diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 16:23:28 -0600 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 16:23:28 -0600 |
commit | dd513537e240bbaf12c4f204d49db88111633d98 (patch) | |
tree | e51cb050b2ff8748066420a78f15106770b237a4 /build | |
parent | 43f194ff780d704834706ac6da454a8858098906 (diff) | |
download | skyblock-api-dd513537e240bbaf12c4f204d49db88111633d98.tar.gz skyblock-api-dd513537e240bbaf12c4f204d49db88111633d98.tar.bz2 skyblock-api-dd513537e240bbaf12c4f204d49db88111633d98.zip |
add fairy souls
Diffstat (limited to 'build')
-rw-r--r-- | build/cleaners/skyblock/minions.js | 11 | ||||
-rw-r--r-- | build/cleaners/skyblock/profile.js | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/build/cleaners/skyblock/minions.js b/build/cleaners/skyblock/minions.js index 289da1a..777db9b 100644 --- a/build/cleaners/skyblock/minions.js +++ b/build/cleaners/skyblock/minions.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.combineMinionArrays = exports.cleanMinions = void 0; +exports.countUniqueMinions = exports.combineMinionArrays = exports.cleanMinions = void 0; const hypixel_1 = require("../../hypixel"); /** * Clean the minions provided by Hypixel @@ -61,3 +61,12 @@ function combineMinionArrays(minions) { return resultMinions; } exports.combineMinionArrays = combineMinionArrays; +function countUniqueMinions(minions) { + let uniqueMinions = 0; + for (const minion of minions) { + // find the number of times `true` is in the list and add it to uniqueMinions + uniqueMinions += minion.levels.filter(x => x).length; + } + return uniqueMinions; +} +exports.countUniqueMinions = countUniqueMinions; diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index aa5433e..86e21a3 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -81,6 +81,7 @@ async function fetchMemberProfile(user, profile) { const member = cleanProfile.members.find(m => m.uuid === playerUuid); return { member: { + // the profile name is in member rather than profile since they sometimes differ for each member profileName: cleanProfile.name, first_join: member.first_join, last_save: member.last_save, @@ -91,6 +92,7 @@ async function fetchMemberProfile(user, profile) { uuid: cleanProfile.uuid, bank: cleanProfile.bank, minions: cleanProfile.minions, + minion_count: minions_1.countUniqueMinions(cleanProfile.minions) } }; } |