Added: As of 3.3.x it is possible to use GetSpellCooldown(Spellid)
mNo edit summary |
(Added: As of 3.3.x it is possible to use GetSpellCooldown(Spellid)) |
||
| Line 2: | Line 2: | ||
Retrieves the cooldown data of the spell specified. | Retrieves the cooldown data of the spell specified. | ||
start, duration, enabled = GetSpellCooldown(spellName or slotID, "bookType"); | start, duration, enabled = GetSpellCooldown(spellName or spellID or slotID, "bookType"); | ||
==Arguments== | ==Arguments== | ||
:;spellName : String - name of the spell to retrieve cooldown data for. | :;spellName : String - name of the spell to retrieve cooldown data for. | ||
:;spellID : Number - ID of the spell in the database | |||
:;slotID : Number - Valid values are 1 through total number of spells in the spellbook on all pages and all tabs, ignoring empty slots. | :;slotID : Number - Valid values are 1 through total number of spells in the spellbook on all pages and all tabs, ignoring empty slots. | ||
:;bookType : String - BOOKTYPE_SPELL or BOOKTYPE_PET depending on whether you wish to query the player or pet spellbook. | :;bookType : String - BOOKTYPE_SPELL or BOOKTYPE_PET depending on whether you wish to query the player or pet spellbook. | ||
| Line 33: | Line 34: | ||
Example of using SpellIDs to retrieve cooldown info | Example of using SpellIDs to retrieve cooldown info | ||
==Example== | |||
local start, duration, enabled = GetSpellCooldown(48505); | |||
===Result=== | |||
returns 0, 0, 1 if the spell 'Starfall' is not on Cooldown | |||
otherwise it returns GetTime(), 90, 1 | |||
| Line 38: | Line 47: | ||
*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. | *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. | *Values returned by this function are not updated immediately when UNIT_SPELLCAST_SUCCEEDED event is raised. | ||
*GetSpellCooldown() does not directly accept SpellIDs. You must first retrieve the spell name using GetSpellInfo(spellID) | *GetSpellCooldown() does not directly accept SpellIDs. You must first retrieve the spell name using GetSpellInfo(spellID) [Seems out of date as of 3.3] | ||
*GetSpellCooldown() accepts SpellIDs [Noticed in 3.3.2 - but worked with it as of 3.3] | |||