aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cleaners/skyblock/slayers.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cleaners/skyblock/slayers.ts b/src/cleaners/skyblock/slayers.ts
index f051852..a47829a 100644
--- a/src/cleaners/skyblock/slayers.ts
+++ b/src/cleaners/skyblock/slayers.ts
@@ -18,6 +18,7 @@ export interface Slayer {
name?: SlayerName
raw_name: string
xp: number
+ level: number
kills: number
tiers: SlayerTier[]
}
@@ -46,6 +47,13 @@ export function cleanSlayers(data: any): SlayerData {
let slayerKills: number = 0
const slayerTiers: SlayerTier[] = []
+ // we get the level by finding the biggest number in "level_<number>"
+ let slayerLevel = Object.keys(slayerDataRaw.claimed_levels)
+ .filter(k => slayerDataRaw.claimed_levels[k])
+ .map(n => parseInt(n.replace(/^level_/, '')))
+ .sort((a, b) => b - a)[0] ?? 0
+
+
for (const slayerDataKey in slayerDataRaw) {
// if a key starts with boss_kills_tier_ (boss_kills_tier_1), get the last number
if (slayerDataKey.startsWith('boss_kills_tier_')) {
@@ -76,6 +84,7 @@ export function cleanSlayers(data: any): SlayerData {
raw_name: slayerNameRaw,
tiers: slayerTiers,
xp: slayerXp ?? 0,
+ level: slayerLevel,
kills: slayerKills
}