From d3b04eec9a750fce15fc4ab6619761716232f07f Mon Sep 17 00:00:00 2001 From: Taken Date: Tue, 2 Sep 2025 20:17:26 +0200 Subject: [PATCH] Added first mm stats --- .../_stats/murder-mystery/murder-mystery.tsx | 41 +++++++++++++++++++ .../[ign]/_stats/murder-mystery/stats.tsx | 23 +++++++++++ src/app/(stats)/player/[ign]/page.tsx | 2 + src/lib/schema/player.ts | 5 ++- src/lib/schema/stats.ts | 11 ++++- đ | 23 +++++++++++ 6 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx create mode 100644 src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx create mode 100644 đ diff --git a/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx b/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx new file mode 100644 index 0000000..3cf858d --- /dev/null +++ b/src/app/(stats)/player/[ign]/_stats/murder-mystery/murder-mystery.tsx @@ -0,0 +1,41 @@ +import { AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion" +import { Card, CardContent } from "@/components/ui/card" +import { Separator } from "@/components/ui/separator" +import { formatNumber } from "@/lib/formatters" +import { NonNullStats } from "@/lib/schema/player" +import CollapsedStats from "../../_components/CollapsedStats" +import MurderMysteryGeneralStats from "./stats" + +export default function MurderMysteryStats({ stats }: { stats: NonNullStats["MurderMystery"] }) { + if (!stats) return null + + return ( + + + + +

Murder Mystery

+
+ Kills

, + stat:

{formatNumber(stats.kills)}

+ }, + { + title:

Wins

, + stat:

{formatNumber(stats.wins)}

+ } + ]} + /> +
+
+ + + + +
+
+
+ ) +} diff --git a/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx b/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx new file mode 100644 index 0000000..de23ece --- /dev/null +++ b/src/app/(stats)/player/[ign]/_stats/murder-mystery/stats.tsx @@ -0,0 +1,23 @@ +import { formatNumber } from "@/lib/formatters" +import { NonNullStats } from "@/lib/schema/player" +import { BasicStat } from "../../_components/Stats" + +export default function MurderMysteryGeneralStats({ statsChecked }: { statsChecked: NonNullStats["MurderMystery"] }) { + const stats = statsChecked! + + const kd = formatNumber(stats.kills / stats.deaths) + + return ( +
+
+ + + + + +
+
+
+
+ ) +} diff --git a/src/app/(stats)/player/[ign]/page.tsx b/src/app/(stats)/player/[ign]/page.tsx index 502f6fa..672f5ee 100644 --- a/src/app/(stats)/player/[ign]/page.tsx +++ b/src/app/(stats)/player/[ign]/page.tsx @@ -10,6 +10,7 @@ import { Suspense } from "react" import Sidebar from "./_components/Sidebar" import BedwarsStats from "./_stats/bedwars/bedwars" import DuelsStats from "./_stats/duels/duels" +import MurderMysteryStats from "./_stats/murder-mystery/murder-mystery" import SkyWarsStats from "./_stats/skywars/skywars" export default async function PlayerPage({ @@ -93,6 +94,7 @@ async function SuspendedPage({ ign: pign }: { ign: string }) { achievements_skywars_opal_obsession={player.achievements?.["skywars_opal_obsession"] ?? 0} /> + ) : diff --git a/src/lib/schema/player.ts b/src/lib/schema/player.ts index df468b8..34a4004 100644 --- a/src/lib/schema/player.ts +++ b/src/lib/schema/player.ts @@ -1,5 +1,5 @@ import z from "zod" -import { bedwarsStatsSchema, duelsStatsSchema, skywarsStatsSchema } from "./stats" +import { bedwarsStatsSchema, duelsStatsSchema, murderMysteryStatsSchema, skywarsStatsSchema } from "./stats" export const playerSchema = z.looseObject({ player: z.looseObject({ @@ -16,7 +16,8 @@ export const playerSchema = z.looseObject({ stats: z.looseObject({ Bedwars: bedwarsStatsSchema.optional(), SkyWars: skywarsStatsSchema.optional(), - Duels: duelsStatsSchema.optional() + Duels: duelsStatsSchema.optional(), + MurderMystery: murderMysteryStatsSchema.optional() }).optional(), quests: z.record( z.string(), diff --git a/src/lib/schema/stats.ts b/src/lib/schema/stats.ts index 2e69ddd..9064bab 100644 --- a/src/lib/schema/stats.ts +++ b/src/lib/schema/stats.ts @@ -1,5 +1,4 @@ -import { title } from "process" -import z, { object } from "zod" +import z from "zod" function bedwarsModeStats() { const ids = [ @@ -331,3 +330,11 @@ export const duelsStatsSchema = z.looseObject({ ...duelsModeStats().bestWs, ...duelsModeStats().bridge }) + +export const murderMysteryStatsSchema = z.looseObject({ + kills: z.number().default(0), + wins: z.number().default(0), + coins: z.number().default(0), + kills_as_murderer: z.number().default(0), + deaths: z.number().default(0) +}) diff --git a/đ b/đ new file mode 100644 index 0000000..de23ece --- /dev/null +++ b/đ @@ -0,0 +1,23 @@ +import { formatNumber } from "@/lib/formatters" +import { NonNullStats } from "@/lib/schema/player" +import { BasicStat } from "../../_components/Stats" + +export default function MurderMysteryGeneralStats({ statsChecked }: { statsChecked: NonNullStats["MurderMystery"] }) { + const stats = statsChecked! + + const kd = formatNumber(stats.kills / stats.deaths) + + return ( +
+
+ + + + + +
+
+
+
+ ) +}