aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build/cleaners/skyblock/member.js11
-rw-r--r--build/cleaners/skyblock/profiles.js1
-rw-r--r--build/hypixelCached.js4
-rw-r--r--src/cleaners/skyblock/member.ts21
-rw-r--r--src/cleaners/skyblock/profiles.ts1
-rw-r--r--src/hypixelCached.ts7
6 files changed, 31 insertions, 14 deletions
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js
index 9d10a5e..39324de 100644
--- a/build/cleaners/skyblock/member.js
+++ b/build/cleaners/skyblock/member.js
@@ -20,12 +20,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanSkyBlockProfileMemberResponse = exports.cleanSkyBlockProfileMemberResponseBasic = void 0;
-const cached = __importStar(require("../../hypixelCached"));
-const fairysouls_1 = require("./fairysouls");
+const stats_1 = require("./stats");
const inventory_1 = require("./inventory");
-const minions_1 = require("./minions");
+const fairysouls_1 = require("./fairysouls");
const objectives_1 = require("./objectives");
-const stats_1 = require("./stats");
+const minions_1 = require("./minions");
+const skills_1 = require("./skills");
+const cached = __importStar(require("../../hypixelCached"));
async function cleanSkyBlockProfileMemberResponseBasic(member, included = null) {
return {
uuid: member.uuid,
@@ -44,11 +45,13 @@ async function cleanSkyBlockProfileMemberResponse(member, included = null) {
username: await cached.usernameFromUser(member.uuid),
last_save: member.last_save,
first_join: member.first_join,
+ purse: member.coin_purse,
stats: stats_1.cleanProfileStats(member),
minions: minions_1.cleanMinions(member),
fairy_souls: fairysouls_1.cleanFairySouls(member),
inventories: inventoriesIncluded ? await inventory_1.cleanInventories(member) : undefined,
objectives: objectives_1.cleanObjectives(member),
+ skills: skills_1.cleanSkills(member)
};
}
exports.cleanSkyBlockProfileMemberResponse = cleanSkyBlockProfileMemberResponse;
diff --git a/build/cleaners/skyblock/profiles.js b/build/cleaners/skyblock/profiles.js
index b481e09..b79fc56 100644
--- a/build/cleaners/skyblock/profiles.js
+++ b/build/cleaners/skyblock/profiles.js
@@ -10,6 +10,7 @@ function cleanPlayerSkyblockProfiles(rawProfiles) {
name: profile.cute_name
});
}
+ console.log('cleanPlayerSkyblockProfiles', profiles);
return profiles;
}
exports.cleanPlayerSkyblockProfiles = cleanPlayerSkyblockProfiles;
diff --git a/build/hypixelCached.js b/build/hypixelCached.js
index bf01171..cb8d0db 100644
--- a/build/hypixelCached.js
+++ b/build/hypixelCached.js
@@ -107,7 +107,9 @@ async function fetchPlayer(user) {
path: 'player',
args: { uuid: playerUuid }
});
- playerCache.set(playerUuid, cleanPlayer);
+ // clone in case it gets modified somehow later
+ const cleanPlayerClone = Object.assign({}, cleanPlayer);
+ playerCache.set(playerUuid, cleanPlayerClone);
return cleanPlayer;
}
exports.fetchPlayer = fetchPlayer;
diff --git a/src/cleaners/skyblock/member.ts b/src/cleaners/skyblock/member.ts
index 04aa476..796d524 100644
--- a/src/cleaners/skyblock/member.ts
+++ b/src/cleaners/skyblock/member.ts
@@ -1,13 +1,14 @@
-import { Included } from '../../hypixel'
-import * as cached from '../../hypixelCached'
-import { CleanPlayer } from '../player'
-import { Bank } from './bank'
-import { cleanFairySouls, FairySouls } from './fairysouls'
+import { CleanProfileStats, cleanProfileStats } from './stats'
import { cleanInventories, INVENTORIES } from './inventory'
-import { CleanMinion, cleanMinions } from './minions'
+import { cleanFairySouls, FairySouls } from './fairysouls'
import { cleanObjectives, Objective } from './objectives'
+import { CleanMinion, cleanMinions } from './minions'
+import { cleanSkills, Skill } from './skills'
+import * as cached from '../../hypixelCached'
import { CleanFullProfile } from './profile'
-import { CleanProfileStats, cleanProfileStats } from './stats'
+import { Included } from '../../hypixel'
+import { CleanPlayer } from '../player'
+import { Bank } from './bank'
export interface CleanBasicMember {
uuid: string
@@ -17,11 +18,13 @@ export interface CleanBasicMember {
}
export interface CleanMember extends CleanBasicMember {
+ purse: number
stats: CleanProfileStats
minions: CleanMinion[]
fairy_souls: FairySouls
inventories: typeof INVENTORIES
objectives: Objective[]
+ skills: Skill[]
}
export async function cleanSkyBlockProfileMemberResponseBasic(member, included: Included[] = null): Promise<CleanBasicMember> {
@@ -43,12 +46,14 @@ export async function cleanSkyBlockProfileMemberResponse(member, included: Inclu
last_save: member.last_save,
first_join: member.first_join,
+ purse: member.coin_purse,
+
stats: cleanProfileStats(member),
minions: cleanMinions(member),
fairy_souls: cleanFairySouls(member),
inventories: inventoriesIncluded ? await cleanInventories(member) : undefined,
objectives: cleanObjectives(member),
- // skills: statsIncluded ?
+ skills: cleanSkills(member)
}
}
diff --git a/src/cleaners/skyblock/profiles.ts b/src/cleaners/skyblock/profiles.ts
index 5eea8fb..c942a14 100644
--- a/src/cleaners/skyblock/profiles.ts
+++ b/src/cleaners/skyblock/profiles.ts
@@ -9,6 +9,7 @@ export function cleanPlayerSkyblockProfiles(rawProfiles: HypixelPlayerStatsSkyBl
name: profile.cute_name
})
}
+ console.log('cleanPlayerSkyblockProfiles', profiles)
return profiles
}
diff --git a/src/hypixelCached.ts b/src/hypixelCached.ts
index bf3124a..f98f6d6 100644
--- a/src/hypixelCached.ts
+++ b/src/hypixelCached.ts
@@ -8,6 +8,7 @@ import * as hypixel from './hypixel'
import { CleanPlayer } from './cleaners/player'
import { undashUuid } from './util'
import { CleanProfile, CleanFullProfile, CleanBasicProfile } from './cleaners/skyblock/profile'
+import { cleanProfileStats } from './cleaners/skyblock/stats'
// cache usernames for 4 hours
@@ -100,7 +101,11 @@ export async function fetchPlayer(user: string): Promise<CleanPlayer> {
path: 'player',
args: { uuid: playerUuid }
})
- playerCache.set(playerUuid, cleanPlayer)
+
+ // clone in case it gets modified somehow later
+ const cleanPlayerClone = Object.assign({}, cleanPlayer)
+ playerCache.set(playerUuid, cleanPlayerClone)
+
return cleanPlayer
}