diff --git a/src/collections/users/Profiles.ts b/src/collections/users/Profiles.ts index ab8adfa..62a944a 100644 --- a/src/collections/users/Profiles.ts +++ b/src/collections/users/Profiles.ts @@ -107,11 +107,17 @@ export const Profiles: CollectionConfig = { let xpAcc = 0; const progressionData = siblingData as { - awards?: Array<{ - award?: number | Award; - } | number>; + awards?: Array< + | { + award?: number | Award; + } + | number + >; scoreboard?: Record; - minigames?: { flappyBird?: { xpEarned?: number | null } }; + minigames?: { + flappyBird?: { xpEarned?: number | null }; + eodMinesweeper?: { xpEarned?: number | null }; + }; }; const awardsList = progressionData?.awards || []; const awardIds = awardsList.flatMap((entry) => { @@ -122,6 +128,7 @@ export const Profiles: CollectionConfig = { }); const scoreboard = progressionData?.scoreboard || {}; const flappyXp = progressionData?.minigames?.flappyBird?.xpEarned ?? 0; + const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0; if (awardIds.length > 0) { await req.payload @@ -159,6 +166,8 @@ export const Profiles: CollectionConfig = { // Flappy Bird training sim: 1 XP per 15 pipes passed in a single run xpAcc += flappyXp; + // EOD Minesweeper: XP from cleared minefields + xpAcc += eodXp; return xpAcc; }, @@ -175,7 +184,7 @@ export const Profiles: CollectionConfig = { relationTo: "awards", required: true, admin: { - appearance: "drawer" + appearance: "drawer", }, }, { @@ -186,7 +195,8 @@ export const Profiles: CollectionConfig = { // issuer's progression/awards when a profile is read. maxDepth: 0, admin: { - description: 'Who issued the award. If no one, the award will be attributed as "on behalf of the unit."', + description: + 'Who issued the award. If no one, the award will be attributed as "on behalf of the unit."', }, }, { @@ -285,6 +295,60 @@ export const Profiles: CollectionConfig = { }, ], }, + { + name: "eodMinesweeper", + label: "EOD Minesweeper", + type: "group", + fields: [ + { + name: "gamesPlayed", + type: "number", + defaultValue: 0, + }, + { + name: "wins", + label: "Wins", + type: "number", + defaultValue: 0, + }, + { + name: "losses", + label: "Losses", + type: "number", + defaultValue: 0, + }, + { + name: "bestScore", + label: "Best Score", + type: "number", + defaultValue: 0, + }, + { + name: "xpEarned", + label: "XP Earned", + type: "number", + defaultValue: 0, + }, + { + name: "bestTrainingTime", + label: "Best Training Pad Time (s)", + type: "number", + defaultValue: 0, + }, + { + name: "bestPerimeterTime", + label: "Best FOB Perimeter Time (s)", + type: "number", + defaultValue: 0, + }, + { + name: "bestSupplyRoadTime", + label: "Best Main Supply Road Time (s)", + type: "number", + defaultValue: 0, + }, + ], + }, ], }, ], diff --git a/src/payload-types.ts b/src/payload-types.ts index e830dca..9a58ea1 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -1677,6 +1677,16 @@ export interface Profile { bestScore?: number | null; xpEarned?: number | null; }; + eodMinesweeper?: { + gamesPlayed?: number | null; + wins?: number | null; + losses?: number | null; + bestScore?: number | null; + xpEarned?: number | null; + bestTrainingTime?: number | null; + bestPerimeterTime?: number | null; + bestSupplyRoadTime?: number | null; + }; }; }; updatedAt: string; @@ -3456,6 +3466,18 @@ export interface ProfilesSelect { bestScore?: T; xpEarned?: T; }; + eodMinesweeper?: + | T + | { + gamesPlayed?: T; + wins?: T; + losses?: T; + bestScore?: T; + xpEarned?: T; + bestTrainingTime?: T; + bestPerimeterTime?: T; + bestSupplyRoadTime?: T; + }; }; }; updatedAt?: T; diff --git a/src/utils/event-log/eventTypes.ts b/src/utils/event-log/eventTypes.ts index 3bbca54..ea7b3d8 100644 --- a/src/utils/event-log/eventTypes.ts +++ b/src/utils/event-log/eventTypes.ts @@ -62,6 +62,7 @@ export const EventTypes = { // Minigames MinigameFlappy: "minigame:flappy", + MinigameEod: "minigame:eod", // Market MarketListingCreate: "market:listing-create",