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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const GameAchievements = require('./GameAchievements.js');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Achievement class
|
|
5
|
+
*/
|
|
6
|
+
class Achievements {
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} data data
|
|
9
|
+
*/
|
|
10
|
+
constructor(data) {
|
|
11
|
+
/**
|
|
12
|
+
* Last time this resource was updated
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
this.lastUpdatedTimestamp = parseInt(data.lastUpdated, 10);
|
|
16
|
+
/**
|
|
17
|
+
* Last time this resource was updated, as Date
|
|
18
|
+
* @type {Date|null}
|
|
19
|
+
*/
|
|
20
|
+
this.lastUpdatedAt = new Date(this.lastUpdatedTimestamp);
|
|
21
|
+
/**
|
|
22
|
+
* @type {Record<StaticGameNames, GameAchievements>}
|
|
23
|
+
*/
|
|
24
|
+
this.achievementsPerGame = Object.fromEntries(
|
|
25
|
+
Object.entries(data.achievements).map(([game, data]) => [game, new GameAchievements(game, data)])
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = Achievements;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const GameChallenges = require('./GameChallenges.js');
|
|
2
|
+
/**
|
|
3
|
+
* Achievement class
|
|
4
|
+
*/
|
|
5
|
+
class Challenges {
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} data data
|
|
8
|
+
*/
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* Last time this resource was updated
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
this.lastUpdatedTimestamp = parseInt(data.lastUpdated, 10);
|
|
15
|
+
/**
|
|
16
|
+
* Last time this resource was updated, as Date
|
|
17
|
+
* @type {Date|null}
|
|
18
|
+
*/
|
|
19
|
+
this.lastUpdatedAt = new Date(this.lastUpdatedTimestamp);
|
|
20
|
+
/**
|
|
21
|
+
* @type {Record<StaticGameNames, GameChallenges>}
|
|
22
|
+
*/
|
|
23
|
+
this.challengesPerGame = Object.fromEntries(
|
|
24
|
+
Object.entries(data.challenges).map(([game, data]) => [game, new GameChallenges(game, data)])
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = Challenges;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const Achievement = require('./Achievement');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Game achievements class
|
|
5
|
+
*/
|
|
6
|
+
class GameAchievements {
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} name game name
|
|
9
|
+
* @param {object} data data
|
|
10
|
+
*/
|
|
11
|
+
constructor(name, data) {
|
|
12
|
+
/**
|
|
13
|
+
* Name of game/category
|
|
14
|
+
* @type {StaticGameNames}
|
|
15
|
+
*/
|
|
16
|
+
this.category = name;
|
|
17
|
+
/**
|
|
18
|
+
* Total points possible from all achievements in this game
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
this.totalPoints = parseInt(data.total_points, 10) || 0;
|
|
22
|
+
/**
|
|
23
|
+
* Total legacy points possible from all achievements in this game
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
this.totalLegacyPoints = parseInt(data.total_legacy_points, 10) || 0;
|
|
27
|
+
/**
|
|
28
|
+
* @type {Achievement[]}
|
|
29
|
+
*/
|
|
30
|
+
this.achievements = Object.entries({ ...(data.one_time || {}), ...(data.tiered || {}) }).map(
|
|
31
|
+
([name, data]) => new Achievement(name, data)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = GameAchievements;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Game challenges class
|
|
3
|
+
*/
|
|
4
|
+
class GameChallenges {
|
|
5
|
+
/**
|
|
6
|
+
* @param {string} name game name
|
|
7
|
+
* @param {object} data data
|
|
8
|
+
*/
|
|
9
|
+
constructor(name, data) {
|
|
10
|
+
/**
|
|
11
|
+
* Name of game/category
|
|
12
|
+
* @type {StaticGameNames}
|
|
13
|
+
*/
|
|
14
|
+
this.category = name;
|
|
15
|
+
/**
|
|
16
|
+
* @type {Map<string, ChallengeData>}
|
|
17
|
+
*/
|
|
18
|
+
this.challenges = new Map();
|
|
19
|
+
|
|
20
|
+
data.forEach((challenge) => {
|
|
21
|
+
const content = {
|
|
22
|
+
id: challenge.id,
|
|
23
|
+
name: challenge.name,
|
|
24
|
+
reward: parseInt(challenge.rewards[0].amount, 10) || 0,
|
|
25
|
+
rewardType: challenge.rewards[0].type
|
|
26
|
+
};
|
|
27
|
+
this.challenges.set(challenge.id, content);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} ChallengeData
|
|
34
|
+
* @property {string} id String ID of the challenge
|
|
35
|
+
* @property {string} name String name of the challenge
|
|
36
|
+
* @property {number} reward Amount of XP upon challenge completion, always 3700 XP.
|
|
37
|
+
* @property {string} rewardType Type of reward. Always "MultipliedExperienceReward" here
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
module.exports = GameChallenges;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Quest = require('./Quest');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Game quests class
|
|
5
|
+
*/
|
|
6
|
+
class GameQuests {
|
|
7
|
+
/**
|
|
8
|
+
* @param {string} name game name
|
|
9
|
+
* @param {object} data data
|
|
10
|
+
*/
|
|
11
|
+
constructor(name, data) {
|
|
12
|
+
/**
|
|
13
|
+
* Name of game
|
|
14
|
+
* @type {StaticGameNames}
|
|
15
|
+
*/
|
|
16
|
+
this.game = name;
|
|
17
|
+
/**
|
|
18
|
+
* @type {Quest[]}
|
|
19
|
+
*/
|
|
20
|
+
this.quests = (data || []).map((x) => new Quest(x));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = GameQuests;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const Achievement = require('./Achievement.js');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Achievement class
|
|
5
|
+
*/
|
|
6
|
+
class GuildAchievements {
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} data data
|
|
9
|
+
*/
|
|
10
|
+
constructor(data) {
|
|
11
|
+
/**
|
|
12
|
+
* Last time this resource was updated
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
this.lastUpdatedTimestamp = parseInt(data.lastUpdated, 10);
|
|
16
|
+
/**
|
|
17
|
+
* Last time this resource was updated, as Date
|
|
18
|
+
* @type {Date|null}
|
|
19
|
+
*/
|
|
20
|
+
this.lastUpdatedAt = new Date(this.lastUpdatedTimestamp);
|
|
21
|
+
/**
|
|
22
|
+
* Achievements
|
|
23
|
+
* @type {Record<string, Achievement>}
|
|
24
|
+
*/
|
|
25
|
+
this.achievements = Object.fromEntries(
|
|
26
|
+
Object.entries({ ...(data.tiered || {}), ...(data.one_time || {}) }).map(([name, value]) => [
|
|
27
|
+
name,
|
|
28
|
+
new Achievement(name, value)
|
|
29
|
+
])
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = GuildAchievements;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quest Class
|
|
3
|
+
*/
|
|
4
|
+
class Quest {
|
|
5
|
+
/**
|
|
6
|
+
* constructor
|
|
7
|
+
* @param {Object} data
|
|
8
|
+
*/
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* Name of quest, trimmed trailing spaces
|
|
12
|
+
* @type {string}
|
|
13
|
+
*/
|
|
14
|
+
this.questName = data.name.trim();
|
|
15
|
+
/**
|
|
16
|
+
* ID of quest
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
this.questID = data.id;
|
|
20
|
+
/**
|
|
21
|
+
* Description, trimmed trailing spaces
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
this.description = data.description.trim();
|
|
25
|
+
/**
|
|
26
|
+
* Type of quest
|
|
27
|
+
* @type {'DAILY'|'WEEKLY'}
|
|
28
|
+
*/
|
|
29
|
+
this.type = 'DailyResetQuestRequirement' === data.requirements?.[0].type ? 'DAILY' : 'WEEKLY';
|
|
30
|
+
/**
|
|
31
|
+
* Objectives
|
|
32
|
+
* @type {Objective[]}
|
|
33
|
+
*/
|
|
34
|
+
this.objectives = data.objectives.map((objective) => ({
|
|
35
|
+
id: objective.id,
|
|
36
|
+
type: 'IntegerObjective' === objective.type ? 'Integer' : 'Boolean',
|
|
37
|
+
amountNeeded: parseInt(objective.integer || '1', 10)
|
|
38
|
+
}));
|
|
39
|
+
/**
|
|
40
|
+
* Rewards for this quest
|
|
41
|
+
* @type {QuestReward[]}
|
|
42
|
+
*/
|
|
43
|
+
this.rewards = data.rewards || [];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* As string
|
|
47
|
+
* @return {string}
|
|
48
|
+
*/
|
|
49
|
+
toString() {
|
|
50
|
+
return this.questName;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} Objective
|
|
56
|
+
* @property {string} id ID
|
|
57
|
+
* @property {'Integer'|'Boolean'} type Integer: a certain amount of something (i.e kills) is needed; Boolean: a condition needs to be fulfilled
|
|
58
|
+
* @property {number} amountNeeded a Boolean-typed objective will have this set to 1. (instead of null in API)
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} QuestReward
|
|
62
|
+
* @property {string} type Types of reward.
|
|
63
|
+
* @property {number} amount Amount
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
module.exports = Quest;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const GameQuests = require('./GameQuests.js');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Quest class
|
|
5
|
+
*/
|
|
6
|
+
class Quests {
|
|
7
|
+
/**
|
|
8
|
+
* @param {object} data data
|
|
9
|
+
*/
|
|
10
|
+
constructor(data) {
|
|
11
|
+
/**
|
|
12
|
+
* Last time this resource was updated
|
|
13
|
+
* @type {number}
|
|
14
|
+
*/
|
|
15
|
+
this.lastUpdatedTimestamp = parseInt(data.lastUpdated, 10);
|
|
16
|
+
/**
|
|
17
|
+
* Last time this resource was updated, as Date
|
|
18
|
+
* @type {Date|null}
|
|
19
|
+
*/
|
|
20
|
+
this.lastUpdatedAt = new Date(this.lastUpdatedTimestamp);
|
|
21
|
+
/**
|
|
22
|
+
* Quests per game
|
|
23
|
+
* @type {Record<StaticGameNames, GameQuests>}
|
|
24
|
+
*/
|
|
25
|
+
this.questsPerGame = Object.fromEntries(
|
|
26
|
+
Object.entries(data.quests).map(([game, data]) => [game, new GameQuests(game, data)])
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = Quests;
|
package/src/structures/Status.js
CHANGED
|
@@ -23,12 +23,12 @@ class Status {
|
|
|
23
23
|
* Game mode
|
|
24
24
|
* @type {string|null}
|
|
25
25
|
*/
|
|
26
|
-
this.mode = data.mode
|
|
26
|
+
this.mode = data.mode ?? null;
|
|
27
27
|
/**
|
|
28
28
|
* Map
|
|
29
29
|
* @type {string|null}
|
|
30
30
|
*/
|
|
31
|
-
this.map = data.map
|
|
31
|
+
this.map = data.map ?? null;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Online Status
|