hypixel-api-reborn 11.3.2 → 11.3.4
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/package.json +11 -11
- package/src/API/skyblock/getAuctions.js +8 -5
- package/src/API/skyblock/getGarden.js +7 -3
- package/src/Client.js +1 -6
- package/src/structures/SkyBlock/SkyblockGarden.js +38 -38
- package/src/structures/SkyBlock/SkyblockMember.js +131 -330
- package/src/structures/SkyBlock/SkyblockProfile.js +7 -0
- package/src/structures/SkyBlock/Static/Candidate.js +12 -2
- package/src/structures/SkyBlock/Static/Government.js +5 -0
- package/src/structures/SkyBlock/Static/Perk.js +0 -1
- package/src/utils/Constants.js +257 -150
- package/src/utils/SkyblockUtils.js +195 -31
- package/typings/index.d.ts +155 -337
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable jsdoc/require-jsdoc */
|
|
2
|
+
const { parse, simplify } = require('prismarine-nbt');
|
|
2
3
|
const constants = require('./Constants');
|
|
3
4
|
|
|
4
5
|
async function decode(base64, isBuffer = false) {
|
|
5
|
-
|
|
6
|
-
const parseNbt = require('util').promisify(nbt.parse);
|
|
6
|
+
// Credit: https://github.com/SkyCryptWebsite/SkyCryptv2/blob/3b5b3ae4fe77c60eff90691797f09024baf68872/src/lib/server/stats/items/processing.ts#L215-L218
|
|
7
7
|
const buffer = isBuffer ? base64 : Buffer.from(base64, 'base64');
|
|
8
|
-
let data = await
|
|
9
|
-
data =
|
|
8
|
+
let data = await parse(buffer);
|
|
9
|
+
data = simplify(data.parsed);
|
|
10
10
|
const newdata = [];
|
|
11
11
|
for (let i = 0; i < data.i.length; i++) {
|
|
12
12
|
newdata.push(data.i[i]);
|
|
@@ -180,7 +180,7 @@ function getTrophyFishRank(level) {
|
|
|
180
180
|
} else if (4 === level) {
|
|
181
181
|
return 'Diamond';
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return null;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
function getSkills(data) {
|
|
@@ -273,35 +273,173 @@ function getSlayer(data) {
|
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
function getScore(points) {
|
|
277
|
+
if (1000 <= points) {
|
|
278
|
+
return 'S';
|
|
279
|
+
} else if (800 <= points) {
|
|
280
|
+
return 'A';
|
|
281
|
+
} else if (600 <= points) {
|
|
282
|
+
return 'B';
|
|
283
|
+
} else if (400 <= points) {
|
|
284
|
+
return 'C';
|
|
285
|
+
} else if (200 <= points) {
|
|
286
|
+
return 'D';
|
|
287
|
+
}
|
|
288
|
+
return 'F';
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function getBelt(points) {
|
|
292
|
+
if (7000 <= points) {
|
|
293
|
+
return 'Black';
|
|
294
|
+
} else if (6000 <= points) {
|
|
295
|
+
return 'Brown';
|
|
296
|
+
} else if (4000 <= points) {
|
|
297
|
+
return 'Blue';
|
|
298
|
+
} else if (2000 <= points) {
|
|
299
|
+
return 'Green';
|
|
300
|
+
} else if (1000 <= points) {
|
|
301
|
+
return 'Yellow';
|
|
302
|
+
}
|
|
303
|
+
return 'White';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function getCrimson(data) {
|
|
307
|
+
return {
|
|
308
|
+
faction: data?.nether_island_player_data?.selected_faction || null,
|
|
309
|
+
reputation: {
|
|
310
|
+
barbarians: data?.nether_island_player_data?.barbarians_reputation ?? 0,
|
|
311
|
+
mages: data?.nether_island_player_data?.mages_reputation ?? 0
|
|
312
|
+
},
|
|
313
|
+
trophyFish: {
|
|
314
|
+
rank: getTrophyFishRank((data?.trophy_fish?.rewards ?? [])?.length),
|
|
315
|
+
caught: {
|
|
316
|
+
total: data?.trophy_fish?.total_caught ?? 0,
|
|
317
|
+
bronze: Object.keys(data?.trophy_fish ?? {}).filter((key) => key.endsWith('_bronze'))?.length,
|
|
318
|
+
silver: Object.keys(data?.trophy_fish ?? {}).filter((key) => key.endsWith('_silver'))?.length,
|
|
319
|
+
gold: Object.keys(data?.trophy_fish ?? {}).filter((key) => key.endsWith('_gold'))?.length,
|
|
320
|
+
diamond: Object.keys(data?.trophy_fish ?? {}).filter((key) => key.endsWith('_diamond'))?.length
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
dojo: {
|
|
324
|
+
belt: getBelt(
|
|
325
|
+
Object.keys(data?.nether_island_player_data?.dojo ?? {})
|
|
326
|
+
.filter((key) => key?.startsWith('dojo_points'))
|
|
327
|
+
.reduce((acc, key) => acc + (data?.nether_island_player_data?.dojo[key] ?? 0), 0)
|
|
328
|
+
),
|
|
329
|
+
force: {
|
|
330
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_mob_kb ?? 0,
|
|
331
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_mob_kb ?? 0)
|
|
332
|
+
},
|
|
333
|
+
stamina: {
|
|
334
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_wall_jump ?? 0,
|
|
335
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_wall_jump ?? 0)
|
|
336
|
+
},
|
|
337
|
+
mastery: {
|
|
338
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_archer ?? 0,
|
|
339
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_archer ?? 0)
|
|
340
|
+
},
|
|
341
|
+
discipline: {
|
|
342
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_sword_swap ?? 0,
|
|
343
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_sword_swap ?? 0)
|
|
344
|
+
},
|
|
345
|
+
swiftness: {
|
|
346
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_snake ?? 0,
|
|
347
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_snake ?? 0)
|
|
348
|
+
},
|
|
349
|
+
control: {
|
|
350
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_lock_head ?? 0,
|
|
351
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_lock_head ?? 0)
|
|
352
|
+
},
|
|
353
|
+
tenacity: {
|
|
354
|
+
points: data?.nether_island_player_data?.dojo?.dojo_points_fireball ?? 0,
|
|
355
|
+
rank: getScore(data?.nether_island_player_data?.dojo?.dojo_points_fireball ?? 0)
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
kuudra: {
|
|
359
|
+
none: data?.nether_island_player_data?.kuudra_completed_tiers?.none ?? 0,
|
|
360
|
+
hot: data?.nether_island_player_data?.kuudra_completed_tiers?.hot ?? 0,
|
|
361
|
+
burning: data?.nether_island_player_data?.kuudra_completed_tiers?.burning ?? 0,
|
|
362
|
+
fiery: data?.nether_island_player_data?.kuudra_completed_tiers?.fiery ?? 0,
|
|
363
|
+
highestWaveHot: data?.nether_island_player_data?.kuudra_completed_tiers?.highest_wave_hot ?? 0,
|
|
364
|
+
highestWaveFiery: data?.nether_island_player_data?.kuudra_completed_tiers?.highest_wave_fiery ?? 0,
|
|
365
|
+
infernal: data?.nether_island_player_data?.kuudra_completed_tiers?.infernal ?? 0,
|
|
366
|
+
highestWaveInfernal: data?.nether_island_player_data?.kuudra_completed_tiers?.highest_wave_infernal ?? 0,
|
|
367
|
+
highestWaveBurning: data?.nether_island_player_data?.kuudra_completed_tiers?.highest_wave_burning ?? 0
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function getCompletions(data) {
|
|
373
|
+
const completions = {
|
|
374
|
+
total: 0
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
for (const tier in data) {
|
|
378
|
+
if ('total' === tier) continue;
|
|
379
|
+
completions[`Floor_${tier}`] = data[tier];
|
|
380
|
+
completions.total += data[tier];
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return completions;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function getDungeonsFloor(data, type, floor) {
|
|
387
|
+
return {
|
|
388
|
+
fastestRun: (data?.dungeons?.dungeon_types?.[type]?.best_runs?.[floor] ?? []).sort(
|
|
389
|
+
(a, b) => a?.elapsed_time - b?.elapsed_time
|
|
390
|
+
)[0],
|
|
391
|
+
fastestSRun: (data?.dungeons?.dungeon_types?.[type]?.best_runs?.[floor] ?? [])
|
|
392
|
+
.filter((run) => 270 >= run?.score_exploration + run?.score_speed + run?.score_skill + run?.score_bonus)
|
|
393
|
+
.sort((a, b) => a?.elapsed_time - b?.elapsed_time)[0],
|
|
394
|
+
fastestSPlusRun: (data?.dungeons?.dungeon_types?.[type]?.best_runs?.[floor] ?? [])
|
|
395
|
+
.filter((run) => 300 >= run?.score_exploration + run?.score_speed + run?.score_skill + run?.score_bonus)
|
|
396
|
+
.sort((a, b) => a?.elapsed_time - b?.elapsed_time)[0],
|
|
397
|
+
completions: data?.dungeonXp?.dungeon_types?.[type]?.tier_completions[floor] ?? 0
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
|
|
276
401
|
function getDungeons(data) {
|
|
277
402
|
return {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
)
|
|
403
|
+
experience: getLevelByXp(data?.dungeons?.dungeon_types?.catacombs?.experience ?? 0, 'dungeons'),
|
|
404
|
+
secrets: data?.dungeons?.secrets ?? 0,
|
|
405
|
+
completions: {
|
|
406
|
+
catacombs: getCompletions(data?.dungeons?.dungeon_types?.catacombs?.tier_completions),
|
|
407
|
+
masterCatacombs: getCompletions(data?.dungeons?.dungeon_types?.master_catacombs?.tier_completions)
|
|
408
|
+
},
|
|
409
|
+
floors: {
|
|
410
|
+
entrance: getDungeonsFloor(data, 'catacombs', '0'),
|
|
411
|
+
floor1: getDungeonsFloor(data, 'catacombs', '1'),
|
|
412
|
+
floor2: getDungeonsFloor(data, 'catacombs', '2'),
|
|
413
|
+
floor3: getDungeonsFloor(data, 'catacombs', '3'),
|
|
414
|
+
floor4: getDungeonsFloor(data, 'catacombs', '4'),
|
|
415
|
+
floor5: getDungeonsFloor(data, 'catacombs', '5'),
|
|
416
|
+
floor6: getDungeonsFloor(data, 'catacombs', '6'),
|
|
417
|
+
floor7: getDungeonsFloor(data, 'catacombs', '7'),
|
|
418
|
+
masterCatacombs1: getDungeonsFloor(data, 'master_catacombs', '1'),
|
|
419
|
+
masterCatacombs2: getDungeonsFloor(data, 'master_catacombs', '2'),
|
|
420
|
+
masterCatacombs3: getDungeonsFloor(data, 'master_catacombs', '3'),
|
|
421
|
+
masterCatacombs4: getDungeonsFloor(data, 'master_catacombs', '4'),
|
|
422
|
+
masterCatacombs5: getDungeonsFloor(data, 'master_catacombs', '5'),
|
|
423
|
+
masterCatacombs6: getDungeonsFloor(data, 'master_catacombs', '6'),
|
|
424
|
+
masterCatacombs7: getDungeonsFloor(data, 'master_catacombs', '7')
|
|
283
425
|
},
|
|
284
426
|
classes: {
|
|
285
|
-
healer: getLevelByXp(
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
tank: getLevelByXp(
|
|
302
|
-
data.dungeons?.player_classes?.tank ? data.dungeons.player_classes.tank.experience : null,
|
|
303
|
-
'dungeons'
|
|
304
|
-
)
|
|
427
|
+
healer: getLevelByXp(data?.dungeons?.player_classes?.healer?.experience ?? 0, 'dungeons'),
|
|
428
|
+
mage: getLevelByXp(data?.dungeons?.player_classes?.mage?.experience ?? 0, 'dungeons'),
|
|
429
|
+
berserk: getLevelByXp(data?.dungeons?.player_classes?.berserk?.experience ?? 0, 'dungeons'),
|
|
430
|
+
archer: getLevelByXp(data?.dungeons?.player_classes?.archer?.experience ?? 0, 'dungeons'),
|
|
431
|
+
tank: getLevelByXp(data?.dungeons?.player_classes?.tank?.experience ?? 0, 'dungeons'),
|
|
432
|
+
selected: data?.dungeons?.selected_dungeon_class ?? 'mage'
|
|
433
|
+
},
|
|
434
|
+
essence: {
|
|
435
|
+
diamond: data?.currencies?.essence?.DIAMOND?.current || 0,
|
|
436
|
+
dragon: data?.currencies?.essence?.DRAGON?.current || 0,
|
|
437
|
+
spider: data?.currencies?.essence?.SPIDER?.current || 0,
|
|
438
|
+
wither: data?.currencies?.essence?.WITHER?.current || 0,
|
|
439
|
+
undead: data?.currencies?.essence?.UNDEAD?.current || 0,
|
|
440
|
+
gold: data?.currencies?.essence?.GOLD?.current || 0,
|
|
441
|
+
ice: data?.currencies?.essence?.ICE?.current || 0,
|
|
442
|
+
crimson: data?.currencies?.essence?.CRIMSON?.current || 0
|
|
305
443
|
}
|
|
306
444
|
};
|
|
307
445
|
}
|
|
@@ -485,6 +623,30 @@ function populateGoals(achieved, all) {
|
|
|
485
623
|
return populatedAchieved;
|
|
486
624
|
}
|
|
487
625
|
|
|
626
|
+
function getHOTM(data) {
|
|
627
|
+
return {
|
|
628
|
+
experience: getLevelByXp(data.mining_core?.experience, 'hotm'),
|
|
629
|
+
ability: data.mining_core?.selected_pickaxe_ability || 'none',
|
|
630
|
+
powder: {
|
|
631
|
+
mithril: {
|
|
632
|
+
spent: data?.mining_core?.powder_spent_mithril || 0,
|
|
633
|
+
current: data?.mining_core?.powder_mithril || 0,
|
|
634
|
+
total: data?.mining_core?.powder_spent_mithril || 0 + data?.mining_core?.powder_mithril || 0
|
|
635
|
+
},
|
|
636
|
+
gemstone: {
|
|
637
|
+
spent: data?.mining_core?.powder_spent_gemstone || 0,
|
|
638
|
+
current: data?.mining_core?.powder_gemstone || 0,
|
|
639
|
+
total: data?.mining_core?.powder_spent_gemstone || 0 + data?.mining_core?.powder_gemstone || 0
|
|
640
|
+
},
|
|
641
|
+
glacite: {
|
|
642
|
+
spent: data?.mining_core?.powder_spent_glacite || 0,
|
|
643
|
+
current: data?.mining_core?.powder_glacite || 0,
|
|
644
|
+
total: data?.mining_core?.powder_spent_glacite || 0 + data?.mining_core?.powder_glacite || 0
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
|
|
488
650
|
module.exports = {
|
|
489
651
|
decode,
|
|
490
652
|
getLevelByXp,
|
|
@@ -493,11 +655,13 @@ module.exports = {
|
|
|
493
655
|
getSkills,
|
|
494
656
|
getBestiaryLevel,
|
|
495
657
|
getSlayer,
|
|
658
|
+
getCrimson,
|
|
496
659
|
getDungeons,
|
|
497
660
|
getJacobData,
|
|
498
661
|
getChocolateFactory,
|
|
499
662
|
getPetLevel,
|
|
500
663
|
parseRarity,
|
|
501
664
|
parseGearScore,
|
|
502
|
-
populateGoals
|
|
665
|
+
populateGoals,
|
|
666
|
+
getHOTM
|
|
503
667
|
};
|