17 lines
443 B
TypeScript
17 lines
443 B
TypeScript
import { STARS } from "@/data/hypixel/build-battle"
|
|
|
|
export function getBuildBattleRank(score: number) {
|
|
for (let i = STARS.length - 1; i >= 0; i--) {
|
|
if (score >= STARS[i].value) return STARS[i]
|
|
}
|
|
return STARS[0]
|
|
}
|
|
|
|
export function getNextBuildBattleRank(score: number) {
|
|
const current = getBuildBattleRank(score)
|
|
|
|
const next = STARS.indexOf(current) + 1
|
|
|
|
return next > STARS.length - 1 ? null : STARS[next]
|
|
}
|