Wikia

WoWWiki

Changes: API ContainerIDToInventoryID

Edit

Back to page

m
(Update layout. Use constants instead of fixed numbers. Improve example.)
 
Line 1: Line 1:
{{wowapi}}
+
{{wowapi}} __NOTOC__
;''Arguments''
 
:;:(bagID)
 
:::;bagID : [[API TYPE bagID|bagID]] - number of the bag (0-11) to get the inventoryID for.
 
   
Note: After TBC Closed Beta patch v2.0.3.6299 (8th Jan 2007), inputs outside the range of 0-11 (0-4 for bags, and 5-11 for bank) now throw "invalid container ID" errors. As of 2.3 (11/12/2007) passing in a bagID of 0 throws an "Invalid Container ID" error.
+
inventoryId = ContainerIDToInventoryID(bagID)
   
  +
== Arguments ==
   
----
+
:;:(bagID)
;''Returns''
+
  +
:::;bagID : [[API TYPE bagID|bagID]] - number of the bag (1 -- NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) to get the inventoryID for.
  +
  +
== Returns ==
   
 
:;inventoryID
 
:;inventoryID
 
:: inventoryID - the bag's inventory ID used in functions like [[API PutItemInBag|PutItemInBag(inventoryId)]] and [[API GetInventoryItemLink|GetInventoryItemLink("player",inventoryId)]]
 
:: inventoryID - the bag's inventory ID used in functions like [[API PutItemInBag|PutItemInBag(inventoryId)]] and [[API GetInventoryItemLink|GetInventoryItemLink("player",inventoryId)]]
----
+
;''Examples''
+
== Example ==
   
 
local invID = ContainerIDToInventoryID(1)
 
local invID = ContainerIDToInventoryID(1)
DEFAULT_CHAT_FRAME:AddMessage("Bag slot 1 is inventory slot "..invID)
+
local bagLink = GetInventoryItemLink("player",invID)
  +
DEFAULT_CHAT_FRAME:AddMessage("Bag slot 1 is inventory slot "..invID..", a "..bagLink)
   
----
+
=== Result ===
;''Result''
 
   
Bag slot 1 is inventory slot 20
+
Bag slot 1 is inventory slot 20, a [Imbued Netherweave Bag]
   
----
+
== Notes ==
;''Notes''
 
   
:The return of container IDs -2 (key ring), -1 (bank) and 0 (backpack) aren't actual Inventory slots usable by most Inventory functions.
+
:Querying for items outside the range 1 -- (NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) throws an error.
:The player bags begin at container 1 and inventory 20.
+
:The player bags begin at container 1 -- currently inventory slot 20.
:The bank bags begin at container 5 and inventory 68.
+
:The bank bags begin at container 5 (1+NUM_BAG_SLOTS) -- currently inventory slot 68.

Latest revision as of 15:56, April 7, 2008

WoW API < ContainerIDToInventoryID
inventoryId = ContainerIDToInventoryID(bagID)

Arguments Edit

(bagID)
bagID 
bagID - number of the bag (1 -- NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) to get the inventoryID for.

Returns Edit

inventoryID
inventoryID - the bag's inventory ID used in functions like PutItemInBag(inventoryId) and GetInventoryItemLink("player",inventoryId)

Example Edit

local invID = ContainerIDToInventoryID(1)  
local bagLink = GetInventoryItemLink("player",invID)
DEFAULT_CHAT_FRAME:AddMessage("Bag slot 1 is inventory slot "..invID..", a "..bagLink)

Result Edit

Bag slot 1 is inventory slot 20, a [Imbued Netherweave Bag]

Notes Edit

Querying for items outside the range 1 -- (NUM_BAG_SLOTS+NUM_BANKBAGSLOTS) throws an error.
The player bags begin at container 1 -- currently inventory slot 20.
The bank bags begin at container 5 (1+NUM_BAG_SLOTS) -- currently inventory slot 68.

Around Wikia's network

Random Wiki