Vendor Stock And Shop Economy Authoring
What This System Is
Vendor stock defines shop entries that NPC services can expose as buyable or tradeable options with item outputs, costs, lock reasons, and relationship deltas.
How Authors Use It
Authors create vendor stock rows and connect NPC service definitions with vendor_stock_id. Each stock entry should name the output item, quantity, cost items or currencies, and any availability conditions. The item authoring tab includes vendor stock projections and draft editing.
Rules And Invariants
Stock ids and entry ids are durable authoring references. Costs must use valid item or currency aliases. Duplicate entry ids are invalid. Stock projection payload signatures should change when item, cost, lock, or relationship data changes.
Validation And Debugging
Missing stock ids, missing items, duplicate entry ids, zero quantities, and invalid cost aliases should fail validation. If a shop option does not refresh after a stock edit, inspect the payload signature and fallback projection.
Examples
A starter tool vendor can expose vendor.tools.starter through an NPC service and price each entry in currency.gold. If the shop opens but an item is missing, inspect the stock entry item id before changing NPC service code.