Originally Posted by
kickmydog
I've been using
PHP Code:
select(2,GetSpellCooldown(spellid)) == 0
for a while now. So that I might know when an ability is available to be used. I am looking however for some code that will enable me to know when an ability will be off it's cooldown before hand. Does anyone have code for that?
So for example I might be able to determine when Bestial Wrath is 2-3s away from being available.
Hey there, I've been using this for my cooldown checking...
Code:
local level = UnitLevel("player")if level == 90 then
conversionfactor = 425
elseif level >= 85 and level < 90 then
conversionfactor = 128.125
elseif level >= 80 and level < 85 then
conversionfactor = 32.79
elseif level >= 70 and level < 80 then
conversionfactor = 15.77
elseif level <= 70 then
conversionfactor = 10
end
spellhaste = GetCombatRating(CR_HASTE_SPELL)
gcd = 1.5 * ( ( 1 + spellhaste / ( conversionfactor * 100 ) ) ^ -1 )
OnCooldown = nil
function OnCooldown(spell)
if IsPlayerSpell(spell) == true then
local start, duration = GetSpellCooldown(spell)
local oncd = ( start > 0 and duration > 0 )
local cdremains = start + duration - GetTime()
if oncd and cdremains > gcd + 0.01 then
return true
else
return false
end
end
end
Hope it helps.