[Q] GetSpellCooldown()

Greetings,

When I call GetSpellCooldown() as, for example,

local cd = { GetSpellCooldown( spellId ) }

The returned cooldown value is ALWAYS 0 (zero), i.e., cd[2] is 0 (zero). And, yes, I’ve checked that the spell Id parameter is correct.

What am I missing, here? Thanks

Have you actually cast the spell? 0(zero) in return 2 means “ready to be cast”

https://wow.gamepedia.com/API_GetSpellCooldown

Yes. I’ve called this function pre-cast, post-cast, and while the cooldown was ticking. All return 0. I might give the mixin a try as described in the 8.0 AddOn changes.

Cheers,
P.S. the documentation for the method states that [2] is the duration.

start, duration, enabled, modRate = GetSpellCooldown(“spellName” or spellID or slotID, “bookType”)

One other note: the method works just fine in the WeakAuras code. So, I modified the code to print out debugging statements. I should be able to learn something.

So, it’s back to the target dummies.

Thanks

[Changed Characters Because Blizz wouldn’t let me post until someone else did]

I think my problem is with the spell with which I’m testing, Haunt. There is something odd going on because GetSpellCooldown() works with other spells (e.g., Deathbolt, Vile Taint, etc.), but not with Haunt.

Here’s the log trace from my Addon:

Haunt: Cast Time 1.112, Start time: 0.000, duration 0.000, enabled 0
4.170,SPELL_DAMAGE,Haunt, 33639
4.180,SPELL_AURA_APPLIED,Haunt
Haunt: Cast Time 1.112, Start time: 0.000, duration 0.000, enabled 0
Haunt: Cast Time 1.112, Start time: 0.000, duration 0.000, enabled 0
19.189,SPELL_AURA_REMOVED,Haunt
Haunt: Cast Time 1.112, Start time: 0.000, duration 0.000, enabled 0

Here’s what the trace tells us:

  1. GetSpellInfo() was called before Haunt was cast
  2. Haunt was cast 4.2 secs later and the CD started.
  3. GetSpellInfo() was cast twice while the CD was ticking down
  4. Haunt’s CD expired about 15 seconds later (19.2 secs).
  5. GetSpellInfo() was cast one more time.

Thus, GetSpellInfo() was cast 4 times (once before, twice during, and once after, Haunt) and the same values were returned each time.

I’ll keep looking at this, but I clearly do not yet understand the semantics going on here.

Cheers,
P.S. I’ll need to go back to Weak Auras and see how they calculate the CD for Haunt. Odd that the tooltip says the Haunt CD is 15 secs but the Wowhead description says N/A for the CD.

Edit: Haunt spell id is 48181

AAAAAAaaaaauuugggh. I got the Id from Wowhead just for testing purposes (same with the other Ids - the two that worked). When I plugged the return value from GetSpellInfo() into GetSpellCooldown() it worked great.

Thanks Fizzlemizz - for the info AND your patience.

Cheers