GetSpellCooldown
Jump to navigation
Jump to search
![]() ![]() ![]() ![]() |
C_Spell.GetSpellCooldown |
![]() ![]() |
+ 11.0.0 |
![]() ![]() ![]() ![]() |
C_SpellBook.GetSpellBookItemCooldown |
![]() ![]() |
+ 11.0.0 |
![]() ![]() |
GetSpellCooldown |
![]() ![]() |
+ 1.0.0, - 11.0.0 |
![]() |
This function was deprecated in patch 11.0.0 and will be removed in patch 11.0.2. |
Returns the cooldown info of a spell.
start, duration, enabled, modRate = GetSpellCooldown(spell) = GetSpellCooldown(index, bookType)
Arguments
- spell
- number|string - Spell ID or Name. When passing a name requires the spell to be in your Spellbook.
Spellbook args | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
Returns
- startTime
- number - The time when the cooldown started (as returned by GetTime()); zero if no cooldown; current time if (enabled == 0).
- duration
- number - Cooldown duration in seconds, 0 if spell is ready to be cast.
- enabled
- number - 0 if the spell is active (Stealth, Shadowmeld, Presence of Mind, etc) and the cooldown will begin as soon as the spell is used/cancelled; 1 otherwise.
- modRate
- number - The rate at which the cooldown widget's animation should be updated.
Details
Related Events | SPELL_UPDATE_COOLDOWN |
Example
The following snippet checks the state of [Presence of Mind] cooldown. On English clients, you could also use
"Presence of Mind"
in place of 12043
, which is the spell's ID.
local start, duration, enabled, modRate = GetSpellCooldown(12043) if enabled == 0 then print("Presence of Mind is currently active, use it and wait " .. duration .. " seconds for the next one.") elseif ( start > 0 and duration > 0) then local cdLeft = start + duration - GetTime() print("Presence of Mind is cooling down, wait " .. cdLeft .. " seconds for the next one.") else print("Presence of Mind is ready.") end
Details
- To check the Global Cooldown, you can use the spell ID
61304
. This is a dummy spell specifically for the GCD. - The enabled return value allows addons to easily check if the player has used a buff-providing spell (such as Presence of Mind or Nature's Swiftness) without searching through the player's buffs.
- Values returned by this function are not updated immediately when UNIT_SPELLCAST_SUCCEEDED event is raised.
Patch changes
Patch 11.0.0 (2024-07-23): Removed, replaced by C_Spell.GetSpellCooldown and C_SpellBook.GetSpellBookItemCooldown.
Patch 7.1.0 (2016-10-25): The
modRate
return value was added.
Patch 6.2.0 (2015-06-23): The
charges
and maxCharges
return values were removed. They were moved to GetSpellCharges.