feat: add lifetime stats to player profile

Introduce six lifetime stat fields (gold, clicks, bosses, quests,
adventurers, achievements) that accumulate across all prestige and
transcendence resets and are never cleared.

- schema: add six new Float fields to the Player model
- prestige route: capture current-run totals and increment lifetime
  fields before resetting per-run counters to zero
- profile route: return lifetime fields as the All Time section data;
  add four new ProfileSettings toggles for visibility control
- ProfilePage: display lifetime bosses/quests/adventurers/achievements
  in All Time section; remove GameProvider dependency by importing
  formatNumber directly (fixes crash on public profile pages)
- EditProfileModal: add four new All Time stat toggles
- types: update Player, ProfileSettings, and PublicProfileResponse
This commit is contained in:
2026-03-07 02:08:41 -08:00
committed by Naomi Carrigan
parent 3cded34f4b
commit 298e1f4604
9 changed files with 213 additions and 39 deletions
+10 -2
View File
@@ -97,14 +97,22 @@ export interface PublicProfileResponse {
avatar: string | null;
bio: string;
profileSettings: ProfileSettings;
prestigeCount: number;
createdAt: number;
/** All Time stats — cumulative across all runs, never reset */
totalGoldEarned: number;
totalClicks: number;
lifetimeBossesDefeated: number;
lifetimeQuestsCompleted: number;
lifetimeAdventurersRecruited: number;
lifetimeAchievementsUnlocked: number;
/** Current Run stats — sourced from the live GameState, reset on prestige & transcendence */
currentRunGold: number;
currentRunClicks: number;
prestigeCount: number;
bossesDefeated: number;
questsCompleted: number;
adventurersRecruited: number;
achievementsUnlocked: number;
createdAt: number;
}
export interface UpdateProfileRequest {
+14 -2
View File
@@ -9,8 +9,20 @@ export interface Player {
createdAt: number;
/** Unix timestamp of the last server-side save */
lastSavedAt: number;
/** Total lifetime gold ever collected (for prestige eligibility) */
/** Gold earned this run (reset on prestige; used for prestige eligibility) */
totalGoldEarned: number;
/** Total lifetime clicks */
/** Clicks this run (reset on prestige) */
totalClicks: number;
/** Cumulative gold earned across all runs — never reset */
lifetimeGoldEarned: number;
/** Cumulative clicks across all runs — never reset */
lifetimeClicks: number;
/** Cumulative bosses defeated across all runs — never reset */
lifetimeBossesDefeated: number;
/** Cumulative quests completed across all runs — never reset */
lifetimeQuestsCompleted: number;
/** Cumulative adventurers recruited across all runs — never reset */
lifetimeAdventurersRecruited: number;
/** Cumulative achievements unlocked across all runs — never reset */
lifetimeAchievementsUnlocked: number;
}
@@ -1,10 +1,18 @@
export type NumberFormat = "suffix" | "scientific" | "engineering";
export interface ProfileSettings {
/** All Time section */
showTotalGold: boolean;
showTotalClicks: boolean;
showPrestige: boolean;
showLifetimeBossesDefeated: boolean;
showLifetimeQuestsCompleted: boolean;
showLifetimeAdventurersRecruited: boolean;
showLifetimeAchievementsUnlocked: boolean;
showGuildFounded: boolean;
/** Current Run section */
showCurrentGold: boolean;
showCurrentClicks: boolean;
showPrestige: boolean;
showBossesDefeated: boolean;
showQuestsCompleted: boolean;
showAdventurersRecruited: boolean;
@@ -15,8 +23,14 @@ export interface ProfileSettings {
export const DEFAULT_PROFILE_SETTINGS: ProfileSettings = {
showTotalGold: true,
showTotalClicks: true,
showPrestige: true,
showLifetimeBossesDefeated: true,
showLifetimeQuestsCompleted: true,
showLifetimeAdventurersRecruited: true,
showLifetimeAchievementsUnlocked: true,
showGuildFounded: true,
showCurrentGold: true,
showCurrentClicks: true,
showPrestige: true,
showBossesDefeated: true,
showQuestsCompleted: true,
showAdventurersRecruited: true,