Updated bedears stats
This commit is contained in:
@@ -17,4 +17,5 @@ export async function getPlayer(uuid: string) {
|
||||
if (!success) return null
|
||||
|
||||
return data.player
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { PRESTIGE_ICONS } from "@/data/hypixel/bedwars"
|
||||
import { PRESTIGE_ICONS, PRESTIGES } from "@/data/hypixel/bedwars"
|
||||
import { floorLevel } from "./formatters"
|
||||
|
||||
export function getBedwarsStar(level: number) {
|
||||
if (level < 1100) {
|
||||
@@ -15,3 +16,23 @@ export function getBedwarsStar(level: number) {
|
||||
|
||||
return PRESTIGE_ICONS[3].symbol
|
||||
}
|
||||
|
||||
export function getTextColor(level: number) {
|
||||
const floored = floorLevel(level, 100)
|
||||
|
||||
if (level > 5000) {
|
||||
return PRESTIGES[PRESTIGES.length - 1].color
|
||||
}
|
||||
|
||||
return PRESTIGES.find(l => l.level === floored)!.color
|
||||
}
|
||||
|
||||
export function getPrestigeName(level: number) {
|
||||
const floored = floorLevel(level, 100)
|
||||
|
||||
if (level > 5000) {
|
||||
return PRESTIGES[PRESTIGES.length - 1].name
|
||||
}
|
||||
|
||||
return PRESTIGES.find(p => p.level === floored)!.name
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP
|
||||
const LEVELS_PER_PRESTIGE = 100
|
||||
const HIGHEST_PRESTIGE = 10
|
||||
|
||||
export function getBWLevel(level: number) {
|
||||
function getBWLevel(level: number) {
|
||||
if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
|
||||
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export function getBWLevel(level: number) {
|
||||
return level % LEVELS_PER_PRESTIGE
|
||||
}
|
||||
|
||||
export function getBWExpForLevel(level: number) {
|
||||
function getBWExpForLevel(level: number) {
|
||||
if (level === 0) return 0
|
||||
|
||||
const respectedLevel = getBWLevel(level)
|
||||
@@ -53,3 +53,17 @@ export function getBWLevelForExp(exp: number) {
|
||||
}
|
||||
return level + Math.floor(expWithoutPrestiges / 5000)
|
||||
}
|
||||
|
||||
export function getTotalExpForLevel(level: number): number {
|
||||
if (level === 0) return 0
|
||||
|
||||
const prestiges = Math.floor(level / LEVELS_PER_PRESTIGE)
|
||||
let totalExp = prestiges * XP_PER_PRESTIGE
|
||||
const remainingLevels = level % LEVELS_PER_PRESTIGE
|
||||
|
||||
for (let i = 1; i <= remainingLevels; i += 1) {
|
||||
totalExp += getBWExpForLevel(i)
|
||||
}
|
||||
|
||||
return totalExp
|
||||
}
|
||||
|
||||
7
src/lib/hypixel/general.ts
Normal file
7
src/lib/hypixel/general.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function getProgress(min: number, mid: number, max: number) {
|
||||
if (max === min) return 100
|
||||
const diff = max - min
|
||||
const progress = mid - min
|
||||
|
||||
return progress / diff * 100
|
||||
}
|
||||
Reference in New Issue
Block a user