24 lines
541 B
TypeScript
24 lines
541 B
TypeScript
import { STARS } from "@/data/hypixel/uhc"
|
|
|
|
export function getUhcStarValue(score: number): number {
|
|
for (let i = STARS.length - 1; i >= 0; i--) {
|
|
if (score >= STARS[i].value) {
|
|
return i + 1
|
|
}
|
|
}
|
|
return 1
|
|
}
|
|
|
|
export function getUhcStar(score: number) {
|
|
const current = getUhcStarValue(score)
|
|
return STARS.at(current - 1)!
|
|
}
|
|
|
|
export function getNextUhcStar(score: number) {
|
|
const current = getUhcStarValue(score)
|
|
|
|
if (current === 15) return STARS.at(-1)!
|
|
|
|
return STARS.at(current)!
|
|
}
|