Player inventory backend
Items a player holds. A stack is a count of one item (potions, keys). A unique item is a set of pieces of its own, each with an id and integer attributes (a sword with its power). Stores, Quests and the trading modules grant and take items through it.
Catalog: Items
Section titled “Catalog: Items”Economy → Items. One row per item.
| Field | Meaning |
|---|---|
key | The id of the item, such as potion. |
name, description, icon, tags | What the game shows. |
kind | stack or unique. |
stack | For a stack, the most one player holds, 0 for no limit. |
tradable | Whether a module that moves items between players may take the item from a player. |
Functions
Section titled “Functions”| Function | Kind | Caller | Arguments | Result |
|---|---|---|---|---|
list | query | client | none | [{item, name, icon, kind, count, id?, attributes?}] |
grant | mutation | server, other modules | {item, count?, id?, attributes?} | {item, count?, ids} |
take | mutation | server, other modules | {item?, count?, id?, tradable?} | {item, count?, id?, attributes?} |
listreturns a row per stack with its count, then a row per unique piece with itsid,attributesand a count of 1, each with the key, the name, the icon and the kind of its item.grantaddscount(1 by default) to a stack, orcountnew pieces of a unique item with new ids and the givenattributes. A piece given with anidkeeps it: it moves from another player.taketakescountof a stack, or one piece by itsid, and returns what it took. Withtradable: trueit refuses an item that is not tradable.
Errors
Section titled “Errors”| Code | When |
|---|---|
unknown_item | The item is not in the catalog. |
invalid_count | The count is not positive. |
stack_full | The stack would go over its limit. |
not_enough | The player holds fewer of the item. |
no_such_piece | The player holds no piece with that id. |
piece_taken | The player already holds a piece with that id. |
not_tradable | The item cannot be traded. |
In the Dashboard
Section titled “In the Dashboard”The Overview of the player card lists what the player holds, with Take on each row and Grant above them.
Limits
Section titled “Limits”A player holds at most about 800 kinds of stacks and 800 unique pieces.