Returns information about a spell. As of 4.1, this function should always return valid data for a spell if the spell is in the player's spellbook (by name or index) or if requested by spell id. When in doubt, if the player does not have the spell in their spellbook, use the numeric id to access its information.
See also Spell functions.
Signature:
name,
rank,
icon,
castingTime,
minRange,
maxRange,
spellID
=
GetSpellInfo(index,
"bookType")
or
GetSpellInfo("name")
or
GetSpellInfo(id)
Arguments:
index
- Index of a spell in the spellbook (number
, spellbookID)bookType
- Type of spellbook (string
)pet
- The pet's spellbookspell
- The player's spellbook
name
- Name of a spell, optionally including secondary text (e.g. "Mana Burn" to find the player's highest rank, or "Mana Burn(Rank 2)" -- no space before the parenthesis -- for a specific rank) (string
)id
- Numeric ID of a spell (number
, spellID)
Returns:
name
- Name of the spell (string
)rank
- Secondary text associated with the spell (e.g."Rank 5", "Racial", etc.) (string
)icon
- Path to an icon texture for the spell (string
)castingTime
- Casting time of the spell in milliseconds (number
)minRange
- Minimum range from the target required to cast the spell (number
)maxRange
- Maximum range from the target at which you can cast the spell (number
)spellID
- Numeric ID of the spell (number
)
Examples:
-- Checking if you can fit in a Chaos Bolt before your multistrike trinket falls off local name, rank, icon, castingTime, minRange, maxRange, spellID = GetSpellInfo(116858) -- we get the castingTime here from GetSpellInfo, note that it returns in milliseconds so we should do *.001 local chaosBoltCastingTime = castingTime*.001 local _, _, _, _, _, _, expires = UnitBuff("Molten Metal") -- getting the remaining time on our multistrike proc local trinketRemaining = expires-GetTime() if chaosBoltCastingTime < trinketRemaining then return true else return false end -- return true if we can fit a chaos bolt before the trinket falls off, false otherwise