[PR #8623] [MERGED] Let a ruleset layer change where items are sold and what drops (Capability API 1.813) #8710

Closed
opened 2026-11-07 17:39:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8623
Author: @kolacheee
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @kolacheee

Base: staging ← Head: claude/project-thread-hl9xui


📝 Commits (2)

  • 86e4ce2 Let a ruleset layer change where items are sold and what drops (Capability API 1.813)
  • 1bea058 Refuse a ruleset whose market and layers' unsold wares together pass 24

📊 Changes

11 files changed (+744 additions, -50 deletions)

View changed files

📝 docs/extending/ruleset-items.md (+2 -1)
📝 docs/extending/ruleset-layers-and-translations.md (+20 -2)
📝 docs/extending/ruleset.schema.json (+185 -0)
📝 docs/game/rulesets.md (+1 -1)
📝 packages/server/src/services/capability-packages/package-manager.service.ts (+15 -0)
📝 packages/shared/src/features/rulesets/layers.ts (+34 -0)
📝 packages/shared/src/features/rulesets/market.ts (+9 -1)
📝 packages/shared/src/schemas/capability-package.schema.ts (+7 -1)
📝 packages/shared/src/schemas/ruleset.schema.ts (+142 -41)
📝 scripts/regressions/capability-package-lifecycle.regression.ts (+3 -3)
➕ scripts/regressions/game-ruleset-layer-items.regression.ts (+326 -0)

📄 Description

Requested by Alyssa · project thread

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.

Linked issue

No issue: requested by the maintainer for the SRD 5.1 ruleset's Low magic layer, which ships in a follow-up 5e package (1.0.2) to the Agents catalog.

Why this change

A low-magic setting keeps magic items in the world but makes them rare and keeps them out of shops. Today a layer can only hide catalog entries, which removes an item from the game entirely (no loot, no Game Master hand-outs). Layers had no way to change a market or a loot table.

What changed

  • Layer items (Capability API 1.813), narrowing or replacing only, like the rest of a layer:
    • market.removeSellers: sellers there are none of while the layer is on. A market always keeps at least one seller; a removal that would empty it (even two layers together) is not made, because a market with no sellers lets anybody sell everything.
    • market.unsold: item filters no seller has among their wares, appended to the market's own new unsold.
    • lootTables: replace tables the ruleset already has, by id, with the same shape; the last active layer that replaces one wins.
  • items.market.unsold on the base market: an item it picks is sold at no place (rulesetItemSoldRank is past every place), so it is never a ware, is left out of the Game Master's MARKET block and cannot be bought as one. A seller's stock table may still roll it, and sellers still buy it back.
  • Applied in layered() in one place, so the market, the item book, loot rolls, combat loot and the prompt all read the layered items with no change of their own. Nothing is added to the catalogs, so an unsold item stays an item the game offers.
  • Import checks: known sellers, at least one left, known item words, and only existing tables replaced, each replacement held to a loot table's own rules (the loot-table and item-filter checks are hoisted so both paths share them).
  • Install gate at 1.813 for a layer's items or a market's unsold; supportedCapabilityApi to 1.813; ruleset.schema.json regenerated.
  • Docs: layers page (the new effect, what a layer still cannot do, the 1.813 limit), items page (unsold), Game Mode rulesets page (one clause).

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

Run by Claude, not a human check:

  • New scripts/regressions/game-ruleset-layer-items.regression.ts on Gravewatch: sellers removed, unsold appended, tables replaced in order, base definition untouched, two layers that would empty the market keep its sellers, last replacement wins; an unsold rare item is refused (not-here) while a common arm sells; the smith's replaced odd lot still sells the pistol from stock; the MARKET block lists no rare ware and no chapel; import refusals; the 1.813 gate.
  • Passing after a rebase on staging 2e0dadf0c: game-ruleset-layer-items, game-ruleset-layers, game-ruleset-markets, capability-package-lifecycle; before the rebase also ruleset-layers-client, game-ruleset-money, game-ruleset-loot. packages/shared lint (tsc) and server tsc --noEmit clean; Prettier clean on changed files; ruleset.schema.json up to date.
  • Checked against the real SRD 5.1 package with its Low magic layer: the layer applies, a Potion of Healing is refused in a city while a Longsword sells, the fence's odd lot still has stock, and magic loot drops about a fifth as often.
  • Not run: full pnpm check, the app, Docker. Local Node was 22, not 24.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Translation follow-up: #8624.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01F2Yga6tiUUAsPShc6cnJui


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8623 **Author:** [@kolacheee](https://github.com/kolacheee) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@kolacheee](https://github.com/kolacheee) **Base:** `staging` ← **Head:** `claude/project-thread-hl9xui` --- ### 📝 Commits (2) - [`86e4ce2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/86e4ce258849ac1281f3836394112afe284194f5) Let a ruleset layer change where items are sold and what drops (Capability API 1.813) - [`1bea058`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1bea058dfcbbc9b81dcc2aee2f46e26989380a68) Refuse a ruleset whose market and layers' unsold wares together pass 24 ### 📊 Changes **11 files changed** (+744 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `docs/extending/ruleset-items.md` (+2 -1) 📝 `docs/extending/ruleset-layers-and-translations.md` (+20 -2) 📝 `docs/extending/ruleset.schema.json` (+185 -0) 📝 `docs/game/rulesets.md` (+1 -1) 📝 `packages/server/src/services/capability-packages/package-manager.service.ts` (+15 -0) 📝 `packages/shared/src/features/rulesets/layers.ts` (+34 -0) 📝 `packages/shared/src/features/rulesets/market.ts` (+9 -1) 📝 `packages/shared/src/schemas/capability-package.schema.ts` (+7 -1) 📝 `packages/shared/src/schemas/ruleset.schema.ts` (+142 -41) 📝 `scripts/regressions/capability-package-lifecycle.regression.ts` (+3 -3) ➕ `scripts/regressions/game-ruleset-layer-items.regression.ts` (+326 -0) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"kolacheee"} --> _Requested by **Alyssa** · [project thread](https://claude.ai/code/project/chan_01EL1ysiLvjMZWconWVBEYwo?thread=cmsg_01EL1ysiLvjMZWconWVBEYwo1MTS9bi1cUKrDe7tP2WRmX)_ > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. ## Linked issue No issue: requested by the maintainer for the SRD 5.1 ruleset's Low magic layer, which ships in a follow-up 5e package (1.0.2) to the Agents catalog. ## Why this change A low-magic setting keeps magic items in the world but makes them rare and keeps them out of shops. Today a layer can only hide catalog entries, which removes an item from the game entirely (no loot, no Game Master hand-outs). Layers had no way to change a market or a loot table. ## What changed - **Layer `items`** (Capability API 1.813), narrowing or replacing only, like the rest of a layer: - `market.removeSellers`: sellers there are none of while the layer is on. A market always keeps at least one seller; a removal that would empty it (even two layers together) is not made, because a market with no sellers lets anybody sell everything. - `market.unsold`: item filters no seller has among their wares, appended to the market's own new `unsold`. - `lootTables`: replace tables the ruleset already has, by id, with the same shape; the last active layer that replaces one wins. - **`items.market.unsold`** on the base market: an item it picks is sold at no place (`rulesetItemSoldRank` is past every place), so it is never a ware, is left out of the Game Master's MARKET block and cannot be bought as one. A seller's `stock` table may still roll it, and sellers still buy it back. - Applied in `layered()` in one place, so the market, the item book, loot rolls, combat loot and the prompt all read the layered items with no change of their own. Nothing is added to the catalogs, so an unsold item stays an item the game offers. - Import checks: known sellers, at least one left, known item words, and only existing tables replaced, each replacement held to a loot table's own rules (the loot-table and item-filter checks are hoisted so both paths share them). - Install gate at 1.813 for a layer's `items` or a market's `unsold`; `supportedCapabilityApi` to 1.813; `ruleset.schema.json` regenerated. - Docs: layers page (the new effect, what a layer still cannot do, the 1.813 limit), items page (`unsold`), Game Mode rulesets page (one clause). ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Run by Claude, not a human check: - New `scripts/regressions/game-ruleset-layer-items.regression.ts` on Gravewatch: sellers removed, `unsold` appended, tables replaced in order, base definition untouched, two layers that would empty the market keep its sellers, last replacement wins; an unsold rare item is refused (`not-here`) while a common arm sells; the smith's replaced odd lot still sells the pistol from stock; the MARKET block lists no rare ware and no chapel; import refusals; the 1.813 gate. - Passing after a rebase on staging 2e0dadf0c: `game-ruleset-layer-items`, `game-ruleset-layers`, `game-ruleset-markets`, `capability-package-lifecycle`; before the rebase also `ruleset-layers-client`, `game-ruleset-money`, `game-ruleset-loot`. `packages/shared` lint (tsc) and server `tsc --noEmit` clean; Prettier clean on changed files; `ruleset.schema.json` up to date. - Checked against the real SRD 5.1 package with its Low magic layer: the layer applies, a Potion of Healing is refused in a city while a Longsword sells, the fence's odd lot still has stock, and magic loot drops about a fifth as often. - Not run: full `pnpm check`, the app, Docker. Local Node was 22, not 24. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README) as needed - [x] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Translation follow-up: #8624. --- _Generated by [Claude Code](https://claude.ai/code/session_01F2Yga6tiUUAsPShc6cnJui)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01F2Yga6tiUUAsPShc6cnJui --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:07 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8710
No description provided.