aboutsummaryrefslogtreecommitdiff
path: root/src/cleaners/skyblock
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleaners/skyblock')
-rw-r--r--src/cleaners/skyblock/inventory.ts1
-rw-r--r--src/cleaners/skyblock/member.ts3
-rw-r--r--src/cleaners/skyblock/profile.ts16
3 files changed, 13 insertions, 7 deletions
diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts
index ac36d88..ea115e5 100644
--- a/src/cleaners/skyblock/inventory.ts
+++ b/src/cleaners/skyblock/inventory.ts
@@ -28,6 +28,7 @@ export const INVENTORIES = {
}
export async function cleanInventories(data: any): Promise<typeof INVENTORIES> {
+ console.log('cleanInventories', data.uuid)
const cleanInventories: any = {}
for (const cleanInventoryName in INVENTORIES) {
const hypixelInventoryName = INVENTORIES[cleanInventoryName]
diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts
index febb9c2..d7d0cd1 100644
--- a/src/cleaners/skyblock/member.ts
+++ b/src/cleaners/skyblock/member.ts
@@ -28,6 +28,7 @@ export interface CleanMember extends CleanBasicMember {
export async function cleanSkyBlockProfileMemberResponse(member, included: Included[] = null): Promise<CleanMember> {
// profiles.members[]
const statsIncluded = included == null || included.includes('stats')
+ const inventoriesIncluded = included == null || included.includes('inventories')
return {
uuid: member.uuid,
username: await cached.usernameFromUser(member.uuid),
@@ -37,7 +38,7 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu
stats: statsIncluded ? cleanProfileStats(member?.stats) : undefined,
minions: statsIncluded ? cleanMinions(member) : undefined,
fairy_souls: statsIncluded ? cleanFairySouls(member) : undefined,
- inventories: statsIncluded ? await cleanInventories(member) : undefined,
+ inventories: inventoriesIncluded ? await cleanInventories(member) : undefined,
}
}
diff --git a/src/cleaners/skyblock/profile.ts b/src/cleaners/skyblock/profile.ts
index 742c9ed..b4a8574 100644
--- a/src/cleaners/skyblock/profile.ts
+++ b/src/cleaners/skyblock/profile.ts
@@ -1,8 +1,7 @@
-import { CleanBasicMember, CleanMember, CleanMemberProfile, cleanSkyBlockProfileMemberResponse } from './member'
+import { CleanBasicMember, CleanMember, cleanSkyBlockProfileMemberResponse } from './member'
import { CleanMinion, combineMinionArrays, countUniqueMinions } from './minions'
-import * as cached from '../../hypixelCached'
import { Bank, cleanBank } from './bank'
-import { cleanFairySouls, FairySouls } from './fairysouls'
+import { ApiOptions } from '../../hypixel'
export interface CleanProfile extends CleanBasicProfile {
members?: CleanBasicMember[]
@@ -36,14 +35,19 @@ export async function cleanSkyblockProfileResponseLighter(data): Promise<CleanPr
}
}
-/** This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data */
-export async function cleanSkyblockProfileResponse(data: any): Promise<CleanFullProfile> {
+/**
+ * This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data
+ */
+export async function cleanSkyblockProfileResponse(data: any, { mainMemberUuid }: ApiOptions): Promise<CleanFullProfile> {
const cleanedMembers: CleanMember[] = []
for (const memberUUID in data.members) {
const memberRaw = data.members[memberUUID]
memberRaw.uuid = memberUUID
- const member: CleanMember = await cleanSkyBlockProfileMemberResponse(memberRaw, ['stats'])
+ const member: CleanMember = await cleanSkyBlockProfileMemberResponse(
+ memberRaw,
+ ['stats', mainMemberUuid === memberUUID ? 'inventories' : undefined]
+ )
cleanedMembers.push(member)
}