hypixel-api-reborn 11.2.1 → 11.3.0

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 (37) 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/getGarden.js +7 -0
  7. package/src/API/skyblock/getMember.js +4 -2
  8. package/src/API/skyblock/getProfiles.js +4 -2
  9. package/src/Client.js +46 -2
  10. package/src/Private/requests.js +1 -1
  11. package/src/index.js +5 -0
  12. package/src/structures/House.js +54 -0
  13. package/src/structures/MiniGames/Arcade.js +754 -270
  14. package/src/structures/MiniGames/ArenaBrawl.js +97 -31
  15. package/src/structures/MiniGames/BlitzSurvivalGames.js +378 -127
  16. package/src/structures/MiniGames/BuildBattle.js +19 -8
  17. package/src/structures/MiniGames/CopsAndCrims.js +252 -25
  18. package/src/structures/MiniGames/Duels.js +899 -656
  19. package/src/structures/MiniGames/MegaWalls.js +390 -51
  20. package/src/structures/MiniGames/MurderMystery.js +151 -30
  21. package/src/structures/MiniGames/Paintball.js +31 -11
  22. package/src/structures/MiniGames/Quakecraft.js +113 -50
  23. package/src/structures/MiniGames/SkyWars.js +340 -195
  24. package/src/structures/MiniGames/SmashHeroes.js +195 -69
  25. package/src/structures/MiniGames/SpeedUHC.js +76 -36
  26. package/src/structures/MiniGames/TNTGames.js +242 -73
  27. package/src/structures/MiniGames/TurboKartRacers.js +55 -115
  28. package/src/structures/MiniGames/UHC.js +135 -124
  29. package/src/structures/MiniGames/VampireZ.js +70 -37
  30. package/src/structures/MiniGames/Warlords.js +126 -1
  31. package/src/structures/MiniGames/WoolWars.js +54 -4
  32. package/src/structures/Player.js +30 -24
  33. package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
  34. package/src/structures/SkyBlock/SkyblockMember.js +12 -5
  35. package/src/utils/Constants.js +507 -5
  36. package/src/utils/SkyblockUtils.js +33 -0
  37. package/typings/index.d.ts +911 -802
@@ -13,50 +13,505 @@ function parseZombiesKills(data) {
13
13
  return Object.fromEntries(matches.map((x) => [removeSnakeCaseString(x[1]), data[x[0]] || 0]));
14
14
  }
15
15
  /**
16
- * Most basic game class, used by all arcade games
16
+ * Zombies - Stats by Map + Difficulty
17
+ */
18
+ class ZombiesStats {
19
+ /**
20
+ * Constructor
21
+ * @param {Object} data Data from API
22
+ * @param {string} type Map name + difficulty ( default overall )
23
+ */
24
+ constructor(data, type = '') {
25
+ if (type) type = `_${type}`;
26
+ /**
27
+ * Best Round
28
+ * @type {number}
29
+ */
30
+ this.bestRound = data[`best_round_zombies${type}`] || 0;
31
+ /**
32
+ * Deaths ( NOT losses )
33
+ * @type {number}
34
+ */
35
+ this.deaths = data[`deaths_zombies${type}`] || 0;
36
+ /**
37
+ * Doors opened
38
+ * @type {number}
39
+ */
40
+ this.doorsOpened = data[`doors_opened_zombies${type}`] || 0;
41
+ /**
42
+ * Fastest time to reach round 10 in seconds
43
+ * @type {number}
44
+ */
45
+ this.fastestRound10 = data[`fastest_time_10_zombies${type}_normal`] || 0;
46
+ /**
47
+ * Fastest time to reach round 20 in seconds
48
+ * @type {number}
49
+ */
50
+ this.fastestRound20 = data[`fastest_time_20_zombies${type}_normal`] || 0;
51
+ /**
52
+ * Fastest time to reach round 30 in seconds
53
+ * @type {number}
54
+ */
55
+ this.fastestRound30 = data[`fastest_time_30_zombies${type}_normal`] || 0;
56
+ /**
57
+ * Players revived
58
+ * @type {number}
59
+ */
60
+ this.playersRevived = data[`players_revived_zombies${type}`] || 0;
61
+ /**
62
+ * Number of times player is knocked down
63
+ * @type {number}
64
+ */
65
+ this.timesKnockedDown = data[`times_knocked_down_zombies${type}`] || 0;
66
+ /**
67
+ * Total amount of rounds the player survived
68
+ * @type {number}
69
+ */
70
+ this.roundsSurvived = data[`total_rounds_survived_zombies${type}`] || 0;
71
+ /**
72
+ * Total amount of windows fully repaired by player
73
+ * @type {number}
74
+ */
75
+ this.windowsRepaired = data[`windows_repaired_zombies${type}`] || 0;
76
+ /**
77
+ * Wins
78
+ * @type {number}
79
+ */
80
+ this.wins = data[`wins_zombies${type}`] || 0;
81
+ /**
82
+ * Total Zombie Kills
83
+ * @type {number}
84
+ */
85
+ this.zombieKills = data[`zombie_kills_zombies${type}`] || 0;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Zombies - Overall stats
91
+ */
92
+ class Zombies {
93
+ /**
94
+ * Constructor
95
+ * @param {Object} data Data from API
96
+ */
97
+ constructor(data) {
98
+ /**
99
+ * Overall Stats
100
+ * @type {ZombiesStats}
101
+ */
102
+ this.overall = new ZombiesStats(data);
103
+ /**
104
+ * Stats for Dead End
105
+ * @type {ZombiesStats}
106
+ */
107
+ this.deadEnd = new ZombiesStats(data, 'deadend');
108
+ /**
109
+ * Stats for Bad Blood
110
+ * @type {ZombiesStats}
111
+ */
112
+ this.badBlood = new ZombiesStats(data, 'badblood');
113
+ /**
114
+ * Stats for Alien Arcadium
115
+ * @type {ZombiesStats}
116
+ */
117
+ this.alienArcadium = new ZombiesStats(data, 'alienarcadium');
118
+ /**
119
+ * Stats for Prison
120
+ * @type {ZombiesStats}
121
+ */
122
+ this.prison = new ZombiesStats(data, 'prison');
123
+ /**
124
+ * Kills By Zombie
125
+ * @type {Record<string, number>}
126
+ */
127
+ this.killsByZombie = parseZombiesKills(data);
128
+ /**
129
+ * Bullets Hit
130
+ * @type {number}
131
+ */
132
+ this.bulletsHit = data.bullets_hit_zombies || 0;
133
+ /**
134
+ * Bullets Shot
135
+ * @type {number}
136
+ */
137
+ this.bulletsShot = data.bullets_shot_zombies || 0;
138
+ /**
139
+ * Gun Accuracy
140
+ * @type {number}
141
+ */
142
+ this.gunAccuracy = divide(this.bulletsHit, this.bulletsShot);
143
+ /**
144
+ * Headshots
145
+ * @type {number}
146
+ */
147
+ this.headshots = data.headshots_zombies || 0;
148
+ /**
149
+ * Headshot Accuracy
150
+ * @type {number}
151
+ */
152
+ this.headshotAccuracy = divide(this.headshots, this.bulletsShot);
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Dropper stats by map
158
+ */
159
+ class DropperMap {
160
+ /**
161
+ * Constructor
162
+ * @param {Object} data Data from API
163
+ * @param {string} mapName String map name
164
+ */
165
+ constructor(data, mapName) {
166
+ /**
167
+ * Best Complete Time
168
+ * @type {number}
169
+ */
170
+ this.bestTime = data?.[mapName]?.best_time ?? 0;
171
+ /**
172
+ * Total completions
173
+ * @type {number}
174
+ */
175
+ this.completions = data?.[mapName]?.completions ?? 0;
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Blocking Dead class
181
+ */
182
+ class BlockingDead {
183
+ constructor(data) {
184
+ /**
185
+ * Wins
186
+ * @type {number}
187
+ */
188
+ this.wins = data.wins_dayone || 0;
189
+ /**
190
+ * Kills
191
+ * @type {number}
192
+ */
193
+ this.kills = data.kills_dayone || 0;
194
+ /**
195
+ * Headshots
196
+ * @type {number}
197
+ */
198
+ this.headshots = data.headshots_dayone || 0;
199
+ }
200
+ }
201
+ /**
202
+ * Bounty Hunters class
203
+ */
204
+ class BountyHunters {
205
+ constructor(data) {
206
+ /**
207
+ * Wins
208
+ * @type {number}
209
+ */
210
+ this.wins = data.wins_oneinthequiver || 0;
211
+ /**
212
+ * Kills
213
+ * @type {number}
214
+ */
215
+ this.kills = data.kills_oneinthequiver || 0;
216
+ /**
217
+ * Deaths
218
+ * @type {number}
219
+ */
220
+ this.deaths = data.deaths_oneinthequiver || 0;
221
+ /**
222
+ * Kill Death Ratio
223
+ * @type {number}
224
+ */
225
+ this.KDRatio = divide(this.kills, this.deaths);
226
+ /**
227
+ * Bounty Kills
228
+ * @type {number}
229
+ */
230
+ this.bountyKills = data.bounty_kills_oneinthequiver || 0;
231
+ /**
232
+ * Bow Kills
233
+ * @type {number}
234
+ */
235
+ this.bowKills = data.bow_kills_oneinthequiver || 0;
236
+ /**
237
+ * Sword Kills
238
+ * @type {number}
239
+ */
240
+ this.swordKills = data.sword_kills_oneinthequiver || 0;
241
+ }
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
+ /**
311
+ * Dragon Wars class
312
+ */
313
+ class DragonWars {
314
+ constructor(data) {
315
+ /**
316
+ * Wins
317
+ * @type {number}
318
+ */
319
+ this.wins = data.wins_dragonwars2 || 0;
320
+ /**
321
+ * Kills
322
+ * @type {number}
323
+ */
324
+ this.kills = data.kills_dragonwars2 || 0;
325
+ }
326
+ }
327
+ /**
328
+ * Dropper class
329
+ */
330
+ class Dropper {
331
+ constructor(data) {
332
+ /**
333
+ * Total Wins
334
+ * @type {number}
335
+ */
336
+ this.wins = data?.wins ?? 0;
337
+ /**
338
+ * Total Fails
339
+ * @type {number}
340
+ */
341
+ this.fails = data?.fails ?? 0;
342
+ /**
343
+ * Fastest Game
344
+ * @type {number}
345
+ */
346
+ this.fastestGame = data?.fastest_game ?? 0;
347
+ /**
348
+ * Total Amount of Flawless Games
349
+ * @type {number}
350
+ */
351
+ this.flawlessGames = data?.flawless_games ?? 0;
352
+ /**
353
+ * Total Amount of Games Played
354
+ * @type {number}
355
+ */
356
+ this.gamesPlayed = data?.games_played ?? 0;
357
+ /**
358
+ * Total Amount of Maps Completed
359
+ * @type {number}
360
+ */
361
+ this.mapsCompleted = data?.maps_completed ?? 0;
362
+ /**
363
+ * Total Amount of Games Finished
364
+ * @type {number}
365
+ */
366
+ this.gamesFinished = data?.games_finished ?? 0;
367
+ /**
368
+ * Maps
369
+ * @type {Object.<string, DropperMap>}
370
+ */
371
+ this.maps = {};
372
+ Object.keys(data?.map_stats ?? {}).forEach((map) => {
373
+ this.maps[map] = new DropperMap(data?.map_stats, map);
374
+ });
375
+ }
376
+ }
377
+ /**
378
+ * Ender Spleef class
379
+ */
380
+ class EnderSpleef {
381
+ constructor(data) {
382
+ /**
383
+ * Wins
384
+ * @type {number}
385
+ */
386
+ this.wins = data.wins_ender || 0;
387
+ /**
388
+ * Kills
389
+ * @type {number}
390
+ */
391
+ this.kills = data.kills_dragonwars2 || 0;
392
+ /**
393
+ * Trail
394
+ * @type {string}
395
+ */
396
+ this.trail = data.enderspleef_trail || '';
397
+ /**
398
+ * Blocks Destroyed
399
+ * @type {number}
400
+ */
401
+ this.blocksDestroyed = data.blocks_destroyed_ender || 0;
402
+ /**
403
+ * Big Shot Activations
404
+ * @type {number}
405
+ */
406
+ this.bigShotActivations = data.bigshot_powerup_activations_ender || 0;
407
+ /**
408
+ * Triple Shot Activations
409
+ * @type {number}
410
+ */
411
+ this.tripleShotActivations = data.tripleshot_powerup_activations_ender || 0;
412
+ /**
413
+ * Total Powerup Activations
414
+ * @type {number}
415
+ */
416
+ this.totalPowerUpActivations = this.bigShotActivations + this.tripleShotActivations;
417
+ }
418
+ }
419
+ /**
420
+ * Farm Hunt class
421
+ */
422
+ class FarmHunt {
423
+ constructor(data) {
424
+ /**
425
+ * Wins
426
+ * @type {number}
427
+ */
428
+ this.wins = data.wins_farm_hunt || 0;
429
+ /**
430
+ * Wins as Animal
431
+ * @type {number}
432
+ */
433
+ this.winsAsAnimal = data.animal_wins_farm_hunt || 0;
434
+ /**
435
+ * Wins as Hunter
436
+ * @type {number}
437
+ */
438
+ this.winsAsHunter = data.hunter_wins_farm_hunt || 0;
439
+ /**
440
+ * Kills
441
+ * @type {number}
442
+ */
443
+ this.kills = data.kills_farm_hunt || 0;
444
+ /**
445
+ * Kills as Animal
446
+ * @type {number}
447
+ */
448
+ this.killsAsAnimal = data.animal_kills_farm_hunt || 0;
449
+ /**
450
+ * Kills as Hunter
451
+ * @type {number}
452
+ */
453
+ this.killsAsHunter = data.hunter_kills_farm_hunt || 0;
454
+ /**
455
+ * Taunts Used
456
+ * @type {number}
457
+ */
458
+ this.tauntsUsed = data.taunts_used_farm_hunt || 0;
459
+ /**
460
+ * Risky Taunts Used
461
+ * @type {number}
462
+ */
463
+ this.riskyTauntsUsed = data.risky_taunts_used_farm_hunt || 0;
464
+ /**
465
+ * Safe Taunts Used
466
+ * @type {number}
467
+ */
468
+ this.safeTauntsUsed = data.safe_taunts_used_farm_hunt || 0;
469
+ /**
470
+ * Dangerous Taunts Used
471
+ * @type {number}
472
+ */
473
+ this.dangerousTauntsUsed = data.dangerous_taunts_used_farm_hunt || 0;
474
+ /**
475
+ * Firework Taunts Used
476
+ * @type {number}
477
+ */
478
+ this.fireworkTauntsUsed = data.firework_taunts_used_farm_hunt || 0;
479
+ /**
480
+ * Poop Collected
481
+ * @type {number}
482
+ */
483
+ this.poop = (data.poop_collected_farm_hunt || 0) + (data.poop_collected || 0);
484
+ }
485
+ }
486
+ /**
487
+ * Football class
17
488
  */
18
- class BaseGame {
19
- /**
20
- * @param {Object} data data
21
- * @param {string} gameName Game Name ( snake )
22
- */
23
- constructor(data, gameName) {
489
+ class Football {
490
+ constructor(data) {
24
491
  /**
25
492
  * Wins
26
- * @type {?number}
493
+ * @type {number}
27
494
  */
28
- this.wins = parseInt(data['wins_' + gameName], 10) || 0;
495
+ this.wins = data.wins_soccer || 0;
29
496
  /**
30
- * Kills, only available in combat games
31
- * @type {?number}
497
+ * Goals
498
+ * @type {number}
32
499
  */
33
- this.kills = parseInt(data['kills_' + gameName], 10) || 0;
500
+ this.goals = data.goals_soccer || 0;
34
501
  /**
35
- * Deaths, only available in combat games
36
- * @type {?number}
502
+ * Kikcs
503
+ * @type {number}
37
504
  */
38
- this.deaths = parseInt(data['deaths_' + gameName], 10) || 0;
505
+ this.kicks = data.kicks_soccer || 0;
39
506
  /**
40
- * Rounds Played, only available in Santa says, Simon Says, and HITW
41
- * @type {?number}
507
+ * Power Kicks
508
+ * @type {number}
42
509
  */
43
- this.roundsPlayed = parseInt(data['rounds_' + gameName], 10) || 0;
44
- }
45
- /**
46
- * Extend BaseGame without creating a new class
47
- * @param {string} name Property to add
48
- * @param {*} value Corresponding value
49
- * @private
50
- * @returns {BaseGame}
51
- */
52
- extend(name, value) {
53
- this[name] = value;
54
- return this;
510
+ this.powerKicks = data.powerkicks_soccer || 0;
55
511
  }
56
512
  }
57
-
58
513
  /**
59
- * Galxy Wars, aka sw class, totally different from normal stats
514
+ * Galxy Wars
60
515
  */
61
516
  class GalaxyWars {
62
517
  /**
@@ -106,270 +561,378 @@ class GalaxyWars {
106
561
  }
107
562
  }
108
563
  /**
109
- * Soccer class
564
+ * Party Popper Stats (Sub gamemode of Hide and Seek)
110
565
  */
111
- class Soccer {
566
+ class PartyPopper {
112
567
  /**
113
568
  * @param {Object} data Data from API
114
569
  */
115
570
  constructor(data) {
571
+ /**
572
+ * Wins as Seeker
573
+ * @type {number}
574
+ */
575
+ this.winsAsSeeker = data.party_pooper_seeker_wins_hide_and_seek || 0;
576
+ /**
577
+ * Wins as Hider
578
+ * @type {number}
579
+ */
580
+ this.winsAsHider = data.party_pooper_hider_wins_hide_and_seek || 0;
116
581
  /**
117
582
  * Wins
118
583
  * @type {number}
119
584
  */
120
- this.wins = data.wins_soccer || 0;
585
+ this.wins = this.winsAsSeeker + this.winsAsHider;
586
+ }
587
+ }
588
+ /**
589
+ * Prop Hunt Stats (Sub gamemode of Hide and Seek)
590
+ */
591
+ class PropHunt {
592
+ /**
593
+ * @param {Object} data Data from API
594
+ */
595
+ constructor(data) {
121
596
  /**
122
- * Number of Kicks
597
+ * Wins as Seeker
123
598
  * @type {number}
124
599
  */
125
- this.kicks = data.kicks_soccer || 0;
600
+ this.winsAsSeeker = data.prop_hunt_seeker_wins_hide_and_seek || 0;
126
601
  /**
127
- * Number of Powerkicks
602
+ * Wins as Hider
128
603
  * @type {number}
129
604
  */
130
- this.powerKicks = data.powerkicks_soccer || 0;
605
+ this.winsAsHider = data.prop_hunt_hider_wins_hide_and_seek || 0;
131
606
  /**
132
- * Goals
607
+ * Wins
133
608
  * @type {number}
134
609
  */
135
- this.goals = data.goals_soccer || 0;
610
+ this.wins = this.winsAsSeeker + this.winsAsHider;
136
611
  }
137
612
  }
138
613
  /**
139
- * Hole in the Wall class
614
+ * Hide And Seek Stats
140
615
  */
141
- class HITW extends BaseGame {
616
+ class HideAndSeek {
142
617
  /**
143
- * @param {Object} data Data From API
618
+ * @param {Object} data Data from API
144
619
  */
145
620
  constructor(data) {
146
- super(data, 'hole_in_the_wall');
147
621
  /**
148
- * Score Record in Finals
149
- * @type {number}
622
+ * Party Popper Stats
623
+ * @type {PartyPopper}
150
624
  */
151
- this.scoreRecordFinals = data.hitw_record_f || 0;
625
+ this.partyPopper = new PartyPopper(data);
152
626
  /**
153
- * Score Record in Normal
627
+ * Prop Hunt Stats
628
+ * @type {PropHunt}
629
+ */
630
+ this.propHunt = new PropHunt(data);
631
+ /**
632
+ * Wins as Seeker
154
633
  * @type {number}
155
634
  */
156
- this.scoreRecordNormal = data.hitw_record_q || 0;
635
+ this.winsAsSeeker = data.seeker_wins_hide_and_seek || 0;
157
636
  /**
158
- * Score Record overall
637
+ * Wins as Hider
159
638
  * @type {number}
160
639
  */
161
- this.scoreRecordOverall = this.scoreRecordFinals + this.scoreRecordNormal;
640
+ this.winsAsHider = data.hider_wins_hide_and_seek || 0;
162
641
  }
163
642
  }
164
643
  /**
165
- * Mini Walls class
644
+ * Hide And Seek Stats
166
645
  */
167
- class MiniWalls extends BaseGame {
646
+ class HoleInTheWall {
168
647
  /**
169
- * Constructor
170
- * @param {Object} data data from API
648
+ * @param {Object} data Data from API
171
649
  */
172
650
  constructor(data) {
173
- super(data, 'mini_walls');
174
651
  /**
175
- * Total Arrow Hits
652
+ * Wins
176
653
  * @type {number}
177
654
  */
178
- this.arrowHits = data.arrows_hit_mini_walls || 0;
655
+ this.wins = data.wins_hole_in_the_wall || 0;
179
656
  /**
180
- * Total Arrow shots
657
+ * Rounds Played
181
658
  * @type {number}
182
659
  */
183
- this.arrowShots = data.arrows_shot_mini_walls || 0;
660
+ this.rounds = data.rounds_hole_in_the_wall || 0;
184
661
  /**
185
- * Bow Accuracy based on hits/shots
662
+ * Score Record in Finals
186
663
  * @type {number}
187
664
  */
188
- this.bowAccuracy = divide(this.arrowHits, this.arrowShots);
665
+ this.scoreRecordFinals = data.hitw_record_f || 0;
189
666
  /**
190
- * Final Kills
667
+ * Score Record in Normal
191
668
  * @type {number}
192
669
  */
193
- this.finalKills = data.final_kills_mini_walls || 0;
670
+ this.scoreRecordNormal = data.hitw_record_q || 0;
194
671
  /**
195
- * Total damage dealt to withers
672
+ * Score Record Overall
196
673
  * @type {number}
197
674
  */
198
- this.witherDamage = data.wither_damage_mini_walls || 0;
675
+ this.scoreRecordOverall = this.scoreRecordFinals + this.scoreRecordNormal;
676
+ }
677
+ }
678
+ /**
679
+ * Hypixel Says Stats
680
+ */
681
+ class HypixelSays {
682
+ constructor(data) {
199
683
  /**
200
- * Wither Killed
684
+ * Wins
201
685
  * @type {number}
202
686
  */
203
- this.witherKills = data.wither_kills_mini_walls || 0;
687
+ this.wins = data.wins_simon_says || 0;
688
+ /**
689
+ * Rounds
690
+ * @type {number}
691
+ */
692
+ this.rounds = data.rounds_simon_says || 0;
693
+ /**
694
+ * Round Wins
695
+ * @type {number}
696
+ */
697
+ this.roundWins = data.round_wins_simon_says || 0;
698
+ /**
699
+ * Top Score
700
+ * @type {number}
701
+ */
702
+ this.topScore = data.top_score_simon_says || 0;
204
703
  }
205
704
  }
206
705
  /**
207
- * Zombies - Stats by Map + Difficulty
706
+ * Mini Walls class
208
707
  */
209
- class ZombiesStats {
708
+ class MiniWalls {
210
709
  /**
211
710
  * Constructor
212
- * @param {Object} data Data from API
213
- * @param {string} type Map name + difficulty ( default overall )
711
+ * @param {Object} data data from API
214
712
  */
215
- constructor(data, type = '') {
216
- if (type) type = `_${type}`;
713
+ constructor(data) {
217
714
  /**
218
- * Best Round
715
+ * Active Kit
716
+ * @type {string}
717
+ */
718
+ this.kit = data.miniWalls_activeKit || '';
719
+ /**
720
+ * Wins
219
721
  * @type {number}
220
722
  */
221
- this.bestRound = data[`best_round_zombies${type}`] || 0;
723
+ this.wins = data.wins_mini_walls || 0;
222
724
  /**
223
- * Deaths ( NOT losses )
725
+ * Kills
224
726
  * @type {number}
225
727
  */
226
- this.deaths = data[`deaths_zombies${type}`] || 0;
728
+ this.kills = data.kills_mini_walls || 0;
227
729
  /**
228
- * Doors opened
730
+ * Deaths
229
731
  * @type {number}
230
732
  */
231
- this.doorsOpened = data[`doors_opened_zombies${type}`] || 0;
733
+ this.deaths = data.deaths_mini_walls || 0;
232
734
  /**
233
- * Fastest time to reach round 10 in seconds
735
+ * Kill Death Ratio
234
736
  * @type {number}
235
737
  */
236
- this.fastestRound10 = data[`fastest_time_10_zombies${type}`] || 0;
738
+ this.KDRatio = divide(this.kills, this.deaths);
237
739
  /**
238
- * Fastest time to reach round 20 in seconds
740
+ * Final Kills
239
741
  * @type {number}
240
742
  */
241
- this.fastestRound20 = data[`fastest_time_20_zombies${type}`] || 0;
743
+ this.finalKills = data.final_kills_mini_walls || 0;
242
744
  /**
243
- * Fastest time to reach round 30 in seconds
745
+ * Wither Kills
244
746
  * @type {number}
245
747
  */
246
- this.fastestRound30 = data[`fastest_time_30_zombies${type}`] || 0;
748
+ this.witherKills = data.wither_kills_mini_walls || 0;
247
749
  /**
248
- * Players revived
750
+ * Wither Damage
249
751
  * @type {number}
250
752
  */
251
- this.playersRevived = data[`players_revived_zombies${type}`] || 0;
753
+ this.witherDamage = data.wither_damage_mini_walls || 0;
252
754
  /**
253
- * Number of times player is knocked down
755
+ * Arrows Shot
254
756
  * @type {number}
255
757
  */
256
- this.timesKnockedDown = data[`times_knocked_down_zombies${type}`] || 0;
758
+ this.arrowsShot = data.arrows_shot_mini_walls || 0;
257
759
  /**
258
- * Total amount of rounds the player survived
760
+ * Arrows Hit
259
761
  * @type {number}
260
762
  */
261
- this.roundsSurvived = data[`total_rounds_survived_zombies${type}`] || 0;
763
+ this.arrowsHit = data.arrows_hit_mini_walls || 0;
262
764
  /**
263
- * Total amount of windows fully repaired by player
765
+ * Bow Accuracy
264
766
  * @type {number}
265
767
  */
266
- this.windowsRepaired = data[`windows_repaired_zombies${type}`] || 0;
768
+ this.bowAccuracy = divide(this.arrowsHit, this.arrowsShot);
769
+ }
770
+ }
771
+ /**
772
+ * Party Games class
773
+ */
774
+ class PartyGames {
775
+ /**
776
+ * Constructor
777
+ * @param {Object} data data from API
778
+ */
779
+ constructor(data) {
267
780
  /**
268
781
  * Wins
269
782
  * @type {number}
270
783
  */
271
- this.wins = data[`wins_zombies${type}`] || 0;
784
+ this.wins = data.wins_party || 0;
272
785
  /**
273
- * Total Zombie Kills
786
+ * Rounds Won
274
787
  * @type {number}
275
788
  */
276
- this.zombieKills = data[`zombie_kills_zombies${type}`] || 0;
789
+ this.roundWins = data.round_wins_party || 0;
790
+ /**
791
+ * Stars Earned
792
+ * @type {number}
793
+ */
794
+ this.stars = data.total_stars_party || 0;
277
795
  }
278
796
  }
279
797
  /**
280
- * Zombie stats by map
798
+ * Pixel Party Game Mode
281
799
  */
282
- class ZombieMap {
800
+ class PixelPartyGameMode {
283
801
  /**
284
802
  * Constructor
285
- * @param {Object} data Data from API
286
- * @param {string} mapName String map name
803
+ * @param {Object} data data from API
804
+ * @param {string} modeName Mode name
287
805
  */
288
- constructor(data, mapName) {
806
+ constructor(data, modeName) {
289
807
  /**
290
- * Normal mode
291
- * @type {ZombiesStats}
808
+ * Wins
809
+ * @type {number}
292
810
  */
293
- this.normal = new ZombiesStats(data, `${mapName}_normal`);
811
+ this.wins = data?.[`wins_${modeName}`] || 0;
294
812
  /**
295
- * Hard mode ( parties only )
296
- * @type {ZombiesStats}
813
+ * Games Played
814
+ * @type {number}
297
815
  */
298
- this.hard = new ZombiesStats(data, `${mapName}_hard`);
816
+ this.gamesPlayed = data?.[`games_played_${modeName}`] || 0;
299
817
  /**
300
- * RIP mode ( parties only )
301
- * @type {ZombiesStats}
818
+ * Losses
819
+ * @type {number}
302
820
  */
303
- this.rip = new ZombiesStats(data, `${mapName}_rip`);
821
+ this.losses = this.gamesPlayed - this.wins;
304
822
  /**
305
- * Overall ( 3 modes combined )
306
- * @type {ZombiesStats}
823
+ * Win Loss Ratio
824
+ * @type {number}
825
+ */
826
+ this.WLRatio = divide(this.wins, this.losses);
827
+ /**
828
+ * Rounds Played
829
+ * @type {number}
830
+ */
831
+ this.roundsPlayed = data?.[`rounds_completed_${modeName}`] || 0;
832
+ /**
833
+ * Power Ups Collected
834
+ * @type {number}
307
835
  */
308
- this.overall = new ZombiesStats(data, mapName);
836
+ this.powerUpsCollected = data?.[`power_ups_collected_${modeName}`] || 0;
309
837
  }
310
838
  }
311
839
  /**
312
- * Zombies - Overall stats
840
+ * Party Games class
313
841
  */
314
- class Zombies {
842
+ class PixelParty {
315
843
  /**
316
844
  * Constructor
317
- * @param {Object} data Data from API
845
+ * @param {Object} data data from API
318
846
  */
319
847
  constructor(data) {
320
848
  /**
321
- * Overall Stats
322
- * @type {ZombiesStats}
849
+ * Wins
850
+ * @type {number}
323
851
  */
324
- this.overall = new ZombiesStats(data);
852
+ this.wins = data?.pixel_party?.wins || 0;
325
853
  /**
326
- * Stats for Dead End
327
- * @type {ZombieMap}
854
+ * Games Played
855
+ * @type {number}
328
856
  */
329
- this.deadEnd = new ZombieMap(data, 'deadend');
857
+ this.gamesPlayed = data?.pixel_party?.games_played || 0;
330
858
  /**
331
- * Stats for Bad Blood
332
- * @type {ZombieMap}
859
+ * Losses
860
+ * @type {number}
333
861
  */
334
- this.badBlood = new ZombieMap(data, 'badblood');
862
+ this.losses = this.gamesPlayed - this.wins;
335
863
  /**
336
- * Stats for Alien Arcadium
337
- * @type {ZombieMap}
864
+ * Win Loss Ratio
865
+ * @type {number}
338
866
  */
339
- this.alienArcadium = new ZombieMap(data, 'alienarcadium');
867
+ this.WLRatio = divide(this.wins, this.losses);
340
868
  /**
341
- * Kills By Zombie
342
- * @type {Record<string,number>}
869
+ * Rounds Played
870
+ * @type {number}
343
871
  */
344
- this.killsByZombie = parseZombiesKills(data);
872
+ this.roundsPlayed = data?.pixel_party?.rounds_completed || 0;
345
873
  /**
346
- * Bullets Hit
874
+ * Power Ups Collected
347
875
  * @type {number}
348
876
  */
349
- this.bulletsHit = data.bullets_hit_zombies || 0;
877
+ this.powerUpsCollected = data?.pixel_party?.power_ups_collected || 0;
350
878
  /**
351
- * Bullets Shot
879
+ * Normal Game Mode
880
+ * @type {PixelPartyGameMode}
881
+ */
882
+ this.normal = new PixelPartyGameMode(data.pixel_party, 'normal');
883
+ /**
884
+ * Hyper Game Mode
885
+ * @type {PixelPartyGameMode}
886
+ */
887
+ this.hyper = new PixelPartyGameMode(data.pixel_party, 'hyper');
888
+ /**
889
+ * Highest Round
352
890
  * @type {number}
353
891
  */
354
- this.bulletsShot = data.bullets_shot_zombies || 0;
892
+ this.highestRound = data?.pixel_party?.highest_round || 0;
355
893
  /**
356
- * Gun Accuracy
894
+ * Music Volume
357
895
  * @type {number}
358
896
  */
359
- this.gunAccuracy = divide(this.bulletsHit, this.bulletsShot);
897
+ this.musicVolume = data.pixel_party_music_volume || 0;
360
898
  /**
361
- * Headshots
899
+ * Color Blind Settings
900
+ * @type {object}
901
+ */
902
+ this.colorBlind = data.pixelparty || {};
903
+ }
904
+ }
905
+ /**
906
+ * Throw Out class
907
+ */
908
+ class ThrowOut {
909
+ /**
910
+ * Constructor
911
+ * @param {Object} data data from API
912
+ */
913
+ constructor(data) {
914
+ /**
915
+ * Wins
362
916
  * @type {number}
363
917
  */
364
- this.headshots = data.headshots_zombies || 0;
918
+ this.wins = data.wins_throw_out || 0;
365
919
  /**
366
- * Headshot Accuracy
920
+ * Kills
367
921
  * @type {number}
368
922
  */
369
- this.headshotAccuracy = divide(this.headshots, this.bulletsShot);
923
+ this.kills = data.kills_throw_out || 0;
924
+ /**
925
+ * Deaths
926
+ * @type {number}
927
+ */
928
+ this.deaths = data.deaths_throw_out || 0;
929
+ /**
930
+ * KDRatio
931
+ * @type {number}
932
+ */
933
+ this.KDRatio = divide(this.kills, this.deaths);
370
934
  }
371
935
  }
372
-
373
936
  /**
374
937
  * Arcade class
375
938
  */
@@ -405,170 +968,91 @@ class Arcade {
405
968
  */
406
969
  this.flashDisabled = !data.flash;
407
970
  /**
408
- * Draw their thing stats
409
- * @type {BaseGame}
410
- */
411
- this.drawTheirThing = new BaseGame(data, 'draw_their_thing');
412
- /**
413
- * Dragon wars "2" stats
414
- * @type {BaseGame}
415
- */
416
- this.dragonWars = new BaseGame(data, 'dragonwars2');
417
- /**
418
- * Easter Simulator stats
419
- * @type {EasterSimulator}
971
+ * Blocking dead ( previously known as DayOne ) stats
972
+ * @type {BlockingDead}
420
973
  */
421
- this.easterSimulator = new BaseGame(data, 'easter_simulator').extend(
422
- 'eggsFound',
423
- data.eggs_found_easter_simulator || 0
424
- );
974
+ this.blockingDead = new BlockingDead(data);
425
975
  /**
426
- * Grinch Simulator stats
427
- * @type {GrinchSimulator}
976
+ * Bounty Hunters (previously known as One In The Quiver) stats
977
+ * @type {BountyHunters}
428
978
  */
429
- this.grinchSimulator = new BaseGame(data, 'grinch_simulator_v2').extend(
430
- 'giftsFound',
431
- data.gifts_grinch_simulator_v2 || 0
432
- );
979
+ this.bountyHunters = new BountyHunters(data);
433
980
  /**
434
- * Scuba Simulator stats
435
- * @type {ScubaSimulator}
981
+ * Capture The Wool
982
+ * @type {CaptureTheWool}
436
983
  */
437
- this.scubaSimulator = new BaseGame(data, 'scuba_simulator').extend(
438
- 'itemsFound',
439
- data.items_found_scuba_simulator || 0
440
- );
984
+ this.captureTheWool = new CaptureTheWool(data);
441
985
  /**
442
- * Santa Simulator stats
443
- * @type {SantaSimulator}
986
+ * Dragon wars stats
987
+ * @type {DragonWars}
444
988
  */
445
- this.santaSimulator = new BaseGame(data, 'santa_simulator').extend(
446
- 'giftsDelivered',
447
- data.delivered_santa_simulator || 0
448
- );
989
+ this.dragonWars = new DragonWars(data);
449
990
  /**
450
- * Santa Says stats
451
- * @type {BaseGame}
991
+ * Dropper
992
+ * @type {Dropper}
452
993
  */
453
- this.santaSays = new BaseGame(data, 'santa_says');
994
+ this.dropper = new Dropper(data.dropper);
454
995
  /**
455
- * Simon Says stats
456
- * @type {BaseGame}
996
+ * Ender Spleef stats
997
+ * @type {EnderSpleef}
457
998
  */
458
- this.simonSays = new BaseGame(data, 'simon_says');
999
+ this.enderSpleef = new EnderSpleef(data);
459
1000
  /**
460
1001
  * Farm Hunt stats
461
- * @type {BaseGame}
462
- */
463
- this.farmHunt = new BaseGame(data, 'farm_hunt');
464
- /**
465
- * Hole in the Wall stats
466
- * @type {HITW}
467
- */
468
- this.holeInTheWall = new HITW(data, 'hole_in_the_wall');
469
- /**
470
- * Mini Walls stats
471
- * @type {MiniWalls}
472
- */
473
- // TODO needs extension
474
- this.miniWalls = new MiniWalls(data);
475
- /**
476
- * Party games (1) stats
477
- * @type {BaseGame}
1002
+ * @type {FarmHunt}
478
1003
  */
479
- this.partyGames = new BaseGame(data, 'party');
1004
+ this.farmHunt = new FarmHunt(data);
480
1005
  /**
481
- * Party Games 2 stats ( legacy )
482
- * @type {BaseGame}
483
- * @deprecated
1006
+ * Football stats
1007
+ * @type {Football}
484
1008
  */
485
- this.partyGames2 = new BaseGame(data, 'party_2');
1009
+ this.football = new Football(data);
486
1010
  /**
487
- * Party Games 3 stats ( legacy )
488
- * @type {BaseGame}
489
- * @deprecated
1011
+ * Galaxy Wars stats
1012
+ * @type {GalaxyWars}
490
1013
  */
491
- this.partyGames3 = new BaseGame(data, 'party_3');
1014
+ this.galaxyWars = new GalaxyWars(data);
492
1015
  /**
493
- * Throw out stats
494
- * @type {BaseGame}
1016
+ * Hide and Seek stats
1017
+ * @type {HideAndSeek}
495
1018
  */
496
- this.throwOut = new BaseGame(data, 'throw_out');
1019
+ this.hideAndSeek = new HideAndSeek(data);
497
1020
  /**
498
- * Soccer stats
499
- * @type {Soccer}
1021
+ * Hole in the Wall stats
1022
+ * @type {HoleInTheWall}
500
1023
  */
501
- this.soccer = new Soccer(data);
1024
+ this.holeInTheWall = new HoleInTheWall(data);
502
1025
  /**
503
- * Hypixel Sports stats
504
- * @type {BaseGame}
505
- * @deprecated
1026
+ * Hypixel Says stats
1027
+ * @type {HypixelSays}
506
1028
  */
507
- this.hypixelSports = new BaseGame(data, 'hypixel_sports');
1029
+ this.hypixelSays = new HypixelSays(data);
508
1030
  /**
509
- * Ender Spleef stats
510
- * @type {BaseGame}
1031
+ * Mini Walls stats
1032
+ * @type {MiniWalls}
511
1033
  */
512
- this.enderSpleef = new BaseGame(data, 'ender');
1034
+ this.miniWalls = new MiniWalls(data);
513
1035
  /**
514
- * Blocking dead ( previously known as DayOne ) stats
515
- * @type {BlockingDead}
1036
+ * Party games stats
1037
+ * @type {PartyGames}
516
1038
  */
517
- this.blockingDead = new BaseGame(data, 'dayone').extend('headshots', data.headshots_dayone || 0);
1039
+ this.partyGames = new PartyGames(data);
518
1040
  /**
519
- * Galaxy Wars stats
520
- * @type {GalaxyWars}
1041
+ * Pixel Party stats
1042
+ * @type {PixelParty}
521
1043
  */
522
- this.galaxyWars = new GalaxyWars(data);
523
- // Lenient parsing
1044
+ this.pixelParty = new PixelParty(data);
524
1045
  /**
525
- * OITQ / One In The Quiver stats
526
- * @type {OITQ}
1046
+ * Throw out stats
1047
+ * @type {ThrowOut}
527
1048
  */
528
- this.oitq = this.oneInTheQuiver = new BaseGame(data, 'oneinthequiver').extend(
529
- 'bountyKills',
530
- data.bounty_kills_oneinthequiver || 0
531
- );
1049
+ this.throwOut = new ThrowOut(data);
532
1050
  /**
533
1051
  * Zombies
534
1052
  * @type {Zombies}
535
1053
  */
536
1054
  this.zombies = new Zombies(data);
537
- /**
538
- * Capture The Wool
539
- * @type {{kills: number, captures: number}}
540
- */
541
- this.captureTheWool = { kills: data.arcade_ctw_slayer || 0, captures: data.arcade_ctw_oh_sheep || 0 };
542
1055
  }
543
1056
  }
544
- /**
545
- * @typedef {Object} EasterSimulator
546
- * @extends BaseGame
547
- * @property {number} eggsFound Total eggs found
548
- */
549
- /**
550
- * @typedef {Object} GrinchSimulator
551
- * @extends BaseGame
552
- * @property {number} giftsFound Total gifts found and stolen
553
- */
554
- /**
555
- * @typedef {Object} ScubaSimulator
556
- * @extends BaseGame
557
- * @property {number} itemsFound Total items found
558
- */
559
- /**
560
- * @typedef {Object} SantaSimulator
561
- * @extends BaseGame
562
- * @property {number} giftsDelivered Total gifts delivered
563
- */
564
- /**
565
- * @typedef {Object} OITQ
566
- * @extends BaseGame
567
- * @property {number} bountyKills Bounty Kills
568
- */
569
- /**
570
- * @typedef {JSON} BlockingDead
571
- * @extends BaseGame
572
- * @property {number} headshots Headshots
573
- */
1057
+
574
1058
  module.exports = Arcade;