Added mega walls card

This commit is contained in:
2025-09-07 11:36:19 +02:00
parent 4612222207
commit 33d02113da
6 changed files with 195 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
import { CLASSES, DIFFICULTIES } from "@/data/hypixel/megawalls"
import { NonNullStats } from "@/lib/schema/player"
export function getMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
let mostPlayedClass: typeof CLASSES[number] | null = null
let maxPlays = 0
for (const classObj of CLASSES) {
const wins = stats[`${classObj.id}_wins`] || 0
const losses = stats[`${classObj.id}_losses`] || 0
const totalPlays = wins + losses
if (totalPlays > maxPlays) {
maxPlays = totalPlays
mostPlayedClass = classObj
}
}
return mostPlayedClass
}
export function getDifficultyColor(val: 1 | 2 | 3 | 4) {
return DIFFICULTIES[val]
}