aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/fairysouls.ts
blob: 92b1eff84d79d87a39a974f0a12c6f1f31fd18ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import typedHypixelApi from 'typed-hypixel-api'
import * as constants from '../../constants.js'

export interface FairySouls {
	total: number
	/** The number of fairy souls that haven't been exchanged yet */
	unexchanged: number
	exchanges: number
	/** The highest possible number of total fairy souls */
	max: number
}

export async function cleanFairySouls(data: typedHypixelApi.SkyBlockProfileMember): Promise<FairySouls> {
	const { max_fairy_souls } = await constants.fetchConstantValues()
	return {
		total: data?.fairy_souls_collected ?? 0,
		unexchanged: data?.fairy_souls ?? 0,
		exchanges: data?.fairy_exchanges ?? 0,
		max: max_fairy_souls ?? 0,
	}
}