Add reusable content sets publication previews and focused input handling
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
# Milestone 2: content and input foundations
|
||||
|
||||
Implemented for manual testing. Model rigs, equipment attachments, animations, and
|
||||
sound hooks remain in milestone 4.5. Playwright authoring/runs remain deferred.
|
||||
|
||||
## Available in Control -> Content
|
||||
|
||||
- **Requirement sets:** immutable named collections of up to eight integer
|
||||
thresholds. Titles support existing achievement/stat metrics; equipment accepts
|
||||
sets containing only level/stat thresholds. Existing title prerequisites on
|
||||
equipment remain available separately.
|
||||
- **Effect sets:** immutable named collections of signed flat/percentage stat
|
||||
modifiers. These are the first reusable effect building blocks; timed damage,
|
||||
healing, auras, and spell behavior arrive with their later systems.
|
||||
- **Composition:** title/equipment drafts can select up to eight sets of each kind
|
||||
and include inline values. Repeated thresholds resolve to the highest value;
|
||||
modifiers add using the existing stat formula. The final result still obeys
|
||||
title/item limits. Unsupported equipment metrics fail server validation.
|
||||
- **Preview changes:** validates and shows the resolved definition against the
|
||||
draft's catalog version. It does not publish, increment the version, create
|
||||
items/awards, or write an audit event. Form edits clear the previous preview.
|
||||
- **Publish changes:** repeats the same content validation under the existing
|
||||
catalog lock and writes the catalog version and audit atomically. Stale editors,
|
||||
duplicate IDs, missing sets, mixed payloads, unsupported values, and repeated
|
||||
references are rejected. Identical publication retries return the original result.
|
||||
|
||||
Sets are expanded into concrete values at publication, not stored as live links on
|
||||
acquired gear or earned titles. Published definitions/sets are append-only: use a new
|
||||
ID for a variation. Sets cannot reference other sets, so recursive composition is
|
||||
not supported. Old catalogs without these collections remain valid. No new table
|
||||
or title-ownership migration is required for this milestone.
|
||||
|
||||
Server implementations: `content/library.go`, `store/catalog_preview.go`, and the
|
||||
existing catalog publication path. Shared content API models are generated from
|
||||
`schemas/protocol.json` alongside the unchanged gameplay intent/snapshot shapes.
|
||||
The read-only preview uses authenticated same-origin POST
|
||||
`/api/control/catalog/preview` with the same draft body as publication.
|
||||
|
||||
## Input and menus
|
||||
|
||||
Keyboard and movement buttons feed named input actions rather than duplicating
|
||||
gameplay dispatch. Existing bindings remain: WASD/arrows move, E gathers, Space
|
||||
attacks, and I opens inventory. Controller support and rebinding UI arrive later.
|
||||
|
||||
Esc closes one focused menu: game inventory/settings, Control character/command
|
||||
dialogs, or the content draft. With multiple panels open, only the focused/most
|
||||
recent menu closes. Focus returns to its opener where available. Esc works while
|
||||
editing a field and does not trigger an underlying game action.
|
||||
|
||||
Opening a game menu stops movement/auto-approach; typing in fields cannot move or
|
||||
attack. Key release, pointer capture loss, tab hiding, and window blur clear held
|
||||
movement. Closing a draft discards unsaved edits; closing while a request is in
|
||||
flight does not cancel that submitted request. Publication results still appear
|
||||
in the catalog/audit. Arrival/death/disconnect screens retain their existing flows.
|
||||
|
||||
## Manual test checklist
|
||||
|
||||
Use unique test IDs; published test content cannot currently be deleted.
|
||||
|
||||
1. In **Control -> Content -> Requirement sets**, create `m2_level` with level >= 1.
|
||||
Fill a reason, preview, and confirm the catalog version/audit has not changed.
|
||||
Publish; refresh and confirm the new set and one audit/version increment.
|
||||
2. Create effect set `m2_defence` with defence +2 flat and movement speed -5%.
|
||||
Preview/publish it. Create a ring with those two sets, drop chance 0, and any
|
||||
inline modifiers you want to inspect. Preview shows the expanded requirements
|
||||
and effects. Publish and confirm the equipment list contains the same values.
|
||||
3. Use **Control -> Characters -> Manage items and titles** to give the ring to a
|
||||
living character. Equip/unequip it in game and inspect the final stat breakdown.
|
||||
Confirm existing inventory, titles, health, and daily usage were not reset.
|
||||
4. Try publishing an already-used set ID: expect rejection and no version change.
|
||||
For stale editing, open drafts in two Control tabs, publish one, then preview/
|
||||
publish the other: expect a refresh conflict, not silent overwriting.
|
||||
5. Open inventory and settings together. Focus a settings field and press Esc:
|
||||
settings closes, inventory stays open. Press Esc again: inventory closes.
|
||||
Repeat in a Control draft and a character/command dialog; only that menu closes.
|
||||
6. Move with WASD/arrows and the on-screen controls, gather with E, attack with
|
||||
Space. Opening a menu or switching tabs stops movement. Typing in fields must
|
||||
not move/attack; returning focus must not leave a movement key stuck.
|
||||
|
||||
## Verification and limits
|
||||
|
||||
Required verification: TypeScript check, production build, generated-contract
|
||||
freshness, and Go tests. Added server tests cover preview non-mutation, composed
|
||||
publication parity, reference validation, retry identity, immutable IDs, restart
|
||||
persistence, and anonymous/player/cross-origin/strict-JSON boundaries. Existing
|
||||
lifecycle tests remain in the full Go suite. PostgreSQL-specific tests require
|
||||
`TEST_DATABASE_URL`; no new capacity/load claim is made.
|
||||
|
||||
Manual browser testing is the user's handoff; automated Playwright was not run.
|
||||
This milestone does not activate resurrection, hub travel, character-title
|
||||
migration, new resource/mob definitions, or model/animation/audio systems.
|
||||
Pause after commit/push for feedback before milestone 3.
|
||||
Reference in New Issue
Block a user