hypixel-api-reborn 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eslint.config.mjs +71 -0
- package/package.json +14 -20
- package/src/API/getAchievements.js +1 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +4 -3
- package/src/API/getGuildAchievements.js +1 -0
- package/src/API/getLeaderboards.js +1 -1
- package/src/API/getPlayer.js +1 -0
- package/src/API/getQuests.js +1 -0
- package/src/API/getRecentGames.js +5 -9
- package/src/API/getServerInfo.js +40 -37
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/housing/getActiveHouses.js +7 -0
- package/src/API/housing/getHouse.js +9 -0
- package/src/API/housing/getPlayerHouses.js +11 -0
- package/src/API/index.js +6 -1
- package/src/API/skyblock/getAuction.js +8 -6
- package/src/API/skyblock/getAuctions.js +15 -12
- package/src/API/skyblock/getAuctionsByPlayer.js +1 -1
- package/src/API/skyblock/getBazaar.js +1 -3
- package/src/API/skyblock/getBingo.js +1 -2
- package/src/API/skyblock/getBingoByPlayer.js +3 -3
- package/src/API/skyblock/getEndedAuctions.js +1 -0
- package/src/API/skyblock/getFireSales.js +1 -1
- package/src/API/skyblock/getGarden.js +7 -0
- package/src/API/skyblock/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +5 -2
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +5 -2
- package/src/Client.js +88 -16
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +12 -13
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- package/src/index.js +5 -0
- package/src/structures/APIIncident.js +1 -2
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +9 -8
- package/src/structures/Game.js +1 -1
- package/src/structures/Guild/Guild.js +19 -36
- package/src/structures/Guild/GuildMember.js +2 -2
- package/src/structures/House.js +54 -0
- package/src/structures/MiniGames/Arcade.js +798 -312
- package/src/structures/MiniGames/ArenaBrawl.js +98 -32
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +381 -129
- package/src/structures/MiniGames/BuildBattle.js +19 -8
- package/src/structures/MiniGames/CopsAndCrims.js +253 -25
- package/src/structures/MiniGames/Duels.js +905 -664
- package/src/structures/MiniGames/MegaWalls.js +390 -51
- package/src/structures/MiniGames/MurderMystery.js +151 -30
- package/src/structures/MiniGames/Paintball.js +31 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/Quakecraft.js +113 -50
- package/src/structures/MiniGames/SkyWars.js +528 -372
- package/src/structures/MiniGames/SmashHeroes.js +201 -73
- package/src/structures/MiniGames/SpeedUHC.js +77 -24
- package/src/structures/MiniGames/TNTGames.js +242 -73
- package/src/structures/MiniGames/TurboKartRacers.js +55 -115
- package/src/structures/MiniGames/UHC.js +144 -132
- package/src/structures/MiniGames/VampireZ.js +70 -37
- package/src/structures/MiniGames/Warlords.js +126 -1
- package/src/structures/MiniGames/WoolWars.js +60 -9
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +43 -128
- package/src/structures/PlayerCosmetics.js +5 -4
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +2 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +7 -14
- package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +90 -228
- package/src/structures/SkyBlock/SkyblockPet.js +3 -4
- package/src/structures/SkyBlock/Static/Bingo.js +10 -11
- package/src/structures/SkyBlock/Static/BingoData.js +1 -1
- package/src/structures/Static/Achievement.js +16 -15
- package/src/structures/Static/AchievementTier.js +2 -2
- package/src/structures/Static/Quest.js +2 -2
- package/src/utils/Constants.js +522 -520
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +482 -192
- package/src/utils/arrayTools.js +1 -1
- package/src/utils/divide.js +1 -1
- package/src/utils/index.js +2 -1
- package/src/utils/isGuildID.js +1 -1
- package/src/utils/oscillation.js +4 -2
- package/src/utils/removeSnakeCase.js +11 -7
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +3 -3
- package/src/utils/toUuid.js +4 -4
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +1186 -967
- package/src/utils/toIGN.js +0 -24
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { parseRarity, parseGearScore } = require('../../utils/SkyblockUtils');
|
|
1
2
|
/**
|
|
2
3
|
* Item class
|
|
3
4
|
*/
|
|
@@ -21,7 +22,7 @@ class SkyblockInventoryItem {
|
|
|
21
22
|
* @type {string}
|
|
22
23
|
*/
|
|
23
24
|
this.name =
|
|
24
|
-
data.tag.display.Name
|
|
25
|
+
null !== data.tag.display.Name ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
|
|
25
26
|
/**
|
|
26
27
|
* Item lore
|
|
27
28
|
* @type {string}
|
|
@@ -58,7 +59,6 @@ class SkyblockInventoryItem {
|
|
|
58
59
|
*/
|
|
59
60
|
this.gemstones = data.tag.ExtraAttributes.gems
|
|
60
61
|
? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => {
|
|
61
|
-
// eslint-disable-next-line no-new-object
|
|
62
62
|
return new Object({ type: gem[0].split('_')[0], quality: gem[1] });
|
|
63
63
|
})
|
|
64
64
|
: null;
|
|
@@ -71,7 +71,6 @@ class SkyblockInventoryItem {
|
|
|
71
71
|
* What rarity the item has, as an uppercase string
|
|
72
72
|
* @author linearaccelerator
|
|
73
73
|
* @type {string}
|
|
74
|
-
* @version >6.0.1
|
|
75
74
|
*/
|
|
76
75
|
this.rarity = parseRarity(this.loreArray[this.loreArray.length - 1]);
|
|
77
76
|
/**
|
|
@@ -94,7 +93,7 @@ class SkyblockInventoryItem {
|
|
|
94
93
|
* Is the item soulbound
|
|
95
94
|
* @type {boolean}
|
|
96
95
|
*/
|
|
97
|
-
this.soulbound = data.tag.ExtraAttributes.donated_museum
|
|
96
|
+
this.soulbound = 1 === data.tag.ExtraAttributes.donated_museum;
|
|
98
97
|
/**
|
|
99
98
|
* Amount of art of war books applied to the item
|
|
100
99
|
* @type {number}
|
|
@@ -114,7 +113,7 @@ class SkyblockInventoryItem {
|
|
|
114
113
|
* Is the item recombobulated
|
|
115
114
|
* @type {boolean}
|
|
116
115
|
*/
|
|
117
|
-
this.recombobulated = data.tag.ExtraAttributes.rarity_upgrades
|
|
116
|
+
this.recombobulated = 1 === data.tag.ExtraAttributes.rarity_upgrades;
|
|
118
117
|
/**
|
|
119
118
|
* Item attributes
|
|
120
119
|
* @type {object}
|
|
@@ -159,29 +158,6 @@ class SkyblockInventoryItem {
|
|
|
159
158
|
return this.name;
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
// eslint-disable-next-line require-jsdoc
|
|
163
|
-
function parseRarity(stringContainingRarity) {
|
|
164
|
-
const rarityArray = [
|
|
165
|
-
'COMMON',
|
|
166
|
-
'UNCOMMON',
|
|
167
|
-
'RARE',
|
|
168
|
-
'EPIC',
|
|
169
|
-
'LEGENDARY',
|
|
170
|
-
'MYTHIC',
|
|
171
|
-
'DIVINE',
|
|
172
|
-
'SPECIAL',
|
|
173
|
-
'VERY SPECIAL'
|
|
174
|
-
];
|
|
175
|
-
for (const rarity of rarityArray) {
|
|
176
|
-
if (stringContainingRarity.includes(rarity)) return rarity;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// eslint-disable-next-line require-jsdoc
|
|
180
|
-
function parseGearScore(lore) {
|
|
181
|
-
for (const line of lore) {
|
|
182
|
-
if (line.match(/Gear Score: §[0-9a-f](\d+)/)) return Number(line.match(/Gear Score: §d(\d+)/)[1]);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
161
|
|
|
186
162
|
/**
|
|
187
163
|
* @typedef {object} SkyblockItemGemstone
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
const {
|
|
2
|
-
|
|
3
|
-
getLevelByXp,
|
|
4
|
-
getSlayerLevel,
|
|
2
|
+
getTrophyFishRank,
|
|
5
3
|
getMemberStats,
|
|
6
|
-
|
|
4
|
+
getLevelByXp,
|
|
5
|
+
decode,
|
|
6
|
+
getSkills,
|
|
7
|
+
getBestiaryLevel,
|
|
8
|
+
getSlayer,
|
|
9
|
+
getDungeons,
|
|
10
|
+
getJacobData,
|
|
11
|
+
getChocolateFactory,
|
|
12
|
+
getPetLevel
|
|
7
13
|
} = require('../../utils/SkyblockUtils');
|
|
8
14
|
const SkyblockInventoryItem = require('./SkyblockInventoryItem');
|
|
15
|
+
const SkyblockMuseum = require('./SkyblockMuseum');
|
|
16
|
+
const SkyblockGarden = require('./SkyblockGarden');
|
|
9
17
|
const Constants = require('../../utils/Constants');
|
|
10
18
|
const skyhelper = require('skyhelper-networth');
|
|
11
19
|
const SkyblockPet = require('./SkyblockPet');
|
|
20
|
+
const Player = require('../Player');
|
|
21
|
+
|
|
12
22
|
/**
|
|
13
23
|
* Skyblock member class
|
|
14
24
|
*/
|
|
@@ -30,9 +40,14 @@ class SkyblockMember {
|
|
|
30
40
|
this.player = data.m.player || null;
|
|
31
41
|
/**
|
|
32
42
|
* If `getMuseum` option is `true`.
|
|
33
|
-
* @type {
|
|
43
|
+
* @type {SkyblockMuseum|null}
|
|
44
|
+
*/
|
|
45
|
+
this.museum = data.museum || null;
|
|
46
|
+
/**
|
|
47
|
+
* If `getGarden` option is `true`.
|
|
48
|
+
* @type {SkyblockGarden|null}
|
|
34
49
|
*/
|
|
35
|
-
this.
|
|
50
|
+
this.garden = data.garden || null;
|
|
36
51
|
/**
|
|
37
52
|
* Profile's gamemode
|
|
38
53
|
* @type {string|null}
|
|
@@ -72,17 +87,17 @@ class SkyblockMember {
|
|
|
72
87
|
* Skyblock Level
|
|
73
88
|
* @type {number}
|
|
74
89
|
*/
|
|
75
|
-
this.level = this.experience / 100
|
|
90
|
+
this.level = this.experience ? this.experience / 100 : 0;
|
|
76
91
|
/**
|
|
77
92
|
* Heart of the Mountain - MiningSkill
|
|
78
93
|
* @type {number}
|
|
79
94
|
*/
|
|
80
|
-
this.hotm = getLevelByXp(data.m.mining_core?.experience, 'hotm'
|
|
95
|
+
this.hotm = getLevelByXp(data.m.mining_core?.experience, 'hotm');
|
|
81
96
|
/**
|
|
82
97
|
* Trophy fish amount of rewards
|
|
83
98
|
* @type {number}
|
|
84
99
|
*/
|
|
85
|
-
this.trophyFish = getTrophyFishRank(data.m.trophy_fish?.rewards
|
|
100
|
+
this.trophyFish = getTrophyFishRank(data.m.trophy_fish?.rewards?.length ?? 0);
|
|
86
101
|
/**
|
|
87
102
|
* The highest magical power **Not current one**
|
|
88
103
|
* @type {number}
|
|
@@ -142,7 +157,12 @@ class SkyblockMember {
|
|
|
142
157
|
* Skyblock jacob data
|
|
143
158
|
* @type {jacobData}
|
|
144
159
|
*/
|
|
145
|
-
this.jacob = getJacobData(data);
|
|
160
|
+
this.jacob = getJacobData(data.m);
|
|
161
|
+
/**
|
|
162
|
+
* Skyblock Chocolate Factory
|
|
163
|
+
* @type {chocolateFactoryData}
|
|
164
|
+
*/
|
|
165
|
+
this.chocolate = getChocolateFactory(data.m);
|
|
146
166
|
/**
|
|
147
167
|
* Equipped armor
|
|
148
168
|
* @return {Promise<SkyblockMemberArmor>}
|
|
@@ -160,14 +180,14 @@ class SkyblockMember {
|
|
|
160
180
|
};
|
|
161
181
|
/**
|
|
162
182
|
* Wardrobe contents
|
|
163
|
-
* @return {Promise<
|
|
183
|
+
* @return {Promise<SkyblockInventoryItem[]>}
|
|
164
184
|
*/
|
|
165
185
|
this.getWardrobe = async () => {
|
|
166
186
|
const base64 = data.m?.inventory?.wardrobe_contents?.data;
|
|
167
187
|
if (!base64) return [];
|
|
168
188
|
const decoded = await decode(base64);
|
|
169
189
|
const armor = decoded
|
|
170
|
-
.filter((item) => Object.keys(item).length
|
|
190
|
+
.filter((item) => 0 !== Object.keys(item).length)
|
|
171
191
|
.map((item) => new SkyblockInventoryItem(item));
|
|
172
192
|
return armor;
|
|
173
193
|
};
|
|
@@ -189,7 +209,7 @@ class SkyblockMember {
|
|
|
189
209
|
edited.push(new SkyblockInventoryItem(chest[i]));
|
|
190
210
|
}
|
|
191
211
|
return edited;
|
|
192
|
-
} catch
|
|
212
|
+
} catch {
|
|
193
213
|
return [];
|
|
194
214
|
}
|
|
195
215
|
};
|
|
@@ -211,7 +231,7 @@ class SkyblockMember {
|
|
|
211
231
|
edited.push(new SkyblockInventoryItem(inventory[i]));
|
|
212
232
|
}
|
|
213
233
|
return edited;
|
|
214
|
-
} catch
|
|
234
|
+
} catch {
|
|
215
235
|
return [];
|
|
216
236
|
}
|
|
217
237
|
};
|
|
@@ -222,14 +242,14 @@ class SkyblockMember {
|
|
|
222
242
|
this.getPetScore = () => {
|
|
223
243
|
const highestRarity = {};
|
|
224
244
|
for (const pet of data.m.pets_data.pets) {
|
|
225
|
-
if (!(pet.type in highestRarity) || Constants.
|
|
226
|
-
highestRarity[pet.type] = Constants.
|
|
245
|
+
if (!(pet.type in highestRarity) || Constants.petScore[pet.tier] > highestRarity[pet.type]) {
|
|
246
|
+
highestRarity[pet.type] = Constants.petScore[pet.tier];
|
|
227
247
|
}
|
|
228
248
|
}
|
|
229
249
|
|
|
230
250
|
const highestLevel = {};
|
|
231
251
|
for (const pet of data.m.pets_data.pets) {
|
|
232
|
-
const maxLevel = pet.type
|
|
252
|
+
const maxLevel = 'GOLDEN_DRAGON' === pet.type ? 200 : 100;
|
|
233
253
|
const petLevel = getPetLevel(pet.exp, pet.tier, maxLevel);
|
|
234
254
|
|
|
235
255
|
if (!(pet.type in highestLevel) || petLevel.level > highestLevel[pet.type]) {
|
|
@@ -262,7 +282,7 @@ class SkyblockMember {
|
|
|
262
282
|
necklace: equipment[0].id ? new SkyblockInventoryItem(equipment[0]) : null
|
|
263
283
|
};
|
|
264
284
|
return playerEquipment;
|
|
265
|
-
} catch
|
|
285
|
+
} catch {
|
|
266
286
|
return [];
|
|
267
287
|
}
|
|
268
288
|
};
|
|
@@ -284,7 +304,7 @@ class SkyblockMember {
|
|
|
284
304
|
edited.push(new SkyblockInventoryItem(vault[i]));
|
|
285
305
|
}
|
|
286
306
|
return edited;
|
|
287
|
-
} catch
|
|
307
|
+
} catch {
|
|
288
308
|
return [];
|
|
289
309
|
}
|
|
290
310
|
};
|
|
@@ -294,14 +314,14 @@ class SkyblockMember {
|
|
|
294
314
|
*/
|
|
295
315
|
this.getNetworth = async () => {
|
|
296
316
|
try {
|
|
297
|
-
const nw = await skyhelper.getNetworth(data.m, data.banking
|
|
317
|
+
const nw = await skyhelper.getNetworth(data.m, data.banking?.balance ?? 0, {
|
|
298
318
|
onlyNetworth: true,
|
|
299
319
|
v2Endpoint: true,
|
|
300
320
|
cache: true,
|
|
301
321
|
museumData: data.museum?.raw ?? {}
|
|
302
322
|
});
|
|
303
323
|
return nw;
|
|
304
|
-
} catch
|
|
324
|
+
} catch {
|
|
305
325
|
return [];
|
|
306
326
|
}
|
|
307
327
|
};
|
|
@@ -314,209 +334,6 @@ class SkyblockMember {
|
|
|
314
334
|
return this.uuid;
|
|
315
335
|
}
|
|
316
336
|
}
|
|
317
|
-
// eslint-disable-next-line require-jsdoc
|
|
318
|
-
function getSkills(data) {
|
|
319
|
-
const skillsObject = {};
|
|
320
|
-
skillsObject['combat'] = getLevelByXp(data?.player_data?.experience?.SKILL_COMBAT ?? 0, 'combat');
|
|
321
|
-
skillsObject['farming'] = getLevelByXp(
|
|
322
|
-
data?.player_data?.experience?.SKILL_FARMING ?? 0,
|
|
323
|
-
'farming',
|
|
324
|
-
data?.m?.jacobs_contest?.perks?.farming_level_cap ?? 0 + 50
|
|
325
|
-
);
|
|
326
|
-
skillsObject['fishing'] = getLevelByXp(data?.player_data?.experience?.SKILL_FISHING ?? 0, 'fishing');
|
|
327
|
-
skillsObject['mining'] = getLevelByXp(data?.player_data?.experience?.SKILL_MINING ?? 0, 'mining');
|
|
328
|
-
skillsObject['foraging'] = getLevelByXp(data?.player_data?.experience?.SKILL_FORAGING ?? 0, 'foraging');
|
|
329
|
-
skillsObject['enchanting'] = getLevelByXp(data?.player_data?.experience?.SKILL_ENCHANTING ?? 0, 'enchanting');
|
|
330
|
-
skillsObject['alchemy'] = getLevelByXp(data?.player_data?.experience?.SKILL_ALCHEMY ?? 0, 'alchemy');
|
|
331
|
-
skillsObject['carpentry'] = getLevelByXp(data?.player_data?.experience?.SKILL_CARPENTRY ?? 0, 'carpentry');
|
|
332
|
-
skillsObject['runecrafting'] = getLevelByXp(data?.player_data?.experience?.SKILL_RUNECRAFTING ?? 0, 'runecrafting');
|
|
333
|
-
skillsObject['taming'] = getLevelByXp(data?.player_data?.experience?.SKILL_TAMING ?? 0, 'taming');
|
|
334
|
-
skillsObject['social'] = getLevelByXp(data?.player_data?.experience?.SKILL_SOCIAL ?? 0, 'social');
|
|
335
|
-
const levels = Object.values(skillsObject)
|
|
336
|
-
.filter((skill) => skill.cosmetic !== true)
|
|
337
|
-
.map((skill) => skill.level);
|
|
338
|
-
skillsObject['average'] = levels.reduce((a, b) => a + b, 0) / levels.length;
|
|
339
|
-
return skillsObject;
|
|
340
|
-
}
|
|
341
|
-
// eslint-disable-next-line require-jsdoc
|
|
342
|
-
function formatBestiaryMobs(userProfile, mobs) {
|
|
343
|
-
const output = [];
|
|
344
|
-
for (const mob of mobs) {
|
|
345
|
-
const mobBracket = Constants.bestiaryBrackets[mob.bracket];
|
|
346
|
-
|
|
347
|
-
const totalKills = mob.mobs.reduce((acc, cur) => {
|
|
348
|
-
return acc + (userProfile.bestiary.kills[cur] ?? 0);
|
|
349
|
-
}, 0);
|
|
350
|
-
|
|
351
|
-
const maxKills = mob.cap;
|
|
352
|
-
const nextTierKills = mobBracket.find((tier) => totalKills < tier && tier <= maxKills);
|
|
353
|
-
const tier = nextTierKills ? mobBracket.indexOf(nextTierKills) : mobBracket.indexOf(maxKills) + 1;
|
|
354
|
-
|
|
355
|
-
output.push({
|
|
356
|
-
tier: tier
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return output;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// eslint-disable-next-line require-jsdoc
|
|
364
|
-
function getBestiaryLevel(userProfile) {
|
|
365
|
-
try {
|
|
366
|
-
if (userProfile.bestiary?.kills === undefined) {
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const output = {};
|
|
371
|
-
let tiersUnlocked = 0;
|
|
372
|
-
for (const [category, data] of Object.entries(Constants.bestiary)) {
|
|
373
|
-
const { mobs } = data;
|
|
374
|
-
output[category] = {};
|
|
375
|
-
|
|
376
|
-
if (category === 'fishing') {
|
|
377
|
-
for (const [key, value] of Object.entries(data)) {
|
|
378
|
-
output[category][key] = {
|
|
379
|
-
mobs: formatBestiaryMobs(userProfile, value.mobs)
|
|
380
|
-
};
|
|
381
|
-
tiersUnlocked += output[category][key].mobs.reduce((acc, cur) => acc + cur.tier, 0);
|
|
382
|
-
}
|
|
383
|
-
} else {
|
|
384
|
-
output[category].mobs = formatBestiaryMobs(userProfile, mobs);
|
|
385
|
-
tiersUnlocked += output[category].mobs.reduce((acc, cur) => acc + cur.tier, 0);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
return tiersUnlocked / 10;
|
|
390
|
-
} catch (error) {
|
|
391
|
-
// eslint-disable-next-line no-console
|
|
392
|
-
console.log(error);
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// eslint-disable-next-line require-jsdoc
|
|
398
|
-
function getSlayer(data) {
|
|
399
|
-
if (!data?.slayer?.slayer_bosses) return;
|
|
400
|
-
return {
|
|
401
|
-
zombie: getSlayerLevel(data?.slayer?.slayer_bosses?.zombie),
|
|
402
|
-
spider: getSlayerLevel(data?.slayer?.slayer_bosses?.spider),
|
|
403
|
-
wolf: getSlayerLevel(data?.slayer?.slayer_bosses?.wolf),
|
|
404
|
-
enderman: getSlayerLevel(data?.slayer?.slayer_bosses?.enderman),
|
|
405
|
-
blaze: getSlayerLevel(data?.slayer?.slayer_bosses?.blaze),
|
|
406
|
-
vampire: getSlayerLevel(data?.slayer?.slayer_bosses?.vampire)
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
// eslint-disable-next-line require-jsdoc
|
|
410
|
-
function getDungeons(data) {
|
|
411
|
-
return {
|
|
412
|
-
types: {
|
|
413
|
-
catacombs: getLevelByXp(
|
|
414
|
-
data.dungeons?.dungeon_types?.catacombs ? data.dungeons.dungeon_types.catacombs.experience : null,
|
|
415
|
-
'dungeons'
|
|
416
|
-
)
|
|
417
|
-
},
|
|
418
|
-
classes: {
|
|
419
|
-
healer: getLevelByXp(
|
|
420
|
-
data.dungeons?.player_classes?.healer ? data.dungeons.player_classes.healer.experience : null,
|
|
421
|
-
'dungeons'
|
|
422
|
-
),
|
|
423
|
-
mage: getLevelByXp(
|
|
424
|
-
data.dungeons?.player_classes?.mage ? data.dungeons.player_classes.mage.experience : null,
|
|
425
|
-
'dungeons'
|
|
426
|
-
),
|
|
427
|
-
berserk: getLevelByXp(
|
|
428
|
-
data.dungeons?.player_classes?.berserk ? data.dungeons.player_classes.berserk.experience : null,
|
|
429
|
-
'dungeons'
|
|
430
|
-
),
|
|
431
|
-
archer: getLevelByXp(
|
|
432
|
-
data.dungeons?.player_classes?.archer ? data.dungeons.player_classes.archer.experience : null,
|
|
433
|
-
'dungeons'
|
|
434
|
-
),
|
|
435
|
-
tank: getLevelByXp(
|
|
436
|
-
data.dungeons?.player_classes?.tank ? data.dungeons.player_classes.tank.experience : null,
|
|
437
|
-
'dungeons'
|
|
438
|
-
)
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
// eslint-disable-next-line require-jsdoc
|
|
443
|
-
function getJacobData(data) {
|
|
444
|
-
if (!data.m.jacobs_contest) {
|
|
445
|
-
return {
|
|
446
|
-
medals: {
|
|
447
|
-
bronze: 0,
|
|
448
|
-
silver: 0,
|
|
449
|
-
gold: 0
|
|
450
|
-
},
|
|
451
|
-
perks: {
|
|
452
|
-
doubleDrops: 0,
|
|
453
|
-
farmingLevelCap: 0,
|
|
454
|
-
personalBests: false
|
|
455
|
-
},
|
|
456
|
-
contests: {}
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
return {
|
|
460
|
-
medals: data.m.jacobs_contest.medals_inv
|
|
461
|
-
? {
|
|
462
|
-
bronze: data.m.jacobs_contest.medals_inv.bronze || 0,
|
|
463
|
-
silver: data.m.jacobs_contest.medals_inv.silver || 0,
|
|
464
|
-
gold: data.m.jacobs_contest.medals_inv.gold || 0
|
|
465
|
-
}
|
|
466
|
-
: { bronze: 0, silver: 0, gold: 0 },
|
|
467
|
-
perks: data.m.jacobs_contest.perks
|
|
468
|
-
? {
|
|
469
|
-
doubleDrops: data.m.jacobs_contest.perks.double_drops || 0,
|
|
470
|
-
farmingLevelCap: data.m.jacobs_contest.perks.farming_level_cap || 0,
|
|
471
|
-
personalBests: data.m.jacobs_contest.perks.personal_bests || false
|
|
472
|
-
}
|
|
473
|
-
: { doubleDrops: 0, farmingLevelCap: 0, personalBests: false },
|
|
474
|
-
contests: data.m.jacobs_contest.contests || {}
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
// eslint-disable-next-line require-jsdoc
|
|
478
|
-
function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
479
|
-
const rarityOffset = Constants.pet_rarity_offset[offsetRarity];
|
|
480
|
-
const levels = Constants.pet_levels.slice(rarityOffset, rarityOffset + maxLevel - 1);
|
|
481
|
-
|
|
482
|
-
const xpMaxLevel = levels.reduce((a, b) => a + b, 0);
|
|
483
|
-
let xpTotal = 0;
|
|
484
|
-
let level = 1;
|
|
485
|
-
|
|
486
|
-
let xpForNext = Infinity;
|
|
487
|
-
|
|
488
|
-
for (let i = 0; i < maxLevel; i++) {
|
|
489
|
-
xpTotal += levels[i];
|
|
490
|
-
|
|
491
|
-
if (xpTotal > petExp) {
|
|
492
|
-
xpTotal -= levels[i];
|
|
493
|
-
break;
|
|
494
|
-
} else {
|
|
495
|
-
level++;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
let xpCurrent = Math.floor(petExp - xpTotal);
|
|
500
|
-
let progress;
|
|
501
|
-
|
|
502
|
-
if (level < maxLevel) {
|
|
503
|
-
xpForNext = Math.ceil(levels[level - 1]);
|
|
504
|
-
progress = Math.max(0, Math.min(xpCurrent / xpForNext, 1));
|
|
505
|
-
} else {
|
|
506
|
-
level = maxLevel;
|
|
507
|
-
xpCurrent = petExp - levels[maxLevel - 1];
|
|
508
|
-
xpForNext = 0;
|
|
509
|
-
progress = 1;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return {
|
|
513
|
-
level,
|
|
514
|
-
xpCurrent,
|
|
515
|
-
xpForNext,
|
|
516
|
-
progress,
|
|
517
|
-
xpMaxLevel
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
337
|
/**
|
|
521
338
|
* @typedef {object} SkyblockMemberEquipment
|
|
522
339
|
* @property {SkyblockInventoryItem|null} gauntlet Gauntlet
|
|
@@ -916,13 +733,58 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
916
733
|
* @property {number} farmingLevelCap Farming level cap
|
|
917
734
|
* @property {boolean} personalBests Personal Bests
|
|
918
735
|
*/
|
|
736
|
+
/**
|
|
737
|
+
* @typedef {object} jacobDataMedals
|
|
738
|
+
* @property {number} gold gold medals
|
|
739
|
+
* @property {number} silver silver medals
|
|
740
|
+
* @property {number} bronze bronze medals
|
|
741
|
+
*/
|
|
919
742
|
/**
|
|
920
743
|
* @typedef {object} jacobData
|
|
921
|
-
* @property {
|
|
922
|
-
* @property {number} medals.bronze Bronze medals
|
|
923
|
-
* @property {number} medals.silver Silver medals
|
|
924
|
-
* @property {number} medals.gold Gold medals
|
|
744
|
+
* @property {jacobDataMedals} medals Medals
|
|
925
745
|
* @property {jacobDataPerks} perks Perks
|
|
926
746
|
* @property {object} contests Contests
|
|
927
747
|
*/
|
|
748
|
+
/**
|
|
749
|
+
* @typedef {object} chocolateFactoryDataEmployees
|
|
750
|
+
* @property {number} bro bro employee level
|
|
751
|
+
* @property {number} cousin cousin employee level
|
|
752
|
+
* @property {number} sis sis employee level
|
|
753
|
+
* @property {number} father father employee level
|
|
754
|
+
* @property {number} grandma grandma employee level
|
|
755
|
+
* @property {number} dog dog employee level
|
|
756
|
+
* @property {number} uncle uncle employee level
|
|
757
|
+
*/
|
|
758
|
+
/**
|
|
759
|
+
* @typedef {object} chocolateFactoryDataChocolate
|
|
760
|
+
* @property {number} count amount of current chocolate
|
|
761
|
+
* @property {number} total total amount of chocolate
|
|
762
|
+
* @property {number} sincePrestige amount of chocolate since prestige
|
|
763
|
+
*/
|
|
764
|
+
/**
|
|
765
|
+
* @typedef {object} chocolateFactoryDataTimeTower
|
|
766
|
+
* @property {number} charge amount of charges in the time tower
|
|
767
|
+
* @property {number} level level of the time tower
|
|
768
|
+
*/
|
|
769
|
+
/**
|
|
770
|
+
* @typedef {object} chocolateFactoryDataUpgrades
|
|
771
|
+
* @property {number} click amount of click upgrades
|
|
772
|
+
* @property {number} multiplier amount of multiplier upgrades
|
|
773
|
+
* @property {number} rabbitRarity amount of rabbit rarity upgrades
|
|
774
|
+
*/
|
|
775
|
+
/**
|
|
776
|
+
* @typedef {object} chocolateFactoryDataGoldenClick
|
|
777
|
+
* @property {number} amount amount of golden clicks
|
|
778
|
+
* @property {number} year year
|
|
779
|
+
*/
|
|
780
|
+
/**
|
|
781
|
+
* @typedef {object} chocolateFactoryData
|
|
782
|
+
* @property {chocolateFactoryDataEmployees} employees Employees
|
|
783
|
+
* @property {chocolateFactoryDataChocolate} chocolate Chocolate
|
|
784
|
+
* @property {chocolateFactoryDataTimeTower} timeTower Time Tower
|
|
785
|
+
* @property {chocolateFactoryDataUpgrades} upgrades Upgrades
|
|
786
|
+
* @property {chocolateFactoryDataGoldenClick} goldenClick Golden Click
|
|
787
|
+
* @property {number} barnCapacity Barn Capacity
|
|
788
|
+
* @property {number} prestige Prestige
|
|
789
|
+
*/
|
|
928
790
|
module.exports = SkyblockMember;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const { pet_score } = require('../../utils/Constants');
|
|
1
|
+
const { petScore } = require('../../utils/Constants');
|
|
3
2
|
/**
|
|
4
3
|
* Skyblock Pet class
|
|
5
4
|
*/
|
|
@@ -38,8 +37,8 @@ class SkyblockPet {
|
|
|
38
37
|
* Skyblock Pet score
|
|
39
38
|
* @type {number}
|
|
40
39
|
*/
|
|
41
|
-
|
|
42
|
-
this.petScore =
|
|
40
|
+
|
|
41
|
+
this.petScore = petScore[data.tier] || 0;
|
|
43
42
|
/**
|
|
44
43
|
* Skyblock Pet held item
|
|
45
44
|
* @type {string|null}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
2
|
+
function parsePosition(position) {
|
|
3
|
+
const x = (position % 5) + 1;
|
|
4
|
+
const y = Math.floor(position / 5) + 1;
|
|
5
|
+
return [x, y];
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* Bingo class
|
|
3
9
|
*/
|
|
@@ -50,7 +56,7 @@ class Bingo {
|
|
|
50
56
|
* Difference between each tier requirement, if it is constant
|
|
51
57
|
* @type {number|null}
|
|
52
58
|
*/
|
|
53
|
-
this.tierStep = this
|
|
59
|
+
this.tierStep = this.getTierStep();
|
|
54
60
|
/**
|
|
55
61
|
* Only available for ONE_TIERED bingos
|
|
56
62
|
* @type {number|null}
|
|
@@ -78,10 +84,10 @@ class Bingo {
|
|
|
78
84
|
* @private
|
|
79
85
|
* @returns {number|null}
|
|
80
86
|
*/
|
|
81
|
-
|
|
82
|
-
if (this.type
|
|
87
|
+
getTierStep() {
|
|
88
|
+
if ('TIERED' !== this.type) return null;
|
|
83
89
|
// No step possible
|
|
84
|
-
if (this.tiers.length
|
|
90
|
+
if (2 > this.tiers.length) return null;
|
|
85
91
|
const hypotheticStep = this.tiers[1] - this.tiers[0];
|
|
86
92
|
// Check if every 2 elements have the same step
|
|
87
93
|
const isConstant = this.tiers.slice(1).every((el, index) => {
|
|
@@ -92,11 +98,4 @@ class Bingo {
|
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
100
|
|
|
95
|
-
// eslint-disable-next-line require-jsdoc
|
|
96
|
-
function parsePosition(position) {
|
|
97
|
-
const x = (position % 5) + 1;
|
|
98
|
-
const y = Math.floor(position / 5) + 1;
|
|
99
|
-
return [x, y];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
101
|
module.exports = Bingo;
|
|
@@ -37,7 +37,7 @@ class BingoData {
|
|
|
37
37
|
* @returns {Bingo|undefined}
|
|
38
38
|
*/
|
|
39
39
|
getGoal(column, row) {
|
|
40
|
-
if (!this.goals || this.goals.length
|
|
40
|
+
if (!this.goals || 1 > this.goals.length) return;
|
|
41
41
|
return this.goals.find((goal) => goal.row === row && goal.column === column);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
const AchievementTier = require('./AchievementTier');
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
4
|
+
function collectAll(data) {
|
|
5
|
+
const mTier = data.maxTier;
|
|
6
|
+
let totalPoints = 0;
|
|
7
|
+
let totalAmount = 0;
|
|
8
|
+
for (let i = 1; i <= mTier; i++) {
|
|
9
|
+
totalPoints += data.getTier(i).pointsRewarded;
|
|
10
|
+
totalAmount += data.getTier(i).amountRequired;
|
|
11
|
+
}
|
|
12
|
+
return { totalPoints, totalAmount };
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
/**
|
|
4
16
|
* Achievement Class
|
|
5
17
|
*/
|
|
@@ -48,20 +60,20 @@ class Achievement {
|
|
|
48
60
|
* ONLY AVAILABLE FOR TIERED
|
|
49
61
|
* @type {AchievementTier|null}
|
|
50
62
|
*/
|
|
51
|
-
this.tierInformation = this.type
|
|
63
|
+
this.tierInformation = 'TIERED' === this.type ? new AchievementTier(data.tiers) : null;
|
|
52
64
|
|
|
53
|
-
const { totalPoints, totalAmount } = this.type
|
|
65
|
+
const { totalPoints, totalAmount } = 'TIERED' === this.type ? collectAll(this.tierInformation) : {};
|
|
54
66
|
/**
|
|
55
67
|
* Total points worth (sum of all tiers if tiered)
|
|
56
68
|
* This is always 0 for Guild Achievements
|
|
57
69
|
* @type {number}
|
|
58
70
|
*/
|
|
59
|
-
this.points = this.type
|
|
71
|
+
this.points = 'ONE_TIME' === this.type ? parseInt(data.points, 10) : totalPoints;
|
|
60
72
|
/**
|
|
61
73
|
* Total amount required to reach max tier, only for tiered
|
|
62
74
|
* @type {number|null}
|
|
63
75
|
*/
|
|
64
|
-
this.totalAmountRequired = this.type
|
|
76
|
+
this.totalAmountRequired = 'TIERED' === this.type ? totalAmount : null;
|
|
65
77
|
}
|
|
66
78
|
/**
|
|
67
79
|
* As string
|
|
@@ -72,15 +84,4 @@ class Achievement {
|
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
|
|
75
|
-
// eslint-disable-next-line require-jsdoc
|
|
76
|
-
function collectAll(data) {
|
|
77
|
-
const mTier = data.maxTier;
|
|
78
|
-
let totalPoints = 0;
|
|
79
|
-
let totalAmount = 0;
|
|
80
|
-
for (let i = 1; i <= mTier; i++) {
|
|
81
|
-
totalPoints += data.getTier(i).pointsRewarded;
|
|
82
|
-
totalAmount += data.getTier(i).amountRequired;
|
|
83
|
-
}
|
|
84
|
-
return { totalPoints, totalAmount };
|
|
85
|
-
}
|
|
86
87
|
module.exports = Achievement;
|
|
@@ -13,7 +13,7 @@ class AchievementTier {
|
|
|
13
13
|
*/
|
|
14
14
|
this.maxTier = data.length;
|
|
15
15
|
// Still make sure it is well sorted
|
|
16
|
-
this.
|
|
16
|
+
this.tierInfo = data.sort(({ tier: tierA }, { tier: tierB }) => Number(tierA) - Number(tierB));
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Gets information for tier
|
|
@@ -22,7 +22,7 @@ class AchievementTier {
|
|
|
22
22
|
*/
|
|
23
23
|
getTier(tier) {
|
|
24
24
|
const index = tier - 1;
|
|
25
|
-
const info = this.
|
|
25
|
+
const info = this.tierInfo[index];
|
|
26
26
|
return {
|
|
27
27
|
pointsRewarded: parseInt(info.points, 10) || 0,
|
|
28
28
|
amountRequired: parseInt(info.amount, 10) || 0
|
|
@@ -26,14 +26,14 @@ class Quest {
|
|
|
26
26
|
* Type of quest
|
|
27
27
|
* @type {'DAILY'|'WEEKLY'}
|
|
28
28
|
*/
|
|
29
|
-
this.type = data.requirements?.[0].type
|
|
29
|
+
this.type = 'DailyResetQuestRequirement' === data.requirements?.[0].type ? 'DAILY' : 'WEEKLY';
|
|
30
30
|
/**
|
|
31
31
|
* Objectives
|
|
32
32
|
* @type {Objective[]}
|
|
33
33
|
*/
|
|
34
34
|
this.objectives = data.objectives.map((objective) => ({
|
|
35
35
|
id: objective.id,
|
|
36
|
-
type: objective.type
|
|
36
|
+
type: 'IntegerObjective' === objective.type ? 'Integer' : 'Boolean',
|
|
37
37
|
amountNeeded: parseInt(objective.integer || '1', 10)
|
|
38
38
|
}));
|
|
39
39
|
/**
|