WoW:API GetEquipmentSetLocations: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with '{{wowapi}} Populates a table with the location/status of each slot in the specified equipment set. infoArray = GetEquipmentSetLocations("name"); ==Arguments== ;"name" : String …')
 
(Correcting return value for supplied infoArray)
Line 1: Line 1:
{{wowapi}}
{{wowapi}}
Populates a table with the location/status of each slot in the specified equipment set.
Populates a table with the location/status of each slot in the specified equipment set.
  infoArray = GetEquipmentSetLocations("name");
  infoArray = GetEquipmentSetLocations("name"[, infoArray]);


==Arguments==
==Arguments==
;"name" : String - equipment set name to retrieve information about.
;"name" : String - equipment set name to retrieve information about.
;infoArray : Table - optional if you don't want a new return table created. (Recommended if you call this multiple times)
==Returns==
==Returns==
;infoArray : Table - the array portion of this table contains information on each of the slots for the set.
;infoArray : Table - the array portion of this table contains information on each of the slots for the set.
Line 30: Line 32:
==Notes==
==Notes==


A value of 0 for a slot means the slot should be emptied. A value of 1 means the slot
If '''"name"''' is not a valid equipment set, the function will not return any value.
is not part of the set (don't change it). A value of -1 means the slot should contain an item but it is not available.


Other values indicate that the slot should contain an item and identifies it as the following:
If you supply infoArray as an argument, the elements [0..19] of the array will be set accordingly and all other values are left unchanged. If successful, the return value of the function will be a reference to the passed infoArray.


local locationtype = bit.rshift(value, 16);
If you do not supply infoArray as an argument, a new table is created and returned by the function.
if locationtype == 0x10 then
  // Equipped
  local slot = bit.band(value, 0xff);
elseif locationtype == 0x30 then
  // In bag
  local bag = bit.band(bit.rshift(value, 8), 0xff);
  local slot = bit.band(value, 0xff);
elseif locationtype == 0x40 then
  // In bank
  local slot = bit.band(value, 0xff);
elseif locationtype == 0x60 then
  // In bank bags (1 to 7, i.e. add NUM_BAG_SLOTS to use as a [[BagId]])
  local bag = bit.band(bit.rshift(value, 8), 0xff);
  local slot = bit.band(value, 0xff);
end


The values for each slot [0..19] of infoArray can be examined as follows:
* -1 : The item for this slot is unavailable.
*  0 : The slot should be emptied.
*  1 : This slot is ignored by the equipment set, no change will be made.
* Any other value can be examined by calling [[API_EquipmentManager_UnpackLocation|EquipmentManager_UnpackLocation]](value).




{{API Trail EquipmentManager}}
{{API Trail EquipmentManager}}

Revision as of 05:23, 29 April 2010

WoW API < GetEquipmentSetLocations

Populates a table with the location/status of each slot in the specified equipment set.

infoArray = GetEquipmentSetLocations("name"[, infoArray]);

Arguments

"name"
String - equipment set name to retrieve information about.
infoArray
Table - optional if you don't want a new return table created. (Recommended if you call this multiple times)

Returns

infoArray
Table - the array portion of this table contains information on each of the slots for the set.
0: Ammo
1: Head
2: Neck
3: Shoulder
4: Shirt
5: Chest
6: Belt
7: Legs
8: Feet
9: Wrist
10: Gloves
11: Finger 1
12: Finger 2
13: Trinket 1
14: Trinket 2
15: Back
16: Mmain hand
17: Off hand
18: Ranged
19: Tabard

Notes

If "name" is not a valid equipment set, the function will not return any value.

If you supply infoArray as an argument, the elements [0..19] of the array will be set accordingly and all other values are left unchanged. If successful, the return value of the function will be a reference to the passed infoArray.

If you do not supply infoArray as an argument, a new table is created and returned by the function.

The values for each slot [0..19] of infoArray can be examined as follows:

  • -1 : The item for this slot is unavailable.
  • 0 : The slot should be emptied.
  • 1 : This slot is ignored by the equipment set, no change will be made.
  • Any other value can be examined by calling EquipmentManager_UnpackLocation(value).