Added wool games mode stats
This commit is contained in:
130
src/app/(stats)/player/[ign]/_stats/woolgames/modes.tsx
Normal file
130
src/app/(stats)/player/[ign]/_stats/woolgames/modes.tsx
Normal file
@@ -0,0 +1,130 @@
|
||||
import { formatNumber, formatSecondsToTime } from "@/lib/formatters"
|
||||
import { devide } from "@/lib/hypixel/general"
|
||||
import { getWoolGamesWoolWarsClass, getWoolGamesWoolWarsClassColor } from "@/lib/hypixel/woolgames/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { BasicStat } from "../../_components/Stats"
|
||||
|
||||
export function WoolGamesCaptureTheWool({ ctw }: { ctw: NonNullable<NonNullStats["WoolGames"]>["capture_the_wool"] }) {
|
||||
if (!ctw) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="text-xl font-bold">Capture The Wool</h2>
|
||||
<p>This person has no Capture The Wool stats.</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const kd = formatNumber(devide(ctw.stats?.kills || 0, ctw.stats?.deaths || 0))
|
||||
const wl = formatNumber(devide(ctw.stats?.participated_wins || 0, ctw.stats?.participated_losses || 0))
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="pb-6 text-xl font-bold">Capture The Wool</h2>
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Kills: " value={formatNumber(ctw.stats?.kills || 0)} />
|
||||
<BasicStat title="Assists: " value={formatNumber(ctw.stats?.assits || 0)} />
|
||||
<BasicStat title="Deaths: " value={formatNumber(ctw.stats?.deaths || 0)} />
|
||||
<BasicStat title="Kill/Death Ratio: " value={kd} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Wins: " value={formatNumber(ctw.stats?.participated_wins || 0)} />
|
||||
<BasicStat title="Losses: " value={formatNumber(ctw.stats?.participated_losses || 0)} />
|
||||
<BasicStat title="Win/Loss Ratio: " value={wl} />
|
||||
<BasicStat title="Fastest Win: " value={formatSecondsToTime(ctw.stats?.fastest_win || 0)} />
|
||||
<BasicStat title="Longest Game: " value={formatSecondsToTime(ctw.stats?.longest_game || 0)} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Wools Stolen: " value={formatNumber(ctw.stats?.wools_stolen || 0)} />
|
||||
<BasicStat title="Wools Captured: " value={formatNumber(ctw.stats?.wools_captured || 0)} />
|
||||
<BasicStat title="Fastest Wool Capture: " value={formatSecondsToTime(ctw.stats?.fastest_wool_capture || 0)} />
|
||||
<BasicStat title="Total Gold Earned: " value={formatNumber(ctw.stats?.gold_earned || 0)} className="text-mc-gold" />
|
||||
<BasicStat title="Total Gold Spent: " value={formatNumber(Math.abs(ctw.stats?.gold_spent || 0))} className="text-mc-gold" />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function WoolGamesSheepWars({ sw }: { sw: NonNullable<NonNullStats["WoolGames"]>["sheep_wars"] }) {
|
||||
if (!sw) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="text-xl font-bold">Sheep Wars</h2>
|
||||
<p>This person has no Sheep Wars stats.</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const kd = formatNumber(devide(sw.stats?.kills || 0, sw.stats?.deaths || 0))
|
||||
const wl = formatNumber(devide(sw.stats?.wins || 0, sw.stats?.losses || 0))
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="pb-6 text-xl font-bold">Sheep Wars</h2>
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Kills: " value={formatNumber(sw.stats?.kills || 0)} />
|
||||
<BasicStat title="Deaths: " value={formatNumber(sw.stats?.deaths || 0)} />
|
||||
<BasicStat title="Kill/Death Ratio: " value={kd} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Wins: " value={formatNumber(sw.stats?.wins || 0)} />
|
||||
<BasicStat title="Losses: " value={formatNumber(sw.stats?.losses || 0)} />
|
||||
<BasicStat title="Win/Loss Ratio: " value={wl} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Sheep Thrown: " value={formatNumber(sw.stats?.sheep_thrown || 0)} />
|
||||
<BasicStat title="Damage Dealt: " value={formatNumber(sw.stats?.damage_dealt || 0)} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function WoolGamesWoolWars({ ww }: { ww: NonNullable<NonNullStats["WoolGames"]>["wool_wars"] }) {
|
||||
if (!ww) {
|
||||
return (
|
||||
<>
|
||||
<h2 className="text-xl font-bold">Wool Wars</h2>
|
||||
<p>This person has no Wool Wars stats.</p>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const klass = getWoolGamesWoolWarsClass(ww.selected_class)
|
||||
const klassName = klass?.name || "Unknown"
|
||||
const klassColor = getWoolGamesWoolWarsClassColor(klass?.difficulty)
|
||||
const kd = formatNumber(devide(ww.stats?.kills || 0, ww.stats?.deaths || 0))
|
||||
const wl = formatNumber(devide(ww.stats?.wins || 0, ww.stats?.losses || 0))
|
||||
|
||||
return (
|
||||
<>
|
||||
<h2 className="pb-6 text-lg font-bold">Wool Wars</h2>
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<BasicStat
|
||||
className={cn(klassColor && `text-mc-${klassColor}`)}
|
||||
title="Selected Class: "
|
||||
value={klassName}
|
||||
/>
|
||||
<BasicStat title="Kills: " value={formatNumber(ww.stats?.kills || 0)} />
|
||||
<BasicStat title="Assists: " value={formatNumber(ww.stats?.assits || 0)} />
|
||||
<BasicStat title="Deaths: " value={formatNumber(ww.stats?.deaths || 0)} />
|
||||
<BasicStat title="Kill/Death Ratio: " value={kd} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Wins: " value={formatNumber(ww.stats?.wins || 0)} />
|
||||
<BasicStat title="Losses: " value={formatNumber(ww.stats?.losses || 0)} />
|
||||
<BasicStat title="Win/Loss Ratio: " value={wl} />
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<BasicStat title="Wool Placed: " value={formatNumber(ww.stats?.wool_placed || 0)} />
|
||||
<BasicStat title="Wool Broken: " value={formatNumber(ww.stats?.blocks_broken || 0)} />
|
||||
<BasicStat title="Poweups: " value={formatNumber(ww.stats?.powerups_gotten || 0)} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { getWoolGamesLevel, getWoolGamesPrestige, getWoolGamesPretigeIcon } from
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import Multicolored from "../../_components/Multicolored"
|
||||
import GeneralStats from "../GeneralStats"
|
||||
import { WoolGamesCaptureTheWool, WoolGamesSheepWars, WoolGamesWoolWars } from "./modes"
|
||||
import WoolGamesProgress from "./progress"
|
||||
import WoolGamesGeneralStats from "./stats"
|
||||
|
||||
@@ -40,6 +41,12 @@ export default function WoolGamesStats({ stats }: { stats: NonNullStats["WoolGam
|
||||
<Separator className="my-4" />
|
||||
<WoolGamesGeneralStats stats={stats} level={level} kills={kills} wins={wins} />
|
||||
<Separator className="my-4" />
|
||||
<WoolGamesCaptureTheWool ctw={stats.capture_the_wool} />
|
||||
<Separator className="my-4" />
|
||||
<WoolGamesSheepWars sw={stats.sheep_wars} />
|
||||
<Separator className="my-4" />
|
||||
<WoolGamesWoolWars ww={stats.wool_wars} />
|
||||
<Separator className="my-4" />
|
||||
</GeneralStats>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user