C_SpellBook .GetSpellBookItemName
Jump to navigation
Jump to search
Flavors |
---|
Links |
Info |
Added in 11.0.0 |
![]() |
This API only exists on the 11.0.0 Public Test Realm |
Returns the name of a spellbook item.
spellName, spellSubName = C_SpellBook.GetSpellBookItemName(index, spellBank)
Arguments
- index
- number - Spellbook slot index, ranging from 1 through the total number of spells across all tabs and pages
- spellBank
- enum - Enum.SpellBookSpellBank.Player or Enum.SpellBookSpellBank.Pet
Returns
- spellName
- string - Name of the spell as it appears in the spell book, e.g. "Lesser Heal"
- spellSubName
- string - The spell rank or sub type, e.g. "Grand Master", "Racial Passive". This can be an empty string. Note: for the Enchanting trade skill at rank Apprentice, the returned string contains a trailing space, i.e. "Apprentice ". This might be the case for other trade skills and ranks also. Not readily available on function call, see SpellMixin:ContinueOnSpellLoad()
Details
Related API | C_SpellBook.GetSpellBookItemInfo |
- This function will return nested flyout spells, but the names returned may not be functional (a hunter will see "Call <petname>" instead of "Call Pet 1" but "/cast Call <petname>" will not function in a macro or from the command line). Use care with the results returned.
- Spell book information is first available after the SPELLS_CHANGED event fires.
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
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
Patch 11.0.0 (Beta): Added, replacement for GetSpellBookItemName.