WoW:API GetSpellBookItemName and WoW:API TYPE partyCategoryType: Difference between pages

From AddOn Studio
(Difference between pages)
Jump to navigation Jump to search
 
(Created page with "{{wowapi}} API LE PARTY CATEGORY is a common set of parameters for determining a special Group type. == Uses == : groupType - (optional) the type of group :: Default is...")
 
Line 1: Line 1:
{{wowapi}}
{{wowapitype}}
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'' = GetSpellBookItemName( ''spellId'', ''bookType'' );
A common set of parameters for determining a special Group type. Added in 5.0.4.


== Arguments ==
== Values ==
* LE_PARTY_CATEGORY_HOME - the local or manually created group.
* LE_PARTY_CATEGORY_INSTANCE - the player's automatic battleground, arena, or dungeon finder group.


:;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.
== Uses ==
: groupType - (optional) the type of group. Default is 'LE_PARTY_CATEGORY_INSTANCE' if in an instance group, otherwise 'LE_PARTY_CATEGORY_HOME'.


:;bookType : String - Either '''BOOKTYPE_SPELL''' ("spell") or '''BOOKTYPE_PET''' ("pet").
== Details ==
The purpose is to differentiate when a player is a member of more than one group, which group is meant. A player can be in a locally created group or an automatic group (ala Finder).


== Returns ==
=== Examples ===
/run local x=UnitIsGroupLeader("Player", LE_PARTY_CATEGORY_INSTANCE); SendChatMessage(tostring(x))
/run local x=UnitIsGroupLeader("Player", LE_PARTY_CATEGORY_HOME); SendChatMessage(tostring(x))
For example if you logged in, then joined a normal finder dungeon group and happend to be the leader, then using 'LE_PARTY_CATEGORY_INSTANCE' on UnitIsGroupLeader for yourself, will return 'true' and using 'LE_PARTY_CATEGORY_HOME' will return 'false'. This is because in your 'home world' or 'explicit group' you are not in a 'group' and you are no 'leader' there, but in the 'foriegn world' or 'automatic group' you are the 'leader'.


:;spellName : String - Name of the spell as it appears in the spellbook, eg. ''"Lesser Heal"''
== Changes ==
* [[Patch 5.0.4]] - added.


:;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.
== See also ==
 
* {{api|GetNumGroupMembers}}
== Example ==
* {{api|GetNumSubgroupMembers}}
 
* {{api|UnitIsGroupLeader}}
local i = 1
* {{api|UnitIsGroupAssistant}}
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 ==
* Displays every spell in the player's spellbook, on all pages and all tabs, in the format required by [[API_CastSpellByName|CastSpellByName]].
 
== Note ==
* 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...).
* Use in conjunction with {{api|GetSpellBookItemInfo}} to determine if a player knows this spell.

Revision as of 18:51, 25 September 2012

API types < partyCategoryType

A common set of parameters for determining a special Group type. Added in 5.0.4.

Values

  • LE_PARTY_CATEGORY_HOME - the local or manually created group.
  • LE_PARTY_CATEGORY_INSTANCE - the player's automatic battleground, arena, or dungeon finder group.

Uses

groupType - (optional) the type of group. Default is 'LE_PARTY_CATEGORY_INSTANCE' if in an instance group, otherwise 'LE_PARTY_CATEGORY_HOME'.

Details

The purpose is to differentiate when a player is a member of more than one group, which group is meant. A player can be in a locally created group or an automatic group (ala Finder).

Examples

/run local x=UnitIsGroupLeader("Player", LE_PARTY_CATEGORY_INSTANCE); SendChatMessage(tostring(x))
/run local x=UnitIsGroupLeader("Player", LE_PARTY_CATEGORY_HOME); SendChatMessage(tostring(x))

For example if you logged in, then joined a normal finder dungeon group and happend to be the leader, then using 'LE_PARTY_CATEGORY_INSTANCE' on UnitIsGroupLeader for yourself, will return 'true' and using 'LE_PARTY_CATEGORY_HOME' will return 'false'. This is because in your 'home world' or 'explicit group' you are not in a 'group' and you are no 'leader' there, but in the 'foriegn world' or 'automatic group' you are the 'leader'.

Changes

See also