Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards.
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
index
number - Spellbook slot index, ranging from 1 through the total number of spells across all tabs and pages.
bookType
string - BOOKTYPE_SPELL
or BOOKTYPE_PET
depending on if you wish to query the player or pet spellbook.
Internally the game only tests if this is equal to "pet"
and treats any other string value as "spell".
Constant
Value
Description
BOOKTYPE_SPELL
"spell"
The General, Class, Specs and Professions tabs[1]
BOOKTYPE_PET
"pet"
The Pet tab
Returns [ ]
spellType
string - The type of the spell: ["SPELL", "FUTURESPELL", "PETACTION", "FLYOUT"]
id
number
Details [ ]
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