hypixel-api-reborn 11.2.0 → 11.3.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/eslint.config.mjs +71 -0
- package/package.json +14 -20
- package/src/API/getAchievements.js +1 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +4 -3
- package/src/API/getGuildAchievements.js +1 -0
- package/src/API/getLeaderboards.js +1 -1
- package/src/API/getPlayer.js +1 -0
- package/src/API/getQuests.js +1 -0
- package/src/API/getRecentGames.js +5 -9
- package/src/API/getServerInfo.js +40 -37
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/housing/getActiveHouses.js +7 -0
- package/src/API/housing/getHouse.js +9 -0
- package/src/API/housing/getPlayerHouses.js +11 -0
- package/src/API/index.js +6 -1
- package/src/API/skyblock/getAuction.js +8 -6
- package/src/API/skyblock/getAuctions.js +15 -12
- package/src/API/skyblock/getAuctionsByPlayer.js +1 -1
- package/src/API/skyblock/getBazaar.js +1 -3
- package/src/API/skyblock/getBingo.js +1 -2
- package/src/API/skyblock/getBingoByPlayer.js +3 -3
- package/src/API/skyblock/getEndedAuctions.js +1 -0
- package/src/API/skyblock/getFireSales.js +1 -1
- package/src/API/skyblock/getGarden.js +7 -0
- package/src/API/skyblock/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +5 -2
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +5 -2
- package/src/Client.js +88 -16
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +12 -13
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- package/src/index.js +5 -0
- package/src/structures/APIIncident.js +1 -2
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +9 -8
- package/src/structures/Game.js +1 -1
- package/src/structures/Guild/Guild.js +19 -36
- package/src/structures/Guild/GuildMember.js +2 -2
- package/src/structures/House.js +54 -0
- package/src/structures/MiniGames/Arcade.js +798 -312
- package/src/structures/MiniGames/ArenaBrawl.js +98 -32
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +381 -129
- package/src/structures/MiniGames/BuildBattle.js +19 -8
- package/src/structures/MiniGames/CopsAndCrims.js +253 -25
- package/src/structures/MiniGames/Duels.js +905 -664
- package/src/structures/MiniGames/MegaWalls.js +390 -51
- package/src/structures/MiniGames/MurderMystery.js +151 -30
- package/src/structures/MiniGames/Paintball.js +31 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/Quakecraft.js +113 -50
- package/src/structures/MiniGames/SkyWars.js +528 -372
- package/src/structures/MiniGames/SmashHeroes.js +201 -73
- package/src/structures/MiniGames/SpeedUHC.js +77 -24
- package/src/structures/MiniGames/TNTGames.js +242 -73
- package/src/structures/MiniGames/TurboKartRacers.js +55 -115
- package/src/structures/MiniGames/UHC.js +144 -132
- package/src/structures/MiniGames/VampireZ.js +70 -37
- package/src/structures/MiniGames/Warlords.js +126 -1
- package/src/structures/MiniGames/WoolWars.js +60 -9
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +43 -128
- package/src/structures/PlayerCosmetics.js +5 -4
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +2 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +7 -14
- package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +90 -228
- package/src/structures/SkyBlock/SkyblockPet.js +3 -4
- package/src/structures/SkyBlock/Static/Bingo.js +10 -11
- package/src/structures/SkyBlock/Static/BingoData.js +1 -1
- package/src/structures/Static/Achievement.js +16 -15
- package/src/structures/Static/AchievementTier.js +2 -2
- package/src/structures/Static/Quest.js +2 -2
- package/src/utils/Constants.js +522 -520
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +482 -192
- 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 +11 -7
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +3 -3
- package/src/utils/toUuid.js +4 -4
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +1186 -967
- package/src/utils/toIGN.js +0 -24
package/src/utils/divide.js
CHANGED
package/src/utils/index.js
CHANGED
|
@@ -2,12 +2,13 @@ module.exports = {
|
|
|
2
2
|
arrayTool: require('./arrayTools'),
|
|
3
3
|
Constants: require('./Constants'),
|
|
4
4
|
divide: require('./divide'),
|
|
5
|
+
guild: require('./Guild'),
|
|
5
6
|
isGuildID: require('./isGuildID'),
|
|
6
7
|
isUUID: require('./isUUID'),
|
|
7
8
|
oscillation: require('./oscillation'),
|
|
9
|
+
player: require('./Player'),
|
|
8
10
|
removeSnakeCase: require('./removeSnakeCase'),
|
|
9
11
|
SkyblockUtils: require('./SkyblockUtils'),
|
|
10
|
-
toIGN: require('./toIGN'),
|
|
11
12
|
toUuid: require('./toUuid'),
|
|
12
13
|
varInt: require('./varInt')
|
|
13
14
|
};
|
package/src/utils/isGuildID.js
CHANGED
package/src/utils/oscillation.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// See https://github.com/HypixelDev/PublicAPI/blob/db26b5fd3b7bb29da14e40e6d211143ec44a4519/Documentation/misc/Oscillation.md
|
|
2
2
|
// Month oscillation started in December 2014, so every month that is pair ( odd in js!! ) is month A
|
|
3
3
|
// Weekly oscillation started... just refer to the code in the docs
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
5
6
|
function monthAB(date = Date.now()) {
|
|
6
7
|
return new Date(date).getMonth() % 2 ? 'a' : 'b';
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
const weeklyOscillationStart = 1417237200000;
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
11
13
|
function weekAB(date = Date.now()) {
|
|
12
14
|
return (Math.abs(new Date(date).getTime() - weeklyOscillationStart) / 604800000) % 2 ? 'a' : 'b';
|
|
13
15
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
const single = (obj) =>
|
|
1
|
+
const single = (obj) => {
|
|
3
2
|
Object.keys(obj).reduce((pV, cV) => ({ ...pV, [cV.replace(/_[a-z]/gi, (x) => x[1].toUpperCase())]: obj[cV] }), {});
|
|
4
|
-
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
5
6
|
function validateJSON(obj) {
|
|
6
|
-
return typeof obj
|
|
7
|
+
return 'object' === typeof obj && '{' === JSON.stringify(obj)[0];
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
9
11
|
function recursive(obj, lowerCase = false) {
|
|
10
12
|
if (!validateJSON(obj)) return obj;
|
|
11
13
|
return Object.keys(obj).reduce(
|
|
@@ -16,11 +18,13 @@ function recursive(obj, lowerCase = false) {
|
|
|
16
18
|
{}
|
|
17
19
|
);
|
|
18
20
|
}
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
20
23
|
function removeSnakeCaseString(str) {
|
|
21
|
-
if (typeof str
|
|
24
|
+
if ('string' !== typeof str) return null;
|
|
22
25
|
return str.toLowerCase().replace(/_[a-z]/gi, (x) => x[1].toUpperCase());
|
|
23
26
|
}
|
|
27
|
+
|
|
24
28
|
module.exports = {
|
|
25
29
|
single,
|
|
26
30
|
recursive,
|
package/src/utils/romanize.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = (num) => {
|
|
2
2
|
if (isNaN(num)) return NaN;
|
|
3
|
-
const digits = String(
|
|
3
|
+
const digits = String(Number(num)).split('');
|
|
4
4
|
const key = [
|
|
5
5
|
'',
|
|
6
6
|
'C',
|
|
@@ -36,7 +36,7 @@ module.exports = (num) => {
|
|
|
36
36
|
let roman = '';
|
|
37
37
|
let i = 3;
|
|
38
38
|
while (i--) {
|
|
39
|
-
roman = (key[
|
|
39
|
+
roman = (key[Number(digits.pop()) + i * 10] || '') + roman;
|
|
40
40
|
}
|
|
41
|
-
return Array(
|
|
41
|
+
return Array(Number(digits.join('')) + 1).join('M') + roman;
|
|
42
42
|
};
|
package/src/utils/toUuid.js
CHANGED
|
@@ -4,15 +4,15 @@ const Errors = require('../Errors');
|
|
|
4
4
|
|
|
5
5
|
module.exports = async (input, cacheTime = 600, useThirdPartyAPI = '') => {
|
|
6
6
|
if (!input) throw new Error(Errors.NO_NICKNAME_UUID);
|
|
7
|
-
if (typeof input
|
|
7
|
+
if ('string' !== typeof input) throw new Error(Errors.UUID_NICKNAME_MUST_BE_A_STRING);
|
|
8
8
|
if (isUUID(input)) return input.replace(/-/g, '');
|
|
9
9
|
try {
|
|
10
|
-
const customUrl =
|
|
10
|
+
const customUrl = true === useThirdPartyAPI ? 'https://api.minetools.eu/uuid/' : useThirdPartyAPI;
|
|
11
11
|
const url = useThirdPartyAPI ? `${customUrl}${input}` : `https://mowojang.matdoes.dev/${input}`;
|
|
12
12
|
const res = await fetch(url, input, cacheTime);
|
|
13
|
-
if (res.status
|
|
13
|
+
if (404 === res.status) {
|
|
14
14
|
return Promise.reject(new Error(Errors.PLAYER_DOES_NOT_EXIST));
|
|
15
|
-
} else if (res.status
|
|
15
|
+
} else if (200 !== res.status) {
|
|
16
16
|
throw new Error('Unknown Error whilst retrieving player information');
|
|
17
17
|
}
|
|
18
18
|
return res.id;
|
package/src/utils/varInt.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// eslint-disable-next-line require-jsdoc
|
|
1
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
2
2
|
function readVarInt(bytes) {
|
|
3
3
|
let numRead = 0;
|
|
4
4
|
let result = 0;
|
|
@@ -7,7 +7,7 @@ function readVarInt(bytes) {
|
|
|
7
7
|
const value = read & 0b01111111;
|
|
8
8
|
result |= value << (7 * numRead);
|
|
9
9
|
numRead++;
|
|
10
|
-
if (
|
|
10
|
+
if (5 < numRead) {
|
|
11
11
|
return NaN;
|
|
12
12
|
}
|
|
13
13
|
} while (numRead < bytes.length);
|