WoW:API GetCompanionInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (→‎Example: : Fixed code to match result)
(Clarify spell ID return value)
Line 20: Line 20:
:;creatureID: Integer - The NPC ID of the companion.
:;creatureID: Integer - The NPC ID of the companion.
:;creatureName: String - The name of the companion.
:;creatureName: String - The name of the companion.
:;creatureSpellID: Integer - The Spell ID to cast the companion.
:;creatureSpellID: Integer - The spell ID to cast the companion.  This is not passed to [[API CallCompanion|CallCompanion]], but can be used with, e.g., [[API GetSpellInfo|GetSpellInfo]].
:;icon: String - The texture of the icon for the companion.
:;icon: String - The texture of the icon for the companion.
:;issummoned: integer - 1 if the companion is summoned, nil if it's not
:;issummoned: integer - 1 if the companion is summoned, nil if it's not

Revision as of 04:12, 20 February 2009

WoW API < GetCompanionInfo


Returns information about the companions you have. New in Patch 3.0

creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("type", id)

Parameters

Arguments

("type")
type
String - The TypeID to query (e.g. "CRITTER", or "MOUNT")
id
Integer - The slot id to query (starts at 1).

Returns

creatureID
Integer - The NPC ID of the companion.
creatureName
String - The name of the companion.
creatureSpellID
Integer - The spell ID to cast the companion. This is not passed to CallCompanion, but can be used with, e.g., GetSpellInfo.
icon
String - The texture of the icon for the companion.
issummoned
integer - 1 if the companion is summoned, nil if it's not

Example

for i=1,GetNumCompanions("CRITTER"),1 do
local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i);
ChatFrame1:AddMessage(creatureID .. " " .. creatureSpellID .. " " .. creatureName .. " " .. icon .. " " .. issummoned) end

Result

Prints all the information regarding your pets to the chat frame.
7555 Hawk Owl 10706 Interface\Icons\Ability_EyeOfTheOwl 1 
7553 Great Horned Owl 10707 Interface\Icons\Ability_EyeOfTheOwl nil