Added warlords stats card
This commit is contained in:
@@ -26,6 +26,7 @@ import SmashHerosStats from "./_stats/smashheros/smashheros"
|
||||
import SpeedUHCStats from "./_stats/speeduhc/speeduhc"
|
||||
import TNTGamesStats from "./_stats/tnt-games/tnt-games"
|
||||
import UHCStats from "./_stats/uhc/uhc"
|
||||
import WarlordsStats from "./_stats/warlords/warlords"
|
||||
import WoolGamesStats from "./_stats/woolgames/woolgames"
|
||||
|
||||
export function PlayerPageLoadText() {
|
||||
@@ -96,7 +97,8 @@ export function PlayerStats(
|
||||
"blitz": <BlitzStats stats={stats.Blitz} />,
|
||||
"arcade": <ArcadeStats stats={stats.Arcade} />,
|
||||
"speeduhc": <SpeedUHCStats stats={stats.SpeedUHC} uhcCoins={stats.UHC?.coins} />,
|
||||
"smashheros": <SmashHerosStats stats={stats.SmashHeros} />
|
||||
"smashheros": <SmashHerosStats stats={stats.SmashHeros} />,
|
||||
"warlords": <WarlordsStats stats={stats.Warlords} />
|
||||
} as const
|
||||
|
||||
const defaultOrder = Object.keys(statsComponents)
|
||||
|
||||
39
src/app/(stats)/player/[ign]/_stats/warlords/stats.tsx
Normal file
39
src/app/(stats)/player/[ign]/_stats/warlords/stats.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { getWarlordsLosses } from "@/lib/hypixel/warlords/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { BasicStat } from "../../_components/Stats"
|
||||
|
||||
export default function WarlordsGeneralStats({ stats }: { stats: NonNullable<NonNullStats["Warlords"]> }) {
|
||||
const losses = getWarlordsLosses(stats)
|
||||
const wl = formatNumber(devide(stats.wins, losses))
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const ak = formatNumber(devide(stats.assists, stats.kills))
|
||||
return (
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Coins: " value={formatNumber(stats.coins)} className="text-mc-gold" />
|
||||
<BasicStat title="Magic Dust: " value={formatNumber(stats.magic_dust)} className="text-mc-aqua" />
|
||||
<BasicStat title="Void Shards: " value={formatNumber(stats.void_shards)} className="text-mc-light-purple" />
|
||||
<p>
|
||||
<br />
|
||||
</p>
|
||||
<BasicStat title="Wins: " value={formatNumber(stats.wins)} />
|
||||
<BasicStat title="Losses: " value={formatNumber(losses)} />
|
||||
<BasicStat title="Win/Loss Ratio: " value={wl} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Kills: " value={formatNumber(stats.kills)} />
|
||||
<BasicStat title="Assists: " value={formatNumber(stats.assists)} />
|
||||
<BasicStat title="Assist/Kill Ratio: " value={ak} />
|
||||
<BasicStat title="Deaths: " value={formatNumber(stats.deaths)} />
|
||||
<BasicStat title="Kill/Death Ratio: " value={kd} />
|
||||
<p>
|
||||
<br />
|
||||
</p>
|
||||
<BasicStat title="Flags Captured: " value={formatNumber(stats.flag_conquer_self)} />
|
||||
<BasicStat title="Flags Returned: " value={formatNumber(stats.flag_returns)} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
44
src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx
Normal file
44
src/app/(stats)/player/[ign]/_stats/warlords/warlords.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { getWarlordsLosses, getWarlordsMostPlayedClass } from "@/lib/hypixel/warlords/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import GeneralStats from "../GeneralStats"
|
||||
import WarlordsGeneralStats from "./stats"
|
||||
|
||||
export default function WarlordsStats({ stats }: { stats: NonNullStats["Warlords"] }) {
|
||||
if (!stats) return null
|
||||
|
||||
const losses = getWarlordsLosses(stats)
|
||||
const kd = formatNumber(devide(stats.kills, stats.deaths))
|
||||
const wl = formatNumber(devide(stats.wins, losses))
|
||||
const mostPlayed = getWarlordsMostPlayedClass(stats)
|
||||
|
||||
return (
|
||||
<GeneralStats
|
||||
id="warlords"
|
||||
title="Warlords"
|
||||
collapsedStats={[
|
||||
{
|
||||
title: <p>Main</p>,
|
||||
stat: <p className="text-mc-gold">{mostPlayed !== null ? mostPlayed.name : "Unknown"}</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>
|
||||
},
|
||||
{
|
||||
title: <p>WL</p>,
|
||||
stat: <p className="text-muted-foreground">{wl}</p>
|
||||
}
|
||||
]}
|
||||
>
|
||||
<Separator className="my-4" />
|
||||
<WarlordsGeneralStats stats={stats} />
|
||||
</GeneralStats>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user