This commit is contained in:
2025-09-08 20:58:46 +02:00
parent f5a5a989d3
commit 0ceda994ee
31 changed files with 111 additions and 98 deletions

View File

@@ -64,7 +64,7 @@ export function concatBedwarsStats(...stats: BedwarsModeStats[]) {
]
}
export function getPrestige(level: number) {
export function getBedwarsPrestige(level: number) {
const floored = floorLevel(level, 100)
if (level > 5000) {
@@ -98,7 +98,7 @@ export function getPrestige(level: number) {
}
}
export function getWalletMax(name?: string) {
export function getBedwarsWalletMax(name?: string) {
if (!name) return 25
const wallets = SLUMBER_WALLETS as Record<string, number>
@@ -108,7 +108,7 @@ export function getWalletMax(name?: string) {
return wallets[name]
}
export function getLatestRoom(rooms?: Record<string, boolean>) {
export function getBedwarsLatestRoom(rooms?: Record<string, boolean>) {
if (!rooms) return null
let latestRoom = null

View File

@@ -15,7 +15,7 @@ function getBWLevel(level: number) {
return level % LEVELS_PER_PRESTIGE
}
function getBWExpForLevel(level: number) {
function getBedwarsExpForLevel(level: number) {
if (level === 0) return 0
const respectedLevel = getBWLevel(level)
@@ -37,14 +37,14 @@ function getBWExpForLevel(level: number) {
}
}
export function getBWLevelForExp(exp: number) {
export function getBedwarsLevelForExp(exp: number) {
const prestiges = Math.floor(exp / XP_PER_PRESTIGE)
let level = prestiges * LEVELS_PER_PRESTIGE
let expWithoutPrestiges = exp - (prestiges * XP_PER_PRESTIGE)
let expForEasyLevel
for (let i = 1; i <= EASY_LEVELS; i += 1) {
expForEasyLevel = getBWExpForLevel(i)
expForEasyLevel = getBedwarsExpForLevel(i)
if (expWithoutPrestiges < expForEasyLevel) {
break
}
@@ -54,7 +54,7 @@ export function getBWLevelForExp(exp: number) {
return level + Math.floor(expWithoutPrestiges / 5000)
}
export function getTotalExpForLevel(level: number): number {
export function getTotalBedwarsExpForLevel(level: number): number {
if (level === 0) return 0
const prestiges = Math.floor(level / LEVELS_PER_PRESTIGE)
@@ -62,7 +62,7 @@ export function getTotalExpForLevel(level: number): number {
const remainingLevels = level % LEVELS_PER_PRESTIGE
for (let i = 1; i <= remainingLevels; i += 1) {
totalExp += getBWExpForLevel(i)
totalExp += getBedwarsExpForLevel(i)
}
return totalExp

View File

@@ -7,7 +7,7 @@ export function getBuildBattleRank(score: number) {
return STARS[0]
}
export function getNextBuildBattleRank(score: number) {
export function getBuildBattleRankNext(score: number) {
const current = getBuildBattleRank(score)
const next = STARS.indexOf(current) + 1

View File

@@ -6,7 +6,7 @@ export function getCopsAndCrimsModeName(modeId: typeof MODES[number]["id"]) {
return MODES.find(m => m.id === modeId)!.name
}
export function getScoreColor(score: number) {
export function getCopsAndCrimsScoreColor(score: number) {
for (const scoreThreshold of SCORE.slice().reverse()) {
if (scoreThreshold.score <= score) return scoreThreshold.color
}

View File

@@ -11,7 +11,7 @@ export type Div = {
type Mode = typeof MODES[number]["id"]
type Devisions = typeof MODES[number]["divisionId"]
export function getMode(id: typeof MODES[number]["id"]) {
export function getDuelsMode(id: typeof MODES[number]["id"]) {
const div = MODES.find(d => d.id === id)
return {
@@ -20,7 +20,7 @@ export function getMode(id: typeof MODES[number]["id"]) {
}
}
export function getDevision(devison: Devisions, stats: NonNullable<NonNullStats["Duels"]>) {
export function getDuelsDevision(devison: Devisions, stats: NonNullable<NonNullStats["Duels"]>) {
if (!devison) return null
for (const div of DIVISIONS.slice().reverse()) {
@@ -37,7 +37,7 @@ export function getDevision(devison: Devisions, stats: NonNullable<NonNullStats[
return null
}
export function getAllDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
export function getAllDuelsDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
for (const div of DIVISIONS.slice().reverse()) {
const index = `all_modes_${div.id}_title_prestige` as const
const val = stats[index]
@@ -53,7 +53,7 @@ export function getAllDivisions(stats: NonNullable<NonNullStats["Duels"]>) {
return null
}
export function getMostPlayed(stats: NonNullable<NonNullStats["Duels"]>) {
export function getDuelsMostPlayed(stats: NonNullable<NonNullStats["Duels"]>) {
let mostPlayed: typeof MODES[number] | null = null
let mostPlays = 0
for (const mode of MODES) {

View File

@@ -2,7 +2,7 @@ import { CLASSES, DIFFICULTIES, MODES } from "@/data/hypixel/megawalls"
import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general"
export function getMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
export function getMegawallsMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
let mostPlayedClass: typeof CLASSES[number] | null = null
let maxPlays = 0
@@ -20,7 +20,7 @@ export function getMostPlayed(stats: NonNullable<NonNullStats["MegaWalls"]>) {
return mostPlayedClass
}
export function getDifficultyColor(val: 1 | 2 | 3 | 4) {
export function getMegaWallsDifficultyColor(val: 1 | 2 | 3 | 4) {
return DIFFICULTIES[val]
}
@@ -32,17 +32,17 @@ export function getMegaWallsClass(classId: typeof CLASSES[number]["id"]) {
return CLASSES.find(c => c.id === classId)!
}
export function getAllClassStats(stats: NonNullable<NonNullStats["MegaWalls"]>) {
export function getAllMegawallsClassStats(stats: NonNullable<NonNullStats["MegaWalls"]>) {
const statsArr: { id: typeof CLASSES[number]["id"], val: number[] }[] = []
for (const klass of CLASSES) {
statsArr.push({ id: klass.id, val: megaWalsClassStats(klass.id, stats) })
statsArr.push({ id: klass.id, val: getMegaWallsClassStats(klass.id, stats) })
}
return statsArr
}
export function megaWalsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable<NonNullStats["MegaWalls"]>) {
export function getMegaWallsClassStats(classId: typeof CLASSES[number]["id"], stats: NonNullable<NonNullStats["MegaWalls"]>) {
return [
stats[`${classId}_kills`],
stats[`${classId}_deaths`],

View File

@@ -2,7 +2,7 @@ import { KNIFESKINS, MODES } from "@/data/hypixel/murder-mystery"
import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general"
export function getKnifeName(name?: string) {
export function getMurderMysteryKnifeName(name?: string) {
if (!name) return KNIFESKINS.undefined
const skin = (KNIFESKINS as Record<string, string>)[name]
@@ -12,7 +12,7 @@ export function getKnifeName(name?: string) {
return skin
}
export function getModeTitle(mode: Exclude<typeof MODES[number]["id"], ""> | "all_modes") {
export function getMurderMysteryModeTitle(mode: Exclude<typeof MODES[number]["id"], ""> | "all_modes") {
if (mode === "all_modes") return MODES.find(m => m.id === "")!.name
return MODES.find(m => m.id === mode)!.name

View File

@@ -1,7 +1,7 @@
import { LEVELCOLORS, PRESTIGE_MULTIPLIERS, PRESTIGECOLORS } from "@/data/hypixel/pit"
import { NonNullStats } from "@/lib/schema/player"
export function getLevelColor(level: number) {
export function getPitLevelColor(level: number) {
for (const lvl of LEVELCOLORS.slice().reverse()) {
if (lvl.level <= level) return lvl.color
}
@@ -9,7 +9,7 @@ export function getLevelColor(level: number) {
return LEVELCOLORS.at(0)!.color
}
export function getPrestigeColor(prestige: number) {
export function getPitPrestigeColor(prestige: number) {
for (const pres of PRESTIGECOLORS.slice().reverse()) {
if (pres.prestige <= prestige) return pres.color
}
@@ -17,11 +17,11 @@ export function getPrestigeColor(prestige: number) {
return PRESTIGECOLORS.at(0)!.color
}
export function getXpForPrestige(prestige: number): number {
export function getPitXpForPrestige(prestige: number): number {
if (prestige <= 0 || prestige > PRESTIGE_MULTIPLIERS.length) return 0
return PRESTIGE_MULTIPLIERS[prestige - 1].SumXp
}
export function getPrestige(stats: NonNullable<NonNullStats["Pit"]>) {
export function getPitPrestige(stats: NonNullable<NonNullStats["Pit"]>) {
return stats.profile.prestiges === undefined ? 0 : stats.profile.prestiges.length
}

View File

@@ -2,7 +2,7 @@ import { HEADS, ICONS, PRESTIGES } from "@/data/hypixel/skywars"
import { formatNumber } from "@/lib/formatters"
import { concatStatsArray, devide, floorLevel } from "../general"
export function getHeads(key: string) {
export function getSkywarsHeads(key: string) {
const val = HEADS.find(v => v.id === key)
if (!val) return null
@@ -32,7 +32,7 @@ export function concatSkywarsStats(...stats: SkywarsModeStats[]) {
]
}
export function getPrestige(level: number) {
export function getSkywarsPrestige(level: number) {
const floored = floorLevel(level, 10)
if (level > PRESTIGES.at(-1)!.level) {
@@ -69,7 +69,7 @@ export type SkywarsModeStats = {
losses: number
}
export function getBestMode(stats: _SkywarsStats): Mode | null {
export function getBestSkywarsMode(stats: _SkywarsStats): Mode | null {
const { wins: normal } = getSkywarsModeStats("normal", stats, true)
const { wins: insane } = getSkywarsModeStats("insane", stats, true)
const { wins: teams_normal } = getSkywarsModeStats("teams_normal", stats, true)

View File

@@ -2,7 +2,7 @@ import { MODES } from "@/data/hypixel/uhc"
import { NonNullStats } from "@/lib/schema/player"
import { devide } from "../general"
export function getStatsCombined(stats: NonNullable<NonNullStats["UHC"]>) {
export function getUHCStatsCombined(stats: NonNullable<NonNullStats["UHC"]>) {
return {
wins: getUHCWins(stats),
kills: getUHCKills(stats),
@@ -17,7 +17,7 @@ export function getUHCModeName(modeId: typeof MODES[number]["id"]) {
export function getUHCModeStats(modeId: typeof MODES[number]["id"] | "all_modes", stats: NonNullable<NonNullStats["UHC"]>) {
if (modeId === "all_modes") {
const statsCombined = getStatsCombined(stats)
const statsCombined = getUHCStatsCombined(stats)
return [
statsCombined.kills,
statsCombined.deaths,

View File

@@ -14,7 +14,7 @@ export function getUhcStar(score: number) {
return STARS.at(current - 1)!
}
export function getNextUhcStar(score: number) {
export function getUhcStarNext(score: number) {
const current = getUhcStarValue(score)
if (current === 15) return STARS.at(-1)!