diff --git a/src/collections/users/Profiles.ts b/src/collections/users/Profiles.ts index ea0e2f2..c2786ae 100644 --- a/src/collections/users/Profiles.ts +++ b/src/collections/users/Profiles.ts @@ -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, + }, + ], + }, ], }, ], diff --git a/src/payload-types.ts b/src/payload-types.ts index 3a08951..aa86649 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -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 { bestPerimeterFlags?: T; bestSupplyRoadFlags?: T; }; + radioTraffic?: + | T + | { + gamesPlayed?: T; + totalMessages?: T; + bestScore?: T; + bestAccuracy?: T; + bestSprintTimeMs?: T; + xpEarned?: T; + }; }; }; updatedAt?: T;