hypixel-api-reborn 11.1.0 → 11.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +3 -3
- package/README.md +6 -4
- package/eslint.config.mjs +71 -0
- package/package.json +21 -25
- package/src/API/getAchievements.js +7 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +7 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +5 -4
- package/src/API/getGuildAchievements.js +7 -0
- package/src/API/getLeaderboards.js +4 -2
- package/src/API/getPlayer.js +2 -1
- package/src/API/getQuests.js +7 -0
- package/src/API/getRecentGames.js +6 -10
- package/src/API/getServerInfo.js +42 -37
- package/src/API/getStatus.js +2 -1
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/index.js +28 -17
- package/src/API/skyblock/getAuction.js +21 -0
- package/src/API/skyblock/{getSkyblockAuctions.js → getAuctions.js} +19 -12
- package/src/API/skyblock/{getSkyblockAuctionsByPlayer.js → getAuctionsByPlayer.js} +2 -2
- package/src/API/skyblock/{getSkyblockBazaar.js → getBazaar.js} +1 -3
- package/src/API/skyblock/getBingo.js +7 -0
- package/src/API/skyblock/getBingoByPlayer.js +14 -0
- package/src/API/skyblock/{getEndedSkyblockAuctions.js → getEndedAuctions.js} +1 -0
- package/src/API/skyblock/getFireSales.js +7 -0
- package/src/API/skyblock/getGovernment.js +7 -0
- package/src/API/skyblock/{getSkyblockMember.js → getMember.js} +10 -3
- package/src/API/skyblock/getMuseum.js +15 -0
- package/src/API/skyblock/{getSkyblockNews.js → getNews.js} +1 -0
- package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +14 -7
- package/src/Client.js +127 -25
- package/src/Errors.js +38 -17
- package/src/Private/rateLimit.js +17 -13
- package/src/Private/requests.js +27 -16
- package/src/Private/updater.js +11 -8
- package/src/Private/uuidCache.js +23 -30
- package/src/Private/validate.js +33 -22
- package/src/index.js +9 -0
- package/src/structures/APIIncident.js +4 -11
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +14 -13
- package/src/structures/Color.js +93 -48
- package/src/structures/Game.js +4 -2
- package/src/structures/Guild/Guild.js +35 -48
- package/src/structures/Guild/GuildMember.js +8 -8
- package/src/structures/Guild/GuildRank.js +2 -2
- package/src/structures/MiniGames/Arcade.js +242 -235
- package/src/structures/MiniGames/ArenaBrawl.js +11 -11
- package/src/structures/MiniGames/BedWars.js +262 -131
- package/src/structures/MiniGames/BlitzSurvivalGames.js +24 -23
- package/src/structures/MiniGames/CopsAndCrims.js +1 -0
- package/src/structures/MiniGames/Duels.js +92 -33
- package/src/structures/MiniGames/MegaWalls.js +3 -1
- package/src/structures/MiniGames/MurderMystery.js +2 -2
- package/src/structures/MiniGames/Pit.js +230 -2
- package/src/structures/MiniGames/PitInventoryItem.js +43 -0
- package/src/structures/MiniGames/SkyWars.js +211 -195
- package/src/structures/MiniGames/SmashHeroes.js +37 -35
- package/src/structures/MiniGames/SpeedUHC.js +17 -4
- package/src/structures/MiniGames/TNTGames.js +1 -1
- package/src/structures/MiniGames/UHC.js +33 -14
- package/src/structures/MiniGames/WoolWars.js +6 -5
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +26 -121
- package/src/structures/PlayerCosmetics.js +67 -12
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/Auctions/Auction.js +3 -1
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +3 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +2 -1
- package/src/structures/SkyBlock/Auctions/Bid.js +1 -0
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +1 -0
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +49 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +76 -32
- package/src/structures/SkyBlock/SkyblockMember.js +252 -289
- package/src/structures/SkyBlock/SkyblockMuseum.js +60 -0
- package/src/structures/SkyBlock/SkyblockMuseumItem.js +54 -0
- package/src/structures/SkyBlock/SkyblockPet.js +3 -3
- package/src/structures/SkyBlock/SkyblockProfile.js +37 -23
- package/src/structures/SkyBlock/Static/Bingo.js +101 -0
- package/src/structures/SkyBlock/Static/BingoData.js +45 -0
- package/src/structures/SkyBlock/Static/Candidate.js +40 -0
- package/src/structures/SkyBlock/Static/FireSale.js +55 -0
- package/src/structures/SkyBlock/Static/Government.js +74 -0
- package/src/structures/SkyBlock/Static/Perk.js +24 -0
- package/src/structures/Static/Achievement.js +87 -0
- package/src/structures/Static/AchievementTier.js +33 -0
- package/src/structures/Static/Achievements.js +30 -0
- package/src/structures/Static/Challenges.js +29 -0
- package/src/structures/Static/GameAchievements.js +36 -0
- package/src/structures/Static/GameChallenges.js +40 -0
- package/src/structures/Static/GameQuests.js +24 -0
- package/src/structures/Static/GuildAchievements.js +34 -0
- package/src/structures/Static/Quest.js +66 -0
- package/src/structures/Static/Quests.js +31 -0
- package/src/structures/Status.js +2 -2
- package/src/utils/Constants.js +384 -543
- package/src/utils/{guildExp.js → Guild.js} +46 -13
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +448 -186
- package/src/utils/arrayTools.js +1 -1
- package/src/utils/divide.js +1 -1
- package/src/utils/index.js +2 -1
- package/src/utils/isGuildID.js +1 -1
- package/src/utils/oscillation.js +4 -2
- package/src/utils/removeSnakeCase.js +19 -8
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +35 -4
- package/src/utils/toUuid.js +12 -7
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +1246 -446
- package/src/utils/toIGN.js +0 -20
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const {
|
|
2
|
+
getTrophyFishRank,
|
|
3
|
+
getMemberStats,
|
|
4
|
+
getLevelByXp,
|
|
5
|
+
decode,
|
|
6
|
+
getSkills,
|
|
7
|
+
getBestiaryLevel,
|
|
8
|
+
getSlayer,
|
|
9
|
+
getDungeons,
|
|
10
|
+
getJacobData,
|
|
11
|
+
getChocolateFactory,
|
|
12
|
+
getPetLevel
|
|
13
|
+
} = require('../../utils/SkyblockUtils');
|
|
4
14
|
const SkyblockInventoryItem = require('./SkyblockInventoryItem');
|
|
5
|
-
const SkyblockPet = require('./SkyblockPet');
|
|
6
|
-
const objectPath = require('object-path');
|
|
7
15
|
const Constants = require('../../utils/Constants');
|
|
16
|
+
const skyhelper = require('skyhelper-networth');
|
|
17
|
+
const SkyblockPet = require('./SkyblockPet');
|
|
18
|
+
const Player = require('../Player');
|
|
19
|
+
|
|
8
20
|
/**
|
|
9
21
|
* Skyblock member class
|
|
10
22
|
*/
|
|
@@ -19,61 +31,56 @@ class SkyblockMember {
|
|
|
19
31
|
*/
|
|
20
32
|
this.uuid = data.uuid;
|
|
21
33
|
/**
|
|
22
|
-
* Skyblock member's player profile
|
|
34
|
+
* Skyblock member's player profile
|
|
23
35
|
* If `fetchPlayer` option is `true`.
|
|
24
36
|
* @type {Player|null}
|
|
25
37
|
*/
|
|
26
38
|
this.player = data.m.player || null;
|
|
27
39
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @type {
|
|
40
|
+
* If `getMuseum` option is `true`.
|
|
41
|
+
* @type {object|null}
|
|
30
42
|
*/
|
|
31
|
-
this.
|
|
43
|
+
this.museum = data.museum ?? null;
|
|
32
44
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @type {
|
|
45
|
+
* Profile's gamemode
|
|
46
|
+
* @type {string|null}
|
|
35
47
|
*/
|
|
36
|
-
this.
|
|
48
|
+
this.gameMode = data.gameMode;
|
|
37
49
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @type {
|
|
50
|
+
* Profile is selected
|
|
51
|
+
* @type {boolean}
|
|
40
52
|
*/
|
|
41
|
-
this.
|
|
53
|
+
this.selected = data.selected;
|
|
42
54
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @type {
|
|
55
|
+
* Skyblock member's profile name
|
|
56
|
+
* @type {string}
|
|
45
57
|
*/
|
|
46
|
-
this.
|
|
58
|
+
this.profileName = data.profileName;
|
|
47
59
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @type {
|
|
60
|
+
* Skyblock member's profile id
|
|
61
|
+
* @type {string}
|
|
50
62
|
*/
|
|
51
|
-
this.
|
|
63
|
+
this.profileId = data.profileId;
|
|
52
64
|
/**
|
|
53
|
-
*
|
|
65
|
+
* Timestamp when player first joined SkyBlock
|
|
54
66
|
* @type {number}
|
|
55
67
|
*/
|
|
56
|
-
this.
|
|
68
|
+
this.firstJoinTimestamp = data.m.profile?.first_join;
|
|
57
69
|
/**
|
|
58
|
-
*
|
|
70
|
+
* Timestamp when player first joined SkyBlock as Date
|
|
59
71
|
* @type {Date}
|
|
60
72
|
*/
|
|
61
|
-
this.
|
|
73
|
+
this.firstJoinAt = new Date(data.m.profile?.first_join);
|
|
62
74
|
/**
|
|
63
|
-
*
|
|
75
|
+
* Experience
|
|
64
76
|
* @type {number}
|
|
65
77
|
*/
|
|
66
|
-
this.
|
|
67
|
-
/**
|
|
68
|
-
* Last death timestamp as Date
|
|
69
|
-
* @type {Date}
|
|
70
|
-
*/
|
|
71
|
-
this.lastDeathAt = new Date(skyblock_year_0 + data.m.last_death * 1000);
|
|
78
|
+
this.experience = data.m.leveling?.experience ?? 0;
|
|
72
79
|
/**
|
|
73
|
-
*
|
|
80
|
+
* Skyblock Level
|
|
74
81
|
* @type {number}
|
|
75
82
|
*/
|
|
76
|
-
this.
|
|
83
|
+
this.level = this.experience ? this.experience / 100 : 0;
|
|
77
84
|
/**
|
|
78
85
|
* Heart of the Mountain - MiningSkill
|
|
79
86
|
* @type {number}
|
|
@@ -89,42 +96,16 @@ class SkyblockMember {
|
|
|
89
96
|
* @type {number}
|
|
90
97
|
*/
|
|
91
98
|
this.highestMagicalPower = data.m.accessory_bag_storage?.highest_magical_power ?? 0;
|
|
92
|
-
/**
|
|
93
|
-
* Equipped armor
|
|
94
|
-
* @return {Promise<SkyblockMemberArmor>}
|
|
95
|
-
*/
|
|
96
|
-
this.getArmor = async () => {
|
|
97
|
-
const base64 = data.m.inv_armor;
|
|
98
|
-
const decoded = await decode(base64.data);
|
|
99
|
-
const armor = {
|
|
100
|
-
helmet: decoded[3].id ? new SkyblockInventoryItem(decoded[3]) : null,
|
|
101
|
-
chestplate: decoded[2].id ? new SkyblockInventoryItem(decoded[2]) : null,
|
|
102
|
-
leggings: decoded[1].id ? new SkyblockInventoryItem(decoded[1]) : null,
|
|
103
|
-
boots: decoded[0].id ? new SkyblockInventoryItem(decoded[0]) : null
|
|
104
|
-
};
|
|
105
|
-
return armor;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Wardrobe contents
|
|
109
|
-
* @return {Promise<SkyblockMemberItem[]>}
|
|
110
|
-
*/
|
|
111
|
-
this.getWardrobe = async () => {
|
|
112
|
-
const base64 = data.m?.wardrobe_contents?.data;
|
|
113
|
-
if (!base64) return [];
|
|
114
|
-
const decoded = await decode(base64);
|
|
115
|
-
const armor = decoded.filter((item) => Object.keys(item).length !== 0).map((item) => new SkyblockInventoryItem(item));
|
|
116
|
-
return armor;
|
|
117
|
-
};
|
|
118
99
|
/**
|
|
119
100
|
* Collected fairy souls
|
|
120
101
|
* @type {number}
|
|
121
102
|
*/
|
|
122
|
-
this.fairySouls = data.m
|
|
103
|
+
this.fairySouls = data.m?.fairy_soul?.total_collected ?? 0;
|
|
123
104
|
/**
|
|
124
105
|
* Amount of fairy soul exchanges
|
|
125
106
|
* @type {number}
|
|
126
107
|
*/
|
|
127
|
-
this.fairyExchanges = data.m
|
|
108
|
+
this.fairyExchanges = data.m?.fairy_soul?.fairy_exchanges ?? 0;
|
|
128
109
|
/**
|
|
129
110
|
* Skyblock member skills
|
|
130
111
|
* @type {SkyblockMemberSkills}
|
|
@@ -150,27 +131,79 @@ class SkyblockMember {
|
|
|
150
131
|
* @type {object}
|
|
151
132
|
*/
|
|
152
133
|
this.collections = data.m.collection ? data.m.collection : null;
|
|
134
|
+
/**
|
|
135
|
+
* Skyblock coins in purse
|
|
136
|
+
* @type {number}
|
|
137
|
+
*/
|
|
138
|
+
this.purse = data.m?.currencies?.coin_purse ?? 0;
|
|
139
|
+
/**
|
|
140
|
+
* Skyblock member stats
|
|
141
|
+
* @type {SkyblockMemberStats}
|
|
142
|
+
*/
|
|
143
|
+
this.stats = data.m.player_stats ? getMemberStats(data.m.player_stats) : null;
|
|
144
|
+
/**
|
|
145
|
+
* Skyblock pets
|
|
146
|
+
* @type {SkyblockPet[]}
|
|
147
|
+
*/
|
|
148
|
+
this.pets = data.m?.pets_data?.pets ? data.m.pets_data.pets.map((pet) => new SkyblockPet(pet)) : [];
|
|
149
|
+
/**
|
|
150
|
+
* Skyblock jacob data
|
|
151
|
+
* @type {jacobData}
|
|
152
|
+
*/
|
|
153
|
+
this.jacob = getJacobData(data.m);
|
|
154
|
+
/**
|
|
155
|
+
* Skyblock Chocolate Factory
|
|
156
|
+
* @type {chocolateFactoryData}
|
|
157
|
+
*/
|
|
158
|
+
this.chocolate = getChocolateFactory(data.m);
|
|
159
|
+
/**
|
|
160
|
+
* Equipped armor
|
|
161
|
+
* @return {Promise<SkyblockMemberArmor>}
|
|
162
|
+
*/
|
|
163
|
+
this.getArmor = async () => {
|
|
164
|
+
const base64 = data.m.inventory.inv_armor;
|
|
165
|
+
const decoded = await decode(base64.data);
|
|
166
|
+
const armor = {
|
|
167
|
+
helmet: decoded[3].id ? new SkyblockInventoryItem(decoded[3]) : null,
|
|
168
|
+
chestplate: decoded[2].id ? new SkyblockInventoryItem(decoded[2]) : null,
|
|
169
|
+
leggings: decoded[1].id ? new SkyblockInventoryItem(decoded[1]) : null,
|
|
170
|
+
boots: decoded[0].id ? new SkyblockInventoryItem(decoded[0]) : null
|
|
171
|
+
};
|
|
172
|
+
return armor;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Wardrobe contents
|
|
176
|
+
* @return {Promise<SkyblockInventoryItem[]>}
|
|
177
|
+
*/
|
|
178
|
+
this.getWardrobe = async () => {
|
|
179
|
+
const base64 = data.m?.inventory?.wardrobe_contents?.data;
|
|
180
|
+
if (!base64) return [];
|
|
181
|
+
const decoded = await decode(base64);
|
|
182
|
+
const armor = decoded
|
|
183
|
+
.filter((item) => 0 !== Object.keys(item).length)
|
|
184
|
+
.map((item) => new SkyblockInventoryItem(item));
|
|
185
|
+
return armor;
|
|
186
|
+
};
|
|
153
187
|
/**
|
|
154
188
|
* Skyblock member enderchest
|
|
155
189
|
* @return {Promise<SkyblockInventoryItem[]>}
|
|
156
190
|
*/
|
|
157
191
|
this.getEnderChest = async () => {
|
|
158
|
-
|
|
192
|
+
let chest = data.m.inventory.ender_chest_contents;
|
|
159
193
|
if (!chest) return [];
|
|
160
194
|
|
|
161
195
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
196
|
+
chest = await decode(chest.data);
|
|
164
197
|
const edited = [];
|
|
165
|
-
for (let i = 0; i <
|
|
166
|
-
if (!
|
|
198
|
+
for (let i = 0; i < chest.length; i++) {
|
|
199
|
+
if (!chest[i].id) {
|
|
167
200
|
continue;
|
|
168
201
|
}
|
|
169
|
-
edited.push(new SkyblockInventoryItem(
|
|
202
|
+
edited.push(new SkyblockInventoryItem(chest[i]));
|
|
170
203
|
}
|
|
171
204
|
return edited;
|
|
172
|
-
} catch
|
|
173
|
-
return
|
|
205
|
+
} catch {
|
|
206
|
+
return [];
|
|
174
207
|
}
|
|
175
208
|
};
|
|
176
209
|
/**
|
|
@@ -178,7 +211,7 @@ class SkyblockMember {
|
|
|
178
211
|
* @return {Promise<SkyblockInventoryItem[]>}
|
|
179
212
|
*/
|
|
180
213
|
this.getInventory = async () => {
|
|
181
|
-
let inventory = data.m.inv_contents;
|
|
214
|
+
let inventory = data.m.inventory.inv_contents;
|
|
182
215
|
if (!inventory) return [];
|
|
183
216
|
|
|
184
217
|
try {
|
|
@@ -191,45 +224,25 @@ class SkyblockMember {
|
|
|
191
224
|
edited.push(new SkyblockInventoryItem(inventory[i]));
|
|
192
225
|
}
|
|
193
226
|
return edited;
|
|
194
|
-
} catch
|
|
195
|
-
return
|
|
227
|
+
} catch {
|
|
228
|
+
return [];
|
|
196
229
|
}
|
|
197
230
|
};
|
|
198
|
-
/**
|
|
199
|
-
* Skyblock coins in purse
|
|
200
|
-
* @type {number}
|
|
201
|
-
*/
|
|
202
|
-
this.purse = data.m.coin_purse || 0;
|
|
203
|
-
/**
|
|
204
|
-
* Skyblock member stats
|
|
205
|
-
* @type {SkyblockMemberStats}
|
|
206
|
-
*/
|
|
207
|
-
this.stats = data.m.stats ? getMemberStats(data.m.stats) : null;
|
|
208
|
-
/**
|
|
209
|
-
* Skyblock pets
|
|
210
|
-
* @type {SkyblockPet[]}
|
|
211
|
-
*/
|
|
212
|
-
this.pets = data.m.pets ? data.m.pets.map((pet) => new SkyblockPet(pet)) : [];
|
|
213
|
-
/**
|
|
214
|
-
* Skyblock jacob data
|
|
215
|
-
* @type {jacobData}
|
|
216
|
-
*/
|
|
217
|
-
this.jacob = getJacobData(data);
|
|
218
231
|
/**
|
|
219
232
|
* Skyblock Member pet score
|
|
220
233
|
* @return {number}
|
|
221
234
|
*/
|
|
222
235
|
this.getPetScore = () => {
|
|
223
236
|
const highestRarity = {};
|
|
224
|
-
for (const pet of data.m.pets) {
|
|
225
|
-
if (!(pet.type in highestRarity) || Constants.
|
|
226
|
-
highestRarity[pet.type] = Constants.
|
|
237
|
+
for (const pet of data.m.pets_data.pets) {
|
|
238
|
+
if (!(pet.type in highestRarity) || Constants.petScore[pet.tier] > highestRarity[pet.type]) {
|
|
239
|
+
highestRarity[pet.type] = Constants.petScore[pet.tier];
|
|
227
240
|
}
|
|
228
241
|
}
|
|
229
242
|
|
|
230
243
|
const highestLevel = {};
|
|
231
|
-
for (const pet of data.m.pets) {
|
|
232
|
-
const maxLevel = pet.type
|
|
244
|
+
for (const pet of data.m.pets_data.pets) {
|
|
245
|
+
const maxLevel = 'GOLDEN_DRAGON' === pet.type ? 200 : 100;
|
|
233
246
|
const petLevel = getPetLevel(pet.exp, pet.tier, maxLevel);
|
|
234
247
|
|
|
235
248
|
if (!(pet.type in highestLevel) || petLevel.level > highestLevel[pet.type]) {
|
|
@@ -241,7 +254,69 @@ class SkyblockMember {
|
|
|
241
254
|
}
|
|
242
255
|
}
|
|
243
256
|
|
|
244
|
-
return
|
|
257
|
+
return (
|
|
258
|
+
Object.values(highestRarity).reduce((a, b) => a + b, 0) + Object.values(highestLevel).reduce((a, b) => a + b, 0)
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Skyblock member equipment
|
|
263
|
+
* @return {Promise<SkyblockMemberEquipment>}
|
|
264
|
+
*/
|
|
265
|
+
this.getEquipment = async () => {
|
|
266
|
+
let equipment = data.m.inventory.equipment_contents;
|
|
267
|
+
if (!equipment) return [];
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
equipment = await decode(equipment.data);
|
|
271
|
+
const playerEquipment = {
|
|
272
|
+
gauntlet: equipment[3].id ? new SkyblockInventoryItem(equipment[3]) : null,
|
|
273
|
+
belt: equipment[2].id ? new SkyblockInventoryItem(equipment[2]) : null,
|
|
274
|
+
cloak: equipment[1].id ? new SkyblockInventoryItem(equipment[1]) : null,
|
|
275
|
+
necklace: equipment[0].id ? new SkyblockInventoryItem(equipment[0]) : null
|
|
276
|
+
};
|
|
277
|
+
return playerEquipment;
|
|
278
|
+
} catch {
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Skyblock member Personal Vault
|
|
284
|
+
* @return {Promise<SkyblockInventoryItem[]>}
|
|
285
|
+
*/
|
|
286
|
+
this.getPersonalVault = async () => {
|
|
287
|
+
let vault = data.m.inventory.personal_vault_contents;
|
|
288
|
+
if (!vault) return [];
|
|
289
|
+
|
|
290
|
+
try {
|
|
291
|
+
vault = await decode(vault.data);
|
|
292
|
+
const edited = [];
|
|
293
|
+
for (let i = 0; i < vault.length; i++) {
|
|
294
|
+
if (!vault[i].id) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
edited.push(new SkyblockInventoryItem(vault[i]));
|
|
298
|
+
}
|
|
299
|
+
return edited;
|
|
300
|
+
} catch {
|
|
301
|
+
return [];
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* Skyblock member networth (Credit to skyhelper-networth package)
|
|
306
|
+
* @return {Promise<skyhelper.NetworthResult>}
|
|
307
|
+
*/
|
|
308
|
+
this.getNetworth = async () => {
|
|
309
|
+
try {
|
|
310
|
+
const nw = await skyhelper.getNetworth(data.m, data.banking.balance ?? 0, {
|
|
311
|
+
onlyNetworth: true,
|
|
312
|
+
v2Endpoint: true,
|
|
313
|
+
cache: true,
|
|
314
|
+
museumData: data.museum?.raw ?? {}
|
|
315
|
+
});
|
|
316
|
+
return nw;
|
|
317
|
+
} catch {
|
|
318
|
+
return [];
|
|
319
|
+
}
|
|
245
320
|
};
|
|
246
321
|
}
|
|
247
322
|
/**
|
|
@@ -252,182 +327,15 @@ class SkyblockMember {
|
|
|
252
327
|
return this.uuid;
|
|
253
328
|
}
|
|
254
329
|
}
|
|
255
|
-
// eslint-disable-next-line require-jsdoc
|
|
256
|
-
function getSkills(data) {
|
|
257
|
-
const skillsObject = {};
|
|
258
|
-
if (!objectPath.has(data, 'experience_skill_foraging')) {
|
|
259
|
-
if (data.player) {
|
|
260
|
-
for (const [skill, achievement] of Object.entries(skills_achievements)) {
|
|
261
|
-
skillsObject[skill] = getLevelByAchievement(data.player.achievements[achievement], skill);
|
|
262
|
-
}
|
|
263
|
-
skillsObject.usedAchievementApi = true;
|
|
264
|
-
return skillsObject;
|
|
265
|
-
}
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
for (const skill of skills) {
|
|
269
|
-
skillsObject[skill] = getLevelByXp(data[`experience_skill_${skill}`], skill, skill === 'farming' ? (data.jacob2 && data.jacob2.perks && data.jacob2.perks.farming_level_cap) || 0 : null);
|
|
270
|
-
}
|
|
271
|
-
if (data.player) skillsObject.usedAchievementApi = false;
|
|
272
|
-
return skillsObject;
|
|
273
|
-
}
|
|
274
|
-
// eslint-disable-next-line require-jsdoc
|
|
275
|
-
function formatBestiaryMobs(userProfile, mobs) {
|
|
276
|
-
const output = [];
|
|
277
|
-
for (const mob of mobs) {
|
|
278
|
-
const mobBracket = Constants.bestiaryBrackets[mob.bracket];
|
|
279
|
-
|
|
280
|
-
const totalKills = mob.mobs.reduce((acc, cur) => {
|
|
281
|
-
return acc + (userProfile.bestiary.kills[cur] ?? 0);
|
|
282
|
-
}, 0);
|
|
283
|
-
|
|
284
|
-
const maxKills = mob.cap;
|
|
285
|
-
const nextTierKills = mobBracket.find((tier) => totalKills < tier && tier <= maxKills);
|
|
286
|
-
const tier = nextTierKills ? mobBracket.indexOf(nextTierKills) : mobBracket.indexOf(maxKills) + 1;
|
|
287
|
-
|
|
288
|
-
output.push({
|
|
289
|
-
tier: tier
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return output;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// eslint-disable-next-line require-jsdoc
|
|
297
|
-
function getBestiaryLevel(userProfile) {
|
|
298
|
-
try {
|
|
299
|
-
if (userProfile.bestiary?.kills === undefined) {
|
|
300
|
-
return null;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
const output = {};
|
|
304
|
-
let tiersUnlocked = 0;
|
|
305
|
-
for (const [category, data] of Object.entries(Constants.bestiary)) {
|
|
306
|
-
const { mobs } = data;
|
|
307
|
-
output[category] = {};
|
|
308
|
-
|
|
309
|
-
if (category === 'fishing') {
|
|
310
|
-
for (const [key, value] of Object.entries(data)) {
|
|
311
|
-
output[category][key] = {
|
|
312
|
-
mobs: formatBestiaryMobs(userProfile, value.mobs)
|
|
313
|
-
};
|
|
314
|
-
tiersUnlocked += output[category][key].mobs.reduce((acc, cur) => acc + cur.tier, 0);
|
|
315
|
-
}
|
|
316
|
-
} else {
|
|
317
|
-
output[category].mobs = formatBestiaryMobs(userProfile, mobs);
|
|
318
|
-
tiersUnlocked += output[category].mobs.reduce((acc, cur) => acc + cur.tier, 0);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return tiersUnlocked / 10;
|
|
323
|
-
} catch (error) {
|
|
324
|
-
// eslint-disable-next-line no-console
|
|
325
|
-
console.log(error);
|
|
326
|
-
return null;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// eslint-disable-next-line require-jsdoc
|
|
331
|
-
function getSlayer(data) {
|
|
332
|
-
if (!objectPath.has(data, 'slayer_bosses')) {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
zombie: getSlayerLevel(data.slayer_bosses.zombie),
|
|
337
|
-
spider: getSlayerLevel(data.slayer_bosses.spider),
|
|
338
|
-
wolf: getSlayerLevel(data.slayer_bosses.wolf),
|
|
339
|
-
enderman: getSlayerLevel(data.slayer_bosses.enderman),
|
|
340
|
-
blaze: getSlayerLevel(data.slayer_bosses.blaze),
|
|
341
|
-
vampire: getSlayerLevel(data.slayer_bosses.vampire)
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
// eslint-disable-next-line require-jsdoc
|
|
345
|
-
function getDungeons(data) {
|
|
346
|
-
if (!objectPath.has(data, 'dungeons')) {
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
return {
|
|
350
|
-
types: {
|
|
351
|
-
catacombs: getLevelByXp(data.dungeons.dungeon_types.catacombs ? data.dungeons.dungeon_types.catacombs.experience : null, 'dungeons')
|
|
352
|
-
},
|
|
353
|
-
classes: {
|
|
354
|
-
healer: getLevelByXp(data.dungeons.player_classes.healer ? data.dungeons.player_classes.healer.experience : null, 'dungeons'),
|
|
355
|
-
mage: getLevelByXp(data.dungeons.player_classes.mage ? data.dungeons.player_classes.mage.experience : null, 'dungeons'),
|
|
356
|
-
berserk: getLevelByXp(data.dungeons.player_classes.berserk ? data.dungeons.player_classes.berserk.experience : null, 'dungeons'),
|
|
357
|
-
archer: getLevelByXp(data.dungeons.player_classes.archer ? data.dungeons.player_classes.archer.experience : null, 'dungeons'),
|
|
358
|
-
tank: getLevelByXp(data.dungeons.player_classes.tank ? data.dungeons.player_classes.tank.experience : null, 'dungeons')
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
// eslint-disable-next-line require-jsdoc
|
|
363
|
-
function getJacobData(data) {
|
|
364
|
-
if (!data.m.jacob2) {
|
|
365
|
-
return {
|
|
366
|
-
medals: {
|
|
367
|
-
bronze: 0,
|
|
368
|
-
silver: 0,
|
|
369
|
-
gold: 0
|
|
370
|
-
},
|
|
371
|
-
perks: {
|
|
372
|
-
doubleDrops: 0,
|
|
373
|
-
farmingLevelCap: 0
|
|
374
|
-
},
|
|
375
|
-
contests: {}
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
return {
|
|
379
|
-
medals: data.m.jacob2.medals_inv
|
|
380
|
-
? { bronze: data.m.jacob2.medals_inv.bronze || 0, silver: data.m.jacob2.medals_inv.silver || 0, gold: data.m.jacob2.medals_inv.gold || 0 }
|
|
381
|
-
: { bronze: 0, silver: 0, gold: 0 },
|
|
382
|
-
perks: data.m.jacob2.perks ? { doubleDrops: data.m.jacob2.perks.doubleDrops || 0, farmingLevelCap: data.m.jacob2.perks.farmingLevelCap || 0 } : { doubleDrops: 0, farmingLevelCap: 0 },
|
|
383
|
-
contests: data.m.jacob2.contests || {}
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
// eslint-disable-next-line require-jsdoc
|
|
387
|
-
function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
388
|
-
const rarityOffset = Constants.pet_rarity_offset[offsetRarity];
|
|
389
|
-
const levels = Constants.pet_levels.slice(rarityOffset, rarityOffset + maxLevel - 1);
|
|
390
|
-
|
|
391
|
-
const xpMaxLevel = levels.reduce((a, b) => a + b, 0);
|
|
392
|
-
let xpTotal = 0;
|
|
393
|
-
let level = 1;
|
|
394
|
-
|
|
395
|
-
let xpForNext = Infinity;
|
|
396
|
-
|
|
397
|
-
for (let i = 0; i < maxLevel; i++) {
|
|
398
|
-
xpTotal += levels[i];
|
|
399
|
-
|
|
400
|
-
if (xpTotal > petExp) {
|
|
401
|
-
xpTotal -= levels[i];
|
|
402
|
-
break;
|
|
403
|
-
} else {
|
|
404
|
-
level++;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
let xpCurrent = Math.floor(petExp - xpTotal);
|
|
409
|
-
let progress;
|
|
410
|
-
|
|
411
|
-
if (level < maxLevel) {
|
|
412
|
-
xpForNext = Math.ceil(levels[level - 1]);
|
|
413
|
-
progress = Math.max(0, Math.min(xpCurrent / xpForNext, 1));
|
|
414
|
-
} else {
|
|
415
|
-
level = maxLevel;
|
|
416
|
-
xpCurrent = petExp - levels[maxLevel - 1];
|
|
417
|
-
xpForNext = 0;
|
|
418
|
-
progress = 1;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
return {
|
|
422
|
-
level,
|
|
423
|
-
xpCurrent,
|
|
424
|
-
xpForNext,
|
|
425
|
-
progress,
|
|
426
|
-
xpMaxLevel
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
330
|
/**
|
|
430
|
-
* @typedef {object}
|
|
331
|
+
* @typedef {object} SkyblockMemberEquipment
|
|
332
|
+
* @property {SkyblockInventoryItem|null} gauntlet Gauntlet
|
|
333
|
+
* @property {SkyblockInventoryItem|null} belt Belt
|
|
334
|
+
* @property {SkyblockInventoryItem|null} cloak Cloak
|
|
335
|
+
* @property {SkyblockInventoryItem|null} necklace Necklace
|
|
336
|
+
*/
|
|
337
|
+
/**
|
|
338
|
+
* @typedef {object} SkyblockMemberArmor
|
|
431
339
|
* @property {SkyblockInventoryItem|null} helmet Helmet
|
|
432
340
|
* @property {SkyblockInventoryItem|null} chestplate Chestplate
|
|
433
341
|
* @property {SkyblockInventoryItem|null} leggings Leggings
|
|
@@ -435,16 +343,18 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
435
343
|
*/
|
|
436
344
|
/**
|
|
437
345
|
* @typedef {object} SkyblockMemberSkills
|
|
346
|
+
* @property {SkyblockSkillLevel} combat Combat skill
|
|
438
347
|
* @property {SkyblockSkillLevel} farming Farming skill
|
|
348
|
+
* @property {SkyblockSkillLevel} fishing Fishing skill
|
|
439
349
|
* @property {SkyblockSkillLevel} mining Mining skill
|
|
440
|
-
* @property {SkyblockSkillLevel} combat Combat skill
|
|
441
350
|
* @property {SkyblockSkillLevel} foraging Foraging skills
|
|
442
|
-
* @property {SkyblockSkillLevel} fishing Fishing skill
|
|
443
351
|
* @property {SkyblockSkillLevel} enchanting Enchanting skill
|
|
444
352
|
* @property {SkyblockSkillLevel} alchemy Alchemy skill
|
|
445
|
-
* @property {SkyblockSkillLevel} taming Taming skill
|
|
446
353
|
* @property {SkyblockSkillLevel} carpentry Carpentry skill
|
|
447
354
|
* @property {SkyblockSkillLevel} runecrafting Runecrafting skill
|
|
355
|
+
* @property {SkyblockSkillLevel} taming Taming skill
|
|
356
|
+
* @property {SkyblockSkillLevel} social Social skill
|
|
357
|
+
* @property {number} average Average skill level
|
|
448
358
|
*/
|
|
449
359
|
/**
|
|
450
360
|
* @typedef {object} SkyblockSkillLevel
|
|
@@ -457,12 +367,15 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
457
367
|
* @property {number} xpCurrent Current XP
|
|
458
368
|
* @property {number} xpForNext XP for next level
|
|
459
369
|
* @property {number} progress Progress
|
|
370
|
+
* @property {boolean} cosmetic Cosmetic
|
|
460
371
|
*/
|
|
461
372
|
/**
|
|
462
373
|
* @typedef {object} SkyblockMemberSlayer
|
|
463
|
-
* @property {SkyblockMemberSlayerLevel} zombie
|
|
464
|
-
* @property {SkyblockMemberSlayerLevel} spider
|
|
465
|
-
* @property {SkyblockMemberSlayerLevel} wolf
|
|
374
|
+
* @property {SkyblockMemberSlayerLevel} zombie Zombie
|
|
375
|
+
* @property {SkyblockMemberSlayerLevel} spider Spider
|
|
376
|
+
* @property {SkyblockMemberSlayerLevel} wolf Wolf
|
|
377
|
+
* @property {SkyblockMemberSlayerLevel} blaze Blaze
|
|
378
|
+
* @property {SkyblockMemberSlayerLevel} vampire Vampire
|
|
466
379
|
*/
|
|
467
380
|
/**
|
|
468
381
|
* @typedef {object} SkyblockMemberSlayerLevel
|
|
@@ -471,12 +384,13 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
471
384
|
* @property {number} tier2 Tier 2
|
|
472
385
|
* @property {number} tier3 Tier 3
|
|
473
386
|
* @property {number} tier4 Tier 4
|
|
387
|
+
* @property {number} tier5 Tier 5
|
|
474
388
|
* @property {number} level Level
|
|
475
389
|
*/
|
|
476
390
|
/**
|
|
477
391
|
* @typedef {object} SkyblockMemberDungeons
|
|
478
|
-
* @property {
|
|
479
|
-
* @property {
|
|
392
|
+
* @property {SkyblockMemberDungeonsTypes} types Dungeons types
|
|
393
|
+
* @property {SkyblockMemberDungeonsClasses} classes Dungeons classes
|
|
480
394
|
*/
|
|
481
395
|
/**
|
|
482
396
|
* @typedef {object} SkyblockMemberDungeonsTypes
|
|
@@ -806,15 +720,64 @@ function getPetLevel(petExp, offsetRarity, maxLevel) {
|
|
|
806
720
|
* @property {number|undefined} petMilestoneOresMined
|
|
807
721
|
* @property {number|undefined} petMilestoneSeaCreaturesKilled
|
|
808
722
|
*/
|
|
723
|
+
/**
|
|
724
|
+
* @typedef {object} jacobDataPerks
|
|
725
|
+
* @property {number} doubleDrops Double drops
|
|
726
|
+
* @property {number} farmingLevelCap Farming level cap
|
|
727
|
+
* @property {boolean} personalBests Personal Bests
|
|
728
|
+
*/
|
|
729
|
+
/**
|
|
730
|
+
* @typedef {object} jacobDataMedals
|
|
731
|
+
* @property {number} gold gold medals
|
|
732
|
+
* @property {number} silver silver medals
|
|
733
|
+
* @property {number} bronze bronze medals
|
|
734
|
+
*/
|
|
809
735
|
/**
|
|
810
736
|
* @typedef {object} jacobData
|
|
811
|
-
* @property {
|
|
812
|
-
* @property {
|
|
813
|
-
* @property {number} medals.silver Silver medals
|
|
814
|
-
* @property {number} medals.gold Gold medals
|
|
815
|
-
* @property {object} perks Perks
|
|
816
|
-
* @property {number} perks.doubleDrops Double drops
|
|
817
|
-
* @property {number} perks.farmingLevelCap Farming level cap
|
|
737
|
+
* @property {jacobDataMedals} medals Medals
|
|
738
|
+
* @property {jacobDataPerks} perks Perks
|
|
818
739
|
* @property {object} contests Contests
|
|
819
740
|
*/
|
|
741
|
+
/**
|
|
742
|
+
* @typedef {object} chocolateFactoryDataEmployees
|
|
743
|
+
* @property {number} bro bro employee level
|
|
744
|
+
* @property {number} cousin cousin employee level
|
|
745
|
+
* @property {number} sis sis employee level
|
|
746
|
+
* @property {number} father father employee level
|
|
747
|
+
* @property {number} grandma grandma employee level
|
|
748
|
+
* @property {number} dog dog employee level
|
|
749
|
+
* @property {number} uncle uncle employee level
|
|
750
|
+
*/
|
|
751
|
+
/**
|
|
752
|
+
* @typedef {object} chocolateFactoryDataChocolate
|
|
753
|
+
* @property {number} count amount of current chocolate
|
|
754
|
+
* @property {number} total total amount of chocolate
|
|
755
|
+
* @property {number} sincePrestige amount of chocolate since prestige
|
|
756
|
+
*/
|
|
757
|
+
/**
|
|
758
|
+
* @typedef {object} chocolateFactoryDataTimeTower
|
|
759
|
+
* @property {number} charge amount of charges in the time tower
|
|
760
|
+
* @property {number} level level of the time tower
|
|
761
|
+
*/
|
|
762
|
+
/**
|
|
763
|
+
* @typedef {object} chocolateFactoryDataUpgrades
|
|
764
|
+
* @property {number} click amount of click upgrades
|
|
765
|
+
* @property {number} multiplier amount of multiplier upgrades
|
|
766
|
+
* @property {number} rabbitRarity amount of rabbit rarity upgrades
|
|
767
|
+
*/
|
|
768
|
+
/**
|
|
769
|
+
* @typedef {object} chocolateFactoryDataGoldenClick
|
|
770
|
+
* @property {number} amount amount of golden clicks
|
|
771
|
+
* @property {number} year year
|
|
772
|
+
*/
|
|
773
|
+
/**
|
|
774
|
+
* @typedef {object} chocolateFactoryData
|
|
775
|
+
* @property {chocolateFactoryDataEmployees} employees Employees
|
|
776
|
+
* @property {chocolateFactoryDataChocolate} chocolate Chocolate
|
|
777
|
+
* @property {chocolateFactoryDataTimeTower} timeTower Time Tower
|
|
778
|
+
* @property {chocolateFactoryDataUpgrades} upgrades Upgrades
|
|
779
|
+
* @property {chocolateFactoryDataGoldenClick} goldenClick Golden Click
|
|
780
|
+
* @property {number} barnCapacity Barn Capacity
|
|
781
|
+
* @property {number} prestige Prestige
|
|
782
|
+
*/
|
|
820
783
|
module.exports = SkyblockMember;
|