aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-02-16 23:15:26 -0600
committermat <github@matdoes.dev>2022-02-16 23:15:26 -0600
commit803e1321e70e0538f63cc3c933823a8897d84965 (patch)
treef24736615d29bd2e98473eb24e2cc30154bf8f71 /src
parentff6dcfbe52cc325fce1acd3cb4f160d233967eec (diff)
downloadskyblock-api-803e1321e70e0538f63cc3c933823a8897d84965.tar.gz
skyblock-api-803e1321e70e0538f63cc3c933823a8897d84965.tar.bz2
skyblock-api-803e1321e70e0538f63cc3c933823a8897d84965.zip
move maxUniqueMinions
Diffstat (limited to 'src')
-rw-r--r--src/cleaners/skyblock/member.ts8
-rw-r--r--src/cleaners/skyblock/profile.ts10
2 files changed, 8 insertions, 10 deletions
diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts
index 932b016..8d1fdf1 100644
--- a/src/cleaners/skyblock/member.ts
+++ b/src/cleaners/skyblock/member.ts
@@ -27,9 +27,8 @@ export interface CleanBasicMember {
export interface CleanMember extends CleanBasicMember {
purse: number
stats: StatItem[]
- rawHypixelStats?: { [ key: string ]: number }
+ rawHypixelStats?: { [key: string]: number }
minions: CleanMinion[]
- max_minions: number
fairy_souls: FairySouls
inventories?: Inventories
objectives: Objective[]
@@ -62,8 +61,6 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu
const { max_fairy_souls: maxFairySouls } = await constants.fetchConstantValues()
if (fairySouls.total > (maxFairySouls ?? 0))
await constants.setConstantValues({ max_fairy_souls: fairySouls.total })
-
- const { max_minions } = await constants.fetchConstantValues()
return {
uuid: member.uuid,
@@ -80,7 +77,6 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu
rawHypixelStats: member.stats ?? {},
minions: await cleanMinions(member),
- max_minions: max_minions ?? 0,
fairy_souls: fairySouls,
inventories: inventoriesIncluded ? await cleanInventories(member) : undefined,
objectives: cleanObjectives(member),
@@ -100,7 +96,7 @@ export interface CleanMemberProfilePlayer extends CleanPlayer {
bank?: Bank
purse?: number
stats?: StatItem[]
- rawHypixelStats?: { [ key: string ]: number }
+ rawHypixelStats?: { [key: string]: number }
minions?: CleanMinion[]
fairy_souls?: FairySouls
inventories?: Inventories
diff --git a/src/cleaners/skyblock/profile.ts b/src/cleaners/skyblock/profile.ts
index 34c895a..a7bc92a 100644
--- a/src/cleaners/skyblock/profile.ts
+++ b/src/cleaners/skyblock/profile.ts
@@ -12,14 +12,15 @@ export interface CleanFullProfile extends CleanProfile {
members: CleanMember[]
bank: Bank
minions: CleanMinion[]
- minion_count: number
+ minion_count: number
+ maxUniqueMinions: number
}
export interface CleanFullProfileBasicMembers extends CleanProfile {
members: CleanBasicMember[]
bank: Bank
minions: CleanMinion[]
- minion_count: number
+ minion_count: number
}
/** Return a `CleanProfile` instead of a `CleanFullProfile`, useful when we need to get members but don't want to waste much ram */
@@ -80,7 +81,7 @@ export async function cleanSkyblockProfileResponse(data: any, options?: ApiOptio
const minions: CleanMinion[] = combineMinionArrays(memberMinions)
const { max_minions: maxUniqueMinions } = await constants.fetchConstantValues()
-
+
const uniqueMinions = countUniqueMinions(minions)
if (uniqueMinions > (maxUniqueMinions ?? 0))
await constants.setConstantValues({ max_minions: uniqueMinions })
@@ -92,7 +93,8 @@ export async function cleanSkyblockProfileResponse(data: any, options?: ApiOptio
members: cleanedMembers,
bank: cleanBank(data),
minions: minions,
- minion_count: uniqueMinions
+ minion_count: uniqueMinions,
+ maxUniqueMinions: maxUniqueMinions ?? 0,
}
}