data/trade_tables/
A trade table: what a vendor sells and buys, at what price, with shared or per-player stock, and offers that rotate from a loot table. A vendor is a counter entity with the manifold-ai:vendor component, (table: "<key>", requires_attendant: true), whose slot.vendor slot its shopkeeper occupies. Prices are worked out on the server and items move all or nothing. Loaded by the server only.
| Registry | manifold-ai:trade-table |
| Files | data/trade_tables/*.ron, *.update.ron, *.final.ron |
| Sides | server: only the server loads it |
| Reads | nothing |
| Contract | Population, data stage |
Entry
A record, written TradeTable(..); the name before the parentheses is optional.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | string | yes | The table’s key, <mod-id>:<name>. | |
currency | string or None | no | none | The item kind (manifold:item-kind key) Coins(n) prices pay in. An unknown key fails the data stage (DATA010). |
offers | list of Offer | yes | The offers, 1 to 64. |
Example
No bundled file declares one yet. From the reference’s test fixture, crates/manifold-server-state/tests/data-reference-fixture/data/trade_tables/bakery.ron, which the data stage loads in its tests:
TradeTable(
id: "dataref-fixture:trade/bakery",
offers: [(sells: Item(kind: "dataref-fixture:bread"), price: Item(kind: "dataref-fixture:coin"))],
)
Types
Offer
One offer: exactly one of sells and buys.
A record: Offer(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sells | Goods or None | no | none | What the vendor sells for the price. |
buys | TradeItem or None | no | none | The item the vendor buys, paying the price. |
price | trade-price | yes | What the buyer pays (or, on a buys offer, is paid). | |
stock | Stock | no | Unlimited | How its stock works. |
rotation | Rotation or None | no | none | For a FromLoot offer, which needs one: how many picks it shows and how often they are rolled again. |
tag | string or None | no | none | A label for content ("price_floor"). |
requires | condition or None | no | always | A condition in the trade context (This the buyer, Target the counter) that must hold. |
Goods
What a sell offer gives.
| Variant | Written | Description |
|---|---|---|
Item | Item(kind: .., count: .., patch: ..) | An item; also written Item("<item kind>"). |
FromLoot | FromLoot(string) | The rotation’s picks from a loot table (manifold:loot-table key): the first stack of each roll. An unknown key fails the data stage (DATA010). |
Item fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
kind | string | yes | The item kind (manifold:item-kind key). An unknown key fails the data stage (DATA010). | |
count | item-count | no | 1 | How many. |
patch | map of string to component-value | no | none | Component values for the item, by component key. |
TradeItem
An item in an offer, written Item(kind: .., count: .., patch: ..) or Item("<item kind>").
A record: TradeItem(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
kind | string | yes | The item kind (manifold:item-kind key). An unknown key fails the data stage (DATA010). | |
count | item-count | no | 1 | How many. |
patch | map of string to component-value | no | none | Component values for the item, by component key. |
Stock
An offer’s stock.
| Variant | Written | Description |
|---|---|---|
Unlimited | Unlimited | Always available. |
PerPlayer | PerPlayer(limit: .., restock: ..) | Each player may trade limit per window that starts at their first trade in it. |
Shared | Shared(limit: .., restock: ..) | The vendor holds limit per slot, refilled restock after the first sale from full. |
PerPlayer fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
limit | u32 | yes | Trades per window, at least 1. | |
restock | duration | yes | The window. |
Shared fields:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
limit | u32 | yes | Units held, at least 1. | |
restock | duration | yes | The refill delay. |
Rotation
A rotating offer’s picks.
A record: Rotation(..) or (..).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
slots | u8 | yes | How many picks it shows, 1 to 8. | |
reroll | duration | yes | How often they are rolled again. |
Value forms used here: component-value, condition, duration, item-count, trade-price.