mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6762] [MERGED] feat(game): change an inventory stack by any amount, split it and merge it #7317
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#7317
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/6762
Author: @kolacheee
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/27/2026
Merged by: @kolacheee
Base:
staging← Head:feat/inventory-stacks📝 Commits (3)
832372ffeat(game): change an inventory stack by any amount, split it and merge it747b9d6Merge remote-tracking branch 'origin/staging' into feat/inventory-stacksea894b5fix(game): stack ids trim dashes without a backtracking pattern, and a fight takes item totals past 10,000📊 Changes
15 files changed (+1287 additions, -428 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/game/party-and-npcs.md(+11 -0)➕
e2e/game-inventory-stacks.e2e.ts(+129 -0)📝
packages/client/src/components/game/GameInventory.tsx(+231 -100)📝
packages/client/src/components/game/GameSurface.tsx(+244 -271)➕
packages/client/src/lib/game-inventory-amount.ts(+20 -0)📝
packages/client/src/localization/locales/en.json(+19 -0)📝
packages/client/vite.config.ts(+3 -0)📝
packages/server/src/routes/combat-director.routes.ts(+22 -11)📝
packages/server/src/routes/game.routes.ts(+2 -38)📝
packages/server/src/routes/generate.routes.ts(+5 -6)📝
packages/shared/src/index.ts(+1 -0)➕
packages/shared/src/utils/game-inventory-stacks.ts(+270 -0)📝
scripts/regressions/combat-director-route.regression.ts(+22 -2)➕
scripts/regressions/game-inventory-stacks.regression.ts(+306 -0)📄 Description
Linked issue
Closes #6759
Why this change
Game Mode's inventory could only change a stack one item at a time, so adding or removing 300 of something took 300 clicks, and there was no way to split a pile. Behind that, inventory entries had no id, and every operation found a stack by its name. Two consequences, both fixed here:
addInventoryUnit). That only worked because two stacks of one name never existed.mergeGameInventoryItems), so any second stack would have been silently lost.This is slice I0 of the ruleset items plan. Per-character bags, ruleset item catalogs, currencies and loot build on stack ids. It needs no ruleset and no Capability API change.
What changed
packages/shared/src/utils/game-inventory-stacks.ts) holds pure helpers the client, the combat director and the session carry-over all use.+Nor-Nadds or takes that many. Setting a stack of more than one to 0 asks first.[inventory: add]adds to the first stack of that name, or makes a new one.[inventory: remove]takes from the stacks of that name top to bottom and removes the ones it empties. It never takes more than there is, and the notification and journal say how many really went.playerStats.inventory) keeps one entry per item and follows every change of count. A split, a merge or a reorder leaves it alone.docs/game/party-and-npcs.md(no page described the inventory screen before), and the CHANGELOG.GameSurfacenow share one save helper (commitInventory) instead of six copies of the save-and-roll-back code. Their fallback error toasts are localized.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on
832372fef(this branch's one commit on staging72cdaeb46):pnpm checkexits 0 (localization and the new bundle budget included),pnpm regression:nodepasses 411/411, andpnpm smoke:uipasses 7/7.pnpm regression:ui e2e/game-inventory-stacks.e2e.ts e2e/game-combat-ai.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1passed 12/12 twice. A third run passed 11/12: the #6741 style test flaked, because the fight's seed is random and the rats can down Ada before her first turn. That test does not touch the inventory; its fix is a separate PR.The build now fails any lazy chunk past 500 KiB (added on staging in #6756), and this change took
GameSurface0.09 kB past it. The inventory screen now has its own chunk (game-inventory, 13.7 kB), the way the narration formatter and tag parser already do, which leavesGameSurfaceat 487 kB.scripts/regressions/game-inventory-stacks.regression.tscovers:+N,-Nand refusals.scripts/regressions/combat-director-route.regression.tsnow seeds the potion as two split stacks. It checks that the fight sees one total, and that spending one empties the first stack and keeps the second with its id.e2e/game-inventory-stacks.e2e.ts, starting from a saved inventory without ids:+50into one stack;Local CodeRabbit (
coderabbit review --agent --committed), four passes: 1, 2, 5 and 0 findings, all fixed:Still to verify by hand (not done by the agent):
+10,-3and a plain number into the amount field, and confirm each.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/game/party-and-npcs.md(carried bydocs-i18n) andCHANGELOG.md. Translations are batched: this section joins the next batched[docs-i18n]issue for the items arc, so no per-PR issue is opened.UI evidence (if applicable)
The browser test saves two screenshots: the split row open with a size typed in, and two stacks of one item after a split and a typed
+50.Summary by CodeRabbit
+N/-Nadjustments; split, merge matching stacks, reorder items, and rename stacks.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.