hypixel-api-reborn 11.2.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/README.md +1 -1
- package/eslint.config.mjs +71 -0
- package/package.json +11 -17
- package/src/API/getAchievements.js +1 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +4 -3
- package/src/API/getGuildAchievements.js +1 -0
- package/src/API/getLeaderboards.js +1 -1
- package/src/API/getPlayer.js +1 -0
- package/src/API/getQuests.js +1 -0
- package/src/API/getRecentGames.js +5 -9
- package/src/API/getServerInfo.js +40 -37
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/skyblock/getAuction.js +8 -6
- package/src/API/skyblock/getAuctions.js +15 -12
- package/src/API/skyblock/getAuctionsByPlayer.js +1 -1
- package/src/API/skyblock/getBazaar.js +1 -3
- package/src/API/skyblock/getBingo.js +1 -2
- package/src/API/skyblock/getBingoByPlayer.js +3 -3
- package/src/API/skyblock/getEndedAuctions.js +1 -0
- package/src/API/skyblock/getFireSales.js +1 -1
- package/src/API/skyblock/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +1 -0
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +1 -0
- package/src/Client.js +42 -14
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +11 -12
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- package/src/structures/APIIncident.js +1 -2
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +9 -8
- package/src/structures/Game.js +1 -1
- package/src/structures/Guild/Guild.js +19 -36
- package/src/structures/Guild/GuildMember.js +2 -2
- package/src/structures/MiniGames/Arcade.js +242 -240
- package/src/structures/MiniGames/ArenaBrawl.js +11 -11
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +24 -23
- package/src/structures/MiniGames/CopsAndCrims.js +1 -0
- package/src/structures/MiniGames/Duels.js +9 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/SkyWars.js +197 -186
- package/src/structures/MiniGames/SmashHeroes.js +36 -34
- package/src/structures/MiniGames/SpeedUHC.js +17 -4
- package/src/structures/MiniGames/UHC.js +26 -25
- package/src/structures/MiniGames/WoolWars.js +6 -5
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +13 -104
- package/src/structures/PlayerCosmetics.js +5 -4
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +2 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +7 -14
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +78 -223
- package/src/structures/SkyBlock/SkyblockPet.js +3 -4
- package/src/structures/SkyBlock/Static/Bingo.js +10 -11
- package/src/structures/SkyBlock/Static/BingoData.js +1 -1
- package/src/structures/Static/Achievement.js +16 -15
- package/src/structures/Static/AchievementTier.js +2 -2
- package/src/structures/Static/Quest.js +2 -2
- package/src/utils/Constants.js +17 -517
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +449 -192
- 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 +11 -7
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +3 -3
- package/src/utils/toUuid.js +4 -4
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +272 -162
- package/src/utils/toIGN.js +0 -24
|
@@ -32,182 +32,9 @@ const generateStatsForMode = (data, mode) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
* BedWars class
|
|
37
|
-
*/
|
|
38
|
-
class BedWars {
|
|
39
|
-
/**
|
|
40
|
-
* @param {object} data BedWars data
|
|
41
|
-
*/
|
|
42
|
-
constructor(data) {
|
|
43
|
-
/**
|
|
44
|
-
* Tokens
|
|
45
|
-
* @type {number}
|
|
46
|
-
*/
|
|
47
|
-
this.tokens = data.coins || 0;
|
|
48
|
-
/**
|
|
49
|
-
* Level
|
|
50
|
-
* @type {number}
|
|
51
|
-
*/
|
|
52
|
-
this.level = data.Experience ? getLevelForExp(data.Experience) : 0;
|
|
53
|
-
/**
|
|
54
|
-
* Experience
|
|
55
|
-
* @type {number}
|
|
56
|
-
*/
|
|
57
|
-
this.experience = data.Experience || 0;
|
|
58
|
-
/**
|
|
59
|
-
* Prestige
|
|
60
|
-
* @type {BedWarsPrestige}
|
|
61
|
-
*/
|
|
62
|
-
this.prestige = data.Experience ? getBedWarsPrestige(getLevelForExp(data.Experience)) : 'Stone';
|
|
63
|
-
/**
|
|
64
|
-
* Played games
|
|
65
|
-
* @type {number}
|
|
66
|
-
*/
|
|
67
|
-
this.playedGames = data.games_played_bedwars || 0;
|
|
68
|
-
/**
|
|
69
|
-
* Wins
|
|
70
|
-
* @type {number}
|
|
71
|
-
*/
|
|
72
|
-
this.wins = data.wins_bedwars || 0;
|
|
73
|
-
/**
|
|
74
|
-
* Winstreak
|
|
75
|
-
* @type {number}
|
|
76
|
-
*/
|
|
77
|
-
this.winstreak = data.winstreak || 0;
|
|
78
|
-
/**
|
|
79
|
-
* Kills
|
|
80
|
-
* @type {number}
|
|
81
|
-
*/
|
|
82
|
-
this.kills = data.kills_bedwars || 0;
|
|
83
|
-
/**
|
|
84
|
-
* Final kills
|
|
85
|
-
* @type {number}
|
|
86
|
-
*/
|
|
87
|
-
this.finalKills = data.final_kills_bedwars || 0;
|
|
88
|
-
/**
|
|
89
|
-
* Losses
|
|
90
|
-
* @type {number}
|
|
91
|
-
*/
|
|
92
|
-
this.losses = data.losses_bedwars || 0;
|
|
93
|
-
/**
|
|
94
|
-
* Deaths
|
|
95
|
-
* @type {number}
|
|
96
|
-
*/
|
|
97
|
-
this.deaths = data.deaths_bedwars || 0;
|
|
98
|
-
/**
|
|
99
|
-
* Final deaths
|
|
100
|
-
* @type {number}
|
|
101
|
-
*/
|
|
102
|
-
this.finalDeaths = data.final_deaths_bedwars || 0;
|
|
103
|
-
/**
|
|
104
|
-
* Collected items
|
|
105
|
-
* @type {BedWarsCollectedItems}
|
|
106
|
-
*/
|
|
107
|
-
this.collectedItemsTotal = {
|
|
108
|
-
iron: data.iron_resources_collected_bedwars || 0,
|
|
109
|
-
gold: data.gold_resources_collected_bedwars || 0,
|
|
110
|
-
diamond: data.diamond_resources_collected_bedwars || 0,
|
|
111
|
-
emerald: data.emerald_resources_collected_bedwars || 0
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Beds lost/broken/BL Ratio
|
|
115
|
-
* @type {BedWarsBeds}
|
|
116
|
-
*/
|
|
117
|
-
this.beds = {
|
|
118
|
-
lost: data.beds_lost_bedwars || 0,
|
|
119
|
-
broken: data.beds_broken_bedwars || 0,
|
|
120
|
-
BLRatio: divide(data.beds_broken_bedwars, data.beds_lost_bedwars)
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Average Kills/Final kills/Beds broken
|
|
124
|
-
* @type {BedWarsAvg}
|
|
125
|
-
*/
|
|
126
|
-
this.avg = {
|
|
127
|
-
kills: divide(this.kills, this.playedGames),
|
|
128
|
-
finalKills: divide(this.finalKills, this.playedGames),
|
|
129
|
-
bedsBroken: divide(this.beds.broken, this.playedGames)
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* Kill Death ratio
|
|
133
|
-
* @type {number}
|
|
134
|
-
*/
|
|
135
|
-
this.KDRatio = divide(this.kills, this.deaths);
|
|
136
|
-
/**
|
|
137
|
-
* Final kill death ratio
|
|
138
|
-
* @type {number}
|
|
139
|
-
*/
|
|
140
|
-
this.finalKDRatio = divide(this.finalKills, this.finalDeaths);
|
|
141
|
-
/**
|
|
142
|
-
* Win Loss ratio
|
|
143
|
-
* @type {number}
|
|
144
|
-
*/
|
|
145
|
-
this.WLRatio = divide(this.wins, this.losses);
|
|
146
|
-
/**
|
|
147
|
-
* BedWars Solo stats
|
|
148
|
-
* @type {BedWarsModeStats}
|
|
149
|
-
*/
|
|
150
|
-
this.solo = generateStatsForMode(data, 'eight_one');
|
|
151
|
-
/**
|
|
152
|
-
* BedWars Doubles stats
|
|
153
|
-
* @type {BedWarsModeStats}
|
|
154
|
-
*/
|
|
155
|
-
this.doubles = generateStatsForMode(data, 'eight_two');
|
|
156
|
-
/**
|
|
157
|
-
* BedWars 3v3v3v3 stats
|
|
158
|
-
* @type {BedWarsModeStats}
|
|
159
|
-
*/
|
|
160
|
-
this.threes = generateStatsForMode(data, 'four_three');
|
|
161
|
-
/**
|
|
162
|
-
* BedWars 4v4v4v4 stats
|
|
163
|
-
* @type {BedWarsModeStats}
|
|
164
|
-
*/
|
|
165
|
-
this.fours = generateStatsForMode(data, 'four_four');
|
|
166
|
-
/**
|
|
167
|
-
* BedWars 4v4 stats
|
|
168
|
-
* @type {BedWarsModeStats}
|
|
169
|
-
*/
|
|
170
|
-
this['4v4'] = generateStatsForMode(data, 'two_four');
|
|
171
|
-
/**
|
|
172
|
-
* BedWars Dream Mode Stats
|
|
173
|
-
* @type {BedwarsDreamStats}
|
|
174
|
-
*/
|
|
175
|
-
this.dream = ['ultimate', 'rush', 'armed', 'lucky', 'voidless'].reduce(
|
|
176
|
-
(ac, mode) => ({
|
|
177
|
-
[mode]: {
|
|
178
|
-
doubles: generateStatsForMode(data, `eight_two_${mode}`),
|
|
179
|
-
fours: generateStatsForMode(data, `four_four_${mode}`)
|
|
180
|
-
},
|
|
181
|
-
...ac
|
|
182
|
-
}),
|
|
183
|
-
{}
|
|
184
|
-
);
|
|
185
|
-
/**
|
|
186
|
-
* BedWars Castle Stats
|
|
187
|
-
* @type {BedWarsModeStats}
|
|
188
|
-
*/
|
|
189
|
-
this.castle = generateStatsForMode(data, 'castle');
|
|
190
|
-
/**
|
|
191
|
-
* BedWars Practice Stats
|
|
192
|
-
* @type {BedWarsPracticeStats}
|
|
193
|
-
*/
|
|
194
|
-
this.practice = generateStatsForPractice(data);
|
|
195
|
-
/**
|
|
196
|
-
* Bedwars Slumber Tickets
|
|
197
|
-
* @type {number}
|
|
198
|
-
*/
|
|
199
|
-
this.slumberTickets = data.slumber?.tickets ?? 0;
|
|
200
|
-
/**
|
|
201
|
-
* Bedwars Slumber Total Tickets
|
|
202
|
-
* @type {number}
|
|
203
|
-
*/
|
|
204
|
-
this.totalSlumberTicket = data.slumber?.total_tickets ?? 0;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// eslint-disable-next-line require-jsdoc
|
|
35
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
208
36
|
function getBedWarsPrestige(level) {
|
|
209
|
-
|
|
210
|
-
if (level >= 5000) return 'Eternal';
|
|
37
|
+
if (5000 <= level) return 'Eternal';
|
|
211
38
|
return (
|
|
212
39
|
[
|
|
213
40
|
'Stone',
|
|
@@ -270,9 +97,17 @@ const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP;
|
|
|
270
97
|
const LEVELS_PER_PRESTIGE = 100;
|
|
271
98
|
const HIGHEST_PRESTIGE = 10;
|
|
272
99
|
|
|
273
|
-
// eslint-disable-next-line require-jsdoc
|
|
100
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
101
|
+
function getLevelRespectingPrestige(level) {
|
|
102
|
+
if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
|
|
103
|
+
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE;
|
|
104
|
+
}
|
|
105
|
+
return level % LEVELS_PER_PRESTIGE;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
274
109
|
function getExpForLevel(level) {
|
|
275
|
-
if (
|
|
110
|
+
if (0 === level) return 0;
|
|
276
111
|
const respectedLevel = getLevelRespectingPrestige(level);
|
|
277
112
|
if (respectedLevel > EASY_LEVELS) return 5000;
|
|
278
113
|
switch (respectedLevel) {
|
|
@@ -284,18 +119,13 @@ function getExpForLevel(level) {
|
|
|
284
119
|
return 2000;
|
|
285
120
|
case 4:
|
|
286
121
|
return 3500;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
// eslint-disable-next-line require-jsdoc
|
|
291
|
-
function getLevelRespectingPrestige(level) {
|
|
292
|
-
if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
|
|
293
|
-
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE;
|
|
294
|
-
} else {
|
|
295
|
-
return level % LEVELS_PER_PRESTIGE;
|
|
122
|
+
default: {
|
|
123
|
+
return 5000;
|
|
124
|
+
}
|
|
296
125
|
}
|
|
297
126
|
}
|
|
298
|
-
|
|
127
|
+
|
|
128
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
299
129
|
function getLevelForExp(exp) {
|
|
300
130
|
const prestiges = Math.floor(exp / XP_PER_PRESTIGE);
|
|
301
131
|
let level = prestiges * LEVELS_PER_PRESTIGE;
|
|
@@ -311,7 +141,8 @@ function getLevelForExp(exp) {
|
|
|
311
141
|
}
|
|
312
142
|
return level + Math.floor(expWithoutPrestiges / 5000);
|
|
313
143
|
}
|
|
314
|
-
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
315
146
|
function generateStatsForPractice(data) {
|
|
316
147
|
return {
|
|
317
148
|
selected: data?.practice?.selected || 'NONE',
|
|
@@ -323,7 +154,7 @@ function generateStatsForPractice(data) {
|
|
|
323
154
|
total: data?.practice?.bridging?.failed_attempts + data?.practice?.bridging?.successful_attempts
|
|
324
155
|
},
|
|
325
156
|
records: {
|
|
326
|
-
|
|
157
|
+
blocks30: {
|
|
327
158
|
elevation: {
|
|
328
159
|
none: {
|
|
329
160
|
straight: data?.practice?.records?.['bridging_distance_30:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
@@ -339,7 +170,7 @@ function generateStatsForPractice(data) {
|
|
|
339
170
|
}
|
|
340
171
|
}
|
|
341
172
|
},
|
|
342
|
-
|
|
173
|
+
blocks50: {
|
|
343
174
|
elevation: {
|
|
344
175
|
none: {
|
|
345
176
|
straight: data?.practice?.records?.['bridging_distance_50:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
@@ -355,7 +186,7 @@ function generateStatsForPractice(data) {
|
|
|
355
186
|
}
|
|
356
187
|
}
|
|
357
188
|
},
|
|
358
|
-
|
|
189
|
+
blocks100: {
|
|
359
190
|
elevation: {
|
|
360
191
|
none: {
|
|
361
192
|
straight: data?.practice?.records?.['bridging_distance_100:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
@@ -398,6 +229,178 @@ function generateStatsForPractice(data) {
|
|
|
398
229
|
}
|
|
399
230
|
};
|
|
400
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* BedWars class
|
|
234
|
+
*/
|
|
235
|
+
class BedWars {
|
|
236
|
+
/**
|
|
237
|
+
* @param {object} data BedWars data
|
|
238
|
+
*/
|
|
239
|
+
constructor(data) {
|
|
240
|
+
/**
|
|
241
|
+
* Tokens
|
|
242
|
+
* @type {number}
|
|
243
|
+
*/
|
|
244
|
+
this.tokens = data.coins || 0;
|
|
245
|
+
/**
|
|
246
|
+
* Level
|
|
247
|
+
* @type {number}
|
|
248
|
+
*/
|
|
249
|
+
this.level = data.Experience ? getLevelForExp(data.Experience) : 0;
|
|
250
|
+
/**
|
|
251
|
+
* Experience
|
|
252
|
+
* @type {number}
|
|
253
|
+
*/
|
|
254
|
+
this.experience = data.Experience || 0;
|
|
255
|
+
/**
|
|
256
|
+
* Prestige
|
|
257
|
+
* @type {BedWarsPrestige}
|
|
258
|
+
*/
|
|
259
|
+
this.prestige = data.Experience ? getBedWarsPrestige(getLevelForExp(data.Experience)) : 'Stone';
|
|
260
|
+
/**
|
|
261
|
+
* Played games
|
|
262
|
+
* @type {number}
|
|
263
|
+
*/
|
|
264
|
+
this.playedGames = data.games_played_bedwars || 0;
|
|
265
|
+
/**
|
|
266
|
+
* Wins
|
|
267
|
+
* @type {number}
|
|
268
|
+
*/
|
|
269
|
+
this.wins = data.wins_bedwars || 0;
|
|
270
|
+
/**
|
|
271
|
+
* Winstreak
|
|
272
|
+
* @type {number}
|
|
273
|
+
*/
|
|
274
|
+
this.winstreak = data.winstreak || 0;
|
|
275
|
+
/**
|
|
276
|
+
* Kills
|
|
277
|
+
* @type {number}
|
|
278
|
+
*/
|
|
279
|
+
this.kills = data.kills_bedwars || 0;
|
|
280
|
+
/**
|
|
281
|
+
* Final kills
|
|
282
|
+
* @type {number}
|
|
283
|
+
*/
|
|
284
|
+
this.finalKills = data.final_kills_bedwars || 0;
|
|
285
|
+
/**
|
|
286
|
+
* Losses
|
|
287
|
+
* @type {number}
|
|
288
|
+
*/
|
|
289
|
+
this.losses = data.losses_bedwars || 0;
|
|
290
|
+
/**
|
|
291
|
+
* Deaths
|
|
292
|
+
* @type {number}
|
|
293
|
+
*/
|
|
294
|
+
this.deaths = data.deaths_bedwars || 0;
|
|
295
|
+
/**
|
|
296
|
+
* Final deaths
|
|
297
|
+
* @type {number}
|
|
298
|
+
*/
|
|
299
|
+
this.finalDeaths = data.final_deaths_bedwars || 0;
|
|
300
|
+
/**
|
|
301
|
+
* Collected items
|
|
302
|
+
* @type {BedWarsCollectedItems}
|
|
303
|
+
*/
|
|
304
|
+
this.collectedItemsTotal = {
|
|
305
|
+
iron: data.iron_resources_collected_bedwars || 0,
|
|
306
|
+
gold: data.gold_resources_collected_bedwars || 0,
|
|
307
|
+
diamond: data.diamond_resources_collected_bedwars || 0,
|
|
308
|
+
emerald: data.emerald_resources_collected_bedwars || 0
|
|
309
|
+
};
|
|
310
|
+
/**
|
|
311
|
+
* Beds lost/broken/BL Ratio
|
|
312
|
+
* @type {BedWarsBeds}
|
|
313
|
+
*/
|
|
314
|
+
this.beds = {
|
|
315
|
+
lost: data.beds_lost_bedwars || 0,
|
|
316
|
+
broken: data.beds_broken_bedwars || 0,
|
|
317
|
+
BLRatio: divide(data.beds_broken_bedwars, data.beds_lost_bedwars)
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Average Kills/Final kills/Beds broken
|
|
321
|
+
* @type {BedWarsAvg}
|
|
322
|
+
*/
|
|
323
|
+
this.avg = {
|
|
324
|
+
kills: divide(this.kills, this.playedGames),
|
|
325
|
+
finalKills: divide(this.finalKills, this.playedGames),
|
|
326
|
+
bedsBroken: divide(this.beds.broken, this.playedGames)
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Kill Death ratio
|
|
330
|
+
* @type {number}
|
|
331
|
+
*/
|
|
332
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
333
|
+
/**
|
|
334
|
+
* Final kill death ratio
|
|
335
|
+
* @type {number}
|
|
336
|
+
*/
|
|
337
|
+
this.finalKDRatio = divide(this.finalKills, this.finalDeaths);
|
|
338
|
+
/**
|
|
339
|
+
* Win Loss ratio
|
|
340
|
+
* @type {number}
|
|
341
|
+
*/
|
|
342
|
+
this.WLRatio = divide(this.wins, this.losses);
|
|
343
|
+
/**
|
|
344
|
+
* BedWars Solo stats
|
|
345
|
+
* @type {BedWarsModeStats}
|
|
346
|
+
*/
|
|
347
|
+
this.solo = generateStatsForMode(data, 'eight_one');
|
|
348
|
+
/**
|
|
349
|
+
* BedWars Doubles stats
|
|
350
|
+
* @type {BedWarsModeStats}
|
|
351
|
+
*/
|
|
352
|
+
this.doubles = generateStatsForMode(data, 'eight_two');
|
|
353
|
+
/**
|
|
354
|
+
* BedWars 3v3v3v3 stats
|
|
355
|
+
* @type {BedWarsModeStats}
|
|
356
|
+
*/
|
|
357
|
+
this.threes = generateStatsForMode(data, 'four_three');
|
|
358
|
+
/**
|
|
359
|
+
* BedWars 4v4v4v4 stats
|
|
360
|
+
* @type {BedWarsModeStats}
|
|
361
|
+
*/
|
|
362
|
+
this.fours = generateStatsForMode(data, 'four_four');
|
|
363
|
+
/**
|
|
364
|
+
* BedWars 4v4 stats
|
|
365
|
+
* @type {BedWarsModeStats}
|
|
366
|
+
*/
|
|
367
|
+
this['4v4'] = generateStatsForMode(data, 'two_four');
|
|
368
|
+
/**
|
|
369
|
+
* BedWars Dream Mode Stats
|
|
370
|
+
* @type {BedwarsDreamStats}
|
|
371
|
+
*/
|
|
372
|
+
this.dream = ['ultimate', 'rush', 'armed', 'lucky', 'voidless'].reduce(
|
|
373
|
+
(ac, mode) => ({
|
|
374
|
+
[mode]: {
|
|
375
|
+
doubles: generateStatsForMode(data, `eight_two_${mode}`),
|
|
376
|
+
fours: generateStatsForMode(data, `four_four_${mode}`)
|
|
377
|
+
},
|
|
378
|
+
...ac
|
|
379
|
+
}),
|
|
380
|
+
{}
|
|
381
|
+
);
|
|
382
|
+
/**
|
|
383
|
+
* BedWars Castle Stats
|
|
384
|
+
* @type {BedWarsModeStats}
|
|
385
|
+
*/
|
|
386
|
+
this.castle = generateStatsForMode(data, 'castle');
|
|
387
|
+
/**
|
|
388
|
+
* BedWars Practice Stats
|
|
389
|
+
* @type {BedWarsPracticeStats}
|
|
390
|
+
*/
|
|
391
|
+
this.practice = generateStatsForPractice(data);
|
|
392
|
+
/**
|
|
393
|
+
* Bedwars Slumber Tickets
|
|
394
|
+
* @type {number}
|
|
395
|
+
*/
|
|
396
|
+
this.slumberTickets = data.slumber?.tickets ?? 0;
|
|
397
|
+
/**
|
|
398
|
+
* Bedwars Slumber Total Tickets
|
|
399
|
+
* @type {number}
|
|
400
|
+
*/
|
|
401
|
+
this.totalSlumberTicket = data.slumber?.total_tickets ?? 0;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
401
404
|
/**
|
|
402
405
|
* @typedef {string} BedWarsPrestige
|
|
403
406
|
* * `Stone`
|
|
@@ -523,9 +526,9 @@ function generateStatsForPractice(data) {
|
|
|
523
526
|
*/
|
|
524
527
|
/**
|
|
525
528
|
* @typedef {Object} BedWarsPracticeRecords
|
|
526
|
-
* @property {BedWarsPracticeRecord}
|
|
527
|
-
* @property {BedWarsPracticeRecord}
|
|
528
|
-
* @property {BedWarsPracticeRecord}
|
|
529
|
+
* @property {BedWarsPracticeRecord} blocks30 30 Blocks
|
|
530
|
+
* @property {BedWarsPracticeRecord} blocks50 50 Blocks
|
|
531
|
+
* @property {BedWarsPracticeRecord} blocks100 100 Blocks
|
|
529
532
|
*/
|
|
530
533
|
/**
|
|
531
534
|
* @typedef {Object} BedWarsPracticeBridging
|
|
@@ -42,6 +42,30 @@ const kits = [
|
|
|
42
42
|
'warrior',
|
|
43
43
|
'rambo'
|
|
44
44
|
];
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
47
|
+
function generateKitStats(data) {
|
|
48
|
+
const stats = [];
|
|
49
|
+
for (let i = 0; i < kits.length; i++) {
|
|
50
|
+
if (data[kits[i]]) {
|
|
51
|
+
stats.push({
|
|
52
|
+
name: kits[i],
|
|
53
|
+
games: data[`games_played_${kits[i]}`] || 0,
|
|
54
|
+
level: data[kits[i]] + 1 || 1,
|
|
55
|
+
experience: data[`exp_${kits[i]}`] || 0,
|
|
56
|
+
prestige: data[`p${kits[i]}`] || 0,
|
|
57
|
+
kills: data[`kills_${kits[i]}`] || 0,
|
|
58
|
+
deaths: data[`deaths_${kits[i]}`] || 0,
|
|
59
|
+
KDRatio: divide(data[`kills_${kits[i]}`], data[`deaths_${kits[i]}`]),
|
|
60
|
+
wins: data[`wins_${kits[i]}`] || 0,
|
|
61
|
+
losses: data[`losses_${kits[i]}`] || 0,
|
|
62
|
+
WLRatio: divide(data[`wins_${kits[i]}`], data[`losses_${kits[i]}`]),
|
|
63
|
+
timePlayed: data[`time_played_${kits[i]}`] || null
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return stats;
|
|
68
|
+
}
|
|
45
69
|
/**
|
|
46
70
|
* Blitz SG class
|
|
47
71
|
*/
|
|
@@ -87,29 +111,6 @@ class BlitzSurvivalGames {
|
|
|
87
111
|
this.kitStats = generateKitStats(data);
|
|
88
112
|
}
|
|
89
113
|
}
|
|
90
|
-
// eslint-disable-next-line require-jsdoc
|
|
91
|
-
function generateKitStats(data) {
|
|
92
|
-
const stats = [];
|
|
93
|
-
for (let i = 0; i < kits.length; i++) {
|
|
94
|
-
if (data[kits[i]]) {
|
|
95
|
-
stats.push({
|
|
96
|
-
name: kits[i],
|
|
97
|
-
games: data[`games_played_${kits[i]}`] || 0,
|
|
98
|
-
level: data[kits[i]] + 1 || 1,
|
|
99
|
-
experience: data[`exp_${kits[i]}`] || 0,
|
|
100
|
-
prestige: data[`p${kits[i]}`] || 0,
|
|
101
|
-
kills: data[`kills_${kits[i]}`] || 0,
|
|
102
|
-
deaths: data[`deaths_${kits[i]}`] || 0,
|
|
103
|
-
KDRatio: divide(data[`kills_${kits[i]}`], data[`deaths_${kits[i]}`]),
|
|
104
|
-
wins: data[`wins_${kits[i]}`] || 0,
|
|
105
|
-
losses: data[`losses_${kits[i]}`] || 0,
|
|
106
|
-
WLRatio: divide(data[`wins_${kits[i]}`], data[`losses_${kits[i]}`]),
|
|
107
|
-
timePlayed: data[`time_played_${kits[i]}`] || null
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return stats;
|
|
112
|
-
}
|
|
113
114
|
/**
|
|
114
115
|
* @typedef {string} BlitzSGKit
|
|
115
116
|
* * `arachnologist`
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const divide = require('../../utils/divide');
|
|
1
|
+
const { duelsDivisions } = require('../../utils/Constants');
|
|
3
2
|
const romanize = require('../../utils/romanize');
|
|
4
|
-
|
|
5
|
-
const { duels_divisions } = require('../../utils/Constants');
|
|
3
|
+
const divide = require('../../utils/divide');
|
|
6
4
|
|
|
7
|
-
// eslint-disable-next-line require-jsdoc
|
|
5
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
8
6
|
function getDivision(data, mode = null) {
|
|
9
|
-
|
|
10
|
-
for (const div of duels_divisions.slice().reverse()) {
|
|
7
|
+
for (const div of duelsDivisions.slice().reverse()) {
|
|
11
8
|
const prestige = data[`${mode ? mode : 'all_modes'}_${div.key}_title_prestige`];
|
|
12
9
|
if (prestige) {
|
|
13
10
|
return `${div.name} ${romanize(prestige)}`;
|
|
@@ -15,14 +12,15 @@ function getDivision(data, mode = null) {
|
|
|
15
12
|
}
|
|
16
13
|
return null;
|
|
17
14
|
}
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
19
17
|
function getTotalKillsDeaths(data) {
|
|
20
18
|
let totalDeaths = 0;
|
|
21
19
|
let totalKills = 0;
|
|
22
20
|
for (const [k, v] of Object.entries(data)) {
|
|
23
|
-
if (k.includes('deaths') &&
|
|
21
|
+
if (k.includes('deaths') && 'deaths' !== k) {
|
|
24
22
|
totalDeaths += v;
|
|
25
|
-
} else if (k.includes('kills') &&
|
|
23
|
+
} else if (k.includes('kills') && 'kills' !== k) {
|
|
26
24
|
totalKills += v;
|
|
27
25
|
}
|
|
28
26
|
}
|
|
@@ -576,7 +574,7 @@ class Duels {
|
|
|
576
574
|
playedGames: data.bridge_four_rounds_played || 0,
|
|
577
575
|
goals: data.bridge_four_goals || 0
|
|
578
576
|
},
|
|
579
|
-
|
|
577
|
+
|
|
580
578
|
ctf: {
|
|
581
579
|
division: getDivision(data, 'bridge'),
|
|
582
580
|
kills: data.capture_threes_bridge_kills || 0,
|
|
@@ -30,7 +30,7 @@ class Pit {
|
|
|
30
30
|
* @type {number}
|
|
31
31
|
*/
|
|
32
32
|
this.level =
|
|
33
|
-
Pit.calcLevel(this.prestige, this.prestige
|
|
33
|
+
Pit.calcLevel(this.prestige, 0 < this.prestige ? this.xp - Prestiges[this.prestige - 1].SumXp : this.xp).level ??
|
|
34
34
|
0;
|
|
35
35
|
/**
|
|
36
36
|
* Kills
|
|
@@ -169,7 +169,7 @@ class Pit {
|
|
|
169
169
|
edited.push(new PitInventoryItem(inventory[i]));
|
|
170
170
|
}
|
|
171
171
|
return edited;
|
|
172
|
-
} catch
|
|
172
|
+
} catch {
|
|
173
173
|
return [];
|
|
174
174
|
}
|
|
175
175
|
};
|
|
@@ -191,7 +191,7 @@ class Pit {
|
|
|
191
191
|
edited.push(new PitInventoryItem(chest[i]));
|
|
192
192
|
}
|
|
193
193
|
return edited;
|
|
194
|
-
} catch
|
|
194
|
+
} catch {
|
|
195
195
|
return [];
|
|
196
196
|
}
|
|
197
197
|
};
|
|
@@ -221,7 +221,7 @@ class Pit {
|
|
|
221
221
|
static calcLevel(prestige, xp) {
|
|
222
222
|
const multiplier = Prestiges[prestige].Multiplier;
|
|
223
223
|
let level = 0;
|
|
224
|
-
while (
|
|
224
|
+
while (0 < xp && 120 > level) {
|
|
225
225
|
const levelXp = Levels[Math.floor(level / 10)].Xp * multiplier;
|
|
226
226
|
if (xp >= levelXp * 10) {
|
|
227
227
|
xp -= levelXp * 10;
|
|
@@ -229,7 +229,6 @@ class Pit {
|
|
|
229
229
|
} else {
|
|
230
230
|
const gain = Math.floor(xp / levelXp);
|
|
231
231
|
level += gain;
|
|
232
|
-
xp -= gain * levelXp;
|
|
233
232
|
xp = 0;
|
|
234
233
|
}
|
|
235
234
|
}
|