→ WoW API
Retrieves the cooldown data of the spell specified.
start, duration, enabled = GetSpellCooldown("spellName" or spellID or slotID, "bookType")
- String - name of the spell to query.
- Number - ID of the spell to query.
- Number - index of a spell book slot to query, integers ascending from 1.
- String - spell book category, e.g. BOOKTYPE_SPELL ("spell") or BOOKTYPE_PET ("pet").
- Number - The time when the cooldown started (as returned by GetTime()); zero if no cooldown; current time if (enabled == 0).
- Number - Cooldown duration in seconds, 0 if spell is ready to be cast.
- 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.
local start, duration, enabled = 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
- 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.