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/.prettierrc
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bracketSameLine": true,
|
|
3
|
-
"trailingComma": "none",
|
|
4
|
-
"arrowParens": "always",
|
|
5
|
-
"bracketSpacing": true,
|
|
6
|
-
"proseWrap": "always",
|
|
7
|
-
"singleQuote": true,
|
|
8
|
-
"printWidth":
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bracketSameLine": true,
|
|
3
|
+
"trailingComma": "none",
|
|
4
|
+
"arrowParens": "always",
|
|
5
|
+
"bracketSpacing": true,
|
|
6
|
+
"proseWrap": "always",
|
|
7
|
+
"singleQuote": true,
|
|
8
|
+
"printWidth": 120,
|
|
9
|
+
"endOfLine": "lf",
|
|
10
|
+
"useTabs": false,
|
|
11
|
+
"tabWidth": 2,
|
|
12
|
+
"semi": true
|
|
13
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 StavZDev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 StavZDev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,65 +1,67 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<img src="https://i.imgur.com/cDFoQZU.png?1">
|
|
3
|
-
<h1>Hypixel API • Reborn</h1>
|
|
4
|
-
<a href="https://discord.gg/NSEBNMM"><img src="https://discordapp.com/api/guilds/660416184252104705/embed.png"></a>
|
|
5
|
-
<a href="https://travis-ci.org/StavZ/hypixel-api-reborn"><img src="https://flat.badgen.net/travis/hypixel-api-reborn/hypixel-api-reborn"></a>
|
|
6
|
-
<a href="https://app.codacy.com/gh/Hypixel-API-Reborn/hypixel-api-reborn?utm_source=github.com&utm_medium=referral&utm_content=Hypixel-API-Reborn/hypixel-api-reborn&utm_campaign=Badge_Grade"><img src="https://flat.badgen.net/codacy/grade/71cd7e95499b496cb2dd11c29b9def33/master"></a>
|
|
7
|
-
<img src="https://flat.badgen.net/npm/v/hypixel-api-reborn">
|
|
8
|
-
<img src="https://flat.badgen.net/npm/node/hypixel-api-reborn">
|
|
9
|
-
<img src="https://flat.badgen.net/npm/license/hypixel-api-reborn">
|
|
10
|
-
<a href="https://github.com/Hypixel-API-Reborn/hypixel-api-reborn"><img src="https://flat.badgen.net/github/stars/hypixel-api-reborn/hypixel-api-reborn"></a>
|
|
11
|
-
<a href="https://www.npmjs.com/package/hypixel-api-reborn"><img src="https://nodei.co/npm/hypixel-api-reborn.png?compact=true"></a>
|
|
12
|
-
<h2>A feature-rich Hypixel API wrapper for Node.js</h2>
|
|
13
|
-
<br>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
### Links
|
|
17
|
-
|
|
18
|
-
[Discord Support](https://discord.gg/NSEBNMM) | [Documentation](https://hypixel-api-reborn.github.io/) |
|
|
19
|
-
[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://i.imgur.com/cDFoQZU.png?1">
|
|
3
|
+
<h1>Hypixel API • Reborn</h1>
|
|
4
|
+
<a href="https://discord.gg/NSEBNMM"><img src="https://discordapp.com/api/guilds/660416184252104705/embed.png"></a>
|
|
5
|
+
<a href="https://travis-ci.org/StavZ/hypixel-api-reborn"><img src="https://flat.badgen.net/travis/hypixel-api-reborn/hypixel-api-reborn"></a>
|
|
6
|
+
<a href="https://app.codacy.com/gh/Hypixel-API-Reborn/hypixel-api-reborn?utm_source=github.com&utm_medium=referral&utm_content=Hypixel-API-Reborn/hypixel-api-reborn&utm_campaign=Badge_Grade"><img src="https://flat.badgen.net/codacy/grade/71cd7e95499b496cb2dd11c29b9def33/master"></a>
|
|
7
|
+
<img src="https://flat.badgen.net/npm/v/hypixel-api-reborn">
|
|
8
|
+
<img src="https://flat.badgen.net/npm/node/hypixel-api-reborn">
|
|
9
|
+
<img src="https://flat.badgen.net/npm/license/hypixel-api-reborn">
|
|
10
|
+
<a href="https://github.com/Hypixel-API-Reborn/hypixel-api-reborn"><img src="https://flat.badgen.net/github/stars/hypixel-api-reborn/hypixel-api-reborn"></a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/hypixel-api-reborn"><img src="https://nodei.co/npm/hypixel-api-reborn.png?compact=true"></a>
|
|
12
|
+
<h2>A feature-rich Hypixel API wrapper for Node.js</h2>
|
|
13
|
+
<br>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
### Links
|
|
17
|
+
|
|
18
|
+
[Discord Support](https://discord.gg/NSEBNMM) | [Documentation](https://hypixel-api-reborn.github.io/) |
|
|
19
|
+
[NPM](https://www.npmjs.com/package/hypixel-api-reborn) |
|
|
20
|
+
[GitHub](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn) |
|
|
21
|
+
[ToDo](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/projects/1) |
|
|
22
|
+
[CLI](https://github.com/Hypixel-API-Reborn/cli)
|
|
23
|
+
|
|
24
|
+
#### Requirements
|
|
25
|
+
|
|
26
|
+
**For Node.js users >= v14.x.x** <br> **For TypeScript users >= v3.5**
|
|
27
|
+
|
|
28
|
+
### Installation & Usage
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
npm i hypixel-api-reborn
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
const Hypixel = require('hypixel-api-reborn');
|
|
36
|
+
const hypixel = new Hypixel.Client('API-KEY');
|
|
37
|
+
|
|
38
|
+
// getPlayer
|
|
39
|
+
hypixel
|
|
40
|
+
.getPlayer('StavZDev')
|
|
41
|
+
.then((player) => {
|
|
42
|
+
console.log(player.level); // 141
|
|
43
|
+
})
|
|
44
|
+
.catch((e) => {
|
|
45
|
+
console.error(e);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// getGuild
|
|
49
|
+
hypixel
|
|
50
|
+
.getGuild('name', 'The Foundation')
|
|
51
|
+
.then((guild) => {
|
|
52
|
+
console.log(guild.level); // 111
|
|
53
|
+
})
|
|
54
|
+
.catch((e) => {
|
|
55
|
+
console.error(e);
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
For more examples go to our [documentation](https://hypixel-api-reborn.github.io/).
|
|
60
|
+
|
|
61
|
+
## Changelog
|
|
62
|
+
|
|
63
|
+
[v11.0.0](https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/releases/tag/11.0.0)
|
|
64
|
+
|
|
65
|
+
### Try it now
|
|
66
|
+
|
|
67
|
+
**[Code Sandbox](https://codesandbox.io/s/clever-babbage-xqmfw?file=/src/index.js)**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hypixel-api-reborn",
|
|
3
|
-
"version": "11.0
|
|
3
|
+
"version": "11.2.0",
|
|
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,11 @@
|
|
|
16
16
|
"url": "https://github.com/Hypixel-API-Reborn/hypixel-api-reborn/issues"
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"lint": "npx eslint src/ typings/",
|
|
20
|
+
"lint:fix": "npx eslint src/ typings/ --fix",
|
|
21
21
|
"lint:dev": "npm run eslint && npm run dtslint",
|
|
22
|
-
"
|
|
23
|
-
"docgen": "npx docgen -s src -o
|
|
24
|
-
"docgen:custom": "npx docgen -s src --custom docs/index.yml -o ../docs/master.json",
|
|
22
|
+
"tests": "npx mocha tests --exit --recursive",
|
|
23
|
+
"docgen": "npx docgen -s src -o ./master.json",
|
|
25
24
|
"dtslint": "npx dtslint typings",
|
|
26
25
|
"prettier": "npx prettier --write src/ typings/",
|
|
27
26
|
"prettier:check": "npx prettier --check src/ typings/"
|
|
@@ -31,10 +30,12 @@
|
|
|
31
30
|
},
|
|
32
31
|
"author": "StavZ",
|
|
33
32
|
"dependencies": {
|
|
34
|
-
"node-
|
|
33
|
+
"node-cache": "^5.1.2",
|
|
34
|
+
"node-fetch": "^3.3.2",
|
|
35
35
|
"object-path": "^0.11.8",
|
|
36
|
-
"prismarine-nbt": "^2.
|
|
37
|
-
"rss-parser": "^3.13.0"
|
|
36
|
+
"prismarine-nbt": "^2.5.0",
|
|
37
|
+
"rss-parser": "^3.13.0",
|
|
38
|
+
"skyhelper-networth": "^1.19.0"
|
|
38
39
|
},
|
|
39
40
|
"license": "MIT",
|
|
40
41
|
"readme": "https://hypixel.stavzdev.me/",
|
|
@@ -43,18 +44,19 @@
|
|
|
43
44
|
},
|
|
44
45
|
"publisher": "StavZ",
|
|
45
46
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@typescript-eslint/
|
|
47
|
+
"@discordjs/docgen": "github:discordjs/docgen",
|
|
48
|
+
"@types/node": "^20.11.19",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
50
|
+
"@typescript-eslint/parser": "^7.0.2",
|
|
49
51
|
"chai": "^4.3.4",
|
|
50
|
-
"dtslint": "^4.1
|
|
51
|
-
"eslint": "^
|
|
52
|
+
"dtslint": "^4.2.1",
|
|
53
|
+
"eslint": "^8.56.0",
|
|
52
54
|
"eslint-config-google": "^0.14.0",
|
|
53
|
-
"eslint-config-prettier": "^9.
|
|
54
|
-
"mocha": "^
|
|
55
|
+
"eslint-config-prettier": "^9.1.0",
|
|
56
|
+
"mocha": "^10.4.0",
|
|
55
57
|
"node-env-run": "^4.0.2",
|
|
56
58
|
"path": "^0.12.7",
|
|
57
|
-
"prettier": "^3.
|
|
58
|
-
"typescript": "^
|
|
59
|
+
"prettier": "^3.2.5",
|
|
60
|
+
"typescript": "^5.3.3"
|
|
59
61
|
}
|
|
60
62
|
}
|
package/src/API/getAPIStatus.js
CHANGED
|
@@ -3,6 +3,6 @@ const Parser = new Rss();
|
|
|
3
3
|
module.exports = async function (options) {
|
|
4
4
|
const Status = require('../structures/APIStatus.js');
|
|
5
5
|
const parsed = await Parser.parseURL('https://status.hypixel.net/history.rss');
|
|
6
|
-
if (options.raw) return parsed;
|
|
6
|
+
if (options && options.raw) return parsed;
|
|
7
7
|
return new Status(parsed);
|
|
8
8
|
};
|
package/src/API/getGuild.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = async function (searchParameter, query) {
|
|
|
6
6
|
const Guild = require('../structures/Guild/Guild');
|
|
7
7
|
if (searchParameter === 'id' && !isGuildID(query)) throw new Error(Errors.INVALID_GUILD_ID);
|
|
8
8
|
const isPlayerQuery = searchParameter === 'player';
|
|
9
|
-
if (isPlayerQuery) query = await toUuid(query);
|
|
9
|
+
if (isPlayerQuery) query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
10
10
|
if (!['id', 'name', 'player'].includes(searchParameter)) throw new Error(Errors.INVALID_GUILD_SEARCH_PARAMETER);
|
|
11
11
|
const res = await this._makeRequest(`/guild?${searchParameter}=${encodeURI(query)}`);
|
|
12
12
|
if (res.raw) return res;
|
|
@@ -7,7 +7,9 @@ module.exports = async function () {
|
|
|
7
7
|
const lbnames = Object.create(require('../utils/Constants').leaderboardNames);
|
|
8
8
|
// eslint-disable-next-line guard-for-in
|
|
9
9
|
for (const name in lbnames) {
|
|
10
|
-
lbnames[name] = res.leaderboards[lbnames[name]].length
|
|
10
|
+
lbnames[name] = res.leaderboards[lbnames[name]].length
|
|
11
|
+
? res.leaderboards[lbnames[name]].map((lb) => new Leaderboard(lb))
|
|
12
|
+
: [];
|
|
11
13
|
}
|
|
12
14
|
return lbnames;
|
|
13
15
|
};
|
package/src/API/getPlayer.js
CHANGED
|
@@ -5,7 +5,7 @@ const getRecentGames = require('./getRecentGames');
|
|
|
5
5
|
module.exports = async function (query, options = { guild: false, recentGames: false }) {
|
|
6
6
|
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
7
|
const Player = require('../structures/Player');
|
|
8
|
-
query = await toUuid(query);
|
|
8
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
9
9
|
const res = await this._makeRequest(`/player?uuid=${query}`);
|
|
10
10
|
if (res.raw) return res;
|
|
11
11
|
if (query && !res.player) throw new Error(Errors.PLAYER_HAS_NEVER_LOGGED);
|
|
@@ -5,7 +5,7 @@ module.exports = async function (query, playerData) {
|
|
|
5
5
|
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
6
6
|
const RecentGame = require('../structures/RecentGame');
|
|
7
7
|
|
|
8
|
-
query = await toUuid(query);
|
|
8
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
9
9
|
|
|
10
10
|
const res = await this._makeRequest(`/recentgames?uuid=${query}`);
|
|
11
11
|
if (res.raw) return res;
|
package/src/API/getServerInfo.js
CHANGED
|
@@ -2,7 +2,9 @@ const net = require('net');
|
|
|
2
2
|
const Errors = require('../Errors');
|
|
3
3
|
const ServerInfo = require('../structures/ServerInfo');
|
|
4
4
|
const varInt = require('../utils/varInt');
|
|
5
|
-
const packetsToSend = ['1500E0050E6D632E6879706978656C2E6E657463DD01', '0100', '09010000000000000000'].map((x) =>
|
|
5
|
+
const packetsToSend = ['1500E0050E6D632E6879706978656C2E6E657463DD01', '0100', '09010000000000000000'].map((x) =>
|
|
6
|
+
Buffer.from(x, 'hex')
|
|
7
|
+
); // To avoid dependency hell, these are precompiled as hex.
|
|
6
8
|
module.exports = async function (repeats) {
|
|
7
9
|
if (repeats < 0 || typeof repeats !== 'number') repeats = 3;
|
|
8
10
|
if (repeats > 10) repeats = 10;
|
package/src/API/getStatus.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const toUuid = require('../utils/toUuid');
|
|
2
2
|
module.exports = async function (query) {
|
|
3
3
|
const Status = require('../structures/Status');
|
|
4
|
-
query = await toUuid(query);
|
|
4
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
5
5
|
const res = await this._makeRequest(`/status?uuid=${query}`);
|
|
6
6
|
if (res.raw) return res;
|
|
7
7
|
return new Status(res.session);
|
package/src/API/index.js
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
getAchievements: require('./getAchievements.js'),
|
|
3
|
+
getAPIStatus: require('./getAPIStatus.js'),
|
|
4
|
+
getBoosters: require('./getBoosters.js'),
|
|
5
|
+
getChallenges: require('./getChallenges.js'),
|
|
6
|
+
getGameCounts: require('./getGameCounts.js'),
|
|
7
|
+
getGuild: require('./getGuild.js'),
|
|
8
|
+
getGuildAchievements: require('./getGuildAchievements.js'),
|
|
9
|
+
getLeaderboards: require('./getLeaderboards.js'),
|
|
10
|
+
getPlayer: require('./getPlayer.js'),
|
|
11
|
+
getQuests: require('./getQuests.js'),
|
|
12
|
+
getRecentGames: require('./getRecentGames.js'),
|
|
13
|
+
getServerInfo: require('./getServerInfo.js'),
|
|
14
|
+
getStatus: require('./getStatus.js'),
|
|
15
|
+
getWatchdogStats: require('./getWatchdogStats.js'),
|
|
16
|
+
|
|
17
|
+
getSkyblockAuction: require('./skyblock/getAuction.js'),
|
|
18
|
+
getSkyblockAuctions: require('./skyblock/getAuctions.js'),
|
|
19
|
+
getSkyblockAuctionsByPlayer: require('./skyblock/getAuctionsByPlayer.js'),
|
|
20
|
+
getSkyblockBazaar: require('./skyblock/getBazaar.js'),
|
|
21
|
+
getSkyblockBingo: require('./skyblock/getBingo.js'),
|
|
22
|
+
getSkyblockBingoByPlayer: require('./skyblock/getBingoByPlayer.js'),
|
|
23
|
+
getSkyblockEndedAuctions: require('./skyblock/getEndedAuctions.js'),
|
|
24
|
+
getSkyblockFireSales: require('./skyblock/getFireSales.js'),
|
|
25
|
+
getSkyblockGovernment: require('./skyblock/getGovernment.js'),
|
|
26
|
+
getSkyblockMember: require('./skyblock/getMember.js'),
|
|
27
|
+
getSkyblockMuseum: require('./skyblock/getMuseum.js'),
|
|
28
|
+
getSkyblockNews: require('./skyblock/getNews.js'),
|
|
29
|
+
getSkyblockProfiles: require('./skyblock/getProfiles.js')
|
|
19
30
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Errors = require('../../Errors');
|
|
2
|
+
const toUuid = require('../../utils/toUuid');
|
|
3
|
+
module.exports = async function (type, query, includeItemBytes = false) {
|
|
4
|
+
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
5
|
+
const Auction = require('../../structures/SkyBlock/Auctions/Auction');
|
|
6
|
+
let filter = '';
|
|
7
|
+
if (type === 'PROFILE') {
|
|
8
|
+
filter = 'profile';
|
|
9
|
+
} else if (type === 'PLAYER') {
|
|
10
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
11
|
+
filter = 'player';
|
|
12
|
+
} else if (type === 'AUCTION') {
|
|
13
|
+
filter = 'uuid';
|
|
14
|
+
} else throw new Error(Errors.BAD_AUCTION_FILTER);
|
|
15
|
+
const res = await this._makeRequest(`/skyblock/auction?${filter}=${query}`);
|
|
16
|
+
if (res.raw) return res;
|
|
17
|
+
|
|
18
|
+
return res.auctions.length ? res.auctions.map((a) => new Auction(a, includeItemBytes)) : [];
|
|
19
|
+
};
|
|
@@ -30,8 +30,12 @@ module.exports = async function (range, options = {}) {
|
|
|
30
30
|
if (range == null || range === '*') range = [0, (await getPage(0, { noAuctions: true })).info.totalPages];
|
|
31
31
|
if (!Array.isArray(range)) range = [parseInt(range), parseInt(range)];
|
|
32
32
|
if (isNaN(range[0])) throw new Error(Errors.PAGE_INDEX_ERROR);
|
|
33
|
-
if (parseInt(options.retries) !== options.retries || options.retries > 10 || options.retries < 0)
|
|
34
|
-
|
|
33
|
+
if (parseInt(options.retries) !== options.retries || options.retries > 10 || options.retries < 0) {
|
|
34
|
+
throw new Error(Errors.INVALID_OPTION_VALUE);
|
|
35
|
+
}
|
|
36
|
+
if (parseInt(options.cooldown) !== options.cooldown || options.cooldown > 3000 || options.cooldown < 0) {
|
|
37
|
+
throw new Error(Errors.INVALID_OPTION_VALUE);
|
|
38
|
+
}
|
|
35
39
|
range = range.sort();
|
|
36
40
|
const result = { auctions: [] };
|
|
37
41
|
const fetches = [];
|
|
@@ -3,7 +3,7 @@ const toUuid = require('../../utils/toUuid');
|
|
|
3
3
|
module.exports = async function (query, includeItemBytes = false) {
|
|
4
4
|
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
5
5
|
const Auction = require('../../structures/SkyBlock/Auctions/Auction');
|
|
6
|
-
query = await toUuid(query);
|
|
6
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
7
7
|
const res = await this._makeRequest(`/skyblock/auction?player=${query}`);
|
|
8
8
|
if (res.raw) return res;
|
|
9
9
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const getBingo = require('./getBingo');
|
|
2
|
+
const toUuid = require('../../utils/toUuid');
|
|
3
|
+
const Errors = require('../../Errors');
|
|
4
|
+
module.exports = async function (query, { fetchBingoData = false }) {
|
|
5
|
+
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
6
|
+
const PlayerBingo = require('../../structures/SkyBlock/PlayerBingo');
|
|
7
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
8
|
+
const res = await this._makeRequest(`/skyblock/uuid?player=${query}`);
|
|
9
|
+
if (res.raw) return res;
|
|
10
|
+
let bingoData = null;
|
|
11
|
+
if (fetchBingoData) bingoData = await getBingo.call(this);
|
|
12
|
+
|
|
13
|
+
return new PlayerBingo(data, bingoData);
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
module.exports = async function () {
|
|
2
|
+
const FireSale = require('../../structures/SkyBlock/Static/FireSale');
|
|
3
|
+
const res = await this._makeRequest('/skyblock/firesales');
|
|
4
|
+
if (res.raw) return res;
|
|
5
|
+
|
|
6
|
+
return res.sales.length ? res.sales.map((a) => new FireSale(a)) : [];
|
|
7
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
const Errors = require('../../Errors');
|
|
2
2
|
const toUuid = require('../../utils/toUuid');
|
|
3
3
|
const getPlayer = require('../getPlayer');
|
|
4
|
-
module.exports = async function (query, options = { fetchPlayer: false }) {
|
|
4
|
+
module.exports = async function (query, options = { fetchPlayer: false, getMuseum: false }) {
|
|
5
5
|
const SkyblockMember = require('../../structures/SkyBlock/SkyblockMember');
|
|
6
|
+
const getSkyblockMuseum = require('../skyblock/getMuseum');
|
|
6
7
|
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
-
query = await toUuid(query);
|
|
8
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
8
9
|
const res = await this._makeRequest(`/skyblock/profiles?uuid=${query}`);
|
|
9
10
|
if (res.raw) return res;
|
|
10
|
-
if (!res.profiles || !res.profiles.length)
|
|
11
|
-
return new Map();
|
|
12
|
-
}
|
|
11
|
+
if (!res.profiles || !res.profiles.length) throw new Error(Errors.NO_SKYBLOCK_PROFILES);
|
|
13
12
|
const player = options.fetchPlayer ? await getPlayer.call(this, query, options) : null;
|
|
14
13
|
const memberByProfileName = new Map();
|
|
15
14
|
for (const profile of res.profiles) {
|
|
@@ -18,9 +17,14 @@ module.exports = async function (query, options = { fetchPlayer: false }) {
|
|
|
18
17
|
profile.cute_name,
|
|
19
18
|
new SkyblockMember({
|
|
20
19
|
uuid: query,
|
|
20
|
+
profileId: profile.profile_id,
|
|
21
21
|
profileName: profile.cute_name,
|
|
22
22
|
gameMode: profile.game_mode || null,
|
|
23
|
-
m: profile.members[query]
|
|
23
|
+
m: profile.members[query],
|
|
24
|
+
banking: profile.banking,
|
|
25
|
+
communityUpgrades: profile.community_upgrades,
|
|
26
|
+
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, profile.profile_id) : null,
|
|
27
|
+
selected: profile.selected
|
|
24
28
|
})
|
|
25
29
|
);
|
|
26
30
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const Errors = require('../../Errors');
|
|
2
|
+
const toUuid = require('../../utils/toUuid');
|
|
3
|
+
module.exports = async function (query, profileId) {
|
|
4
|
+
const SkyblockMuseum = require('../../structures/SkyBlock/SkyblockMuseum');
|
|
5
|
+
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
6
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
7
|
+
const res = await this._makeRequest(`/skyblock/museum?uuid=${query}&profile=${profileId}`);
|
|
8
|
+
if (res.raw) return res;
|
|
9
|
+
return new SkyblockMuseum({
|
|
10
|
+
uuid: query,
|
|
11
|
+
m: res,
|
|
12
|
+
profileId: profileId
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
const Errors = require('../../Errors');
|
|
2
2
|
const toUuid = require('../../utils/toUuid');
|
|
3
3
|
const getPlayer = require('../getPlayer');
|
|
4
|
-
module.exports = async function (query, options = { fetchPlayer: false }) {
|
|
4
|
+
module.exports = async function (query, options = { fetchPlayer: false, getMuseum: false }) {
|
|
5
5
|
const SkyblockProfile = require('../../structures/SkyBlock/SkyblockProfile');
|
|
6
|
+
const getSkyblockMuseum = require('../skyblock/getMuseum');
|
|
6
7
|
if (!query) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
-
query = await toUuid(query);
|
|
8
|
+
query = await toUuid(query, this.options.mojangCacheTime, this.options.useThirdPartyAPI);
|
|
8
9
|
const res = await this._makeRequest(`/skyblock/profiles?uuid=${query}`);
|
|
9
10
|
if (res.raw) return res;
|
|
10
|
-
|
|
11
|
-
if (!res.profiles || !res.profiles.length) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
|
|
11
|
+
if (!res.profiles || !res.profiles.length) throw new Error(Errors.NO_SKYBLOCK_PROFILES);
|
|
15
12
|
const players = new Map();
|
|
16
13
|
if (options.fetchPlayer) {
|
|
17
14
|
const uniqueUuids = [...new Set(res.profiles.map((profile) => Object.keys(profile.members)).flat())];
|
|
@@ -32,11 +29,16 @@ module.exports = async function (query, options = { fetchPlayer: false }) {
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
profiles.push({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
uuid: query,
|
|
33
|
+
profileId: res.profiles[i].profile_id,
|
|
34
|
+
profileName: res.profiles[i].cute_name,
|
|
35
|
+
gameMode: res.profiles[i].game_mode || null,
|
|
36
|
+
m: res.profiles[i].members[query],
|
|
37
|
+
banking: res.profiles[i].banking,
|
|
38
|
+
communityUpgrades: res.profiles[i].community_upgrades,
|
|
39
|
+
museum: options.getMuseum ? await getSkyblockMuseum.call(this, query, res.profiles[i].profile_id) : null,
|
|
40
|
+
selected: res.profiles[i].selected,
|
|
41
|
+
members: res.profiles[i].members
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
|