hypixel-api-reborn 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eslint.config.mjs +71 -0
- package/package.json +14 -20
- 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/housing/getActiveHouses.js +7 -0
- package/src/API/housing/getHouse.js +9 -0
- package/src/API/housing/getPlayerHouses.js +11 -0
- package/src/API/index.js +6 -1
- 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/getGarden.js +7 -0
- package/src/API/skyblock/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +5 -2
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +5 -2
- package/src/Client.js +88 -16
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +12 -13
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- package/src/index.js +5 -0
- 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/House.js +54 -0
- package/src/structures/MiniGames/Arcade.js +798 -312
- package/src/structures/MiniGames/ArenaBrawl.js +98 -32
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +381 -129
- package/src/structures/MiniGames/BuildBattle.js +19 -8
- package/src/structures/MiniGames/CopsAndCrims.js +253 -25
- package/src/structures/MiniGames/Duels.js +905 -664
- package/src/structures/MiniGames/MegaWalls.js +390 -51
- package/src/structures/MiniGames/MurderMystery.js +151 -30
- package/src/structures/MiniGames/Paintball.js +31 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/Quakecraft.js +113 -50
- package/src/structures/MiniGames/SkyWars.js +528 -372
- package/src/structures/MiniGames/SmashHeroes.js +201 -73
- package/src/structures/MiniGames/SpeedUHC.js +77 -24
- package/src/structures/MiniGames/TNTGames.js +242 -73
- package/src/structures/MiniGames/TurboKartRacers.js +55 -115
- package/src/structures/MiniGames/UHC.js +144 -132
- package/src/structures/MiniGames/VampireZ.js +70 -37
- package/src/structures/MiniGames/Warlords.js +126 -1
- package/src/structures/MiniGames/WoolWars.js +60 -9
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +43 -128
- 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/SkyblockGarden.js +146 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +90 -228
- 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 +522 -520
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +482 -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 +1186 -967
- package/src/utils/toIGN.js +0 -24
|
@@ -1,4 +1,64 @@
|
|
|
1
1
|
const divide = require('../../utils/divide');
|
|
2
|
+
|
|
3
|
+
class ArenaBrawlMode {
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} data ArenaBrawl data
|
|
6
|
+
* @param {string} mode mode
|
|
7
|
+
*/
|
|
8
|
+
constructor(data, mode) {
|
|
9
|
+
/**
|
|
10
|
+
* Damage
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.damage = data[`damage_${mode}`];
|
|
14
|
+
/**
|
|
15
|
+
* Kills
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
this.kills = data[`kills_${mode}`];
|
|
19
|
+
/**
|
|
20
|
+
* Deaths
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
this.deaths = data[`deaths_${mode}`];
|
|
24
|
+
/**
|
|
25
|
+
* KDRatio
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
29
|
+
/**
|
|
30
|
+
* Healed
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
this.healed = data[`healed_${mode}`];
|
|
34
|
+
/**
|
|
35
|
+
* Wins
|
|
36
|
+
* @type {number}
|
|
37
|
+
*/
|
|
38
|
+
this.wins = data[`wins_${mode}`];
|
|
39
|
+
/**
|
|
40
|
+
* Losses
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
this.losses = data[`losses_${mode}`];
|
|
44
|
+
/**
|
|
45
|
+
* WLRatio
|
|
46
|
+
* @type {number}
|
|
47
|
+
*/
|
|
48
|
+
this.WLRatio = divide(this.wins, this.losses);
|
|
49
|
+
/**
|
|
50
|
+
* Games Played
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
this.games = data[`games_${mode}`];
|
|
54
|
+
/**
|
|
55
|
+
* Winstreak
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
this.winstreak = data[`win_streaks_${mode}`];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
2
62
|
/**
|
|
3
63
|
* ArenaBrawl class
|
|
4
64
|
*/
|
|
@@ -12,41 +72,47 @@ class ArenaBrawl {
|
|
|
12
72
|
* @type {number}
|
|
13
73
|
*/
|
|
14
74
|
this.coins = data.coins || 0;
|
|
75
|
+
/**
|
|
76
|
+
* Coins Spent
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
this.coinsSpent = data.coins_spent || 0;
|
|
80
|
+
/**
|
|
81
|
+
* Wins
|
|
82
|
+
* @type {number}
|
|
83
|
+
*/
|
|
84
|
+
this.wins = data.wins || 0;
|
|
85
|
+
/**
|
|
86
|
+
* Keys
|
|
87
|
+
* @type {number}
|
|
88
|
+
*/
|
|
89
|
+
this.keys = data.keys || 0;
|
|
90
|
+
/**
|
|
91
|
+
* Chests
|
|
92
|
+
* @type {number}
|
|
93
|
+
*/
|
|
94
|
+
this.chests = data.magical_chest || 0;
|
|
95
|
+
/**
|
|
96
|
+
* Rune
|
|
97
|
+
* @type {string}
|
|
98
|
+
*/
|
|
99
|
+
this.rune = data.active_rune || '';
|
|
15
100
|
/**
|
|
16
101
|
* ArenaBrawl mode stats
|
|
17
|
-
* @type {
|
|
102
|
+
* @type {ArenaBrawlMode}
|
|
18
103
|
*/
|
|
19
|
-
this
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
104
|
+
this['1v1'] = new ArenaBrawlMode(data, '1v1');
|
|
105
|
+
/**
|
|
106
|
+
* ArenaBrawl mode stats
|
|
107
|
+
* @type {ArenaBrawlMode}
|
|
108
|
+
*/
|
|
109
|
+
this['2v2'] = new ArenaBrawlMode(data, '2v2');
|
|
110
|
+
/**
|
|
111
|
+
* ArenaBrawl mode stats
|
|
112
|
+
* @type {ArenaBrawlMode}
|
|
113
|
+
*/
|
|
114
|
+
this['4v4'] = new ArenaBrawlMode(data, '4v4');
|
|
24
115
|
}
|
|
25
116
|
}
|
|
26
|
-
|
|
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
|
-
/**
|
|
38
|
-
* @typedef {Object} ArenaBrawlStats
|
|
39
|
-
* @property {ArenaBrawlModeStats} '1v1' ArenaBrawl 1v1 stats
|
|
40
|
-
* @property {ArenaBrawlModeStats} '2v2' ArenaBrawl 2v2 stats
|
|
41
|
-
* @property {ArenaBrawlModeStats} '4v4' ArenaBrawl 4v4 stats
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {Object} ArenaBrawlModeStats
|
|
45
|
-
* @property {number} kills ArenaBrawl kills
|
|
46
|
-
* @property {number} deaths ArenaBrawl deaths
|
|
47
|
-
* @property {number} KDRatio ArenaBrawl Kill Death ratio
|
|
48
|
-
* @property {number} wins ArenaBrawl wins
|
|
49
|
-
* @property {number} losses ArenaBrawl losses
|
|
50
|
-
* @property {number} WLRatio ArenaBrawl Win Loss ratio
|
|
51
|
-
*/
|
|
117
|
+
|
|
52
118
|
module.exports = ArenaBrawl;
|
|
@@ -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
|