aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock/member.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-05-21 16:20:17 -0500
committermat <github@matdoes.dev>2022-05-21 16:20:17 -0500
commit8582958e7f3764e47a49667c57805400643b005c (patch)
tree99b28e87139769c658aae9ad2a6f7e701d629b59 /src/cleaners/skyblock/member.ts
parenteb13e07305169c0f19ee87e2516005eb5c0ef3c9 (diff)
downloadskyblock-api-8582958e7f3764e47a49667c57805400643b005c.tar.gz
skyblock-api-8582958e7f3764e47a49667c57805400643b005c.tar.bz2
skyblock-api-8582958e7f3764e47a49667c57805400643b005c.zip
add essence
Diffstat (limited to 'src/cleaners/skyblock/member.ts')
-rw-r--r--src/cleaners/skyblock/member.ts31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts
index f2526d2..d69295e 100644
--- a/src/cleaners/skyblock/member.ts
+++ b/src/cleaners/skyblock/member.ts
@@ -20,6 +20,7 @@ import { Included } from '../../hypixel.js'
import { CleanPlayer } from '../player.js'
import { CleanRank } from '../rank.js'
import { AccessoryBagUpgrades, cleanAccessoryBagUpgrades } from './accessoryBagUpgrades.js'
+import { cleanEssence, Essence } from './essence.js'
export interface CleanBasicMember {
uuid: string
@@ -30,7 +31,7 @@ export interface CleanBasicMember {
left?: boolean
}
-export interface CleanMember extends CleanBasicMember {
+interface ExtraCleanMemberFields {
purse: number
stats: StatItem[]
rawHypixelStats: { [key: string]: number }
@@ -47,10 +48,13 @@ export interface CleanMember extends CleanBasicMember {
coopInvitation: CoopInvitation | null
farmingContests: FarmingContests
accessoryBagUpgrades: AccessoryBagUpgrades
- /** Whether the user left the coop */
+ essence: Essence
+ /** Whether the member left the coop. */
left: boolean
}
+export type CleanMember = CleanBasicMember & ExtraCleanMemberFields
+
export async function cleanSkyBlockProfileMemberResponseBasic(member: typedHypixelApi.SkyBlockProfileMember & { uuid: string }): Promise<CleanBasicMember | null> {
const player = await cached.fetchPlayer(member.uuid, false)
if (!player) return null
@@ -70,6 +74,7 @@ export async function cleanSkyBlockProfileMemberResponse(member: typedHypixelApi
if (!player) return null
const fairySouls = await cleanFairySouls(member)
+
const { max_fairy_souls: maxFairySouls } = await constants.fetchConstantValues()
if (fairySouls.total > (maxFairySouls ?? 0))
await constants.setConstantValues({ max_fairy_souls: fairySouls.total })
@@ -113,35 +118,19 @@ export async function cleanSkyBlockProfileMemberResponse(member: typedHypixelApi
coopInvitation: await coopInvitationPromise,
farmingContests: await farmingContestsPromise,
accessoryBagUpgrades: cleanAccessoryBagUpgrades(member),
+ essence: cleanEssence(member),
left: (player.profiles?.find(profile => profile.uuid === profileId) === undefined) ?? false
}
}
-export interface CleanMemberProfilePlayer extends CleanPlayer {
+export type CleanMemberProfilePlayer = CleanPlayer & {
// The profile name may be different for each player, so we put it here
profileName: string
firstJoin: number | null
lastSave: number | null
- purse: number
- stats: StatItem[]
- rawHypixelStats: { [key: string]: number }
- minions: CleanMinion[]
- fairySouls: FairySouls
- inventories?: Inventories
- objectives: Objective[]
- skills: Skills
- zones: Zone[]
- collections: Collection[]
- slayers: SlayerData
- pets: PetsData
- harp: HarpData
- coopInvitation: CoopInvitation | null
- farmingContests: FarmingContests
- accessoryBagUpgrades: AccessoryBagUpgrades
- left: boolean
-}
+} & ExtraCleanMemberFields
export interface CleanMemberProfile {
member: CleanMemberProfilePlayer