diff options
author | mat <github@matdoes.dev> | 2021-06-29 17:54:50 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-06-29 17:54:50 -0500 |
commit | 49ff24343e1c964b6cb82fdf76957ffd2f27d049 (patch) | |
tree | 820a3668e21dffc7eefa53630944412d9d97a129 /build/cleaners/skyblock | |
parent | 758ca15277daa11ce1ec86ce7f07ea7beee9eb8f (diff) | |
parent | c0c534dafb54ebf9f95a5054f576ad99de29f232 (diff) | |
download | skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.tar.gz skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.tar.bz2 skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.zip |
Merge branch 'main' of https://github.com/skyblockstats/skyblock-api into main
Diffstat (limited to 'build/cleaners/skyblock')
-rw-r--r-- | build/cleaners/skyblock/member.js | 10 | ||||
-rw-r--r-- | build/cleaners/skyblock/minions.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/profile.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/stats.js | 1 |
4 files changed, 9 insertions, 6 deletions
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js index 8e72be8..cc66488 100644 --- a/build/cleaners/skyblock/member.js +++ b/build/cleaners/skyblock/member.js @@ -31,8 +31,10 @@ const zones_1 = require("./zones"); const skills_1 = require("./skills"); const cached = __importStar(require("../../hypixelCached")); const constants = __importStar(require("../../constants")); -async function cleanSkyBlockProfileMemberResponseBasic(member, included = null) { +async function cleanSkyBlockProfileMemberResponseBasic(member) { const player = await cached.fetchPlayer(member.uuid); + if (!player) + return null; return { uuid: member.uuid, username: player.username, @@ -43,13 +45,13 @@ async function cleanSkyBlockProfileMemberResponseBasic(member, included = null) } exports.cleanSkyBlockProfileMemberResponseBasic = cleanSkyBlockProfileMemberResponseBasic; /** Cleans up a member (from skyblock/profile) */ -async function cleanSkyBlockProfileMemberResponse(member, included = null) { +async function cleanSkyBlockProfileMemberResponse(member, included = undefined) { var _a; // profiles.members[] - const inventoriesIncluded = included === null || included.includes('inventories'); + const inventoriesIncluded = included === undefined || included.includes('inventories'); const player = await cached.fetchPlayer(member.uuid); if (!player) - return; + return null; const fairySouls = fairysouls_1.cleanFairySouls(member); const { max_fairy_souls: maxFairySouls } = await constants.fetchConstantValues(); if (fairySouls.total > (maxFairySouls !== null && maxFairySouls !== void 0 ? maxFairySouls : 0)) diff --git a/build/cleaners/skyblock/minions.js b/build/cleaners/skyblock/minions.js index fae3c96..d2bfc41 100644 --- a/build/cleaners/skyblock/minions.js +++ b/build/cleaners/skyblock/minions.js @@ -89,7 +89,7 @@ function combineMinionArrays(minions) { // This should never happen, but in case the length of `minion.levels` is longer than // `matchingMinionReference.levels`, then it should be extended to be equal length while (matchingMinionReference.levels.length < minion.levels.length) - matchingMinionReference.levels.push(null); + matchingMinionReference.levels.push(false); for (let i = 0; i < minion.levels.length; i++) { if (minion.levels[i]) matchingMinionReference.levels[i] = true; diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index 45ef57b..da988cc 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -34,7 +34,7 @@ async function cleanSkyblockProfileResponseLighter(data) { // we pass an empty array to make it not check stats promises.push(member_1.cleanSkyBlockProfileMemberResponseBasic(memberRaw)); } - const cleanedMembers = await Promise.all(promises); + const cleanedMembers = (await Promise.all(promises)).filter(m => m); return { uuid: data.profile_id, name: data.cute_name, diff --git a/build/cleaners/skyblock/stats.js b/build/cleaners/skyblock/stats.js index 482771c..4ca671b 100644 --- a/build/cleaners/skyblock/stats.js +++ b/build/cleaners/skyblock/stats.js @@ -74,6 +74,7 @@ function getStatUnit(name) { return unitName; } } + return null; } exports.getStatUnit = getStatUnit; function cleanProfileStats(data) { |