Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Returns spell info.
name, rank, icon, castTime, minRange, maxRange, spellID, originalIcon = GetSpellInfo(spell) = GetSpellInfo(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[]
- name
- string - The localized name of the spell.
- rank
- string - Always returns
nil
. Refer to GetSpellSubtext() for retrieving the rank of spells on Classic. - icon
- number : FileID - The spell icon texture.
- castTime
- number - Cast time in milliseconds, or 0 for instant spells.
- minRange
- number - Minimum range of the spell, or 0 if not applicable.
- maxRange
- number - Maximum range of the spell, or 0 if not applicable.
- spellID
- number - The ID of the spell.
- originalIcon
- number : FileID - The original icon texture for this spell.
Details[]
- The player's form or stance may affect return values on relevant spells, such as a warlock's Corruption spell transforming to Doom while Metamorphosis is active.
- When dealing with base spells that have been overridden by another spell, the
icon
return will represent the icon of the overriding spell, andoriginalIcon
the icon of the base spell.- For example, if a Rogue has learned [Gloomblade] then any queries for [Backstab] will yield Gloomblades' icon as the
icon
return, and the original icon for Backstab would be exposed through theoriginalIcon
return value.
- For example, if a Rogue has learned [Gloomblade] then any queries for [Backstab] will yield Gloomblades' icon as the
Example[]
/dump GetSpellInfo(2061) -- "Flash Heal", nil, 135907, 1352, 0, 40, 2061
Some spell data - such as subtext and description - are load on demand. You can use SpellMixin:ContinueOnSpellLoad() to asynchronously query the data.
local spell = Spell:CreateFromSpellID(139)
spell:ContinueOnSpellLoad(function()
local name = spell:GetSpellName()
local desc = spell:GetSpellDescription()
print(name, desc) -- "Renew", "Fill the target with faith in the light, healing for 295 over 15 sec."
end)
Patch changes[]
Patch 10.0.0 (2022-10-25): Added originalIcon
return value.
Patch 8.0.1 (2018-07-17): The rank
return value is now always nil
.[1]
Patch 6.0.2 (2014-10-14): Removed cost, isFunnel, powerType
return values.
References[]
- ^ Battle for Azeroth Addon Changes by Ythisens, 24 Apr 2018