hypixel-api-reborn 9.0.3 → 10.0.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/package.json +1 -1
- package/src/API/getAPIStatus.js +2 -1
- package/src/API/getBoosters.js +1 -0
- package/src/API/getFriends.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +1 -0
- package/src/API/getKeyInfo.js +1 -0
- package/src/API/getLeaderboards.js +1 -0
- package/src/API/getPlayer.js +2 -1
- package/src/API/getRankedSkyWars.js +1 -0
- package/src/API/getRecentGames.js +1 -0
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/index.js +23 -9
- package/src/API/skyblock/getEndedSkyblockAuctions.js +1 -0
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +1 -0
- package/src/API/skyblock/getSkyblockBazaar.js +1 -0
- package/src/API/skyblock/getSkyblockMember.js +1 -0
- package/src/API/skyblock/getSkyblockNews.js +1 -0
- package/src/API/skyblock/getSkyblockProfiles.js +1 -0
- package/src/Client.js +34 -14
- package/src/Errors.js +2 -1
- package/src/Private/defaultCache.js +78 -0
- package/src/Private/requests.js +24 -9
- package/src/Private/updater.js +4 -1
- package/src/Private/validate.js +3 -3
- package/src/structures/MiniGames/BedWars.js +22 -0
- package/src/structures/MiniGames/Duels.js +216 -46
- package/src/structures/MiniGames/TurboKartRacers.js +105 -0
- package/src/structures/Player.js +4 -8
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +4 -4
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +29 -1
- package/src/structures/SkyBlock/SkyblockMember.js +25 -13
- package/src/utils/Constants.js +14 -0
- package/src/utils/index.js +13 -9
- package/src/utils/rgbToHexColor.js +8 -0
- package/src/utils/romanize.js +13 -0
- package/typings/index.d.ts +375 -356
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const rgbToHexColor = require('../../utils/rgbToHexColor');
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Item class
|
|
3
5
|
*/
|
|
@@ -36,11 +38,30 @@ class SkyblockInventoryItem {
|
|
|
36
38
|
* @type {string}
|
|
37
39
|
*/
|
|
38
40
|
this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
|
|
41
|
+
/**
|
|
42
|
+
* Hexadecimal color code of armor
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
this.color = data.tag.ExtraAttributes.color ? rgbToHexColor(data.tag.ExtraAttributes.color.split(':')) : null;
|
|
39
46
|
/**
|
|
40
47
|
* Item enchantments
|
|
41
48
|
* @type {object}
|
|
42
49
|
*/
|
|
43
50
|
this.enchantments = data.tag.ExtraAttributes.enchantments ? data.tag.ExtraAttributes.enchantments : null;
|
|
51
|
+
/**
|
|
52
|
+
* Armor reforge
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
this.reforge = data.tag.ExtraAttributes.modifier ? data.tag.ExtraAttributes.modifier : null;
|
|
56
|
+
/**
|
|
57
|
+
* Equipment gemstones (if any)
|
|
58
|
+
* @type {SkyblockItemGemstone}
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line no-new-object
|
|
61
|
+
this.gemstones = data.tag.ExtraAttributes.gems ? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => new Object({
|
|
62
|
+
type: gem[0].split('_')[0],
|
|
63
|
+
quality: gem[1]
|
|
64
|
+
})) : null;
|
|
44
65
|
/**
|
|
45
66
|
* Anvil uses
|
|
46
67
|
* @type {number}
|
|
@@ -85,7 +106,7 @@ class SkyblockInventoryItem {
|
|
|
85
106
|
* @return {string}
|
|
86
107
|
*/
|
|
87
108
|
function parseRarity (stringContainingRarity) {
|
|
88
|
-
const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', '
|
|
109
|
+
const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', 'DIVINE', 'SPECIAL', 'VERY SPECIAL'];
|
|
89
110
|
for (const rarity of rarityArray) {
|
|
90
111
|
if (stringContainingRarity.includes(rarity)) return rarity;
|
|
91
112
|
}
|
|
@@ -99,4 +120,11 @@ function parseGearScore (lore) {
|
|
|
99
120
|
if (line.match(/Gear Score: §[0-9a-f](\d+)/)) return Number(line.match(/Gear Score: §d(\d+)/)[1]);
|
|
100
121
|
}
|
|
101
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @typedef {object} SkyblockItemGemstone
|
|
126
|
+
* @property {string} type Gemstone type
|
|
127
|
+
* @property {string} quality Gemstone quality (rough, flawed, fine, flawless, perfect)
|
|
128
|
+
*/
|
|
129
|
+
|
|
102
130
|
module.exports = SkyblockInventoryItem;
|
|
@@ -12,7 +12,7 @@ class SkyblockMember {
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {object} data Skyblock member data
|
|
14
14
|
*/
|
|
15
|
-
constructor
|
|
15
|
+
constructor(data) {
|
|
16
16
|
/**
|
|
17
17
|
* Skyblock member UUID
|
|
18
18
|
* @type {string}
|
|
@@ -53,22 +53,22 @@ class SkyblockMember {
|
|
|
53
53
|
* Last save timestamp
|
|
54
54
|
* @type {number}
|
|
55
55
|
*/
|
|
56
|
-
this.
|
|
56
|
+
this.lastSaveTimestamp = data.m.last_save;
|
|
57
57
|
/**
|
|
58
58
|
* Last save timestamp as Date
|
|
59
59
|
* @type {Date}
|
|
60
60
|
*/
|
|
61
61
|
this.lastSaveAt = new Date(data.m.last_save);
|
|
62
|
+
/**
|
|
63
|
+
* Last save timestamp
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
this.lastDeathTimestamp = data.m.last_death;
|
|
62
67
|
/**
|
|
63
68
|
* Last death timestamp as Date
|
|
64
69
|
* @type {Date}
|
|
65
70
|
*/
|
|
66
71
|
this.lastDeathAt = new Date(skyblock_year_0 + data.m.last_death * 1000);
|
|
67
|
-
/**
|
|
68
|
-
* Last save timestamp
|
|
69
|
-
* @type {number}
|
|
70
|
-
*/
|
|
71
|
-
this.lastDeath = data.m.last_death;
|
|
72
72
|
/**
|
|
73
73
|
* Equipped armor
|
|
74
74
|
* @return {Promise<SkyblockMemberArmor>}
|
|
@@ -84,6 +84,18 @@ class SkyblockMember {
|
|
|
84
84
|
};
|
|
85
85
|
return armor;
|
|
86
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Wardrobe contents
|
|
89
|
+
* @return {Promise<SkyblockMemberItem[]>}
|
|
90
|
+
*/
|
|
91
|
+
this.getWardrobe = async () => {
|
|
92
|
+
const base64 = data.m?.wardrobe_contents?.data;
|
|
93
|
+
if (!base64) return [];
|
|
94
|
+
const decoded = await decode(base64);
|
|
95
|
+
const armor = decoded.filter((item) => Object.keys(item).length !== 0)
|
|
96
|
+
.map((item) => new SkyblockInventoryItem(item));
|
|
97
|
+
return armor;
|
|
98
|
+
};
|
|
87
99
|
/**
|
|
88
100
|
* Collected fairy souls
|
|
89
101
|
* @type {number}
|
|
@@ -184,14 +196,14 @@ class SkyblockMember {
|
|
|
184
196
|
* Skyblock Member pet score
|
|
185
197
|
* @return {number}
|
|
186
198
|
*/
|
|
187
|
-
getPetScore
|
|
199
|
+
getPetScore() {
|
|
188
200
|
return this.pets.reduce((acc, cur) => acc + (cur.petScore || 0), 0);
|
|
189
201
|
}
|
|
190
202
|
/**
|
|
191
203
|
* UUID
|
|
192
204
|
* @return {string}
|
|
193
205
|
*/
|
|
194
|
-
toString
|
|
206
|
+
toString() {
|
|
195
207
|
return this.uuid;
|
|
196
208
|
}
|
|
197
209
|
}
|
|
@@ -199,7 +211,7 @@ class SkyblockMember {
|
|
|
199
211
|
* @param {object} data
|
|
200
212
|
* @return {object}
|
|
201
213
|
*/
|
|
202
|
-
function getSkills
|
|
214
|
+
function getSkills(data) {
|
|
203
215
|
const skillsObject = {};
|
|
204
216
|
if (!objectPath.has(data, 'experience_skill_foraging')) {
|
|
205
217
|
if (data.player) {
|
|
@@ -221,7 +233,7 @@ function getSkills (data) {
|
|
|
221
233
|
* @param {object} data
|
|
222
234
|
* @return {object}
|
|
223
235
|
*/
|
|
224
|
-
function getSlayer
|
|
236
|
+
function getSlayer(data) {
|
|
225
237
|
if (!objectPath.has(data, 'slayer_bosses')) {
|
|
226
238
|
return null;
|
|
227
239
|
}
|
|
@@ -235,7 +247,7 @@ function getSlayer (data) {
|
|
|
235
247
|
* @param {object} data
|
|
236
248
|
* @return {object}
|
|
237
249
|
*/
|
|
238
|
-
function getDungeons
|
|
250
|
+
function getDungeons(data) {
|
|
239
251
|
if (!objectPath.has(data, 'dungeons')) {
|
|
240
252
|
return null;
|
|
241
253
|
}
|
|
@@ -256,7 +268,7 @@ function getDungeons (data) {
|
|
|
256
268
|
* @param {object} data
|
|
257
269
|
* @return {jacobData}
|
|
258
270
|
*/
|
|
259
|
-
function getJacobData
|
|
271
|
+
function getJacobData(data) {
|
|
260
272
|
if (!data.m.jacob2) {
|
|
261
273
|
return {
|
|
262
274
|
medals: {
|
package/src/utils/Constants.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
skyblock_year_0: 1.5602757e+12,
|
|
3
3
|
|
|
4
|
+
duels_divisions: [
|
|
5
|
+
{ name: 'Rookie', key: 'rookie' },
|
|
6
|
+
{ name: 'Iron', key: 'iron' },
|
|
7
|
+
{ name: 'Gold', key: 'gold' },
|
|
8
|
+
{ name: 'Diamond', key: 'diamond' },
|
|
9
|
+
{ name: 'Master', key: 'master' },
|
|
10
|
+
{ name: 'Legend', key: 'legend' },
|
|
11
|
+
{ name: 'Grandmaster', key: 'grandmaster' },
|
|
12
|
+
{ name: 'Godlike', key: 'godlike' },
|
|
13
|
+
{ name: 'WORLD ELITE', key: 'world_elite' },
|
|
14
|
+
{ name: 'WORLD MASTER', key: 'world_master' },
|
|
15
|
+
{ name: 'WORLD\'S BEST', key: 'worlds_best' }
|
|
16
|
+
],
|
|
17
|
+
|
|
4
18
|
leveling_xp: {
|
|
5
19
|
1: 50,
|
|
6
20
|
2: 125,
|
package/src/utils/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
arrayTool: require('./arrayTools'),
|
|
3
|
+
Constants: require('./Constants'),
|
|
4
|
+
divide: require('./divide'),
|
|
5
|
+
isGuildID: require('./isGuildID'),
|
|
6
|
+
isUUID: require('./isUUID'),
|
|
7
|
+
oscillation: require('./oscillation'),
|
|
8
|
+
removeSnakeCase: require('./removeSnakeCase'),
|
|
9
|
+
SkyblockUtils: require('./SkyblockUtils'),
|
|
10
|
+
toIGN: require('./toIGN'),
|
|
11
|
+
toUuid: require('./toUuid'),
|
|
12
|
+
varInt: require('./varInt')
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = (num) => {
|
|
2
|
+
if (isNaN(num)) return NaN;
|
|
3
|
+
const digits = String(+num).split('');
|
|
4
|
+
const key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM',
|
|
5
|
+
'', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC',
|
|
6
|
+
'', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
|
|
7
|
+
let roman = '';
|
|
8
|
+
let i = 3;
|
|
9
|
+
while (i--) {
|
|
10
|
+
roman = (key[+ digits.pop() + (i * 10)] || '') + roman;
|
|
11
|
+
}
|
|
12
|
+
return Array(+digits.join('') + 1).join('M') + roman;
|
|
13
|
+
};
|