aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/skills.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-27 15:50:39 -0500
committermat <github@matdoes.dev>2022-03-27 15:50:39 -0500
commitc71f5cd982f96a726ff90f930f37108f18c6f352 (patch)
treecdda3ad9cde4592a41743981f0dc3c450e70187c /src/cleaners/skyblock/skills.ts
parent3531a091e052c1c8554fa974ad825dc0f4d6bf09 (diff)
downloadskyblock-api-c71f5cd982f96a726ff90f930f37108f18c6f352.tar.gz
skyblock-api-c71f5cd982f96a726ff90f930f37108f18c6f352.tar.bz2
skyblock-api-c71f5cd982f96a726ff90f930f37108f18c6f352.zip
Add pets
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[]> {