No edit summary Tag: WoW API docs |
Tag: WoW API docs |
||
Line 7: | Line 7: | ||
;spellName : <span class="apitype">string</span> - Spell book item name. |
;spellName : <span class="apitype">string</span> - Spell book item name. |
||
---- |
---- |
||
− | ;index : <span class="apitype">number</span> - Spellbook slot index, ranging from 1 through total number of spells in the spell book on all pages and |
+ | ;index : <span class="apitype">number</span> - Spellbook slot index, ranging from 1 through total number of spells in the spell book on all pages and tabs. |
;bookType: <span class="apitype">string</span> - <code>BOOKTYPE_SPELL</code> or <code>BOOKTYPE_PET</code> depending on if you wish to query the player or pet spellbook. Internally the game only tests if this is equal to <code>"pet"</code> and treats any other string value as "spell". |
;bookType: <span class="apitype">string</span> - <code>BOOKTYPE_SPELL</code> or <code>BOOKTYPE_PET</code> depending on if you wish to query the player or pet spellbook. Internally the game only tests if this is equal to <code>"pet"</code> and treats any other string value as "spell". |
||
{{:Const_BOOKTYPE}} |
{{:Const_BOOKTYPE}} |
Revision as of 19:34, 22 May 2022
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Retrieves the spell name and spell rank for a spell in the player's spell book.
spellName, spellSubName, spellID = GetSpellBookItemName(spellName) = GetSpellBookItemName(index, bookType)
Arguments
- spellName
- string - Spell book item name.
- index
- number - Spellbook slot index, ranging from 1 through total number of spells in the spell book on all pages and tabs.
- bookType
- string -
BOOKTYPE_SPELL
orBOOKTYPE_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
- 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()
- spellID
- number
Details
- 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..
- Use in conjunction with GetSpellBookItemInfo to determine if a player knows this spell.
- 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, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
for j = offset+1, offset+numSlots do
print(i, j, GetSpellBookItemName(j, BOOKTYPE_SPELL))
end
end
Patch changes
- Patch 4.0.1 (2010-10-12): Added. Replaces GetSpellName()