aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/essence.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock/essence.ts')
-rw-r--r--src/cleaners/skyblock/essence.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cleaners/skyblock/essence.ts b/src/cleaners/skyblock/essence.ts
new file mode 100644
index 0000000..4af94fb
--- /dev/null
+++ b/src/cleaners/skyblock/essence.ts
@@ -0,0 +1,28 @@
+import typedHypixelApi from 'typed-hypixel-api'
+import * as constants from '../../constants.js'
+
+interface EssenceType {
+ id: string
+ value: number
+}
+
+export interface Essence {
+ types: EssenceType[]
+}
+
+export function cleanEssence(data: typedHypixelApi.SkyBlockProfileMember): Essence {
+ const essences: EssenceType[] = []
+
+ for (const [id, value] of Object.entries(data ?? {})) {
+ if (id.startsWith('essence_')) {
+ essences.push({
+ id: id.replace(/^essence_/, ''),
+ value: value ?? 0,
+ })
+ }
+ }
+
+ return {
+ types: essences,
+ }
+} \ No newline at end of file