WoW API: GetCompanionInfo

From AddOn Studio
Revision as of 10:44, 2 August 2008 by WoWWiki>Ackis (Initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.
creatureSpellID
Integer - The Spell ID to cast the companion.
creatureName
String - The name of 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