aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/gameMode.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-09 19:30:59 -0500
committermat <github@matdoes.dev>2022-04-09 19:30:59 -0500
commit58e2fa480e127c30a04dc81256f462b7ad206eb9 (patch)
tree31fa318182aa25bd22c5afc8dc4a2f19086e024e /src/cleaners/skyblock/gameMode.ts
parent44510a2390270c7aeb8ad7ade72cd03c56ad5a2d (diff)
downloadskyblock-api-58e2fa480e127c30a04dc81256f462b7ad206eb9.tar.gz
skyblock-api-58e2fa480e127c30a04dc81256f462b7ad206eb9.tar.bz2
skyblock-api-58e2fa480e127c30a04dc81256f462b7ad206eb9.zip
add special profile modes
Diffstat (limited to 'src/cleaners/skyblock/gameMode.ts')
-rw-r--r--src/cleaners/skyblock/gameMode.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cleaners/skyblock/gameMode.ts b/src/cleaners/skyblock/gameMode.ts
new file mode 100644
index 0000000..635c00a
--- /dev/null
+++ b/src/cleaners/skyblock/gameMode.ts
@@ -0,0 +1,16 @@
+import typedHypixelApi from 'typed-hypixel-api'
+import { fetchItemList } from '../../hypixel.js'
+import { levelFromXpTable } from '../../util.js'
+import { fetchPets } from '../../constants.js'
+import { ItemListItem } from './itemList.js'
+
+export type GameMode = 'normal' | 'stranded' | 'bingo' | 'ironman'
+const gameModeMap: Record<NonNullable<typedHypixelApi.SkyBlockProfile['game_mode']>, GameMode> = {
+ bingo: 'bingo',
+ island: 'stranded',
+ ironman: 'ironman',
+}
+
+export function cleanGameMode(data: typedHypixelApi.SkyBlockProfile): GameMode {
+ return (data.game_mode && (data.game_mode in gameModeMap)) ? gameModeMap[data.game_mode] : 'normal'
+}