step 6.2: done
This commit is contained in:
+13
-9
@@ -4,8 +4,8 @@
|
||||
> If this file disagrees with the code, trust the code and fix this file.
|
||||
|
||||
## 1. Where we are
|
||||
- **Last completed step:** 6.1 (Shop API: GET /api/shop, POST /api/shop/buy, POST /api/shop/sell) — TICKED in STATUS.md
|
||||
- **Next step:** 6.2 — Level-gated shop stock (ensure stock query properly filters by level) + UI shop page
|
||||
- **Last completed step:** 6.2 (Shop UI: `shop.html` + `shop.js` with buy/sell tabs, level-gated stock display, material sell list) — TICKED in STATUS.md
|
||||
- **Next step:** 6.3 — Additional tests: buy with insufficient gold (already covered in shop.test.js), sell equipped item (must be rejected), concurrent double-buy safety (transaction)
|
||||
- **Updated:** 2026-10-21
|
||||
- **Was the last session cut off mid-task?** No
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|---|---|
|
||||
| `npm install` | succeeds |
|
||||
| `npm run migrate` | applies 001–004 and 006 / "nothing to do" |
|
||||
| `npm test` | **132 passing, 0 failing** (85 unit + 47 integration) |
|
||||
| `npm test` | **137 passing, 0 failing** (85 unit + 52 integration) |
|
||||
|
||||
## 3. What exists now (files that matter)
|
||||
- `src/game/stats.js` — `calcDerived()` is the ONLY derived-stat formula. Also re-exports xpToNext/checkLevelUp.
|
||||
@@ -33,19 +33,23 @@
|
||||
- `src/db/migrations/003_content.sql` — also SEEDS zones/monsters/items/loot (INSERT OR IGNORE).
|
||||
- `src/db/migrations/004_inventory.sql` — inventory table, FK constraints, partial unique index for equipped slots.
|
||||
- `tests/integration/shop.test.js` — 14 integration tests (stock listing, level gating, buy, sell, error paths, round-trip spread).
|
||||
- `tests/integration/shop-page.test.js` — 5 integration tests (stock listing, levelOk, sell pricing, buy/sell round-trip).
|
||||
- `tests/integration/inventory.test.js` — 20 integration tests (13 equip/unequip + 7 consumable).
|
||||
- `public/shop.html` — dedicated shop page with buy/sell tabs.
|
||||
- `public/js/shop.js` — shop page JS: render stock, render materials, buy/sell handlers, tab switching, auth guard.
|
||||
- `public/game.html` — dashboard with stats panel, tabbed action panel (Hunt/Inventory), equipment panel, inventory grid.
|
||||
- `public/js/game.js` — full hunt UI + inventory UI.
|
||||
- `public/css/main.css` — zone cards, combat log, result panel, toast styles, tabs, equipment panel, inventory grid, tooltips, rarity colors.
|
||||
|
||||
## 4. Half-finished / fragile things
|
||||
- No shop UI yet (Phase 6.2).
|
||||
- No shop link in game.html top-bar navigation (users must navigate manually to /shop.html).
|
||||
- No expedition UI yet (Phase 7).
|
||||
- No leaderboard UI yet (Phase 8).
|
||||
- HP never regenerates naturally; only level-up restores it.
|
||||
- No restart-persistence test for sessions.
|
||||
- `npm run seed` script in package.json points to nonexistent `scripts/seed.js`.
|
||||
- Equipment bonuses not yet passed into combat (Issue #5 in STATUS.md).
|
||||
- Step 6.3 needs: sell equipped item rejection test, concurrent double-buy safety test.
|
||||
|
||||
## 5. Decisions & deviations from the docs
|
||||
- D-004..D-007 in `docs/DECISIONS.md` (combat rounds, equipment counted once, session store, clock).
|
||||
@@ -69,11 +73,11 @@
|
||||
- Transaction callback args must match the call order exactly — passing `qty` as the second arg when the callback expects `etype` silently misapplies the effect.
|
||||
- Error responses from route-level `AppError`s do NOT include `data` field — only `{ ok: false, error: { code, message } }`.
|
||||
|
||||
## 7. Next-step briefing (6.2)
|
||||
- **Goal:** Level-gated shop stock (already partially done — `levelOk` flag exists and stock query filters by level; verify completeness) + UI shop page.
|
||||
- **Docs:** GAME_DESIGN.md §Economy, API.md, UI_GUIDE.
|
||||
- **Files to create/modify:** `public/shop.html`, `public/js/shop.js`, verify shopService stock filtering is complete.
|
||||
- **Key rules:** Shop stock should only show items where character level >= item min_level. Materials always visible for selling.
|
||||
## 7. Next-step briefing (6.3)
|
||||
- **Goal:** Additional shop tests — buy with insufficient gold (already covered in shop.test.js), sell equipped item (must be rejected), concurrent double-buy safety (transaction).
|
||||
- **Docs:** GAME_DESIGN.md §Economy, API.md.
|
||||
- **Files to modify:** `tests/integration/shop.test.js` or `tests/integration/shop-page.test.js`.
|
||||
- **Key rules:** Sell equipped item → should reject (item is in slot, still in inventory but equipped). Concurrent double-buy → two requests for same item simultaneously, only one should succeed if gold is insufficient for both.
|
||||
|
||||
## 8. Open Known Issues
|
||||
STATUS.md issues 1–6 (balance, dangling `seed` script, restart test, equipment-in-combat, HP regen, zone min_level balance).
|
||||
|
||||
Reference in New Issue
Block a user