GetSpellBookItemInfo
Jump to navigation
Jump to search
Returns info for a spellbook item.
spellType, id = GetSpellBookItemInfo(spellName) = GetSpellBookItemInfo(index, bookType)
Arguments
- spellName
- string - Requires the spell to be in your Spellbook.
Spellbook args | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
Returns
- spellType
- string - The type of the spell:
["SPELL", "FUTURESPELL", "PETACTION", "FLYOUT"]
- id
- number
- For SPELL and FUTURESPELL, the SpellID used in GetSpellInfo()
- For PETACTION, the ActionID used in C_ActionBar.HasPetActionButtons(); furthermore, the SpellID can be obtained by applying the bitmask 0xFFFFFF.
- For FLYOUT, the FlyoutID used in GetFlyoutInfo()
Details
Related API | GetSpellBookItemName |
Example
Prints all spells in the spellbook for the player, except the profession tab ones.
local spellFunc = {
SPELL = GetSpellInfo,
FUTURESPELL = GetSpellInfo,
FLYOUT = GetFlyoutInfo,
}
for i = 1, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
for j = offset+1, offset+numSlots do
local spellType, id = GetSpellBookItemInfo(j, BOOKTYPE_SPELL)
local spellName = spellFunc[spellType](id)
print(i, j, spellType, id, spellName)
end
end
Prints all pet spells.
for i = 1, HasPetSpells() do
local spellType, id = GetSpellBookItemInfo(i, BOOKTYPE_PET)
local spellID = bit.band(0xFFFFFF, id)
-- not sure what the non-spell IDs are
local spellName = spellID > 100 and GetSpellInfo(spellID) or GetSpellBookItemName(i, BOOKTYPE_PET)
local hasActionButton = C_ActionBar.HasPetActionButtons(id)
print(i, spellType, id, spellID, spellName, hasActionButton)
end