hypixel-api-reborn 11.2.0 → 11.2.1
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 +11 -17
- 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/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/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +1 -0
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +1 -0
- package/src/Client.js +42 -14
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +11 -12
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- 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/MiniGames/Arcade.js +242 -240
- package/src/structures/MiniGames/ArenaBrawl.js +11 -11
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +24 -23
- package/src/structures/MiniGames/CopsAndCrims.js +1 -0
- package/src/structures/MiniGames/Duels.js +9 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/SkyWars.js +197 -186
- package/src/structures/MiniGames/SmashHeroes.js +36 -34
- package/src/structures/MiniGames/SpeedUHC.js +17 -4
- package/src/structures/MiniGames/UHC.js +26 -25
- package/src/structures/MiniGames/WoolWars.js +6 -5
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +13 -104
- 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/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +78 -223
- 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 +17 -517
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +449 -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 +272 -162
- package/src/utils/toIGN.js +0 -24
|
@@ -1,14 +1,22 @@
|
|
|
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');
|
|
9
15
|
const Constants = require('../../utils/Constants');
|
|
10
16
|
const skyhelper = require('skyhelper-networth');
|
|
11
17
|
const SkyblockPet = require('./SkyblockPet');
|
|
18
|
+
const Player = require('../Player');
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* Skyblock member class
|
|
14
22
|
*/
|
|
@@ -72,7 +80,7 @@ class SkyblockMember {
|
|
|
72
80
|
* Skyblock Level
|
|
73
81
|
* @type {number}
|
|
74
82
|
*/
|
|
75
|
-
this.level = this.experience / 100
|
|
83
|
+
this.level = this.experience ? this.experience / 100 : 0;
|
|
76
84
|
/**
|
|
77
85
|
* Heart of the Mountain - MiningSkill
|
|
78
86
|
* @type {number}
|
|
@@ -142,7 +150,12 @@ class SkyblockMember {
|
|
|
142
150
|
* Skyblock jacob data
|
|
143
151
|
* @type {jacobData}
|
|
144
152
|
*/
|
|
145
|
-
this.jacob = getJacobData(data);
|
|
153
|
+
this.jacob = getJacobData(data.m);
|
|
154
|
+
/**
|
|
155
|
+
* Skyblock Chocolate Factory
|
|
156
|
+
* @type {chocolateFactoryData}
|
|
157
|
+
*/
|
|
158
|
+
this.chocolate = getChocolateFactory(data.m);
|
|
146
159
|
/**
|
|
147
160
|
* Equipped armor
|
|
148
161
|
* @return {Promise<SkyblockMemberArmor>}
|
|
@@ -160,14 +173,14 @@ class SkyblockMember {
|
|
|
160
173
|
};
|
|
161
174
|
/**
|
|
162
175
|
* Wardrobe contents
|
|
163
|
-
* @return {Promise<
|
|
176
|
+
* @return {Promise<SkyblockInventoryItem[]>}
|
|
164
177
|
*/
|
|
165
178
|
this.getWardrobe = async () => {
|
|
166
179
|
const base64 = data.m?.inventory?.wardrobe_contents?.data;
|
|
167
180
|
if (!base64) return [];
|
|
168
181
|
const decoded = await decode(base64);
|
|
169
182
|
const armor = decoded
|
|
170
|
-
.filter((item) => Object.keys(item).length
|
|
183
|
+
.filter((item) => 0 !== Object.keys(item).length)
|
|
171
184
|
.map((item) => new SkyblockInventoryItem(item));
|
|
172
185
|
return armor;
|
|
173
186
|
};
|
|
@@ -189,7 +202,7 @@ class SkyblockMember {
|
|
|
189
202
|
edited.push(new SkyblockInventoryItem(chest[i]));
|
|
190
203
|
}
|
|
191
204
|
return edited;
|
|
192
|
-
} catch
|
|
205
|
+
} catch {
|
|
193
206
|
return [];
|
|
194
207
|
}
|
|
195
208
|
};
|
|
@@ -211,7 +224,7 @@ class SkyblockMember {
|
|
|
211
224
|
edited.push(new SkyblockInventoryItem(inventory[i]));
|
|
212
225
|
}
|
|
213
226
|
return edited;
|
|
214
|
-
} catch
|
|
227
|
+
} catch {
|
|
215
228
|
return [];
|
|
216
229
|
}
|
|
217
230
|
};
|
|
@@ -222,14 +235,14 @@ class SkyblockMember {
|
|
|
222
235
|
this.getPetScore = () => {
|
|
223
236
|
const highestRarity = {};
|
|
224
237
|
for (const pet of data.m.pets_data.pets) {
|
|
225
|
-
if (!(pet.type in highestRarity) || Constants.
|
|
226
|
-
highestRarity[pet.type] = Constants.
|
|
238
|
+
if (!(pet.type in highestRarity) || Constants.petScore[pet.tier] > highestRarity[pet.type]) {
|
|
239
|
+
highestRarity[pet.type] = Constants.petScore[pet.tier];
|
|
227
240
|
}
|
|
228
241
|
}
|
|
229
242
|
|
|
230
243
|
const highestLevel = {};
|
|
231
244
|
for (const pet of data.m.pets_data.pets) {
|
|
232
|
-
const maxLevel = pet.type
|
|
245
|
+
const maxLevel = 'GOLDEN_DRAGON' === pet.type ? 200 : 100;
|
|
233
246
|
const petLevel = getPetLevel(pet.exp, pet.tier, maxLevel);
|
|
234
247
|
|
|
235
248
|
if (!(pet.type in highestLevel) || petLevel.level > highestLevel[pet.type]) {
|
|
@@ -262,7 +275,7 @@ class SkyblockMember {
|
|
|
262
275
|
necklace: equipment[0].id ? new SkyblockInventoryItem(equipment[0]) : null
|
|
263
276
|
};
|
|
264
277
|
return playerEquipment;
|
|
265
|
-
} catch
|
|
278
|
+
} catch {
|
|
266
279
|
return [];
|
|
267
280
|
}
|
|
268
281
|
};
|
|
@@ -284,7 +297,7 @@ class SkyblockMember {
|
|
|
284
297
|
edited.push(new SkyblockInventoryItem(vault[i]));
|
|
285
298
|
}
|
|
286
299
|
return edited;
|
|
287
|
-
} catch
|
|
300
|
+
} catch {
|
|
288
301
|
return [];
|
|
289
302
|
}
|
|
290
303
|
};
|
|
@@ -301,7 +314,7 @@ class SkyblockMember {
|
|
|
301
314
|
museumData: data.museum?.raw ?? {}
|
|
302
315
|
});
|
|
303
316
|
return nw;
|
|
304
|
-
} catch
|
|
317
|
+
} catch {
|
|
305
318
|
return [];
|
|
306
319
|
}
|
|
307
320
|
};
|
|
@@ -314,209 +327,6 @@ class SkyblockMember {
|
|
|
314
327
|
return this.uuid;
|
|
315
328
|
}
|
|
316
329
|
}
|
|
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
330
|
/**
|
|
521
331
|
* @typedef {object} SkyblockMemberEquipment
|
|
522
332
|
* @property {SkyblockInventoryItem|null} gauntlet Gauntlet
|
|
@@ -916,13 +726,58 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
916
726
|
* @property {number} farmingLevelCap Farming level cap
|
|
917
727
|
* @property {boolean} personalBests Personal Bests
|
|
918
728
|
*/
|
|
729
|
+
/**
|
|
730
|
+
* @typedef {object} jacobDataMedals
|
|
731
|
+
* @property {number} gold gold medals
|
|
732
|
+
* @property {number} silver silver medals
|
|
733
|
+
* @property {number} bronze bronze medals
|
|
734
|
+
*/
|
|
919
735
|
/**
|
|
920
736
|
* @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
|
|
737
|
+
* @property {jacobDataMedals} medals Medals
|
|
925
738
|
* @property {jacobDataPerks} perks Perks
|
|
926
739
|
* @property {object} contests Contests
|
|
927
740
|
*/
|
|
741
|
+
/**
|
|
742
|
+
* @typedef {object} chocolateFactoryDataEmployees
|
|
743
|
+
* @property {number} bro bro employee level
|
|
744
|
+
* @property {number} cousin cousin employee level
|
|
745
|
+
* @property {number} sis sis employee level
|
|
746
|
+
* @property {number} father father employee level
|
|
747
|
+
* @property {number} grandma grandma employee level
|
|
748
|
+
* @property {number} dog dog employee level
|
|
749
|
+
* @property {number} uncle uncle employee level
|
|
750
|
+
*/
|
|
751
|
+
/**
|
|
752
|
+
* @typedef {object} chocolateFactoryDataChocolate
|
|
753
|
+
* @property {number} count amount of current chocolate
|
|
754
|
+
* @property {number} total total amount of chocolate
|
|
755
|
+
* @property {number} sincePrestige amount of chocolate since prestige
|
|
756
|
+
*/
|
|
757
|
+
/**
|
|
758
|
+
* @typedef {object} chocolateFactoryDataTimeTower
|
|
759
|
+
* @property {number} charge amount of charges in the time tower
|
|
760
|
+
* @property {number} level level of the time tower
|
|
761
|
+
*/
|
|
762
|
+
/**
|
|
763
|
+
* @typedef {object} chocolateFactoryDataUpgrades
|
|
764
|
+
* @property {number} click amount of click upgrades
|
|
765
|
+
* @property {number} multiplier amount of multiplier upgrades
|
|
766
|
+
* @property {number} rabbitRarity amount of rabbit rarity upgrades
|
|
767
|
+
*/
|
|
768
|
+
/**
|
|
769
|
+
* @typedef {object} chocolateFactoryDataGoldenClick
|
|
770
|
+
* @property {number} amount amount of golden clicks
|
|
771
|
+
* @property {number} year year
|
|
772
|
+
*/
|
|
773
|
+
/**
|
|
774
|
+
* @typedef {object} chocolateFactoryData
|
|
775
|
+
* @property {chocolateFactoryDataEmployees} employees Employees
|
|
776
|
+
* @property {chocolateFactoryDataChocolate} chocolate Chocolate
|
|
777
|
+
* @property {chocolateFactoryDataTimeTower} timeTower Time Tower
|
|
778
|
+
* @property {chocolateFactoryDataUpgrades} upgrades Upgrades
|
|
779
|
+
* @property {chocolateFactoryDataGoldenClick} goldenClick Golden Click
|
|
780
|
+
* @property {number} barnCapacity Barn Capacity
|
|
781
|
+
* @property {number} prestige Prestige
|
|
782
|
+
*/
|
|
928
783
|
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
|
/**
|