Fandom

WoWWiki

API GetSpellBookItemName

104,642pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

WoW API < GetSpellBookItemName

Retrieves the spell name and spell rank for a spell in the player's spellbook. If you're trying to read the spell book at login, register for the PLAYER_LOGIN event.

spellName, spellSubName = GetSpellBookItemName( spellId, bookType );

Arguments Edit

spellId 
Integer - Spell ID. Valid values are 1 through total number of spells in the spellbook on all pages and all tabs, ignoring empty slots.
bookType 
String - Either BOOKTYPE_SPELL ("spell") or BOOKTYPE_PET ("pet").

Returns Edit

spellName 
String - Name of the spell as it appears in the spellbook, eg. "Lesser Heal"
spellSubName 
String - The spell rank or sub type, eg. "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, ie. "Apprentice ". This might be the case for other trade skills and ranks also.

Example Edit

local i = 1
while true do
   local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_SPELL)
   if not spellName then
      do break end
   end
   
   -- use spellName and spellSubName here
   DEFAULT_CHAT_FRAME:AddMessage( spellName .. '(' .. spellSubName .. ')' )
   
   i = i + 1
end

Result Edit

  • Displays every spell in the player's spellbook, on all pages and all tabs, in the format required by CastSpellByName.

Note Edit

  • This function replaced GetSpellName() in patch 4.0.1.
  • Some spells are not returnable via this function, such as tracking spells (Track Beasts, etc...).
  • Use in conjunction with GetSpellBookItemInfo to determine if a player knows this spell.

Also on Fandom

Random Wiki