/** * Canonical registry data for the minigames feature. * * Pure and client-safe (no Payload import): the `minigames` collection seeds * its rows from `BUILTIN_MINIGAMES`, the `minigame-rules` global seeds its * defaults from `MINIGAME_RULE_DEFAULTS`, and the sidebar can read the same * list without a Payload round trip. * * `icon` is a lucide-react icon name (a string), mapped to a component in the * client. Keeping it as data means the registry can be edited in the admin * panel without shipping new code. */ export type MinigameCategory = "core" | "cardtable" | "multiplayer"; export type MinigameStatus = "active" | "retired" | "upcoming" | "phasingOut"; /** The six period-scoring games. Poker and Blackjack stay out of periods. */ export const CORE_MINIGAME_KEYS = [ "flappy", "eod", "radio", "qualification", "opord", "callForFire", ] as const; export const CARDTABLE_MINIGAME_KEYS = ["poker", "blackjack"] as const; export type CoreMinigameKey = (typeof CORE_MINIGAME_KEYS)[number]; export type MinigameKey = CoreMinigameKey | (typeof CARDTABLE_MINIGAME_KEYS)[number]; export interface BuiltinMinigame { key: string; label: string; description: string; route: string; /** lucide-react icon name, resolved in the client. */ icon: string; category: MinigameCategory; status: MinigameStatus; /** Sort order within the sidebar / leaderboards. */ order: number; /** Whether this game's ledger entries feed anchored period boards. */ countsForPeriods: boolean; /** Label for the score column, e.g. "Passes", "Time". */ scoreLabel: string; /** * Optional target release instant (ISO 8601, UTC) shown as a countdown while * `status` is "upcoming". Display only: the game goes live when an admin * changes `status` to "active", so a slipped estimate never exposes it. */ estimatedReleaseDate?: string | null; /** * Optional target removal instant (ISO 8601, UTC) shown as a countdown while * `status` is "phasingOut". Display only: the game stays fully playable and * keeps scoring periods until an admin sets `status` to "retired". */ estimatedRemovalDate?: string | null; } /** The seven built-in games, seeded into the `minigames` registry collection. */ export const BUILTIN_MINIGAMES: BuiltinMinigame[] = [ { key: "flappy", label: "Flight Simulator", description: "Guide an aircraft through an obstacle course for as many passes as you can manage.", route: "/minigames/flappy", icon: "Bird", category: "core", status: "active", order: 1, countsForPeriods: true, scoreLabel: "Passes", }, { key: "eod", label: "Minefield Clearance", description: "Clear a minefield without detonating a charge, against the clock.", route: "/minigames/eod", icon: "Bomb", category: "core", status: "active", order: 2, countsForPeriods: true, scoreLabel: "Score", }, { key: "radio", label: "Radio Traffic", description: "Transcribe and repeat radio traffic accurately, sprint or watch mode.", route: "/minigames/radio", icon: "Radio", category: "core", status: "active", order: 3, countsForPeriods: true, scoreLabel: "Score", }, { key: "qualification", label: "Qualification Course", description: "Range drill: engage targets quickly and accurately while sparing civilians.", route: "/minigames/qualification", icon: "Crosshair", category: "core", status: "active", order: 4, countsForPeriods: true, scoreLabel: "Score", }, { key: "opord", label: "OPORD Recall", description: "Study a briefing, then recall its details under time pressure.", route: "/minigames/opord", icon: "FileTextIcon", category: "core", status: "active", order: 5, countsForPeriods: true, scoreLabel: "Score", }, { key: "callForFire", label: "Call for Fire", description: "Bracket artillery onto a hidden target: fewer fire missions score higher.", route: "/minigames/call-for-fire", icon: "Target", category: "core", status: "active", order: 6, countsForPeriods: true, scoreLabel: "Score", }, { key: "poker", label: "Poker", description: "Cardtable game. Play chips earned from Core minigames. Keeps its own all-time board.", route: "/minigames/poker", icon: "Spade", category: "cardtable", status: "active", order: 7, countsForPeriods: false, scoreLabel: "Chips", }, { key: "blackjack", label: "Blackjack", description: "Cardtable game. Play chips earned from Core minigames. Keeps its own all-time board.", route: "/minigames/blackjack", icon: "Club", category: "cardtable", status: "active", order: 8, countsForPeriods: false, scoreLabel: "Chips", }, { key: "callForFireVersus", label: "Call for Fire: Versus", description: "Head-to-head artillery duel. Place your fire bases, then target the enemy's before they target yours.", route: "/minigames/call-for-fire-versus", icon: "Swords", category: "multiplayer", status: "active", order: 9, countsForPeriods: false, scoreLabel: "Score", }, ]; /** Anchor for Period 1: the Monday 00:00 UTC the feature goes live. */ export const MINIGAME_ANCHOR_DATE = "2026-10-12T00:00:00.000Z"; export const PERIOD_LENGTH_DAYS_DEFAULT = 14; export const PLACEMENT_LADDER_TOP_N_DEFAULT = 10; export const PRECISION_MIN_ATTEMPTS_DEFAULT = 5; export const MINIGAME_ACHIEVEMENT_TYPES = [ "period-champion", "player-of-month", "player-of-year", "diligence", "dedication", "precision", "most-improved", ] as const; export type MinigameAchievementType = (typeof MINIGAME_ACHIEVEMENT_TYPES)[number]; export const MINIGAME_ACHIEVEMENT_WINDOWS = ["period", "month", "year"] as const; export type MinigameAchievementWindow = (typeof MINIGAME_ACHIEVEMENT_WINDOWS)[number]; export const MINIGAME_ACHIEVEMENT_TYPE_LABELS: Record = { "period-champion": "Period Champion", "player-of-month": "Player of the Month", "player-of-year": "Player of the Year", diligence: "Diligence (Most Attempts)", dedication: "Dedication (Most Time)", precision: "Precision (Accuracy)", "most-improved": "Most Improved", }; export const MINIGAME_ACHIEVEMENT_WINDOW_LABELS: Record = { period: "Period", month: "Month", year: "Year", }; /** * Registry key -> the `profiles.progression.minigames` group name, used by the * All-Time tab and any all-time fallback. The ledger is the source of truth for * period boards; these profile aggregates are the untouched all-time stats. */ export const MINIGAME_PROFILE_GAME_KEYS: Record = { flappy: "flappyBird", eod: "eodMinesweeper", radio: "radioTraffic", qualification: "aimTrainer", opord: "opordRecall", callForFire: "callForFire", callForFireVersus: "callForFireVersus", poker: "poker", blackjack: "blackjack", }; /** Defaults for the `minigame-rules` global, seeded on first migration. */ export const MINIGAME_RULE_DEFAULTS = { enabled: true, periodLengthDays: PERIOD_LENGTH_DAYS_DEFAULT, anchorDate: MINIGAME_ANCHOR_DATE, placementLadderTopN: PLACEMENT_LADDER_TOP_N_DEFAULT, precisionMinAttempts: PRECISION_MIN_ATTEMPTS_DEFAULT, } as const; /** * A registry row as the client sees it. Same shape as a built-in so the nav and * leaderboards render identically whether the data came from the DB or from the * built-in fallback (`src/lib/minigames/loadRegistry.ts`). */ export type RegistryGame = BuiltinMinigame; /** Icon name used when a registry row's `icon` is missing or unknown. */ export const MINIGAME_ICON_FALLBACK = "Gamepad2";