Originally Posted by
blaythe
Thank you! I'd rep you again but I have to spread it around apparently.
That actually won't return the correct cooldown. You have to do it like this:
PHP Code:
local SpellStart, SpellDuration = GetSpellCooldown(SpelID)
local SpellCooldown = SpellStart + SpellDuration - GetTime()
I just have a function in my data file to simplify it.
PHP Code:
function PQR_GetSpellCooldown(ID)
local SpellStart, SpellDuration = GetSpellCooldown(ID)
local SpellCooldown = SpellStart - GetTime() + SpellDuration
if SpellCooldown < 0 then
SpellCooldown = 0
end
return SpellCooldown
end
Then it'd just be:
PHP Code:
if PQR_GetSpellCooldown(SpellID) < x then
--blabla
end
The default GetSpellCooldown function is only useful for checking if a cooldown is 0.