Fixed total coins

This commit is contained in:
2025-09-14 14:11:21 +02:00
parent 6c19b059c4
commit 28fe35ccd1
2 changed files with 5 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ export function getCoinMultiplier(level: number, rank?: string, specialRank?: st
const coinsSchema = z.record( const coinsSchema = z.record(
z.string(), z.string(),
z.object({ z.object({
coins: z.number().optional() coins: z.number().default(0)
}) })
) )
@@ -83,7 +83,9 @@ export function getTotalCoins(stats: Player["player"]["stats"]) {
if (!data) return 0 if (!data) return 0
return Object.values(data).reduce((total, stat) => total + (stat.coins || 0), 0) console.log(data)
return Object.values(data).reduce((total, stat) => total + stat.coins, 0)
} }
export function getTotalQuests(quests: Player["player"]["quests"]) { export function getTotalQuests(quests: Player["player"]["quests"]) {

View File

@@ -913,6 +913,7 @@ function arcadeModeWins() {
} }
export const arcadeStatsSchema = z.object({ export const arcadeStatsSchema = z.object({
coins: z.number().default(0),
pixel_party: z.object({ pixel_party: z.object({
wins: z.number().default(0) wins: z.number().default(0)
}).optional(), }).optional(),