WoW:API GetSpellCooldown: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (bookType rather than tabNumber) |
||
| Line 1: | Line 1: | ||
Retrieves the cooldown data of the spell specified. | Retrieves the cooldown data of the spell specified. | ||
local start, duration = GetSpellCooldown(spellID, | local start, duration = GetSpellCooldown(spellID, "bookType"); | ||
; | ; | ||
| Line 12: | Line 12: | ||
:;spellID : The ID of the spell to retrieve cooldown data for | :;spellID : The ID of the spell to retrieve cooldown data for | ||
:( | :(string bookType) | ||
:; | :;bookType : BOOKTYPE_SPELL or BOOKTYPE_PET depending on whether you wish to query the player or pet spellbook. | ||
---- | ---- | ||
| Line 28: | Line 28: | ||
---- | ---- | ||
;''Example'' | ;''Example'' | ||
local start, duration = GetSpellCooldown(spellID, | local start, duration = GetSpellCooldown(spellID, BOOKTYPE_SPELL); | ||
if ( start > 0 and duration > 0) then | if ( start > 0 and duration > 0) then | ||
Print('Please wait ' .. duration - ( GetTime() - start) .. ' seconds before using this spell.'); | Print('Please wait ' .. duration - ( GetTime() - start) .. ' seconds before using this spell.'); | ||
Revision as of 18:12, 18 March 2006
Retrieves the cooldown data of the spell specified.
local start, duration = GetSpellCooldown(spellID, "bookType");
- Arguments
- (Number spellID)
- spellID
- The ID of the spell to retrieve cooldown data for
- (string bookType)
- bookType
- BOOKTYPE_SPELL or BOOKTYPE_PET depending on whether you wish to query the player or pet spellbook.
- Returns
- (Number startTime, Number duration, Number enable)
- startTime
- The time when the cooldown started (as returned by GetTime()) or zero if no cooldown
- duration
- The number of seconds the cooldown will last, or zero if no cooldown
- enable
- Appears to be set to 1 if this spell is in cooldown, and 0 otherwise.
- Example
local start, duration = GetSpellCooldown(spellID, BOOKTYPE_SPELL);
if ( start > 0 and duration > 0) then
Print('Please wait ' .. duration - ( GetTime() - start) .. ' seconds before using this spell.');
else
Print('Spell is ready.');
end
- Result
- Retrieves data. Does not (to my knowledge) actually change anything.
- "For the Nature's Swiftness spell and posibly other spells that don't start their cooldown timer before they are used up the values retrieved by GetSpellCooldown change over time. The startTime returned is the current time (that this function was called), not the time the spell was cast. The duration is 0.001 not the spell's normal cooldown.
- In this way we can use GetSpellCooldown to see if this type of spell is active on the player without having to look at buffs and debuffs." --Brahgulshin 19:39, 13 March 2006 (EST)
- Description
- Retrieves data on the cooldown of a specific spell within your spellbook.