aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2021-09-06 21:06:22 +0000
committerGitHub <noreply@github.com>2021-09-06 21:06:22 +0000
commit487f208565894f332ca58c13e1b208c3beb9c8c6 (patch)
treeb3209e94cc63658b5430bc1949b80140cc27efe4
parent4f03cb71b30978b277ff292dbddeba182117a7cb (diff)
downloadskyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.tar.gz
skyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.tar.bz2
skyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.zip
Bump node-fetch from 2.6.1 to 3.0.0 (#116)
* Bump node-fetch from 2.6.1 to 3.0.0 Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 3.0.0. - [Release notes](https://github.com/node-fetch/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md) - [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v3.0.0) --- updated-dependencies: - dependency-name: node-fetch dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix issues with node fetch 3.0 * change module to esnext instead of commonjs * fix imports and tests * fix package-lock.json Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mat <github@matdoes.dev> Co-authored-by: mat <27899617+mat-1@users.noreply.github.com>
-rw-r--r--.github/workflows/test.yml2
-rw-r--r--build/cleaners/player.js23
-rw-r--r--build/cleaners/rank.js18
-rw-r--r--build/cleaners/skyblock/bank.js9
-rw-r--r--build/cleaners/skyblock/collections.js19
-rw-r--r--build/cleaners/skyblock/fairysouls.js13
-rw-r--r--build/cleaners/skyblock/inventory.js64
-rw-r--r--build/cleaners/skyblock/itemId.js9
-rw-r--r--build/cleaners/skyblock/member.js73
-rw-r--r--build/cleaners/skyblock/minions.js42
-rw-r--r--build/cleaners/skyblock/objectives.js8
-rw-r--r--build/cleaners/skyblock/profile.js54
-rw-r--r--build/cleaners/skyblock/profiles.js17
-rw-r--r--build/cleaners/skyblock/skills.js12
-rw-r--r--build/cleaners/skyblock/slayers.js19
-rw-r--r--build/cleaners/skyblock/stats.js23
-rw-r--r--build/cleaners/skyblock/zones.js8
-rw-r--r--build/cleaners/socialmedia.js11
-rw-r--r--build/constants.js110
-rw-r--r--build/database.js202
-rw-r--r--build/discord.js24
-rw-r--r--build/hypixel.js101
-rw-r--r--build/hypixelApi.js45
-rw-r--r--build/hypixelCached.js204
-rw-r--r--build/index.js74
-rw-r--r--build/mojang.js50
-rw-r--r--build/util.js29
-rw-r--r--package-lock.json2287
-rw-r--r--package.json16
-rw-r--r--src/cleaners/player.ts12
-rw-r--r--src/cleaners/rank.ts4
-rw-r--r--src/cleaners/skyblock/collections.ts2
-rw-r--r--src/cleaners/skyblock/member.ts34
-rw-r--r--src/cleaners/skyblock/minions.ts4
-rw-r--r--src/cleaners/skyblock/profile.ts10
-rw-r--r--src/cleaners/skyblock/profiles.ts4
-rw-r--r--src/cleaners/skyblock/skills.ts2
-rw-r--r--src/constants.ts19
-rw-r--r--src/database.ts23
-rw-r--r--src/discord.ts4
-rw-r--r--src/hypixel.ts28
-rw-r--r--src/hypixelApi.ts8
-rw-r--r--src/hypixelCached.ts12
-rw-r--r--src/index.ts10
-rw-r--r--src/mojang.ts16
-rw-r--r--test/test.js44
-rw-r--r--tsconfig.json7
47 files changed, 2852 insertions, 957 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index d797ab9..ed1fc94 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,7 +9,7 @@ jobs:
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
- node-version: '14.15.0'
+ node-version: '16.0.0'
- run: npm install
- name: Run tests
diff --git a/build/cleaners/player.js b/build/cleaners/player.js
index 42c76b8..214be1f 100644
--- a/build/cleaners/player.js
+++ b/build/cleaners/player.js
@@ -1,22 +1,17 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanPlayerResponse = void 0;
-const profiles_1 = require("./skyblock/profiles");
-const socialmedia_1 = require("./socialmedia");
-const rank_1 = require("./rank");
-const util_1 = require("../util");
-async function cleanPlayerResponse(data) {
- var _a, _b;
+import { cleanPlayerSkyblockProfiles } from './skyblock/profiles.js';
+import { cleanSocialMedia } from './socialmedia.js';
+import { cleanRank } from './rank.js';
+import { undashUuid } from '../util.js';
+export async function cleanPlayerResponse(data) {
// Cleans up a 'player' api response
if (!data)
return null; // bruh
return {
- uuid: util_1.undashUuid(data.uuid),
+ uuid: undashUuid(data.uuid),
username: data.displayname,
- rank: rank_1.cleanRank(data),
- socials: socialmedia_1.cleanSocialMedia(data),
+ rank: cleanRank(data),
+ socials: cleanSocialMedia(data),
// first_join: data.firstLogin / 1000,
- profiles: profiles_1.cleanPlayerSkyblockProfiles((_b = (_a = data.stats) === null || _a === void 0 ? void 0 : _a.SkyBlock) === null || _b === void 0 ? void 0 : _b.profiles)
+ profiles: cleanPlayerSkyblockProfiles(data.stats?.SkyBlock?.profiles)
};
}
-exports.cleanPlayerResponse = cleanPlayerResponse;
diff --git a/build/cleaners/rank.js b/build/cleaners/rank.js
index 19e4938..1d80d2c 100644
--- a/build/cleaners/rank.js
+++ b/build/cleaners/rank.js
@@ -1,7 +1,4 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanRank = void 0;
-const util_1 = require("../util");
+import { colorCodeFromName, minecraftColorCodes } from '../util.js';
const rankColors = {
'NONE': '7',
'VIP': 'a',
@@ -16,15 +13,14 @@ const rankColors = {
'ADMIN': 'c'
};
/** Response cleaning (reformatting to be nicer) */
-function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusColor, rank, prefix }) {
- var _a;
+export function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusColor, rank, prefix }) {
let name;
let color;
let colored;
let bracketColor;
if (prefix) { // derive values from prefix
colored = prefix;
- color = util_1.minecraftColorCodes[colored.match(/§./)[0][1]];
+ color = minecraftColorCodes[colored.match(/§./)[0][1]];
name = colored.replace(/§./g, '').replace(/[\[\]]/g, '');
}
else {
@@ -33,7 +29,8 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo
else if (rank && rank !== 'NORMAL')
name = rank;
else
- name = (_a = newPackageRank === null || newPackageRank === void 0 ? void 0 : newPackageRank.replace('_PLUS', '+')) !== null && _a !== void 0 ? _a : packageRank === null || packageRank === void 0 ? void 0 : packageRank.replace('_PLUS', '+');
+ name = newPackageRank?.replace('_PLUS', '+')
+ ?? packageRank?.replace('_PLUS', '+');
switch (name) {
// MVP++ is called Superstar for some reason
case 'SUPERSTAR':
@@ -54,8 +51,8 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo
name = 'NONE';
break;
}
- const plusColor = rankPlusColor ? util_1.colorCodeFromName(rankPlusColor) : null;
- color = util_1.minecraftColorCodes[rankColors[name]];
+ const plusColor = rankPlusColor ? colorCodeFromName(rankPlusColor) : null;
+ color = minecraftColorCodes[rankColors[name]];
let rankColorPrefix = rankColors[name] ? '§' + rankColors[name] : '';
// the text is white, but only in the prefix
if (name === 'YOUTUBE')
@@ -82,4 +79,3 @@ function cleanRank({ packageRank, newPackageRank, monthlyPackageRank, rankPlusCo
colored
};
}
-exports.cleanRank = cleanRank;
diff --git a/build/cleaners/skyblock/bank.js b/build/cleaners/skyblock/bank.js
index 9836685..fb08af5 100644
--- a/build/cleaners/skyblock/bank.js
+++ b/build/cleaners/skyblock/bank.js
@@ -1,13 +1,8 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanBank = void 0;
-function cleanBank(data) {
- var _a, _b;
+export function cleanBank(data) {
return {
- balance: (_b = (_a = data === null || data === void 0 ? void 0 : data.banking) === null || _a === void 0 ? void 0 : _a.balance) !== null && _b !== void 0 ? _b : 0,
+ balance: data?.banking?.balance ?? 0,
// TODO: make transactions good
// history: data?.banking?.transactions ?? []
history: []
};
}
-exports.cleanBank = cleanBank;
diff --git a/build/cleaners/skyblock/collections.js b/build/cleaners/skyblock/collections.js
index 0bb4cb5..4a5b34e 100644
--- a/build/cleaners/skyblock/collections.js
+++ b/build/cleaners/skyblock/collections.js
@@ -1,7 +1,4 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanCollections = void 0;
-const itemId_1 = require("./itemId");
+import { cleanItemId } from './itemId.js';
const COLLECTIONS = {
'farming': [
'wheat',
@@ -83,15 +80,14 @@ function getCategory(collectionName) {
return categoryName;
}
}
-function cleanCollections(data) {
- var _a, _b, _c;
+export function cleanCollections(data) {
// collection tiers show up like this: [ GRAVEL_3, GOLD_INGOT_2, MELON_-1, LOG_2:1_7, RAW_FISH:3_-1]
// these tiers are the same for all players in a coop
- const playerCollectionTiersRaw = (_a = data === null || data === void 0 ? void 0 : data.unlocked_coll_tiers) !== null && _a !== void 0 ? _a : [];
+ const playerCollectionTiersRaw = data?.unlocked_coll_tiers ?? [];
const playerCollectionTiers = {};
for (const collectionTierNameValueRaw of playerCollectionTiersRaw) {
const [collectionTierNameRaw, collectionTierValueRaw] = collectionTierNameValueRaw.split(/_(?=-?\d+$)/);
- const collectionName = itemId_1.cleanItemId(collectionTierNameRaw);
+ const collectionName = cleanItemId(collectionTierNameRaw);
// ensure it's at least 0
const collectionValue = Math.max(parseInt(collectionTierValueRaw), 0);
// if the collection hasn't been checked yet, or the new value is higher than the old, replace it
@@ -100,13 +96,13 @@ function cleanCollections(data) {
}
// collection names show up like this: { LOG: 49789, LOG:2: 26219, MUSHROOM_COLLECTION: 2923}
// these values are different for each player in a coop
- const playerCollectionXpsRaw = (_b = data === null || data === void 0 ? void 0 : data.collection) !== null && _b !== void 0 ? _b : {};
+ const playerCollectionXpsRaw = data?.collection ?? {};
const playerCollections = [];
for (const collectionNameRaw in playerCollectionXpsRaw) {
const collectionXp = playerCollectionXpsRaw[collectionNameRaw];
- const collectionName = itemId_1.cleanItemId(collectionNameRaw);
+ const collectionName = cleanItemId(collectionNameRaw);
const collectionLevel = playerCollectionTiers[collectionName];
- const collectionCategory = (_c = getCategory(collectionName)) !== null && _c !== void 0 ? _c : 'unknown';
+ const collectionCategory = getCategory(collectionName) ?? 'unknown';
// in some very weird cases the collection level will be undefined, we should ignore these collections
if (collectionLevel !== undefined)
playerCollections.push({
@@ -118,4 +114,3 @@ function cleanCollections(data) {
}
return playerCollections;
}
-exports.cleanCollections = cleanCollections;
diff --git a/build/cleaners/skyblock/fairysouls.js b/build/cleaners/skyblock/fairysouls.js
index 1c6cef6..8ec8078 100644
--- a/build/cleaners/skyblock/fairysouls.js
+++ b/build/cleaners/skyblock/fairysouls.js
@@ -1,12 +1,7 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanFairySouls = void 0;
-function cleanFairySouls(data) {
- var _a, _b, _c;
+export function cleanFairySouls(data) {
return {
- total: (_a = data === null || data === void 0 ? void 0 : data.fairy_souls_collected) !== null && _a !== void 0 ? _a : 0,
- unexchanged: (_b = data === null || data === void 0 ? void 0 : data.fairy_souls) !== null && _b !== void 0 ? _b : 0,
- exchanges: (_c = data === null || data === void 0 ? void 0 : data.fairy_exchanges) !== null && _c !== void 0 ? _c : 0,
+ total: data?.fairy_souls_collected ?? 0,
+ unexchanged: data?.fairy_souls ?? 0,
+ exchanges: data?.fairy_exchanges ?? 0,
};
}
-exports.cleanFairySouls = cleanFairySouls;
diff --git a/build/cleaners/skyblock/inventory.js b/build/cleaners/skyblock/inventory.js
index 098b8d4..714a302 100644
--- a/build/cleaners/skyblock/inventory.js
+++ b/build/cleaners/skyblock/inventory.js
@@ -1,32 +1,9 @@
-"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.cleanInventories = exports.INVENTORIES = exports.cleanInventory = void 0;
// maybe todo?: create a fast replacement for prismarine-nbt
-const nbt = __importStar(require("prismarine-nbt"));
+import * as nbt from 'prismarine-nbt';
function base64decode(base64) {
return Buffer.from(base64, 'base64');
}
function cleanItem(rawItem) {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
// if the item doesn't have an id, it isn't an item
if (rawItem.id === undefined)
return null;
@@ -34,13 +11,13 @@ function cleanItem(rawItem) {
const itemCount = rawItem.Count;
const damageValue = rawItem.Damage;
const itemTag = rawItem.tag;
- const extraAttributes = (_a = itemTag === null || itemTag === void 0 ? void 0 : itemTag.ExtraAttributes) !== null && _a !== void 0 ? _a : {};
+ const extraAttributes = itemTag?.ExtraAttributes ?? {};
let headId;
if (vanillaId === 397) {
- const headDataBase64 = (_e = (_d = (_c = (_b = itemTag === null || itemTag === void 0 ? void 0 : itemTag.SkullOwner) === null || _b === void 0 ? void 0 : _b.Properties) === null || _c === void 0 ? void 0 : _c.textures) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.Value;
+ const headDataBase64 = itemTag?.SkullOwner?.Properties?.textures?.[0]?.Value;
if (headDataBase64) {
const headData = JSON.parse(base64decode(headDataBase64).toString());
- const headDataUrl = (_g = (_f = headData === null || headData === void 0 ? void 0 : headData.textures) === null || _f === void 0 ? void 0 : _f.SKIN) === null || _g === void 0 ? void 0 : _g.url;
+ const headDataUrl = headData?.textures?.SKIN?.url;
if (headDataUrl) {
const splitUrl = headDataUrl.split('/');
headId = splitUrl[splitUrl.length - 1];
@@ -48,26 +25,26 @@ function cleanItem(rawItem) {
}
}
return {
- id: (_h = extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.id) !== null && _h !== void 0 ? _h : null,
- count: itemCount !== null && itemCount !== void 0 ? itemCount : 1,
+ id: extraAttributes?.id ?? null,
+ count: itemCount ?? 1,
vanillaId: damageValue ? `${vanillaId}:${damageValue}` : vanillaId.toString(),
display: {
- name: (_k = (_j = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _j === void 0 ? void 0 : _j.Name) !== null && _k !== void 0 ? _k : 'null',
- lore: (_m = (_l = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _l === void 0 ? void 0 : _l.Lore) !== null && _m !== void 0 ? _m : [],
+ name: itemTag?.display?.Name ?? 'null',
+ lore: itemTag?.display?.Lore ?? [],
// if it has an ench value in the tag, then it should have an enchant glint effect
- glint: ((_o = itemTag === null || itemTag === void 0 ? void 0 : itemTag.ench) !== null && _o !== void 0 ? _o : []).length > 0
+ glint: (itemTag?.ench ?? []).length > 0
},
- reforge: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.modifier,
- enchantments: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.enchantments,
- anvil_uses: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.anvil_uses,
- timestamp: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.timestamp,
+ reforge: extraAttributes?.modifier,
+ enchantments: extraAttributes?.enchantments,
+ anvil_uses: extraAttributes?.anvil_uses,
+ timestamp: extraAttributes?.timestamp,
head_texture: headId,
};
}
function cleanItems(rawItems) {
return rawItems.map(cleanItem);
}
-function cleanInventory(encodedNbt) {
+export function cleanInventory(encodedNbt) {
return new Promise(resolve => {
const base64Data = base64decode(encodedNbt);
nbt.parse(base64Data, false, (err, value) => {
@@ -77,8 +54,7 @@ function cleanInventory(encodedNbt) {
});
});
}
-exports.cleanInventory = cleanInventory;
-exports.INVENTORIES = {
+export const INVENTORIES = {
armor: 'inv_armor',
inventory: 'inv_contents',
ender_chest: 'ender_chest_contents',
@@ -89,12 +65,11 @@ exports.INVENTORIES = {
trick_or_treat_bag: 'candy_inventory_contents',
wardrobe: 'wardrobe_contents'
};
-async function cleanInventories(data) {
- var _a;
+export async function cleanInventories(data) {
const cleanInventories = {};
- for (const cleanInventoryName in exports.INVENTORIES) {
- const hypixelInventoryName = exports.INVENTORIES[cleanInventoryName];
- const encodedInventoryContents = (_a = data[hypixelInventoryName]) === null || _a === void 0 ? void 0 : _a.data;
+ for (const cleanInventoryName in INVENTORIES) {
+ const hypixelInventoryName = INVENTORIES[cleanInventoryName];
+ const encodedInventoryContents = data[hypixelInventoryName]?.data;
let inventoryContents;
if (encodedInventoryContents) {
inventoryContents = await cleanInventory(encodedInventoryContents);
@@ -106,4 +81,3 @@ async function cleanInventories(data) {
}
return cleanInventories;
}
-exports.cleanInventories = cleanInventories;
diff --git a/build/cleaners/skyblock/itemId.js b/build/cleaners/skyblock/itemId.js
index 7bf5402..ea94771 100644
--- a/build/cleaners/skyblock/itemId.js
+++ b/build/cleaners/skyblock/itemId.js
@@ -1,6 +1,3 @@
-"use strict";
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.cleanItemId = void 0;
// change weird item names to be more consistent with vanilla
const ITEMS = {
'log': 'oak_log',
@@ -55,8 +52,6 @@ const ITEMS = {
'enchanted_glistering_melon': 'enchanted_glistering_melon_slice'
};
/** Clean an item with a weird name (log_2:1) and make it have a better name (dark_oak_log) */
-function cleanItemId(itemId) {
- var _a;
- return (_a = ITEMS[itemId.toLowerCase()]) !== null && _a !== void 0 ? _a : itemId.toLowerCase();
+export function cleanItemId(itemId) {
+ return ITEMS[itemId.toLowerCase()] ?? itemId.toLowerCase();
}
-exports.cleanItemId = cleanItemId;
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js
index cc66488..2242828 100644
--- a/build/cleaners/skyblock/member.js
+++ b/build/cleaners/skyblock/member.js
@@ -1,37 +1,15 @@
-"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.cleanSkyBlockProfileMemberResponse = exports.cleanSkyBlockProfileMemberResponseBasic = void 0;
-const collections_1 = require("./collections");
-const inventory_1 = require("./inventory");
-const fairysouls_1 = require("./fairysouls");
-const objectives_1 = require("./objectives");
-const stats_1 = require("./stats");
-const minions_1 = require("./minions");
-const slayers_1 = require("./slayers");
-const zones_1 = require("./zones");
-const skills_1 = require("./skills");
-const cached = __importStar(require("../../hypixelCached"));
-const constants = __importStar(require("../../constants"));
-async function cleanSkyBlockProfileMemberResponseBasic(member) {
+import { cleanCollections } from './collections.js';
+import { cleanInventories } from './inventory.js';
+import { cleanFairySouls } from './fairysouls.js';
+import { cleanObjectives } from './objectives.js';
+import { cleanProfileStats } from './stats.js';
+import { cleanMinions } from './minions.js';
+import { cleanSlayers } from './slayers.js';
+import { cleanVisitedZones } from './zones.js';
+import { cleanSkills } from './skills.js';
+import * as cached from '../../hypixelCached.js';
+import * as constants from '../../constants.js';
+export async function cleanSkyBlockProfileMemberResponseBasic(member) {
const player = await cached.fetchPlayer(member.uuid);
if (!player)
return null;
@@ -43,18 +21,16 @@ async function cleanSkyBlockProfileMemberResponseBasic(member) {
rank: player.rank
};
}
-exports.cleanSkyBlockProfileMemberResponseBasic = cleanSkyBlockProfileMemberResponseBasic;
/** Cleans up a member (from skyblock/profile) */
-async function cleanSkyBlockProfileMemberResponse(member, included = undefined) {
- var _a;
+export async function cleanSkyBlockProfileMemberResponse(member, included = undefined) {
// profiles.members[]
const inventoriesIncluded = included === undefined || included.includes('inventories');
const player = await cached.fetchPlayer(member.uuid);
if (!player)
return null;
- const fairySouls = fairysouls_1.cleanFairySouls(member);
+ const fairySouls = cleanFairySouls(member);
const { max_fairy_souls: maxFairySouls } = await constants.fetchConstantValues();
- if (fairySouls.total > (maxFairySouls !== null && maxFairySouls !== void 0 ? maxFairySouls : 0))
+ if (fairySouls.total > (maxFairySouls ?? 0))
await constants.setConstantValues({ max_fairy_souls: fairySouls.total });
return {
uuid: member.uuid,
@@ -63,17 +39,16 @@ async function cleanSkyBlockProfileMemberResponse(member, included = undefined)
first_join: member.first_join / 1000,
rank: player.rank,
purse: member.coin_purse,
- stats: stats_1.cleanProfileStats(member),
+ stats: cleanProfileStats(member),
// this is used for leaderboards
- rawHypixelStats: (_a = member.stats) !== null && _a !== void 0 ? _a : {},
- minions: await minions_1.cleanMinions(member),
+ rawHypixelStats: member.stats ?? {},
+ minions: await cleanMinions(member),
fairy_souls: fairySouls,
- inventories: inventoriesIncluded ? await inventory_1.cleanInventories(member) : undefined,
- objectives: objectives_1.cleanObjectives(member),
- skills: await skills_1.cleanSkills(member),
- visited_zones: zones_1.cleanVisitedZones(member),
- collections: collections_1.cleanCollections(member),
- slayers: slayers_1.cleanSlayers(member)
+ inventories: inventoriesIncluded ? await cleanInventories(member) : undefined,
+ objectives: cleanObjectives(member),
+ skills: await cleanSkills(member),
+ visited_zones: cleanVisitedZones(member),
+ collections: cleanCollections(member),
+ slayers: cleanSlayers(member)
};
}
-exports.cleanSkyBlockProfileMemberResponse = cleanSkyBlockProfileMemberResponse;
diff --git a/build/cleaners/skyblock/minions.js b/build/cleaners/skyblock/minions.js
index d2bfc41..5c0bd9a 100644
--- a/build/cleaners/skyblock/minions.js
+++ b/build/cleaners/skyblock/minions.js
@@ -1,36 +1,13 @@
-"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.countUniqueMinions = exports.combineMinionArrays = exports.cleanMinions = void 0;
-const hypixel_1 = require("../../hypixel");
-const constants = __importStar(require("../../constants"));
+import { maxMinion } from '../../hypixel.js';
+import * as constants from '../../constants.js';
/**
* Clean the minions provided by Hypixel
* @param minionsRaw The minion data provided by the Hypixel API
*/
-async function cleanMinions(member) {
- var _a;
+export async function cleanMinions(member) {
const minions = [];
const processedMinionNames = new Set();
- for (const minionRaw of (_a = member === null || member === void 0 ? void 0 : member.craf