Your character
inventory and Item
Bags, the bank, equipment and the items in them.
inventory lists the items in your bags, shared slots, bank and equipment as Item handles. An Item is tied to its slot and the item that was in it: once the item is used up or moved, item:valid() is false and its other methods return nil.
for _, item in ipairs(inventory.items()) do
if item:rarity() == inventory.RARITY_JUNK then
print("junk:", item:name(), item:quantity())
end
end
local kit = inventory.find("Basic Salvage Kit")
local loot = inventory.find(19721)
if kit and loot then loot:salvage(kit) endA container is one of "items" (what's in your bags, the default), "bags" (the bags themselves), "shared" (shared inventory slots), "bank" or "equipment".
inventory
Every item in a container.
The item in one slot.
The first item in your bags or shared slots with this item id or name.
Every such item.
inventory.count(id_or_name)integer
The total quantity of an item in your bags and shared slots.
Whether you have the item.
inventory.capacity([container])integer?
How many slots a container has.
How many of them are used.
inventory.free_slots()integer?
Free slots in your bags.
inventory.active_weapon_set()integer?
The weapon set in use.
The land weapon set in use.
Shows or hides an equipment slot.
Puts a bag
Item into a bag slot.Takes a bag out and puts it in another slot.
A chat link for an item, like
[&AgH...].Item
What the item is:
item:valid()boolean
Whether the item is still in its slot.
item:id()integer
The item id.
item:slot()integer
Its slot.
item:container()string
Its container, such as
"items".item:name()string?
Its name.
item:icon()Image?
Its icon, for
ui.image.item:rarity()integer?
One of the
inventory.RARITY_* constants.item:item_type()integer?
One of the
inventory.ITEM_TYPE_* constants.item:quantity()integer?
How many are in the stack.
item:charges()integer?
Charges left, for tools and kits.
item:stackable()boolean?
Whether it stacks.
item:tradeable()boolean?
Whether it can be sold on the trading post.
item:salvageable()boolean?
Whether it can be salvaged.
item:usable()boolean?
Whether it can be used.
item:consumable()boolean?
Whether using it uses it up.
item:vendor_value()integer?
What a vendor pays for it, in copper.
item:def()ItemDef?
Its definition. See ItemDef.
item:info()table?
Everything at once:
{id, slot, container, name, icon, rarity, item_type, quantity, charges, stackable, tradeable, salvageable, skin, stats, upgrades, infusions, dyes, def}.What you can do with it. The ones that return a boolean return false when the item is gone.
Uses (or opens) the item.
Uses the whole stack, for items that allow it.
item:select(item_id)boolean
Picks a choice from a container that offers several.
item:destroy([quantity])boolean
Destroys the item, or part of the stack.
item:equip(slot)boolean
Equips it in an equipment slot (
inventory.SLOT_*).Moves it, or part of the stack.
slot_type is one of the inventory.SLOT_TYPE_* constants.item:salvage(kit)boolean
Salvages it with a salvage kit
Item.Deposits it in material storage.
Dyes it with four dye ids.
Constants
Rarities
RARITY_JUNKRARITY_BASICRARITY_FINERARITY_MASTERWORKRARITY_RARERARITY_EXOTICRARITY_ASCENDEDRARITY_LEGENDARYinventory.RARITY_COLORS maps each rarity's name (junk, basic, fine, masterwork, rare, exotic, ascended, legendary) to the color the game uses for it.
Slot types
SLOT_TYPE_INVENTORYSLOT_TYPE_BANKSLOT_TYPE_SHAREDEquipment slots
SLOT_HEADSLOT_SHOULDERSLOT_CHESTSLOT_GLOVESSLOT_LEGSSLOT_BOOTSSLOT_AQUATIC_HEADGEARSLOT_WEAPON_1SLOT_WEAPON_2SLOT_WEAPON_3SLOT_WEAPON_4SLOT_AQUATIC_WEAPON_1SLOT_AQUATIC_WEAPON_2SLOT_BACK_ITEMSLOT_ACCESSORY_1SLOT_ACCESSORY_2SLOT_RING_1SLOT_RING_2SLOT_AMULETSLOT_RELICItem types
ITEM_TYPE_ARMORITEM_TYPE_BACK_ITEMITEM_TYPE_BAGITEM_TYPE_CONSUMABLEITEM_TYPE_CONTAINERITEM_TYPE_MATERIALITEM_TYPE_GATHERINGITEM_TYPE_GIZMOITEM_TYPE_MINIITEM_TYPE_JADE_BOT_MODULEITEM_TYPE_RELICITEM_TYPE_TRINKETITEM_TYPE_TROPHYITEM_TYPE_UPGRADE_COMPONENTITEM_TYPE_WEAPONWeapon types
WEAPON_TYPE_SWORDWEAPON_TYPE_HAMMERWEAPON_TYPE_LONG_BOWWEAPON_TYPE_SHORT_BOWWEAPON_TYPE_AXEWEAPON_TYPE_DAGGERWEAPON_TYPE_GREATSWORDWEAPON_TYPE_MACEWEAPON_TYPE_PISTOLWEAPON_TYPE_POLEARMWEAPON_TYPE_RIFLEWEAPON_TYPE_SCEPTERWEAPON_TYPE_STAFFWEAPON_TYPE_FOCUSWEAPON_TYPE_TORCHWEAPON_TYPE_WARHORNWEAPON_TYPE_SHIELDWEAPON_TYPE_SMALL_BUNDLEWEAPON_TYPE_LARGE_BUNDLEWEAPON_TYPE_SPEARWEAPON_TYPE_HARPOON_GUNWEAPON_TYPE_TRIDENTWEAPON_TYPE_TOYArmor
ARMOR_TYPE_HEADARMOR_TYPE_HEAD_AQUATICARMOR_TYPE_SHOULDERARMOR_TYPE_CHESTARMOR_TYPE_HANDARMOR_TYPE_LEGARMOR_TYPE_FOOTARMOR_WEIGHT_CLASS_LIGHTARMOR_WEIGHT_CLASS_MEDIUMARMOR_WEIGHT_CLASS_HEAVYTrinkets and upgrades
TRINKET_TYPE_ACCESSORYTRINKET_TYPE_AMULETTRINKET_TYPE_RINGUPGRADE_COMPONENT_TYPE_DEFAULTUPGRADE_COMPONENT_TYPE_GEMUPGRADE_COMPONENT_TYPE_RUNEUPGRADE_COMPONENT_TYPE_SIGIL