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
@@ -3,7 +3,7 @@ const romanize = require('../../utils/romanize');
3
3
  const divide = require('../../utils/divide');
4
4
 
5
5
  // eslint-disable-next-line jsdoc/require-jsdoc
6
- function getDivision(data, mode = null) {
6
+ function getTitle(data, mode = null) {
7
7
  for (const div of duelsDivisions.slice().reverse()) {
8
8
  const prestige = data[`${mode ? mode : 'all_modes'}_${div.key}_title_prestige`];
9
9
  if (prestige) {
@@ -13,22 +13,799 @@ function getDivision(data, mode = null) {
13
13
  return null;
14
14
  }
15
15
 
16
- // eslint-disable-next-line jsdoc/require-jsdoc
17
- function getTotalKillsDeaths(data) {
18
- let totalDeaths = 0;
19
- let totalKills = 0;
20
- for (const [k, v] of Object.entries(data)) {
21
- if (k.includes('deaths') && 'deaths' !== k) {
22
- totalDeaths += v;
23
- } else if (k.includes('kills') && 'kills' !== k) {
24
- totalKills += v;
25
- }
16
+ class DuelsGamemode {
17
+ /**
18
+ * @param {object} data Duels data
19
+ */
20
+ constructor(data, mode, title = '') {
21
+ /**
22
+ * Title
23
+ * @type {string}
24
+ */
25
+ this.title = title;
26
+ /**
27
+ * Winstreak
28
+ * @type {number}
29
+ */
30
+ this.winstreak = data[`current_winstreak_mode_${mode}`] || 0;
31
+ /**
32
+ * Best Winstreak
33
+ * @type {number}
34
+ */
35
+ this.bestWinstreak = data[`best_winstreak_mode_${mode}`] || 0;
36
+ /**
37
+ * Kills
38
+ * @type {number}
39
+ */
40
+ this.kills = data[`${mode}_kills`] || 0;
41
+ /**
42
+ * Deaths
43
+ * @type {number}
44
+ */
45
+ this.deaths = data[`${mode}_deaths`] || 0;
46
+ /**
47
+ * KDRatio
48
+ * @type {number}
49
+ */
50
+ this.KDRatio = divide(this.kills, this.deaths);
51
+ /**
52
+ * Wins
53
+ * @type {number}
54
+ */
55
+ this.wins = data[`${mode}_wins`] || 0;
56
+ /**
57
+ * Losses
58
+ * @type {number}
59
+ */
60
+ this.losses = data[`${mode}_losses`] || 0;
61
+ /**
62
+ * WLRatio
63
+ * @type {number}
64
+ */
65
+ this.WLRatio = divide(this.wins, this.losses);
66
+ /**
67
+ * Played Games
68
+ * @type {number}
69
+ */
70
+ this.playedGames = data[`${mode}_rounds_played`] || 0;
71
+ /**
72
+ * Swings
73
+ * @type {number}
74
+ */
75
+ this.swings = data[`${mode}_melee_swings`] || 0;
76
+ /**
77
+ * Hits
78
+ * @type {number}
79
+ */
80
+ this.hits = data[`${mode}_melee_hits`] || 0;
81
+ /**
82
+ * Melee Accuracy
83
+ * @type {number}
84
+ */
85
+ this.meleeAccuracy = divide(this.swings, this.hits);
86
+ /**
87
+ * Bow Shots
88
+ * @type {number}
89
+ */
90
+ this.bowShots = data[`${mode}_bow_shots`] || 0;
91
+ /**
92
+ * Bow Hits
93
+ * @type {number}
94
+ */
95
+ this.bowHits = data[`${mode}_bow_hits`] || 0;
96
+ /**
97
+ * Bow Accuracy
98
+ * @type {number}
99
+ */
100
+ this.bowAccuracy = divide(this.bowShots, this.bowHits);
101
+ /**
102
+ * Blocks Placed
103
+ * @type {number}
104
+ */
105
+ this.blocksPlaced = data[`${mode}_blocks_placed`] || 0;
106
+ /**
107
+ * Health Regenerated
108
+ * @type {number}
109
+ */
110
+ this.healthRegenerated = data[`${mode}_health_regenerated`] || 0;
111
+ /**
112
+ * Golden Apples Eatan
113
+ * @type {number}
114
+ */
115
+ this.goldenApplesEatan = data[`${mode}_golden_apples_eaten`] || 0;
116
+ }
117
+ }
118
+
119
+ class DuelsUHC {
120
+ /**
121
+ * @param {object} data Duels data
122
+ */
123
+ constructor(data) {
124
+ /**
125
+ * Title
126
+ * @type {string}
127
+ */
128
+ this.title = getTitle(data, 'uhc');
129
+ /**
130
+ * Winstreak
131
+ * @type {number}
132
+ */
133
+ this.winstreak = data.current_uhc_winstreak || 0;
134
+ /**
135
+ * Best Winstreak
136
+ * @type {number}
137
+ */
138
+ this.bestWinstreak = data.best_uhc_winstreak || 0;
139
+ /**
140
+ * Solo Game Mode Stats
141
+ * @type {DuelsGamemode}
142
+ */
143
+ this.solo = new DuelsGamemode(data, 'uhc_duel', this.title);
144
+ /**
145
+ * Doubles Game Mode Stats
146
+ * @type {DuelsGamemode}
147
+ */
148
+ this.doubles = new DuelsGamemode(data, 'uhc_doubles', this.title);
149
+ /**
150
+ * Fours Game Mode Stats
151
+ * @type {DuelsGamemode}
152
+ */
153
+ this.fours = new DuelsGamemode(data, 'uhc_four', this.title);
154
+ /**
155
+ * Deathmatch Game Mode Stats
156
+ * @type {DuelsGamemode}
157
+ */
158
+ this.deathmatch = new DuelsGamemode(data, 'uhc_meetup', this.title);
159
+ /**
160
+ * Kills
161
+ * @type {number}
162
+ */
163
+ this.kills = this.solo.kills + this.doubles.kills + this.fours.kills + this.deathmatch.kills;
164
+ /**
165
+ * Deaths
166
+ * @type {number}
167
+ */
168
+ this.deaths = this.solo.deaths + this.doubles.deaths + this.fours.deaths + this.deathmatch.deaths;
169
+ /**
170
+ * KDRatio
171
+ * @type {number}
172
+ */
173
+ this.KDRatio = divide(this.kills, this.deaths);
174
+ /**
175
+ * Wins
176
+ * @type {number}
177
+ */
178
+ this.wins = this.solo.wins + this.doubles.wins + this.fours.wins + this.deathmatch.wins;
179
+ /**
180
+ * Losses
181
+ * @type {number}
182
+ */
183
+ this.losses = this.solo.losses + this.doubles.losses + this.fours.losses + this.deathmatch.losses;
184
+ /**
185
+ * WLRatio
186
+ * @type {number}
187
+ */
188
+ this.WLRatio = divide(this.wins, this.losses);
189
+ /**
190
+ * Played Games
191
+ * @type {number}
192
+ */
193
+ this.playedGames =
194
+ this.solo.playedGames + this.doubles.playedGames + this.fours.playedGames + this.deathmatch.playedGames;
195
+ /**
196
+ * Swings
197
+ * @type {number}
198
+ */
199
+ this.swings = this.solo.swings + this.doubles.swings + this.fours.swings + this.deathmatch.swings;
200
+ /**
201
+ * Hits
202
+ * @type {number}
203
+ */
204
+ this.hits = this.solo.hits + this.doubles.hits + this.fours.hits + this.deathmatch.hits;
205
+ /**
206
+ * Melee Accuracy
207
+ * @type {number}
208
+ */
209
+ this.meleeAccuracy = divide(this.hits, this.swings);
210
+ /**
211
+ * Bow Shots
212
+ * @type {number}
213
+ */
214
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots + this.fours.bowShots + this.deathmatch.bowShots;
215
+ /**
216
+ * Bow Hits
217
+ * @type {number}
218
+ */
219
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits + this.fours.bowHits + this.deathmatch.bowHits;
220
+ /**
221
+ * Bow Accuracy
222
+ * @type {number}
223
+ */
224
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
225
+ /**
226
+ * Blocks Placed
227
+ * @type {number}
228
+ */
229
+ this.blocksPlaced =
230
+ this.solo.blocksPlaced + this.doubles.blocksPlaced + this.fours.blocksPlaced + this.deathmatch.blocksPlaced;
231
+ /**
232
+ * Health Regenerated
233
+ * @type {number}
234
+ */
235
+ this.healthRegenerated =
236
+ this.solo.healthRegenerated +
237
+ this.doubles.healthRegenerated +
238
+ this.fours.healthRegenerated +
239
+ this.deathmatch.healthRegenerated;
240
+ /**
241
+ * Golden Apples Eatan
242
+ * @type {number}
243
+ */
244
+ this.goldenApplesEatan =
245
+ this.solo.goldenApplesEatan +
246
+ this.doubles.goldenApplesEatan +
247
+ this.fours.goldenApplesEatan +
248
+ this.deathmatch.goldenApplesEatan;
249
+ }
250
+ }
251
+ class DuelsSkyWars {
252
+ /**
253
+ * @param {object} data Duels data
254
+ */
255
+ constructor(data) {
256
+ /**
257
+ * Title
258
+ * @type {string}
259
+ */
260
+ this.title = getTitle(data, 'sw');
261
+ /**
262
+ * Winstreak
263
+ * @type {number}
264
+ */
265
+ this.winstreak = data.current_sw_winstreak || 0;
266
+ /**
267
+ * Best Winstreak
268
+ * @type {number}
269
+ */
270
+ this.bestWinstreak = data.best_sw_winstreak || 0;
271
+ /**
272
+ * Solo Game Mode Stats
273
+ * @type {DuelsGamemode}
274
+ */
275
+ this.solo = new DuelsGamemode(data, 'sw_duel', this.title);
276
+ /**
277
+ * Doubles Game Mode Stats
278
+ * @type {DuelsGamemode}
279
+ */
280
+ this.doubles = new DuelsGamemode(data, 'sw_doubles', this.title);
281
+ /**
282
+ * Kills
283
+ * @type {number}
284
+ */
285
+ this.kills = this.solo.kills + this.doubles.kills;
286
+ /**
287
+ * Deaths
288
+ * @type {number}
289
+ */
290
+ this.deaths = this.solo.deaths + this.doubles.deaths;
291
+ /**
292
+ * KDRatio
293
+ * @type {number}
294
+ */
295
+ this.KDRatio = divide(this.kills, this.deaths);
296
+ /**
297
+ * Wins
298
+ * @type {number}
299
+ */
300
+ this.wins = this.solo.wins + this.doubles.wins;
301
+ /**
302
+ * Losses
303
+ * @type {number}
304
+ */
305
+ this.losses = this.solo.losses + this.doubles.losses;
306
+ /**
307
+ * WLRatio
308
+ * @type {number}
309
+ */
310
+ this.WLRatio = divide(this.wins, this.losses);
311
+ /**
312
+ * Played Games
313
+ * @type {number}
314
+ */
315
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
316
+ /**
317
+ * Swings
318
+ * @type {number}
319
+ */
320
+ this.swings = this.solo.swings + this.doubles.swings;
321
+ /**
322
+ * Hits
323
+ * @type {number}
324
+ */
325
+ this.hits = this.solo.hits + this.doubles.hits;
326
+ /**
327
+ * Melee Accuracy
328
+ * @type {number}
329
+ */
330
+ this.meleeAccuracy = divide(this.hits, this.swings);
331
+ /**
332
+ * Bow Shots
333
+ * @type {number}
334
+ */
335
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
336
+ /**
337
+ * Bow Hits
338
+ * @type {number}
339
+ */
340
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
341
+ /**
342
+ * Bow Accuracy
343
+ * @type {number}
344
+ */
345
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
346
+ /**
347
+ * Blocks Placed
348
+ * @type {number}
349
+ */
350
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
351
+ /**
352
+ * Health Regenerated
353
+ * @type {number}
354
+ */
355
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
356
+ /**
357
+ * Golden Apples Eatan
358
+ * @type {number}
359
+ */
360
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
361
+ }
362
+ }
363
+ class DuelsMegaWalls {
364
+ /**
365
+ * @param {object} data Duels data
366
+ */
367
+ constructor(data) {
368
+ /**
369
+ * Title
370
+ * @type {string}
371
+ */
372
+ this.title = getTitle(data, 'mega_walls');
373
+ /**
374
+ * Winstreak
375
+ * @type {number}
376
+ */
377
+ this.winstreak = data.current_mega_walls_winstreak || 0;
378
+ /**
379
+ * Best Winstreak
380
+ * @type {number}
381
+ */
382
+ this.bestWinstreak = data.best_mega_walls_winstreak || 0;
383
+ /**
384
+ * Solo Game Mode Stats
385
+ * @type {DuelsGamemode}
386
+ */
387
+ this.solo = new DuelsGamemode(data, 'mw_duel', this.title);
388
+ /**
389
+ * Doubles Game Mode Stats
390
+ * @type {DuelsGamemode}
391
+ */
392
+ this.doubles = new DuelsGamemode(data, 'mw_doubles', this.title);
393
+ /**
394
+ * Kills
395
+ * @type {number}
396
+ */
397
+ this.kills = this.solo.kills + this.doubles.kills;
398
+ /**
399
+ * Deaths
400
+ * @type {number}
401
+ */
402
+ this.deaths = this.solo.deaths + this.doubles.deaths;
403
+ /**
404
+ * KDRatio
405
+ * @type {number}
406
+ */
407
+ this.KDRatio = divide(this.kills, this.deaths);
408
+ /**
409
+ * Wins
410
+ * @type {number}
411
+ */
412
+ this.wins = this.solo.wins + this.doubles.wins;
413
+ /**
414
+ * Losses
415
+ * @type {number}
416
+ */
417
+ this.losses = this.solo.losses + this.doubles.losses;
418
+ /**
419
+ * WLRatio
420
+ * @type {number}
421
+ */
422
+ this.WLRatio = divide(this.wins, this.losses);
423
+ /**
424
+ * Played Games
425
+ * @type {number}
426
+ */
427
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
428
+ /**
429
+ * Swings
430
+ * @type {number}
431
+ */
432
+ this.swings = this.solo.swings + this.doubles.swings;
433
+ /**
434
+ * Hits
435
+ * @type {number}
436
+ */
437
+ this.hits = this.solo.hits + this.doubles.hits;
438
+ /**
439
+ * Melee Accuracy
440
+ * @type {number}
441
+ */
442
+ this.meleeAccuracy = divide(this.hits, this.swings);
443
+ /**
444
+ * Bow Shots
445
+ * @type {number}
446
+ */
447
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
448
+ /**
449
+ * Bow Hits
450
+ * @type {number}
451
+ */
452
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
453
+ /**
454
+ * Bow Accuracy
455
+ * @type {number}
456
+ */
457
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
458
+ /**
459
+ * Blocks Placed
460
+ * @type {number}
461
+ */
462
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
463
+ /**
464
+ * Health Regenerated
465
+ * @type {number}
466
+ */
467
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
468
+ /**
469
+ * Golden Apples Eatan
470
+ * @type {number}
471
+ */
472
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
473
+ }
474
+ }
475
+ class DuelsOP {
476
+ /**
477
+ * @param {object} data Duels data
478
+ */
479
+ constructor(data) {
480
+ /**
481
+ * Title
482
+ * @type {string}
483
+ */
484
+ this.title = getTitle(data, 'op');
485
+ /**
486
+ * Winstreak
487
+ * @type {number}
488
+ */
489
+ this.winstreak = data.current_op_winstreak || 0;
490
+ /**
491
+ * Best Winstreak
492
+ * @type {number}
493
+ */
494
+ this.bestWinstreak = data.best_op_winstreak || 0;
495
+ /**
496
+ * Solo Game Mode Stats
497
+ * @type {DuelsGamemode}
498
+ */
499
+ this.solo = new DuelsGamemode(data, 'op_duel', this.title);
500
+ /**
501
+ * Doubles Game Mode Stats
502
+ * @type {DuelsGamemode}
503
+ */
504
+ this.doubles = new DuelsGamemode(data, 'op_doubles', this.title);
505
+ /**
506
+ * Kills
507
+ * @type {number}
508
+ */
509
+ this.kills = this.solo.kills + this.doubles.kills;
510
+ /**
511
+ * Deaths
512
+ * @type {number}
513
+ */
514
+ this.deaths = this.solo.deaths + this.doubles.deaths;
515
+ /**
516
+ * KDRatio
517
+ * @type {number}
518
+ */
519
+ this.KDRatio = divide(this.kills, this.deaths);
520
+ /**
521
+ * Wins
522
+ * @type {number}
523
+ */
524
+ this.wins = this.solo.wins + this.doubles.wins;
525
+ /**
526
+ * Losses
527
+ * @type {number}
528
+ */
529
+ this.losses = this.solo.losses + this.doubles.losses;
530
+ /**
531
+ * WLRatio
532
+ * @type {number}
533
+ */
534
+ this.WLRatio = divide(this.wins, this.losses);
535
+ /**
536
+ * Played Games
537
+ * @type {number}
538
+ */
539
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
540
+ /**
541
+ * Swings
542
+ * @type {number}
543
+ */
544
+ this.swings = this.solo.swings + this.doubles.swings;
545
+ /**
546
+ * Hits
547
+ * @type {number}
548
+ */
549
+ this.hits = this.solo.hits + this.doubles.hits;
550
+ /**
551
+ * Melee Accuracy
552
+ * @type {number}
553
+ */
554
+ this.meleeAccuracy = divide(this.hits, this.swings);
555
+ /**
556
+ * Bow Shots
557
+ * @type {number}
558
+ */
559
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
560
+ /**
561
+ * Bow Hits
562
+ * @type {number}
563
+ */
564
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
565
+ /**
566
+ * Bow Accuracy
567
+ * @type {number}
568
+ */
569
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
570
+ /**
571
+ * Blocks Placed
572
+ * @type {number}
573
+ */
574
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
575
+ /**
576
+ * Health Regenerated
577
+ * @type {number}
578
+ */
579
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
580
+ /**
581
+ * Golden Apples Eatan
582
+ * @type {number}
583
+ */
584
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
585
+ }
586
+ }
587
+ class DuelsBridge {
588
+ /**
589
+ * @param {object} data Duels data
590
+ */
591
+ constructor(data) {
592
+ /**
593
+ * Title
594
+ * @type {string}
595
+ */
596
+ this.title = getTitle(data, 'bridge');
597
+ /**
598
+ * Winstreak
599
+ * @type {number}
600
+ */
601
+ this.winstreak = data.current_bridge_winstreak || 0;
602
+ /**
603
+ * Best Winstreak
604
+ * @type {number}
605
+ */
606
+ this.bestWinstreak = data.best_bridge_winstreak || 0;
607
+ /**
608
+ * Solo Game Mode Stats
609
+ * @type {DuelsGamemode}
610
+ */
611
+ this.solo = new DuelsGamemode(data, 'bridge_duel', this.title);
612
+ /**
613
+ * Doubles Game Mode Stats
614
+ * @type {DuelsGamemode}
615
+ */
616
+ this.doubles = new DuelsGamemode(data, 'bridge_doubles', this.title);
617
+ /**
618
+ * Threes Game Mode Stats
619
+ * @type {DuelsGamemode}
620
+ */
621
+ this.threes = new DuelsGamemode(data, 'bridge_threes', this.title);
622
+ /**
623
+ * Fours Game Mode Stats
624
+ * @type {DuelsGamemode}
625
+ */
626
+ this.fours = new DuelsGamemode(data, 'bridge_fours', this.title);
627
+ /**
628
+ * 2v2v2v2 Game Mode Stats
629
+ * @type {DuelsGamemode}
630
+ */
631
+ this['2v2v2v2'] = new DuelsGamemode(data, '2v2v2v2', this.title);
632
+ /**
633
+ * 3v3v3v3 Game Mode Stats
634
+ * @type {DuelsGamemode}
635
+ */
636
+ this['3v3v3v3'] = new DuelsGamemode(data, '3v3v3v3', this.title);
637
+ /**
638
+ * Capture The Flag Game Mode Stats
639
+ * @type {DuelsGamemode}
640
+ */
641
+ this.ctf = new DuelsGamemode(data, 'capture_threes', this.title);
642
+ /**
643
+ * Kills
644
+ * @type {number}
645
+ */
646
+ this.kills =
647
+ this.solo.kills +
648
+ this.doubles.kills +
649
+ this.threes.kills +
650
+ this.fours.kills +
651
+ this['2v2v2v2'].kills +
652
+ this['3v3v3v3'].kills +
653
+ this.ctf.kills;
654
+ /**
655
+ * Deaths
656
+ * @type {number}
657
+ */
658
+ this.deaths =
659
+ this.solo.deaths +
660
+ this.doubles.deaths +
661
+ this.threes.deaths +
662
+ this.fours.deaths +
663
+ this['2v2v2v2'].deaths +
664
+ this['3v3v3v3'].deaths +
665
+ this.ctf.deaths;
666
+ /**
667
+ * KDRatio
668
+ * @type {number}
669
+ */
670
+ this.KDRatio = divide(this.kills, this.deaths);
671
+ /**
672
+ * Wins
673
+ * @type {number}
674
+ */
675
+ this.wins =
676
+ this.solo.wins +
677
+ this.doubles.wins +
678
+ this.threes.wins +
679
+ this.fours.wins +
680
+ this['2v2v2v2'].wins +
681
+ this['3v3v3v3'].wins +
682
+ this.ctf.wins;
683
+ /**
684
+ * Losses
685
+ * @type {number}
686
+ */
687
+ this.losses =
688
+ this.solo.losses +
689
+ this.doubles.losses +
690
+ this.threes.losses +
691
+ this.fours.losses +
692
+ this['2v2v2v2'].losses +
693
+ this['3v3v3v3'].losses +
694
+ this.ctf.losses;
695
+ /**
696
+ * WLRatio
697
+ * @type {number}
698
+ */
699
+ this.WLRatio = divide(this.wins, this.losses);
700
+ /**
701
+ * Played Games
702
+ * @type {number}
703
+ */
704
+ this.playedGames =
705
+ this.solo.playedGames +
706
+ this.doubles.playedGames +
707
+ this.threes.playedGames +
708
+ this.fours.playedGames +
709
+ this['2v2v2v2'].playedGames +
710
+ this['3v3v3v3'].playedGames +
711
+ this.ctf.playedGames;
712
+ /**
713
+ * Swings
714
+ * @type {number}
715
+ */
716
+ this.swings =
717
+ this.solo.swings +
718
+ this.doubles.swings +
719
+ this.threes.swings +
720
+ this.fours.swings +
721
+ this['2v2v2v2'].swings +
722
+ this['3v3v3v3'].swings +
723
+ this.ctf.swings;
724
+ /**
725
+ * Hits
726
+ * @type {number}
727
+ */
728
+ this.hits =
729
+ this.solo.hits +
730
+ this.doubles.hits +
731
+ this.threes.hits +
732
+ this.fours.hits +
733
+ this['2v2v2v2'].hits +
734
+ this['3v3v3v3'].hits +
735
+ this.ctf.hits;
736
+ /**
737
+ * Melee Accuracy
738
+ * @type {number}
739
+ */
740
+ this.meleeAccuracy = divide(this.hits, this.swings);
741
+ /**
742
+ * Bow Shots
743
+ * @type {number}
744
+ */
745
+ this.bowShots =
746
+ this.solo.bowShots +
747
+ this.doubles.bowShots +
748
+ this.threes.bowShots +
749
+ this.fours.bowShots +
750
+ this['2v2v2v2'].bowShots +
751
+ this['3v3v3v3'].bowShots +
752
+ this.ctf.bowShots;
753
+ /**
754
+ * Bow Hits
755
+ * @type {number}
756
+ */
757
+ this.bowHits =
758
+ this.solo.bowHits +
759
+ this.doubles.bowHits +
760
+ this.threes.bowHits +
761
+ this.fours.bowHits +
762
+ this['2v2v2v2'].bowHits +
763
+ this['3v3v3v3'].bowHits +
764
+ this.ctf.bowHits;
765
+ /**
766
+ * Bow Accuracy
767
+ * @type {number}
768
+ */
769
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
770
+ /**
771
+ * Blocks Placed
772
+ * @type {number}
773
+ */
774
+ this.blocksPlaced =
775
+ this.solo.blocksPlaced +
776
+ this.doubles.blocksPlaced +
777
+ this.threes.blocksPlaced +
778
+ this.fours.blocksPlaced +
779
+ this['2v2v2v2'].blocksPlaced +
780
+ this['3v3v3v3'].blocksPlaced +
781
+ this.ctf.blocksPlaced;
782
+ /**
783
+ * Health Regenerated
784
+ * @type {number}
785
+ */
786
+ this.healthRegenerated =
787
+ this.solo.healthRegenerated +
788
+ this.doubles.healthRegenerated +
789
+ this.threes.healthRegenerated +
790
+ this.fours.healthRegenerated +
791
+ this['2v2v2v2'].healthRegenerated +
792
+ this['3v3v3v3'].healthRegenerated +
793
+ this.ctf.healthRegenerated;
794
+ /**
795
+ * Golden Apples Eatan
796
+ * @type {number}
797
+ */
798
+ this.goldenApplesEatan =
799
+ this.solo.goldenApplesEatan +
800
+ this.doubles.goldenApplesEatan +
801
+ this.threes.goldenApplesEatan +
802
+ this.fours.goldenApplesEatan +
803
+ this['2v2v2v2'].goldenApplesEatan +
804
+ this['3v3v3v3'].goldenApplesEatan +
805
+ this.ctf.goldenApplesEatan;
26
806
  }
27
- return {
28
- kills: totalKills,
29
- deaths: totalDeaths
30
- };
31
807
  }
808
+
32
809
  /**
33
810
  * Duels class
34
811
  */
@@ -43,20 +820,20 @@ class Duels {
43
820
  */
44
821
  this.tokens = data.coins || 0;
45
822
  /**
46
- * All modes division
823
+ * All modes Title
47
824
  * @type {string|null}
48
825
  */
49
- this.division = getDivision(data);
826
+ this.title = getTitle(data);
50
827
  /**
51
828
  * Kills
52
829
  * @type {number}
53
830
  */
54
- this.kills = getTotalKillsDeaths(data).kills;
831
+ this.kills = data.kills || 0;
55
832
  /**
56
833
  * Deaths
57
834
  * @type {number}
58
835
  */
59
- this.deaths = getTotalKillsDeaths(data).deaths;
836
+ this.deaths = data.deaths || 0;
60
837
  /**
61
838
  * Kill Death ratio
62
839
  * @type {number}
@@ -92,662 +869,128 @@ class Duels {
92
869
  * @type {number}
93
870
  */
94
871
  this.bestWinstreak = data.best_overall_winstreak || 0;
872
+ /**
873
+ * Ping Range Preference
874
+ * @type {number}
875
+ */
876
+ this.ping = data.pingPreference || 0;
877
+ /**
878
+ * Blocks Placed
879
+ * @type {number}
880
+ */
881
+ this.blocksPlaced = data.blocks_placed || 0;
882
+ /**
883
+ * Swings
884
+ * @type {number}
885
+ */
886
+ this.swings = data.melee_swings || 0;
887
+ /**
888
+ * Hits
889
+ * @type {number}
890
+ */
891
+ this.hits = data.melee_hits || 0;
892
+ /**
893
+ * Melee Accuracy
894
+ * @type {number}
895
+ */
896
+ this.meleeAccuracy = divide(this.hits, this.swings);
897
+ /**
898
+ * Bow Shots
899
+ * @type {number}
900
+ */
901
+ this.bowShots = data.bow_shots || 0;
902
+ /**
903
+ * Bow Hits
904
+ * @type {number}
905
+ */
906
+ this.bowHits = data.bow_hits || 0;
907
+ /**
908
+ * Bow Accuracy
909
+ * @type {number}
910
+ */
911
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
912
+ /**
913
+ * Health Regenerated
914
+ * @type {number}
915
+ */
916
+ this.healthRegenerated = data.health_regenerated || 0;
917
+ /**
918
+ * Golden Apples Eaten
919
+ * @type {number}
920
+ */
921
+ this.goldenApplesEatan = data.golden_apples_eaten || 0;
95
922
  /**
96
923
  * UHC duels stats
97
924
  * @type {DuelsUHC}
98
925
  */
99
- this.uhc = {
100
- overall: {
101
- division: getDivision(data, 'uhc'),
102
- winstreak: data.current_uhc_winstreak || 0,
103
- bestWinstreak: data.best_uhc_winstreak || 0,
104
- kills:
105
- (data.uhc_duel_kills || 0) +
106
- (data.uhc_doubles_kills || 0) +
107
- (data.uhc_four_kills || 0) +
108
- (data.uhc_meetup_kills || 0),
109
- deaths:
110
- (data.uhc_duel_deaths || 0) +
111
- (data.uhc_doubles_deaths || 0) +
112
- (data.uhc_four_deaths || 0) +
113
- (data.uhc_meetup_deaths || 0),
114
- KDRatio: divide(
115
- (data.uhc_duel_kills || 0) +
116
- (data.uhc_doubles_kills || 0) +
117
- (data.uhc_four_kills || 0) +
118
- (data.uhc_meetup_kills || 0),
119
- (data.uhc_duel_deaths || 0) +
120
- (data.uhc_doubles_deaths || 0) +
121
- (data.uhc_four_deaths || 0) +
122
- (data.uhc_meetup_deaths || 0)
123
- ),
124
- wins:
125
- (data.uhc_duel_wins || 0) +
126
- (data.uhc_doubles_wins || 0) +
127
- (data.uhc_four_wins || 0) +
128
- (data.uhc_meetup_wins || 0),
129
- losses:
130
- (data.uhc_duel_losses || 0) +
131
- (data.uhc_doubles_losses || 0) +
132
- (data.uhc_four_losses || 0) +
133
- (data.uhc_meetup_losses || 0),
134
- WLRatio: divide(
135
- (data.uhc_duel_wins || 0) +
136
- (data.uhc_doubles_wins || 0) +
137
- (data.uhc_four_wins || 0) +
138
- (data.uhc_meetup_wins || 0),
139
- (data.uhc_duel_losses || 0) +
140
- (data.uhc_doubles_losses || 0) +
141
- (data.uhc_four_losses || 0) +
142
- (data.uhc_meetup_losses || 0)
143
- ),
144
- playedGames:
145
- (data.uhc_duel_rounds_played || 0) +
146
- (data.uhc_doubles_rounds_played || 0) +
147
- (data.uhc_four_rounds_played || 0) +
148
- (data.uhc_meetup_rounds_played || 0)
149
- },
150
- '1v1': {
151
- division: getDivision(data, 'uhc'),
152
- winstreak: data.current_winstreak_mode_uhc_duel || 0,
153
- bestWinstreak: data.best_winstreak_mode_uhc_duel || 0,
154
- kills: data.uhc_duel_kills || 0,
155
- deaths: data.uhc_duel_deaths || 0,
156
- KDRatio: divide(data.uhc_duel_kills, data.uhc_duel_deaths),
157
- wins: data.uhc_duel_wins || 0,
158
- losses: data.uhc_duel_losses || 0,
159
- WLRatio: divide(data.uhc_duel_wins, data.uhc_duel_losses),
160
- playedGames: data.uhc_duel_rounds_played || 0
161
- },
162
- '2v2': {
163
- division: getDivision(data, 'uhc'),
164
- winstreak: data.current_winstreak_mode_uhc_doubles || 0,
165
- bestWinstreak: data.best_winstreak_mode_uhc_doubles || 0,
166
- kills: data.uhc_doubles_kills || 0,
167
- deaths: data.uhc_doubles_deaths || 0,
168
- KDRatio: divide(data.uhc_doubles_kills, data.uhc_doubles_deaths),
169
- wins: data.uhc_doubles_wins || 0,
170
- losses: data.uhc_doubles_losses || 0,
171
- WLRatio: divide(data.uhc_doubles_wins, data.uhc_doubles_losses),
172
- playedGames: data.uhc_doubles_rounds_played || 0
173
- },
174
- '4v4': {
175
- division: getDivision(data, 'uhc'),
176
- winstreak: data.current_winstreak_mode_uhc_four || 0,
177
- bestWinstreak: data.best_winstreak_mode_uhc_four || 0,
178
- kills: data.uhc_four_kills || 0,
179
- deaths: data.uhc_four_deaths || 0,
180
- KDRatio: divide(data.uhc_four_kills, data.uhc_four_deaths),
181
- wins: data.uhc_four_wins || 0,
182
- losses: data.uhc_four_losses || 0,
183
- WLRatio: divide(data.uhc_four_wins, data.uhc_four_losses),
184
- playedGames: data.uhc_four_rounds_played || 0
185
- },
186
- meetup: {
187
- division: getDivision(data, 'uhc'),
188
- winstreak: data.current_winstreak_mode_uhc_meetup || 0,
189
- bestWinstreak: data.best_winstreak_mode_uhc_meetup || 0,
190
- kills: data.uhc_meetup_kills || 0,
191
- deaths: data.uhc_meetup_deaths || 0,
192
- KDRatio: divide(data.uhc_meetup_kills, data.uhc_meetup_deaths),
193
- wins: data.uhc_meetup_wins || 0,
194
- losses: data.uhc_meetup_losses || 0,
195
- WLRatio: divide(data.uhc_meetup_wins, data.uhc_meetup_losses),
196
- playedGames: data.uhc_meetup_rounds_played || 0
197
- }
198
- };
199
- /**
200
- * @type {DuelsParkour}
201
- */
202
- this.parkour = {
203
- division: getDivision(data, 'parkour'),
204
- deaths: data.parkour_eight_deaths || 0,
205
- wins: data.parkour_eight_wins || 0,
206
- losses: data.parkour_eight_losses || 0,
207
- WLRatio: divide(data.parkour_eight_wins, data.parkour_eight_losses),
208
- playedGames: data.parkour_eight_rounds_played || 0
209
- };
210
- /**
211
- * @type {DuelsBoxing}
212
- */
213
- this.boxing = {
214
- division: getDivision(data, 'boxing'),
215
- kills: data.boxing_duel_kills || 0,
216
- wins: data.boxing_duel_wins || 0,
217
- losses: data.boxing_duel_losses || 0,
218
- WLRatio: divide(data.boxing_duel_wins, data.boxing_duel_losses),
219
- playedGames: data.boxing_duel_rounds_played || 0,
220
- meleeSwings: data.boxing_duel_melee_swings || 0,
221
- meleeHits: data.boxing_duel_melee_hits || 0
222
- };
223
- /**
224
- * @type {DuelsBowspleef}
225
- */
226
- this.bowspleef = {
227
- division: getDivision(data, 'tnt_games'),
228
- winstreak: data.current_tnt_games_winstreak || 0,
229
- bestWinstreak: data.best_tnt_games_winstreak || 0,
230
- bowShots: data.bowspleef_duel_bow_shots || 0,
231
- deaths: data.bowspleef_duel_deaths || 0,
232
- wins: data.bowspleef_duel_wins || 0,
233
- losses: data.bowspleef_duel_losses || 0,
234
- WLRatio: divide(data.bowspleef_duel_wins || 0, data.bowspleef_duel_losses || 0),
235
- playedGames: data.bowspleef_duel_rounds_played || 0
236
- };
237
- /**
238
- * @type {DuelsArena}
239
- */
240
- this.arena = {
241
- kills: data.duel_arena_kills || 0,
242
- deaths: data.duel_arena_deaths || 0,
243
- KDRatio: divide(data.duel_arena_kills, data.duel_arena_deaths),
244
- wins: data.duel_arena_wins || 0,
245
- losses: data.duel_arena_losses || 0,
246
- WLRatio: divide(data.duel_arena_wins, data.duel_arena_losses),
247
- playedGames: data.duel_arena_rounds_played || 0
248
- };
926
+ this.uhc = new DuelsUHC(data);
927
+
928
+ /**
929
+ * SkyWars duels stats
930
+ * @type {DuelsSkyWars}
931
+ */
932
+ this.skywars = new DuelsSkyWars(data);
249
933
  /**
250
934
  * MegaWalls duels stats
251
- * @type {DuelsModeStats}
252
- */
253
- this.megawalls = {
254
- division: getDivision(data, 'mega_walls'),
255
- winstreak: data.current_winstreak_mode_mw_duel || 0,
256
- bestWinstreak: data.best_winstreak_mode_mw_duel || 0,
257
- kills: data.mw_duel_kills || 0,
258
- deaths: data.mw_duel_deaths || 0,
259
- KDRatio: divide(data.mw_duel_kills, data.mw_duel_deaths),
260
- wins: data.mw_duel_wins || 0,
261
- losses: data.mw_duel_losses || 0,
262
- WLRatio: divide(data.mw_duel_wins, data.mw_duel_losses),
263
- playedGames: data.mw_duel_rounds_played || 0
264
- };
935
+ * @type {DuelsMegaWalls}
936
+ */
937
+ this.megawalls = new DuelsMegaWalls(data);
938
+ /**
939
+ * Blitz duel stats
940
+ * @type {DuelsGamemode}
941
+ */
942
+ this.blitz = new DuelsGamemode(data, 'blitz_duel', getTitle(data, 'blitz'));
265
943
  /**
266
944
  * OP duels stats
267
945
  * @type {DuelsOP}
268
946
  */
269
- this.op = {
270
- overall: {
271
- division: getDivision(data, 'op'),
272
- winstreak: data.current_op_winstreak || 0,
273
- bestWinstreak: data.best_op_winstreak || 0,
274
- kills: (data.op_duel_kills || 0) + (data.op_doubles_kills || 0),
275
- deaths: (data.op_duel_deaths || 0) + (data.op_doubles_deaths || 0),
276
- KDRatio: divide(
277
- (data.op_duel_kills || 0) + (data.op_doubles_kills || 0),
278
- (data.op_duel_deaths || 0) + (data.op_doubles_deaths || 0)
279
- ),
280
- wins: (data.op_duel_wins || 0) + (data.op_doubles_wins || 0),
281
- losses: (data.op_duel_losses || 0) + (data.op_doubles_losses || 0),
282
- WLRatio: divide(
283
- (data.op_duel_wins || 0) + (data.op_doubles_wins || 0),
284
- (data.op_duel_losses || 0) + (data.op_doubles_losses || 0)
285
- ),
286
- playedGames: (data.op_duel_rounds_played || 0) + (data.op_doubles_rounds_played || 0)
287
- },
288
- '1v1': {
289
- division: getDivision(data, 'op'),
290
- winstreak: data.current_winstreak_mode_op_duel || 0,
291
- bestWinstreak: data.best_winstreak_mode_op_duel || 0,
292
- kills: data.op_duel_kills || 0,
293
- deaths: data.op_duel_deaths || 0,
294
- KDRatio: divide(data.op_duel_kills, data.op_duel_deaths),
295
- wins: data.op_duel_wins || 0,
296
- losses: data.op_duel_losses || 0,
297
- WLRatio: divide(data.op_duel_wins, data.op_duel_losses),
298
- playedGames: data.op_duel_rounds_played || 0
299
- },
300
- '2v2': {
301
- division: getDivision(data, 'op'),
302
- winstreak: data.current_winstreak_mode_op_doubles || 0,
303
- bestWinstreak: data.best_winstreak_mode_op_doubles || 0,
304
- kills: data.op_doubles_kills || 0,
305
- deaths: data.op_doubles_deaths || 0,
306
- KDRatio: divide(data.op_doubles_kills, data.op_doubles_deaths),
307
- wins: data.op_doubles_wins || 0,
308
- losses: data.op_doubles_losses || 0,
309
- WLRatio: divide(data.op_doubles_wins, data.op_doubles_losses),
310
- playedGames: data.op_doubles_rounds_played || 0
311
- }
312
- };
947
+ this.op = new DuelsOP(data);
313
948
  /**
314
- * SkyWars duels stats
315
- * @type {DuelsSkyWars}
949
+ * Classic duels stats
950
+ * @type {DuelsGamemode}
316
951
  */
317
- this.skywars = {
318
- overall: {
319
- division: getDivision(data, 'skywars'),
320
- winstreak: data.current_skywars_winstreak || 0,
321
- bestWinstreak: data.best_skywars_winstreak || 0,
322
- kills: (data.sw_duel_kills || 0) + (data.sw_doubles_kills || 0),
323
- deaths: (data.sw_duel_deaths || 0) + (data.sw_doubles_deaths || 0),
324
- KDRatio: divide(
325
- (data.sw_duel_kills || 0) + (data.sw_doubles_kills || 0),
326
- (data.sw_duel_deaths || 0) + (data.sw_doubles_deaths || 0)
327
- ),
328
- wins: (data.sw_duel_wins || 0) + (data.sw_doubles_wins || 0),
329
- losses: (data.sw_duel_losses || 0) + (data.sw_doubles_losses || 0),
330
- WLRatio: divide(
331
- (data.sw_duel_wins || 0) + (data.sw_doubles_wins || 0),
332
- (data.sw_duel_losses || 0) + (data.sw_doubles_losses || 0)
333
- ),
334
- playedGames: (data.sw_duel_rounds_played || 0) + (data.sw_doubles_rounds_played || 0)
335
- },
336
- '1v1': {
337
- division: getDivision(data, 'skywars'),
338
- winstreak: data.current_winstreak_mode_sw_duel || 0,
339
- bestWinstreak: data.best_winstreak_mode_sw_duel || 0,
340
- kills: data.sw_duel_kills || 0,
341
- deaths: data.sw_duel_deaths || 0,
342
- KDRatio: divide(data.sw_duel_kills, data.sw_duel_deaths),
343
- wins: data.sw_duel_wins || 0,
344
- losses: data.sw_duel_losses || 0,
345
- WLRatio: divide(data.sw_duel_wins, data.sw_duel_losses),
346
- playedGames: data.sw_duel_rounds_played || 0
347
- },
348
- '2v2': {
349
- division: getDivision(data, 'skywars'),
350
- winstreak: data.current_winstreak_mode_sw_doubles || 0,
351
- bestWinstreak: data.best_winstreak_mode_sw_doubles || 0,
352
- kills: data.sw_doubles_kills || 0,
353
- deaths: data.sw_doubles_deaths || 0,
354
- KDRatio: divide(data.sw_doubles_kills, data.sw_doubles_deaths),
355
- wins: data.sw_doubles_wins || 0,
356
- losses: data.sw_doubles_losses || 0,
357
- WLRatio: divide(data.sw_doubles_wins, data.sw_doubles_losses),
358
- playedGames: data.sw_doubles_rounds_played || 0
359
- }
360
- };
952
+ this.classic = new DuelsGamemode(data, 'classic_duel', getTitle(data, 'classic'));
361
953
  /**
362
- * Sumo duels stats
363
- * @type {DuelsModeStats}
364
- */
365
- this.sumo = {
366
- division: getDivision(data, 'sumo'),
367
- winstreak: data.current_winstreak_mode_sumo_duel || 0,
368
- bestWinstreak: data.best_winstreak_mode_sumo_duel || 0,
369
- kills: data.sumo_duel_kills || 0,
370
- deaths: data.sumo_duel_deaths || 0,
371
- KDRatio: divide(data.sumo_duel_kills, data.sumo_duel_deaths),
372
- wins: data.sumo_duel_wins || 0,
373
- losses: data.sumo_duel_losses || 0,
374
- WLRatio: divide(data.sumo_duel_wins, data.sumo_duel_losses),
375
- playedGames: data.sumo_duel_rounds_played || 0
376
- };
954
+ * Bow duels stats
955
+ * @type {DuelsGamemode}
956
+ */
957
+ this.bow = new DuelsGamemode(data, 'bow_duel', getTitle(data, 'bow'));
377
958
  /**
378
- * Classic duels stats
379
- * @type {DuelsModeStats}
380
- */
381
- this.classic = {
382
- division: getDivision(data, 'classic'),
383
- winstreak: data.current_winstreak_mode_classic_duel || 0,
384
- bestWinstreak: data.best_winstreak_mode_classic_duel || 0,
385
- kills: data.classic_duel_kills || 0,
386
- deaths: data.classic_duel_deaths || 0,
387
- KDRatio: divide(data.classic_duel_kills, data.classic_duel_deaths),
388
- wins: data.classic_duel_wins || 0,
389
- losses: data.classic_duel_losses || 0,
390
- WLRatio: divide(data.classic_duel_wins, data.classic_duel_losses),
391
- playedGames: data.classic_duel_rounds_played || 0
392
- };
959
+ * No Debuff duels stats
960
+ * @type {DuelsGamemode}
961
+ */
962
+ this.noDebuff = new DuelsGamemode(data, 'potion_duel', getTitle(data, 'no_debuff'));
393
963
  /**
394
964
  * Combo duels stats
395
- * @type {DuelsModeStats}
396
- */
397
- this.combo = {
398
- division: getDivision(data, 'combo'),
399
- winstreak: data.current_winstreak_mode_combo_duel || 0,
400
- bestWinstreak: data.best_winstreak_mode_combo_duel || 0,
401
- kills: data.combo_duel_kills || 0,
402
- deaths: data.combo_duel_deaths || 0,
403
- KDRatio: divide(data.combo_duel_kills, data.combo_duel_deaths),
404
- wins: data.combo_duel_wins || 0,
405
- losses: data.combo_duel_losses || 0,
406
- WLRatio: divide(data.combo_duel_wins, data.combo_duel_losses),
407
- playedGames: data.combo_duel_rounds_played || 0
408
- };
409
- /**
410
- * The bridge duels stats
965
+ * @type {DuelsGamemode}
966
+ */
967
+ this.combo = new DuelsGamemode(data, 'combo_duel', getTitle(data, 'combo'));
968
+ /**
969
+ * Bow Spleef duels stats
970
+ * @type {DuelsGamemode}
971
+ */
972
+ this.bowSpleef = new DuelsGamemode(data, 'bowspleef_duel', getTitle(data, 'tnt_games'));
973
+ /**
974
+ * Sumo duels stats
975
+ * @type {DuelsGamemode}
976
+ */
977
+ this.sumo = new DuelsGamemode(data, 'sumo_duel', getTitle(data, 'sumo'));
978
+ /**
979
+ * Bridge duels stats
411
980
  * @type {DuelsBridge}
412
981
  */
413
- this.bridge = {
414
- overall: {
415
- division: getDivision(data, 'bridge'),
416
- winstreak: data.current_bridge_winstreak || 0,
417
- bestWinstreak: data.best_bridge_winstreak || 0,
418
- kills:
419
- (data.bridge_duel_bridge_kills || 0) +
420
- (data.bridge_doubles_bridge_kills || 0) +
421
- (data.bridge_2v2v2v2_bridge_kills || 0) +
422
- (data.bridge_3v3v3v3_bridge_kills || 0) +
423
- (data.bridge_four_bridge_kills || 0) +
424
- (data.bridge_threes_bridge_kills || 0) +
425
- (data.capture_threes_bridge_kills || 0),
426
- deaths:
427
- (data.bridge_duel_bridge_deaths || 0) +
428
- (data.bridge_doubles_bridge_deaths || 0) +
429
- (data.bridge_2v2v2v2_bridge_deaths || 0) +
430
- (data.bridge_3v3v3v3_bridge_deaths || 0) +
431
- (data.bridge_four_bridge_deaths || 0) +
432
- (data.bridge_threes_bridge_deaths || 0) +
433
- (data.capture_threes_bridge_deaths || 0),
434
- KDRatio: divide(
435
- (data.bridge_duel_bridge_kills || 0) +
436
- (data.bridge_doubles_bridge_kills || 0) +
437
- (data.bridge_2v2v2v2_bridge_kills || 0) +
438
- (data.bridge_3v3v3v3_bridge_kills || 0) +
439
- (data.bridge_four_bridge_kills || 0) +
440
- (data.bridge_threes_bridge_kills || 0) +
441
- (data.capture_threes_bridge_kills || 0),
442
- (data.bridge_duel_bridge_deaths || 0) +
443
- (data.bridge_doubles_bridge_deaths || 0) +
444
- (data.bridge_2v2v2v2_bridge_deaths || 0) +
445
- (data.bridge_3v3v3v3_bridge_deaths || 0) +
446
- (data.bridge_four_bridge_deaths || 0) +
447
- (data.bridge_threes_bridge_deaths || 0) +
448
- (data.capture_threes_bridge_deaths || 0)
449
- ),
450
- wins:
451
- (data.bridge_duel_wins || 0) +
452
- (data.bridge_doubles_wins || 0) +
453
- (data.bridge_2v2v2v2_wins || 0) +
454
- (data.bridge_3v3v3v3_wins || 0) +
455
- (data.bridge_four_wins || 0) +
456
- (data.bridge_threes_wins || 0) +
457
- (data.capture_threes_wins || 0),
458
- losses:
459
- (data.bridge_duel_losses || 0) +
460
- (data.bridge_doubles_losses || 0) +
461
- (data.bridge_2v2v2v2_losses || 0) +
462
- (data.bridge_3v3v3v3_losses || 0) +
463
- (data.bridge_four_losses || 0) +
464
- (data.bridge_threes_bridge_losses || 0) +
465
- (data.capture_threes_bridge_losses || 0),
466
- WLRatio: divide(
467
- (data.bridge_duel_wins || 0) +
468
- (data.bridge_doubles_wins || 0) +
469
- (data.bridge_2v2v2v2_wins || 0) +
470
- (data.bridge_3v3v3v3_wins || 0) +
471
- (data.bridge_four_wins || 0) +
472
- (data.bridge_threes_bridge_wins || 0) +
473
- (data.capture_threes_wins || 0),
474
- (data.bridge_duel_losses || 0) +
475
- (data.bridge_doubles_losses || 0) +
476
- (data.bridge_2v2v2v2_losses || 0) +
477
- (data.bridge_3v3v3v3_losses || 0) +
478
- (data.bridge_four_losses || 0) +
479
- (data.bridge_threes_bridge_losses || 0) +
480
- (data.capture_threes_bridge_losses || 0)
481
- ),
482
- playedGames:
483
- (data.bridge_duel_rounds_played || 0) +
484
- (data.bridge_doubles_rounds_played || 0) +
485
- (data.bridge_2v2v2v2_rounds_played || 0) +
486
- (data.bridge_3v3v3v3_rounds_played || 0) +
487
- (data.bridge_four_rounds_played || 0) +
488
- (data.bridge_threes_bridge_rounds_played || 0) +
489
- (data.capture_threes_rounds_played || 0),
490
- goals:
491
- (data.bridge_duel_goals || 0) +
492
- (data.bridge_doubles_goals || 0) +
493
- (data.bridge_2v2v2v2_goals || 0) +
494
- (data.bridge_3v3v3v3_goals || 0) +
495
- (data.bridge_four_goals || 0) +
496
- (data.bridge_threes_bridge_goals || 0) +
497
- (data.capture_threes_goals || 0)
498
- },
499
- '1v1': {
500
- division: getDivision(data, 'bridge'),
501
- winstreak: data.current_winstreak_mode_bridge_duel || 0,
502
- bestWinstreak: data.best_winstreak_mode_bridge_duel || 0,
503
- kills: data.bridge_duel_bridge_kills || 0,
504
- deaths: data.bridge_duel_bridge_deaths || 0,
505
- KDRatio: divide(data.bridge_duel_bridge_kills, data.bridge_duel_bridge_deaths),
506
- wins: data.bridge_duel_wins || 0,
507
- losses: data.bridge_duel_losses || 0,
508
- WLRatio: divide(data.bridge_duel_wins, data.bridge_duel_losses),
509
- playedGames: data.bridge_duel_rounds_played || 0,
510
- goals: data.bridge_duel_goals || 0
511
- },
512
- '2v2': {
513
- division: getDivision(data, 'bridge'),
514
- winstreak: data.current_winstreak_mode_bridge_doubles || 0,
515
- bestWinstreak: data.best_winstreak_mode_bridge_doubles || 0,
516
- kills: data.bridge_doubles_bridge_kills || 0,
517
- deaths: data.bridge_doubles_bridge_deaths || 0,
518
- KDRatio: divide(data.bridge_doubles_bridge_kills, data.bridge_doubles_bridge_deaths),
519
- wins: data.bridge_doubles_wins || 0,
520
- losses: data.bridge_doubles_losses || 0,
521
- WLRatio: divide(data.bridge_doubles_wins, data.bridge_doubles_losses),
522
- playedGames: data.bridge_doubles_rounds_played || 0,
523
- goals: data.bridge_doubles_goals || 0
524
- },
525
- '3v3': {
526
- division: getDivision(data, 'bridge'),
527
- winstreak: data.current_winstreak_mode_bridge_threes || 0,
528
- bestWinstreak: data.best_winstreak_mode_bridge_threes || 0,
529
- kills: data.bridge_threes_bridge_kills || 0,
530
- deaths: data.bridge_threes_bridge_deaths || 0,
531
- KDRatio: divide(data.bridge_threes_bridge_kills, data.bridge_threes_bridge_deaths),
532
- wins: data.bridge_threes_wins || 0,
533
- losses: data.bridge_threes_losses || 0,
534
- WLRatio: divide(data.bridge_threes_wins, data.bridge_threes_losses),
535
- playedGames: data.bridge_threes_rounds_played || 0,
536
- goals: data.bridge_threes_goals || 0
537
- },
538
- '2v2v2v2': {
539
- division: getDivision(data, 'bridge'),
540
- winstreak: data.current_winstreak_mode_bridge_2v2v2v2 || 0,
541
- bestWinstreak: data.best_winstreak_mode_bridge_2v2v2v2 || 0,
542
- kills: data.bridge_2v2v2v2_bridge_kills || 0,
543
- deaths: data.bridge_2v2v2v2_bridge_deaths || 0,
544
- KDRatio: divide(data.bridge_2v2v2v2_bridge_kills, data.bridge_2v2v2v2_bridge_deaths),
545
- wins: data.bridge_2v2v2v2_wins || 0,
546
- losses: data.bridge_2v2v2v2_losses || 0,
547
- WLRatio: divide(data.bridge_2v2v2v2_wins, data.bridge_2v2v2v2_losses),
548
- playedGames: data.bridge_2v2v2v2_rounds_played || 0,
549
- goals: data.bridge_2v2v2v2_goals || 0
550
- },
551
- '3v3v3v3': {
552
- division: getDivision(data, 'bridge'),
553
- winstreak: data.current_winstreak_mode_bridge_3v3v3v3 || 0,
554
- bestWinstreak: data.best_winstreak_mode_bridge_3v3v3v3 || 0,
555
- kills: data.bridge_3v3v3v3_bridge_kills || 0,
556
- deaths: data.bridge_3v3v3v3_bridge_deaths || 0,
557
- KDRatio: divide(data.bridge_3v3v3v3_bridge_kills, data.bridge_3v3v3v3_bridge_deaths),
558
- wins: data.bridge_3v3v3v3_wins || 0,
559
- losses: data.bridge_3v3v3v3_losses || 0,
560
- WLRatio: divide(data.bridge_3v3v3v3_wins, data.bridge_3v3v3v3_losses),
561
- playedGames: data.bridge_3v3v3v3_rounds_played || 0,
562
- goals: data.bridge_3v3v3v3_goals || 0
563
- },
564
- '4v4': {
565
- division: getDivision(data, 'bridge'),
566
- winstreak: data.current_winstreak_mode_bridge_four || 0,
567
- bestWinstreak: data.best_winstreak_mode_bridge_four || 0,
568
- kills: data.bridge_four_bridge_kills || 0,
569
- deaths: data.bridge_four_bridge_deaths || 0,
570
- KDRatio: divide(data.bridge_four_bridge_kills, data.bridge_four_bridge_deaths),
571
- wins: data.bridge_four_wins || 0,
572
- losses: data.bridge_four_losses || 0,
573
- WLRatio: divide(data.bridge_four_wins, data.bridge_four_losses),
574
- playedGames: data.bridge_four_rounds_played || 0,
575
- goals: data.bridge_four_goals || 0
576
- },
577
-
578
- ctf: {
579
- division: getDivision(data, 'bridge'),
580
- kills: data.capture_threes_bridge_kills || 0,
581
- deaths: data.capture_threes_bridge_deaths || 0,
582
- KDRatio: divide(data.capture_threes_bridge_kills, data.capture_threes_bridge_deaths),
583
- wins: data.capture_threes_wins || 0,
584
- losses: data.capture_threes_losses || 0,
585
- WLRatio: divide(data.capture_threes_wins, data.capture_threes_losses),
586
- captures: data.capture_threes_captures || 0,
587
- playedGames: data.capture_threes_rounds_played || 0,
588
- goals: data.capture_threes_goals || 0
589
- }
590
- };
982
+ this.bridge = new DuelsBridge(data);
591
983
  /**
592
- * Blitz duel stats
593
- * @type {DuelsModeStats}
594
- */
595
- this.blitz = {
596
- division: getDivision(data, 'blitz'),
597
- winstreak: data.current_winstreak_mode_blitz_duel || 0,
598
- bestWinstreak: data.best_winstreak_mode_blitz_duel || 0,
599
- kills: data.blitz_duel_kills || 0,
600
- deaths: data.blitz_duel_deaths || 0,
601
- KDRatio: divide(data.blitz_duel_kills, data.blitz_duel_deaths),
602
- wins: data.blitz_duel_wins || 0,
603
- losses: data.blitz_duel_losses || 0,
604
- WLRatio: divide(data.blitz_duel_wins, data.blitz_duel_losses),
605
- playedGames: data.blitz_duel_rounds_played || 0
606
- };
607
- /**
608
- * Nodebuff duel stats
609
- * @type {DuelsModeStats}
610
- */
611
- this.nodebuff = {
612
- division: getDivision(data, 'no_debuff'),
613
- winstreak: data.current_winstreak_mode_potion_duel || 0,
614
- bestWinstreak: data.best_winstreak_mode_potion_duel || 0,
615
- kills: data.potion_duel_kills || 0,
616
- deaths: data.potion_duel_deaths || 0,
617
- KDRatio: divide(data.potion_duel_kills, data.potion_duel_deaths),
618
- wins: data.potion_duel_wins || 0,
619
- losses: data.potion_duel_losses || 0,
620
- WLRatio: divide(data.potion_duel_wins, data.potion_duel_losses),
621
- playedGames: data.potion_duel_rounds_played || 0
622
- };
623
- /**
624
- * Bow duel stats
625
- * @type {DuelsModeStats}
626
- */
627
- this.bow = {
628
- division: getDivision(data, 'bow'),
629
- winstreak: data.current_winstreak_mode_bow_duel || 0,
630
- bestWinstreak: data.best_winstreak_mode_bow_duel || 0,
631
- kills: data.bow_duel_kills || 0,
632
- deaths: data.bow_duel_deaths || 0,
633
- KDRatio: divide(data.bow_duel_kills, data.bow_duel_deaths),
634
- wins: data.bow_duel_wins || 0,
635
- losses: data.bow_duel_losses || 0,
636
- WLRatio: divide(data.bow_duel_wins, data.bow_duel_losses),
637
- playedGames: data.bow_duel_rounds_played || 0
638
- };
984
+ * Parkour duels stats
985
+ * @type {DuelsGamemode}
986
+ */
987
+ this.parkour = new DuelsGamemode(data, 'parkour_eight', getTitle(data, 'parkour'));
988
+ /**
989
+ * Arena duels stats
990
+ * @type {DuelsGamemode}
991
+ */
992
+ this.arena = new DuelsGamemode(data, 'duel_arena');
639
993
  }
640
994
  }
641
- /**
642
- * @typedef {object} DuelsModeStats
643
- * @property {number} winstreak Current winstreak
644
- * @property {number} bestWinstreak Best winstreak
645
- * @property {string|null} division Division
646
- * @property {number} kills Kills
647
- * @property {number} deaths Deaths
648
- * @property {number} wins Wins
649
- * @property {number} losses Losses
650
- * @property {number} KDRatio Kill/Death ratio
651
- * @property {number} WLRatio Win/Loss ratio
652
- * @property {number} playedGames Played games
653
- */
654
- /**
655
- * @typedef {object} BridgeModeStats
656
- * @property {number} winstreak Current winstreak
657
- * @property {number} bestWinstreak Best winstreak
658
- * @property {string|null} division Division
659
- * @property {number} kills Kills
660
- * @property {number} deaths Deaths
661
- * @property {number} wins Wins
662
- * @property {number} losses Losses
663
- * @property {number} KDRatio Kill/Death ratio
664
- * @property {number} WLRatio Win/Loss ratio
665
- * @property {number} playedGames Played games
666
- * @property {number} goals Goals
667
- */
668
- /**
669
- * @typedef {object} DuelsBowspleef
670
- * @property {string|null} division Division
671
- * @property {number} winstreak Winstreak
672
- * @property {number} bestWinstreak Best winstreak
673
- * @property {number} bowShots Bow shots
674
- * @property {number} deaths Deaths
675
- * @property {number} wins Wins
676
- * @property {number} losses Losses
677
- * @property {number} WLRatio Win/Loss ratio
678
- * @property {number} playedGames Played games
679
- */
680
- /**
681
- * @typedef {object} BridgeCTFModeStats
682
- * @property {string|null} division Division
683
- * @property {number} kills Kills
684
- * @property {number} deaths Deaths
685
- * @property {number} wins Wins
686
- * @property {number} losses Losses
687
- * @property {number} KDRatio Kill/Death ratio
688
- * @property {number} WLRatio Win/Loss ratio
689
- * @property {number} playedGames Played games
690
- * @property {number} captures Captures
691
- */
692
- /**
693
- * @typedef {object} DuelsParkour
694
- * @property {string|null} division Division
695
- * @property {number} deaths Deaths
696
- * @property {number} wins Wins
697
- * @property {number} losses Losses
698
- * @property {number} WLRatio Win/Loss ratio
699
- * @property {number} playedGames Played games
700
- */
701
- /**
702
- * @typedef {object} DuelsBoxing
703
- * @property {string|null} division Division
704
- * @property {number} kills Kills
705
- * @property {number} wins Wins
706
- * @property {number} losses Losses
707
- * @property {number} WLRatio Win/Loss ratio
708
- * @property {number} playedGames Played games
709
- * @property {number} meleeSwings Melee swings
710
- * @property {number} meleeHits Melee hits
711
- */
712
- /**
713
- * @typedef {object} DuelsArena
714
- * @property {number} kills Kills
715
- * @property {number} deaths Deaths
716
- * @property {number} wins Wins
717
- * @property {number} losses Losses
718
- * @property {number} KDRatio Kill/Death ratio
719
- * @property {number} WLRatio Win/Loss ratio
720
- * @property {number} playedGames Played games
721
- */
722
- /**
723
- * @typedef {object} DuelsOP
724
- * @property {DuelsModeStats} overall Overall OP duel stats
725
- * @property {DuelsModeStats} '1v1' OP Duel 1v1 stats
726
- * @property {DuelsModeStats} '2v2' OP Duel 2v2 stats
727
- */
728
- /**
729
- * @typedef {object} DuelsUHC
730
- * @property {DuelsModeStats} overall Overall UHC duel stats
731
- * @property {DuelsModeStats} '1v1' UHC Duel 1v1 stats
732
- * @property {DuelsModeStats} '2v2' UHC Duel 2v2 stats
733
- * @property {DuelsModeStats} '4v4' UHC Duel 4v4 stats
734
- * @property {DuelsModeStats} meetup UHC Meetup
735
- */
736
- /**
737
- * @typedef {object} DuelsSkyWars
738
- * @property {DuelsModeStats} overall Overall SkyWars duel stats
739
- * @property {DuelsModeStats} '1v1' SkyWars Duel 1v1 stats
740
- * @property {DuelsModeStats} '2v2' SkyWars Duel 2v2 stats
741
- */
742
- /**
743
- * @typedef {object} DuelsBridge
744
- * @property {BridgeModeStats} overall Overall The Bridge duel stats
745
- * @property {BridgeModeStats} '1v1' The Bridge Duel 1v1 stats
746
- * @property {BridgeModeStats} '2v2' The Bridge Duel 2v2 stats
747
- * @property {BridgeModeStats} '3v3' The Bridge Duel 3v3 stats
748
- * @property {BridgeModeStats} '4v4' The Bridge Duel 4v4 stats
749
- * @property {BridgeModeStats} '2v2v2v2' The Bridge Duel 2v2v2v2 stats
750
- * @property {BridgeModeStats} '3v3v3v3' The Bridge Duel 3v3v3v3 stats
751
- * @property {BridgeCTFModeStats} ctf The Bridge Capture The Flag duel 3v3 stats
752
- */
995
+
753
996
  module.exports = Duels;