WoW API: GetItemCount

From AddOn Studio
Revision as of 17:17, 2 November 2008 by WoWWiki>Toadkiller (New page: {{wowapi}}__NOTOC__ Returns count information for the item. count = GetItemCount(itemID or "itemName" or "itemLink", includeBank) === Arguments === :(itemId or "itemName" or "[[itemLink...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW API < GetItemCount

Returns count information for the item.

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

Arguments

(itemId or "itemName" or "itemLink", includeBank, includeCharges)
itemId
Integer - The numeric ID of the item. ie. 12345
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

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)")