aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/cleaners/skyblock/minions.js11
-rw-r--r--build/cleaners/skyblock/profile.js2
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)
}
};
}