WoW:API GetInventoryItemCount: Difference between revisions
Jump to navigation
Jump to search
GetInventoryItemCount - Documentation by ulic
No edit summary |
m (More details, updated template.) |
||
Line 1: | Line 1: | ||
<center>'''GetInventoryItemCount''' '' | <center>'''GetInventoryItemCount''' - ''Documentation by [[User:Ulic|ulic]]''</center> | ||
Determine the quantity of an item in an inventory slot. | |||
GetInventoryItemCount("unit", | count = GetInventoryItemCount("unit", slotId) | ||
== Parameters == | |||
=== Arguments === | |||
:("unit", slotId) | |||
:;unit : String - The [[API TYPE UnitId|UnitId]] of the unit whose inventory is to be queried. | |||
:;slotId : Numeric - The inventory slot to be queried, obtained via [[API GetInventorySlotInfo|GetInventorySlotInfo]]. | |||
=== Returns === | |||
:count | |||
:;count : Numeric - The number of the item in the specified slot. This returns 1 for normal items (AND for empty slots). For the ammo slot it returns the available quantity of that ammo type. BEWARE - An EMPTY ammo slot returns 1. | |||
== Example == | |||
<!-- begin code --> | |||
local ammoSlot = GetInventorySlotInfo("AmmoSlot"); | |||
local ammoCount = GetInventoryItemCount("player", ammoSlot); | |||
<!-- | if ((ammoCount == 1) and (not GetInventoryItemTexture("player", ammoSlot))) then | ||
ammoCount = 0; | |||
end; | |||
<!-- end code --> | |||
; | |||
<!-- | |||
---- | ---- | ||
{{Template:WoW API}} | __NOTOC__ | ||
{{Template:WoW API}} | |||
[[Category:API Inventory Functions|GetInventoryItemCount]] | |||
[[Category:API Inventory Functions| |
Revision as of 21:45, 10 April 2005
Determine the quantity of an item in an inventory slot.
count = GetInventoryItemCount("unit", slotId)
Parameters
Arguments
- ("unit", slotId)
- unit
- String - The UnitId of the unit whose inventory is to be queried.
- slotId
- Numeric - The inventory slot to be queried, obtained via GetInventorySlotInfo.
Returns
- count
- count
- Numeric - The number of the item in the specified slot. This returns 1 for normal items (AND for empty slots). For the ammo slot it returns the available quantity of that ammo type. BEWARE - An EMPTY ammo slot returns 1.
Example
local ammoSlot = GetInventorySlotInfo("AmmoSlot"); local ammoCount = GetInventoryItemCount("player", ammoSlot); if ((ammoCount == 1) and (not GetInventoryItemTexture("player", ammoSlot))) then ammoCount = 0; end;