1
0
Fork 0

feat(profiles): track radio traffic progression

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-03 01:59:57 -04:00
parent f71a10ce05
commit f98e9aaca5
2 changed files with 64 additions and 1 deletions

View file

@ -2,7 +2,7 @@ import { CollectionConfig } from "payload";
import { Award } from "@/payload-types";
import { broadcastToUser } from "@/lib/realtime/bus";
import { notifyAwardGrants } from "@/lib/awards";
import { requirePermission, hasPermission } from "@/utils/access-control/hasPermission";
import { hasPermission } from "@/utils/access-control/hasPermission";
export const Profiles: CollectionConfig = {
slug: "profiles",
@ -121,6 +121,7 @@ export const Profiles: CollectionConfig = {
minigames?: {
flappyBird?: { xpEarned?: number | null };
eodMinesweeper?: { xpEarned?: number | null };
radioTraffic?: { xpEarned?: number | null };
};
};
const awardsList = progressionData?.awards || [];
@ -133,6 +134,7 @@ export const Profiles: CollectionConfig = {
const scoreboard = progressionData?.scoreboard || {};
const flappyXp = progressionData?.minigames?.flappyBird?.xpEarned ?? 0;
const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0;
const radioTrafficXp = progressionData?.minigames?.radioTraffic?.xpEarned ?? 0;
if (awardIds.length > 0) {
await req.payload
@ -172,6 +174,7 @@ export const Profiles: CollectionConfig = {
xpAcc += flappyXp;
// EOD Minesweeper: XP from cleared minefields
xpAcc += eodXp;
xpAcc += radioTrafficXp;
return xpAcc;
},
@ -371,6 +374,48 @@ export const Profiles: CollectionConfig = {
},
],
},
{
name: "radioTraffic",
label: "Radio Traffic",
type: "group",
fields: [
{
name: "gamesPlayed",
type: "number",
defaultValue: 0,
},
{
name: "totalMessages",
label: "Total Messages",
type: "number",
defaultValue: 0,
},
{
name: "bestScore",
label: "Best Score",
type: "number",
defaultValue: 0,
},
{
name: "bestAccuracy",
label: "Best Accuracy",
type: "number",
defaultValue: 0,
},
{
name: "bestSprintTimeMs",
label: "Best Sprint Time (ms)",
type: "number",
defaultValue: 0,
},
{
name: "xpEarned",
label: "XP Earned",
type: "number",
defaultValue: 0,
},
],
},
],
},
],

View file

@ -1784,6 +1784,14 @@ export interface Profile {
bestPerimeterFlags?: number | null;
bestSupplyRoadFlags?: number | null;
};
radioTraffic?: {
gamesPlayed?: number | null;
totalMessages?: number | null;
bestScore?: number | null;
bestAccuracy?: number | null;
bestSprintTimeMs?: number | null;
xpEarned?: number | null;
};
};
};
updatedAt: string;
@ -3792,6 +3800,16 @@ export interface ProfilesSelect<T extends boolean = true> {
bestPerimeterFlags?: T;
bestSupplyRoadFlags?: T;
};
radioTraffic?:
| T
| {
gamesPlayed?: T;
totalMessages?: T;
bestScore?: T;
bestAccuracy?: T;
bestSprintTimeMs?: T;
xpEarned?: T;
};
};
};
updatedAt?: T;