hypixel-api-reborn 11.2.1 → 11.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/package.json +8 -8
  2. package/src/API/housing/getActiveHouses.js +7 -0
  3. package/src/API/housing/getHouse.js +9 -0
  4. package/src/API/housing/getPlayerHouses.js +11 -0
  5. package/src/API/index.js +6 -1
  6. package/src/API/skyblock/getFireSales.js +1 -1
  7. package/src/API/skyblock/getGarden.js +7 -0
  8. package/src/API/skyblock/getMember.js +4 -2
  9. package/src/API/skyblock/getProfiles.js +4 -2
  10. package/src/Client.js +46 -2
  11. package/src/Private/requests.js +1 -1
  12. package/src/index.js +5 -0
  13. package/src/structures/House.js +54 -0
  14. package/src/structures/MiniGames/Arcade.js +754 -270
  15. package/src/structures/MiniGames/ArenaBrawl.js +97 -31
  16. package/src/structures/MiniGames/BlitzSurvivalGames.js +378 -127
  17. package/src/structures/MiniGames/BuildBattle.js +19 -8
  18. package/src/structures/MiniGames/CopsAndCrims.js +252 -25
  19. package/src/structures/MiniGames/Duels.js +916 -656
  20. package/src/structures/MiniGames/MegaWalls.js +390 -51
  21. package/src/structures/MiniGames/MurderMystery.js +151 -30
  22. package/src/structures/MiniGames/Paintball.js +31 -11
  23. package/src/structures/MiniGames/Quakecraft.js +113 -50
  24. package/src/structures/MiniGames/SkyWars.js +340 -195
  25. package/src/structures/MiniGames/SmashHeroes.js +195 -69
  26. package/src/structures/MiniGames/SpeedUHC.js +76 -36
  27. package/src/structures/MiniGames/TNTGames.js +242 -73
  28. package/src/structures/MiniGames/TurboKartRacers.js +55 -115
  29. package/src/structures/MiniGames/UHC.js +135 -124
  30. package/src/structures/MiniGames/VampireZ.js +70 -37
  31. package/src/structures/MiniGames/Warlords.js +126 -1
  32. package/src/structures/MiniGames/WoolWars.js +54 -4
  33. package/src/structures/Player.js +33 -25
  34. package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
  35. package/src/structures/SkyBlock/SkyblockMember.js +12 -5
  36. package/src/utils/Constants.js +507 -5
  37. package/src/utils/SkyblockUtils.js +33 -0
  38. package/typings/index.d.ts +1034 -899
@@ -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,816 @@ 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
+ * Goals (only shows up in bridge)
118
+ * @type {number}
119
+ */
120
+ this.goals = data[`${mode}_goals`] || 0;
121
+ }
122
+ }
123
+
124
+ class DuelsUHC {
125
+ /**
126
+ * @param {object} data Duels data
127
+ */
128
+ constructor(data) {
129
+ /**
130
+ * Title
131
+ * @type {string}
132
+ */
133
+ this.title = getTitle(data, 'uhc');
134
+ /**
135
+ * Winstreak
136
+ * @type {number}
137
+ */
138
+ this.winstreak = data.current_uhc_winstreak || 0;
139
+ /**
140
+ * Best Winstreak
141
+ * @type {number}
142
+ */
143
+ this.bestWinstreak = data.best_uhc_winstreak || 0;
144
+ /**
145
+ * Solo Game Mode Stats
146
+ * @type {DuelsGamemode}
147
+ */
148
+ this.solo = new DuelsGamemode(data, 'uhc_duel', this.title);
149
+ /**
150
+ * Doubles Game Mode Stats
151
+ * @type {DuelsGamemode}
152
+ */
153
+ this.doubles = new DuelsGamemode(data, 'uhc_doubles', this.title);
154
+ /**
155
+ * Fours Game Mode Stats
156
+ * @type {DuelsGamemode}
157
+ */
158
+ this.fours = new DuelsGamemode(data, 'uhc_four', this.title);
159
+ /**
160
+ * Deathmatch Game Mode Stats
161
+ * @type {DuelsGamemode}
162
+ */
163
+ this.deathmatch = new DuelsGamemode(data, 'uhc_meetup', this.title);
164
+ /**
165
+ * Kills
166
+ * @type {number}
167
+ */
168
+ this.kills = this.solo.kills + this.doubles.kills + this.fours.kills + this.deathmatch.kills;
169
+ /**
170
+ * Deaths
171
+ * @type {number}
172
+ */
173
+ this.deaths = this.solo.deaths + this.doubles.deaths + this.fours.deaths + this.deathmatch.deaths;
174
+ /**
175
+ * KDRatio
176
+ * @type {number}
177
+ */
178
+ this.KDRatio = divide(this.kills, this.deaths);
179
+ /**
180
+ * Wins
181
+ * @type {number}
182
+ */
183
+ this.wins = this.solo.wins + this.doubles.wins + this.fours.wins + this.deathmatch.wins;
184
+ /**
185
+ * Losses
186
+ * @type {number}
187
+ */
188
+ this.losses = this.solo.losses + this.doubles.losses + this.fours.losses + this.deathmatch.losses;
189
+ /**
190
+ * WLRatio
191
+ * @type {number}
192
+ */
193
+ this.WLRatio = divide(this.wins, this.losses);
194
+ /**
195
+ * Played Games
196
+ * @type {number}
197
+ */
198
+ this.playedGames =
199
+ this.solo.playedGames + this.doubles.playedGames + this.fours.playedGames + this.deathmatch.playedGames;
200
+ /**
201
+ * Swings
202
+ * @type {number}
203
+ */
204
+ this.swings = this.solo.swings + this.doubles.swings + this.fours.swings + this.deathmatch.swings;
205
+ /**
206
+ * Hits
207
+ * @type {number}
208
+ */
209
+ this.hits = this.solo.hits + this.doubles.hits + this.fours.hits + this.deathmatch.hits;
210
+ /**
211
+ * Melee Accuracy
212
+ * @type {number}
213
+ */
214
+ this.meleeAccuracy = divide(this.hits, this.swings);
215
+ /**
216
+ * Bow Shots
217
+ * @type {number}
218
+ */
219
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots + this.fours.bowShots + this.deathmatch.bowShots;
220
+ /**
221
+ * Bow Hits
222
+ * @type {number}
223
+ */
224
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits + this.fours.bowHits + this.deathmatch.bowHits;
225
+ /**
226
+ * Bow Accuracy
227
+ * @type {number}
228
+ */
229
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
230
+ /**
231
+ * Blocks Placed
232
+ * @type {number}
233
+ */
234
+ this.blocksPlaced =
235
+ this.solo.blocksPlaced + this.doubles.blocksPlaced + this.fours.blocksPlaced + this.deathmatch.blocksPlaced;
236
+ /**
237
+ * Health Regenerated
238
+ * @type {number}
239
+ */
240
+ this.healthRegenerated =
241
+ this.solo.healthRegenerated +
242
+ this.doubles.healthRegenerated +
243
+ this.fours.healthRegenerated +
244
+ this.deathmatch.healthRegenerated;
245
+ /**
246
+ * Golden Apples Eatan
247
+ * @type {number}
248
+ */
249
+ this.goldenApplesEatan =
250
+ this.solo.goldenApplesEatan +
251
+ this.doubles.goldenApplesEatan +
252
+ this.fours.goldenApplesEatan +
253
+ this.deathmatch.goldenApplesEatan;
254
+ }
255
+ }
256
+ class DuelsSkyWars {
257
+ /**
258
+ * @param {object} data Duels data
259
+ */
260
+ constructor(data) {
261
+ /**
262
+ * Title
263
+ * @type {string}
264
+ */
265
+ this.title = getTitle(data, 'sw');
266
+ /**
267
+ * Winstreak
268
+ * @type {number}
269
+ */
270
+ this.winstreak = data.current_sw_winstreak || 0;
271
+ /**
272
+ * Best Winstreak
273
+ * @type {number}
274
+ */
275
+ this.bestWinstreak = data.best_sw_winstreak || 0;
276
+ /**
277
+ * Solo Game Mode Stats
278
+ * @type {DuelsGamemode}
279
+ */
280
+ this.solo = new DuelsGamemode(data, 'sw_duel', this.title);
281
+ /**
282
+ * Doubles Game Mode Stats
283
+ * @type {DuelsGamemode}
284
+ */
285
+ this.doubles = new DuelsGamemode(data, 'sw_doubles', this.title);
286
+ /**
287
+ * Kills
288
+ * @type {number}
289
+ */
290
+ this.kills = this.solo.kills + this.doubles.kills;
291
+ /**
292
+ * Deaths
293
+ * @type {number}
294
+ */
295
+ this.deaths = this.solo.deaths + this.doubles.deaths;
296
+ /**
297
+ * KDRatio
298
+ * @type {number}
299
+ */
300
+ this.KDRatio = divide(this.kills, this.deaths);
301
+ /**
302
+ * Wins
303
+ * @type {number}
304
+ */
305
+ this.wins = this.solo.wins + this.doubles.wins;
306
+ /**
307
+ * Losses
308
+ * @type {number}
309
+ */
310
+ this.losses = this.solo.losses + this.doubles.losses;
311
+ /**
312
+ * WLRatio
313
+ * @type {number}
314
+ */
315
+ this.WLRatio = divide(this.wins, this.losses);
316
+ /**
317
+ * Played Games
318
+ * @type {number}
319
+ */
320
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
321
+ /**
322
+ * Swings
323
+ * @type {number}
324
+ */
325
+ this.swings = this.solo.swings + this.doubles.swings;
326
+ /**
327
+ * Hits
328
+ * @type {number}
329
+ */
330
+ this.hits = this.solo.hits + this.doubles.hits;
331
+ /**
332
+ * Melee Accuracy
333
+ * @type {number}
334
+ */
335
+ this.meleeAccuracy = divide(this.hits, this.swings);
336
+ /**
337
+ * Bow Shots
338
+ * @type {number}
339
+ */
340
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
341
+ /**
342
+ * Bow Hits
343
+ * @type {number}
344
+ */
345
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
346
+ /**
347
+ * Bow Accuracy
348
+ * @type {number}
349
+ */
350
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
351
+ /**
352
+ * Blocks Placed
353
+ * @type {number}
354
+ */
355
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
356
+ /**
357
+ * Health Regenerated
358
+ * @type {number}
359
+ */
360
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
361
+ /**
362
+ * Golden Apples Eatan
363
+ * @type {number}
364
+ */
365
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
366
+ }
367
+ }
368
+ class DuelsMegaWalls {
369
+ /**
370
+ * @param {object} data Duels data
371
+ */
372
+ constructor(data) {
373
+ /**
374
+ * Title
375
+ * @type {string}
376
+ */
377
+ this.title = getTitle(data, 'mega_walls');
378
+ /**
379
+ * Winstreak
380
+ * @type {number}
381
+ */
382
+ this.winstreak = data.current_mega_walls_winstreak || 0;
383
+ /**
384
+ * Best Winstreak
385
+ * @type {number}
386
+ */
387
+ this.bestWinstreak = data.best_mega_walls_winstreak || 0;
388
+ /**
389
+ * Solo Game Mode Stats
390
+ * @type {DuelsGamemode}
391
+ */
392
+ this.solo = new DuelsGamemode(data, 'mw_duel', this.title);
393
+ /**
394
+ * Doubles Game Mode Stats
395
+ * @type {DuelsGamemode}
396
+ */
397
+ this.doubles = new DuelsGamemode(data, 'mw_doubles', this.title);
398
+ /**
399
+ * Kills
400
+ * @type {number}
401
+ */
402
+ this.kills = this.solo.kills + this.doubles.kills;
403
+ /**
404
+ * Deaths
405
+ * @type {number}
406
+ */
407
+ this.deaths = this.solo.deaths + this.doubles.deaths;
408
+ /**
409
+ * KDRatio
410
+ * @type {number}
411
+ */
412
+ this.KDRatio = divide(this.kills, this.deaths);
413
+ /**
414
+ * Wins
415
+ * @type {number}
416
+ */
417
+ this.wins = this.solo.wins + this.doubles.wins;
418
+ /**
419
+ * Losses
420
+ * @type {number}
421
+ */
422
+ this.losses = this.solo.losses + this.doubles.losses;
423
+ /**
424
+ * WLRatio
425
+ * @type {number}
426
+ */
427
+ this.WLRatio = divide(this.wins, this.losses);
428
+ /**
429
+ * Played Games
430
+ * @type {number}
431
+ */
432
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
433
+ /**
434
+ * Swings
435
+ * @type {number}
436
+ */
437
+ this.swings = this.solo.swings + this.doubles.swings;
438
+ /**
439
+ * Hits
440
+ * @type {number}
441
+ */
442
+ this.hits = this.solo.hits + this.doubles.hits;
443
+ /**
444
+ * Melee Accuracy
445
+ * @type {number}
446
+ */
447
+ this.meleeAccuracy = divide(this.hits, this.swings);
448
+ /**
449
+ * Bow Shots
450
+ * @type {number}
451
+ */
452
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
453
+ /**
454
+ * Bow Hits
455
+ * @type {number}
456
+ */
457
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
458
+ /**
459
+ * Bow Accuracy
460
+ * @type {number}
461
+ */
462
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
463
+ /**
464
+ * Blocks Placed
465
+ * @type {number}
466
+ */
467
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
468
+ /**
469
+ * Health Regenerated
470
+ * @type {number}
471
+ */
472
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
473
+ /**
474
+ * Golden Apples Eatan
475
+ * @type {number}
476
+ */
477
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
478
+ }
479
+ }
480
+ class DuelsOP {
481
+ /**
482
+ * @param {object} data Duels data
483
+ */
484
+ constructor(data) {
485
+ /**
486
+ * Title
487
+ * @type {string}
488
+ */
489
+ this.title = getTitle(data, 'op');
490
+ /**
491
+ * Winstreak
492
+ * @type {number}
493
+ */
494
+ this.winstreak = data.current_op_winstreak || 0;
495
+ /**
496
+ * Best Winstreak
497
+ * @type {number}
498
+ */
499
+ this.bestWinstreak = data.best_op_winstreak || 0;
500
+ /**
501
+ * Solo Game Mode Stats
502
+ * @type {DuelsGamemode}
503
+ */
504
+ this.solo = new DuelsGamemode(data, 'op_duel', this.title);
505
+ /**
506
+ * Doubles Game Mode Stats
507
+ * @type {DuelsGamemode}
508
+ */
509
+ this.doubles = new DuelsGamemode(data, 'op_doubles', this.title);
510
+ /**
511
+ * Kills
512
+ * @type {number}
513
+ */
514
+ this.kills = this.solo.kills + this.doubles.kills;
515
+ /**
516
+ * Deaths
517
+ * @type {number}
518
+ */
519
+ this.deaths = this.solo.deaths + this.doubles.deaths;
520
+ /**
521
+ * KDRatio
522
+ * @type {number}
523
+ */
524
+ this.KDRatio = divide(this.kills, this.deaths);
525
+ /**
526
+ * Wins
527
+ * @type {number}
528
+ */
529
+ this.wins = this.solo.wins + this.doubles.wins;
530
+ /**
531
+ * Losses
532
+ * @type {number}
533
+ */
534
+ this.losses = this.solo.losses + this.doubles.losses;
535
+ /**
536
+ * WLRatio
537
+ * @type {number}
538
+ */
539
+ this.WLRatio = divide(this.wins, this.losses);
540
+ /**
541
+ * Played Games
542
+ * @type {number}
543
+ */
544
+ this.playedGames = this.solo.playedGames + this.doubles.playedGames;
545
+ /**
546
+ * Swings
547
+ * @type {number}
548
+ */
549
+ this.swings = this.solo.swings + this.doubles.swings;
550
+ /**
551
+ * Hits
552
+ * @type {number}
553
+ */
554
+ this.hits = this.solo.hits + this.doubles.hits;
555
+ /**
556
+ * Melee Accuracy
557
+ * @type {number}
558
+ */
559
+ this.meleeAccuracy = divide(this.hits, this.swings);
560
+ /**
561
+ * Bow Shots
562
+ * @type {number}
563
+ */
564
+ this.bowShots = this.solo.bowShots + this.doubles.bowShots;
565
+ /**
566
+ * Bow Hits
567
+ * @type {number}
568
+ */
569
+ this.bowHits = this.solo.bowHits + this.doubles.bowHits;
570
+ /**
571
+ * Bow Accuracy
572
+ * @type {number}
573
+ */
574
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
575
+ /**
576
+ * Blocks Placed
577
+ * @type {number}
578
+ */
579
+ this.blocksPlaced = this.solo.blocksPlaced + this.doubles.blocksPlaced;
580
+ /**
581
+ * Health Regenerated
582
+ * @type {number}
583
+ */
584
+ this.healthRegenerated = this.solo.healthRegenerated + this.doubles.healthRegenerated;
585
+ /**
586
+ * Golden Apples Eatan
587
+ * @type {number}
588
+ */
589
+ this.goldenApplesEatan = this.solo.goldenApplesEatan + this.doubles.goldenApplesEatan;
590
+ }
591
+ }
592
+ class DuelsBridge {
593
+ /**
594
+ * @param {object} data Duels data
595
+ */
596
+ constructor(data) {
597
+ /**
598
+ * Title
599
+ * @type {string}
600
+ */
601
+ this.title = getTitle(data, 'bridge');
602
+ /**
603
+ * Winstreak
604
+ * @type {number}
605
+ */
606
+ this.winstreak = data.current_bridge_winstreak || 0;
607
+ /**
608
+ * Best Winstreak
609
+ * @type {number}
610
+ */
611
+ this.bestWinstreak = data.best_bridge_winstreak || 0;
612
+ /**
613
+ * Solo Game Mode Stats
614
+ * @type {DuelsGamemode}
615
+ */
616
+ this.solo = new DuelsGamemode(data, 'bridge_duel', this.title);
617
+ /**
618
+ * Doubles Game Mode Stats
619
+ * @type {DuelsGamemode}
620
+ */
621
+ this.doubles = new DuelsGamemode(data, 'bridge_doubles', this.title);
622
+ /**
623
+ * Threes Game Mode Stats
624
+ * @type {DuelsGamemode}
625
+ */
626
+ this.threes = new DuelsGamemode(data, 'bridge_threes', this.title);
627
+ /**
628
+ * Fours Game Mode Stats
629
+ * @type {DuelsGamemode}
630
+ */
631
+ this.fours = new DuelsGamemode(data, 'bridge_fours', this.title);
632
+ /**
633
+ * 2v2v2v2 Game Mode Stats
634
+ * @type {DuelsGamemode}
635
+ */
636
+ this['2v2v2v2'] = new DuelsGamemode(data, '2v2v2v2', this.title);
637
+ /**
638
+ * 3v3v3v3 Game Mode Stats
639
+ * @type {DuelsGamemode}
640
+ */
641
+ this['3v3v3v3'] = new DuelsGamemode(data, '3v3v3v3', this.title);
642
+ /**
643
+ * Capture The Flag Game Mode Stats
644
+ * @type {DuelsGamemode}
645
+ */
646
+ this.ctf = new DuelsGamemode(data, 'capture_threes', this.title);
647
+ /**
648
+ * Kills
649
+ * @type {number}
650
+ */
651
+ this.kills =
652
+ this.solo.kills +
653
+ this.doubles.kills +
654
+ this.threes.kills +
655
+ this.fours.kills +
656
+ this['2v2v2v2'].kills +
657
+ this['3v3v3v3'].kills +
658
+ this.ctf.kills;
659
+ /**
660
+ * Deaths
661
+ * @type {number}
662
+ */
663
+ this.deaths =
664
+ this.solo.deaths +
665
+ this.doubles.deaths +
666
+ this.threes.deaths +
667
+ this.fours.deaths +
668
+ this['2v2v2v2'].deaths +
669
+ this['3v3v3v3'].deaths +
670
+ this.ctf.deaths;
671
+ /**
672
+ * KDRatio
673
+ * @type {number}
674
+ */
675
+ this.KDRatio = divide(this.kills, this.deaths);
676
+ /**
677
+ * Wins
678
+ * @type {number}
679
+ */
680
+ this.wins =
681
+ this.solo.wins +
682
+ this.doubles.wins +
683
+ this.threes.wins +
684
+ this.fours.wins +
685
+ this['2v2v2v2'].wins +
686
+ this['3v3v3v3'].wins +
687
+ this.ctf.wins;
688
+ /**
689
+ * Losses
690
+ * @type {number}
691
+ */
692
+ this.losses =
693
+ this.solo.losses +
694
+ this.doubles.losses +
695
+ this.threes.losses +
696
+ this.fours.losses +
697
+ this['2v2v2v2'].losses +
698
+ this['3v3v3v3'].losses +
699
+ this.ctf.losses;
700
+ /**
701
+ * WLRatio
702
+ * @type {number}
703
+ */
704
+ this.WLRatio = divide(this.wins, this.losses);
705
+ /**
706
+ * Played Games
707
+ * @type {number}
708
+ */
709
+ this.playedGames =
710
+ this.solo.playedGames +
711
+ this.doubles.playedGames +
712
+ this.threes.playedGames +
713
+ this.fours.playedGames +
714
+ this['2v2v2v2'].playedGames +
715
+ this['3v3v3v3'].playedGames +
716
+ this.ctf.playedGames;
717
+ /**
718
+ * Swings
719
+ * @type {number}
720
+ */
721
+ this.swings =
722
+ this.solo.swings +
723
+ this.doubles.swings +
724
+ this.threes.swings +
725
+ this.fours.swings +
726
+ this['2v2v2v2'].swings +
727
+ this['3v3v3v3'].swings +
728
+ this.ctf.swings;
729
+ /**
730
+ * Hits
731
+ * @type {number}
732
+ */
733
+ this.hits =
734
+ this.solo.hits +
735
+ this.doubles.hits +
736
+ this.threes.hits +
737
+ this.fours.hits +
738
+ this['2v2v2v2'].hits +
739
+ this['3v3v3v3'].hits +
740
+ this.ctf.hits;
741
+ /**
742
+ * Melee Accuracy
743
+ * @type {number}
744
+ */
745
+ this.meleeAccuracy = divide(this.hits, this.swings);
746
+ /**
747
+ * Bow Shots
748
+ * @type {number}
749
+ */
750
+ this.bowShots =
751
+ this.solo.bowShots +
752
+ this.doubles.bowShots +
753
+ this.threes.bowShots +
754
+ this.fours.bowShots +
755
+ this['2v2v2v2'].bowShots +
756
+ this['3v3v3v3'].bowShots +
757
+ this.ctf.bowShots;
758
+ /**
759
+ * Bow Hits
760
+ * @type {number}
761
+ */
762
+ this.bowHits =
763
+ this.solo.bowHits +
764
+ this.doubles.bowHits +
765
+ this.threes.bowHits +
766
+ this.fours.bowHits +
767
+ this['2v2v2v2'].bowHits +
768
+ this['3v3v3v3'].bowHits +
769
+ this.ctf.bowHits;
770
+ /**
771
+ * Bow Accuracy
772
+ * @type {number}
773
+ */
774
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
775
+ /**
776
+ * Blocks Placed
777
+ * @type {number}
778
+ */
779
+ this.blocksPlaced =
780
+ this.solo.blocksPlaced +
781
+ this.doubles.blocksPlaced +
782
+ this.threes.blocksPlaced +
783
+ this.fours.blocksPlaced +
784
+ this['2v2v2v2'].blocksPlaced +
785
+ this['3v3v3v3'].blocksPlaced +
786
+ this.ctf.blocksPlaced;
787
+ /**
788
+ * Health Regenerated
789
+ * @type {number}
790
+ */
791
+ this.healthRegenerated =
792
+ this.solo.healthRegenerated +
793
+ this.doubles.healthRegenerated +
794
+ this.threes.healthRegenerated +
795
+ this.fours.healthRegenerated +
796
+ this['2v2v2v2'].healthRegenerated +
797
+ this['3v3v3v3'].healthRegenerated +
798
+ this.ctf.healthRegenerated;
799
+ /**
800
+ * Golden Apples Eatan
801
+ * @type {number}
802
+ */
803
+ this.goldenApplesEatan =
804
+ this.solo.goldenApplesEatan +
805
+ this.doubles.goldenApplesEatan +
806
+ this.threes.goldenApplesEatan +
807
+ this.fours.goldenApplesEatan +
808
+ this['2v2v2v2'].goldenApplesEatan +
809
+ this['3v3v3v3'].goldenApplesEatan +
810
+ this.ctf.goldenApplesEatan;
811
+ /**
812
+ * Goals
813
+ * @type {number}
814
+ */
815
+ this.goals =
816
+ this.solo.goals +
817
+ this.doubles.goals +
818
+ this.threes.goals +
819
+ this.fours.goals +
820
+ this['2v2v2v2'].goals +
821
+ this['3v3v3v3'].goals +
822
+ this.ctf.goals;
26
823
  }
27
- return {
28
- kills: totalKills,
29
- deaths: totalDeaths
30
- };
31
824
  }
825
+
32
826
  /**
33
827
  * Duels class
34
828
  */
@@ -43,20 +837,20 @@ class Duels {
43
837
  */
44
838
  this.tokens = data.coins || 0;
45
839
  /**
46
- * All modes division
840
+ * All modes Title
47
841
  * @type {string|null}
48
842
  */
49
- this.division = getDivision(data);
843
+ this.title = getTitle(data);
50
844
  /**
51
845
  * Kills
52
846
  * @type {number}
53
847
  */
54
- this.kills = getTotalKillsDeaths(data).kills;
848
+ this.kills = data.kills || 0;
55
849
  /**
56
850
  * Deaths
57
851
  * @type {number}
58
852
  */
59
- this.deaths = getTotalKillsDeaths(data).deaths;
853
+ this.deaths = data.deaths || 0;
60
854
  /**
61
855
  * Kill Death ratio
62
856
  * @type {number}
@@ -92,662 +886,128 @@ class Duels {
92
886
  * @type {number}
93
887
  */
94
888
  this.bestWinstreak = data.best_overall_winstreak || 0;
889
+ /**
890
+ * Ping Range Preference
891
+ * @type {number}
892
+ */
893
+ this.ping = data.pingPreference || 0;
894
+ /**
895
+ * Blocks Placed
896
+ * @type {number}
897
+ */
898
+ this.blocksPlaced = data.blocks_placed || 0;
899
+ /**
900
+ * Swings
901
+ * @type {number}
902
+ */
903
+ this.swings = data.melee_swings || 0;
904
+ /**
905
+ * Hits
906
+ * @type {number}
907
+ */
908
+ this.hits = data.melee_hits || 0;
909
+ /**
910
+ * Melee Accuracy
911
+ * @type {number}
912
+ */
913
+ this.meleeAccuracy = divide(this.hits, this.swings);
914
+ /**
915
+ * Bow Shots
916
+ * @type {number}
917
+ */
918
+ this.bowShots = data.bow_shots || 0;
919
+ /**
920
+ * Bow Hits
921
+ * @type {number}
922
+ */
923
+ this.bowHits = data.bow_hits || 0;
924
+ /**
925
+ * Bow Accuracy
926
+ * @type {number}
927
+ */
928
+ this.bowAccuracy = divide(this.bowHits, this.bowShots);
929
+ /**
930
+ * Health Regenerated
931
+ * @type {number}
932
+ */
933
+ this.healthRegenerated = data.health_regenerated || 0;
934
+ /**
935
+ * Golden Apples Eaten
936
+ * @type {number}
937
+ */
938
+ this.goldenApplesEatan = data.golden_apples_eaten || 0;
95
939
  /**
96
940
  * UHC duels stats
97
941
  * @type {DuelsUHC}
98
942
  */
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
- };
943
+ this.uhc = new DuelsUHC(data);
944
+
945
+ /**
946
+ * SkyWars duels stats
947
+ * @type {DuelsSkyWars}
948
+ */
949
+ this.skywars = new DuelsSkyWars(data);
249
950
  /**
250
951
  * 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
- };
952
+ * @type {DuelsMegaWalls}
953
+ */
954
+ this.megawalls = new DuelsMegaWalls(data);
955
+ /**
956
+ * Blitz duel stats
957
+ * @type {DuelsGamemode}
958
+ */
959
+ this.blitz = new DuelsGamemode(data, 'blitz_duel', getTitle(data, 'blitz'));
265
960
  /**
266
961
  * OP duels stats
267
962
  * @type {DuelsOP}
268
963
  */
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
- };
964
+ this.op = new DuelsOP(data);
313
965
  /**
314
- * SkyWars duels stats
315
- * @type {DuelsSkyWars}
966
+ * Classic duels stats
967
+ * @type {DuelsGamemode}
316
968
  */
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
- };
969
+ this.classic = new DuelsGamemode(data, 'classic_duel', getTitle(data, 'classic'));
361
970
  /**
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
- };
971
+ * Bow duels stats
972
+ * @type {DuelsGamemode}
973
+ */
974
+ this.bow = new DuelsGamemode(data, 'bow_duel', getTitle(data, 'bow'));
377
975
  /**
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
- };
976
+ * No Debuff duels stats
977
+ * @type {DuelsGamemode}
978
+ */
979
+ this.noDebuff = new DuelsGamemode(data, 'potion_duel', getTitle(data, 'no_debuff'));
393
980
  /**
394
981
  * 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
982
+ * @type {DuelsGamemode}
983
+ */
984
+ this.combo = new DuelsGamemode(data, 'combo_duel', getTitle(data, 'combo'));
985
+ /**
986
+ * Bow Spleef duels stats
987
+ * @type {DuelsGamemode}
988
+ */
989
+ this.bowSpleef = new DuelsGamemode(data, 'bowspleef_duel', getTitle(data, 'tnt_games'));
990
+ /**
991
+ * Sumo duels stats
992
+ * @type {DuelsGamemode}
993
+ */
994
+ this.sumo = new DuelsGamemode(data, 'sumo_duel', getTitle(data, 'sumo'));
995
+ /**
996
+ * Bridge duels stats
411
997
  * @type {DuelsBridge}
412
998
  */
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
- };
999
+ this.bridge = new DuelsBridge(data);
591
1000
  /**
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
- };
1001
+ * Parkour duels stats
1002
+ * @type {DuelsGamemode}
1003
+ */
1004
+ this.parkour = new DuelsGamemode(data, 'parkour_eight', getTitle(data, 'parkour'));
1005
+ /**
1006
+ * Arena duels stats
1007
+ * @type {DuelsGamemode}
1008
+ */
1009
+ this.arena = new DuelsGamemode(data, 'duel_arena');
639
1010
  }
640
1011
  }
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
- */
1012
+
753
1013
  module.exports = Duels;