From e55a1659866bc9d1ddd8e9f9945d11169eae6696 Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 10 Sep 2025 20:00:04 +0200 Subject: [PATCH] Updated wool games stats --- .../[ign]/_stats/woolgames/woolgames.tsx | 15 ++++++++++++- src/lib/schema/stats.ts | 21 ++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx b/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx index 8f81850..454fdca 100644 --- a/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx +++ b/src/app/(stats)/player/[ign]/_stats/woolgames/woolgames.tsx @@ -1,15 +1,28 @@ import { Separator } from "@/components/ui/separator" +import { formatNumber } from "@/lib/formatters" import { NonNullStats } from "@/lib/schema/player" import GeneralStats from "../GeneralStats" export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGames"] }) { if (!stats) return null + const kills = (stats.capture_the_wool?.stats?.kills || 0) + (stats.sheep_wars?.stats?.kills || 0) + (stats.wool_wars?.stats?.kills || 0) + const wins = (stats.capture_the_wool?.stats?.participated_wins || 0) + (stats.sheep_wars?.stats?.wins || 0) + (stats.wool_wars?.stats?.wins || 0) + return ( Kills

, + stat:

{formatNumber(kills)}

+ }, + { + title:

Wins

, + stat:

{formatNumber(wins)}

+ } + ]} >
diff --git a/src/lib/schema/stats.ts b/src/lib/schema/stats.ts index dbd246a..90d7901 100644 --- a/src/lib/schema/stats.ts +++ b/src/lib/schema/stats.ts @@ -724,4 +724,23 @@ export const copsAndCrimsStatsSchema = z.looseObject({ ...copsAndCrimsGunUpgrades() }) -export const woolGamesStatsSchema = z.looseObject({}) +export const woolGamesStatsSchema = z.looseObject({ + capture_the_wool: z.looseObject({ + stats: z.looseObject({ + kills: z.number().default(0), + participated_wins: z.number().default(0) + }).optional() + }).optional(), + sheep_wars: z.looseObject({ + stats: z.looseObject({ + kills: z.number().default(0), + wins: z.number().default(0) + }).optional() + }).optional(), + wool_wars: z.looseObject({ + stats: z.looseObject({ + kills: z.number().default(0), + wins: z.number().default(0) + }).optional() + }).optional() +})