hypixel-api-reborn 11.1.0 → 11.2.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.
- package/.prettierrc +3 -3
- package/README.md +6 -4
- package/eslint.config.mjs +71 -0
- package/package.json +21 -25
- package/src/API/getAchievements.js +7 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +7 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +5 -4
- package/src/API/getGuildAchievements.js +7 -0
- package/src/API/getLeaderboards.js +4 -2
- package/src/API/getPlayer.js +2 -1
- package/src/API/getQuests.js +7 -0
- package/src/API/getRecentGames.js +6 -10
- package/src/API/getServerInfo.js +42 -37
- package/src/API/getStatus.js +2 -1
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/index.js +28 -17
- package/src/API/skyblock/getAuction.js +21 -0
- package/src/API/skyblock/{getSkyblockAuctions.js → getAuctions.js} +19 -12
- package/src/API/skyblock/{getSkyblockAuctionsByPlayer.js → getAuctionsByPlayer.js} +2 -2
- package/src/API/skyblock/{getSkyblockBazaar.js → getBazaar.js} +1 -3
- package/src/API/skyblock/getBingo.js +7 -0
- package/src/API/skyblock/getBingoByPlayer.js +14 -0
- package/src/API/skyblock/{getEndedSkyblockAuctions.js → getEndedAuctions.js} +1 -0
- package/src/API/skyblock/getFireSales.js +7 -0
- package/src/API/skyblock/getGovernment.js +7 -0
- package/src/API/skyblock/{getSkyblockMember.js → getMember.js} +10 -3
- package/src/API/skyblock/getMuseum.js +15 -0
- package/src/API/skyblock/{getSkyblockNews.js → getNews.js} +1 -0
- package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +14 -7
- package/src/Client.js +127 -25
- package/src/Errors.js +38 -17
- package/src/Private/rateLimit.js +17 -13
- package/src/Private/requests.js +27 -16
- package/src/Private/updater.js +11 -8
- package/src/Private/uuidCache.js +23 -30
- package/src/Private/validate.js +33 -22
- package/src/index.js +9 -0
- package/src/structures/APIIncident.js +4 -11
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +14 -13
- package/src/structures/Color.js +93 -48
- package/src/structures/Game.js +4 -2
- package/src/structures/Guild/Guild.js +35 -48
- package/src/structures/Guild/GuildMember.js +8 -8
- package/src/structures/Guild/GuildRank.js +2 -2
- package/src/structures/MiniGames/Arcade.js +242 -235
- package/src/structures/MiniGames/ArenaBrawl.js +11 -11
- package/src/structures/MiniGames/BedWars.js +262 -131
- package/src/structures/MiniGames/BlitzSurvivalGames.js +24 -23
- package/src/structures/MiniGames/CopsAndCrims.js +1 -0
- package/src/structures/MiniGames/Duels.js +92 -33
- package/src/structures/MiniGames/MegaWalls.js +3 -1
- package/src/structures/MiniGames/MurderMystery.js +2 -2
- package/src/structures/MiniGames/Pit.js +230 -2
- package/src/structures/MiniGames/PitInventoryItem.js +43 -0
- package/src/structures/MiniGames/SkyWars.js +211 -195
- package/src/structures/MiniGames/SmashHeroes.js +37 -35
- package/src/structures/MiniGames/SpeedUHC.js +17 -4
- package/src/structures/MiniGames/TNTGames.js +1 -1
- package/src/structures/MiniGames/UHC.js +33 -14
- package/src/structures/MiniGames/WoolWars.js +6 -5
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +26 -121
- package/src/structures/PlayerCosmetics.js +67 -12
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/Auctions/Auction.js +3 -1
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +3 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +2 -1
- package/src/structures/SkyBlock/Auctions/Bid.js +1 -0
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +1 -0
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +49 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +76 -32
- package/src/structures/SkyBlock/SkyblockMember.js +252 -289
- package/src/structures/SkyBlock/SkyblockMuseum.js +60 -0
- package/src/structures/SkyBlock/SkyblockMuseumItem.js +54 -0
- package/src/structures/SkyBlock/SkyblockPet.js +3 -3
- package/src/structures/SkyBlock/SkyblockProfile.js +37 -23
- package/src/structures/SkyBlock/Static/Bingo.js +101 -0
- package/src/structures/SkyBlock/Static/BingoData.js +45 -0
- package/src/structures/SkyBlock/Static/Candidate.js +40 -0
- package/src/structures/SkyBlock/Static/FireSale.js +55 -0
- package/src/structures/SkyBlock/Static/Government.js +74 -0
- package/src/structures/SkyBlock/Static/Perk.js +24 -0
- package/src/structures/Static/Achievement.js +87 -0
- package/src/structures/Static/AchievementTier.js +33 -0
- package/src/structures/Static/Achievements.js +30 -0
- package/src/structures/Static/Challenges.js +29 -0
- package/src/structures/Static/GameAchievements.js +36 -0
- package/src/structures/Static/GameChallenges.js +40 -0
- package/src/structures/Static/GameQuests.js +24 -0
- package/src/structures/Static/GuildAchievements.js +34 -0
- package/src/structures/Static/Quest.js +66 -0
- package/src/structures/Static/Quests.js +31 -0
- package/src/structures/Status.js +2 -2
- package/src/utils/Constants.js +384 -543
- package/src/utils/{guildExp.js → Guild.js} +46 -13
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +448 -186
- package/src/utils/arrayTools.js +1 -1
- package/src/utils/divide.js +1 -1
- package/src/utils/index.js +2 -1
- package/src/utils/isGuildID.js +1 -1
- package/src/utils/oscillation.js +4 -2
- package/src/utils/removeSnakeCase.js +19 -8
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +35 -4
- package/src/utils/toUuid.js +12 -7
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +1246 -446
- package/src/utils/toIGN.js +0 -20
|
@@ -1,173 +1,16 @@
|
|
|
1
1
|
// IMPORTANT : a lot of the properties from the API seem to be nonsense
|
|
2
2
|
|
|
3
|
-
const divide = require('../../utils/divide');
|
|
4
|
-
const { weekAB, monthAB } = require('../../utils/oscillation');
|
|
5
3
|
const { removeSnakeCaseString } = require('../../utils/removeSnakeCase');
|
|
4
|
+
const { weekAB, monthAB } = require('../../utils/oscillation');
|
|
5
|
+
const divide = require('../../utils/divide');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
constructor(data = {}) {
|
|
16
|
-
/**
|
|
17
|
-
* Last Tournament Advertisement as timestamp, only appears when a tournament is announced
|
|
18
|
-
* @type {number}
|
|
19
|
-
*/
|
|
20
|
-
this.lastTourneyAdTimestamp = data.lastTourneyAd || undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Last Tournament Advertisement as Date, only appears when a tournament is announced
|
|
23
|
-
* @type {Date}
|
|
24
|
-
*/
|
|
25
|
-
this.lastTourneyAdAt = this.lastTourneyAdTimestamp ? new Date(data.lastTourneyAd) : undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Amount of coins
|
|
28
|
-
* @type {number}
|
|
29
|
-
*/
|
|
30
|
-
this.coins = data.coins || 0;
|
|
31
|
-
/**
|
|
32
|
-
* Weekly coins
|
|
33
|
-
* @type {number}
|
|
34
|
-
*/
|
|
35
|
-
this.weeklyCoins = parseInt(data[`weekly_coins_${weekAB()}`] || 0, 10);
|
|
36
|
-
/**
|
|
37
|
-
* Monthly coins
|
|
38
|
-
* @type {number}
|
|
39
|
-
*/
|
|
40
|
-
this.monthlyCoins = parseInt(data[`monthly_coins_${monthAB()}`] || 0, 10);
|
|
41
|
-
/**
|
|
42
|
-
* Hints Disabled
|
|
43
|
-
* @type {Boolean}
|
|
44
|
-
*/
|
|
45
|
-
this.hintsDisabled = !data.hints;
|
|
46
|
-
/**
|
|
47
|
-
* Flash Disabled
|
|
48
|
-
* @type {Boolean}
|
|
49
|
-
*/
|
|
50
|
-
this.flashDisabled = !data.flash;
|
|
51
|
-
/**
|
|
52
|
-
* Draw their thing stats
|
|
53
|
-
* @type {BaseGame}
|
|
54
|
-
*/
|
|
55
|
-
this.drawTheirThing = new BaseGame(data, 'draw_their_thing');
|
|
56
|
-
/**
|
|
57
|
-
* Dragon wars "2" stats
|
|
58
|
-
* @type {BaseGame}
|
|
59
|
-
*/
|
|
60
|
-
this.dragonWars = new BaseGame(data, 'dragonwars2');
|
|
61
|
-
/**
|
|
62
|
-
* Easter Simulator stats
|
|
63
|
-
* @type {EasterSimulator}
|
|
64
|
-
*/
|
|
65
|
-
this.easterSimulator = new BaseGame(data, 'easter_simulator').extend('eggsFound', data.eggs_found_easter_simulator || 0);
|
|
66
|
-
/**
|
|
67
|
-
* Grinch Simulator stats
|
|
68
|
-
* @type {GrinchSimulator}
|
|
69
|
-
*/
|
|
70
|
-
this.grinchSimulator = new BaseGame(data, 'grinch_simulator_v2').extend('giftsFound', data.gifts_grinch_simulator_v2 || 0);
|
|
71
|
-
/**
|
|
72
|
-
* Scuba Simulator stats
|
|
73
|
-
* @type {ScubaSimulator}
|
|
74
|
-
*/
|
|
75
|
-
this.scubaSimulator = new BaseGame(data, 'scuba_simulator').extend('itemsFound', data.items_found_scuba_simulator || 0);
|
|
76
|
-
/**
|
|
77
|
-
* Santa Simulator stats
|
|
78
|
-
* @type {SantaSimulator}
|
|
79
|
-
*/
|
|
80
|
-
this.santaSimulator = new BaseGame(data, 'santa_simulator').extend('giftsDelivered', data.delivered_santa_simulator || 0);
|
|
81
|
-
/**
|
|
82
|
-
* Santa Says stats
|
|
83
|
-
* @type {BaseGame}
|
|
84
|
-
*/
|
|
85
|
-
this.santaSays = new BaseGame(data, 'santa_says');
|
|
86
|
-
/**
|
|
87
|
-
* Simon Says stats
|
|
88
|
-
* @type {BaseGame}
|
|
89
|
-
*/
|
|
90
|
-
this.simonSays = new BaseGame(data, 'simon_says');
|
|
91
|
-
/**
|
|
92
|
-
* Farm Hunt stats
|
|
93
|
-
* @type {BaseGame}
|
|
94
|
-
*/
|
|
95
|
-
this.farmHunt = new BaseGame(data, 'farm_hunt');
|
|
96
|
-
/**
|
|
97
|
-
* Hole in the Wall stats
|
|
98
|
-
* @type {HITW}
|
|
99
|
-
*/
|
|
100
|
-
this.holeInTheWall = new HITW(data, 'hole_in_the_wall');
|
|
101
|
-
/**
|
|
102
|
-
* Mini Walls stats
|
|
103
|
-
* @type {MiniWalls}
|
|
104
|
-
*/
|
|
105
|
-
this.miniWalls = new MiniWalls(data); // needs extension
|
|
106
|
-
/**
|
|
107
|
-
* Party games (1) stats
|
|
108
|
-
* @type {BaseGame}
|
|
109
|
-
*/
|
|
110
|
-
this.partyGames = new BaseGame(data, 'party');
|
|
111
|
-
/**
|
|
112
|
-
* Party Games 2 stats ( legacy )
|
|
113
|
-
* @type {BaseGame}
|
|
114
|
-
* @deprecated
|
|
115
|
-
*/
|
|
116
|
-
this.partyGames2 = new BaseGame(data, 'party_2');
|
|
117
|
-
/**
|
|
118
|
-
* Party Games 3 stats ( legacy )
|
|
119
|
-
* @type {BaseGame}
|
|
120
|
-
* @deprecated
|
|
121
|
-
*/
|
|
122
|
-
this.partyGames3 = new BaseGame(data, 'party_3');
|
|
123
|
-
/**
|
|
124
|
-
* Throw out stats
|
|
125
|
-
* @type {BaseGame}
|
|
126
|
-
*/
|
|
127
|
-
this.throwOut = new BaseGame(data, 'throw_out');
|
|
128
|
-
/**
|
|
129
|
-
* Soccer stats
|
|
130
|
-
* @type {Soccer}
|
|
131
|
-
*/
|
|
132
|
-
this.soccer = new Soccer(data);
|
|
133
|
-
/**
|
|
134
|
-
* Hypixel Sports stats
|
|
135
|
-
* @type {BaseGame}
|
|
136
|
-
* @deprecated
|
|
137
|
-
*/
|
|
138
|
-
this.hypixelSports = new BaseGame(data, 'hypixel_sports');
|
|
139
|
-
/**
|
|
140
|
-
* Ender Spleef stats
|
|
141
|
-
* @type {BaseGame}
|
|
142
|
-
*/
|
|
143
|
-
this.enderSpleef = new BaseGame(data, 'ender');
|
|
144
|
-
/**
|
|
145
|
-
* Blocking dead ( previously known as DayOne ) stats
|
|
146
|
-
* @type {BlockingDead}
|
|
147
|
-
*/
|
|
148
|
-
this.blockingDead = new BaseGame(data, 'dayone').extend('headshots', data.headshots_dayone || 0);
|
|
149
|
-
/**
|
|
150
|
-
* Galaxy Wars stats
|
|
151
|
-
* @type {GalaxyWars}
|
|
152
|
-
*/
|
|
153
|
-
this.galaxyWars = new GalaxyWars(data);
|
|
154
|
-
// Lenient parsing
|
|
155
|
-
/**
|
|
156
|
-
* OITQ / One In The Quiver stats
|
|
157
|
-
* @type {OITQ}
|
|
158
|
-
*/
|
|
159
|
-
this.oitq = this.oneInTheQuiver = new BaseGame(data, 'oneinthequiver').extend('bountyKills', data.bounty_kills_oneinthequiver || 0);
|
|
160
|
-
/**
|
|
161
|
-
* Zombies
|
|
162
|
-
* @type {Zombies}
|
|
163
|
-
*/
|
|
164
|
-
this.zombies = new Zombies(data);
|
|
165
|
-
/**
|
|
166
|
-
* Capture The Wool
|
|
167
|
-
* @type {{kills: number, captures: number}}
|
|
168
|
-
*/
|
|
169
|
-
this.captureTheWool = { kills: data.arcade_ctw_slayer || 0, captures: data.arcade_ctw_oh_sheep || 0 };
|
|
170
|
-
}
|
|
7
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
8
|
+
function parseZombiesKills(data) {
|
|
9
|
+
const matches = Array.from(Object.keys(data))
|
|
10
|
+
.map((x) => x.match(/^([A-Za-z]+)_zombie_kills_zombies$/))
|
|
11
|
+
.filter((x) => x);
|
|
12
|
+
// From entries might be broken
|
|
13
|
+
return Object.fromEntries(matches.map((x) => [removeSnakeCaseString(x[1]), data[x[0]] || 0]));
|
|
171
14
|
}
|
|
172
15
|
/**
|
|
173
16
|
* Most basic game class, used by all arcade games
|
|
@@ -361,64 +204,76 @@ class MiniWalls extends BaseGame {
|
|
|
361
204
|
}
|
|
362
205
|
}
|
|
363
206
|
/**
|
|
364
|
-
* Zombies -
|
|
207
|
+
* Zombies - Stats by Map + Difficulty
|
|
365
208
|
*/
|
|
366
|
-
class
|
|
209
|
+
class ZombiesStats {
|
|
367
210
|
/**
|
|
368
211
|
* Constructor
|
|
369
212
|
* @param {Object} data Data from API
|
|
213
|
+
* @param {string} type Map name + difficulty ( default overall )
|
|
370
214
|
*/
|
|
371
|
-
constructor(data) {
|
|
215
|
+
constructor(data, type = '') {
|
|
216
|
+
if (type) type = `_${type}`;
|
|
372
217
|
/**
|
|
373
|
-
*
|
|
374
|
-
* @type {
|
|
218
|
+
* Best Round
|
|
219
|
+
* @type {number}
|
|
375
220
|
*/
|
|
376
|
-
this.
|
|
221
|
+
this.bestRound = data[`best_round_zombies${type}`] || 0;
|
|
377
222
|
/**
|
|
378
|
-
*
|
|
379
|
-
* @type {
|
|
223
|
+
* Deaths ( NOT losses )
|
|
224
|
+
* @type {number}
|
|
380
225
|
*/
|
|
381
|
-
this.
|
|
226
|
+
this.deaths = data[`deaths_zombies${type}`] || 0;
|
|
382
227
|
/**
|
|
383
|
-
*
|
|
384
|
-
* @type {
|
|
228
|
+
* Doors opened
|
|
229
|
+
* @type {number}
|
|
385
230
|
*/
|
|
386
|
-
this.
|
|
231
|
+
this.doorsOpened = data[`doors_opened_zombies${type}`] || 0;
|
|
387
232
|
/**
|
|
388
|
-
*
|
|
389
|
-
* @type {
|
|
233
|
+
* Fastest time to reach round 10 in seconds
|
|
234
|
+
* @type {number}
|
|
390
235
|
*/
|
|
391
|
-
this.
|
|
236
|
+
this.fastestRound10 = data[`fastest_time_10_zombies${type}`] || 0;
|
|
392
237
|
/**
|
|
393
|
-
*
|
|
394
|
-
* @type {
|
|
238
|
+
* Fastest time to reach round 20 in seconds
|
|
239
|
+
* @type {number}
|
|
395
240
|
*/
|
|
396
|
-
this.
|
|
241
|
+
this.fastestRound20 = data[`fastest_time_20_zombies${type}`] || 0;
|
|
397
242
|
/**
|
|
398
|
-
*
|
|
243
|
+
* Fastest time to reach round 30 in seconds
|
|
399
244
|
* @type {number}
|
|
400
245
|
*/
|
|
401
|
-
this.
|
|
246
|
+
this.fastestRound30 = data[`fastest_time_30_zombies${type}`] || 0;
|
|
402
247
|
/**
|
|
403
|
-
*
|
|
248
|
+
* Players revived
|
|
404
249
|
* @type {number}
|
|
405
250
|
*/
|
|
406
|
-
this.
|
|
251
|
+
this.playersRevived = data[`players_revived_zombies${type}`] || 0;
|
|
407
252
|
/**
|
|
408
|
-
*
|
|
253
|
+
* Number of times player is knocked down
|
|
409
254
|
* @type {number}
|
|
410
255
|
*/
|
|
411
|
-
this.
|
|
256
|
+
this.timesKnockedDown = data[`times_knocked_down_zombies${type}`] || 0;
|
|
412
257
|
/**
|
|
413
|
-
*
|
|
258
|
+
* Total amount of rounds the player survived
|
|
414
259
|
* @type {number}
|
|
415
260
|
*/
|
|
416
|
-
this.
|
|
261
|
+
this.roundsSurvived = data[`total_rounds_survived_zombies${type}`] || 0;
|
|
417
262
|
/**
|
|
418
|
-
*
|
|
263
|
+
* Total amount of windows fully repaired by player
|
|
419
264
|
* @type {number}
|
|
420
265
|
*/
|
|
421
|
-
this.
|
|
266
|
+
this.windowsRepaired = data[`windows_repaired_zombies${type}`] || 0;
|
|
267
|
+
/**
|
|
268
|
+
* Wins
|
|
269
|
+
* @type {number}
|
|
270
|
+
*/
|
|
271
|
+
this.wins = data[`wins_zombies${type}`] || 0;
|
|
272
|
+
/**
|
|
273
|
+
* Total Zombie Kills
|
|
274
|
+
* @type {number}
|
|
275
|
+
*/
|
|
276
|
+
this.zombieKills = data[`zombie_kills_zombies${type}`] || 0;
|
|
422
277
|
}
|
|
423
278
|
}
|
|
424
279
|
/**
|
|
@@ -454,86 +309,238 @@ class ZombieMap {
|
|
|
454
309
|
}
|
|
455
310
|
}
|
|
456
311
|
/**
|
|
457
|
-
* Zombies -
|
|
312
|
+
* Zombies - Overall stats
|
|
458
313
|
*/
|
|
459
|
-
class
|
|
314
|
+
class Zombies {
|
|
460
315
|
/**
|
|
461
316
|
* Constructor
|
|
462
317
|
* @param {Object} data Data from API
|
|
463
|
-
* @param {string} type Map name + difficulty ( default overall )
|
|
464
318
|
*/
|
|
465
|
-
constructor(data
|
|
466
|
-
if (type) type = `_${type}`;
|
|
319
|
+
constructor(data) {
|
|
467
320
|
/**
|
|
468
|
-
*
|
|
469
|
-
* @type {
|
|
321
|
+
* Overall Stats
|
|
322
|
+
* @type {ZombiesStats}
|
|
470
323
|
*/
|
|
471
|
-
this.
|
|
324
|
+
this.overall = new ZombiesStats(data);
|
|
472
325
|
/**
|
|
473
|
-
*
|
|
474
|
-
* @type {
|
|
326
|
+
* Stats for Dead End
|
|
327
|
+
* @type {ZombieMap}
|
|
475
328
|
*/
|
|
476
|
-
this.
|
|
329
|
+
this.deadEnd = new ZombieMap(data, 'deadend');
|
|
477
330
|
/**
|
|
478
|
-
*
|
|
479
|
-
* @type {
|
|
331
|
+
* Stats for Bad Blood
|
|
332
|
+
* @type {ZombieMap}
|
|
480
333
|
*/
|
|
481
|
-
this.
|
|
334
|
+
this.badBlood = new ZombieMap(data, 'badblood');
|
|
482
335
|
/**
|
|
483
|
-
*
|
|
484
|
-
* @type {
|
|
336
|
+
* Stats for Alien Arcadium
|
|
337
|
+
* @type {ZombieMap}
|
|
485
338
|
*/
|
|
486
|
-
this.
|
|
339
|
+
this.alienArcadium = new ZombieMap(data, 'alienarcadium');
|
|
487
340
|
/**
|
|
488
|
-
*
|
|
341
|
+
* Kills By Zombie
|
|
342
|
+
* @type {Record<string,number>}
|
|
343
|
+
*/
|
|
344
|
+
this.killsByZombie = parseZombiesKills(data);
|
|
345
|
+
/**
|
|
346
|
+
* Bullets Hit
|
|
489
347
|
* @type {number}
|
|
490
348
|
*/
|
|
491
|
-
this.
|
|
349
|
+
this.bulletsHit = data.bullets_hit_zombies || 0;
|
|
492
350
|
/**
|
|
493
|
-
*
|
|
351
|
+
* Bullets Shot
|
|
494
352
|
* @type {number}
|
|
495
353
|
*/
|
|
496
|
-
this.
|
|
354
|
+
this.bulletsShot = data.bullets_shot_zombies || 0;
|
|
497
355
|
/**
|
|
498
|
-
*
|
|
356
|
+
* Gun Accuracy
|
|
499
357
|
* @type {number}
|
|
500
358
|
*/
|
|
501
|
-
this.
|
|
359
|
+
this.gunAccuracy = divide(this.bulletsHit, this.bulletsShot);
|
|
502
360
|
/**
|
|
503
|
-
*
|
|
361
|
+
* Headshots
|
|
504
362
|
* @type {number}
|
|
505
363
|
*/
|
|
506
|
-
this.
|
|
364
|
+
this.headshots = data.headshots_zombies || 0;
|
|
507
365
|
/**
|
|
508
|
-
*
|
|
366
|
+
* Headshot Accuracy
|
|
509
367
|
* @type {number}
|
|
510
368
|
*/
|
|
511
|
-
this.
|
|
369
|
+
this.headshotAccuracy = divide(this.headshots, this.bulletsShot);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Arcade class
|
|
375
|
+
*/
|
|
376
|
+
class Arcade {
|
|
377
|
+
/**
|
|
378
|
+
* Constructor
|
|
379
|
+
* @param {Object} data Data from the API
|
|
380
|
+
*/
|
|
381
|
+
constructor(data = {}) {
|
|
512
382
|
/**
|
|
513
|
-
*
|
|
383
|
+
* Amount of coins
|
|
514
384
|
* @type {number}
|
|
515
385
|
*/
|
|
516
|
-
this.
|
|
386
|
+
this.coins = data.coins || 0;
|
|
517
387
|
/**
|
|
518
|
-
*
|
|
388
|
+
* Weekly coins
|
|
519
389
|
* @type {number}
|
|
520
390
|
*/
|
|
521
|
-
this.
|
|
391
|
+
this.weeklyCoins = parseInt(data[`weekly_coins_${weekAB()}`] || 0, 10);
|
|
522
392
|
/**
|
|
523
|
-
*
|
|
393
|
+
* Monthly coins
|
|
524
394
|
* @type {number}
|
|
525
395
|
*/
|
|
526
|
-
this.
|
|
396
|
+
this.monthlyCoins = parseInt(data[`monthly_coins_${monthAB()}`] || 0, 10);
|
|
397
|
+
/**
|
|
398
|
+
* Hints Disabled
|
|
399
|
+
* @type {boolean}
|
|
400
|
+
*/
|
|
401
|
+
this.hintsDisabled = !data.hints;
|
|
402
|
+
/**
|
|
403
|
+
* Flash Disabled
|
|
404
|
+
* @type {boolean}
|
|
405
|
+
*/
|
|
406
|
+
this.flashDisabled = !data.flash;
|
|
407
|
+
/**
|
|
408
|
+
* Draw their thing stats
|
|
409
|
+
* @type {BaseGame}
|
|
410
|
+
*/
|
|
411
|
+
this.drawTheirThing = new BaseGame(data, 'draw_their_thing');
|
|
412
|
+
/**
|
|
413
|
+
* Dragon wars "2" stats
|
|
414
|
+
* @type {BaseGame}
|
|
415
|
+
*/
|
|
416
|
+
this.dragonWars = new BaseGame(data, 'dragonwars2');
|
|
417
|
+
/**
|
|
418
|
+
* Easter Simulator stats
|
|
419
|
+
* @type {EasterSimulator}
|
|
420
|
+
*/
|
|
421
|
+
this.easterSimulator = new BaseGame(data, 'easter_simulator').extend(
|
|
422
|
+
'eggsFound',
|
|
423
|
+
data.eggs_found_easter_simulator || 0
|
|
424
|
+
);
|
|
425
|
+
/**
|
|
426
|
+
* Grinch Simulator stats
|
|
427
|
+
* @type {GrinchSimulator}
|
|
428
|
+
*/
|
|
429
|
+
this.grinchSimulator = new BaseGame(data, 'grinch_simulator_v2').extend(
|
|
430
|
+
'giftsFound',
|
|
431
|
+
data.gifts_grinch_simulator_v2 || 0
|
|
432
|
+
);
|
|
433
|
+
/**
|
|
434
|
+
* Scuba Simulator stats
|
|
435
|
+
* @type {ScubaSimulator}
|
|
436
|
+
*/
|
|
437
|
+
this.scubaSimulator = new BaseGame(data, 'scuba_simulator').extend(
|
|
438
|
+
'itemsFound',
|
|
439
|
+
data.items_found_scuba_simulator || 0
|
|
440
|
+
);
|
|
441
|
+
/**
|
|
442
|
+
* Santa Simulator stats
|
|
443
|
+
* @type {SantaSimulator}
|
|
444
|
+
*/
|
|
445
|
+
this.santaSimulator = new BaseGame(data, 'santa_simulator').extend(
|
|
446
|
+
'giftsDelivered',
|
|
447
|
+
data.delivered_santa_simulator || 0
|
|
448
|
+
);
|
|
449
|
+
/**
|
|
450
|
+
* Santa Says stats
|
|
451
|
+
* @type {BaseGame}
|
|
452
|
+
*/
|
|
453
|
+
this.santaSays = new BaseGame(data, 'santa_says');
|
|
454
|
+
/**
|
|
455
|
+
* Simon Says stats
|
|
456
|
+
* @type {BaseGame}
|
|
457
|
+
*/
|
|
458
|
+
this.simonSays = new BaseGame(data, 'simon_says');
|
|
459
|
+
/**
|
|
460
|
+
* Farm Hunt stats
|
|
461
|
+
* @type {BaseGame}
|
|
462
|
+
*/
|
|
463
|
+
this.farmHunt = new BaseGame(data, 'farm_hunt');
|
|
464
|
+
/**
|
|
465
|
+
* Hole in the Wall stats
|
|
466
|
+
* @type {HITW}
|
|
467
|
+
*/
|
|
468
|
+
this.holeInTheWall = new HITW(data, 'hole_in_the_wall');
|
|
469
|
+
/**
|
|
470
|
+
* Mini Walls stats
|
|
471
|
+
* @type {MiniWalls}
|
|
472
|
+
*/
|
|
473
|
+
// TODO needs extension
|
|
474
|
+
this.miniWalls = new MiniWalls(data);
|
|
475
|
+
/**
|
|
476
|
+
* Party games (1) stats
|
|
477
|
+
* @type {BaseGame}
|
|
478
|
+
*/
|
|
479
|
+
this.partyGames = new BaseGame(data, 'party');
|
|
480
|
+
/**
|
|
481
|
+
* Party Games 2 stats ( legacy )
|
|
482
|
+
* @type {BaseGame}
|
|
483
|
+
* @deprecated
|
|
484
|
+
*/
|
|
485
|
+
this.partyGames2 = new BaseGame(data, 'party_2');
|
|
486
|
+
/**
|
|
487
|
+
* Party Games 3 stats ( legacy )
|
|
488
|
+
* @type {BaseGame}
|
|
489
|
+
* @deprecated
|
|
490
|
+
*/
|
|
491
|
+
this.partyGames3 = new BaseGame(data, 'party_3');
|
|
492
|
+
/**
|
|
493
|
+
* Throw out stats
|
|
494
|
+
* @type {BaseGame}
|
|
495
|
+
*/
|
|
496
|
+
this.throwOut = new BaseGame(data, 'throw_out');
|
|
497
|
+
/**
|
|
498
|
+
* Soccer stats
|
|
499
|
+
* @type {Soccer}
|
|
500
|
+
*/
|
|
501
|
+
this.soccer = new Soccer(data);
|
|
502
|
+
/**
|
|
503
|
+
* Hypixel Sports stats
|
|
504
|
+
* @type {BaseGame}
|
|
505
|
+
* @deprecated
|
|
506
|
+
*/
|
|
507
|
+
this.hypixelSports = new BaseGame(data, 'hypixel_sports');
|
|
508
|
+
/**
|
|
509
|
+
* Ender Spleef stats
|
|
510
|
+
* @type {BaseGame}
|
|
511
|
+
*/
|
|
512
|
+
this.enderSpleef = new BaseGame(data, 'ender');
|
|
513
|
+
/**
|
|
514
|
+
* Blocking dead ( previously known as DayOne ) stats
|
|
515
|
+
* @type {BlockingDead}
|
|
516
|
+
*/
|
|
517
|
+
this.blockingDead = new BaseGame(data, 'dayone').extend('headshots', data.headshots_dayone || 0);
|
|
518
|
+
/**
|
|
519
|
+
* Galaxy Wars stats
|
|
520
|
+
* @type {GalaxyWars}
|
|
521
|
+
*/
|
|
522
|
+
this.galaxyWars = new GalaxyWars(data);
|
|
523
|
+
// Lenient parsing
|
|
524
|
+
/**
|
|
525
|
+
* OITQ / One In The Quiver stats
|
|
526
|
+
* @type {OITQ}
|
|
527
|
+
*/
|
|
528
|
+
this.oitq = this.oneInTheQuiver = new BaseGame(data, 'oneinthequiver').extend(
|
|
529
|
+
'bountyKills',
|
|
530
|
+
data.bounty_kills_oneinthequiver || 0
|
|
531
|
+
);
|
|
532
|
+
/**
|
|
533
|
+
* Zombies
|
|
534
|
+
* @type {Zombies}
|
|
535
|
+
*/
|
|
536
|
+
this.zombies = new Zombies(data);
|
|
537
|
+
/**
|
|
538
|
+
* Capture The Wool
|
|
539
|
+
* @type {{kills: number, captures: number}}
|
|
540
|
+
*/
|
|
541
|
+
this.captureTheWool = { kills: data.arcade_ctw_slayer || 0, captures: data.arcade_ctw_oh_sheep || 0 };
|
|
527
542
|
}
|
|
528
543
|
}
|
|
529
|
-
// eslint-disable-next-line require-jsdoc
|
|
530
|
-
function parseZombiesKills(data) {
|
|
531
|
-
const matches = Array.from(Object.keys(data))
|
|
532
|
-
.map((x) => x.match(/^([A-z]+)_zombie_kills_zombies$/))
|
|
533
|
-
.filter((x) => x);
|
|
534
|
-
// From entries might be broken
|
|
535
|
-
return Object.fromEntries(matches.map((x) => [removeSnakeCaseString(x[1]), data[x[0]] || 0]));
|
|
536
|
-
}
|
|
537
544
|
/**
|
|
538
545
|
* @typedef {Object} EasterSimulator
|
|
539
546
|
* @extends BaseGame
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
const divide = require('../../utils/divide');
|
|
2
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
3
|
+
function generateModeStats(data, mode) {
|
|
4
|
+
return {
|
|
5
|
+
kills: data[`kills_${mode}`] || 0,
|
|
6
|
+
deaths: data[`deaths_${mode}`] || 0,
|
|
7
|
+
KDRatio: divide(data[`kills_${mode}`], data[`deaths_${mode}`]),
|
|
8
|
+
wins: data[`wins_${mode}`] || 0,
|
|
9
|
+
losses: data[`losses_${mode}`] || 0,
|
|
10
|
+
WLRatio: divide(data[`wins_${mode}`], data[`losses_${mode}`])
|
|
11
|
+
};
|
|
12
|
+
}
|
|
2
13
|
/**
|
|
3
14
|
* ArenaBrawl class
|
|
4
15
|
*/
|
|
@@ -23,17 +34,6 @@ class ArenaBrawl {
|
|
|
23
34
|
};
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
|
-
// eslint-disable-next-line require-jsdoc
|
|
27
|
-
function generateModeStats(data, mode) {
|
|
28
|
-
return {
|
|
29
|
-
kills: data[`kills_${mode}`] || 0,
|
|
30
|
-
deaths: data[`deaths_${mode}`] || 0,
|
|
31
|
-
KDRatio: divide(data[`kills_${mode}`], data[`deaths_${mode}`]),
|
|
32
|
-
wins: data[`wins_${mode}`] || 0,
|
|
33
|
-
losses: data[`losses_${mode}`] || 0,
|
|
34
|
-
WLRatio: divide(data[`wins_${mode}`], data[`losses_${mode}`])
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
37
|
/**
|
|
38
38
|
* @typedef {Object} ArenaBrawlStats
|
|
39
39
|
* @property {ArenaBrawlModeStats} '1v1' ArenaBrawl 1v1 stats
|