Added paintball stats
This commit is contained in:
@@ -100,7 +100,14 @@ export function PlayerStats(
|
||||
"speeduhc": <SpeedUHCStats stats={stats.SpeedUHC} uhcCoins={stats.UHC?.coins} />,
|
||||
"smashheros": <SmashHerosStats stats={stats.SmashHeros} />,
|
||||
"warlords": <WarlordsStats stats={stats.Warlords} />,
|
||||
"classic": <ClassicStats arenaBrawlStats={stats.ArenaBrawl} />
|
||||
"classic": (
|
||||
<ClassicStats
|
||||
stats={{
|
||||
arena: stats.ArenaBrawl,
|
||||
paintball: stats.Paintball
|
||||
}}
|
||||
/>
|
||||
)
|
||||
} as const
|
||||
|
||||
const defaultOrder = Object.keys(statsComponents)
|
||||
|
||||
@@ -4,8 +4,9 @@ import { NonNullStats } from "@/lib/schema/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
import CollapsedStats from "../../_components/CollapsedStats"
|
||||
import ArenaBrawlStats from "./arenabrawl"
|
||||
import PaintballStats from "./paintball"
|
||||
|
||||
export default function ClassicStats({ arenaBrawlStats }: { arenaBrawlStats: NonNullStats["ArenaBrawl"] }) {
|
||||
export default function ClassicStats({ stats }: { stats: { arena: NonNullStats["ArenaBrawl"], paintball: NonNullStats["Paintball"] } }) {
|
||||
return (
|
||||
<AccordionItem value="classic">
|
||||
<Card className="py-0">
|
||||
@@ -23,8 +24,9 @@ export default function ClassicStats({ arenaBrawlStats }: { arenaBrawlStats: Non
|
||||
</AccordionTrigger>
|
||||
</CardContent>
|
||||
</Card>
|
||||
<AccordionContent className="pt-4 mx-auto w-[95%]">
|
||||
<ArenaBrawlStats stats={arenaBrawlStats} />
|
||||
<AccordionContent className="pt-4 space-y-4 mx-auto w-[95%]">
|
||||
<ArenaBrawlStats stats={stats.arena} />
|
||||
<PaintballStats stats={stats.paintball} />
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
)
|
||||
|
||||
37
src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx
Normal file
37
src/app/(stats)/player/[ign]/_stats/classic/paintball.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import GeneralStats from "../GeneralStats"
|
||||
import { PaintballGeneralStats } from "./stats"
|
||||
|
||||
export default function PaintballStats({ stats }: { stats: NonNullStats["Paintball"] }) {
|
||||
if (!stats) return null
|
||||
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
|
||||
return (
|
||||
<GeneralStats
|
||||
id="classic-paintball"
|
||||
title="Paintball"
|
||||
collapsedStats={[
|
||||
{
|
||||
title: <p>Kills</p>,
|
||||
stat: <p className="text-muted-foreground">{formatNumber(stats.kills)}</p>
|
||||
},
|
||||
{
|
||||
title: <p>KD</p>,
|
||||
stat: <p className="text-muted-foreground">{kd}</p>
|
||||
},
|
||||
{
|
||||
title: <p>Wins</p>,
|
||||
stat: <p className="text-muted-foreground">{formatNumber(stats.wins)}</p>
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Separator className="my-4" />
|
||||
<PaintballGeneralStats stats={stats} />
|
||||
<Separator className="my-4" />
|
||||
</GeneralStats>
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { formatNumber, formatSecondsToTime } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { BasicStat } from "../../_components/Stats"
|
||||
|
||||
export function ArenaBrawlGeneralStats({ coins, keys, ws }: { coins: number, keys: number, ws: number }) {
|
||||
@@ -10,3 +12,25 @@ export function ArenaBrawlGeneralStats({ coins, keys, ws }: { coins: number, key
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function PaintballGeneralStats({ stats }: { stats: NonNullable<NonNullStats["Paintball"]> }) {
|
||||
return (
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Coins: " value={formatNumber(stats.coins)} className="text-mc-gold" />
|
||||
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
||||
<BasicStat title="Force Field Time: " value={`${formatSecondsToTime(stats.forcefieldTime)}s`} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
||||
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
||||
<BasicStat title="Kill/Death Ratio: " value={formatNumber(devide(stats.kills, stats.deaths))} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Killstreaks: " value={formatNumber(stats.killstreaks)} />
|
||||
<BasicStat title="Shots Fired: " value={formatNumber(stats.shots_fired)} />
|
||||
<BasicStat title="Shot/Kill Ratio: " value={formatNumber(devide(stats.shots_fired, stats.kills))} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { arcadeStatsSchema } from "./stats/arcade"
|
||||
import { bedwarsStatsSchema } from "./stats/bedwars"
|
||||
import { blitzStatsSchema } from "./stats/blitz"
|
||||
import { buildBattleStatsSchema } from "./stats/build-battle"
|
||||
import { arenaBrawlStatsSchema } from "./stats/classic"
|
||||
import { arenaBrawlStatsSchema, paintBallStatsSchema } from "./stats/classic"
|
||||
import { copsAndCrimsStatsSchema } from "./stats/copsandcrims"
|
||||
import { duelsStatsSchema } from "./stats/duels"
|
||||
import { megawallsStats } from "./stats/megawalls"
|
||||
@@ -46,7 +46,8 @@ export const playerSchema = z.looseObject({
|
||||
SpeedUHC: speedUhcStatsSchema.optional(),
|
||||
SuperSmash: smashHerosStats.optional(),
|
||||
Battleground: warlordsStatsSchema.optional(),
|
||||
Arena: arenaBrawlStatsSchema.optional()
|
||||
Arena: arenaBrawlStatsSchema.optional(),
|
||||
Paintball: paintBallStatsSchema
|
||||
}).transform(({ Walls3, MCGO, HungerGames, SuperSmash, Battleground, Arena, ...rest }) => {
|
||||
return {
|
||||
MegaWalls: Walls3,
|
||||
|
||||
@@ -19,3 +19,13 @@ export const arenaBrawlStatsSchema = z.object({
|
||||
win_streaks_2v2: z.number().default(0),
|
||||
win_streaks_4v4: z.number().default(0)
|
||||
})
|
||||
|
||||
export const paintBallStatsSchema = z.object({
|
||||
kills: z.number().default(0),
|
||||
deaths: z.number().default(0),
|
||||
wins: z.number().default(0),
|
||||
coins: z.number().default(0),
|
||||
forcefieldTime: z.number().default(0),
|
||||
killstreaks: z.number().default(0),
|
||||
shots_fired: z.number().default(0)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user