Inventory, Equipment, and CraftingLua table
Read item lists, manage equipment and storage, and work with crafting and gathering.
These advanced functions are available directly on game. Keep the leading
underscore in each name. The SDK facade only exports
a subset of game; use these exact game names rather than inventing aliases.
These interfaces are experimental; check that each function exists in the installed runtime. Availability depends on the loaded character, current game state, and client
support. A successful action reports that the local request was sent or invoked,
not that an item changed. Refresh the relevant list on a later update.
For a single item-use request, see game.use_item.
For buying and selling, see Commerce. Use a
worker for periodic reads and
handle unavailable values.
Item Lists
game._inventory_capacity()
Parameters: None. Returns: The current integer inventory slot capacity,
or nil, error while it cannot be read. Capacity is not the number of occupied
slots or the number of rows in a snapshot.
game._inventory_record_snapshot()
Parameters: None. Returns: An array of item records, or nil, error.
An empty array is a successful read of an empty inventory. Reads return at most
500 records and fail when a complete, consistent list is unavailable.
Each record contains these integer fields:
| Field | Meaning |
|---|---|
uid | Positive item-instance UID used by item actions. |
object | Same value as uid; use uid for new scripts. |
id | Positive item definition ID, distinct from the UID. |
count | Positive quantity in this stack. |
enhancement | Equipment enhancement value. |
power | Item power value. |
required_level | Item's required character level. |
type | Item category code. |
equipment_type | Equipment category code. |
body_slot | Equipment body-slot code. |
grade | Item grade code. |
needs_imprint | Imprint flag code. |
cooldown_id | Item cooldown-group ID. |
trade | Exchange-type code. |
can_store | Storage eligibility code. |
can_auction | 1 when auction-eligible, otherwise 0. |
can_sell | Selling eligibility code. |
material_id | Material identifier. |
The category and flag codes are integers, not Lua booleans. In Lua, 0 is
truthy, so compare flags explicitly. Not every metadata field applies to every
item. Do not treat a zero field as proof that an action is supported or impossible.
Keep IDs and UIDs as integers rather than converting them to floating-point values.
local items, err = game._inventory_record_snapshot()
if items == nil then
log.warn(err)
else
for _, item in ipairs(items) do
log.info(string.format("Item %d, UID %d, count %d",
item.id, item.uid, item.count))
end
endgame._equipped_record_snapshot()
Parameters: None. Returns: An array with the same
item-record fields, read from equipped gear, or nil, error.
An empty array means that the equipped list was available and empty. Read this
again after an equipment request; a request result alone does not confirm a slot change.
game._warehouse_record_snapshot(selector)
Parameters: Integer storage-list selector: 1 selects account storage;
any other integer selects character storage. Use 0 for character storage.
Returns: An array with the same item-record fields, or nil, error when
that storage list is unavailable. Storage-list selectors and the warehouse
types used by transfer actions are different arguments; do not interchange them.
game._inventory_ready_groups()
Parameters: None. Returns: An array of integer ready-group IDs, or
nil, error. The list can be empty and contains at most 100 IDs. It is not an
item list and does not report inventory capacity.
Arcanas and Equipment Stats
These calls return each item's stat lines, skill lines and enhancement level.
They read the character's current items once per call; refresh after an
equip, enhance or dismantle request instead of keeping old rows.
character_build adds stat names, Arcana
names and a combined export table on top of these rows.
game._arcana_snapshot()
Parameters: None. Returns: An array of every owned Arcana, or
nil, error. Equipped Arcanas come first, followed by unequipped ones. An
empty array is a successful read of a character without Arcanas.
game._equipped_detail_snapshot()
Parameters: None. Returns: An array with one row for each equipped
item, Arcanas included, or nil, error.
Both calls return rows with these fields:
| Field | Meaning |
|---|---|
uid | Item-instance UID, the same value item actions accept. |
id | Item definition ID. |
grade | Item grade code: 1 Common, 2 Rare, 3 Legend, 4 Unique, 5 Epic, 6 Mythic. |
enhancement | Enhancement level. |
power | Item power value. |
required_level | Required character level. |
equipment_type | Equipment category code; Arcanas use 51 to 60. |
arcana_type | 1 Grail, 2 Parchment, 3 Compass, 4 Bell, 5 Mirror, 6 Libra, 7 Key, 8 Hourglass, 9 Dice, 10 Lantern; 0 for other items. |
body_slot | Equipment slot code; equipped Arcanas use 41 to 50. |
equipped | 1 when the item is equipped, otherwise 0. |
main_stats | Array of {stat, value} main stat lines. |
sub_stats | Array of {stat, value} sub stat lines. |
added_sub_stats | Array of {stat, value} added sub stat lines. |
skills | Array of {skill_id, level} skill lines. |
added_skills | Array of {skill_id, level} added skill levels. |
stat is the game's stat code; require("character_build").stat_name(stat)
returns its name, such as HPMax or Critical. Values are the item's stored
amounts. Stat arrays can be empty, for example for items without sub stats.
local arcanas, err = game._arcana_snapshot()
if arcanas == nil then
log.warn(err)
else
for _, arcana in ipairs(arcanas) do
log.info(string.format("Arcana %d type %d +%d equipped=%d main lines=%d",
arcana.id, arcana.arcana_type, arcana.enhancement, arcana.equipped,
#arcana.main_stats))
end
endItem Use and Equipment
game._bulk_item_use_candidate(uid, item_id, count)
Parameters: Three integers: the current item UID, its matching definition
ID, and requested quantity. Use a positive quantity within the current stack.
Returns: true when sent, false when rejected locally, or nil, error
when the character, action, or request is unavailable. The wrapper does not
validate stack ownership or available quantity for you. Refresh inventory
before constructing the request and afterward to observe consumption.
game._reward_box_candidate(uid, count, selection_index)
Parameters: Positive reward-box UID, count from 1 to 50, and selection
index from 0 to 127. Returns: true when sent, or nil, error for invalid
arguments, rejection, or unavailability. The selection index is zero-based;
choose an index valid for the box. This may consume the selected box quantity.
game._auto_use_status_snapshot()
Parameters: None. Returns: Two integer values,
potion_condition, sealstone_condition, or nil, error. These are condition
codes, not a table and not booleans. No public code-to-label mapping is supplied.
This reads the settings and does not change them.
local potion, sealstoneOrError = game._auto_use_status_snapshot()
if potion == nil then
log.warn(sealstoneOrError)
else
log.info(string.format("Potion %d, sealstone %d", potion, sealstoneOrError))
endgame._equip_gear_request(uid, slot)
Parameters: Integer item UID and equipment slot code. Use a current UID
and a slot from 0 to 255 that is valid for that item. Returns: true when
invoked, or nil, error. It does not validate equipment compatibility or
confirm the server's result. Refresh the equipped and inventory lists afterward.
game._equipment_upgrade_select_candidate(uid)
Parameters: Integer item UID. Returns: true when selected in the
equipment-upgrade window, false for rejection or an unavailable window/panel,
or nil, error for other unavailability. Open the appropriate upgrade window
first. Selection does not perform or confirm an upgrade.
game._equipment_imprint_request(uid)
Parameters: Integer item UID. Returns: true when submitted, false
when rejected locally, or nil, error. This requests imprinting; it does not
confirm an imprint or report its cost. Check the item's current state before
requesting and refresh inventory afterward.
game._decompose_item_request(uid)
Parameters: Integer item UID. Returns: true when submitted, false
when rejected locally, or nil, error if the action is unavailable. Dismantling may
consume the item.
Require an explicit user choice of the current item rather than automatically
applying this to every snapshot row.
game._discard_item_request(uid, quantity)
Parameters: Integer item UID and quantity. Use a positive quantity within
the current stack. Returns: true when invoked, or nil, error. The
wrapper does not confirm discard or validate the current quantity for you.
Discarding may permanently remove items.
game._inventory_expand_request()
Parameters: None. Returns: true when submitted, false when rejected
locally, or nil, error. Expansion may have a game-defined cost and limit;
this call does not quote that cost or confirm payment. Read capacity afterward.
Warehouse Transfers
game._warehouse_store_request(warehouse_type, npc_uid, item_uid, quantity)
Parameters: Four integers. warehouse_type must be 2 for account
storage or 15 for character storage.
npc_uid must identify the relevant storage NPC; its 32-bit key must not be
zero. item_uid and quantity must be positive. Returns: true when
submitted, false when rejected locally, or nil, error for invalid
arguments or unavailability. This transfers one item stack request; it does
not confirm storage, available capacity, or the NPC interaction.
game._warehouse_take_request(warehouse_type, npc_uid, item_uid, quantity)
Parameters: The same four arguments and rules as storing.
Returns: true when submitted, false when rejected locally, or
nil, error. Use a UID from the relevant warehouse list rather than guessing
from an inventory item ID. Refresh both lists after either transfer.
Crafting
game._crafting_level_entries()
Parameters: None. Returns: {count, rows}, or nil, error. Each row
contains integer source_index, crafting id, and level. Iterate rows
with ipairs; source_index is a source-list position, not a Lua array index.
An empty rows array is a successful empty read.
game._crafting_status_source()
Parameters: None. Returns: An integer crafting status code, or
nil, error. The published value is 0 for the zero state and 1 for either
of the supported nonzero states. It does not distinguish those states or
prove the crafting dialog is visible. This does not report whether a craft
completed; recipe/count controls still require the visible dialog.
game._craft_select_recipe(recipe_id)
Parameters: Integer recipe ID; use a valid ID from 1 to 4294967295.
Returns: true when selection is invoked, false when it cannot be
invoked, or nil, error for invalid argument shape or a call failure. A visible
crafting dialog is required. This selects a recipe, not a completed craft.
game._craft_set_count(count)
Parameters: Integer count; use a positive value up to 2147483647 and
within the recipe's current limits. Returns: true when the count-change
control is invoked, false when it cannot be invoked, or nil, error for
invalid argument shape or a call failure. A visible crafting dialog is
required. This sets its requested count and does not start production or
validate materials.
Gathering
game._current_gathered_item_raw()
Parameters: None. Returns: {can_succeed, color, item_id}, or
nil, error. All fields are integers. A successful read with no active
gathering context can return {can_succeed=-1, color=0, item_id=0}; do not
treat that as an error or an actionable item. can_succeed and color are
game codes without a supplied public mapping, not Lua booleans.
game._gather_points_source()
Parameters: None. Returns: {level, general_points, specialist_points}
with integer values, or nil, error. This is a current gathering progression
read, not a request to spend points.
game._current_gather_skill_entries()
Parameters: None. Returns: {count, rows}, or nil, error. Each
documented row contains integer skill id and level. Use these IDs for
gathering skill actions. A successful empty list means there are no returned
skills. An unavailable character or inactive gathering context can also
produce a successful empty list; do not treat it as proof that no skills are
learned. A failed read is not an empty list.
game._gather_skill_acquire_request(skill_id)
Parameters: Integer gathering skill ID. Returns: true when
submitted, false when rejected locally, or nil, error. The request does
not establish eligibility, point cost, or that the skill was learned.
game._gather_skill_upgrade_request(skill_id, target_level)
Parameters: Integer gathering skill ID and target level.
Returns: true when submitted, false when rejected locally, or
nil, error. Use a level supported by the current skill and refresh skills
and points afterward to verify the result.