hypixel-api-reborn 11.2.1 → 11.3.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.
Files changed (38) hide show
  1. package/package.json +8 -8
  2. package/src/API/housing/getActiveHouses.js +7 -0
  3. package/src/API/housing/getHouse.js +9 -0
  4. package/src/API/housing/getPlayerHouses.js +11 -0
  5. package/src/API/index.js +6 -1
  6. package/src/API/skyblock/getFireSales.js +1 -1
  7. package/src/API/skyblock/getGarden.js +7 -0
  8. package/src/API/skyblock/getMember.js +4 -2
  9. package/src/API/skyblock/getProfiles.js +4 -2
  10. package/src/Client.js +46 -2
  11. package/src/Private/requests.js +1 -1
  12. package/src/index.js +5 -0
  13. package/src/structures/House.js +54 -0
  14. package/src/structures/MiniGames/Arcade.js +754 -270
  15. package/src/structures/MiniGames/ArenaBrawl.js +97 -31
  16. package/src/structures/MiniGames/BlitzSurvivalGames.js +378 -127
  17. package/src/structures/MiniGames/BuildBattle.js +19 -8
  18. package/src/structures/MiniGames/CopsAndCrims.js +252 -25
  19. package/src/structures/MiniGames/Duels.js +916 -656
  20. package/src/structures/MiniGames/MegaWalls.js +390 -51
  21. package/src/structures/MiniGames/MurderMystery.js +151 -30
  22. package/src/structures/MiniGames/Paintball.js +31 -11
  23. package/src/structures/MiniGames/Quakecraft.js +113 -50
  24. package/src/structures/MiniGames/SkyWars.js +340 -195
  25. package/src/structures/MiniGames/SmashHeroes.js +195 -69
  26. package/src/structures/MiniGames/SpeedUHC.js +76 -36
  27. package/src/structures/MiniGames/TNTGames.js +242 -73
  28. package/src/structures/MiniGames/TurboKartRacers.js +55 -115
  29. package/src/structures/MiniGames/UHC.js +135 -124
  30. package/src/structures/MiniGames/VampireZ.js +70 -37
  31. package/src/structures/MiniGames/Warlords.js +126 -1
  32. package/src/structures/MiniGames/WoolWars.js +54 -4
  33. package/src/structures/Player.js +33 -25
  34. package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
  35. package/src/structures/SkyBlock/SkyblockMember.js +12 -5
  36. package/src/utils/Constants.js +507 -5
  37. package/src/utils/SkyblockUtils.js +33 -0
  38. package/typings/index.d.ts +1034 -899
@@ -219,28 +219,28 @@ class Player {
219
219
  */
220
220
  this.stats = data.stats
221
221
  ? {
222
- skywars: data.stats.SkyWars ? new SkyWars(data.stats.SkyWars) : null,
222
+ arcade: data.stats.Arcade ? new Arcade({ ...data.stats.Arcade, ...data.achievements }) : null,
223
+ arena: data.stats.Arena ? new ArenaBrawl(data.stats.Arena) : null,
223
224
  bedwars: data.stats.Bedwars ? new BedWars(data.stats.Bedwars) : null,
224
- uhc: data.stats.UHC ? new UHC(data.stats.UHC) : null,
225
- speeduhc: data.stats.SpeedUHC ? new SpeedUHC(data.stats.SpeedUHC) : null,
226
- murdermystery: data.stats.MurderMystery ? new MurderMystery(data.stats.MurderMystery) : null,
227
- duels: data.stats.Duels ? new Duels(data.stats.Duels) : null,
225
+ blitzsg: data.stats.HungerGames ? new BlitzSurvivalGames(data.stats.HungerGames) : null,
228
226
  buildbattle: data.stats.BuildBattle ? new BuildBattle(data.stats.BuildBattle) : null,
229
- megawalls: data.stats.Walls3 ? new MegaWalls(data.stats.Walls3) : null,
230
227
  copsandcrims: data.stats.MCGO ? new CopsAndCrims(data.stats.MCGO) : null,
231
- tntgames: data.stats.TNTGames ? new TNTGames(data.stats.TNTGames) : null,
232
- smashheroes: data.stats.SuperSmash ? new SmashHeroes(data.stats.SuperSmash) : null,
233
- vampirez: data.stats.VampireZ ? new VampireZ(data.stats.VampireZ) : null,
234
- blitzsg: data.stats.HungerGames ? new BlitzSurvivalGames(data.stats.HungerGames) : null,
235
- arena: data.stats.Arena ? new ArenaBrawl(data.stats.Arena) : null,
236
- arcade: data.stats.Arcade ? new Arcade({ ...data.stats.Arcade, ...data.achievements }) : null,
228
+ duels: data.stats.Duels ? new Duels(data.stats.Duels) : null,
229
+ megawalls: data.stats.Walls3 ? new MegaWalls(data.stats.Walls3) : null,
230
+ murdermystery: data.stats.MurderMystery ? new MurderMystery(data.stats.MurderMystery) : null,
237
231
  paintball: data.stats.Paintball ? new Paintball(data.stats.Paintball) : null,
232
+ pit: data.stats.Pit ? new Pit(data.stats.Pit) : null,
238
233
  quakecraft: data.stats.Quake ? new Quakecraft(data.stats.Quake) : null,
234
+ skywars: data.stats.SkyWars ? new SkyWars(data.stats.SkyWars) : null,
235
+ smashheroes: data.stats.SuperSmash ? new SmashHeroes(data.stats.SuperSmash) : null,
236
+ speeduhc: data.stats.SpeedUHC ? new SpeedUHC(data.stats.SpeedUHC) : null,
237
+ tntgames: data.stats.TNTGames ? new TNTGames(data.stats.TNTGames) : null,
239
238
  turbokartracers: data.stats.GingerBread ? new TurboKartRacers(data.stats.GingerBread) : null,
239
+ uhc: data.stats.UHC ? new UHC(data.stats.UHC) : null,
240
+ vampirez: data.stats.VampireZ ? new VampireZ(data.stats.VampireZ) : null,
240
241
  walls: data.stats.Walls ? new Walls(data.stats.Walls) : null,
241
242
  warlords: data.stats.Battleground ? new Warlords(data.stats.Battleground) : null,
242
- woolwars: data.stats.WoolGames ? new WoolWars(data.stats.WoolGames) : null,
243
- pit: data.stats.Pit ? new Pit(data.stats.Pit) : null
243
+ woolwars: data.stats.WoolGames ? new WoolWars(data.stats.WoolGames) : null
244
244
  }
245
245
  : null;
246
246
  /**
@@ -286,9 +286,11 @@ class Player {
286
286
  * * `MVP`
287
287
  * * `MVP+`
288
288
  * * `MVP++`
289
+ * * `YouTube`
289
290
  * * `Game Master`
290
291
  * * `Admin`
291
- * * `YouTube`
292
+ * * `PIG+++`
293
+ * * `INNIT`
292
294
  */
293
295
  /**
294
296
  * @typedef {Object} PlayerSocialMedia
@@ -302,21 +304,27 @@ class Player {
302
304
  * Player stats for each mini-game. `null` if player has no stats.
303
305
  * <br>
304
306
  * Usage: `<Player>.stats.skywars`
305
- * @property {SkyWars|null} skywars SkyWars
307
+ * @property {Arcade|null} arcade Arcade
308
+ * @property {ArenaBrawl|null} arena Arena Brawl
306
309
  * @property {BedWars|null} bedwars BedWars
307
- * @property {UHC|null} uhc UHC
308
- * @property {SpeedUHC|null} speedUHC Speed UHC
309
- * @property {MurderMystery|null} murdermystery Murder Mystery
310
- * @property {Duels|null} duels Duels
310
+ * @property {BlitzSurvivalGames|null} blitzsg Blitz Survival Games
311
311
  * @property {BuildBattle|null} buildbattle BuildBattle
312
- * @property {MegaWalls|null} megawalls MegaWalls
313
312
  * @property {CopsAndCrims|null} copsandcrims Cops and Crims
314
- * @property {TNTGames|null} tntgames The TNT Games
313
+ * @property {Duels|null} duels Duels
314
+ * @property {MegaWalls|null} megawalls MegaWalls
315
+ * @property {MurderMystery|null} murdermystery Murder Mystery
316
+ * @property {Paintball|null} paintball Paint Ball
317
+ * @property {Pit|null} pit Pit
318
+ * @property {Quakecraft|null} quakecraft Quake Craft
319
+ * @property {SkyWars|null} skywars SkyWars
315
320
  * @property {SmashHeroes|null} smashheroes Smash Heroes
321
+ * @property {SpeedUHC|null} speedUHC Speed UHC
322
+ * @property {TNTGames|null} tntgames The TNT Games
323
+ * @property {TurboKartRacers|null} turbokartracers Turbo Kart Racers
324
+ * @property {UHC|null} uhc UHC
316
325
  * @property {VampireZ|null} vampirez VampireZ
317
- * @property {BlitzSurvivalGames|null} blitzsg Blitz Survival Games
318
- * @property {ArenaBrawl|null} arena Arena Brawl
319
- * @property {Arcade|null} arcade Arcade
326
+ * @property {Walls|null} walls Walls
327
+ * @property {Warlords|null} warlords Warlords
320
328
  * @property {WoolWars|null} woolwars Wool Wars
321
329
  */
322
330
  /**
@@ -0,0 +1,146 @@
1
+ const { getLevelByXp } = require('../../utils/SkyblockUtils');
2
+
3
+ /**
4
+ * Skyblock Garden class
5
+ */
6
+ class SkyblockGarden {
7
+ /**
8
+ * @param {object} data Skyblock member data
9
+ */
10
+ constructor(data) {
11
+ /**
12
+ * level
13
+ * @type {SkyblockSkillLevel}
14
+ */
15
+ this.level = getLevelByXp(data?.garden?.garden_experience || 0, 'garden');
16
+ /**
17
+ * Current Barn Skin
18
+ * @type {string}
19
+ */
20
+ this.barnSkin = data.garden?.selected_barn_skin || '';
21
+ /**
22
+ * Unlocked Plots
23
+ * @type {string[]}
24
+ */
25
+ this.unlockedPlots = data.garden?.unlocked_plots_ids || [];
26
+ /**
27
+ * Visitor Stats
28
+ * @type {SkyblockGardenVisitor}
29
+ */
30
+ this.visitors = {
31
+ visited: data.garden?.commission_data?.visits || {},
32
+ completed: data.garden?.commission_data?.completed || {},
33
+ served: {
34
+ total: data.garden?.commission_data?.total_completed || 0,
35
+ unique: data.garden?.commission_data?.unique_npcs_served || 0
36
+ }
37
+ };
38
+ /**
39
+ * Crop Milestones
40
+ * @type {SkyblockGarenCropMilestones}
41
+ */
42
+ this.cropMilestones = {
43
+ wheat: getLevelByXp(data.garden?.resources_collected?.WHEAT || 0, 'wheat'),
44
+ carrot: getLevelByXp(data.garden?.resources_collected?.CARROT_ITEM || 0, 'carrot'),
45
+ sugarCane: getLevelByXp(data.garden?.resources_collected?.SUGAR_CANE || 0, 'sugarCane'),
46
+ potato: getLevelByXp(data.garden?.resources_collected?.POTATO_ITEM || 0, 'potato'),
47
+ pumpkin: getLevelByXp(data.garden?.resources_collected?.PUMPKIN || 0, 'pumpkin'),
48
+ melon: getLevelByXp(data.garden?.resources_collected?.MELON || 0, 'melon'),
49
+ cactus: getLevelByXp(data.garden?.resources_collected?.CACTUS || 0, 'cactus'),
50
+ cocoBeans: getLevelByXp(data.garden?.resources_collected?.['INK_SACK:3'] || 0, 'cocoBeans'),
51
+ mushroom: getLevelByXp(data.garden?.resources_collected?.MUSHROOM_COLLECTION || 0, 'mushroom'),
52
+ netherWart: getLevelByXp(data.garden?.resources_collected?.NETHER_STALK || 0, 'netherWart')
53
+ };
54
+ /**
55
+ * Composter
56
+ * @type {SkyblockGardenComposter}
57
+ */
58
+ this.composter = {
59
+ organicMatter: data.garden?.composter_data?.organic_matter || 0,
60
+ fuelUnits: data.garden?.composter_data?.fuel_units || 0,
61
+ compostUnits: data.garden?.composter_data?.compost_units || 0,
62
+ compostItems: data.garden?.composter_data?.compost_items || 0,
63
+ conversionTicks: data.garden?.composter_data?.conversion_ticks || 0,
64
+ upgrades: {
65
+ speed: data.garden?.composter_data?.upgrades?.speed || 0,
66
+ multiDrop: data.garden?.composter_data?.upgrades?.multi_drop || 0,
67
+ fuelCap: data.garden?.composter_data?.upgrades?.fuel_cap || 0,
68
+ organicMatterCap: data.garden?.composter_data?.upgrades?.organic_matter_cap || 0,
69
+ costReduction: data.garden?.composter_data?.upgrades?.cost_reduction || 0
70
+ }
71
+ };
72
+ /**
73
+ * Crop Upgrades
74
+ * @type {SkyblockGarenCrops}
75
+ */
76
+ this.cropUpgrades = {
77
+ wheat: data.garden?.crop_upgrade_levels?.WHEAT || 0,
78
+ carrot: data.garden?.crop_upgrade_levels?.CARROT_ITEM || 0,
79
+ sugarCane: data.garden?.crop_upgrade_levels?.SUGAR_CANE || 0,
80
+ potato: data.garden?.crop_upgrade_levels?.POTATO_ITEM || 0,
81
+ pumpkin: data.garden?.crop_upgrade_levels?.PUMPKIN || 0,
82
+ melon: data.garden?.crop_upgrade_levels?.MELON || 0,
83
+ cactus: data.garden?.crop_upgrade_levels?.CACTUS || 0,
84
+ cocoBeans: data.garden?.crop_upgrade_levels?.['INK_SACK:3'] || 0,
85
+ mushroom: data.garden?.crop_upgrade_levels?.MUSHROOM_COLLECTION || 0,
86
+ netherWart: data.garden?.crop_upgrade_levels?.NETHER_STALK || 0
87
+ };
88
+ }
89
+ }
90
+
91
+ /**
92
+ * @typedef {object} SkyblockGardenVisitor
93
+ * @property {Record<string, number>} visited Visited
94
+ * @property {Record<string, number>} completed Completed
95
+ * @property {SkyblockGardenVisitorServed} served served
96
+ */
97
+ /**
98
+ * @typedef {object} SkyblockGardenVisitorServed
99
+ * @property {number} total total
100
+ * @property {number} unique unique
101
+ */
102
+ /**
103
+ * @typedef {object} SkyblockGardenComposter
104
+ * @property {number} organicMatter Organic Matter
105
+ * @property {number} fuelUnits Fuel Units
106
+ * @property {number} compostUnits Compost Units
107
+ * @property {number} compostItems Compost Items
108
+ * @property {number} conversionTicks Conversion Ticks
109
+ * @property {SkyblockGardenComposterUpgrades} upgrades upgrades
110
+ */
111
+ /**
112
+ * @typedef {object} SkyblockGardenComposterUpgrades
113
+ * @property {number} speed Speed
114
+ * @property {number} multiDrop Multi Drop
115
+ * @property {number} fuelCap Fuel Cap
116
+ * @property {number} organicMatterCap Organic Matter Cap
117
+ * @property {number} costReduction Cost Reduction
118
+ */
119
+ /**
120
+ * @typedef {object} SkyblockGarenCrops
121
+ * @property {number} wheat Wheat
122
+ * @property {number} carrot Carrot
123
+ * @property {number} sugarCane Sugar Cane
124
+ * @property {number} potato Potato
125
+ * @property {number} pumpkin Pumpkin
126
+ * @property {number} melon Melon
127
+ * @property {number} cactus Cactus
128
+ * @property {number} cocoBeans Coco Beans
129
+ * @property {number} mushroom Mushroom
130
+ * @property {number} netherWart Nether Wart
131
+ */
132
+ /**
133
+ * @typedef {object} SkyblockGarenCropMilestones
134
+ * @property {SkyblockSkillLevel} wheat Wheat
135
+ * @property {SkyblockSkillLevel} carrot Carrot
136
+ * @property {SkyblockSkillLevel} sugarCane Sugar Cane
137
+ * @property {SkyblockSkillLevel} potato Potato
138
+ * @property {SkyblockSkillLevel} pumpkin Pumpkin
139
+ * @property {SkyblockSkillLevel} melon Melon
140
+ * @property {SkyblockSkillLevel} cactus Cactus
141
+ * @property {SkyblockSkillLevel} cocoBeans Coco Beans
142
+ * @property {SkyblockSkillLevel} mushroom Mushroom
143
+ * @property {SkyblockSkillLevel} netherWart Nether Wart
144
+ */
145
+
146
+ module.exports = SkyblockGarden;
@@ -12,6 +12,8 @@ const {
12
12
  getPetLevel
13
13
  } = require('../../utils/SkyblockUtils');
14
14
  const SkyblockInventoryItem = require('./SkyblockInventoryItem');
15
+ const SkyblockMuseum = require('./SkyblockMuseum');
16
+ const SkyblockGarden = require('./SkyblockGarden');
15
17
  const Constants = require('../../utils/Constants');
16
18
  const skyhelper = require('skyhelper-networth');
17
19
  const SkyblockPet = require('./SkyblockPet');
@@ -38,9 +40,14 @@ class SkyblockMember {
38
40
  this.player = data.m.player || null;
39
41
  /**
40
42
  * If `getMuseum` option is `true`.
41
- * @type {object|null}
43
+ * @type {SkyblockMuseum|null}
42
44
  */
43
- this.museum = data.museum ?? null;
45
+ this.museum = data.museum || null;
46
+ /**
47
+ * If `getGarden` option is `true`.
48
+ * @type {SkyblockGarden|null}
49
+ */
50
+ this.garden = data.garden || null;
44
51
  /**
45
52
  * Profile's gamemode
46
53
  * @type {string|null}
@@ -85,12 +92,12 @@ class SkyblockMember {
85
92
  * Heart of the Mountain - MiningSkill
86
93
  * @type {number}
87
94
  */
88
- this.hotm = getLevelByXp(data.m.mining_core?.experience, 'hotm', 7);
95
+ this.hotm = getLevelByXp(data.m.mining_core?.experience, 'hotm');
89
96
  /**
90
97
  * Trophy fish amount of rewards
91
98
  * @type {number}
92
99
  */
93
- this.trophyFish = getTrophyFishRank(data.m.trophy_fish?.rewards.length ?? 0);
100
+ this.trophyFish = getTrophyFishRank(data.m.trophy_fish?.rewards?.length ?? 0);
94
101
  /**
95
102
  * The highest magical power **Not current one**
96
103
  * @type {number}
@@ -307,7 +314,7 @@ class SkyblockMember {
307
314
  */
308
315
  this.getNetworth = async () => {
309
316
  try {
310
- const nw = await skyhelper.getNetworth(data.m, data.banking.balance ?? 0, {
317
+ const nw = await skyhelper.getNetworth(data.m, data.banking?.balance ?? 0, {
311
318
  onlyNetworth: true,
312
319
  v2Endpoint: true,
313
320
  cache: true,