Finished duels stats

This commit is contained in:
2025-09-02 13:57:52 +02:00
parent 83031f6526
commit 2b262025df
4 changed files with 82 additions and 30 deletions

View File

@@ -8,11 +8,33 @@ export type Div = {
level: number
color: typeof DIVISIONS[number]["color"]
}
type Mode = typeof MODES[number]["id"]
type Devisions = typeof MODES[number]["divisionId"]
export function getModeTitle(id: typeof MODES[number]["id"]) {
export function getMode(id: typeof MODES[number]["id"]) {
const div = MODES.find(d => d.id === id)
return div!.name
return {
name: div!.name,
divId: div!.divisionId
}
}
export function getDevision(devison: Devisions, stats: NonNullable<NonNullStats["Duels"]>) {
if (!devison) return null
for (const div of DIVISIONS.slice().reverse()) {
const index = `${devison}_${div.id}_title_prestige` as const
const val = stats[index]
if (val > 0) {
return {
level: val,
color: div.color
}
}
}
return null
}
export function getAllDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
@@ -44,8 +66,6 @@ export function getMostPlayed(stats: NonNullable<NonNullStats["Duels"]>) {
return mostPlayed
}
type Mode = typeof MODES[number]["id"]
export function getBestDuelsMode(stats: NonNullable<NonNullStats["Duels"]>) {
let best: typeof MODES[number] | null = null
let mostPlays = 0