aboutsummaryrefslogtreecommitdiff
path: root/build/cleaners/skyblock
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-02-13 19:02:49 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-02-13 19:02:49 -0600
commit9b2856303374521b315759500cf594ec7f22d293 (patch)
treef1439e79f6b79ac2f32cfa08e58124bff553b502 /build/cleaners/skyblock
parent728994f435e781eeffcba739698a1c21bba76a83 (diff)
downloadskyblock-api-9b2856303374521b315759500cf594ec7f22d293.tar.gz
skyblock-api-9b2856303374521b315759500cf594ec7f22d293.tar.bz2
skyblock-api-9b2856303374521b315759500cf594ec7f22d293.zip
fix some stats cutting off at the wrong place
Diffstat (limited to 'build/cleaners/skyblock')
-rw-r--r--build/cleaners/skyblock/member.js3
-rw-r--r--build/cleaners/skyblock/profile.js8
-rw-r--r--build/cleaners/skyblock/stats.js6
3 files changed, 10 insertions, 7 deletions
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js
index 74da48a..4cd0425 100644
--- a/build/cleaners/skyblock/member.js
+++ b/build/cleaners/skyblock/member.js
@@ -29,6 +29,7 @@ const stats_1 = require("./stats");
async function cleanSkyBlockProfileMemberResponse(member, included = null) {
// 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),
@@ -38,7 +39,7 @@ async function cleanSkyBlockProfileMemberResponse(member, included = null) {
stats: statsIncluded ? stats_1.cleanProfileStats(member === null || member === void 0 ? void 0 : member.stats) : undefined,
minions: statsIncluded ? minions_1.cleanMinions(member) : undefined,
fairy_souls: statsIncluded ? fairysouls_1.cleanFairySouls(member) : undefined,
- inventories: statsIncluded ? await inventory_1.cleanInventories(member) : undefined,
+ inventories: inventoriesIncluded ? await inventory_1.cleanInventories(member) : undefined,
};
}
exports.cleanSkyBlockProfileMemberResponse = cleanSkyBlockProfileMemberResponse;
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js
index 5804bb5..7ef57ef 100644
--- a/build/cleaners/skyblock/profile.js
+++ b/build/cleaners/skyblock/profile.js
@@ -22,13 +22,15 @@ async function cleanSkyblockProfileResponseLighter(data) {
};
}
exports.cleanSkyblockProfileResponseLighter = cleanSkyblockProfileResponseLighter;
-/** This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data */
-async function cleanSkyblockProfileResponse(data) {
+/**
+ * This function is somewhat costly and shouldn't be called often. Use cleanSkyblockProfileResponseLighter if you don't need all the data
+ */
+async function cleanSkyblockProfileResponse(data, { mainMemberUuid }) {
const cleanedMembers = [];
for (const memberUUID in data.members) {
const memberRaw = data.members[memberUUID];
memberRaw.uuid = memberUUID;
- const member = await member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats']);
+ const member = await member_1.cleanSkyBlockProfileMemberResponse(memberRaw, ['stats', mainMemberUuid === memberUUID ? 'inventories' : undefined]);
cleanedMembers.push(member);
}
const memberMinions = [];
diff --git a/build/cleaners/skyblock/stats.js b/build/cleaners/skyblock/stats.js
index 81f5544..aa026db 100644
--- a/build/cleaners/skyblock/stats.js
+++ b/build/cleaners/skyblock/stats.js
@@ -23,8 +23,8 @@ function categorizeStat(statNameRaw) {
}
for (const categoryMatch of statCategoryMatchers) {
// ['deaths_']
- let trailingEnd = categoryMatch[0] == '_';
- let trailingStart = categoryMatch.substr(-1) == '_';
+ let trailingEnd = categoryMatch[0] === '_';
+ let trailingStart = categoryMatch.substr(-1) === '_';
if (trailingStart && statNameRaw.startsWith(categoryMatch)) {
return {
category: statCategory,
@@ -34,7 +34,7 @@ function categorizeStat(statNameRaw) {
else if (trailingEnd && statNameRaw.endsWith(categoryMatch)) {
return {
category: statCategory,
- name: statNameRaw.substr(0, categoryMatch.length)
+ name: statNameRaw.substr(0, statNameRaw.length - categoryMatch.length)
};
}
else if (statNameRaw == categoryMatch) {