v1.5.0: shared-world spawn quality rule — max reputation across players (ISS-111)
CI / build + unit + e2e (pull_request) Successful in 13m53s
CI / build + unit + e2e (pull_request) Successful in 13m53s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { randomInt, randomUUID } from 'node:crypto';
|
||||
import { getGameDb, persist } from '@/lib/db/client';
|
||||
import { getLocalPlayer } from '@/lib/db/localPlayer';
|
||||
import { getSharedWorldReputation } from '@/lib/db/localPlayer';
|
||||
import * as schema from '@/lib/db/schema';
|
||||
import { loadAirportsGeoJson } from '@/lib/airports';
|
||||
import { generatePackage, mulberry32 } from '@/lib/game/seed';
|
||||
@@ -83,9 +83,9 @@ export async function POST(req: Request) {
|
||||
}
|
||||
|
||||
const rng = mulberry32(randomInt(0, 2 ** 31));
|
||||
// v0.38.0 (ISS-072): hook-created packages carry the LIVE account reputation — same job quality
|
||||
// as engine spawns; never force a fixed value here.
|
||||
const player = await getLocalPlayer(inst);
|
||||
// v0.38.0 (ISS-072): hook-created packages carry shared-world job quality — the same MAX-reputation
|
||||
// rule as engine spawns (v1.5.0, ISS-111); never force a fixed value here.
|
||||
const reputation = await getSharedWorldReputation(inst);
|
||||
const created = generatePackage({
|
||||
id: randomUUID(),
|
||||
airports,
|
||||
@@ -97,7 +97,7 @@ export async function POST(req: Request) {
|
||||
weightKg: input.weightKg as number | undefined,
|
||||
// Omitted → force null (no roll) so existing e2e reward/rep assertions stay deterministic.
|
||||
special: input.special === undefined ? null : (input.special as string | null),
|
||||
reputation: player.reputation,
|
||||
reputation,
|
||||
});
|
||||
await inst.db.insert(schema.packages).values(created);
|
||||
await persist(inst);
|
||||
|
||||
Reference in New Issue
Block a user