1
0
Fork 0

feat(poker): pause placement XP behind POKER_XP_ENABLED switch

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Jason Fraley 2026-09-11 12:57:34 -04:00
parent 12f9da0c25
commit 117de8ecee

View file

@ -31,6 +31,13 @@ export interface PokerStats {
xpEarned: number; xpEarned: number;
} }
/**
* XP rework in progress: when false, finished games still record placements,
* hands won, and best chips, but xpEarned is untouched and no XP push fires.
* Flip to true to resume placement-based XP payouts.
*/
export const POKER_XP_ENABLED = false;
/** /**
* XP per placement, scaled by table size: * XP per placement, scaled by table size:
* 1st = 40x, 2nd = 20x, 3rd = 10x, 4th = 5x (times playerCount). * 1st = 40x, 2nd = 20x, 3rd = 10x, 4th = 5x (times playerCount).
@ -105,7 +112,7 @@ export async function awardPokerGameResult(
const xpByUser: Record<number, number> = {}; const xpByUser: Record<number, number> = {};
for (const result of results) { for (const result of results) {
const xp = xpForPlacement(result.placement, playerCount); const xp = POKER_XP_ENABLED ? xpForPlacement(result.placement, playerCount) : 0;
xpByUser[result.userId] = xp; xpByUser[result.userId] = xp;
try { try {
@ -123,7 +130,10 @@ export async function awardPokerGameResult(
} }
const current = readPokerStats(profile); const current = readPokerStats(profile);
const next = computePokerStatsDelta(current, result, playerCount); const delta = computePokerStatsDelta(current, result, playerCount);
const next: PokerStats = POKER_XP_ENABLED
? delta
: { ...delta, xpEarned: current.xpEarned };
const progression = (profile.progression ?? {}) as Record<string, unknown>; const progression = (profile.progression ?? {}) as Record<string, unknown>;
const minigames = (progression.minigames ?? {}) as Record<string, unknown>; const minigames = (progression.minigames ?? {}) as Record<string, unknown>;
@ -143,11 +153,13 @@ export async function awardPokerGameResult(
depth: 0, depth: 0,
}); });
broadcastToUser("profile-update", result.userId, { if (xp > 0) {
reason: "xp", broadcastToUser("profile-update", result.userId, {
xpGained: xp, reason: "xp",
profileId: profile.id, xpGained: xp,
}); profileId: profile.id,
});
}
} catch (error) { } catch (error) {
const message = error instanceof Error ? error.message : String(error); const message = error instanceof Error ? error.message : String(error);
payload.logger.error( payload.logger.error(