mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6921] [MERGED] feat(rulesets): markets: price levels, place sizes, sellers, services and the Game Master's buy #7385
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7385
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6921
Author: @kolacheee
Created: 9/30/2026
Status: ✅ Merged
Merged: 10/1/2026
Merged by: @kolacheee
Base:
staging← Head:feat/ruleset-items-markets📝 Commits (4)
ad57a97feat(rulesets): markets: price levels, place sizes, sellers, services and the Game Master's buy (#6917)e53f064fix(rulesets): a place a player types never counts, a service is never added to a bag, and a buy that does not fully fit is refused (#6917)94ca74fMerge remote-tracking branch 'origin/staging' into feat/ruleset-items-markets2b3aca6fix(rulesets): a seller's only reads what the buyer carries at that tag, and the market e2e matches its notifications exactly (#6917)📊 Changes
38 files changed (+2324 additions, -25 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+30 -0)📝
docs/examples/rulesets/gravewatch.json(+43 -2)📝
docs/extending/ruleset.schema.json(+358 -0)📝
docs/extending/writing-rulesets.md(+51 -2)📝
docs/game/party-and-npcs.md(+2 -0)➕
e2e/game-ruleset-markets.e2e.ts(+179 -0)📝
packages/client/src/components/game/GameSurface.tsx(+9 -0)📝
packages/client/src/components/game/RulesetItemPicker.tsx(+2 -1)📝
packages/client/src/localization/locales/en.json(+3 -0)📝
packages/server/src/routes/generate.routes.ts(+64 -0)📝
packages/server/src/services/capability-packages/package-manager.service.ts(+18 -0)📝
packages/server/src/services/game/game-inventory.service.ts(+8 -1)➕
packages/server/src/services/game/game-market.service.ts(+90 -0)📝
packages/server/src/services/game/gm-prompts.ts(+13 -1)📝
packages/shared/src/features/rulesets/item-book.ts(+1 -0)➕
packages/shared/src/features/rulesets/market.ts(+221 -0)📝
packages/shared/src/index.ts(+2 -0)📝
packages/shared/src/schemas/capability-package.schema.ts(+7 -1)📝
packages/shared/src/schemas/gm-verb-table.schema.ts(+1 -0)...and 18 more files
📄 Description
Linked issue
Closes #6917
Why this change
costin the ruleset's own coins, but buying is the Game Master's payment and then an add: every shop in the world sells everything at its list price, and nothing but the Game Master's judgement decides what a place has. The user asked (2026-09-30) for what can be bought, and what it costs, to follow the size of the place and the kind of seller, with price levels. This is slice I9-1 of the ruleset items plan.What changed
features/rulesets/market.ts):prices: levels, each a multiplier on an item's cost, one the default (cheap, fair and dear at ×0.75, ×1 and ×1.5, say). A price is worked out in the cost family's smallest coin, rounded there (never below one coin for something that costs anything), and said in the largest coin the game's layers leave that pays it exactly.places: a ladder of place sizes in the ruleset's own words, smallest first.sold: rules for the smallest place that sells what a filter picks (filters read as a loot line's are; the first match decides). An item's ownsoldwins; an item nothing names is sold anywhere.sellers: what each kind of seller sells, the smallest place that has one, and who it sellsonlyto (a value off the buyer's sheet, read as an item'sgate.unlessis).service: trueon an item: bought like one, never carried. Buying it only pays.[place: name="Millbrook" size="market town"], answered in place (an unknown size is refused). The place in force is the last one answered in the messages the player sees, from the latest conversation start and only before the telling a regeneration replaces, then the reply's own; so swipes, deletions and branches need nothing stored.placeis now a reserved GM tag name. The worldgen plan will later fill the same seam from a generated world.[inventory: action="buy" item level seller count who]. The Engine checks the place and the seller sell it, prices it, pays out of the buyer's purse as a payment is (largest coins first, change back), and adds the item to their bag, or refuses and changes nothing (no place, an unknown level, item or seller, no price, too small a place, no seller here, a seller'sonly, a purse or a bag that cannot take it). The answer carries theprice, and a notification says "You bought ... for 12 shillings." The market is built once per turn and kept on the inventory turn, so the preview and the save answer alike.[place:]andbuylines, and a MARKET block naming the place and its size, the levels, and each seller there with a dozen wares at the default level, cheapest first.soldandservicein the item fields, and the version rundown indocs/extending/writing-rulesets.md; the Money section ofdocs/game/party-and-npcs.md; the I9-1 record indocs/development/game-rulesets-and-sheets-implementation.md; the regenerateddocs/extending/ruleset.schema.json; and a CHANGELOG entry.limiteditems a place keeps only a few of, and selling back up to a purse per day.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Local run on this branch (Fedora):
pnpm check,pnpm localization:checkand prettier: clean.pnpm regression: 481 of 481.pnpm smoke:ui: 7 passed.186cc60f4afterwards (the CHANGELOG was the only conflict):pnpm check,pnpm localization:check,pnpm regression(481 of 481) and the markets and money e2e (3 passed) again.Lanes:
game-ruleset-markets.regression.ts: every import check (levels, the one default, places, rules, filters, sellers,only, an item's place with and without a market, a service's cost and what it may not have); places by id or label, the default level, filters by every word, the rank an item is sold from (its own place, the first rule, anywhere), the sellers at each size; prices (dear, cheap, counted, the largest coin that pays, rounding, never below one, free stays free, a layer that takes crowns out); buys (a dear coat paid with change, a service that only pays, a member's purse and bag, every refusal changing nothing, a hidden item, an item nobody can carry costing nothing, a layer's coins); place tags (answered, refused, unreadable, the last in force, only answered ones, no market); the MARKET block (exact lines, no place said, no market, a small place with no seller, a dozen and how many more) and the instructions with and without a market; the 1.65 gate for a market, an item's place and a service each alone; and, on a real database, the place before a reply (and without the telling a regeneration replaces) and a seller'sonlyread off the player's card, a member's, a persona's and a blank sheet.ammo,armor,item-charges,item-gate,item-use,item-use-outside,loot,money,weapon-modes,weapons) strip the 1.65 keys as they strip the 1.64 ones;capability-package-lifecyclepins 1.65;capability-gm-verbsreservesplace.e2e/game-ruleset-markets.e2e.ts: a real turn against a local model fixture names a market town and buys a dear coat and a bed at the watch-house (paid with change, the coat in the bag, the bed not), a watch pistol is refused as only a city sells it, both notifications show, and the next turn's prompt carries that town's MARKET block.60 deliberate breaks, each caught by these lanes and the e2e.
GitHub CodeRabbit's first review raised three real findings, all fixed in
e53f064a7: a place tag a player types no longer counts (only the Game Master's replies are read); a service is refused by the add operation itself, so nothing puts one in a bag, and the picker leaves services out; and a buy whose items do not all fit is refused whole, so nothing is paid for what is not delivered. Each has a lane case (and the picker an e2e check) and a deliberate break. Local CodeRabbit on that commit: no findings.Local CodeRabbit raised eight findings over three passes:
onlyread live state off the newest stored row, which during a regeneration is the replaced telling's. Fixed: the route hands the market the turn's own live state, the one the reply's items are used with (a lane case where Resolve left decides, one break). The route's choice of that state is the same expression the item uses read, proven by typecheck rather than a regeneration e2e.only(one chat read per turn, only in games with a market); wrapping the MARKET block's building in its own try/catch (the item facts, purses and carrying status beside it are built from the same calls, unwrapped, and a catalog that cannot be read is already logged and left out by the book loader); and addingserviceto the chandler in the docs' shortened example (a shortened example; services are described on their own below it).Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
docs/extending/writing-rulesets.md,docs/game/party-and-npcs.md,docs/development/game-rulesets-and-sheets-implementation.md(all carried bydocs-i18n),docs/extending/ruleset.schema.json(generated), andCHANGELOG.md. Translations: #6813 is the items arc's follow-up; this PR is added to it there.UI evidence (if applicable)
A market town turn: "You bought Lantern-keeper's coat for 12 shillings." and "You bought A bed at the watch-house for 6 pennies." (captured by
e2e/game-ruleset-markets.e2e.tsasmarket-bought.png).Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.