C_Spell.GetSpellInfo

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 11.0.0

Returns spell info.

spellInfo = C_Spell.GetSpellInfo(spellIdentifier)

Arguments

spellIdentifier
number|string|link - New "spellIdentifier" parameter type accepts a Spell ID, name, name(subtext), or link.

Returns

spellInfo
SpellInfo
Field Type Description
name string The localized name of the spell
iconID number fileID - The spell icon texture
originalIconID number fileID - The original icon texture for this spell
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

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 iconID return will represent the icon of the overriding spell, and originalIconID 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 iconID return, and the original icon for Backstab would be exposed through the originalIconID return value.

Example

/dump C_Spell.GetSpellInfo(2061) -- [1]={castTime=1317, name="Flash Heal", minRange=0, originalIconID=135907, iconID=135907, maxRange=40, spellID=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

The War Within Patch 11.0.0 (Beta): Added, replacement for GetSpellInfo and C_SpellBook.GetSpellInfo.