diff options
Diffstat (limited to 'src/cleaners')
-rw-r--r-- | src/cleaners/player.ts | 1 | ||||
-rw-r--r-- | src/cleaners/rank.ts | 1 | ||||
-rw-r--r-- | src/cleaners/skyblock/inventory.ts | 1 | ||||
-rw-r--r-- | src/cleaners/skyblock/member.ts | 3 | ||||
-rw-r--r-- | src/cleaners/skyblock/profile.ts | 16 |
5 files changed, 13 insertions, 9 deletions
diff --git a/src/cleaners/player.ts b/src/cleaners/player.ts index 02eed90..f49d72c 100644 --- a/src/cleaners/player.ts +++ b/src/cleaners/player.ts @@ -18,7 +18,6 @@ export interface CleanPlayer extends CleanBasicPlayer { export async function cleanPlayerResponse(data: HypixelPlayer): Promise<CleanPlayer> { // Cleans up a 'player' api response - console.log('cleanPlayerResponse', data.stats.SkyBlock.profiles) return { uuid: undashUuid(data.uuid), username: data.displayname, diff --git a/src/cleaners/rank.ts b/src/cleaners/rank.ts index 928373a..49520a9 100644 --- a/src/cleaners/rank.ts +++ b/src/cleaners/rank.ts @@ -52,7 +52,6 @@ export function parseRank({ const rankColorPrefix = rankColors[name] ? '§' + rankColors[name] : '' const nameWithoutPlus = name.split('+')[0] const plusesInName = '+'.repeat(name.split('+').length - 1) - console.log(plusColor, nameWithoutPlus, plusesInName) if (plusColor && plusesInName.length >= 1) colored = `${rankColorPrefix}[${nameWithoutPlus}§${plusColor}${plusesInName}${rankColorPrefix}]` else 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) } |