WoW API: GetCompanionInfo

Revision as of 19:54, 5 November 2008 by WoWWiki>DrDoom (→‎Returns: Changed the order of the return variables to match the example given.)

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.
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) 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