hypixel-api-reborn 11.3.2 → 11.3.4
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/package.json +11 -11
- package/src/API/skyblock/getAuctions.js +8 -5
- package/src/API/skyblock/getGarden.js +7 -3
- package/src/Client.js +1 -6
- package/src/structures/SkyBlock/SkyblockGarden.js +38 -38
- package/src/structures/SkyBlock/SkyblockMember.js +131 -330
- package/src/structures/SkyBlock/SkyblockProfile.js +7 -0
- package/src/structures/SkyBlock/Static/Candidate.js +12 -2
- package/src/structures/SkyBlock/Static/Government.js +5 -0
- package/src/structures/SkyBlock/Static/Perk.js +0 -1
- package/src/utils/Constants.js +257 -150
- package/src/utils/SkyblockUtils.js +195 -31
- package/typings/index.d.ts +155 -337
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypixel-api-reborn",
|
|
3
|
-
"version": "11.3.
|
|
3
|
+
"version": "11.3.4",
|
|
4
4
|
"description": "Feature-rich Hypixel API wrapper for Node.js",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./typings/index.d.ts",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"url": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/issues"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"lint": "npx eslint
|
|
20
|
-
"lint:fix": "npx eslint
|
|
19
|
+
"lint": "npx eslint src/",
|
|
20
|
+
"lint:fix": "npx eslint src/ --fix",
|
|
21
21
|
"tests": "npx mocha tests --exit --recursive",
|
|
22
22
|
"docgen": " npx docgen -s src/ --custom docs/index.yml -o ./master.json",
|
|
23
|
-
"prettier": "npx prettier --
|
|
24
|
-
"prettier:check": "npx prettier --
|
|
23
|
+
"prettier": "npx prettier --write src/ typings/",
|
|
24
|
+
"prettier:check": "npx prettier --check src/ typings/"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
27
|
"node": ">=18.18.0"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node-fetch": "^3.3.2",
|
|
33
33
|
"prismarine-nbt": "^2.5.0",
|
|
34
34
|
"rss-parser": "^3.13.0",
|
|
35
|
-
"skyhelper-networth": "^1.
|
|
35
|
+
"skyhelper-networth": "^1.23.0"
|
|
36
36
|
},
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"readme": "https://hypixel.stavzdev.me/",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"publisher": "StavZ",
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@discordjs/docgen": "github:discordjs/docgen",
|
|
45
|
-
"@types/node": "^
|
|
45
|
+
"@types/node": "^22.1.0",
|
|
46
46
|
"chai": "^4.3.4",
|
|
47
|
-
"eslint": "^9.
|
|
48
|
-
"eslint-plugin-jsdoc": "^
|
|
49
|
-
"globals": "^15.
|
|
47
|
+
"eslint": "^9.8.0",
|
|
48
|
+
"eslint-plugin-jsdoc": "^49.0.0",
|
|
49
|
+
"globals": "^15.9.0",
|
|
50
50
|
"mocha": "^10.4.0",
|
|
51
51
|
"node-env-run": "^4.0.2",
|
|
52
52
|
"path": "^0.12.7",
|
|
53
53
|
"prettier": "^3.3.3",
|
|
54
|
-
"typescript": "^5.5.
|
|
54
|
+
"typescript": "^5.5.4"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
const Auction = require('../../structures/SkyBlock/Auctions/Auction');
|
|
3
3
|
const AuctionInfo = require('../../structures/SkyBlock/Auctions/AuctionInfo');
|
|
4
4
|
const Errors = require('../../Errors');
|
|
5
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
6
|
+
let _makeRequest;
|
|
5
7
|
async function getPage(page = 0, options = {}) {
|
|
6
|
-
|
|
7
|
-
const content = await this._makeRequest(`/skyblock/auctions?page=${page}`, false);
|
|
8
|
+
const content = await _makeRequest(`/skyblock/auctions?page=${page}`, false);
|
|
8
9
|
const result = {};
|
|
9
10
|
if (!options.noInfo) result.info = new AuctionInfo(content);
|
|
10
11
|
if (options.raw) result.auctions = content.auctions;
|
|
@@ -25,6 +26,8 @@ async function noReject(promise, args = [], retries = 3, cooldown = 100) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
module.exports = async function (range, options = {}) {
|
|
29
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
30
|
+
_makeRequest = this._makeRequest;
|
|
28
31
|
options.retries ||= 3;
|
|
29
32
|
options.cooldown ||= 100;
|
|
30
33
|
if (null === range || '*' === range) range = [0, (await getPage(0, { noAuctions: true })).info.totalPages];
|
|
@@ -37,7 +40,7 @@ module.exports = async function (range, options = {}) {
|
|
|
37
40
|
throw new Error(Errors.INVALID_OPTION_VALUE);
|
|
38
41
|
}
|
|
39
42
|
range = range.sort();
|
|
40
|
-
const result = {
|
|
43
|
+
const result = { info: null, Auctions: [] };
|
|
41
44
|
const fetches = [];
|
|
42
45
|
const failedPages = [];
|
|
43
46
|
if (options.noAuctions) return { info: options.noInfo ? null : (await getPage(range[1], { noAuctions: true })).info };
|
|
@@ -47,7 +50,7 @@ module.exports = async function (range, options = {}) {
|
|
|
47
50
|
} else {
|
|
48
51
|
const resp = await noReject(getPage, [i, options], options.retries, options.cooldown);
|
|
49
52
|
if (resp) {
|
|
50
|
-
result.
|
|
53
|
+
result.Auctions = result.Auctions.concat(resp.auctions);
|
|
51
54
|
if (resp.info) result.info = resp.info;
|
|
52
55
|
} else {
|
|
53
56
|
failedPages.push(i);
|
|
@@ -55,7 +58,7 @@ module.exports = async function (range, options = {}) {
|
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
if (fetches.length) {
|
|
58
|
-
result.
|
|
61
|
+
result.Auctions = (await Promise.all(fetches)).reduce((pV, cV, index) => {
|
|
59
62
|
if (!cV) {
|
|
60
63
|
failedPages.push(index + range[0]);
|
|
61
64
|
return pV;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
module.exports = async function (profileId) {
|
|
2
2
|
const SkyblockGarden = require('../../structures/SkyBlock/SkyblockGarden');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let res;
|
|
4
|
+
try {
|
|
5
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
6
|
+
res = await this._makeRequest(`/skyblock/garden?profile=${profileId}`).catch();
|
|
7
|
+
// eslint-disable-next-line no-unused-vars, no-empty
|
|
8
|
+
} catch (e) {}
|
|
9
|
+
if (res?.raw) return res;
|
|
6
10
|
return new SkyblockGarden(res);
|
|
7
11
|
};
|
package/src/Client.js
CHANGED
|
@@ -348,12 +348,7 @@ class Client extends EventEmitter {
|
|
|
348
348
|
* @name Client#getSkyblockAuctions
|
|
349
349
|
* @param {string|number|number[]} page - "*", a page number, or an array with the start and the end page number ( automatically sorted )
|
|
350
350
|
* @param {auctionsOptions} [options={}] Options
|
|
351
|
-
* @return {Promise<{info:AuctionInfo,
|
|
352
|
-
* @example
|
|
353
|
-
* hypixel.getSkyblockAuctions(0).then(auctions =>{
|
|
354
|
-
* console.log(auctions[0].item); // Mythic Farmer Boots
|
|
355
|
-
* })
|
|
356
|
-
* .catch(console.log);
|
|
351
|
+
* @return {Promise<{info:AuctionInfo,Auctions:Auction[]}>}
|
|
357
352
|
*/
|
|
358
353
|
/**
|
|
359
354
|
* Allows you to get player's skyblock auctions
|
|
@@ -17,22 +17,22 @@ class SkyblockGarden {
|
|
|
17
17
|
* Current Barn Skin
|
|
18
18
|
* @type {string}
|
|
19
19
|
*/
|
|
20
|
-
this.barnSkin = data
|
|
20
|
+
this.barnSkin = data?.garden?.selected_barn_skin || '';
|
|
21
21
|
/**
|
|
22
22
|
* Unlocked Plots
|
|
23
23
|
* @type {string[]}
|
|
24
24
|
*/
|
|
25
|
-
this.unlockedPlots = data
|
|
25
|
+
this.unlockedPlots = data?.garden?.unlocked_plots_ids || [];
|
|
26
26
|
/**
|
|
27
27
|
* Visitor Stats
|
|
28
28
|
* @type {SkyblockGardenVisitor}
|
|
29
29
|
*/
|
|
30
30
|
this.visitors = {
|
|
31
|
-
visited: data
|
|
32
|
-
completed: data
|
|
31
|
+
visited: data?.garden?.commission_data?.visits || {},
|
|
32
|
+
completed: data?.garden?.commission_data?.completed || {},
|
|
33
33
|
served: {
|
|
34
|
-
total: data
|
|
35
|
-
unique: data
|
|
34
|
+
total: data?.garden?.commission_data?.total_completed || 0,
|
|
35
|
+
unique: data?.garden?.commission_data?.unique_npcs_served || 0
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
/**
|
|
@@ -40,33 +40,33 @@ class SkyblockGarden {
|
|
|
40
40
|
* @type {SkyblockGarenCropMilestones}
|
|
41
41
|
*/
|
|
42
42
|
this.cropMilestones = {
|
|
43
|
-
wheat: getLevelByXp(data
|
|
44
|
-
carrot: getLevelByXp(data
|
|
45
|
-
sugarCane: getLevelByXp(data
|
|
46
|
-
potato: getLevelByXp(data
|
|
47
|
-
pumpkin: getLevelByXp(data
|
|
48
|
-
melon: getLevelByXp(data
|
|
49
|
-
cactus: getLevelByXp(data
|
|
50
|
-
|
|
51
|
-
mushroom: getLevelByXp(data
|
|
52
|
-
netherWart: getLevelByXp(data
|
|
43
|
+
wheat: getLevelByXp(data?.garden?.resources_collected?.WHEAT || 0, 'wheat'),
|
|
44
|
+
carrot: getLevelByXp(data?.garden?.resources_collected?.CARROT_ITEM || 0, 'carrot'),
|
|
45
|
+
sugarCane: getLevelByXp(data?.garden?.resources_collected?.SUGAR_CANE || 0, 'sugarCane'),
|
|
46
|
+
potato: getLevelByXp(data?.garden?.resources_collected?.POTATO_ITEM || 0, 'potato'),
|
|
47
|
+
pumpkin: getLevelByXp(data?.garden?.resources_collected?.PUMPKIN || 0, 'pumpkin'),
|
|
48
|
+
melon: getLevelByXp(data?.garden?.resources_collected?.MELON || 0, 'melon'),
|
|
49
|
+
cactus: getLevelByXp(data?.garden?.resources_collected?.CACTUS || 0, 'cactus'),
|
|
50
|
+
cocoaBeans: getLevelByXp(data?.garden?.resources_collected?.['INK_SACK:3'] || 0, 'cocoaBeans'),
|
|
51
|
+
mushroom: getLevelByXp(data?.garden?.resources_collected?.MUSHROOM_COLLECTION || 0, 'mushroom'),
|
|
52
|
+
netherWart: getLevelByXp(data?.garden?.resources_collected?.NETHER_STALK || 0, 'netherWart')
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
55
|
* Composter
|
|
56
56
|
* @type {SkyblockGardenComposter}
|
|
57
57
|
*/
|
|
58
58
|
this.composter = {
|
|
59
|
-
organicMatter: data
|
|
60
|
-
fuelUnits: data
|
|
61
|
-
compostUnits: data
|
|
62
|
-
compostItems: data
|
|
63
|
-
conversionTicks: data
|
|
59
|
+
organicMatter: data?.garden?.composter_data?.organic_matter || 0,
|
|
60
|
+
fuelUnits: data?.garden?.composter_data?.fuel_units || 0,
|
|
61
|
+
compostUnits: data?.garden?.composter_data?.compost_units || 0,
|
|
62
|
+
compostItems: data?.garden?.composter_data?.compost_items || 0,
|
|
63
|
+
conversionTicks: data?.garden?.composter_data?.conversion_ticks || 0,
|
|
64
64
|
upgrades: {
|
|
65
|
-
speed: data
|
|
66
|
-
multiDrop: data
|
|
67
|
-
fuelCap: data
|
|
68
|
-
organicMatterCap: data
|
|
69
|
-
costReduction: data
|
|
65
|
+
speed: data?.garden?.composter_data?.upgrades?.speed || 0,
|
|
66
|
+
multiDrop: data?.garden?.composter_data?.upgrades?.multi_drop || 0,
|
|
67
|
+
fuelCap: data?.garden?.composter_data?.upgrades?.fuel_cap || 0,
|
|
68
|
+
organicMatterCap: data?.garden?.composter_data?.upgrades?.organic_matter_cap || 0,
|
|
69
|
+
costReduction: data?.garden?.composter_data?.upgrades?.cost_reduction || 0
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
@@ -74,16 +74,16 @@ class SkyblockGarden {
|
|
|
74
74
|
* @type {SkyblockGarenCrops}
|
|
75
75
|
*/
|
|
76
76
|
this.cropUpgrades = {
|
|
77
|
-
wheat: data
|
|
78
|
-
carrot: data
|
|
79
|
-
sugarCane: data
|
|
80
|
-
potato: data
|
|
81
|
-
pumpkin: data
|
|
82
|
-
melon: data
|
|
83
|
-
cactus: data
|
|
84
|
-
|
|
85
|
-
mushroom: data
|
|
86
|
-
netherWart: data
|
|
77
|
+
wheat: data?.garden?.crop_upgrade_levels?.WHEAT || 0,
|
|
78
|
+
carrot: data?.garden?.crop_upgrade_levels?.CARROT_ITEM || 0,
|
|
79
|
+
sugarCane: data?.garden?.crop_upgrade_levels?.SUGAR_CANE || 0,
|
|
80
|
+
potato: data?.garden?.crop_upgrade_levels?.POTATO_ITEM || 0,
|
|
81
|
+
pumpkin: data?.garden?.crop_upgrade_levels?.PUMPKIN || 0,
|
|
82
|
+
melon: data?.garden?.crop_upgrade_levels?.MELON || 0,
|
|
83
|
+
cactus: data?.garden?.crop_upgrade_levels?.CACTUS || 0,
|
|
84
|
+
cocoaBeans: data?.garden?.crop_upgrade_levels?.['INK_SACK:3'] || 0,
|
|
85
|
+
mushroom: data?.garden?.crop_upgrade_levels?.MUSHROOM_COLLECTION || 0,
|
|
86
|
+
netherWart: data?.garden?.crop_upgrade_levels?.NETHER_STALK || 0
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -125,7 +125,7 @@ class SkyblockGarden {
|
|
|
125
125
|
* @property {number} pumpkin Pumpkin
|
|
126
126
|
* @property {number} melon Melon
|
|
127
127
|
* @property {number} cactus Cactus
|
|
128
|
-
* @property {number}
|
|
128
|
+
* @property {number} cocoaBeans Cocoa Beans
|
|
129
129
|
* @property {number} mushroom Mushroom
|
|
130
130
|
* @property {number} netherWart Nether Wart
|
|
131
131
|
*/
|
|
@@ -138,7 +138,7 @@ class SkyblockGarden {
|
|
|
138
138
|
* @property {SkyblockSkillLevel} pumpkin Pumpkin
|
|
139
139
|
* @property {SkyblockSkillLevel} melon Melon
|
|
140
140
|
* @property {SkyblockSkillLevel} cactus Cactus
|
|
141
|
-
* @property {SkyblockSkillLevel}
|
|
141
|
+
* @property {SkyblockSkillLevel} cocoaBeans Cocoa Beans
|
|
142
142
|
* @property {SkyblockSkillLevel} mushroom Mushroom
|
|
143
143
|
* @property {SkyblockSkillLevel} netherWart Nether Wart
|
|
144
144
|
*/
|