WoW:API GetItemCount: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New page: {{wowapi}}__NOTOC__ Returns count information for the item. count = GetItemCount(itemID or "itemName" or "itemLink", includeBank) === Arguments === :(itemId or "itemName" or "[[itemLink...)
 
m (bp)
Line 1: Line 1:
{{wowapi}}__NOTOC__
{{wowapi}}
Returns count information for the item.
Returns count information for the item.
  count = GetItemCount(itemID or "itemName" or "itemLink"[, includeBank][, includeCharges])
  count = GetItemCount(itemID or "itemName" or "itemLink"[, includeBank][, includeCharges])


=== Arguments ===
=== Arguments ===
; itemID / "itemName" / "itemLink" : Number/String/String - Numeric ID of the item, name of the item, or [[itemLink]] of the item to query.
:(itemId or "itemName" or "[[itemLink]]", includeBank, includeCharges)
:(itemId or "itemName" or "[[itemLink]]", includeBank, includeCharges)
 
;includeBank: Boolean - true: count includes bank items
:;itemId : Integer - The numeric ID of the item. ie. 12345
;includeCharges: Boolean - true: count is charges if any, otherwise number of items
:;itemName : String - The Name of the Item, ex: "Hearthstone"
:;[[itemLink]] : String - The [[itemLink]], when Shift-Clicking items.
:;includeBank: Boolean - true: count includes bank items
:;includeCharges: Boolean - true: count is charges if any, otherwise number of items


=== Returns ===
=== Returns ===
:; count: Number - The number of items in your possesion, or charges if includeCharges is true and the item has charges.
; count: Number - The number of items in your possesion, or charges if includeCharges is true and the item has charges.


== Example ==
== Example ==
<!-- begin code -->
  local count = GetItemCount(29434)
  local count = GetItemCount(29434)
  print("Badge of Justice:", count)
  print("Badge of Justice:", count)
Line 26: Line 22:
  local countTotal = GetItemCount("Netherweave Cloth", true)
  local countTotal = GetItemCount("Netherweave Cloth", true)
  print("Netherweave Cloth:", countBags, "(bags)", (countTotal - countBags), "(bank)")
  print("Netherweave Cloth:", countBags, "(bags)", (countTotal - countBags), "(bank)")
<!-- end code -->
----

Revision as of 12:01, 15 June 2010

WoW API < GetItemCount

Returns count information for the item.

count = GetItemCount(itemID or "itemName" or "itemLink"[, includeBank][, includeCharges])

Arguments

itemID / "itemName" / "itemLink"
Number/String/String - Numeric ID of the item, name of the item, or itemLink of the item to query.
(itemId or "itemName" or "itemLink", includeBank, includeCharges)
includeBank
Boolean - true: count includes bank items
includeCharges
Boolean - true: count is charges if any, otherwise number of items

Returns

count
Number - The number of items in your possesion, or charges if includeCharges is true and the item has charges.

Example

local count = GetItemCount(29434)
print("Badge of Justice:", count)
local count = GetItemCount(33312, nil, true) 
print("Mana Saphire Charges:", count)
local countBags = GetItemCount("Netherweave Cloth")
local countTotal = GetItemCount("Netherweave Cloth", true)
print("Netherweave Cloth:", countBags, "(bags)", (countTotal - countBags), "(bank)")