C_SpellBook.GetSpellBookSkillLineInfo

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

Returns info for the specified spellbook skill line.

skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(skillLineIndex)

Arguments

skillLineIndex
number - The index of the skill line, ascending from 1.

Returns

skillLineInfo
SpellBookSkillLineInfo
Field Type Description
name string The name of the spell line (General, Shadow, Fury, etc)
iconID number FileID - The spell icon texture
itemIndexOffset number This value + 1 is the first Spell Book Item slotIndex within this skill line
numSpellBookItems number The number of spell entries in this skill line
isGuild boolean true for Guild Perks, false otherwise
shouldHide boolean
specID number Will be nil if this skill line is not associated with a specialization
offSpecID number Will be nil if this skill line is not associated with a non-active specialization

Details

Example

Prints all spells in the spellbook for the player, except the profession tab ones.

for i = 1, C_SpellBook.GetNumSpellBookSkillLines() do
	local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(i)
	local offset, numSlots = skillLineInfo.itemIndexOffset, skillLineInfo.numSpellBookItems
	for j = offset+1, offset+numSlots do
		local name, subName = C_SpellBook.GetSpellBookItemName(j, Enum.SpellBookSpellBank.Player)
		local spellID = select(2,C_SpellBook.GetSpellBookItemType(j, Enum.SpellBookSpellBank.Player))
		print(i, j, name, subName, spellID)
	end
end

API GetSpellBookItemName 01.png

Prints the spells shown in the profession tab.

for _, i in pairs{GetProfessions()} do
	local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(i)
	local offset, numSlots = skillLineInfo.itemIndexOffset, skillLineInfo.numSpellBookItems
	for j = offset+1, offset+numSlots do
		local name, subName = C_SpellBook.GetSpellBookItemName(j, Enum.SpellBookSpellBank.Player)
		local spellID = select(2,C_SpellBook.GetSpellBookItemType(j, Enum.SpellBookSpellBank.Player))
		print(i, j, name, subName, spellID)
	end
end

> 7, 126, "Tailoring", "", 3908
> 8, 128, "Engineering", "", 4036
> 6, 122, "Cooking", "", 2550
> 6, 123, "Cooking Fire", "", 81

Prints the spells shown in the pet tab.

local numSpells, petToken = C_SpellBook.HasPetSpells()  -- nil if pet does not have spellbook, 'petToken' will usually be "PET"
for i=1, numSpells do
    local petSpellName, petSubType = C_SpellBook.GetSpellBookItemName(i, Enum.SpellBookSpellBank.Pet)
	local spellID = select(2,C_SpellBook.GetSpellBookItemType(i, Enum.SpellBookSpellBank.Pet))
    print("petSpellName", petSpellName)  --like "Dash"
    print("petSubType", petSubType) -- like "Basic Ability" or "Pet Stance"
    print("spellID", spellId)
end

Note that not all spells available from the API are shown in the spellbook.

local i = 1
while C_SpellBook.GetSpellBookItemName(i, Enum.SpellBookSpellBank.Player) do
	print(i, C_SpellBook.GetSpellBookItemName(i, Enum.SpellBookSpellBank.Player))
	i = i + 1
end

Patch changes

The War Within Patch 11.0.0 (Beta): Added, replacement for GetSpellTabInfo.