aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/skills.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock/skills.ts')
-rw-r--r--src/cleaners/skyblock/skills.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/skills.ts b/src/cleaners/skyblock/skills.ts
index c69acd0..a186232 100644
--- a/src/cleaners/skyblock/skills.ts
+++ b/src/cleaners/skyblock/skills.ts
@@ -1,4 +1,5 @@
import typedHypixelApi from 'typed-hypixel-api'
+import { levelFromXpTable } from '../../util'
export interface Skill {
name: string
@@ -131,8 +132,7 @@ const skillsDefaultMaxLevel: number = 50
*/
export function levelForSkillXp(xp: number, maxLevel: number) {
const xpTable = (maxLevel <= 25 ? skillXpTableEasier : skillXpTable).slice(0, maxLevel)
- const skillLevel = [...xpTable].reverse().findIndex(levelXp => xp >= levelXp)
- return skillLevel === -1 ? 0 : xpTable.length - skillLevel
+ return levelFromXpTable(xp, xpTable)
}
export async function cleanSkills(data: typedHypixelApi.SkyBlockProfileMember): Promise<Skill[]> {