From 0a1fc6998a7f0c0cdb7c48ce5ad024ac30490de2 Mon Sep 17 00:00:00 2001 From: mat-1 Date: Mon, 3 May 2021 01:38:56 +0000 Subject: Compiled TS into JS --- build/cleaners/skyblock/profile.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'build/cleaners/skyblock/profile.js') diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index ba2c030..2ddcb83 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -1,9 +1,29 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.cleanSkyblockProfileResponse = exports.cleanSkyblockProfileResponseLighter = void 0; const member_1 = require("./member"); const minions_1 = require("./minions"); const bank_1 = require("./bank"); +const constants = __importStar(require("../../constants")); /** Return a `CleanProfile` instead of a `CleanFullProfile`, useful when we need to get members but don't want to waste much ram */ async function cleanSkyblockProfileResponseLighter(data) { // We use Promise.all so it can fetch all the usernames at once instead of waiting for the previous promise to complete @@ -49,6 +69,11 @@ async function cleanSkyblockProfileResponse(data, options) { memberMinions.push(member.minions); } const minions = minions_1.combineMinionArrays(memberMinions); + const { max_minions: maxUniqueMinions } = await constants.fetchConstantValues(); + const uniqueMinions = minions_1.countUniqueMinions(minions); + console.log(uniqueMinions, (maxUniqueMinions !== null && maxUniqueMinions !== void 0 ? maxUniqueMinions : 0), uniqueMinions > (maxUniqueMinions !== null && maxUniqueMinions !== void 0 ? maxUniqueMinions : 0)); + if (uniqueMinions > (maxUniqueMinions !== null && maxUniqueMinions !== void 0 ? maxUniqueMinions : 0)) + await constants.setConstantValues({ max_minions: uniqueMinions }); // return more detailed info return { uuid: data.profile_id, @@ -56,7 +81,7 @@ async function cleanSkyblockProfileResponse(data, options) { members: cleanedMembers, bank: bank_1.cleanBank(data), minions: minions, - minion_count: minions_1.countUniqueMinions(minions) + minion_count: uniqueMinions }; } exports.cleanSkyblockProfileResponse = cleanSkyblockProfileResponse; -- cgit