hypixel-api-reborn 11.3.4 → 11.3.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypixel-api-reborn",
3
- "version": "11.3.4",
3
+ "version": "11.3.6",
4
4
  "description": "Feature-rich Hypixel API wrapper for Node.js",
5
5
  "main": "./src/index.js",
6
6
  "types": "./typings/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "node-fetch": "^3.3.2",
33
33
  "prismarine-nbt": "^2.5.0",
34
34
  "rss-parser": "^3.13.0",
35
- "skyhelper-networth": "^1.23.0"
35
+ "skyhelper-networth": "^1.24.0"
36
36
  },
37
37
  "license": "MIT",
38
38
  "readme": "https://hypixel.stavzdev.me/",
@@ -42,10 +42,10 @@
42
42
  "publisher": "StavZ",
43
43
  "devDependencies": {
44
44
  "@discordjs/docgen": "github:discordjs/docgen",
45
- "@types/node": "^22.1.0",
45
+ "@types/node": "^22.5.5",
46
46
  "chai": "^4.3.4",
47
- "eslint": "^9.8.0",
48
- "eslint-plugin-jsdoc": "^49.0.0",
47
+ "eslint": "^9.10.0",
48
+ "eslint-plugin-jsdoc": "^50.2.3",
49
49
  "globals": "^15.9.0",
50
50
  "mocha": "^10.4.0",
51
51
  "node-env-run": "^4.0.2",
package/src/Errors.js CHANGED
@@ -62,5 +62,7 @@ module.exports = {
62
62
  INVALID_UPDATE_OPTION: '[hypixel-api-reborn] Invalid Value for update : must be a boolean',
63
63
  INVALID_THIRD_PARTY_API_OPTION: '[hypixel-api-reborn] Invalid Third Party API option : must be a boolean or string',
64
64
  BAD_AUCTION_FILTER:
65
- '[hypixel-api-reborn] Unexpected filter for Client#getSkyblockAuction. Expected one of "PLAYER", "AUCTION", "PROFILE", but got something else.'
65
+ '[hypixel-api-reborn] Unexpected filter for Client#getSkyblockAuction. Expected one of "PLAYER", "AUCTION", "PROFILE", but got something else.',
66
+ RECENT_REQUEST:
67
+ '[Hypixel-API-Reborn] You have requested that player recently. Try turning on cache. For help join our Discord Server https://discord.gg/NSEBNMM'
66
68
  };
@@ -32,6 +32,12 @@ class Requests {
32
32
  }
33
33
  if (403 === res.status) throw new Error(Errors.INVALID_API_KEY);
34
34
  if (422 === res.status) throw new Error(Errors.UNEXPECTED_ERROR);
35
+ if (
36
+ 429 === res.status &&
37
+ 'You have already looked up this player too recently, please try again shortly' === parsedRes.cause
38
+ ) {
39
+ throw new Error(Errors.RECENT_REQUEST);
40
+ }
35
41
  if (429 === res.status) throw new Error(Errors.RATE_LIMIT_EXCEEDED);
36
42
  if (200 !== res.status) throw new Error(Errors.ERROR_STATUSTEXT.replace(/{statustext}/, res.statusText));
37
43
  if (!parsedRes.success && !endpoint.startsWith('/housing')) {
package/src/index.js CHANGED
@@ -80,7 +80,7 @@ module.exports = {
80
80
  VampireZ: require('./structures/MiniGames/VampireZ.js'),
81
81
  Walls: require('./structures/MiniGames/Walls.js'),
82
82
  Warlords: require('./structures/MiniGames/Warlords.js'),
83
- WoolWars: require('./structures/MiniGames/WoolWars.js'),
83
+ WoolGames: require('./structures/MiniGames/WoolGames.js'),
84
84
 
85
85
  /* Leaderboards */
86
86
  Leaderboard: require('./structures/Leaderboard.js'),
@@ -240,73 +240,6 @@ class BountyHunters {
240
240
  this.swordKills = data.sword_kills_oneinthequiver || 0;
241
241
  }
242
242
  }
243
- /**
244
- * Capture the Wool class
245
- */
246
- class CaptureTheWool {
247
- constructor(data) {
248
- /**
249
- * Wins
250
- * @type {number}
251
- */
252
- this.wins = data.woolhunt_participated_wins || 0;
253
- /**
254
- * Losses
255
- * @type {number}
256
- */
257
- this.losses = data.woolhunt_participated_losses || 0;
258
- /**
259
- * Win Loss ratio
260
- * @type {number}
261
- */
262
- this.WLRatio = divide(this.wins, this.losses);
263
- /**
264
- * Draws
265
- * @type {number}
266
- */
267
- this.draws = data.woolhunt_participated_draws || 0;
268
- /**
269
- * Kills
270
- * @type {number}
271
- */
272
- this.kills = data.woolhunt_kills || 0;
273
- /**
274
- * Deaths
275
- * @type {number}
276
- */
277
- this.deaths = data.woolhunt_deaths || 0;
278
- /**
279
- * Kill Death ratio
280
- * @type {number}
281
- */
282
- this.KDRatio = divide(this.kills, this.deaths);
283
- /**
284
- * assists
285
- * @type {number}
286
- */
287
- this.assists = data.woolhunt_assists || 0;
288
- /**
289
- * woolPickedUp
290
- * @type {number}
291
- */
292
- this.woolPickedUp = data.woolhunt_wools_stolen || 0;
293
- /**
294
- * woolCaptured
295
- * @type {number}
296
- */
297
- this.woolCaptured = data.woolhunt_wools_captured || 0;
298
- /**
299
- * fastestWin (In seconds)
300
- * @type {number}
301
- */
302
- this.fastestWin = data.woolhunt_fastest_win || 0;
303
- /**
304
- * longestGame (In seconds)
305
- * @type {number}
306
- */
307
- this.longestGame = data.woolhunt_longest_game || 0;
308
- }
309
- }
310
243
  /**
311
244
  * Dragon Wars class
312
245
  */
@@ -561,9 +494,9 @@ class GalaxyWars {
561
494
  }
562
495
  }
563
496
  /**
564
- * Party Popper Stats (Sub gamemode of Hide and Seek)
497
+ * Party Pooper Stats (Sub gamemode of Hide and Seek)
565
498
  */
566
- class PartyPopper {
499
+ class PartyPooper {
567
500
  /**
568
501
  * @param {Object} data Data from API
569
502
  */
@@ -619,10 +552,10 @@ class HideAndSeek {
619
552
  */
620
553
  constructor(data) {
621
554
  /**
622
- * Party Popper Stats
623
- * @type {PartyPopper}
555
+ * Party Pooper Stats
556
+ * @type {PartyPooper}
624
557
  */
625
- this.partyPopper = new PartyPopper(data);
558
+ this.partyPooper = new PartyPooper(data);
626
559
  /**
627
560
  * Prop Hunt Stats
628
561
  * @type {PropHunt}
@@ -977,11 +910,6 @@ class Arcade {
977
910
  * @type {BountyHunters}
978
911
  */
979
912
  this.bountyHunters = new BountyHunters(data);
980
- /**
981
- * Capture The Wool
982
- * @type {CaptureTheWool}
983
- */
984
- this.captureTheWool = new CaptureTheWool(data);
985
913
  /**
986
914
  * Dragon wars stats
987
915
  * @type {DragonWars}
@@ -14,8 +14,7 @@ class UHCGamemode {
14
14
  * @param {object} data UHC data
15
15
  * @param {string} mode UHC Mode Name
16
16
  */
17
- constructor(data, mode) {
18
- if (mode) mode = `_${mode}`;
17
+ constructor(data, mode = '') {
19
18
  /**
20
19
  * Kills
21
20
  * @type {number}
@@ -76,7 +75,7 @@ class UHC {
76
75
  * Solo
77
76
  * @type {UHCGamemode}
78
77
  */
79
- this.solo = new UHCGamemode(data, 'solo');
78
+ this.solo = new UHCGamemode(data, '_solo');
80
79
  /**
81
80
  * Teams
82
81
  * @type {UHCGamemode}
@@ -86,27 +85,27 @@ class UHC {
86
85
  * Red vs Blue
87
86
  * @type {UHCGamemode}
88
87
  */
89
- this.redVsBlue = new UHCGamemode(data, 'red_vs_blue');
88
+ this.redVsBlue = new UHCGamemode(data, '_red_vs_blue');
90
89
  /**
91
90
  * No Diamond
92
91
  * @type {UHCGamemode}
93
92
  */
94
- this.noDiamond = new UHCGamemode(data, 'no_diamonds');
93
+ this.noDiamond = new UHCGamemode(data, '_no_diamonds');
95
94
  /**
96
95
  * Brawl
97
96
  * @type {UHCGamemode}
98
97
  */
99
- this.brawl = new UHCGamemode(data, 'brawl');
98
+ this.brawl = new UHCGamemode(data, '_brawl');
100
99
  /**
101
100
  * Solo brawl
102
101
  * @type {UHCGamemode}
103
102
  */
104
- this.soloBrawl = new UHCGamemode(data, 'solo_brawl');
103
+ this.soloBrawl = new UHCGamemode(data, '_solo_brawl');
105
104
  /**
106
105
  * Duo Brawl
107
106
  * @type {UHCGamemode}
108
107
  */
109
- this.duoBrawl = new UHCGamemode(data, 'duo_brawl');
108
+ this.duoBrawl = new UHCGamemode(data, '_duo_brawl');
110
109
  /**
111
110
  * Wins
112
111
  * @type {number}
@@ -0,0 +1,405 @@
1
+ const { divide } = require('../../utils');
2
+
3
+ class WoolWarsClass {
4
+ /**
5
+ * Constructor
6
+ * @param {Record<string, unknown>} data Data from API
7
+ */
8
+ constructor(data, className) {
9
+ /**
10
+ * Wins
11
+ * @type {number}
12
+ */
13
+ this.wins = data?.[className]?.wins || 0;
14
+ /**
15
+ * Kills
16
+ * @type {number}
17
+ */
18
+ this.kills = data?.[className]?.kills || 0;
19
+ /**
20
+ * Assists
21
+ * @type {number}
22
+ */
23
+ this.assists = data?.[className]?.assists || 0;
24
+ /**
25
+ * Deaths
26
+ * @type {number}
27
+ */
28
+ this.deaths = data?.[className]?.deaths || 0;
29
+ /**
30
+ * KDRatio
31
+ * @type {number}
32
+ */
33
+ this.KDRatio = divide(this.kills, this.deaths);
34
+ /**
35
+ * Games Played
36
+ * @type {number}
37
+ */
38
+ this.gamesPlayed = data?.[className]?.games_played || 0;
39
+ /**
40
+ * Wools Placed
41
+ * @type {number}
42
+ */
43
+ this.woolsPlaced = data?.[className]?.wool_placed || 0;
44
+ /**
45
+ * Blocks Broken
46
+ * @type {number}
47
+ */
48
+ this.blocksBroken = data?.[className]?.blocks_broken || 0;
49
+ /**
50
+ * Place Break Ratio
51
+ * @type {number}
52
+ */
53
+ this.placeBreakRatio = divide(this.woolsPlaced, this.blocksBroken);
54
+ /**
55
+ * Powerups Collected
56
+ * @type {number}
57
+ */
58
+ this.powerups = data?.[className]?.powerups_gotten || 0;
59
+ }
60
+ }
61
+
62
+ /**
63
+ * Wool Wars Class
64
+ */
65
+ class WoolWars {
66
+ /**
67
+ * Constructor
68
+ * @param {Record<string, unknown>} data Data from API
69
+ */
70
+ constructor(data) {
71
+ /**
72
+ * Selected Class
73
+ * @type {'ASSAULT' | 'TANK' | 'GOLEM' | 'SWORDSMAN' | 'ENGINEER' | 'ARCHER' | 'NONE'}
74
+ */
75
+ this.selectedClass = data?.selected_class || 'NONE';
76
+ /**
77
+ * Wins
78
+ * @type {number}
79
+ */
80
+ this.wins = data?.stats?.wins || 0;
81
+ /**
82
+ * Kills
83
+ * @type {number}
84
+ */
85
+ this.kills = data?.stats?.kills || 0;
86
+ /**
87
+ * Assists
88
+ * @type {number}
89
+ */
90
+ this.assists = data?.stats?.assists || 0;
91
+ /**
92
+ * Deaths
93
+ * @type {number}
94
+ */
95
+ this.deaths = data?.stats?.deaths || 0;
96
+ /**
97
+ * KDRatio
98
+ * @type {number}
99
+ */
100
+ this.KDRatio = divide(this.kills, this.deaths);
101
+ /**
102
+ * Games Played
103
+ * @type {number}
104
+ */
105
+ this.gamesPlayed = data?.stats?.games_played || 0;
106
+ /**
107
+ * Wools Placed
108
+ * @type {number}
109
+ */
110
+ this.woolsPlaced = data?.stats?.wool_placed || 0;
111
+ /**
112
+ * Blocks Broken
113
+ * @type {number}
114
+ */
115
+ this.blocksBroken = data?.stats?.blocks_broken || 0;
116
+ /**
117
+ * Place Break Ratio
118
+ * @type {number}
119
+ */
120
+ this.placeBreakRatio = divide(this.woolsPlaced, this.blocksBroken);
121
+ /**
122
+ * powerups
123
+ * @type {number}
124
+ */
125
+ this.powerups = data?.powerups_gotten || 0;
126
+ /**
127
+ * Assault Class Stats
128
+ * @type {WoolWarsClass}
129
+ */
130
+ this.assault = new WoolWarsClass(data?.stats?.classes, 'assault');
131
+ /**
132
+ * Tank Class Stats
133
+ * @type {WoolWarsClass}
134
+ */
135
+ this.tank = new WoolWarsClass(data?.stats?.classes, 'tank');
136
+ /**
137
+ * Golem Class Stats
138
+ * @type {WoolWarsClass}
139
+ */
140
+ this.golem = new WoolWarsClass(data?.stats?.classes, 'golem');
141
+ /**
142
+ * Swordsman Class Stats
143
+ * @type {WoolWarsClass}
144
+ */
145
+ this.swordsman = new WoolWarsClass(data?.stats?.classes, 'swordsman');
146
+ /**
147
+ * Engineer Class Stats
148
+ * @type {WoolWarsClass}
149
+ */
150
+ this.engineer = new WoolWarsClass(data?.stats?.classes, 'engineer');
151
+ /**
152
+ * Archer Class Stats
153
+ * @type {WoolWarsClass}
154
+ */
155
+ this.archer = new WoolWarsClass(data?.stats?.classes, 'archer');
156
+ }
157
+ }
158
+ /**
159
+ * Capture The Wool Stats Class
160
+ */
161
+ class CaptureTheWool {
162
+ /**
163
+ * Constructor
164
+ * @param {Record<string, unknown>} data Data from API
165
+ */
166
+ constructor(data) {
167
+ /**
168
+ * kills
169
+ * @type {number}
170
+ */
171
+ this.kills = data?.stats?.kills || 0;
172
+ /**
173
+ * Assists
174
+ * @type {number}
175
+ */
176
+ this.assists = data?.stats?.assists || 0;
177
+ /**
178
+ * Deaths
179
+ * @type {number}
180
+ */
181
+ this.deaths = data?.stats?.deaths || 0;
182
+ /**
183
+ * KDRatio
184
+ * @type {number}
185
+ */
186
+ this.KDRatio = divide(this.kills, this.deaths);
187
+ /**
188
+ * Kills With Wool
189
+ * @type {number}
190
+ */
191
+ this.killsWithWool = data?.stats?.kills_with_wool || 0;
192
+ /**
193
+ * Deaths With Wool
194
+ * @type {number}
195
+ */
196
+ this.deathsWithWool = data?.stats?.deaths_with_wool || 0;
197
+ /**
198
+ * KDRatio With Wool
199
+ * @type {number}
200
+ */
201
+ this.KDRatioWithWool = divide(this.killsWithWool, this.deathsWithWool);
202
+ /**
203
+ * Wool Captured
204
+ * @type {number}
205
+ */
206
+ this.woolCaptured = data?.stats?.wools_captured || 0;
207
+ /**
208
+ * Wool Stolen
209
+ * @type {number}
210
+ */
211
+ this.woolStolen = data?.stats?.wools_stolen || 0;
212
+ /**
213
+ * Wool Capture Stolen Ratio
214
+ * @type {number}
215
+ */
216
+ this.woolCaptureStolenRatio = divide(this.woolCaptured, this.woolStolen);
217
+ }
218
+ }
219
+ /**
220
+ * Sheep Wars Stats Class
221
+ */
222
+ class SheepWars {
223
+ /**
224
+ * Constructor
225
+ * @param {Record<string, unknown>} data Data from API
226
+ */
227
+ constructor(data) {
228
+ /**
229
+ * Wins
230
+ * @type {number}
231
+ */
232
+ this.wins = data?.stats?.wins || 0;
233
+ /**
234
+ * Kills
235
+ * @type {number}
236
+ */
237
+ this.kills = data?.stats?.kills || 0;
238
+ /**
239
+ * Kills Void
240
+ * @type {number}
241
+ */
242
+ this.killsVoid = data?.stats?.kills_void || 0;
243
+ /**
244
+ K kills Bow
245
+ * @type {number}
246
+ */
247
+ this.killsBow = data?.stats?.kills_bow || 0;
248
+ /**
249
+ * Kills Explosive
250
+ * @type {number}
251
+ */
252
+ this.killsExplosive = data?.stats?.kills_explosive || 0;
253
+ /**
254
+ * Deaths
255
+ * @type {number}
256
+ */
257
+ this.deaths = data?.stats?.deaths || 0;
258
+ /**
259
+ * Deaths Void
260
+ * @type {number}
261
+ */
262
+ this.deathsVoid = data?.stats?.deaths_void || 0;
263
+ /**
264
+ * Deaths Melee
265
+ * @type {number}
266
+ */
267
+ this.deathsMelee = data?.stats?.deaths_melee || 0;
268
+ /**
269
+ * Deaths Explosive
270
+ * @type {number}
271
+ */
272
+ this.deathsExplosive = data?.stats?.deaths_explosive || 0;
273
+ /**
274
+ * KDRatio
275
+ * @type {number}
276
+ */
277
+ this.KDRatio = divide(this.wins, this.deaths);
278
+ /**
279
+ * Losses
280
+ * @type {number}
281
+ */
282
+ this.losses = data?.stats?.losses || 0;
283
+ /**
284
+ * WLRatio
285
+ * @type {number}
286
+ */
287
+ this.WLRatio = divide(this.wins, this.losses);
288
+ /**
289
+ * Games Played
290
+ * @type {number}
291
+ */
292
+ this.gamesPlayed = data?.stats?.games_played || 0;
293
+ /**
294
+ * Damage Dealt
295
+ * @type {number}
296
+ */
297
+ this.damageDealt = data?.stats?.damage_dealt || 0;
298
+ /**
299
+ * Sheep Thrown
300
+ * @type {number}
301
+ */
302
+ this.sheepThrown = data?.stats?.sheep_thrown || 0;
303
+ /**
304
+ * Magic Wool Hit
305
+ * @type {number}
306
+ */
307
+ this.magicWoolHit = data?.stats?.magic_wool_hit || 0;
308
+ }
309
+ }
310
+
311
+ /**
312
+ * WoolGames Stats
313
+ */
314
+ class WoolGames {
315
+ /**
316
+ * Constructor
317
+ * @param {Record<string, unknown>} data Data from API
318
+ */
319
+ constructor(data) {
320
+ /**
321
+ * Layers
322
+ * @type {number}
323
+ */
324
+ this.layers = data?.progression?.available_layers || 0;
325
+ /**
326
+ * XP
327
+ * @type {number}
328
+ */
329
+ this.xp = data?.progression?.experience || 0;
330
+ /**
331
+ * Exact Level
332
+ * @type {number}
333
+ */
334
+ this.exactLevel = this.convertXPToLevel(this.xp);
335
+ /**
336
+ * Level
337
+ * @type {number}
338
+ */
339
+ this.level = Math?.floor(this.exactLevel);
340
+ /**
341
+ * Coins
342
+ * @type {number}
343
+ */
344
+ this.coins = data?.coins || 0;
345
+ /**
346
+ * Owned Cosmetics
347
+ * @type {string[]}
348
+ */
349
+ this.ownedCosmetics = data?.packages || [];
350
+ /**
351
+ * Private Games Config
352
+ * @type {WoolGamesPrivateGamesConfig}
353
+ */
354
+ this.privateGamesConfig = data?.privategames || {};
355
+ /**
356
+ * Playtime
357
+ * @type {number}
358
+ */
359
+ this.playtime = data?.playtime || 0;
360
+ /**
361
+ * Wool Wars
362
+ * @type {WoolWars}
363
+ */
364
+ this.woolWars = new WoolWars(data?.wool_wars);
365
+ /**
366
+ * Capture The Wool
367
+ * @type {CaptureTheWool}
368
+ */
369
+ this.captureTheWool = new CaptureTheWool(data?.capture_the_wool);
370
+ /**
371
+ * Sheep Wars
372
+ * @type {SheepWars}
373
+ */
374
+ this.sheepWars = new SheepWars(data?.sheep_wars);
375
+ }
376
+
377
+ /**
378
+ * Converts XP to Level
379
+ * @param {number} exp xp
380
+ * @return {number}
381
+ */
382
+ convertXPToLevel(exp) {
383
+ const minimalExp = [0, 1e3, 3e3, 6e3, 1e4, 15e3];
384
+ const baseLevel = minimalExp.length;
385
+ const baseExp = minimalExp[minimalExp.length - 1];
386
+ const expToLevel100 = 49e4;
387
+ if (exp < baseExp) return minimalExp.findIndex((x) => exp < x);
388
+ const theoreticalLevel = (exp - baseExp) / 5e3 + baseLevel;
389
+ if (100 < theoreticalLevel) return 100 + this.convertXPToLevel(exp - expToLevel100);
390
+ return theoreticalLevel;
391
+ }
392
+ }
393
+
394
+ /**
395
+ * @typedef {object} WoolGamesPrivateGamesConfig
396
+ * @property {boolean} one_hit_one_kill one hit one kill
397
+ * @property {'Enabled' | 'Disabled'} rainbow_wool rainbow wool
398
+ * @property {string} health_buff health buff
399
+ * @property {string} game_speed game speed
400
+ * @property {string} speed speed
401
+ * @property {'Enabled' | 'Disabled'} no_class no class
402
+ * @property {boolean} respawn_enable respawn enable
403
+ */
404
+
405
+ module.exports = WoolGames;
@@ -29,7 +29,7 @@ const Paintball = require('./MiniGames/Paintball');
29
29
  const Quakecraft = require('./MiniGames/Quakecraft');
30
30
  const Walls = require('./MiniGames/Walls');
31
31
  const Warlords = require('./MiniGames/Warlords');
32
- const WoolWars = require('./MiniGames/WoolWars');
32
+ const WoolGames = require('./MiniGames/WoolGames');
33
33
  const Pit = require('./MiniGames/Pit');
34
34
  const Guild = require('./Guild/Guild');
35
35
  const RecentGame = require('./RecentGame');
@@ -240,7 +240,7 @@ class Player {
240
240
  vampirez: data.stats.VampireZ ? new VampireZ(data.stats.VampireZ) : null,
241
241
  walls: data.stats.Walls ? new Walls(data.stats.Walls) : null,
242
242
  warlords: data.stats.Battleground ? new Warlords(data.stats.Battleground) : null,
243
- woolwars: data.stats.WoolGames ? new WoolWars(data.stats.WoolGames) : null
243
+ woolgames: data.stats.WoolGames ? new WoolGames(data.stats.WoolGames) : null
244
244
  }
245
245
  : null;
246
246
  /**
@@ -325,7 +325,7 @@ class Player {
325
325
  * @property {VampireZ|null} vampirez VampireZ
326
326
  * @property {Walls|null} walls Walls
327
327
  * @property {Warlords|null} warlords Warlords
328
- * @property {WoolWars|null} woolwars Wool Wars
328
+ * @property {WoolGames|null} woolgames Wool Games
329
329
  */
330
330
  /**
331
331
  * @typedef {Object} RanksPurchaseTime
@@ -32,7 +32,10 @@ class BaseAuction {
32
32
  * Item bytes
33
33
  * @type {ItemBytes|null}
34
34
  */
35
- this.itemBytes = includeItemBytes ? new ItemBytes(data.item_bytes) : null;
35
+ this.itemBytes =
36
+ includeItemBytes && data.item_bytes
37
+ ? new ItemBytes(data.item_bytes.data ? data.item_bytes.data : data.item_bytes)
38
+ : null;
36
39
  }
37
40
  /**
38
41
  * Auction ID
@@ -14,7 +14,7 @@ class SkyblockMuseumItem {
14
14
  this.name = data.name;
15
15
  /**
16
16
  * Item
17
- * @type {SkyblockInventoryItem}
17
+ * @type {SkyblockInventoryItem[]}
18
18
  */
19
19
  this.items = [];
20
20
  data.decoded.forEach((item) => {
@@ -104,7 +104,7 @@ module.exports = {
104
104
  25: 19050
105
105
  },
106
106
  skillsCap: {
107
- taming: 50,
107
+ taming: 60,
108
108
  farming: 60,
109
109
  mining: 60,
110
110
  combat: 60,
@@ -8,6 +8,7 @@ function parseDate(date) {
8
8
  }
9
9
 
10
10
  function parseHistory(historyData) {
11
+ const expValuesReversed = Object.values(historyData).reverse();
11
12
  return Object.entries(historyData).map((x, index) => ({
12
13
  day: x[0],
13
14
  date:
@@ -18,9 +19,7 @@ function parseHistory(historyData) {
18
19
  .map((x) => parseInt(x, 10))
19
20
  ) || undefined,
20
21
  exp: x[1] || 0,
21
- totalExp: Object.values(historyData)
22
- .slice(0, index + 1)
23
- .reduce((pV, cV) => pV + cV, 0)
22
+ totalExp: expValuesReversed.slice(0, expValuesReversed.length - index).reduce((pV, cV) => pV + cV)
24
23
  }));
25
24
  }
26
25
 
@@ -579,7 +579,7 @@ declare module 'hypixel-api-reborn' {
579
579
  25: 19050;
580
580
  };
581
581
  skillsCap: {
582
- taming: 50;
582
+ taming: 60;
583
583
  farming: 60;
584
584
  mining: 60;
585
585
  combat: 60;
@@ -1424,7 +1424,7 @@ declare module 'hypixel-api-reborn' {
1424
1424
  walls?: Walls;
1425
1425
  warlords?: Warlords;
1426
1426
  arcade?: Arcade;
1427
- woolwars?: WoolWars;
1427
+ woolgames?: WoolGames;
1428
1428
  pit?: Pit;
1429
1429
  };
1430
1430
  getRecentGames(): Promise<RecentGame[]>;
@@ -1474,49 +1474,71 @@ declare module 'hypixel-api-reborn' {
1474
1474
  extraAttributes: string | null;
1475
1475
  toString(): string;
1476
1476
  }
1477
- class WoolWars {
1478
- static convertXPToLevel(exp: number): number;
1479
- static generateStatsFor(data: Record<string, unknown>, _class?: string | undefined): WoolWarsStats;
1477
+ class WoolWarsClass {
1480
1478
  constructor(data: Record<string, unknown>);
1481
- layers: number;
1482
- xp: number;
1483
- exactLevel: number;
1484
- level: number;
1485
- coins: number;
1486
1479
  wins: number;
1480
+ kills: number;
1481
+ assists: number;
1482
+ deaths: number;
1483
+ KDRatio: number;
1487
1484
  gamesPlayed: number;
1488
1485
  woolsPlaced: number;
1489
1486
  blocksBroken: number;
1490
1487
  placeBreakRatio: number;
1491
- kills: number;
1492
- deaths: number;
1493
- KDRatio: number;
1494
- assists: number;
1495
1488
  powerups: number;
1496
- selectedClass: 'ASSAULT' | 'TANK' | 'GOLEM' | 'SWORDSMAN' | 'ENGINEER' | 'ARCHER' | 'NONE';
1497
- stats: {
1498
- assault: WoolWarsStats;
1499
- tank: WoolWarsStats;
1500
- golem: WoolWarsStats;
1501
- swordsman: WoolWarsStats;
1502
- engineer: WoolWarsStats;
1503
- archer: WoolWarsStats;
1504
- };
1505
- ownedCosmetics: string[];
1506
- privateGamesConfig: PrivateGamesConfig;
1507
1489
  }
1508
- type WoolWarsStats = {
1490
+ class WoolWars {
1491
+ constructor(data: Record<string, unknown>);
1492
+ selectedClass: 'ASSAULT' | 'TANK' | 'GOLEM' | 'SWORDSMAN' | 'ENGINEER' | 'ARCHER' | 'NONE';
1509
1493
  wins: number;
1494
+ kills: number;
1495
+ assists: number;
1496
+ deaths: number;
1497
+ KDRatio: number;
1510
1498
  gamesPlayed: number;
1511
1499
  woolsPlaced: number;
1512
1500
  blocksBroken: number;
1513
1501
  placeBreakRatio: number;
1502
+ powerups: number;
1503
+ assault: WoolWarsClass;
1504
+ tank: WoolWarsClass;
1505
+ golem: WoolWarsClass;
1506
+ swordsman: WoolWarsClass;
1507
+ engineer: WoolWarsClass;
1508
+ archer: WoolWarsClass;
1509
+ }
1510
+ class CaptureTheWool {
1511
+ constructor(data: Record<string, unknown>);
1514
1512
  kills: number;
1513
+ assists: number;
1515
1514
  deaths: number;
1516
1515
  KDRatio: number;
1517
- assists: number;
1518
- powerups: number;
1519
- };
1516
+ killsWithWool: number;
1517
+ deathsWithWool: number;
1518
+ KDRatioWithWool: number;
1519
+ woolCaptured: number;
1520
+ woolStolen: number;
1521
+ woolCaptureStolenRatio: number;
1522
+ }
1523
+ class SheepWars {
1524
+ constructor(data: Record<string, unknown>);
1525
+ wins: number;
1526
+ kills: number;
1527
+ killsVoid: number;
1528
+ killsBow: number;
1529
+ killsExplosive: number;
1530
+ deaths: number;
1531
+ deathsVoid: number;
1532
+ deathsMelee: number;
1533
+ deathsExplosive: number;
1534
+ KDRatio: number;
1535
+ losses: number;
1536
+ WLRatio: number;
1537
+ gamesPlayed: number;
1538
+ damageDealt: number;
1539
+ sheepThrown: number;
1540
+ magicWoolHit: number;
1541
+ }
1520
1542
  type PrivateGamesConfig = {
1521
1543
  one_hit_one_kill: boolean;
1522
1544
  rainbow_wool: 'Enabled' | 'Disabled';
@@ -1526,6 +1548,20 @@ declare module 'hypixel-api-reborn' {
1526
1548
  no_class: 'Enabled' | 'Disabled';
1527
1549
  respawn_enable: boolean;
1528
1550
  };
1551
+ class WoolGames {
1552
+ constructor(data: Record<string, unknown>);
1553
+ layers: number;
1554
+ xp: number;
1555
+ exactLevel: number;
1556
+ level: number;
1557
+ coins: number;
1558
+ ownedCosmetics: string[];
1559
+ privateGamesConfig: PrivateGamesConfig;
1560
+ playtime: number;
1561
+ woolWars: WoolWars;
1562
+ captureTheWool: CaptureTheWool;
1563
+ sheepWars: SheepWars;
1564
+ }
1529
1565
  class PlayerCosmetics {
1530
1566
  constructor(data: Record<string, unknown>);
1531
1567
  allCosmetics: string[];
@@ -1805,7 +1841,6 @@ declare module 'hypixel-api-reborn' {
1805
1841
  flashDisabled: boolean;
1806
1842
  blockingDead: BlockingDead;
1807
1843
  bountyHunters: BountyHunters;
1808
- captureTheWool: CaptureTheWool;
1809
1844
  dragonWars: DragonWars;
1810
1845
  dropper: Dropper;
1811
1846
  enderSpleef: EnderSpleef;
@@ -1835,21 +1870,6 @@ declare module 'hypixel-api-reborn' {
1835
1870
  bowKills: number;
1836
1871
  swordKills: number;
1837
1872
  }
1838
- class CaptureTheWool {
1839
- constructor(data: Record<string, unknown>);
1840
- wins: number;
1841
- losses: number;
1842
- WLRatio: number;
1843
- draws: number;
1844
- kills: number;
1845
- deaths: number;
1846
- KDRatio: number;
1847
- assists: number;
1848
- woolPickedUp: number;
1849
- woolCaptured: number;
1850
- fastestWin: number;
1851
- longestGame: number;
1852
- }
1853
1873
  class DragonWars {
1854
1874
  constructor(data: Record<string, unknown>);
1855
1875
  wins: number;
@@ -1914,7 +1934,7 @@ declare module 'hypixel-api-reborn' {
1914
1934
  attackerKills: number;
1915
1935
  defenderKills: number;
1916
1936
  }
1917
- class PartyPopper {
1937
+ class PartyPooper {
1918
1938
  constructor(data: Record<string, unknown>);
1919
1939
  winsAsSeeker: number;
1920
1940
  winsAsHider: number;
@@ -1928,7 +1948,7 @@ declare module 'hypixel-api-reborn' {
1928
1948
  }
1929
1949
  class HideAndSeek {
1930
1950
  constructor(data: Record<string, unknown>);
1931
- partyPopper: PartyPopper;
1951
+ partyPooper: PartyPooper;
1932
1952
  propHunt: PropHunt;
1933
1953
  winsAsSeeker: number;
1934
1954
  winsAsHider: number;
@@ -2632,6 +2652,21 @@ declare module 'hypixel-api-reborn' {
2632
2652
  candyUsed: number;
2633
2653
  skin: string | null;
2634
2654
  }
2655
+ class SkyblockMuseumItem {
2656
+ constructor(data: Record<string, unknown>);
2657
+ name: string | null;
2658
+ items: SkyblockInventoryItem[];
2659
+ donatedTime: number;
2660
+ donatedTimeAt: Date;
2661
+ borrowing: boolean;
2662
+ featuredSlot: string | null;
2663
+ }
2664
+ class SkyblockMuseum {
2665
+ constructor(data: Record<string, unknown>);
2666
+ raw: object;
2667
+ getWardrobe(): Promise<SkyblockMuseumItem[]>;
2668
+ getWardrobe(): Promise<SkyblockMuseumItem[]>;
2669
+ }
2635
2670
  class SkyblockGarden {
2636
2671
  constructor(data: Record<string, unknown>);
2637
2672
  level: SKYBLOCK_SKILL_DATA;
@@ -2721,11 +2756,14 @@ declare module 'hypixel-api-reborn' {
2721
2756
  mages: number;
2722
2757
  };
2723
2758
  trophyFish: {
2724
- total: number;
2725
- bronze: number;
2726
- silver: number;
2727
- gold: number;
2728
- diamond: number;
2759
+ rank: 'Diamond' | 'Gold' | 'Silver' | 'Bronze' | null;
2760
+ caught: {
2761
+ total: number;
2762
+ bronze: number;
2763
+ silver: number;
2764
+ gold: number;
2765
+ diamond: number;
2766
+ };
2729
2767
  };
2730
2768
  kuudra: {
2731
2769
  none: number;
@@ -2772,14 +2810,14 @@ declare module 'hypixel-api-reborn' {
2772
2810
  selected: string;
2773
2811
  };
2774
2812
  essence: {
2775
- diamond: numer;
2776
- dragon: numer;
2777
- spider: numer;
2778
- wither: numer;
2779
- undead: numer;
2780
- gold: numer;
2781
- ice: numer;
2782
- crimson: numer;
2813
+ diamond: number;
2814
+ dragon: number;
2815
+ spider: number;
2816
+ wither: number;
2817
+ undead: number;
2818
+ gold: number;
2819
+ ice: number;
2820
+ crimson: number;
2783
2821
  };
2784
2822
  } | null;
2785
2823
  collections: object;
@@ -1,174 +0,0 @@
1
- const { divide } = require('../../utils');
2
-
3
- /**
4
- * Wool Wars Class
5
- */
6
- class WoolWars {
7
- /**
8
- * Constructor
9
- * @param {Record<string,unknown>} data Data from API
10
- */
11
- constructor(data) {
12
- /**
13
- * Sheep layers, similar to prestige
14
- * @type {number}
15
- */
16
- this.layers = data.progression?.available_layers || 0;
17
- /**
18
- * Wool Wars XP
19
- * @type {number}
20
- */
21
- this.xp = data.progression?.experience || 0;
22
- /**
23
- * Wool Wars Decimal Level
24
- * @type {number}
25
- */
26
- this.exactLevel = WoolWars.convertXPToLevel(this.xp);
27
- /**
28
- * Wool wars level (as shown in game)
29
- * @type {number}
30
- */
31
- this.level = Math.floor(this.exactLevel);
32
- /**
33
- * Coins
34
- * @type {number}
35
- */
36
- this.coins = data.coins || 0;
37
- /**
38
- * Wins
39
- * @type {number}
40
- */
41
- this.wins = data.wins || 0;
42
- /**
43
- * gamesPlayed
44
- * @type {number}
45
- */
46
- this.gamesPlayed = data.games_played || 0;
47
- /**
48
- * woolsPlaced
49
- * @type {number}
50
- */
51
- this.woolsPlaced = data.wool_placed || 0;
52
- /**
53
- * blocksBroken
54
- * @type {number}
55
- */
56
- this.blocksBroken = data.blocks_broken || 0;
57
- /**
58
- * placeBreakRatio
59
- * @type {number}
60
- */
61
- this.placeBreakRatio = divide(this.woolsPlaced, this.blocksBroken);
62
- /**
63
- * kills
64
- * @type {number}
65
- */
66
- this.kills = data.kills || 0;
67
- /**
68
- * deaths
69
- * @type {number}
70
- */
71
- this.deaths = data.deaths || 0;
72
- /**
73
- * KDRatio
74
- * @type {number}
75
- */
76
- this.KDRatio = divide(this.kills, this.deaths);
77
- /**
78
- * assists
79
- * @type {number}
80
- */
81
- this.assists = data.assists || 0;
82
- /**
83
- * powerups
84
- * @type {number}
85
- */
86
- this.powerups = data.powerups_gotten || 0;
87
- /**
88
- * Selected class, or NONE if field isn't present in API for some reason
89
- * @type {'ASSAULT'|'TANK'|'GOLEM'|'SWORDSMAN'|'ENGINEER'|'ARCHER'|'NONE'}
90
- */
91
- this.selectedClass = data.wool_wars?.selected_class || 'NONE';
92
- this.stats = {
93
- assault: WoolWars.generateStatsFor(data.wool_wars?.stats, 'assault'),
94
- tank: WoolWars.generateStatsFor(data.wool_wars?.stats, 'tank'),
95
- golem: WoolWars.generateStatsFor(data.wool_wars?.stats, 'golem'),
96
- swordsman: WoolWars.generateStatsFor(data.wool_wars?.stats, 'swordsman'),
97
- engineer: WoolWars.generateStatsFor(data.wool_wars?.stats, 'engineer'),
98
- archer: WoolWars.generateStatsFor(data.wool_wars?.stats, 'archer')
99
- };
100
- /**
101
- * Owned Cosmetics
102
- * @type {string[]}
103
- */
104
- this.ownedCosmetics = data.packages || [];
105
- /**
106
- * Private Games config
107
- * @type {PrivateGamesConfig}
108
- */
109
- this.privateGamesConfig = data.privategames || {};
110
- }
111
- /**
112
- * Converts XP to Level
113
- * @param {number} exp xp
114
- * @return {number}
115
- */
116
- static convertXPToLevel(exp) {
117
- const minimalExp = [0, 1e3, 3e3, 6e3, 1e4, 15e3];
118
- const baseLevel = minimalExp.length;
119
- const baseExp = minimalExp[minimalExp.length - 1];
120
- const expToLevel100 = 49e4;
121
- if (exp < baseExp) return minimalExp.findIndex((x) => exp < x);
122
- const theoreticalLevel = (exp - baseExp) / 5e3 + baseLevel;
123
- if (100 < theoreticalLevel) return 100 + this.convertXPToLevel(exp - expToLevel100);
124
- return theoreticalLevel;
125
- }
126
- /**
127
- * Generates stats per class/overall
128
- * @param {Record<string, any>} data data
129
- * @param {string} [_class=''] Class
130
- * @return {WoolWarsStats}
131
- */
132
- static generateStatsFor(data, _class) {
133
- // N.B i called it _class instead of class because reserved keyword
134
-
135
- // eslint-disable-next-line no-underscore-dangle
136
- const workingData = (_class ? data?.classes?.[_class] : data) || {};
137
- return {
138
- wins: workingData.wins || 0,
139
- gamesPlayed: workingData.games_played || 0,
140
- woolsPlaced: workingData.wool_placed || 0,
141
- blocksBroken: workingData.blocks_broken || 0,
142
- placeBreakRatio: divide(workingData.wool_placed || 0, workingData.blocks_broken || 0),
143
- kills: workingData.kills || 0,
144
- deaths: workingData.deaths || 0,
145
- KDRatio: divide(workingData.kills, workingData.deaths),
146
- assists: workingData.assists || 0,
147
- powerups: workingData.powerups_gotten || 0
148
- };
149
- }
150
- }
151
- /**
152
- * @typedef {Object} PrivateGamesConfig NB. There could be more fields
153
- * @property {boolean} one_hit_one_kill One hit one kill
154
- * @property {'Enabled'|'Disabled'} rainbow_wool Rainbow wool
155
- * @property {string} health_buff Health Buff
156
- * @property {string} game_speed Game speed
157
- * @property {string} speed Player speed
158
- * @property {'Enabled'|'Disabled'} no_class No class
159
- * @property {boolean} respawn_enable Respawning enabled
160
- */
161
- /**
162
- * @typedef {Object} WoolWarsStats
163
- * @property {number} wins wins
164
- * @property {number} gamesPlayed games played
165
- * @property {number} woolsPlaced wools placed
166
- * @property {number} blocksBroken blocks broken
167
- * @property {number} placeBreakRatio broken blocks to placed wool ratio
168
- * @property {number} kills kills
169
- * @property {number} deaths deaths
170
- * @property {number} KDRatio KDR
171
- * @property {number} assists assists (not included in KDR)
172
- * @property {number} powerups number of powerups picked up
173
- */
174
- module.exports = WoolWars;