Added more pit stats

This commit is contained in:
2025-09-05 19:44:48 +02:00
parent 5bf00d513a
commit 2a0403160a
3 changed files with 40 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ import { getLevelColor, getPrestige, getPrestigeColor } from "@/lib/hypixel/pit/
import { getPitLevel } from "@/lib/hypixel/pit/level"
import { NonNullStats } from "@/lib/schema/player"
import CollapsedStats from "../../_components/CollapsedStats"
import PitGeneralStats from "./stats"
export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) {
if (!stats) return null
@@ -51,6 +52,7 @@ export default function PitStats({ stats }: { stats: NonNullStats["Pit"] }) {
</AccordionTrigger>
<AccordionContent>
<Separator className="my-4" />
<PitGeneralStats stats={stats} />
</AccordionContent>
</CardContent>
</Card>

View File

@@ -0,0 +1,33 @@
import { formatNumber } from "@/lib/formatters"
import { romanize } from "@/lib/hypixel/general"
import { getLevelColor, getPrestige, getPrestigeColor } from "@/lib/hypixel/pit/general"
import { getPitLevel } from "@/lib/hypixel/pit/level"
import { NonNullStats } from "@/lib/schema/player"
import { BasicStat } from "../../_components/Stats"
export default function PitGeneralStats({ stats }: { stats: NonNullable<NonNullStats["Pit"]> }) {
const prestige = getPrestige(stats)
const level = getPitLevel(stats.profile.xp, prestige)
const pretigeColor = getPrestigeColor(prestige)
const levelColor = getLevelColor(level)
return (
<div className="flex">
<div className="flex-1">
<BasicStat title="Pretige: " value={romanize(prestige)} className={`font-bold text-mc-${pretigeColor}`} />
<BasicStat title="Level: " value={level} className={`font-bold text-mc-${levelColor}`} />
<BasicStat title="Gold: " value={formatNumber(Math.floor(stats.profile.cash))} className="text-mc-gold" />
<BasicStat title="Lifetime Gold: " value={formatNumber(Math.floor(stats.cash_earned))} className="text-mc-gold" />
<BasicStat title="XP: " value={formatNumber(stats.profile.xp)} className="text-mc-aqua" />
<BasicStat title="Renown: " value={formatNumber(stats.profile.renown)} className="text-mc-yellow" />
<p>
<br />
</p>
</div>
<div className="flex-1">
</div>
<div className="flex-1">
</div>
</div>
)
}

View File

@@ -449,7 +449,8 @@ export const uhcSchema = z.looseObject({
export const pitStats = z.looseObject({
pit_stats_ptl: z.looseObject({
kills: z.number().default(0),
deaths: z.number().default(0)
deaths: z.number().default(0),
cash_earned: z.number().default(0)
}),
profile: z.looseObject({
prestiges: z.array(z.looseObject({
@@ -457,7 +458,9 @@ export const pitStats = z.looseObject({
xp_on_prestige: z.number(),
timestamp: z.number()
})),
xp: z.number().default(0)
xp: z.number().default(0),
cash: z.number().default(0),
renown: z.number().default(0)
})
}).transform(({ profile, pit_stats_ptl, ...rest }) => ({
profile,