step 6.1: done
This commit is contained in:
+7
-7
@@ -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)
|
||||
- **Next step:** 6.2 — Level-gated shop stock (filter by character level) + UI page
|
||||
- **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
|
||||
- **Updated:** 2026-10-21
|
||||
- **Was the last session cut off mid-task?** No
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
- `src/services/combatLogService.js` — `getCombatLog(characterId, limit)` → recent fights.
|
||||
- `src/services/characterService.js` — `createCharacter`, `getCharacterProfile`, `getCharacterIdForUser`.
|
||||
- `src/services/inventoryService.js` — `listInventory`, `equipItem`, `unequipItem`, `useConsumable`. Uses WeakMap stmt cache.
|
||||
- `src/services/shopService.js` — **NEW**: `getStock`, `buyItem`, `sellItem`. Uses WeakMap stmt cache. Sell value = 40% of buy_price (materials use rarity default).
|
||||
- `src/routes/shop.js` — **NEW**: `GET /api/shop`, `POST /api/shop/buy`, `POST /api/shop/sell`.
|
||||
- `src/services/shopService.js` — `getStock`, `buyItem`, `sellItem`. Uses WeakMap stmt cache. Sell value = 40% of buy_price (materials use rarity default).
|
||||
- `src/routes/shop.js` — `GET /api/shop`, `POST /api/shop/buy`, `POST /api/shop/sell`.
|
||||
- `src/routes/inventory.js` — `GET /api/inventory`, `POST /api/inventory/equip`, `POST /api/inventory/unequip`, `POST /api/inventory/use`.
|
||||
- `src/utils/time.js` — `now()/setNow()/resetNow()`; never call `Date.now()` in services.
|
||||
- `src/routes/zones.js` — `GET /api/zones`.
|
||||
- `src/routes/combatLog.js` — `GET /api/combat-log`.
|
||||
- `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` — **NEW**: 14 integration tests (stock listing, level gating, buy, sell, error paths, round-trip spread).
|
||||
- `tests/integration/shop.test.js` — 14 integration tests (stock listing, level gating, buy, sell, error paths, round-trip spread).
|
||||
- `tests/integration/inventory.test.js` — 20 integration tests (13 equip/unequip + 7 consumable).
|
||||
- `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.
|
||||
@@ -70,9 +70,9 @@
|
||||
- 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; ensure stock query properly filters by level) + UI shop page.
|
||||
- **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.
|
||||
- **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.
|
||||
|
||||
## 8. Open Known Issues
|
||||
|
||||
Reference in New Issue
Block a user