What is being done with these recently removed and now converted APIs in 11.0.2 , such as
GetSpellCooldown
converting to
C_Spell.GetSpellCooldown
This change has now made many of my macros for successful casted spells to announce or whisper if activated successfully.
…I had things like yells for cooldown activations, like spell reflect for a warrior so players wouldnt interrupt casts, defensive cooldown uses, aswell as whispers to players for battle rezes, power infusions, innervates and so forth to whisper players on the spell casted successfully…that now all nolonger work with this change.
What must one do to fix this script that the macros might work as previous?
The new function returns a table containing the information rather than x number of return values. You get the information from the table.
https://warcraft.wiki.gg/wiki/API_C_Spell.GetSpellCooldown
eg.
/run local t = C_Spell.GetSpellCooldown(12043) print(t.startTime, t.duration, t.isEnabled, t.modRate)
1 Like
Thank you for the assist, Fizz, but i am totally inept to scripting for this new change…could you assist with just a simple example to a macro string to alter these to the new API?
Previously i had the script of
/run if GetSpellCooldown(“Spell Reflection”) == 0 then SendChatMessage(“Spell Reflection Active”,”yell”); end
/cast Spell Reflection
How would I go about altering this to run properly with the new API?
I know its odd to ask…but i would really appreciate the helping hand.
Something like:
/run if C_Spell.GetSpellCooldown("Spell Reflection").startTime == 0 then SendChatMessage("Spell Reflection Active","yell"); end
/cast Spell Reflection
2 Likes
local GetSpellInfo = GetSpellInfo or function(spellID)
if not spellID then
return nil;
end
local spellInfo = C_Spell.GetSpellInfo(spellID);
if spellInfo then
return spellInfo.name, nil, spellInfo.iconID, spellInfo.castTime, spellInfo.minRange, spellInfo.maxRange, spellInfo.spellID, spellInfo.originalIconID;
end
end