WoW:API GetSpellBookItemName: Difference between revisions
Jump to navigation
Jump to search
→Arguments
(New in 4.0.1) |
|||
| Line 2: | Line 2: | ||
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 [[Events P (Party, Petition, Pet, PlayerBank, Player)#PLAYER_LOGIN|PLAYER_LOGIN]] event. | 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 [[Events P (Party, Petition, Pet, PlayerBank, Player)#PLAYER_LOGIN|PLAYER_LOGIN]] event. | ||
''spellName'', ''spellSubName'' = | ''spellName'', ''spellSubName'' = GetSpellBookItemName( ''spellId'', ''bookType'' ); | ||
== Arguments == | == Arguments == | ||
| Line 14: | Line 14: | ||
:;spellName : String - Name of the spell as it appears in the spellbook, eg. ''"Lesser Heal"'' | :;spellName : String - Name of the spell as it appears in the spellbook, eg. ''"Lesser Heal"'' | ||
:;spellSubName : String - The spell rank or type, eg. ''" | :;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 == | == Example == | ||
| Line 20: | Line 20: | ||
local i = 1 | local i = 1 | ||
while true do | while true do | ||
local spellName, spellSubName = | local spellName, spellSubName = GetSpellBookItemName(i, BOOKTYPE_SPELL) | ||
if not spellName then | if not spellName then | ||
do break end | do break end | ||
| Line 26: | Line 26: | ||
-- use spellName and spellSubName here | -- use spellName and spellSubName here | ||
DEFAULT_CHAT_FRAME:AddMessage( spellName .. '(' .. | DEFAULT_CHAT_FRAME:AddMessage( spellName .. '(' .. spellSubName Rank .. ')' ) | ||
i = i + 1 | i = i + 1 | ||
| Line 35: | Line 35: | ||
== Note == | == Note == | ||
* This function replaced {{api| | * This function replaced {{api|GetSpellName}}() in patch 4.0.1. | ||
* Some spells are not returnable via this function, such as tracking spells (Track Beasts, etc...). | * Some spells are not returnable via this function, such as tracking spells (Track Beasts, etc...). | ||
* Use in conjunction with {{api|GetSpellBookItemInfo}} to determine if a player knows this spell. | * Use in conjunction with {{api|GetSpellBookItemInfo}} to determine if a player knows this spell. | ||