WoW:API GetCompanionInfo: Difference between revisions

m
Line 23: Line 23:
: Integer - 15 and 31 (0x0f and 0x1f) for flying mounts, 29 (0x1d) for ground mounts, 12 (0x0c) for water mounts and nil for companions. Difference between flying mount values unknown.
: Integer - 15 and 31 (0x0f and 0x1f) for flying mounts, 29 (0x1d) for ground mounts, 12 (0x0c) for water mounts and nil for companions. Difference between flying mount values unknown.


== Example ==
== Examples ==
;Example 1
  for i=1,GetNumCompanions("CRITTER") do
  for i=1,GetNumCompanions("CRITTER") do
     local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i);
     local creatureID, creatureName, creatureSpellID, icon, issummoned = GetCompanionInfo("CRITTER", i);
     print(creatureID, creatureSpellID, creatureName, icon, issummoned)
     print(creatureID, creatureSpellID, creatureName, icon, issummoned)
  end
  end
 
Prints all the information regarding your pets to the chat frame:
===Result===
:Prints all the information regarding your pets to the chat frame.
  7555 Hawk Owl 10706 Interface\Icons\Ability_EyeOfTheOwl 1  
  7555 Hawk Owl 10706 Interface\Icons\Ability_EyeOfTheOwl 1  
  7553 Great Horned Owl 10707 Interface\Icons\Ability_EyeOfTheOwl nil
  7553 Great Horned Owl 10707 Interface\Icons\Ability_EyeOfTheOwl nil


== Example 2 ==
;Example 2
  for i = 1, GetNumCompanions("MOUNT") do
  for i = 1, GetNumCompanions("MOUNT") do
     local _,name,_,_,_,typeID,typeString = GetCompanionInfo("mount", i)
     local _,name,_,_,_,typeID,typeString = GetCompanionInfo("mount", i)
Line 45: Line 44:
  end
  end


===Result===
Prints the name of all of your mounts, followed by their mount type:
:Prints the name of all of your mounts, followed by their mount type.
  Abyssal Seahorse Water
  Abyssal Seahorse Water
  Black Drake Mount Flying
  Black Drake Mount Flying