aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/gameMode.ts
blob: 635c00af1d22a9723f0ac4b8d70805067a066333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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'
}