aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/gameMode.ts
blob: 4c98d10269466219c6d84731eb88ec06c3f4d1a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import typedHypixelApi from 'typed-hypixel-api'

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'
}