Lore archive · Warcraft Wiki, 2023 dump
API GetSpellCooldown
Last wiki revision 2022-09-09
Returns the cooldown info of a spell. start, duration, enabled, modRate = GetSpellCooldown(spell) = GetSpellCooldown(index, bookType)
- startTime: - The time when the cooldown started (as returned by GetTime); zero if no cooldown; current time if (enabled == 0).
- duration: - Cooldown duration in seconds, 0 if spell is ready to be cast.
- enabled: - 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: - The rate at which the cooldown widget's animation should be updated.
The following snippet checks the state of Presence of Mind cooldown. On English clients, you could also use in place of , 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
- To check the Global Cooldown, you can use the spell ID . 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 event is raised.
Source
https://warcraft.wiki.gg/wiki/API_GetSpellCooldown · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.