(Keyring gone) |
Tag: WoW API docs |
||
(36 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{stub/API}} |
||
{{wowapitype}} |
{{wowapitype}} |
||
+ | Inventory slots refer to a unique [[equipment]] or [[BagID|bag]] slot. |
||
+ | * For equipment, slot names are resolved to a slot id [https://www.townlong-yak.com/framexml/9.0.2/Constants.lua#192 constant] with {{api|GetInventorySlotInfo}}(). This gives Blizzard more flexibility to possibly change slot ids. |
||
− | You may obtain the IDs either by calling [[API GetInventorySlotInfo|GetInventorySlotInfo]], [[API ContainerIDToInventoryID|ContainerIDToInventoryID]], or from the table below. Note that you should never use these values in AddOns, since they may change. Use [[API GetInventorySlotInfo|GetInventorySlotInfo]]([[API TYPE InventorySlotName|invSlotName]]) to get the current mapping. This list is only meant to be used as a reference for reverse mapping while debugging, or possibly for use in [[macro]]s. These can be used for commands such as [[API UseInventoryItem|UseInventoryItem]] and [[API PickupInventoryItem|PickupInventoryItem]]. |
||
+ | * InventorySlotName also doubles as a [https://wow.tools/dbc/?dbc=globalstrings#search=SLOT GlobalString] |
||
+ | ==Equipment== |
||
− | [[Image:InventorySlots.jpg|thumb|Graphical Explanation]] |
+ | [[Image:InventorySlots.jpg|thumb|Graphical Explanation (Classic)]] |
+ | Example: prints the InventorySlotId for an InventorySlotName, and the related globalstring and constant. |
||
+ | <syntaxhighlight lang="lua"> |
||
+ | /dump GetInventorySlotInfo("SHOULDERSLOT") -- 3 |
||
+ | /dump SHOULDERSLOT -- "Shoulders" (slot name doubles as a globalstring) |
||
+ | /dump INVSLOT_SHOULDER -- 3 (the related constant) |
||
+ | </syntaxhighlight> |
||
+ | {| class="sortable darktable zebra" |
||
+ | |- |
||
+ | ! colspan="2" | InvSlotName<br>GlobalString (enUS) !! InvSlotId !! Constant |
||
+ | |- |
||
+ | | AMMOSLOT {{Wow-inline}} || Ammo || align="center" | 0 || INVSLOT_AMMO |
||
+ | |- |
||
+ | | HEADSLOT || Head || align="center" | 1 || INVSLOT_HEAD |
||
+ | |- |
||
+ | | NECKSLOT || Neck || align="center" | 2 || INVSLOT_NECK |
||
+ | |- |
||
+ | | SHOULDERSLOT || Shoulders || align="center" | 3 || INVSLOT_SHOULDER |
||
+ | |- |
||
+ | | SHIRTSLOT || Shirt || align="center" | 4 || INVSLOT_BODY |
||
+ | |- |
||
+ | | CHESTSLOT || Chest || align="center" | 5 || INVSLOT_CHEST |
||
+ | |- |
||
+ | | WAISTSLOT || Waist || align="center" | 6 || INVSLOT_WAIST |
||
+ | |- |
||
+ | | LEGSSLOT || Legs || align="center" | 7 || INVSLOT_LEGS |
||
+ | |- |
||
+ | | FEETSLOT || Feet || align="center" | 8 || INVSLOT_FEET |
||
+ | |- |
||
+ | | WRISTSLOT || Wrist || align="center" | 9 || INVSLOT_WRIST |
||
+ | |- |
||
+ | | HANDSSLOT || Hands || align="center" | 10 || INVSLOT_HAND |
||
+ | |- |
||
+ | | FINGER0SLOT || Finger || align="center" | 11 || INVSLOT_FINGER1 |
||
+ | |- |
||
+ | | FINGER1SLOT || Finger || align="center" | 12 || INVSLOT_FINGER2 |
||
+ | |- |
||
+ | | TRINKET0SLOT || Trinket || align="center" | 13 || INVSLOT_TRINKET1 |
||
+ | |- |
||
+ | | TRINKET1SLOT || Trinket || align="center" | 14 || INVSLOT_TRINKET2 |
||
+ | |- |
||
+ | | BACKSLOT || Back || align="center" | 15 || INVSLOT_BACK |
||
+ | |- |
||
+ | | MAINHANDSLOT || Main Hand || align="center" | 16 || INVSLOT_MAINHAND |
||
+ | |- |
||
+ | | SECONDARYHANDSLOT || Off Hand || align="center" | 17 || INVSLOT_OFFHAND |
||
+ | |- |
||
+ | | RANGEDSLOT {{Wow-inline}} || Ranged || align="center" | 18 || INVSLOT_RANGED |
||
+ | |- |
||
+ | | TABARDSLOT || Tabard || align="center" | 19 || INVSLOT_TABARD |
||
+ | |} |
||
+ | ==Bags== |
||
− | == Regular inventory items == |
||
+ | Slot ids for bags are returned from {{api|ContainerIDToInventoryID}}() |
||
− | The current IDs for Inventory Slots are (see FrameXML\Constants.lua): |
||
+ | <syntaxhighlight lang="lua"> |
||
− | <pre> |
||
+ | -- Constants |
||
− | INVSLOT_AMMO = 0 |
||
+ | NUM_BAG_SLOTS = 4; |
||
− | INVSLOT_HEAD = 1 |
||
+ | NUM_BANKBAGSLOTS = 7; -- 6 in vanilla |
||
− | INVSLOT_NECK = 2 |
||
− | INVSLOT_SHOULDER = 3 |
||
− | INVSLOT_BODY = 4 (shirt) |
||
− | INVSLOT_CHEST = 5 |
||
− | INVSLOT_WAIST = 6 |
||
− | INVSLOT_LEGS = 7 |
||
− | INVSLOT_FEET = 8 |
||
− | INVSLOT_WRIST = 9 |
||
− | INVSLOT_HAND = 10 |
||
− | INVSLOT_FINGER1 = 11 |
||
− | INVSLOT_FINGER2 = 12 |
||
− | INVSLOT_TRINKET1 = 13 |
||
− | INVSLOT_TRINKET2 = 14 |
||
− | INVSLOT_BACK = 15 |
||
− | INVSLOT_MAINHAND = 16 |
||
− | INVSLOT_OFFHAND = 17 |
||
− | INVSLOT_RANGED = 18 |
||
− | INVSLOT_TABARD = 19 |
||
− | CONTAINER_BAG_OFFSET+1 = 20 (first bag, the rightmost one) |
||
− | CONTAINER_BAG_OFFSET+2 = 21 (second bag) |
||
− | CONTAINER_BAG_OFFSET+3 = 22 (third bag) |
||
− | CONTAINER_BAG_OFFSET+4 = 23 (fourth bag, the leftmost one) |
||
− | </pre> |
||
+ | -- Example (retail) |
||
− | == When bank frame is open == |
||
+ | ContainerIDToInventoryID(1) -- 20 (1st character bag, the rightmost one) |
||
− | <pre> |
||
+ | ContainerIDToInventoryID(NUM_BAG_SLOTS) -- 23 (4th character bag, the leftmost one) |
||
− | 40 to 67 = the 28 bank slots |
||
+ | ContainerIDToInventoryID(NUM_BAG_SLOTS + 1) -- 80 (1st bank bag) |
||
− | 68 = first bank bag slot |
||
+ | ContainerIDToInventoryID(NUM_BAG_SLOTS + NUM_BANKBAGSLOTS) -- 86 (7th bank bag) |
||
− | 69 = second bank bag slot |
||
+ | </syntaxhighlight> |
||
− | 70 = third bank bag slot |
||
− | 71 = fourth bank bag slot |
||
− | 72 = fifth bank bag slot |
||
− | 73 = sixth bank bag slot |
||
− | 74 = seventh bank bag slot |
||
− | </pre> |
||
+ | Slot ids for the stock containers in the bank are returned from {{api|BankButtonIDToInvSlotID}}() |
||
+ | <syntaxhighlight lang="lua"> |
||
+ | -- Constants |
||
+ | NUM_BANKGENERIC_SLOTS = 28; -- 24 in classic |
||
+ | |||
+ | -- Example (retail) |
||
+ | BankButtonIDToInvSlotID(1) -- 52 (first bank container slot) |
||
+ | BankButtonIDToInvSlotID(NUM_BANKGENERIC_SLOTS) -- 79 (last bank container slot) |
||
+ | </syntaxhighlight> |
||
+ | |||
+ | <onlyinclude>{| class="sortable darktable zebra" |
||
+ | |- |
||
+ | ! ID !! Vanilla<br>1.13.7 !! Vanilla<br>1.14.0 !! TBC<br>2.5.2 !! Retail !! Description |
||
+ | |- |
||
+ | | <center>1</center> || colspan="4" | <center>20</center> || 1st character bag |
||
+ | |- |
||
+ | | <center>2</center> || colspan="4" | <center>21</center> || 2nd character bag |
||
+ | |- |
||
+ | | <center>3</center> || colspan="4" | <center>22</center> || 3rd character bag |
||
+ | |- |
||
+ | | <center>4</center> || colspan="4" | <center>23</center> || 4th character bag |
||
+ | |- |
||
+ | | || <center>48-71</center> || <center>48-71</center> || <center>48-75</center> || <center>52-79</center> || bank slots (vanilla: 24, bcc/retail: 28) |
||
+ | |- |
||
+ | | <center>5</center> || <center>72</center> || <center>76</center> || <center>76</center> || <center>80</center> || 1st bank bag |
||
+ | |- |
||
+ | | <center>6</center> || <center>73</center> || <center>77</center> || <center>77</center> || <center>81</center> || 2nd bank bag |
||
+ | |- |
||
+ | | <center>7</center> || <center>74</center> || <center>78</center> || <center>78</center> || <center>82</center> || 3rd bank bag |
||
+ | |- |
||
+ | | <center>8</center> || <center>75</center> || <center>79</center> || <center>79</center> || <center>83</center> || 4th bank bag |
||
+ | |- |
||
+ | | <center>9</center> || <center>76</center> || <center>80</center> || <center>80</center> || <center>84</center> || 5th bank bag |
||
+ | |- |
||
+ | | <center>10</center> || <center>77</center> || <center>81</center> || <center>81</center> || <center>85</center> || 6th bank bag |
||
+ | |- |
||
+ | | <center>11</center> || || || <center>82</center> || <center>86</center> || 7th bank bag |
||
+ | |}</onlyinclude> |
||
+ | |||
+ | ===Bag InvSlotNames=== |
||
+ | <syntaxhighlight lang="lua"> |
||
+ | /dump GetInventorySlotInfo("BAG0SLOT") -- 20 |
||
+ | </syntaxhighlight> |
||
+ | {| class="sortable darktable zebra col2-center" |
||
+ | |- |
||
+ | ! InvSlotName !! InvSlotId |
||
+ | |- |
||
+ | | BAG0SLOT || 20 |
||
+ | |- |
||
+ | | BAG1SLOT || 21 |
||
+ | |- |
||
+ | | BAG2SLOT || 22 |
||
+ | |- |
||
+ | | BAG3SLOT || 23 |
||
+ | |} |
||
+ | |||
+ | <syntaxhighlight lang="lua"> |
||
+ | /dump GetInventorySlotInfo("BAG1") -- 64 |
||
+ | </syntaxhighlight> |
||
+ | {| class="sortable darktable zebra col2-center" |
||
+ | |- |
||
+ | ! InvSlotName !! InvSlotId |
||
+ | |- |
||
+ | | BAG1 || 64 |
||
+ | |- |
||
+ | | BAG2 || 65 |
||
+ | |- |
||
+ | | BAG3 || 66 |
||
+ | |- |
||
+ | | BAG4 || 67 |
||
+ | |- |
||
+ | | BAG5 || 68 |
||
+ | |- |
||
+ | | BAG6 || 69 |
||
+ | |- |
||
+ | | BAG7 || 70 |
||
+ | |- |
||
+ | | BAG8 || 71 |
||
+ | |- |
||
+ | | BAG9 || 72 |
||
+ | |- |
||
+ | | BAG10 || 73 |
||
+ | |- |
||
+ | | BAG11 || 74 |
||
+ | |- |
||
+ | | BAG12 || 75 |
||
+ | |} |
||
+ | |||
+ | == Patch changes == |
||
+ | * {{Patch 8.3.0|note=Slot ids for bank bags start from 80 instead of 76.}} |
||
+ | |||
+ | == See also == |
||
+ | * [[Enum.InventoryType]] |
||
+ | * {{api|GetFirstBagBankSlotIndex}}() |
||
[[Category:Macros]] |
[[Category:Macros]] |
Revision as of 00:18, 6 November 2021
Inventory slots refer to a unique equipment or bag slot.
- For equipment, slot names are resolved to a slot id constant with GetInventorySlotInfo(). This gives Blizzard more flexibility to possibly change slot ids.
- InventorySlotName also doubles as a GlobalString
Equipment
Example: prints the InventorySlotId for an InventorySlotName, and the related globalstring and constant.
/dump GetInventorySlotInfo("SHOULDERSLOT") -- 3
/dump SHOULDERSLOT -- "Shoulders" (slot name doubles as a globalstring)
/dump INVSLOT_SHOULDER -- 3 (the related constant)
Bags
Slot ids for bags are returned from ContainerIDToInventoryID()
-- Constants
NUM_BAG_SLOTS = 4;
NUM_BANKBAGSLOTS = 7; -- 6 in vanilla
-- Example (retail)
ContainerIDToInventoryID(1) -- 20 (1st character bag, the rightmost one)
ContainerIDToInventoryID(NUM_BAG_SLOTS) -- 23 (4th character bag, the leftmost one)
ContainerIDToInventoryID(NUM_BAG_SLOTS + 1) -- 80 (1st bank bag)
ContainerIDToInventoryID(NUM_BAG_SLOTS + NUM_BANKBAGSLOTS) -- 86 (7th bank bag)
Slot ids for the stock containers in the bank are returned from BankButtonIDToInvSlotID()
-- Constants
NUM_BANKGENERIC_SLOTS = 28; -- 24 in classic
-- Example (retail)
BankButtonIDToInvSlotID(1) -- 52 (first bank container slot)
BankButtonIDToInvSlotID(NUM_BANKGENERIC_SLOTS) -- 79 (last bank container slot)
ID | Vanilla 1.13.7 |
Vanilla 1.14.0 |
TBC 2.5.2 |
Retail | Description |
---|---|---|---|---|---|
1st character bag | |||||
2nd character bag | |||||
3rd character bag | |||||
4th character bag | |||||
bank slots (vanilla: 24, bcc/retail: 28) | |||||
1st bank bag | |||||
2nd bank bag | |||||
3rd bank bag | |||||
4th bank bag | |||||
5th bank bag | |||||
6th bank bag | |||||
7th bank bag |
Bag InvSlotNames
/dump GetInventorySlotInfo("BAG0SLOT") -- 20
InvSlotName | InvSlotId |
---|---|
BAG0SLOT | 20 |
BAG1SLOT | 21 |
BAG2SLOT | 22 |
BAG3SLOT | 23 |
/dump GetInventorySlotInfo("BAG1") -- 64
InvSlotName | InvSlotId |
---|---|
BAG1 | 64 |
BAG2 | 65 |
BAG3 | 66 |
BAG4 | 67 |
BAG5 | 68 |
BAG6 | 69 |
BAG7 | 70 |
BAG8 | 71 |
BAG9 | 72 |
BAG10 | 73 |
BAG11 | 74 |
BAG12 | 75 |
Patch changes
- Patch 8.3.0 (2020-01-14): Slot ids for bank bags start from 80 instead of 76.