aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/cleaners/skyblock/collections.js106
-rw-r--r--build/cleaners/skyblock/inventory.js2
-rw-r--r--build/cleaners/skyblock/itemId.js62
-rw-r--r--build/cleaners/skyblock/member.js4
4 files changed, 172 insertions, 2 deletions
diff --git a/build/cleaners/skyblock/collections.js b/build/cleaners/skyblock/collections.js
new file mode 100644
index 0000000..def7140
--- /dev/null
+++ b/build/cleaners/skyblock/collections.js
@@ -0,0 +1,106 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.cleanCollections = void 0;
+const itemId_1 = require("./itemId");
+const COLLECTIONS = {
+ 'farming': [
+ 'wheat',
+ 'carrot',
+ 'potato',
+ 'pumpkin',
+ 'melon_slice',
+ 'wheat_seeds',
+ 'red_mushroom',
+ 'cocoa_beans',
+ 'cactus',
+ 'sugar_cane',
+ 'feather',
+ 'leather',
+ 'porkchop',
+ 'chicken',
+ 'mutton',
+ 'rabbit',
+ 'nether_wart'
+ ],
+ 'mining': [
+ 'cobblestone',
+ 'coal',
+ 'iron_ingot',
+ 'gold_ingot',
+ 'diamond',
+ 'lapis_lazuli',
+ 'emerald',
+ 'redstone',
+ 'quartz',
+ 'obsidian',
+ 'glowstone_dust',
+ 'gravel',
+ 'ice',
+ 'netherrack',
+ 'sand',
+ 'end_stone'
+ ],
+ 'combat': [
+ 'rotten_flesh',
+ 'bone',
+ 'string',
+ 'spider_eye',
+ 'gunpowder',
+ 'ender_pearl',
+ 'ghast_tear',
+ 'slime_ball',
+ 'blaze_rod',
+ 'magma_cream'
+ ],
+ 'foraging': [
+ 'oak_log',
+ 'spruce_log',
+ 'birch_log',
+ 'jungle_log',
+ 'acacia_log',
+ 'dark_oak_log'
+ ],
+ 'fishing': [
+ 'cod',
+ 'salmon',
+ 'tropical_fish',
+ 'pufferfish',
+ 'prismarine_shard',
+ 'prismarine_crystals',
+ 'clay_ball',
+ 'lily_pad',
+ 'ink_sac',
+ 'sponge'
+ ]
+};
+function cleanCollections(data) {
+ var _a, _b;
+ // 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 playerCollectionTiers = {};
+ for (const collectionTierNameValueRaw of playerCollectionTiersRaw) {
+ const [collectionTierNameRaw, collectionTierValueRaw] = collectionTierNameValueRaw.split(/_(?=-?\d+$)/);
+ const collectionName = itemId_1.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
+ if (!playerCollectionTiers[collectionName] || collectionValue > playerCollectionTiers[collectionName])
+ playerCollectionTiers[collectionName] = collectionValue;
+ }
+ // 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 playerCollectionValuesRaw = (_b = data === null || data === void 0 ? void 0 : data.collection) !== null && _b !== void 0 ? _b : {};
+ const playerCollectionValues = [];
+ for (const collectionNameRaw in playerCollectionValuesRaw) {
+ const collectionValue = playerCollectionValuesRaw[collectionNameRaw];
+ const collectionName = itemId_1.cleanItemId(collectionNameRaw);
+ playerCollectionValues.push({
+ name: collectionName,
+ xp: collectionValue,
+ level: playerCollectionTiers[collectionName]
+ });
+ }
+ return playerCollectionValues;
+}
+exports.cleanCollections = cleanCollections;
diff --git a/build/cleaners/skyblock/inventory.js b/build/cleaners/skyblock/inventory.js
index c0c54ba..6892c6e 100644
--- a/build/cleaners/skyblock/inventory.js
+++ b/build/cleaners/skyblock/inventory.js
@@ -29,7 +29,7 @@ function cleanItem(rawItem) {
// if the item doesn't have an id, it isn't an item
if (rawItem.id === undefined)
return null;
- const vanillaId = rawItem.id && -1;
+ const vanillaId = rawItem.id;
const itemCount = rawItem.Count;
const damageValue = rawItem.Damage;
const itemTag = rawItem.tag;
diff --git a/build/cleaners/skyblock/itemId.js b/build/cleaners/skyblock/itemId.js
new file mode 100644
index 0000000..7bf5402
--- /dev/null
+++ b/build/cleaners/skyblock/itemId.js
@@ -0,0 +1,62 @@
+"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',
+ 'log:1': 'spruce_log',
+ 'log:2': 'birch_log',
+ 'log:3': 'jungle_log',
+ 'log_2': 'acacia_log',
+ 'log_2:1': 'dark_oak_log',
+ 'ink_sack': 'ink_sac',
+ 'ink_sack:3': 'cocoa_beans',
+ 'ink_sack:4': 'lapis_lazuli',
+ 'cocoa': 'cocoa_beans',
+ 'raw_fish': 'cod',
+ 'raw_fish:1': 'salmon',
+ 'raw_fish:2': 'tropical_fish',
+ 'raw_fish:3': 'pufferfish',
+ 'raw_salmon': 'salmon',
+ 'cooked_fish': 'cooked_cod',
+ 'seeds': 'wheat_seeds',
+ 'sulphur': 'gunpowder',
+ 'raw_chicken': 'chicken',
+ 'pork': 'porkchop',
+ 'potato_item': 'potato',
+ 'carrot_item': 'carrot',
+ 'mushroom_collection': 'red_mushroom',
+ 'nether_stalk': 'nether_wart',
+ 'water_lily': 'lily_pad',
+ 'melon': 'melon_slice',
+ 'ender_stone': 'end_stone',
+ 'huge_mushroom_1': 'red_mushroom_block',
+ 'huge_mushroom_2': 'brown_mushroom_block',
+ 'iron_ingot': 'iron_ingot',
+ 'iron': 'iron_ingot',
+ 'gold': 'gold_ingot',
+ 'endstone': 'end_stone',
+ 'lapis_lazuli_block': 'lapis_block',
+ 'snow_ball': 'snowball',
+ 'raw_beef': 'beef',
+ 'eye_of_ender': 'ender_eye',
+ 'grilled_pork': 'cooked_porkchop',
+ 'glistering_melon': 'glistering_melon_slice',
+ 'cactus_green': 'green_dye',
+ 'enchanted_lapis_lazuli': 'enchanted_lapis_lazuli',
+ 'enchanted_potato': 'enchanted_potato',
+ 'enchanted_birch_log': 'enchanted_birch_log',
+ 'enchanted_gunpowder': 'enchanted_gunpowder',
+ 'enchanted_raw_salmon': 'enchanted_salmon',
+ 'enchanted_raw_chicken': 'enchanted_chicken',
+ 'enchanted_water_lily': 'enchanted_lily_pad',
+ 'enchanted_ink_sack': 'enchanted_ink_sac',
+ 'enchanted_melon': 'enchanted_melon_slice',
+ '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();
+}
+exports.cleanItemId = cleanItemId;
diff --git a/build/cleaners/skyblock/member.js b/build/cleaners/skyblock/member.js
index bf1f908..41092e1 100644
--- a/build/cleaners/skyblock/member.js
+++ b/build/cleaners/skyblock/member.js
@@ -28,6 +28,7 @@ const minions_1 = require("./minions");
const skills_1 = require("./skills");
const cached = __importStar(require("../../hypixelCached"));
const zones_1 = require("./zones");
+const collections_1 = require("./collections");
async function cleanSkyBlockProfileMemberResponseBasic(member, included = null) {
return {
uuid: member.uuid,
@@ -53,7 +54,8 @@ async function cleanSkyBlockProfileMemberResponse(member, included = null) {
inventories: inventoriesIncluded ? await inventory_1.cleanInventories(member) : undefined,
objectives: objectives_1.cleanObjectives(member),
skills: skills_1.cleanSkills(member),
- visited_zones: zones_1.cleanVisitedZones(member)
+ visited_zones: zones_1.cleanVisitedZones(member),
+ collections: collections_1.cleanCollections(member)
};
}
exports.cleanSkyBlockProfileMemberResponse = cleanSkyBlockProfileMemberResponse;