Skip to content

sdk.inventory ​

Live backpack / equipped / depot / stash stacks from TContainerStorage. Gold sums gold coin (3031), platinum (3035), crystal (3043). Depot and stash return "not open" when those windows are closed.

lua
local M = require("sdk.inventory")

Constants ​

Lua 5.4 has no enums — these are integer (or string) fields on the module.

NameValueSummary
STASH_STOW_ITEM0—
STASH_STOW_CONTAINER1—
STASH_STOW_STACK2—
STASH_WITHDRAW3—

count_of ​

function · count_of(stacks, item_id)

Sum counts for one appearance id across an already-fetched stack list. Does not touch live memory — use Inv:count when the snapshot may be stale.

find_in ​

function · find_in(stacks, item_id)

First stack row with this appearance id, or nil. Same snapshot contract as count_of — does not reread TContainerStorage.

convertible_coin_stack ​

function · convertible_coin_stack(stacks, minimum)

Pick the best backpack stack that UseObject will convert (100 gold or 100 platinum).

gold_of ​

function · gold_of(stacks)

Gold/platinum/crystal stacks in gp. Equipped coins (rare) are the caller's job; this only sums the list it is given.

moveObject ​

function · moveObject(from, to, item_id, count)

GameclientMessageMoveObject. Native move_native wins; Lua path writes from/identifier/to/count with has_bits 0x0F.

useObject ​

function · useObject(item_id, loc, index)

GameclientMessageUseObject. index omitted → native use_native, then has_bits 3; with index, has_bits 7 (window slot for opening a bag).

look ​

function · look(self: Inventory, from: ItemStack|ItemLocation): Result?, ErrorMessage?

GameclientMessageLook at a location + identifier.

Parameters

NameTypeSummary
fromItemStack|ItemLocation—

Returns

TypeSummary
Result?, ErrorMessage?—

pickObjectToImbue ​

function · pickObjectToImbue(item_id, loc, slot)

GameclientMessagePickObjectToImbue (position, identifier, shrine slot).

stash ​

function · stash(action, pos, item_id, stackpos, count)

GameclientMessageStashAction. action is STASH_STOW_* / WITHDRAW; position is omitted on withdraw (bits still include identifier/action/count).

equipObject ​

function · equipObject(item_id)

GameclientMessageEquipObject — identifier only; client chooses the slot.

closeContainer ​

function · closeContainer(container)

GameclientMessageCloseContainer by runtime id. Native close_native first.

upContainer ​

function · upContainer(container)

GameclientMessageUpContainer by runtime id (already-open nested window).

openParentContainer ​

function · openParentContainer()

Empty OpenParentContainer — no fields on the wire.

seekInContainer ​

function · seekInContainer(container, index, category)

GameclientMessageSeekInContainer. container/index/category are all required; a missing category is not a valid depot page seek.

useTwoObjects ​

function · useTwoObjects(from_id, from_loc, to_id, to_loc)

GameclientMessageUseTwoObjects (from ident+pos, to ident+pos).

Service ​

function · Service(opts)

New container_service instance (not the process singleton).

GetService ​

function · GetService(opts)

container_service process singleton (same as Inv:containerService).

Get ​

function · Get()

Returns Inventory.

Returns

TypeSummary
Inventory—

items ​

method · items(self: Inventory, options?: InventoryQuery): ItemStack[], ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
optionsInventoryQuery—

Returns

TypeSummary
ItemStack[], ErrorMessage?—

count ​

method · count(self: Inventory, item_id: ItemId): integer?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
item_idItemId—

Returns

TypeSummary
integer?, ErrorMessage?—

gold ​

method · gold(self: Inventory): integer?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
integer?, ErrorMessage?—

find ​

method · find(self: Inventory, item_id: ItemId): ItemStack?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
item_idItemId—

Returns

TypeSummary
ItemStack?, ErrorMessage?—

equipped ​

method · equipped(self: Inventory): table<integer, ItemStack>?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
table&lt;integer, ItemStack&gt;?, ErrorMessage?—

containers ​

method · containers(self: Inventory): ContainerId[]?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
ContainerId[]?, ErrorMessage?—

openContainers ​

method · openContainers(self: Inventory): ContainerView[], ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Returns

TypeSummary
ContainerView[], ErrorMessage?—

container ​

method · container(self: Inventory, id: ContainerId): ContainerView?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
idContainerId—

Returns

TypeSummary
ContainerView?, ErrorMessage?—

isFull ​

method · isFull(self: Inventory): boolean|nil, ErrorMessage?

Slot-full nest: every open child is full and no closed nested bag remains. Without a nest, every open carrying bag is slot-full. Not weight.

Returns

TypeSummary
boolean|nil, ErrorMessage?—

lootDestination ​

method · lootDestination(self: Inventory, preferred?: table, exclude_container?: integer, item_id?: ItemId): ItemLocation?, ErrorMessage?

With a preferred set (loot path): nested bag with a free slot when a nest exists. preferred==nil (depot withdraw): first carrying bag with a free slot, never a nest redirect.

Parameters

NameTypeSummary
preferredtable—
exclude_containerinteger—
item_idItemId—

Returns

TypeSummary
ItemLocation?, ErrorMessage?—

move ​

method · move(self: Inventory, from: ItemStack|ItemLocation, to: ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
toItemLocation—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

drop ​

method · drop(self: Inventory, from: ItemStack|ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

pickup ​

method · pickup(self: Inventory, from: ItemStack|ItemLocation, count?: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

equip ​

method · equip(self: Inventory, from: ItemStack): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack—

Returns

TypeSummary
Result?, ErrorMessage?—

dequip ​

method · dequip(self: Inventory, slot: integer|ItemStack, to?: ItemLocation): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
slotinteger|ItemStack—
toItemLocation—

Returns

TypeSummary
Result?, ErrorMessage?—

close ​

method · close(self: Inventory, container: ContainerId): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
containerContainerId—

Returns

TypeSummary
Result?, ErrorMessage?—

useWith ​

method · useWith(self: Inventory, from: ItemStack, to: ItemStack): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack—
toItemStack—

Returns

TypeSummary
Result?, ErrorMessage?—

open ​

method · open(self: Inventory, from: ItemStack, index?: integer): Result?, ErrorMessage?

Optional index is UseObject.index (container window).

Parameters

NameTypeSummary
fromItemStack—
indexinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

use ​

method · use(self: Inventory, from: ItemStack|ItemLocation, index?: integer): Result?, ErrorMessage?

UseObject at from (same as open).

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
indexinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

stow ​

method · stow(self: Inventory, from: ItemStack|ItemLocation, count?: integer): Result?, ErrorMessage?

Stow one stack to the store inbox.

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

stowContainer ​

method · stowContainer(self: Inventory, from: ItemStack|ItemLocation): Result?, ErrorMessage?

Stow container's content.

Parameters

NameTypeSummary
fromItemStack|ItemLocation—

Returns

TypeSummary
Result?, ErrorMessage?—

stowStack ​

method · stowStack(self: Inventory, from: ItemStack|ItemLocation): Result?, ErrorMessage?

Stow the whole stack type.

Parameters

NameTypeSummary
fromItemStack|ItemLocation—

Returns

TypeSummary
Result?, ErrorMessage?—

retrieve ​

method · retrieve(self: Inventory, item_id: ItemId, count?: integer): Result?, ErrorMessage?

Withdraw from stash.

Parameters

NameTypeSummary
item_idItemId—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

pickToImbue ​

method · pickToImbue(self: Inventory, from: ItemStack|ItemLocation, slot?: integer): Result?, ErrorMessage?

Pick Item for the imbuing shrine (slot = hole, default 0).

Parameters

NameTypeSummary
fromItemStack|ItemLocation—
slotinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

changeGold ​

method · changeGold(self: Inventory, options?: {minimum?: integer}): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
options&#123;minimum?—

Returns

TypeSummary
Result?, ErrorMessage?—

split ​

method · split(self: Inventory, from: ItemStack, count: integer): Result?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
fromItemStack—
countinteger—

Returns

TypeSummary
Result?, ErrorMessage?—

containerService ​

method · containerService(self: Inventory, options?: ContainerServiceOptions): ContainerService?, ErrorMessage?

Live inventory reads preserve uncertainty: count/gold/find return nil plus an error when the session or layout cannot be read. Zero means a successful read found none; it never means "not available".

Parameters

NameTypeSummary
optionsContainerServiceOptions—

Returns

TypeSummary
ContainerService?, ErrorMessage?—

Arcane SDK catalog generated from scripts/sdk