mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6794] [MERGED] feat(game): items keep who they are when renamed (item ids and nicknames) #7335
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#7335
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/6794
Author: @kolacheee
Created: 9/27/2026
Status: ✅ Merged
Merged: 9/28/2026
Merged by: @kolacheee
Base:
staging← Head:feat/inventory-item-ids📝 Commits (10+)
6ae20d6feat(game): items keep who they are when renamed (item ids and nicknames)e6909aeMerge remote-tracking branch 'origin/staging' into feat/inventory-item-idsa6b9a66fix(game): unique fight line names, effects found for nicknamed lines, and the count an add reportsbbb549dfix(game): match a fight's item effects by each item's own name first1a86069Merge remote-tracking branch 'origin/staging' into feat/inventory-item-ids39043d0fix(game): draw a detailed entry by id first and leave untouched entries alonee3b7f94Merge remote-tracking branch 'origin/staging' into feat/inventory-item-idsc66e7b2fix(game): answer takes and gives with the count of the item they moved7b44118fix(game): carry an entry of an item nobody holds as that item, and say both names plainly on Use48438b5fix(game): trust an own name read off an id only when it makes that id again, and name an add by its stack📊 Changes
20 files changed (+1274 additions, -394 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)📝
docs/game/party-and-npcs.md(+4 -4)📝
e2e/game-inventory-bags.e2e.ts(+27 -5)📝
packages/client/src/components/game/GameInventory.tsx(+88 -51)📝
packages/client/src/components/game/GameSurface.tsx(+64 -50)📝
packages/client/src/localization/locales/en.json(+4 -1)📝
packages/server/src/routes/combat-director.routes.ts(+32 -9)📝
packages/server/src/routes/game-inventory.routes.ts(+1 -1)📝
packages/server/src/services/game/combat-director.service.ts(+3 -1)📝
packages/server/src/services/game/game-inventory.service.ts(+3 -6)📝
packages/server/src/services/game/gm-prompts.ts(+12 -5)📝
packages/shared/src/features/combat-director.ts(+3 -1)📝
packages/shared/src/types/game-state.ts(+3 -0)📝
packages/shared/src/utils/game-inventory-ops.ts(+95 -85)📝
packages/shared/src/utils/game-inventory-stacks.ts(+380 -102)📝
packages/shared/src/utils/game-inventory-tags.ts(+19 -9)📝
packages/shared/src/utils/game-inventory-turns.ts(+4 -2)📝
scripts/regressions/combat-director-route.regression.ts(+104 -0)📝
scripts/regressions/game-inventory-bags.regression.ts(+303 -48)📝
scripts/regressions/game-inventory-stacks.regression.ts(+123 -14)📄 Description
Linked issue
Closes #6791
Why this change
Game Mode's inventory told items apart only by their names:
removeno longer found it, and a fight listed it as another item.This is the first half of slice I2b of the ruleset items plan (the user's ruling during #6789's review): items get a stable identity before ruleset items, which need one even more, arrive in the second half. It needs no Capability API change.
What changed
name, which a rename never changes.plain:and its letters and digits in any script, or a fingerprint for a name with none), so saved games stay byte-identical. Ruleset items will store a catalog reference in the next PR.who="Bram"finds Bram's nickname even when the player holds an item of that own name.Grandpa's rope (Rope) ×2, and the command line says to write either name, never both.item), stamped the first time the Engine moves it; an entry written without one (by a tracker, or before this) is matched by name once. A rename only changes the name an entry shows, so its description and place survive renames and gifts. The rename records and all the rename guessing are gone.docs/game/party-and-npcs.md, and the CHANGELOG. The ruleset items plan records how identity was built, and that I3's invented items should useinvented:<id>(a colon never appears in a catalog id).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent on this branch at
9b5bbc6d9(the feature commit, the review fixesa6b9a66e1,bbb549d12,39043d082,c66e7b2f5,7b441183e,48438b506,41c99c345,93d31a009,df39d128c,2fa3667beand9b5bbc6d9, and merges of staging up toe28d46240). The full gates below ran at2fa3667be; the last commit,9b5bbc6d9, changes one sentence of the Game Master's prompt and the lane line that checks it, and passedpnpm checkand the bags lane:pnpm checkexits 0, andpnpm localization:checkexits 0.pnpm regression:nodepasses 421/421.provider-compatfailed once, when this machine could not look up Google's API host (EAI_AGAIN), and passed when rerun; this PR does not touch providers.pnpm smoke:uipasses 7/7.pnpm regression:ui e2e/game-inventory-bags.e2e.ts e2e/game-inventory-stacks.e2e.ts e2e/game-combat-ai.e2e.ts e2e/game-combat-director.e2e.ts --project=desktop-chromium --workers=1passes 13/13.Lanes:
game-inventory-stacks.regression.ts: a rename is a nickname (same item, counted and named either way, never merged, cleared by the own name, read back and dropped when it is the own name); which item a name makes (case, punctuation and Latin, Greek and Cyrillic accents aside, every script kept with the marks that belong to its letters, such as がく and かく staying two items, a plus or minus sign in front of a number kept, so "Sword +1" and "Sword -1" stay two items, fingerprints for names with no letters, long names not cut into one); carry-over keeping nicknames, bringing back an entry of an item nobody holds as that item, and bringing a fingerprinted id back by its entry's name.game-inventory-bags.regression.ts: gives keeping nicknames (part and whole); the detailed inventory keyed by item (companions' changes ignored, renames only renaming, an entry followed by id whatever it is called, drawn from before an entry found by name, another item's entry never moved for sharing a name, entries without an id matched once and stamped on a gain or a loss, a name the item went by looked for before the one it takes now, and an entry under another held item's own name left to that item); Game Master tags naming a nicknamed item either way, a give by nickname, an add by a name another bag holds; takes, gives and adds answering with the count of the item they moved; own names winning over nicknames and a named bag read alone; the prompt showing both names and telling the Game Master to write one of them, never both; a nickname counting as a player's change for the tellings record.combat-director-route.regression.ts: a cord nicknamed "Potion" beside a real potion; the fight lists "Potion (Cord)" and "Potion", and using the cord's line spends the cord while the potion stays. A fight whose listed item is gone refuses a spend that another item's nickname would make up ("Inventory changed").Forty deliberate breaks of these rules, in the shared helpers, the fight route and the prompt, were each caught.
Local CodeRabbit (
coderabbit review --agent), run before each push:39043d082: the detailed inventory draws from the entry carrying the item's id before one found by name and leaves untouched entries alone, and the classic fight screen finds a used item's line by normalized name. Fixing the first turned up one of my own: a numbered line for an item without a nickname had no own name to be spent by, which the same commit fixes.7b441183e: carry-over judges an entry with an item id only by that id, and Use says "Nickname (Name)" in the Game Master's own form instead of through a translation.48438b506: carry-over reads an own name off an id only when that name makes the same id again, and Add names the stack the item went onto.41c99c345: accents come off Latin, Greek and Cyrillic letters only, so a Japanese dakuten or a Devanagari vowel sign keeps two items apart; a fight's spend is checked against that exact item; and the bags browser test clears a nickname by typing the own name.93d31a009: a plus or minus sign in front of a number stays in the id.df39d128c: a cord nicknamed "Rope" could take the real rope's detailed entry when that entry had no id. Names the item went by are looked for first, and a name that is another held item's own name is left to that item. The same commit fixes a step I added to the bags browser test, which clicked the already selected stack (closing it) before clearing its nickname.2fa3667be: the docs said a nicknamed stack never merges into anything, beside a Merge bullet saying stacks of one item merge whatever each is called. They now say setting a nickname never merges a stack by itself.9b5bbc6d9: the prompt said a "Nickname (Name)" item could be named either way, which left room to copy the whole label intoitem=, and no item goes by that. It now says to write either name, never both. This was the only finding of the last pass, at2fa3667be.GitHub CodeRabbit's first review found three more, all fixed in
a6b9a66e1: fight lines could still share a name when a third item is really called "Potion (Cord)"; an item's effect named by its own name was not found for a line shown by its nickname; and an add by a nickname another bag holds answerednow="0". Its translated-docs note is answered by the batched[docs-i18n]issue. Its second review found one more, fixed inbbb549d12: an item really called "Potion (Cord)" lost its effect to a cord listed under that name, so each line now takes the effect named by its own name first. Its third review's outside-diff finding (atakecould answer with the count of another item once the named item was gone) is fixed inc66e7b2f5: which items a name means is settled before a take or a give, andnowcounts only those items.Clicked through by the agent, in a separate Engine instance on its own ports and data folder, with a stand-in model that answers with scripted replies (light mode, desktop width):
{ name: "Rope", nickname: "Grandpa's rope" }; the slot shows the nickname, and the header reads "Grandpa's rope (Rope) carried by Ada".remove item="Rope"andgive item="Grandpa's rope" count="2" to="Bram": the prompt showedAda: Grandpa's rope (Rope) ×4and the new command-line sentence; both tags were answeredok, and Bram's new stack kept the nickname.Also run by the agent after opening, in the same instance:
item="Rope". That tag was a give to "environment", which the Engine refused asunknown-characterbefore looking the item up. Itsadd item="Torch"in the same reply was carried out. In the other turns it wrote no inventory tag, so nothing changed, as it should. A small local model rarely writes the command at all; which name finds which item is the Engine's own logic, covered by the lanes and the stand-in turns above.Nothing is left to verify by hand.
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 for the items arc: this section joins the batched[docs-i18n]issue opened after the arc's last slice, so no per-PR issue is opened.UI evidence (if applicable)
The bags browser test adds an item by name and renames a stack, then checks the nickname shows, that adding the item's own name tops up the same stack, and that typing the own name back clears the nickname.
Summary by CodeRabbit
New Features
Bug Fixes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.