Updated cc stats
This commit is contained in:
@@ -6,11 +6,13 @@ import { getScoreColor } from "@/lib/hypixel/copsandcrims/general"
|
|||||||
import { devide } from "@/lib/hypixel/general"
|
import { devide } from "@/lib/hypixel/general"
|
||||||
import { NonNullStats } from "@/lib/schema/player"
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
import CollapsedStats from "../../_components/CollapsedStats"
|
import CollapsedStats from "../../_components/CollapsedStats"
|
||||||
|
import CopsAndCrimsGeneralStats from "./stats"
|
||||||
|
|
||||||
export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["CopsAndCrims"] }) {
|
export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["CopsAndCrims"] }) {
|
||||||
if (!stats) return null
|
if (!stats) return null
|
||||||
|
|
||||||
const kills = stats.kills + stats.kills_deathmatch + stats.kills_gungame
|
const kills = stats.kills + stats.kills_deathmatch + stats.kills_gungame
|
||||||
|
const assists = stats.assists + stats.assists_deathmatch + stats.assists_gungame
|
||||||
const deaths = stats.deaths + stats.deaths_deathmatch + stats.deaths_gungame
|
const deaths = stats.deaths + stats.deaths_deathmatch + stats.deaths_gungame
|
||||||
const wins = stats.game_wins + stats.game_wins_deathmatch + stats.game_wins_gungame
|
const wins = stats.game_wins + stats.game_wins_deathmatch + stats.game_wins_gungame
|
||||||
const kd = formatNumber(devide(kills, deaths))
|
const kd = formatNumber(devide(kills, deaths))
|
||||||
@@ -48,6 +50,8 @@ export default function CopsAndCrimsStats({ stats }: { stats: NonNullStats["Cops
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent>
|
<AccordionContent>
|
||||||
<Separator className="my-4" />
|
<Separator className="my-4" />
|
||||||
|
<CopsAndCrimsGeneralStats stats={stats} wins={wins} kills={kills} assits={assists} deaths={deaths} />
|
||||||
|
<Separator className="my-4" />
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
43
src/app/(stats)/player/[ign]/_stats/copsandcrims/stats.tsx
Normal file
43
src/app/(stats)/player/[ign]/_stats/copsandcrims/stats.tsx
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { formatNumber } from "@/lib/formatters"
|
||||||
|
import { devide } from "@/lib/hypixel/general"
|
||||||
|
import { NonNullStats } from "@/lib/schema/player"
|
||||||
|
import { BasicStat } from "../../_components/Stats"
|
||||||
|
|
||||||
|
export default function CopsAndCrimsGeneralStats(
|
||||||
|
{ stats, kills, assits, deaths, wins }: {
|
||||||
|
stats: NonNullable<NonNullStats["CopsAndCrims"]>
|
||||||
|
kills: number
|
||||||
|
assits: number
|
||||||
|
deaths: number
|
||||||
|
wins: number
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<div className="flex">
|
||||||
|
<div className="flex-1">
|
||||||
|
<BasicStat title="Coins: " value={formatNumber(stats.coins)} className="text-mc-gold" />
|
||||||
|
<p>
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
<BasicStat title="Kills: " value={formatNumber(kills)} />
|
||||||
|
<BasicStat title="Assits: " value={formatNumber(assits)} />
|
||||||
|
<BasicStat title="Deaths: " value={formatNumber(deaths)} />
|
||||||
|
<BasicStat title="Kill/Death Ratio: " value={formatNumber(devide(kills, deaths))} />
|
||||||
|
</div>
|
||||||
|
<div className="flex-1">
|
||||||
|
<BasicStat title="Wins: " value={formatNumber(wins)} />
|
||||||
|
<BasicStat title="Round Wins: " value={formatNumber(stats.round_wins)} />
|
||||||
|
<p>
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
<BasicStat title="Bombs Planted: " value={formatNumber(stats.bombs_planted)} />
|
||||||
|
<BasicStat title="Bombs Defused: " value={formatNumber(stats.bombs_defused)} />
|
||||||
|
<BasicStat title="Shots Fired: " value={formatNumber(stats.shots_fired)} />
|
||||||
|
<BasicStat title="Headshots: " value={formatNumber(stats.headshot_kills)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -662,15 +662,21 @@ export const megawallsStats = z.looseObject({
|
|||||||
|
|
||||||
export const copsAndCrimsStatsSchema = z.looseObject({
|
export const copsAndCrimsStatsSchema = z.looseObject({
|
||||||
kills: z.number().default(0),
|
kills: z.number().default(0),
|
||||||
|
assists: z.number().default(0),
|
||||||
deaths: z.number().default(0),
|
deaths: z.number().default(0),
|
||||||
game_wins: z.number().default(0),
|
game_wins: z.number().default(0),
|
||||||
kills_deathmatch: z.number().default(0),
|
kills_deathmatch: z.number().default(0),
|
||||||
|
assists_deathmatch: z.number().default(0),
|
||||||
deaths_deathmatch: z.number().default(0),
|
deaths_deathmatch: z.number().default(0),
|
||||||
game_wins_deathmatch: z.number().default(0),
|
game_wins_deathmatch: z.number().default(0),
|
||||||
kills_gungame: z.number().default(0),
|
kills_gungame: z.number().default(0),
|
||||||
|
assists_gungame: z.number().default(0),
|
||||||
deaths_gungame: z.number().default(0),
|
deaths_gungame: z.number().default(0),
|
||||||
game_wins_gungame: z.number().default(0),
|
game_wins_gungame: z.number().default(0),
|
||||||
bombs_planted: z.number().default(0),
|
bombs_planted: z.number().default(0),
|
||||||
bombs_defused: z.number().default(0),
|
bombs_defused: z.number().default(0),
|
||||||
shots_fired: z.number().default(0)
|
shots_fired: z.number().default(0),
|
||||||
|
coins: z.number().default(0),
|
||||||
|
round_wins: z.number().default(0),
|
||||||
|
headshot_kills: z.number().default(0)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user