Updated bestmodes

This commit is contained in:
2025-09-14 22:58:49 +02:00
parent a6b4b6efad
commit 3db30213e0
9 changed files with 48 additions and 5 deletions

View File

@@ -53,6 +53,8 @@ export function getArcadeMostPlayedPixelPartyMode(stats: NonNullable<NonNullStat
{ games: stats.games_played_hyper, modeId: "hyper" as const }
]
if (played[0].games === 0 && played[1].games === 0) return null
const mostPlayed = played.reduce((max, current) => current.games > max.games ? current : max)
return mostPlayed.modeId

View File

@@ -163,6 +163,8 @@ export function getBestMode(stats: NonNullable<NonNullStats["Bedwars"]>): "solo"
const max = Math.max(solo, doubles, threes, fours)
if (max === 0) return null
switch (max) {
case solo:
return "solo"

View File

@@ -2,6 +2,16 @@ import { KITEXP, KITS } from "@/data/hypixel/blitz"
import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general"
export function getBlitzBestMode(stats: NonNullable<NonNullStats["Blitz"]>) {
if (stats.wins_solo_normal === 0 && stats.wins_teams_normal === 0) return null
if (stats.wins_solo_normal > stats.wins_teams_normal) {
return "solo_normal"
} else {
return "teams_normal"
}
}
export function getBlitzKitLevel(kitId: typeof KITS[number]["id"], stats: NonNullable<NonNullStats["Blitz"]>) {
let level = stats[kitId]
if (level === -1) {

View File

@@ -1,4 +1,5 @@
import { MODES, STARS } from "@/data/hypixel/build-battle"
import { NonNullStats } from "@/lib/schema/player"
export function getBuildBattleRank(score: number) {
for (let i = STARS.length - 1; i >= 0; i--) {
@@ -18,3 +19,21 @@ export function getBuildBattleRankNext(score: number) {
export function getBuildBattleModeName(id: typeof MODES[number]["id"]) {
return MODES.find(m => m.id === id)!
}
export function getBuildBattleBestMode(stats: NonNullable<NonNullStats["BuildBattle"]>): typeof MODES[number]["id"] | null {
let bestMode: typeof MODES[number]["id"] | null = null
let maxWins = 0
for (const mode of MODES) {
if (mode.id === "") continue
const wins = stats[`wins_${mode.id}` as keyof typeof stats] as number
if (wins > maxWins) {
maxWins = wins
bestMode = mode.id
}
}
return bestMode
}

View File

@@ -53,6 +53,8 @@ export function getCopsAndCrimsBestMode(stats: NonNullable<NonNullStats["CopsAnd
wins: mode.id === "" ? stats["game_wins"] : stats[`game_wins_${mode.id}`] || 0
}))
if (modeWins.map(m => m.wins).reduce((a, b) => a + b) === 0) return null
const best = modeWins.reduce((best, current) => current.wins > best.wins ? current : best).mode
return best === "" ? "regular" : best

View File

@@ -92,6 +92,8 @@ export function getMegaWallsMostPlayedMode(stats: NonNullable<NonNullStats["Mega
}
]
if (modes.map(m => m.games).reduce((a, b) => a + b) === 0) return null
const mostPlayed = modes.reduce((max, current) => current.games > max.games ? current : max)
return mostPlayed.id

View File

@@ -80,6 +80,8 @@ export function getBestSkywarsMode(stats: NonNullable<NonNullStats["SkyWars"]>):
const max = Math.max(normal, insane, teams_normal, teams_insane, mega, mega_doubles, ranked)
if (max === 0) return null
switch (max) {
case normal:
return "normal"