Bug: 2.1.2 isUsableSpell() not fixed

by Drome | 09/07/2007 17:32:46

Drome

This is especially annoying creating buttons targeted to a unit with spells Power Word: Shield (PWS) and Blessing of Protection (BOP) in eXtremeUnitButtons.

The Issue: For some spells IsUsableSpell returns nil if the "Target" is not valid. This is not consistent across all spells but is true for PWS and BOP. In the end I will have many buttons that cast a spell against their assigned unit which is usually not the "Target" and i need some way of knowing if the spell is castable.

example:

myUsable, myNoMana = IsUsableSpell("Power Word: Shield"); 


returns

myUsable = 1 when no target, or when a party member is targeted; and nil when an NPC or non-party member is selected.

Other Spells in game do not exhibit this reliance on the "Target" for IsSpellUsable. For example "Lesser Heal" returns myUsable = 1 no matter what is targeted (party, NPC, NPC for other Faction).

I created a simple addon with the following functions; then create a macro that calls IUS_test_all().

function IUS_test_all()
myClass = UnitClass("Player");
if myClass == "Priest" then
IUS_TestSpell("Power Word: Shield");
IUS_TestSpell("Lesser Heal");
elseif myClass == "Paladin" then
IUS_TestSpell("Blessing of Protection");
IUS_TestSpell("Holy Light");
IUS_TestSpell("Holy Shock");
end
DEFAULT_CHAT_FRAME:AddMessage(" ");
end


function IUS_TestSpell(mySpell)
local myUsable;
local myNoMana;
myUsable, myNoMana = IsUsableSpell(mySpell);
if myUsable == nil then myUsable = "nil" end;
if myNoMana == nil then myNoMana = "nil" end;
DEFAULT_CHAT_FRAME:AddMessage(" For " .. mySpell .. " myUsable = " .. myUsable .. ", myNoMana = " .. myNoMana);
end

by Slouken | 09/07/2007 18:19:45

Slouken

This is by design, because of the special target state requirements for the spell.

by Slouken | 09/07/2007 19:08:12

Slouken

You should be passing the target in, and it will work properly. (or if it doesn't now, it does in 2.2)

Bump! Recently Bumped Threads

 

Blizzard Announcement Recent Blizzard Announcements

 

We suggest