User:Cogswobble/Addon Tutorial/Investigating Functions

From Warcraft Wiki
Jump to navigation Jump to search

Now that we have a platform for investigating our "interesting" functions, we need to take a deeper look at them with an eye towards how they work together.

A Closer Look at Inventory/Item Functions

Bank Functions

BankButtonIDToInvSlotID(buttonID, isBag)   - Returns the ID number of a bank button or bag in terms of inventory slot ID.
GetNumBankSlots()   - Returns total purchased bank bag slots, and a flag indicating if it's full.

Container/Bag Functions

ContainerIDToInventoryID(bagID)
GetBagName(bagID)   - Get the name of one of the player's bags.
GetContainerItemInfo(bagID, slot)   - Get the info for an item in one of the player's bags.
GetContainerNumSlots(bagID)   - Returns the total number of slots in the bag specified by the index.
PROTECTED (Situational) UseContainerItem(bagID, slot[, onSelf])   - Uses an item located in bag# and slot#. (Warning: If a vendor window is open, using items in your pack may sell them!)   - 'onSelf' added in 1.12

Inventory Functions

ContainerIDToInventoryID(bagID)
GetInventoryItemCount("unit",invSlot)   - Determine the quantity of an item in an inventory slot.
GetInventoryItemQuality("unit",invSlot)   - Return the quality of an inventory item.
GetInventoryItemTexture("unit",invSlot)   - Return the texture for an inventory item.
GetInventorySlotInfo(invSlotName)   - Get the info for a named inventory slot (slot ID and texture)
PROTECTED UseInventoryItem(invSlot)   - Use an item in a specific inventory slot.

Item Functions

GetItemCount(itemId or "itemName" or "itemLink"[, includeBank])   - returns how many of specified item you have in your inventory
GetItemFamily(itemId or "itemName" or "itemLink")   - Returns the bag type that an item can go into, or for bags the type of items that it can contain. (New in Patch 2.4)
GetItemIcon(itemId or "itemString" or "itemName" or "itemLink")   - Returns the icon for the item. Works for any valid item even if it's not in the cache. (New in Patch 2.4)
GetItemInfo(itemId or "itemString" or "itemName" or "itemLink")   - Returns information about an item.
IsUsableItem(item)   - Returns usable, noMana.
IsConsumableItem(item)   -