More questions in pursuit of developing my AddOn...
I'm pretty sure I've figured out how to check if we're in the GCD and, if so, how long until it's over. I'm using the following code:
local function getGlobalCooldownEnds()
local spells = { "Raptor Strike", "Serpent Sting", "Mend Pet" }
local start, dur
for i,spell in pairs(spells) do
start, dur = GetSpellCooldown(GetSpellID(spell), BOOKTYPE_SPELL)
Debug("GCD: " .. spell .. " start=" .. tostring(start) .. " dur=" .. tostring(dur))
if ((start ~= nil and dur ~= nil) and (start > 0 and dur > 0 and dur <= 2)) then
return (start + dur)
end
end
return 0
end
Does that look about right?
Next, I'm trying to ask "When was the last time SpellX was cast, and how long until it's cooldown is up?". From the best I can tell, it's not actually possible to get this information. I tried using
GetSpellCooldown, but that returns the same start time for every ranged spell. I suppose that makes sense, since that's how the GCD logic uses it to figure out it's information. However, I can't figure out how to get the information about a specific spell.
Anyone happen to have any thoughts?