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
|
@@ -32,6 +32,203 @@ const generateStatsForMode = (data, mode) => {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
36
|
+
function getBedWarsPrestige(level) {
|
|
37
|
+
if (5000 <= level) return 'Eternal';
|
|
38
|
+
return (
|
|
39
|
+
[
|
|
40
|
+
'Stone',
|
|
41
|
+
'Iron',
|
|
42
|
+
'Gold',
|
|
43
|
+
'Diamond',
|
|
44
|
+
'Emerald',
|
|
45
|
+
'Sapphire',
|
|
46
|
+
'Ruby',
|
|
47
|
+
'Crystal',
|
|
48
|
+
'Opal',
|
|
49
|
+
'Amethyst',
|
|
50
|
+
'Rainbow',
|
|
51
|
+
'Iron Prime',
|
|
52
|
+
'Gold Prime',
|
|
53
|
+
'Diamond Prime',
|
|
54
|
+
'Emerald Prime',
|
|
55
|
+
'Sapphire Prime',
|
|
56
|
+
'Ruby Prime',
|
|
57
|
+
'Crystal Prime',
|
|
58
|
+
'Opal Prime',
|
|
59
|
+
'Amethyst Prime',
|
|
60
|
+
'Mirror',
|
|
61
|
+
'Light',
|
|
62
|
+
'Dawn',
|
|
63
|
+
'Dusk',
|
|
64
|
+
'Air',
|
|
65
|
+
'Wind',
|
|
66
|
+
'Nebula',
|
|
67
|
+
'Thunder',
|
|
68
|
+
'Earth',
|
|
69
|
+
'Water',
|
|
70
|
+
'Fire',
|
|
71
|
+
'Sunrise',
|
|
72
|
+
'Eclipse',
|
|
73
|
+
'Gamma',
|
|
74
|
+
'Majestic',
|
|
75
|
+
'Andesine',
|
|
76
|
+
'Marine',
|
|
77
|
+
'Element',
|
|
78
|
+
'Galaxy',
|
|
79
|
+
'Atomic',
|
|
80
|
+
'Sunset',
|
|
81
|
+
'Time',
|
|
82
|
+
'Winter',
|
|
83
|
+
'Obsidian',
|
|
84
|
+
'Spring',
|
|
85
|
+
'Ice',
|
|
86
|
+
'Summer',
|
|
87
|
+
'Spinel',
|
|
88
|
+
'Autumn',
|
|
89
|
+
'Mystic',
|
|
90
|
+
'Eternal'
|
|
91
|
+
][Math.floor(level / 100)] || 'Eternal'
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
const EASY_LEVELS = 4;
|
|
95
|
+
const EASY_LEVELS_XP = 7000;
|
|
96
|
+
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP;
|
|
97
|
+
const LEVELS_PER_PRESTIGE = 100;
|
|
98
|
+
const HIGHEST_PRESTIGE = 10;
|
|
99
|
+
|
|
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
|
|
109
|
+
function getExpForLevel(level) {
|
|
110
|
+
if (0 === level) return 0;
|
|
111
|
+
const respectedLevel = getLevelRespectingPrestige(level);
|
|
112
|
+
if (respectedLevel > EASY_LEVELS) return 5000;
|
|
113
|
+
switch (respectedLevel) {
|
|
114
|
+
case 1:
|
|
115
|
+
return 500;
|
|
116
|
+
case 2:
|
|
117
|
+
return 1000;
|
|
118
|
+
case 3:
|
|
119
|
+
return 2000;
|
|
120
|
+
case 4:
|
|
121
|
+
return 3500;
|
|
122
|
+
default: {
|
|
123
|
+
return 5000;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
129
|
+
function getLevelForExp(exp) {
|
|
130
|
+
const prestiges = Math.floor(exp / XP_PER_PRESTIGE);
|
|
131
|
+
let level = prestiges * LEVELS_PER_PRESTIGE;
|
|
132
|
+
let expWithoutPrestiges = exp - prestiges * XP_PER_PRESTIGE;
|
|
133
|
+
|
|
134
|
+
for (let i = 1; i <= EASY_LEVELS; ++i) {
|
|
135
|
+
const expForEasyLevel = getExpForLevel(i);
|
|
136
|
+
if (expWithoutPrestiges < expForEasyLevel) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
level++;
|
|
140
|
+
expWithoutPrestiges -= expForEasyLevel;
|
|
141
|
+
}
|
|
142
|
+
return level + Math.floor(expWithoutPrestiges / 5000);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
146
|
+
function generateStatsForPractice(data) {
|
|
147
|
+
return {
|
|
148
|
+
selected: data?.practice?.selected || 'NONE',
|
|
149
|
+
bridging: {
|
|
150
|
+
blocksPlaced: data?.practice?.bridging?.blocks_placed ?? 0,
|
|
151
|
+
attempts: {
|
|
152
|
+
failed: data?.practice?.bridging?.failed_attempts ?? 0,
|
|
153
|
+
successful: data?.practice?.bridging?.successful_attempts ?? 0,
|
|
154
|
+
total: data?.practice?.bridging?.failed_attempts + data?.practice?.bridging?.successful_attempts
|
|
155
|
+
},
|
|
156
|
+
records: {
|
|
157
|
+
blocks30: {
|
|
158
|
+
elevation: {
|
|
159
|
+
none: {
|
|
160
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
161
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
162
|
+
},
|
|
163
|
+
slight: {
|
|
164
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
165
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
166
|
+
},
|
|
167
|
+
staircase: {
|
|
168
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
169
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
blocks50: {
|
|
174
|
+
elevation: {
|
|
175
|
+
none: {
|
|
176
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
177
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
178
|
+
},
|
|
179
|
+
slight: {
|
|
180
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
181
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
182
|
+
},
|
|
183
|
+
staircase: {
|
|
184
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
185
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
blocks100: {
|
|
190
|
+
elevation: {
|
|
191
|
+
none: {
|
|
192
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
193
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
194
|
+
},
|
|
195
|
+
slight: {
|
|
196
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
197
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
198
|
+
},
|
|
199
|
+
staircase: {
|
|
200
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
201
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
fireballJumping: {
|
|
208
|
+
blocksPlaced: data?.practice?.fireball_jumping?.blocks_placed ?? 0,
|
|
209
|
+
attempts: {
|
|
210
|
+
failed: data?.practice?.fireball_jumping?.failed_attempts ?? 0,
|
|
211
|
+
successful: data?.practice?.fireball_jumping?.successful_attempts ?? 0,
|
|
212
|
+
total: data?.practice?.fireball_jumping?.failed_attempts + data?.practice?.fireball_jumping?.successful_attempts
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
pearlClutching: {
|
|
216
|
+
attempts: {
|
|
217
|
+
failed: data?.practice?.pearl_clutching?.failed_attempts ?? 0,
|
|
218
|
+
successful: data?.practice?.pearl_clutching?.successful_attempts ?? 0,
|
|
219
|
+
total: data?.practice?.pearl_clutching?.failed_attempts + data?.practice?.pearl_clutching?.successful_attempts
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
mlg: {
|
|
223
|
+
blocksPlaced: data?.practice?.mlg?.blocks_placed ?? 0,
|
|
224
|
+
attempts: {
|
|
225
|
+
failed: data?.practice?.mlg?.failed_attempts ?? 0,
|
|
226
|
+
successful: data?.practice?.mlg?.successful_attempts ?? 0,
|
|
227
|
+
total: data?.practice?.mlg?.failed_attempts + data?.practice?.mlg?.successful_attempts
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
35
232
|
/**
|
|
36
233
|
* BedWars class
|
|
37
234
|
*/
|
|
@@ -41,10 +238,10 @@ class BedWars {
|
|
|
41
238
|
*/
|
|
42
239
|
constructor(data) {
|
|
43
240
|
/**
|
|
44
|
-
*
|
|
241
|
+
* Tokens
|
|
45
242
|
* @type {number}
|
|
46
243
|
*/
|
|
47
|
-
this.
|
|
244
|
+
this.tokens = data.coins || 0;
|
|
48
245
|
/**
|
|
49
246
|
* Level
|
|
50
247
|
* @type {number}
|
|
@@ -110,19 +307,6 @@ class BedWars {
|
|
|
110
307
|
diamond: data.diamond_resources_collected_bedwars || 0,
|
|
111
308
|
emerald: data.emerald_resources_collected_bedwars || 0
|
|
112
309
|
};
|
|
113
|
-
/**
|
|
114
|
-
* Loot chests
|
|
115
|
-
* @type {BedWarsLootChests}
|
|
116
|
-
*/
|
|
117
|
-
this.lootChests = {
|
|
118
|
-
christmas: data.bedwars_christmas_boxes || 0,
|
|
119
|
-
lunar: data.bedwars_lunar_boxes || 0,
|
|
120
|
-
normal: data.bedwars_boxes || 0,
|
|
121
|
-
easter: data.bedwars_easter_boxes || 0,
|
|
122
|
-
halloween: data.bedwars_halloween_boxes || 0,
|
|
123
|
-
golden: data.bedwars_golden_boxes || 0,
|
|
124
|
-
total: data.bedwars_christmas_boxes + data.bedwars_lunar_boxes + data.bedwars_boxes + data.bedwars_easter_boxes + data.bedwars_halloween_boxes + data.bedwars_golden_boxes || 0
|
|
125
|
-
};
|
|
126
310
|
/**
|
|
127
311
|
* Beds lost/broken/BL Ratio
|
|
128
312
|
* @type {BedWarsBeds}
|
|
@@ -200,115 +384,23 @@ class BedWars {
|
|
|
200
384
|
* @type {BedWarsModeStats}
|
|
201
385
|
*/
|
|
202
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;
|
|
203
402
|
}
|
|
204
403
|
}
|
|
205
|
-
// eslint-disable-next-line require-jsdoc
|
|
206
|
-
function getBedWarsPrestige(level) {
|
|
207
|
-
// eslint-disable-next-line max-len
|
|
208
|
-
if (level >= 5000) return 'Eternal';
|
|
209
|
-
return (
|
|
210
|
-
[
|
|
211
|
-
'Stone',
|
|
212
|
-
'Iron',
|
|
213
|
-
'Gold',
|
|
214
|
-
'Diamond',
|
|
215
|
-
'Emerald',
|
|
216
|
-
'Sapphire',
|
|
217
|
-
'Ruby',
|
|
218
|
-
'Crystal',
|
|
219
|
-
'Opal',
|
|
220
|
-
'Amethyst',
|
|
221
|
-
'Rainbow',
|
|
222
|
-
'Iron Prime',
|
|
223
|
-
'Gold Prime',
|
|
224
|
-
'Diamond Prime',
|
|
225
|
-
'Emerald Prime',
|
|
226
|
-
'Sapphire Prime',
|
|
227
|
-
'Ruby Prime',
|
|
228
|
-
'Crystal Prime',
|
|
229
|
-
'Opal Prime',
|
|
230
|
-
'Amethyst Prime',
|
|
231
|
-
'Mirror',
|
|
232
|
-
'Light',
|
|
233
|
-
'Dawn',
|
|
234
|
-
'Dusk',
|
|
235
|
-
'Air',
|
|
236
|
-
'Wind',
|
|
237
|
-
'Nebula',
|
|
238
|
-
'Thunder',
|
|
239
|
-
'Earth',
|
|
240
|
-
'Water',
|
|
241
|
-
'Fire',
|
|
242
|
-
'Sunrise',
|
|
243
|
-
'Eclipse',
|
|
244
|
-
'Gamma',
|
|
245
|
-
'Majestic',
|
|
246
|
-
'Andesine',
|
|
247
|
-
'Marine',
|
|
248
|
-
'Element',
|
|
249
|
-
'Galaxy',
|
|
250
|
-
'Atomic',
|
|
251
|
-
'Sunset',
|
|
252
|
-
'Time',
|
|
253
|
-
'Winter',
|
|
254
|
-
'Obsidian',
|
|
255
|
-
'Spring',
|
|
256
|
-
'Ice',
|
|
257
|
-
'Summer',
|
|
258
|
-
'Spinel',
|
|
259
|
-
'Autumn',
|
|
260
|
-
'Mystic',
|
|
261
|
-
'Eternal'
|
|
262
|
-
][Math.floor(level / 100)] || 'Eternal'
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
const EASY_LEVELS = 4;
|
|
266
|
-
const EASY_LEVELS_XP = 7000;
|
|
267
|
-
const XP_PER_PRESTIGE = 96 * 5000 + EASY_LEVELS_XP;
|
|
268
|
-
const LEVELS_PER_PRESTIGE = 100;
|
|
269
|
-
const HIGHEST_PRESTIGE = 10;
|
|
270
|
-
|
|
271
|
-
// eslint-disable-next-line require-jsdoc
|
|
272
|
-
function getExpForLevel(level) {
|
|
273
|
-
if (level === 0) return 0;
|
|
274
|
-
const respectedLevel = getLevelRespectingPrestige(level);
|
|
275
|
-
if (respectedLevel > EASY_LEVELS) return 5000;
|
|
276
|
-
switch (respectedLevel) {
|
|
277
|
-
case 1:
|
|
278
|
-
return 500;
|
|
279
|
-
case 2:
|
|
280
|
-
return 1000;
|
|
281
|
-
case 3:
|
|
282
|
-
return 2000;
|
|
283
|
-
case 4:
|
|
284
|
-
return 3500;
|
|
285
|
-
}
|
|
286
|
-
return 5000;
|
|
287
|
-
}
|
|
288
|
-
// eslint-disable-next-line require-jsdoc
|
|
289
|
-
function getLevelRespectingPrestige(level) {
|
|
290
|
-
if (level > HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE) {
|
|
291
|
-
return level - HIGHEST_PRESTIGE * LEVELS_PER_PRESTIGE;
|
|
292
|
-
} else {
|
|
293
|
-
return level % LEVELS_PER_PRESTIGE;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
// eslint-disable-next-line require-jsdoc
|
|
297
|
-
function getLevelForExp(exp) {
|
|
298
|
-
const prestiges = Math.floor(exp / XP_PER_PRESTIGE);
|
|
299
|
-
let level = prestiges * LEVELS_PER_PRESTIGE;
|
|
300
|
-
let expWithoutPrestiges = exp - prestiges * XP_PER_PRESTIGE;
|
|
301
|
-
|
|
302
|
-
for (let i = 1; i <= EASY_LEVELS; ++i) {
|
|
303
|
-
const expForEasyLevel = getExpForLevel(i);
|
|
304
|
-
if (expWithoutPrestiges < expForEasyLevel) {
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
level++;
|
|
308
|
-
expWithoutPrestiges -= expForEasyLevel;
|
|
309
|
-
}
|
|
310
|
-
return level + Math.floor(expWithoutPrestiges / 5000);
|
|
311
|
-
}
|
|
312
404
|
/**
|
|
313
405
|
* @typedef {string} BedWarsPrestige
|
|
314
406
|
* * `Stone`
|
|
@@ -376,15 +468,6 @@ function getLevelForExp(exp) {
|
|
|
376
468
|
* @property {number} diamond Diamond
|
|
377
469
|
* @property {number} emerald Emerald
|
|
378
470
|
*/
|
|
379
|
-
/**
|
|
380
|
-
* @typedef {object} BedWarsLootChests
|
|
381
|
-
* @property {number} christmas Christmas chests
|
|
382
|
-
* @property {number} halloween Halloween chests
|
|
383
|
-
* @property {number} easter Easter chests
|
|
384
|
-
* @property {number} christmas Christmas chests
|
|
385
|
-
* @property {number} golden Golden chests
|
|
386
|
-
* @property {number} normal Normal chests
|
|
387
|
-
*/
|
|
388
471
|
/**
|
|
389
472
|
* @typedef {object} BedWarsBeds
|
|
390
473
|
* @property {number} lost Beds lost
|
|
@@ -420,4 +503,52 @@ function getLevelForExp(exp) {
|
|
|
420
503
|
* @property {BedWarsModeStats} doubles Doubles
|
|
421
504
|
* @property {BedWarsModeStats} fours Fours
|
|
422
505
|
*/
|
|
506
|
+
/**
|
|
507
|
+
* @typedef {Object} BedWarsPracticeAttempts
|
|
508
|
+
* @property {number} failed Total failed attempts
|
|
509
|
+
* @property {number} successful Total successful attempts
|
|
510
|
+
* @property {number} total Total Number of attempts
|
|
511
|
+
*/
|
|
512
|
+
/**
|
|
513
|
+
* @typedef {Object} BedWarsPracticeElevation
|
|
514
|
+
* @property {number} straight straight
|
|
515
|
+
* @property {number} diagonal diagonal
|
|
516
|
+
*/
|
|
517
|
+
/**
|
|
518
|
+
* @typedef {Object} BedWarsPracticeElevations
|
|
519
|
+
* @property {BedWarsPracticeElevation} none none
|
|
520
|
+
* @property {BedWarsPracticeElevation} slight slight
|
|
521
|
+
* @property {BedWarsPracticeElevation} staircase staircase
|
|
522
|
+
*/
|
|
523
|
+
/**
|
|
524
|
+
* @typedef {Object} BedWarsPracticeRecord
|
|
525
|
+
* @property {BedWarsPracticeElevations} elevation Elevation
|
|
526
|
+
*/
|
|
527
|
+
/**
|
|
528
|
+
* @typedef {Object} BedWarsPracticeRecords
|
|
529
|
+
* @property {BedWarsPracticeRecord} blocks30 30 Blocks
|
|
530
|
+
* @property {BedWarsPracticeRecord} blocks50 50 Blocks
|
|
531
|
+
* @property {BedWarsPracticeRecord} blocks100 100 Blocks
|
|
532
|
+
*/
|
|
533
|
+
/**
|
|
534
|
+
* @typedef {Object} BedWarsPracticeBridging
|
|
535
|
+
* @property {number} blocksPlaced Blocks placed
|
|
536
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
537
|
+
*/
|
|
538
|
+
/**
|
|
539
|
+
* @typedef {Object} BedWarsPracticePearlClutching
|
|
540
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
541
|
+
*/
|
|
542
|
+
/**
|
|
543
|
+
* @typedef {Object} BedWarsPracticeMLG
|
|
544
|
+
* @property {number} blocksPlaced Blocks placed
|
|
545
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
546
|
+
*/
|
|
547
|
+
/**
|
|
548
|
+
* @typedef {Object} BedWarsPracticeStats
|
|
549
|
+
* @property {string} selected Selected Type of Practice
|
|
550
|
+
* @property {BedWarsPracticeBridging} bridging Bridging stats
|
|
551
|
+
* @property {BedWarsPracticePearlClutching} pearlClutching Pearl Clutching stats
|
|
552
|
+
* @property {BedWarsPracticeMLG} mlg MLG stats
|
|
553
|
+
*/
|
|
423
554
|
module.exports = BedWars;
|
|
@@ -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`
|