diff --git a/src/lib/layouts/stats/Main.svelte b/src/lib/layouts/stats/Main.svelte index a17bf3c3..8a8ab891 100644 --- a/src/lib/layouts/stats/Main.svelte +++ b/src/lib/layouts/stats/Main.svelte @@ -9,6 +9,7 @@ import Inventory from "$lib/sections/stats/Inventory.svelte"; import Pets from "$lib/sections/stats/Pets.svelte"; import SkillsSection from "$lib/sections/stats/SkillsSection.svelte"; + import Slayer from "$lib/sections/stats/Slayer.svelte"; import Weapons from "$lib/sections/stats/Weapons.svelte"; import type { Stats as StatsType } from "$types/stats"; import { setContext } from "svelte"; @@ -30,6 +31,7 @@ + diff --git a/src/lib/sections/stats/Slayer.svelte b/src/lib/sections/stats/Slayer.svelte new file mode 100644 index 00000000..b0d96392 --- /dev/null +++ b/src/lib/sections/stats/Slayer.svelte @@ -0,0 +1,72 @@ + + + + Slayer + {#if slayer} + + + {#each Object.entries(slayer.data) as [key, value]} + {#if value.level.xp > 0} + + + + + + + + + {value.name} + + + {#each Object.entries(value.kills) as [key, killValue]} + + + {#if !isNaN(Number(key))} + Tier {["I", "II", "III", "IV", "V"][Number(key) - 1]} + {:else} + {key} + {/if} + + + {format(killValue)} + + + {/each} + + + + {key} Level {value.level.level} + + + + + + {#if value.level.maxed} + {format(value.level.xp)} + {:else} + {format(value.level.xp)} / {format(value.level.xpForNext)} + {/if} + XP + + + + + + + {/if} + {/each} + + + {/if} + diff --git a/src/lib/stats/slayer.ts b/src/lib/stats/slayer.ts index b76e85aa..a1b9b1eb 100644 --- a/src/lib/stats/slayer.ts +++ b/src/lib/stats/slayer.ts @@ -27,7 +27,7 @@ function getLevel(slayer: string, data: SlayerBoss) { level: 0, maxLevel: 0, xpCurrent: 0, - xpForNext: 0, + xpForNext: constants.SLAYER_XP[slayer] ? constants.SLAYER_XP[slayer]["1"] : 0, maxed: false }; } @@ -37,7 +37,7 @@ function getLevel(slayer: string, data: SlayerBoss) { const maxLevel = Object.keys(constants.SLAYER_XP[slayer]).length; for (const [level, xp] of reversed) { if (data.xp > xp) { - const xpForNext = xp; + const xpForNext = constants.SLAYER_XP[slayer][parseInt(level) + 1]; return { xp: data.xp, xpForNext,
+ {key} Level {value.level.level} +