WoW:API GetEquipmentSetItemIDs: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Created page with '{{wowapi}} Populates a table with item IDs of items in the specified equipment set. itemArray = GetEquipmentSetItemIDs("name"[, returnTable]); ==Parameters== ===Arguments=== ;"...')
 
Line 8: Line 8:
==Returns==
==Returns==
;itemArray : Table - the array portion of this table contains item IDs of the items in the set.
;itemArray : Table - the array portion of this table contains item IDs of the items in 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


==Example==
==Example==
To print all items that are part of the first set:
To print all items that are part of the first set:
  local set = GetEquipmentSetInfo(1);
  local set = GetEquipmentSetInfo(1);
  local itemArray = GetEquipmentSetItemIDs(set);
  local itemArray = GetEquipmentSetItemIDs(set);
  for i=1,#itemArray do
  for i=1, 19 do
  print(i, (GetItemInfo(itemArray[i])));
  if itemArray[i] then
    print(i, (GetItemInfo(itemArray[i])));
  end
  end
  end


NOTE: If the set is a partial set the method 'for i=1, #itemArray do' will not work, as 'i' can possibly be the wrong ids.
where #itemArray returns 2, items 1, 2 may be nil and items 15, 17 may be the correct array indicies
{{API Trail EquipmentManager}}
{{API Trail EquipmentManager}}

Revision as of 14:55, 19 July 2009

WoW API < GetEquipmentSetItemIDs

Populates a table with item IDs of items in the specified equipment set.

itemArray = GetEquipmentSetItemIDs("name"[, returnTable]);

Arguments

"name"
String - equipment set name to retrieve information about.
returnTable
Table, optional - if specified, the array portion of the table is populated with item IDs. If not provided, a new table is creased

Returns

itemArray
Table - the array portion of this table contains item IDs of the items in 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

Example

To print all items that are part of the first set:

local set = GetEquipmentSetInfo(1);
local itemArray = GetEquipmentSetItemIDs(set);
for i=1, 19 do
  if itemArray[i] then
    print(i, (GetItemInfo(itemArray[i])));
  end
end

NOTE: If the set is a partial set the method 'for i=1, #itemArray do' will not work, as 'i' can possibly be the wrong ids.

where #itemArray returns 2, items 1, 2 may be nil and items 15, 17 may be the correct array indicies