Mercurial > wow > mylilpony
changeset 58:d3d070ea6341 1.2.1
Fixed CallMountXYZ functions to always exclude unusable mounts
(e.g. faction and profession specific mounts).
author | syzler |
---|---|
date | Wed, 24 Jun 2015 21:00:10 -0400 |
parents | 01083a070f3b |
children | 12b9c632919d |
files | libMyLilPony/libMyLilPony_mountFunctions.lua |
diffstat | 1 files changed, 24 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/libMyLilPony/libMyLilPony_mountFunctions.lua Tue Jun 23 22:56:21 2015 -0400 +++ b/libMyLilPony/libMyLilPony_mountFunctions.lua Wed Jun 24 21:00:10 2015 -0400 @@ -42,8 +42,8 @@ -- @return A Boolean value indicating whether or not a mount was successfully summoned. function MyLilPony.CallMount() local filter = function (i) - local _, _, _, summoned = C_MountJournal.GetMountInfo(i); - return not summoned; + local _, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); + return not summoned and usable; end return MyLilPony.CallMountByFilter(filter); end @@ -53,8 +53,8 @@ -- @return A Boolean value indicating whether or not a mount was successfully summoned. function MyLilPony.CallFlyingMount() local filter = function (i) - local _, id, _, summoned = C_MountJournal.GetMountInfo(i); - return not summoned and MyLilPony.IsFlyingMountSlot(i); + local _, id, _, summoned, usable = C_MountJournal.GetMountInfo(i); + return not summoned and usable and MyLilPony.IsFlyingMountSlot(i); end return MyLilPony.CallMountByFilter(filter); end @@ -64,8 +64,8 @@ -- @return A Boolean value indicating whether or not a mount was successfully summoned. function MyLilPony.CallGroundMount() local filter = function (i) - local _, id, _, summoned = C_MountJournal.GetMountInfo(i); - return not summoned and MyLilPony.IsGroundMountSlot(i); + local _, id, _, summoned, usable = C_MountJournal.GetMountInfo(i); + return not summoned and usable and MyLilPony.IsGroundMountSlot(i); end return MyLilPony.CallMountByFilter(filter); end @@ -75,8 +75,8 @@ -- @return A Boolean value indicating whether or not a mount was successfully summoned. function MyLilPony.CallAquaticMount() local filter = function (i) - local _, id, _, summoned = C_MountJournal.GetMountInfo(i); - return not summoned and MyLilPony.IsAquaticMountSlot(i); + local _, id, _, summoned, usable = C_MountJournal.GetMountInfo(i); + return not summoned and usable and MyLilPony.IsAquaticMountSlot(i); end return MyLilPony.CallMountByFilter(filter); end @@ -88,8 +88,8 @@ function MyLilPony.CallMountBySlot(slotNumber) local countMounts = C_MountJournal.GetNumMounts(); if slotNumber > 0 and slotNumber < countMounts+1 then - local _, _, _, summoned = C_MountJournal.GetMountInfo(i); - MyLilPony.CallMount(slotNumber, not summoned); + local _, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); + MyLilPony.CallMount(slotNumber, not summoned and usable); return true; end return false; @@ -102,9 +102,9 @@ function MyLilPony.CallMountByName(mountName) local result = false; for i in MyLilPony.EnumerateKnownMountSlotIDs() do - local name, _, _, summoned = C_MountJournal.GetMountInfo(i); + local name, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); if name == mountName then - MyLilPony.CallMount(i, not summoned); + MyLilPony.CallMount(i, not summoned and usable); result = true; do break end end @@ -119,8 +119,8 @@ -- @return A Boolean value indicating whether or not a mount was successfully summoned. function MyLilPony.CallMountByPattern(mountNamePattern) local filter = function (i) - local name, _, _, summoned = C_MountJournal.GetMountInfo(i); - return not summoned and MyLilPony.StringMatchIgnoreCase(name, mountNamePattern); + local name, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); + return not summoned and usable and MyLilPony.StringMatchIgnoreCase(name, mountNamePattern); end return MyLilPony.CallMountByFilter(filter); end @@ -132,10 +132,10 @@ function MyLilPony.CallMountById(id) local result = false; for i in MyLilPony.EnumerateKnownMountSlotIDs() do - local _, spellId, _, summoned = C_MountJournal.GetMountInfo(i); + local _, spellId, _, summoned, usable = C_MountJournal.GetMountInfo(i); local creatureId = C_MountJournal.GetMountInfoExtra(i); if id == creatureId or id == spellId then - MyLilPony.CallMount(i, not summoned); + MyLilPony.CallMount(i, not summoned and usable); result = true; do break end end @@ -150,9 +150,9 @@ function MyLilPony.CallMountBySpell(spellId) local result = false; for i in MyLilPony.EnumerateKnownMountSlotIDs() do - local _, id, _, summoned = C_MountJournal.GetMountInfo(i); + local _, id, _, summoned, usable = C_MountJournal.GetMountInfo(i); if id == spellId then - MyLilPony.CallMount(i, not summoned); + MyLilPony.CallMount(i, not summoned and usable); result = true; do break end end @@ -167,10 +167,10 @@ function MyLilPony.CallMountByCreature(creatureId) local result = false; for i in MyLilPony.EnumerateKnownMountSlotIDs() do - local _, _, _, summoned = C_MountJournal.GetMountInfo(i); + local _, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); local id = C_MountJournal.GetMountInfoExtra(i); if id == creatureId then - MyLilPony.CallMount(i, not summoned); + MyLilPony.CallMount(i, not summoned and usable); result = true; do break end end @@ -189,9 +189,9 @@ local result = false; local unitBuffs = MyLilPony.GetUnitBuffs(unit); for i in MyLilPony.EnumerateKnownMountSlotIDs() do - local _, id, _, summoned = C_MountJournal.GetMountInfo(i); + local _, id, _, summoned, usable = C_MountJournal.GetMountInfo(i); if unitBuffs[id] ~= nil then - MyLilPony.CallMount(i, not summoned); + MyLilPony.CallMount(i, not summoned and usable); result = true; do break end end @@ -220,8 +220,8 @@ if x > 0 then local i = mounts[random(1, x)]; - local _, _, _, summoned = C_MountJournal.GetMountInfo(i); - MyLilPony.CallMount(i, not summoned); + local _, _, _, summoned, usable = C_MountJournal.GetMountInfo(i); + MyLilPony.CallMount(i, not summoned and usable); return true; end return false;