v1.3.0: per-player money & reputation in engine + actions (ISS-110)
CI / build + unit + e2e (pull_request) Successful in 13m20s

This commit is contained in:
2026-09-26 17:03:15 +00:00
parent 306f81aec6
commit d00a012c4b
14 changed files with 153 additions and 35 deletions
+4 -2
View File
@@ -1,5 +1,5 @@
import { getGameDb, persist } from '@/lib/db/client';
import { getLocalPlayer, updateLocalPlayerEconomy } from '@/lib/db/localPlayer';
import { LOCAL_PLAYER, getLocalPlayer, updateLocalPlayerEconomy } from '@/lib/db/localPlayer';
import { getStateSnapshot } from '@/lib/game/state';
import { tickNow } from '@/lib/sim/engine';
@@ -46,10 +46,12 @@ export async function POST(req: Request) {
try {
const inst = await getGameDb();
await tickNow(); // clock is current before the snapshot we return (same as siblings)
// v1.3.0 (ISS-110): admin-style hook — no session, grants to the SEEDED local account (the
// player the e2e suite plays via mint-player-session's default).
const player = await getLocalPlayer(inst);
await updateLocalPlayerEconomy(inst, { cash: Math.round((player.cash + amount) * 100) / 100 });
await persist(inst);
return Response.json(await getStateSnapshot());
return Response.json(await getStateSnapshot(LOCAL_PLAYER.id));
} catch (err) {
console.error('test hook failed', err);
return Response.json({ error: 'test hook failed' }, { status: 500 });