Added zombie type stats
This commit is contained in:
@@ -3,7 +3,7 @@ import { devide } from "@/lib/hypixel/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { capitalizeFirstLetter } from "@/lib/utils"
|
||||
import { BasicStat } from "../../_components/Stats"
|
||||
import { PixelPartyStatsTable } from "./table"
|
||||
import { ArcadePixelPartyStatsTable, ArcadeZombieStatsTable, ArcadeZombieTypesTable } from "./table"
|
||||
|
||||
export function ArcadeZombieStats({ stats }: { stats: NonNullable<NonNullStats["Arcade"]> }) {
|
||||
const bha = devide(stats.bullets_hit_zombies, stats.bullets_shot_zombies) * 100
|
||||
@@ -38,6 +38,8 @@ export function ArcadeZombieStats({ stats }: { stats: NonNullable<NonNullStats["
|
||||
<BasicStat title="Windows Repaired: " value={formatNumber(stats.windows_repaired_zombies)} />
|
||||
</div>
|
||||
</div>
|
||||
<ArcadeZombieStatsTable stats={stats} />
|
||||
<ArcadeZombieTypesTable stats={stats} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -63,7 +65,7 @@ export function ArcadePixelPartyStats({ stats }: { stats: NonNullable<NonNullSta
|
||||
<BasicStat title="Power-ups Collected: " value={formatNumber(stats.pixel_party?.power_ups_collected || 0)} />
|
||||
</div>
|
||||
</div>
|
||||
<PixelPartyStatsTable stats={stats.pixel_party} />
|
||||
<ArcadePixelPartyStatsTable stats={stats.pixel_party} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,23 +1,128 @@
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"
|
||||
import { formatNumber } from "@/lib/formatters"
|
||||
import { getArcadeMostPlayedPixelPartyMode, getArcadePixelPartyModeName, getArcadePixelPartyModeStats } from "@/lib/hypixel/arcade/general"
|
||||
import {
|
||||
getArcadeMostPlayedPixelPartyMode,
|
||||
getArcadePixelPartyModeName,
|
||||
getArcadePixelPartyModeStats,
|
||||
getArcadeZombiesBestMode,
|
||||
getArcadeZombiesMode,
|
||||
getArcadeZombiesModeStats,
|
||||
getArcadeZombiesType,
|
||||
getArcadeZombiesTypeStats
|
||||
} from "@/lib/hypixel/arcade/general"
|
||||
import { NonNullStats } from "@/lib/schema/player"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export function PixelPartyStatsTable({ stats }: { stats: NonNullable<NonNullStats["Arcade"]>["pixel_party"] }) {
|
||||
export function ArcadeZombieTypesTable({ stats }: { stats: NonNullable<NonNullStats["Arcade"]> }) {
|
||||
return (
|
||||
<Table>
|
||||
<PixelPartyStatsTableHeader />
|
||||
<ArcadeZombieTypesTableHeader />
|
||||
<ArcadeZombieTypes stats={stats} />
|
||||
</Table>
|
||||
)
|
||||
}
|
||||
|
||||
function ArcadeZombieTypes({ stats }: { stats: NonNullable<NonNullStats["Arcade"]> }) {
|
||||
const wins = getArcadeZombiesTypeStats(stats)
|
||||
|
||||
return (
|
||||
<TableBody>
|
||||
{wins.map((w, i) => {
|
||||
const { id, wins } = w
|
||||
const type = getArcadeZombiesType(id)
|
||||
|
||||
return (
|
||||
<TableRow key={i}>
|
||||
<TableCell className={cn(type.color && `text-mc-${type.color}`)}>{type.name}</TableCell>
|
||||
<TableCell>{formatNumber(wins)}</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
})}
|
||||
</TableBody>
|
||||
)
|
||||
}
|
||||
|
||||
function ArcadeZombieTypesTableHeader() {
|
||||
const headerElements = [
|
||||
"Zombies",
|
||||
"Kills"
|
||||
]
|
||||
|
||||
return (
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
{headerElements.map((v, i) => <TableHead key={i} className="font-bold">{v}</TableHead>)}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
)
|
||||
}
|
||||
|
||||
export function ArcadeZombieStatsTable({ stats }: { stats: NonNullable<NonNullStats["Arcade"]> }) {
|
||||
return (
|
||||
<Table>
|
||||
<ArcadeZombiesTableHeader />
|
||||
<TableBody>
|
||||
<PixelPartyTableStat modeId="normal" stats={stats} />
|
||||
<PixelPartyTableStat modeId="hyper" stats={stats} />
|
||||
<PixelPartyTableStat modeId="all_modes" stats={stats} />
|
||||
<ArcadeZombiesTableStat modeId="deadend" stats={stats} />
|
||||
<ArcadeZombiesTableStat modeId="badblood" stats={stats} />
|
||||
<ArcadeZombiesTableStat modeId="alienarcadium" stats={stats} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
)
|
||||
}
|
||||
|
||||
function PixelPartyTableStat(
|
||||
function ArcadeZombiesTableStat(
|
||||
{ modeId, stats }: { modeId: Parameters<typeof getArcadeZombiesModeStats>[0], stats: NonNullable<NonNullStats["Arcade"]> }
|
||||
) {
|
||||
const mode = getArcadeZombiesMode(modeId)
|
||||
const modeStats = getArcadeZombiesModeStats(modeId, stats)
|
||||
const isMostPlayed = getArcadeZombiesBestMode(stats) === modeId
|
||||
|
||||
return (
|
||||
<TableRow className={cn(isMostPlayed && "text-mc-light-purple")}>
|
||||
<TableCell className={cn(`text-mc-${mode.color}`)}>{mode.name}</TableCell>
|
||||
{modeStats.map((v, i) => {
|
||||
return <TableCell key={i}>{formatNumber(v)}</TableCell>
|
||||
})}
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
|
||||
function ArcadeZombiesTableHeader() {
|
||||
const headerElements = [
|
||||
"Map",
|
||||
"Downs",
|
||||
"Revives",
|
||||
"Doors Opened",
|
||||
"Windows Repaired",
|
||||
"Zombies Killed",
|
||||
"Deaths",
|
||||
"Best Round",
|
||||
"Wins"
|
||||
]
|
||||
|
||||
return (
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
{headerElements.map((v, i) => <TableHead key={i} className="font-bold">{v}</TableHead>)}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
)
|
||||
}
|
||||
|
||||
export function ArcadePixelPartyStatsTable({ stats }: { stats: NonNullable<NonNullStats["Arcade"]>["pixel_party"] }) {
|
||||
return (
|
||||
<Table>
|
||||
<ArcadePixelPartyStatsTableHeader />
|
||||
<TableBody>
|
||||
<ArcadePixelPartyTableStat modeId="normal" stats={stats} />
|
||||
<ArcadePixelPartyTableStat modeId="hyper" stats={stats} />
|
||||
<ArcadePixelPartyTableStat modeId="all_modes" stats={stats} />
|
||||
</TableBody>
|
||||
</Table>
|
||||
)
|
||||
}
|
||||
|
||||
function ArcadePixelPartyTableStat(
|
||||
{ modeId, stats }: { modeId: Parameters<typeof getArcadePixelPartyModeStats>[0], stats: NonNullable<NonNullStats["Arcade"]>["pixel_party"] }
|
||||
) {
|
||||
const modeName = getArcadePixelPartyModeName(modeId)
|
||||
@@ -35,7 +140,7 @@ function PixelPartyTableStat(
|
||||
)
|
||||
}
|
||||
|
||||
function PixelPartyStatsTableHeader() {
|
||||
function ArcadePixelPartyStatsTableHeader() {
|
||||
const headerElements = [
|
||||
"Mode",
|
||||
"Wins",
|
||||
|
||||
Reference in New Issue
Block a user