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:
parent
f71a10ce05
commit
f98e9aaca5
2 changed files with 64 additions and 1 deletions
|
|
@ -2,7 +2,7 @@ import { CollectionConfig } from "payload";
|
||||||
import { Award } from "@/payload-types";
|
import { Award } from "@/payload-types";
|
||||||
import { broadcastToUser } from "@/lib/realtime/bus";
|
import { broadcastToUser } from "@/lib/realtime/bus";
|
||||||
import { notifyAwardGrants } from "@/lib/awards";
|
import { notifyAwardGrants } from "@/lib/awards";
|
||||||
import { requirePermission, hasPermission } from "@/utils/access-control/hasPermission";
|
import { hasPermission } from "@/utils/access-control/hasPermission";
|
||||||
|
|
||||||
export const Profiles: CollectionConfig = {
|
export const Profiles: CollectionConfig = {
|
||||||
slug: "profiles",
|
slug: "profiles",
|
||||||
|
|
@ -121,6 +121,7 @@ export const Profiles: CollectionConfig = {
|
||||||
minigames?: {
|
minigames?: {
|
||||||
flappyBird?: { xpEarned?: number | null };
|
flappyBird?: { xpEarned?: number | null };
|
||||||
eodMinesweeper?: { xpEarned?: number | null };
|
eodMinesweeper?: { xpEarned?: number | null };
|
||||||
|
radioTraffic?: { xpEarned?: number | null };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const awardsList = progressionData?.awards || [];
|
const awardsList = progressionData?.awards || [];
|
||||||
|
|
@ -133,6 +134,7 @@ export const Profiles: CollectionConfig = {
|
||||||
const scoreboard = progressionData?.scoreboard || {};
|
const scoreboard = progressionData?.scoreboard || {};
|
||||||
const flappyXp = progressionData?.minigames?.flappyBird?.xpEarned ?? 0;
|
const flappyXp = progressionData?.minigames?.flappyBird?.xpEarned ?? 0;
|
||||||
const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0;
|
const eodXp = progressionData?.minigames?.eodMinesweeper?.xpEarned ?? 0;
|
||||||
|
const radioTrafficXp = progressionData?.minigames?.radioTraffic?.xpEarned ?? 0;
|
||||||
|
|
||||||
if (awardIds.length > 0) {
|
if (awardIds.length > 0) {
|
||||||
await req.payload
|
await req.payload
|
||||||
|
|
@ -172,6 +174,7 @@ export const Profiles: CollectionConfig = {
|
||||||
xpAcc += flappyXp;
|
xpAcc += flappyXp;
|
||||||
// EOD Minesweeper: XP from cleared minefields
|
// EOD Minesweeper: XP from cleared minefields
|
||||||
xpAcc += eodXp;
|
xpAcc += eodXp;
|
||||||
|
xpAcc += radioTrafficXp;
|
||||||
|
|
||||||
return xpAcc;
|
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,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1784,6 +1784,14 @@ export interface Profile {
|
||||||
bestPerimeterFlags?: number | null;
|
bestPerimeterFlags?: number | null;
|
||||||
bestSupplyRoadFlags?: 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;
|
updatedAt: string;
|
||||||
|
|
@ -3792,6 +3800,16 @@ export interface ProfilesSelect<T extends boolean = true> {
|
||||||
bestPerimeterFlags?: T;
|
bestPerimeterFlags?: T;
|
||||||
bestSupplyRoadFlags?: T;
|
bestSupplyRoadFlags?: T;
|
||||||
};
|
};
|
||||||
|
radioTraffic?:
|
||||||
|
| T
|
||||||
|
| {
|
||||||
|
gamesPlayed?: T;
|
||||||
|
totalMessages?: T;
|
||||||
|
bestScore?: T;
|
||||||
|
bestAccuracy?: T;
|
||||||
|
bestSprintTimeMs?: T;
|
||||||
|
xpEarned?: T;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
updatedAt?: T;
|
updatedAt?: T;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue