WoW:API GetInventoryItemCount: Difference between revisions

m
More details, updated template.
No edit summary
 
m (More details, updated template.)
Line 1: Line 1:
<center>'''GetInventoryItemCount''' ''-Documentation by [[user:ulic|ulic]]-''</center>
<center>'''GetInventoryItemCount''' - ''Documentation by [[User:Ulic|ulic]]''</center>


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
Determine the quantity of an item in an inventory slot.


  GetInventoryItemCount("unit", slot);
  count = GetInventoryItemCount("unit", slotId)
== Parameters ==
=== Arguments ===
:("unit", slotId)


<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
:;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


Gets the quantity for an item in an Inventory Slot. Only known use for this is the ranged slot, for throwing weapons.
:;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 -->
;''Arguments''
local ammoSlot = GetInventorySlotInfo("AmmoSlot");
 
local ammoCount = GetInventoryItemCount("player", ammoSlot);
<!-- List each argument, together with its type -->
if ((ammoCount == 1) and (not GetInventoryItemTexture("player", ammoSlot))) then
:(unit, slot)
    ammoCount = 0;
:;unit : String - the string identifing where to get the slot info from
end;
:;slot : Integer - the integer number of the inventory slot
<!-- end code -->
 
----
;''Returns''
 
<!-- List each return value, together with its type -->
:Integer - the number of the item in the specified slot
 
----
;''Example''
itemCount = GetInventoryItemCount("player", index);
----
----
{{Template:WoW API}} :
__NOTOC__
<!-- Update the category to the appropriate subsection, and be sure to put the function name as the label for the category link. Multiple subcategories are okay if appropriate, please dont link functions to the API Functions category directly. -->
{{Template:WoW API}}
[[World of Warcraft API#Inventory_Functions|Inventory Functions]]
[[Category:API Inventory Functions|GetInventoryItemCount]]
[[Category:API Inventory Functions|PickupContainerItem]]
Anonymous user