hypixel-api-reborn 11.0.1 → 11.2.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/.prettierrc +13 -13
- package/LICENSE +20 -20
- package/README.md +67 -65
- package/package.json +20 -18
- package/src/API/getAPIStatus.js +1 -1
- package/src/API/getAchievements.js +6 -0
- package/src/API/getChallenges.js +6 -0
- package/src/API/getGuild.js +1 -1
- package/src/API/getGuildAchievements.js +6 -0
- package/src/API/getLeaderboards.js +3 -1
- package/src/API/getPlayer.js +1 -1
- package/src/API/getQuests.js +6 -0
- package/src/API/getRecentGames.js +1 -1
- package/src/API/getServerInfo.js +3 -1
- package/src/API/getStatus.js +1 -1
- package/src/API/index.js +28 -17
- package/src/API/skyblock/getAuction.js +19 -0
- package/src/API/skyblock/{getSkyblockAuctions.js → getAuctions.js} +6 -2
- package/src/API/skyblock/{getSkyblockAuctionsByPlayer.js → getAuctionsByPlayer.js} +1 -1
- package/src/API/skyblock/getBingo.js +8 -0
- package/src/API/skyblock/getBingoByPlayer.js +14 -0
- package/src/API/skyblock/getFireSales.js +7 -0
- package/src/API/skyblock/getGovernment.js +8 -0
- package/src/API/skyblock/{getSkyblockMember.js → getMember.js} +10 -6
- package/src/API/skyblock/getMuseum.js +14 -0
- package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +14 -12
- package/src/Client.js +91 -17
- package/src/Errors.js +39 -17
- package/src/Private/rateLimit.js +10 -2
- package/src/Private/requests.js +20 -8
- package/src/Private/updater.js +10 -20
- package/src/Private/uuidCache.js +23 -29
- package/src/Private/validate.js +20 -9
- package/src/index.js +9 -0
- package/src/structures/APIIncident.js +3 -9
- package/src/structures/Boosters/Booster.js +5 -5
- package/src/structures/Color.js +93 -48
- package/src/structures/Game.js +3 -1
- package/src/structures/Guild/Guild.js +21 -17
- package/src/structures/Guild/GuildMember.js +6 -6
- package/src/structures/Guild/GuildRank.js +2 -2
- package/src/structures/MiniGames/Arcade.js +22 -17
- package/src/structures/MiniGames/BedWars.js +152 -24
- package/src/structures/MiniGames/Duels.js +84 -23
- package/src/structures/MiniGames/MegaWalls.js +3 -1
- package/src/structures/MiniGames/MurderMystery.js +2 -2
- package/src/structures/MiniGames/Pit.js +231 -2
- package/src/structures/MiniGames/PitInventoryItem.js +43 -0
- package/src/structures/MiniGames/SkyWars.js +19 -14
- package/src/structures/MiniGames/SmashHeroes.js +1 -1
- package/src/structures/MiniGames/TNTGames.js +1 -1
- package/src/structures/MiniGames/UHC.js +21 -3
- package/src/structures/MiniGames/WoolWars.js +1 -1
- package/src/structures/Player.js +16 -20
- package/src/structures/PlayerCosmetics.js +64 -10
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/Auctions/Auction.js +3 -1
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +1 -0
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -0
- package/src/structures/SkyBlock/Auctions/Bid.js +1 -0
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +1 -0
- package/src/structures/SkyBlock/PlayerBingo.js +56 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +86 -18
- package/src/structures/SkyBlock/SkyblockMember.js +252 -144
- package/src/structures/SkyBlock/SkyblockMuseum.js +60 -0
- package/src/structures/SkyBlock/SkyblockMuseumItem.js +54 -0
- package/src/structures/SkyBlock/SkyblockPet.js +1 -0
- package/src/structures/SkyBlock/SkyblockProfile.js +37 -23
- package/src/structures/SkyBlock/Static/Bingo.js +102 -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 +86 -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 +385 -42
- package/src/utils/SkyblockUtils.js +12 -7
- package/src/utils/guildExp.js +4 -1
- package/src/utils/removeSnakeCase.js +9 -2
- package/src/utils/romanize.js +32 -1
- package/src/utils/toIGN.js +6 -2
- package/src/utils/toUuid.js +10 -5
- package/typings/index.d.ts +989 -297
- /package/src/API/skyblock/{getSkyblockBazaar.js → getBazaar.js} +0 -0
- /package/src/API/skyblock/{getEndedSkyblockAuctions.js → getEndedAuctions.js} +0 -0
- /package/src/API/skyblock/{getSkyblockNews.js → getNews.js} +0 -0
package/src/structures/Color.js
CHANGED
|
@@ -68,62 +68,107 @@ class Color {
|
|
|
68
68
|
toCode() {
|
|
69
69
|
return this.color;
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Returns color code
|
|
74
|
+
* @return {InGameCode}
|
|
75
|
+
*/
|
|
76
|
+
toInGameCode() {
|
|
77
|
+
const InGameCodes = {
|
|
78
|
+
BLACK: '§0',
|
|
79
|
+
DARK_BLUE: '§1',
|
|
80
|
+
DARK_GREEN: '§2',
|
|
81
|
+
DARK_AQUA: '§3',
|
|
82
|
+
DARK_RED: '§4',
|
|
83
|
+
DARK_PURPLE: '§5',
|
|
84
|
+
GOLD: '§6',
|
|
85
|
+
GRAY: '§7',
|
|
86
|
+
DARK_GRAY: '§8',
|
|
87
|
+
BLUE: '§9',
|
|
88
|
+
GREEN: '§a',
|
|
89
|
+
AQUA: '§b',
|
|
90
|
+
RED: '§c',
|
|
91
|
+
LIGHT_PURPLE: '§d',
|
|
92
|
+
YELLOW: '§e',
|
|
93
|
+
WHITE: '§f'
|
|
94
|
+
};
|
|
95
|
+
return InGameCodes[this.color];
|
|
96
|
+
}
|
|
71
97
|
}
|
|
72
98
|
/**
|
|
73
99
|
* @typedef {string} ColorCode
|
|
74
|
-
* *
|
|
75
|
-
* *
|
|
76
|
-
* *
|
|
77
|
-
* *
|
|
78
|
-
* *
|
|
79
|
-
* *
|
|
80
|
-
* *
|
|
81
|
-
* *
|
|
82
|
-
* *
|
|
83
|
-
* *
|
|
84
|
-
* *
|
|
85
|
-
* *
|
|
86
|
-
* *
|
|
87
|
-
* *
|
|
88
|
-
* *
|
|
89
|
-
* *
|
|
100
|
+
* * 'BLACK'
|
|
101
|
+
* * 'DARK_BLUE'
|
|
102
|
+
* * 'DARK_GREEN'
|
|
103
|
+
* * 'DARK_AQUA'
|
|
104
|
+
* * 'DARK_RED'
|
|
105
|
+
* * 'DARK_PURPLE'
|
|
106
|
+
* * 'GOLD'
|
|
107
|
+
* * 'GRAY'
|
|
108
|
+
* * 'DARK_GRAY'
|
|
109
|
+
* * 'BLUE'
|
|
110
|
+
* * 'GREEN'
|
|
111
|
+
* * 'AQUA'
|
|
112
|
+
* * 'RED'
|
|
113
|
+
* * 'LIGHT_PURPLE'
|
|
114
|
+
* * 'YELLOW'
|
|
115
|
+
* * 'WHITE'
|
|
90
116
|
*/
|
|
91
117
|
/**
|
|
92
118
|
* @typedef {string} ColorString
|
|
93
|
-
* * BLACK:
|
|
94
|
-
* * DARK_BLUE:
|
|
95
|
-
* * DARK_GREEN:
|
|
96
|
-
* * DARK_AQUA:
|
|
97
|
-
* * DARK_RED:
|
|
98
|
-
* * DARK_PURPLE:
|
|
99
|
-
* * GOLD:
|
|
100
|
-
* * GRAY:
|
|
101
|
-
* * DARK_GRAY:
|
|
102
|
-
* * BLUE: `
|
|
103
|
-
* * GREEN:
|
|
104
|
-
* * AQUA:
|
|
105
|
-
* * RED:
|
|
106
|
-
* * LIGHT_PURPLE:
|
|
107
|
-
* * YELLOW:
|
|
108
|
-
* * WHITE:
|
|
119
|
+
* * BLACK: 'Black'
|
|
120
|
+
* * DARK_BLUE: 'Dark Blue'
|
|
121
|
+
* * DARK_GREEN: 'Dark Green'
|
|
122
|
+
* * DARK_AQUA: 'Dark Aqua'
|
|
123
|
+
* * DARK_RED: 'Dark Red'
|
|
124
|
+
* * DARK_PURPLE: 'Dark Purple'
|
|
125
|
+
* * GOLD: 'Gold'
|
|
126
|
+
* * GRAY: 'Gray'
|
|
127
|
+
* * DARK_GRAY: 'Dark Gray'
|
|
128
|
+
* * BLUE: 'Blue`'
|
|
129
|
+
* * GREEN: 'Green'
|
|
130
|
+
* * AQUA: 'Aqua'
|
|
131
|
+
* * RED: 'Red'
|
|
132
|
+
* * LIGHT_PURPLE: 'Light Purple'
|
|
133
|
+
* * YELLOW: 'Yellow'
|
|
134
|
+
* * WHITE: 'White'
|
|
109
135
|
*/
|
|
110
136
|
/**
|
|
111
137
|
* @typedef {string} ColorHex
|
|
112
|
-
* * BLACK:
|
|
113
|
-
* * DARK_BLUE:
|
|
114
|
-
* * DARK_GREEN:
|
|
115
|
-
* * DARK_AQUA:
|
|
116
|
-
* * DARK_RED:
|
|
117
|
-
* * DARK_PURPLE:
|
|
118
|
-
* * GOLD:
|
|
119
|
-
* * GRAY:
|
|
120
|
-
* * DARK_GRAY:
|
|
121
|
-
* * BLUE:
|
|
122
|
-
* * GREEN:
|
|
123
|
-
* * AQUA:
|
|
124
|
-
* * RED:
|
|
125
|
-
* * LIGHT_PURPLE:
|
|
126
|
-
* * YELLOW:
|
|
127
|
-
* * WHITE:
|
|
138
|
+
* * BLACK: '#000000'
|
|
139
|
+
* * DARK_BLUE: '#0000AA'
|
|
140
|
+
* * DARK_GREEN: '#008000'
|
|
141
|
+
* * DARK_AQUA: '#00AAAA'
|
|
142
|
+
* * DARK_RED: '#AA0000'
|
|
143
|
+
* * DARK_PURPLE: '#AA00AA'
|
|
144
|
+
* * GOLD: '#FFAA00'
|
|
145
|
+
* * GRAY: '#AAAAAA'
|
|
146
|
+
* * DARK_GRAY: '#555555'
|
|
147
|
+
* * BLUE: '#5555FF'
|
|
148
|
+
* * GREEN: '#3CE63C'
|
|
149
|
+
* * AQUA: '#3CE6E6'
|
|
150
|
+
* * RED: '#FF5555'
|
|
151
|
+
* * LIGHT_PURPLE: '#FF55FF'
|
|
152
|
+
* * YELLOW: '#FFFF55'
|
|
153
|
+
* * WHITE: '#FFFFFF'
|
|
154
|
+
*/
|
|
155
|
+
/**
|
|
156
|
+
* @typedef {string} InGameCode
|
|
157
|
+
* * BLACK: '§0'
|
|
158
|
+
* * DARK_BLUE: '§1'
|
|
159
|
+
* * DARK_GREEN: '§2'
|
|
160
|
+
* * DARK_AQUA: '§3'
|
|
161
|
+
* * DARK_RED: '§4'
|
|
162
|
+
* * DARK_PURPLE: '§5'
|
|
163
|
+
* * GOLD: '§6'
|
|
164
|
+
* * GRAY: '§7'
|
|
165
|
+
* * DARK_GRAY: '§8'
|
|
166
|
+
* * BLUE: '§9'
|
|
167
|
+
* * GREEN: '§a'
|
|
168
|
+
* * AQUA: '§b'
|
|
169
|
+
* * RED: '§c'
|
|
170
|
+
* * LIGHT_PURPLE: '§d'
|
|
171
|
+
* * YELLOW: '§e'
|
|
172
|
+
* * WHITE: '§f'
|
|
128
173
|
*/
|
|
129
174
|
module.exports = Color;
|
package/src/structures/Game.js
CHANGED
|
@@ -12,7 +12,9 @@ class Game {
|
|
|
12
12
|
* @type {GameId|GameCode}
|
|
13
13
|
*/
|
|
14
14
|
this.game = game.toString().toLowerCase();
|
|
15
|
-
const result = games.find(
|
|
15
|
+
const result = games.find(
|
|
16
|
+
(g) => g.code.toLowerCase() === this.game || g.id.toString() === this.game || g.name.toLowerCase() === this.game
|
|
17
|
+
);
|
|
16
18
|
/**
|
|
17
19
|
* ID of game
|
|
18
20
|
* @type {GameId}
|
|
@@ -9,7 +9,7 @@ const { getGuildLevel, parseHistory } = require('../../utils/guildExp');
|
|
|
9
9
|
class Guild {
|
|
10
10
|
/**
|
|
11
11
|
* @param {data} data Guild data
|
|
12
|
-
* @param {string} [me] Player uuid
|
|
12
|
+
* @param {string} [me] Player uuid u#sed to search for this guild
|
|
13
13
|
*/
|
|
14
14
|
constructor(data, me = '') {
|
|
15
15
|
/**
|
|
@@ -19,22 +19,22 @@ class Guild {
|
|
|
19
19
|
this.id = data._id;
|
|
20
20
|
/**
|
|
21
21
|
* Guild name
|
|
22
|
-
* @type {
|
|
22
|
+
* @type {string}
|
|
23
23
|
*/
|
|
24
24
|
this.name = data.name;
|
|
25
25
|
/**
|
|
26
26
|
* Guild description
|
|
27
|
-
* @type {
|
|
27
|
+
* @type {string}
|
|
28
28
|
*/
|
|
29
|
-
this.description = data.description
|
|
29
|
+
this.description = data.description ?? '';
|
|
30
30
|
/**
|
|
31
31
|
* Guild experience
|
|
32
|
-
* @type {
|
|
32
|
+
* @type {number}
|
|
33
33
|
*/
|
|
34
34
|
this.experience = data.exp || 0;
|
|
35
35
|
/**
|
|
36
36
|
* Guild level
|
|
37
|
-
* @type {
|
|
37
|
+
* @type {number}
|
|
38
38
|
*/
|
|
39
39
|
this.level = getGuildLevel(this.experience);
|
|
40
40
|
/**
|
|
@@ -64,7 +64,9 @@ class Guild {
|
|
|
64
64
|
* @return {Array<GuildRank>}
|
|
65
65
|
*/
|
|
66
66
|
this.getRanksByNewest = function () {
|
|
67
|
-
return this.ranks.length
|
|
67
|
+
return this.ranks.length
|
|
68
|
+
? this.ranks.map((r) => new GuildRank(r)).sort((a, b) => b.createdAt - a.createdAt)
|
|
69
|
+
: null;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* A map containing all guild members, keyed by their uuids
|
|
@@ -86,7 +88,7 @@ class Guild {
|
|
|
86
88
|
};
|
|
87
89
|
/**
|
|
88
90
|
* Date of guild creation as timestamp
|
|
89
|
-
* @type {
|
|
91
|
+
* @type {string}
|
|
90
92
|
*/
|
|
91
93
|
this.createdAtTimestamp = data.created;
|
|
92
94
|
/**
|
|
@@ -98,7 +100,7 @@ class Guild {
|
|
|
98
100
|
* Whether this guild can be joined using /g join
|
|
99
101
|
* @type {boolean}
|
|
100
102
|
*/
|
|
101
|
-
this.joinable = data.joinable
|
|
103
|
+
this.joinable = data.joinable ?? false;
|
|
102
104
|
/**
|
|
103
105
|
* Whether this guild is listed in the Guild Finder
|
|
104
106
|
* @type {boolean}
|
|
@@ -108,22 +110,22 @@ class Guild {
|
|
|
108
110
|
* Timestamp guild chat will be unmuted at.
|
|
109
111
|
* @type {number|null}
|
|
110
112
|
*/
|
|
111
|
-
this.chatMuteUntilTimestamp = data.chatMute
|
|
113
|
+
this.chatMuteUntilTimestamp = data.chatMute ?? null;
|
|
112
114
|
/**
|
|
113
115
|
* Timestamp guild chat will be unmuted at as Date.
|
|
114
116
|
* @type {Date|null}
|
|
115
117
|
*/
|
|
116
|
-
this.chatMuteUntil =
|
|
118
|
+
this.chatMuteUntil = new Date(data.chatMute) ?? null;
|
|
117
119
|
/**
|
|
118
120
|
* Timestamp guild chat will be unmuted at.
|
|
119
121
|
* @type {Array<{ Pattern: string, Color: string }>}
|
|
120
122
|
*/
|
|
121
|
-
this.banner = data.banner
|
|
123
|
+
this.banner = data.banner ?? null;
|
|
122
124
|
/**
|
|
123
125
|
* Guild tag
|
|
124
126
|
* @type {string}
|
|
125
127
|
*/
|
|
126
|
-
this.tag = data.tag
|
|
128
|
+
this.tag = data.tag ?? null;
|
|
127
129
|
/**
|
|
128
130
|
* Guild tag color
|
|
129
131
|
* @type {Color}
|
|
@@ -145,9 +147,9 @@ class Guild {
|
|
|
145
147
|
* @type {{winners: number, experienceKings: number, onlinePlayers: number}}
|
|
146
148
|
*/
|
|
147
149
|
this.achievements = {
|
|
148
|
-
winners: data.achievements
|
|
149
|
-
experienceKings: data.achievements
|
|
150
|
-
onlinePlayers: data.achievements
|
|
150
|
+
winners: data.achievements.WINNERS ?? 0,
|
|
151
|
+
experienceKings: data.achievements.EXPERIENCE_KINGS ?? 0,
|
|
152
|
+
onlinePlayers: data.achievements.ONLINE_PLAYERS ?? 0
|
|
151
153
|
};
|
|
152
154
|
/**
|
|
153
155
|
* Guild preferred games
|
|
@@ -176,7 +178,9 @@ function members(data) {
|
|
|
176
178
|
}
|
|
177
179
|
// eslint-disable-next-line require-jsdoc
|
|
178
180
|
function ranks(data) {
|
|
179
|
-
return data.ranks && data.ranks.length
|
|
181
|
+
return data.ranks && data.ranks.length
|
|
182
|
+
? data.ranks.map((r) => new GuildRank(r)).sort((a, b) => a.priority - b.priority)
|
|
183
|
+
: [];
|
|
180
184
|
}
|
|
181
185
|
// eslint-disable-next-line require-jsdoc
|
|
182
186
|
function totalWeeklyGexp(data) {
|
|
@@ -9,12 +9,12 @@ class GuildMember {
|
|
|
9
9
|
constructor(data) {
|
|
10
10
|
/**
|
|
11
11
|
* Guild member UUID
|
|
12
|
-
* @type {
|
|
12
|
+
* @type {string}
|
|
13
13
|
*/
|
|
14
14
|
this.uuid = data.uuid;
|
|
15
15
|
/**
|
|
16
16
|
* Timestamp this member joined at
|
|
17
|
-
* @type {
|
|
17
|
+
* @type {number}
|
|
18
18
|
*/
|
|
19
19
|
this.joinedAtTimestamp = data.joined;
|
|
20
20
|
/**
|
|
@@ -24,19 +24,19 @@ class GuildMember {
|
|
|
24
24
|
this.joinedAt = new Date(data.joined);
|
|
25
25
|
/**
|
|
26
26
|
* The number of challenges completed that count towards the current quest
|
|
27
|
-
* @type {
|
|
27
|
+
* @type {number}
|
|
28
28
|
*/
|
|
29
29
|
this.questParticipation = data.questParticipation || 0;
|
|
30
30
|
/**
|
|
31
31
|
* Member's rank
|
|
32
|
-
* @type {
|
|
32
|
+
* @type {string}
|
|
33
33
|
*/
|
|
34
34
|
this.rank = data.rank;
|
|
35
35
|
/**
|
|
36
36
|
* Timestamp this member will be unmuted at ( if muted )
|
|
37
37
|
* @type {Number|null}
|
|
38
38
|
*/
|
|
39
|
-
this.mutedUntilTimestamp = data.mutedTill
|
|
39
|
+
this.mutedUntilTimestamp = data.mutedTill ?? null;
|
|
40
40
|
/**
|
|
41
41
|
* Timestamp this member will be unmuted at as Date ( if muted )
|
|
42
42
|
* @type {Date|null}
|
|
@@ -50,7 +50,7 @@ class GuildMember {
|
|
|
50
50
|
this.expHistory = parseHistory(data.expHistory);
|
|
51
51
|
/**
|
|
52
52
|
* Experience per week, resets every Monday at 5 am UTC
|
|
53
|
-
* @type {
|
|
53
|
+
* @type {number}
|
|
54
54
|
*/
|
|
55
55
|
this.weeklyExperience = xpCheck ? Object.values(data.expHistory).reduce((pV, cV) => pV + cV, 0) : null;
|
|
56
56
|
}
|
|
@@ -8,7 +8,7 @@ class GuildRank {
|
|
|
8
8
|
constructor(data) {
|
|
9
9
|
/**
|
|
10
10
|
* Guild rank name
|
|
11
|
-
* @type {
|
|
11
|
+
* @type {string}
|
|
12
12
|
*/
|
|
13
13
|
this.name = data.name;
|
|
14
14
|
/**
|
|
@@ -20,7 +20,7 @@ class GuildRank {
|
|
|
20
20
|
* Guild rank tag that appears in guild chat. null if none
|
|
21
21
|
* @type {string|null}
|
|
22
22
|
*/
|
|
23
|
-
this.tag = data.tag
|
|
23
|
+
this.tag = data.tag ?? null;
|
|
24
24
|
/**
|
|
25
25
|
* Timestamp this rank was created at
|
|
26
26
|
* @type {number}
|
|
@@ -13,16 +13,6 @@ class Arcade {
|
|
|
13
13
|
* @param {Object} data Data from the API
|
|
14
14
|
*/
|
|
15
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
16
|
/**
|
|
27
17
|
* Amount of coins
|
|
28
18
|
* @type {number}
|
|
@@ -40,12 +30,12 @@ class Arcade {
|
|
|
40
30
|
this.monthlyCoins = parseInt(data[`monthly_coins_${monthAB()}`] || 0, 10);
|
|
41
31
|
/**
|
|
42
32
|
* Hints Disabled
|
|
43
|
-
* @type {
|
|
33
|
+
* @type {boolean}
|
|
44
34
|
*/
|
|
45
35
|
this.hintsDisabled = !data.hints;
|
|
46
36
|
/**
|
|
47
37
|
* Flash Disabled
|
|
48
|
-
* @type {
|
|
38
|
+
* @type {boolean}
|
|
49
39
|
*/
|
|
50
40
|
this.flashDisabled = !data.flash;
|
|
51
41
|
/**
|
|
@@ -62,22 +52,34 @@ class Arcade {
|
|
|
62
52
|
* Easter Simulator stats
|
|
63
53
|
* @type {EasterSimulator}
|
|
64
54
|
*/
|
|
65
|
-
this.easterSimulator = new BaseGame(data, 'easter_simulator').extend(
|
|
55
|
+
this.easterSimulator = new BaseGame(data, 'easter_simulator').extend(
|
|
56
|
+
'eggsFound',
|
|
57
|
+
data.eggs_found_easter_simulator || 0
|
|
58
|
+
);
|
|
66
59
|
/**
|
|
67
60
|
* Grinch Simulator stats
|
|
68
61
|
* @type {GrinchSimulator}
|
|
69
62
|
*/
|
|
70
|
-
this.grinchSimulator = new BaseGame(data, 'grinch_simulator_v2').extend(
|
|
63
|
+
this.grinchSimulator = new BaseGame(data, 'grinch_simulator_v2').extend(
|
|
64
|
+
'giftsFound',
|
|
65
|
+
data.gifts_grinch_simulator_v2 || 0
|
|
66
|
+
);
|
|
71
67
|
/**
|
|
72
68
|
* Scuba Simulator stats
|
|
73
69
|
* @type {ScubaSimulator}
|
|
74
70
|
*/
|
|
75
|
-
this.scubaSimulator = new BaseGame(data, 'scuba_simulator').extend(
|
|
71
|
+
this.scubaSimulator = new BaseGame(data, 'scuba_simulator').extend(
|
|
72
|
+
'itemsFound',
|
|
73
|
+
data.items_found_scuba_simulator || 0
|
|
74
|
+
);
|
|
76
75
|
/**
|
|
77
76
|
* Santa Simulator stats
|
|
78
77
|
* @type {SantaSimulator}
|
|
79
78
|
*/
|
|
80
|
-
this.santaSimulator = new BaseGame(data, 'santa_simulator').extend(
|
|
79
|
+
this.santaSimulator = new BaseGame(data, 'santa_simulator').extend(
|
|
80
|
+
'giftsDelivered',
|
|
81
|
+
data.delivered_santa_simulator || 0
|
|
82
|
+
);
|
|
81
83
|
/**
|
|
82
84
|
* Santa Says stats
|
|
83
85
|
* @type {BaseGame}
|
|
@@ -156,7 +158,10 @@ class Arcade {
|
|
|
156
158
|
* OITQ / One In The Quiver stats
|
|
157
159
|
* @type {OITQ}
|
|
158
160
|
*/
|
|
159
|
-
this.oitq = this.oneInTheQuiver = new BaseGame(data, 'oneinthequiver').extend(
|
|
161
|
+
this.oitq = this.oneInTheQuiver = new BaseGame(data, 'oneinthequiver').extend(
|
|
162
|
+
'bountyKills',
|
|
163
|
+
data.bounty_kills_oneinthequiver || 0
|
|
164
|
+
);
|
|
160
165
|
/**
|
|
161
166
|
* Zombies
|
|
162
167
|
* @type {Zombies}
|
|
@@ -41,10 +41,10 @@ class BedWars {
|
|
|
41
41
|
*/
|
|
42
42
|
constructor(data) {
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Tokens
|
|
45
45
|
* @type {number}
|
|
46
46
|
*/
|
|
47
|
-
this.
|
|
47
|
+
this.tokens = data.coins || 0;
|
|
48
48
|
/**
|
|
49
49
|
* Level
|
|
50
50
|
* @type {number}
|
|
@@ -110,19 +110,6 @@ class BedWars {
|
|
|
110
110
|
diamond: data.diamond_resources_collected_bedwars || 0,
|
|
111
111
|
emerald: data.emerald_resources_collected_bedwars || 0
|
|
112
112
|
};
|
|
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
113
|
/**
|
|
127
114
|
* Beds lost/broken/BL Ratio
|
|
128
115
|
* @type {BedWarsBeds}
|
|
@@ -200,6 +187,21 @@ class BedWars {
|
|
|
200
187
|
* @type {BedWarsModeStats}
|
|
201
188
|
*/
|
|
202
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;
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
// eslint-disable-next-line require-jsdoc
|
|
@@ -309,6 +311,93 @@ function getLevelForExp(exp) {
|
|
|
309
311
|
}
|
|
310
312
|
return level + Math.floor(expWithoutPrestiges / 5000);
|
|
311
313
|
}
|
|
314
|
+
// eslint-disable-next-line require-jsdoc
|
|
315
|
+
function generateStatsForPractice(data) {
|
|
316
|
+
return {
|
|
317
|
+
selected: data?.practice?.selected || 'NONE',
|
|
318
|
+
bridging: {
|
|
319
|
+
blocksPlaced: data?.practice?.bridging?.blocks_placed ?? 0,
|
|
320
|
+
attempts: {
|
|
321
|
+
failed: data?.practice?.bridging?.failed_attempts ?? 0,
|
|
322
|
+
successful: data?.practice?.bridging?.successful_attempts ?? 0,
|
|
323
|
+
total: data?.practice?.bridging?.failed_attempts + data?.practice?.bridging?.successful_attempts
|
|
324
|
+
},
|
|
325
|
+
records: {
|
|
326
|
+
'30Blocks': {
|
|
327
|
+
elevation: {
|
|
328
|
+
none: {
|
|
329
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
330
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
331
|
+
},
|
|
332
|
+
slight: {
|
|
333
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
334
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
335
|
+
},
|
|
336
|
+
staircase: {
|
|
337
|
+
straight: data?.practice?.records?.['bridging_distance_30:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
338
|
+
diagonal: data?.practice?.records?.['bridging_distance_30:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
'50Blocks': {
|
|
343
|
+
elevation: {
|
|
344
|
+
none: {
|
|
345
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
346
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
347
|
+
},
|
|
348
|
+
slight: {
|
|
349
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
350
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
351
|
+
},
|
|
352
|
+
staircase: {
|
|
353
|
+
straight: data?.practice?.records?.['bridging_distance_50:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
354
|
+
diagonal: data?.practice?.records?.['bridging_distance_50:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
'100Blocks': {
|
|
359
|
+
elevation: {
|
|
360
|
+
none: {
|
|
361
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_NONE:angle_STRAIGHT:'] ?? 0,
|
|
362
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_NONE:angle_DIAGONAL:'] ?? 0
|
|
363
|
+
},
|
|
364
|
+
slight: {
|
|
365
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_SLIGHT:angle_STRAIGHT:'] ?? 0,
|
|
366
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_SLIGHT:angle_DIAGONAL:'] ?? 0
|
|
367
|
+
},
|
|
368
|
+
staircase: {
|
|
369
|
+
straight: data?.practice?.records?.['bridging_distance_100:elevation_STAIRCASE:angle_STRAIGHT:'] ?? 0,
|
|
370
|
+
diagonal: data?.practice?.records?.['bridging_distance_100:elevation_STAIRCASE:angle_DIAGONAL:'] ?? 0
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
fireballJumping: {
|
|
377
|
+
blocksPlaced: data?.practice?.fireball_jumping?.blocks_placed ?? 0,
|
|
378
|
+
attempts: {
|
|
379
|
+
failed: data?.practice?.fireball_jumping?.failed_attempts ?? 0,
|
|
380
|
+
successful: data?.practice?.fireball_jumping?.successful_attempts ?? 0,
|
|
381
|
+
total: data?.practice?.fireball_jumping?.failed_attempts + data?.practice?.fireball_jumping?.successful_attempts
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
pearlClutching: {
|
|
385
|
+
attempts: {
|
|
386
|
+
failed: data?.practice?.pearl_clutching?.failed_attempts ?? 0,
|
|
387
|
+
successful: data?.practice?.pearl_clutching?.successful_attempts ?? 0,
|
|
388
|
+
total: data?.practice?.pearl_clutching?.failed_attempts + data?.practice?.pearl_clutching?.successful_attempts
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
mlg: {
|
|
392
|
+
blocksPlaced: data?.practice?.mlg?.blocks_placed ?? 0,
|
|
393
|
+
attempts: {
|
|
394
|
+
failed: data?.practice?.mlg?.failed_attempts ?? 0,
|
|
395
|
+
successful: data?.practice?.mlg?.successful_attempts ?? 0,
|
|
396
|
+
total: data?.practice?.mlg?.failed_attempts + data?.practice?.mlg?.successful_attempts
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
312
401
|
/**
|
|
313
402
|
* @typedef {string} BedWarsPrestige
|
|
314
403
|
* * `Stone`
|
|
@@ -376,15 +465,6 @@ function getLevelForExp(exp) {
|
|
|
376
465
|
* @property {number} diamond Diamond
|
|
377
466
|
* @property {number} emerald Emerald
|
|
378
467
|
*/
|
|
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
468
|
/**
|
|
389
469
|
* @typedef {object} BedWarsBeds
|
|
390
470
|
* @property {number} lost Beds lost
|
|
@@ -420,4 +500,52 @@ function getLevelForExp(exp) {
|
|
|
420
500
|
* @property {BedWarsModeStats} doubles Doubles
|
|
421
501
|
* @property {BedWarsModeStats} fours Fours
|
|
422
502
|
*/
|
|
503
|
+
/**
|
|
504
|
+
* @typedef {Object} BedWarsPracticeAttempts
|
|
505
|
+
* @property {number} failed Total failed attempts
|
|
506
|
+
* @property {number} successful Total successful attempts
|
|
507
|
+
* @property {number} total Total Number of attempts
|
|
508
|
+
*/
|
|
509
|
+
/**
|
|
510
|
+
* @typedef {Object} BedWarsPracticeElevation
|
|
511
|
+
* @property {number} straight straight
|
|
512
|
+
* @property {number} diagonal diagonal
|
|
513
|
+
*/
|
|
514
|
+
/**
|
|
515
|
+
* @typedef {Object} BedWarsPracticeElevations
|
|
516
|
+
* @property {BedWarsPracticeElevation} none none
|
|
517
|
+
* @property {BedWarsPracticeElevation} slight slight
|
|
518
|
+
* @property {BedWarsPracticeElevation} staircase staircase
|
|
519
|
+
*/
|
|
520
|
+
/**
|
|
521
|
+
* @typedef {Object} BedWarsPracticeRecord
|
|
522
|
+
* @property {BedWarsPracticeElevations} elevation Elevation
|
|
523
|
+
*/
|
|
524
|
+
/**
|
|
525
|
+
* @typedef {Object} BedWarsPracticeRecords
|
|
526
|
+
* @property {BedWarsPracticeRecord} 30Blocks 30 Blocks
|
|
527
|
+
* @property {BedWarsPracticeRecord} 50Blocks 50 Blocks
|
|
528
|
+
* @property {BedWarsPracticeRecord} 100Blocks 100 Blocks
|
|
529
|
+
*/
|
|
530
|
+
/**
|
|
531
|
+
* @typedef {Object} BedWarsPracticeBridging
|
|
532
|
+
* @property {number} blocksPlaced Blocks placed
|
|
533
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
534
|
+
*/
|
|
535
|
+
/**
|
|
536
|
+
* @typedef {Object} BedWarsPracticePearlClutching
|
|
537
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
538
|
+
*/
|
|
539
|
+
/**
|
|
540
|
+
* @typedef {Object} BedWarsPracticeMLG
|
|
541
|
+
* @property {number} blocksPlaced Blocks placed
|
|
542
|
+
* @property {BedWarsPracticeAttempts} attempts Attempts
|
|
543
|
+
*/
|
|
544
|
+
/**
|
|
545
|
+
* @typedef {Object} BedWarsPracticeStats
|
|
546
|
+
* @property {string} selected Selected Type of Practice
|
|
547
|
+
* @property {BedWarsPracticeBridging} bridging Bridging stats
|
|
548
|
+
* @property {BedWarsPracticePearlClutching} pearlClutching Pearl Clutching stats
|
|
549
|
+
* @property {BedWarsPracticeMLG} mlg MLG stats
|
|
550
|
+
*/
|
|
423
551
|
module.exports = BedWars;
|