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
@@ -1,38 +1,106 @@
1
1
  const divide = require('../../utils/divide');
2
2
 
3
- // eslint-disable-next-line jsdoc/require-jsdoc
4
- function generateModeStats(data, mode) {
5
- return {
6
- kills: data[`kills_${mode}`] || 0,
7
- deaths: data[`deaths_${mode}`] || 0,
8
- KDRatio: divide(data[`kills_${mode}`], data[`deaths_${mode}`]),
9
- wins: data[`wins_${mode}`] || 0,
10
- losses: data[`losses_${mode}`] || 0,
11
- WLRatio: divide(data[`wins_${mode}`], data[`losses_${mode}`])
12
- };
3
+ class SmashHeroesMode {
4
+ /**
5
+ * @param {object} data SmashHeroes data
6
+ * @param {string} mode SmashHeores mode
7
+ */
8
+ constructor(data, mode) {
9
+ /**
10
+ * kills
11
+ * @type {number}
12
+ */
13
+ this.kills = data[`kills_${mode}`] || 0;
14
+ /**
15
+ * deaths
16
+ * @type {number}
17
+ */
18
+ this.deaths = data[`deaths_${mode}`] || 0;
19
+ /**
20
+ * KDRatio
21
+ * @type {number}
22
+ */
23
+ this.KDRatio = divide(this.kills, this.deaths);
24
+ /**
25
+ * wins
26
+ * @type {number}
27
+ */
28
+ this.wins = data[`wins_${mode}`] || 0;
29
+ /**
30
+ * losses
31
+ * @type {number}
32
+ */
33
+ this.losses = data[`losses_${mode}`] || 0;
34
+ /**
35
+ * WLRatio
36
+ * @type {number}
37
+ */
38
+ this.WLRatio = divide(this.wins, this.losses);
39
+ }
13
40
  }
14
41
 
15
- // eslint-disable-next-line jsdoc/require-jsdoc
16
- function generateHeroStats(data) {
17
- const stats = [];
18
- for (const hero in data.class_stats) {
19
- if (Object.prototype.hasOwnProperty.call(data.class_stats, hero)) {
20
- stats.push({
21
- name: hero,
22
- level: data[`lastLevel_${hero}`] || 0,
23
- xp: data[`xp_${hero}`] || 0,
24
- prestige: data[`pg_${hero}`] || 0,
25
- playedGames: data.class_stats[hero].games || 0,
26
- kills: data.class_stats[hero].kills || 0,
27
- deaths: data.class_stats[hero].deaths || 0,
28
- KDRatio: divide(data.class_stats[hero].kills, data.class_stats[hero].deaths),
29
- wins: data.class_stats[hero].wins || 0,
30
- losses: data.class_stats[hero].losses || 0,
31
- WLRatio: divide(data.class_stats[hero].wins, data.class_stats[hero].losses)
32
- });
33
- }
42
+ class SmashHeoresHero {
43
+ /**
44
+ * @param {object} data SmashHeroes data
45
+ * @param {string} hero Hero name
46
+ */
47
+ constructor(data, hero) {
48
+ /**
49
+ * Hero Name
50
+ * @type {string}
51
+ */
52
+ this.name = hero;
53
+ /**
54
+ * Level
55
+ * @type {number}
56
+ */
57
+ this.level = data[`lastLevel_${hero}`] || 0;
58
+ /**
59
+ * Xp
60
+ * @type {number}
61
+ */
62
+ this.xp = data[`xp_${hero}`] || 0;
63
+ /**
64
+ * Prestige
65
+ * @type {number}
66
+ */
67
+ this.prestige = data[`pg_${hero}`] || 0;
68
+ /**
69
+ * Played Games
70
+ * @type {number}
71
+ */
72
+ this.playedGames = data.class_stats?.[hero]?.games || 0;
73
+ /**
74
+ * Kills
75
+ * @type {number}
76
+ */
77
+ this.kills = data.class_stats?.[hero]?.kills || 0;
78
+ /**
79
+ * Deaths
80
+ * @type {number}
81
+ */
82
+ this.deaths = data.class_stats?.[hero]?.deaths || 0;
83
+ /**
84
+ * KDRatio
85
+ * @type {number}
86
+ */
87
+ this.KDRatio = divide(this.kills, this.deaths);
88
+ /**
89
+ * Wins
90
+ * @type {number}
91
+ */
92
+ this.wins = data.class_stats?.[hero]?.wins || 0;
93
+ /**
94
+ * Losses
95
+ * @type {number}
96
+ */
97
+ this.losses = data.class_stats?.[hero]?.losses || 0;
98
+ /**
99
+ * WLRatio
100
+ * @type {number}
101
+ */
102
+ this.WLRatio = divide(this.wins, this.losses);
34
103
  }
35
- return stats;
36
104
  }
37
105
 
38
106
  /**
@@ -93,54 +161,112 @@ class SmashHeroes {
93
161
  * @type {number}
94
162
  */
95
163
  this.WLRatio = divide(this.wins, this.losses);
164
+ /**
165
+ * Smashed
166
+ * @type {number}
167
+ */
168
+ this.smashed = data.smashed || 0;
169
+ /**
170
+ * Stats for each mode
171
+ * @type {SmashHeroesMode}
172
+ */
173
+ this['1v1v1v1'] = new SmashHeroesMode(data, 'normal');
96
174
  /**
97
175
  * Stats for each mode
98
- * @type {SmashHeroesModes}
176
+ * @type {SmashHeroesMode}
99
177
  */
100
- this.mode = {
101
- '1v1v1v1': generateModeStats(data, 'normal'),
102
- '2v2': generateModeStats(data, '2v2'),
103
- '2v2v2': generateModeStats(data, 'teams')
104
- };
178
+ this['2v2'] = new SmashHeroesMode(data, '2v2');
179
+ /**
180
+ * Stats for each mode
181
+ * @type {SmashHeroesMode}
182
+ */
183
+ this['2v2v2'] = new SmashHeroesMode(data, 'teams');
105
184
  /**
106
185
  * Active class
107
186
  * @type {string}
108
187
  */
109
- this.activeClass = data.active_class ?? null;
188
+ this.activeClass = data.active_class || null;
189
+ /**
190
+ * The Bulk
191
+ * @type {SmashHeoresHero}
192
+ */
193
+ this.theBulk = new SmashHeoresHero(data, 'THE_BULK');
194
+ /**
195
+ * Cake Monster
196
+ * @type {SmashHeoresHero}
197
+ */
198
+ this.cakeMonster = new SmashHeoresHero(data, 'CAKE_MONSTER');
199
+ /**
200
+ * General Cluck
201
+ * @type {SmashHeoresHero}
202
+ */
203
+ this.generalCluck = new SmashHeoresHero(data, 'GENERAL_CLUCK');
204
+ /**
205
+ * Botmun
206
+ * @type {SmashHeoresHero}
207
+ */
208
+ this.botmun = new SmashHeoresHero(data, 'BOTMUN');
209
+ /**
210
+ * Marauder
211
+ * @type {SmashHeoresHero}
212
+ */
213
+ this.marauder = new SmashHeoresHero(data, 'MARAUDER');
214
+ /**
215
+ * Pug
216
+ * @type {SmashHeoresHero}
217
+ */
218
+ this.pug = new SmashHeoresHero(data, 'PUG');
219
+ /**
220
+ * Tinman
221
+ * @type {SmashHeoresHero}
222
+ */
223
+ this.tinman = new SmashHeoresHero(data, 'TINMAN');
224
+ /**
225
+ * Spoderman
226
+ * @type {SmashHeoresHero}
227
+ */
228
+ this.spoderman = new SmashHeoresHero(data, 'SPODERMAN');
229
+ /**
230
+ * Frosty
231
+ * @type {SmashHeoresHero}
232
+ */
233
+ this.frosty = new SmashHeoresHero(data, 'FROSTY');
234
+ /**
235
+ * Sergeant Shield
236
+ * @type {SmashHeoresHero}
237
+ */
238
+ this.sergeantShield = new SmashHeoresHero(data, 'SERGEANT_SHIELD');
239
+ /**
240
+ * Skullfire
241
+ * @type {SmashHeoresHero}
242
+ */
243
+ this.skullfire = new SmashHeoresHero(data, 'SKULLFIRE');
244
+ /**
245
+ * Goku
246
+ * @type {SmashHeoresHero}
247
+ */
248
+ this.goku = new SmashHeoresHero(data, 'GOKU');
249
+ /**
250
+ * Sanic
251
+ * @type {SmashHeoresHero}
252
+ */
253
+ this.sanic = new SmashHeoresHero(data, 'SANIC');
254
+ /**
255
+ * Dusk Crawler
256
+ * @type {SmashHeoresHero}
257
+ */
258
+ this.duskCrawler = new SmashHeoresHero(data, 'DUSK_CRAWLER');
259
+ /**
260
+ * Shoop Da Whoop
261
+ * @type {SmashHeoresHero}
262
+ */
263
+ this.shoopDaWhoop = new SmashHeoresHero(data, 'SHOOP_DA_WHOOP');
110
264
  /**
111
- * Stats for each class
112
- * @type {SmashHeroesClassStats[]|null}
265
+ * Green Hood
266
+ * @type {SmashHeoresHero}
113
267
  */
114
- this.heroStats = data.class_stats ? generateHeroStats(data) : null;
268
+ this.greenHood = new SmashHeoresHero(data, 'GREEN_HOOD');
115
269
  }
116
270
  }
117
- /**
118
- * @typedef {object} SmashHeroesModes
119
- * @property {SmashHeroesModeStats} '1v1v1v1' 1v1v1v1
120
- * @property {SmashHeroesModeStats} '2v2' 2v2
121
- * @property {SmashHeroesModeStats} '2v2v2' 2v2v2
122
- */
123
- /**
124
- * @typedef {object} SmashHeroesModeStats
125
- * @property {number} kills Kills
126
- * @property {number} deaths Deaths
127
- * @property {number} KDRatio Kill/Death ratio
128
- * @property {number} wins Wins
129
- * @property {number} losses Losses
130
- * @property {number} WLRatio Win/Loss ratio
131
- */
132
- /**
133
- * @typedef {object} SmashHeroesClassStats
134
- * @property {string} name Name
135
- * @property {number} level Level
136
- * @property {number} xp XP
137
- * @property {number} prestige Prestige
138
- * @property {number} playedGames Played games
139
- * @property {number} kills Kills
140
- * @property {number} deaths Deaths
141
- * @property {number} KDRatio Kill/Death ratio
142
- * @property {number} wins Wins
143
- * @property {number} losses Losses
144
- * @property {number} WLRatio Win/Loss ratio
145
- */
271
+
146
272
  module.exports = SmashHeroes;
@@ -1,4 +1,54 @@
1
1
  const divide = require('../../utils/divide');
2
+
3
+ class SpeedUHCMode {
4
+ /**
5
+ * @param {object} data Speed UHC data
6
+ * @param {string} data Speed UHC data
7
+ */
8
+ constructor(data, mode) {
9
+ /**
10
+ * Kills
11
+ * @type {number}
12
+ */
13
+ this.kills = data[`kills_${mode}`] || 0;
14
+ /**
15
+ * Deaths
16
+ * @type {number}
17
+ */
18
+ this.deaths = data[`deaths_${mode}`] || 0;
19
+ /**
20
+ * Wins
21
+ * @type {number}
22
+ */
23
+ this.wins = data[`wins_${mode}`] || 0;
24
+ /**
25
+ * Losses
26
+ * @type {number}
27
+ */
28
+ this.losses = data[`losses_${mode}`] || 0;
29
+ /**
30
+ * Played Games
31
+ * @type {number}
32
+ */
33
+ this.playedGames = data[`games_${mode}`] || 0;
34
+ /**
35
+ * Winstreak
36
+ * @type {number}
37
+ */
38
+ this.winstreak = data[`win_streak_${mode}`] || 0;
39
+ /**
40
+ * Kill Streak
41
+ * @type {number}
42
+ */
43
+ this.killStreak = data[`killstreak_${mode}`] || 0;
44
+ /**
45
+ * Assists
46
+ * @type {number}
47
+ */
48
+ this.assists = data[`assists_${mode}`] || 0;
49
+ }
50
+ }
51
+
2
52
  /**
3
53
  * Speed UHC class
4
54
  */
@@ -84,45 +134,35 @@ class SpeedUHC {
84
134
  this.assists = data.assists || 0;
85
135
  /**
86
136
  * Solo
87
- * @type {SpeedUHCModeStats}
88
- */
89
- this.solo = {
90
- kills: data.kills_solo || 0,
91
- deaths: data.deaths_solo || 0,
92
- wins: data.wins_solo || 0,
93
- losses: data.losses_solo || 0,
94
- playedGames: data.games_solo || 0,
95
- winStreak: data.win_streak_solo || 0,
96
- killStreak: data.killstreak_solo || 0,
97
- assists: data.assists_solo || 0
98
- };
137
+ * @type {SpeedUHCMode}
138
+ */
139
+ this.solo = new SpeedUHCMode(data, 'solo');
140
+ /**
141
+ * Solo Normal
142
+ * @type {SpeedUHCMode}
143
+ */
144
+ this.soloNormal = new SpeedUHCMode(data, 'solo_normal');
145
+ /**
146
+ * Solo Insane
147
+ * @type {SpeedUHCMode}
148
+ */
149
+ this.soloInsane = new SpeedUHCMode(data, 'solo_insane');
99
150
  /**
100
151
  * Team
101
- * @type {SpeedUHCModeStats}
102
- */
103
- this.teams = {
104
- kills: data.kills_team || 0,
105
- deaths: data.deaths_team || 0,
106
- wins: data.wins_team || 0,
107
- losses: data.losses_team || 0,
108
- playedGames: data.games_team || 0,
109
- winStreak: data.win_streak_team || 0,
110
- killStreak: data.killstreak_team || 0,
111
- assists: data.assists_team || 0
112
- };
152
+ * @type {SpeedUHCMode}
153
+ */
154
+ this.team = new SpeedUHCMode(data, 'team');
155
+ /**
156
+ * Team Normal
157
+ * @type {SpeedUHCMode}
158
+ */
159
+ this.teamNormal = new SpeedUHCMode(data, 'team_normal');
160
+ /**
161
+ * Team Insane
162
+ * @type {SpeedUHCMode}
163
+ */
164
+ this.teamInsane = new SpeedUHCMode(data, 'team_insane');
113
165
  }
114
166
  }
115
167
 
116
- /**
117
- * @typedef {object} SpeedUHCModeStats
118
- * @property {number} kills Kills
119
- * @property {number} deaths Deaths
120
- * @property {number} wins Wins
121
- * @property {number} losses Losses
122
- * @property {number} playedGames Played games
123
- * @property {number} winStreak Win streak
124
- * @property {number} killStreak Kill streak
125
- * @property {number} assists Assists
126
- */
127
-
128
168
  module.exports = SpeedUHC;