hypixel-api-reborn 11.1.0 → 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 +3 -3
- package/README.md +5 -3
- package/package.json +20 -18
- 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} +9 -3
- package/src/API/skyblock/getMuseum.js +14 -0
- package/src/API/skyblock/{getSkyblockProfiles.js → getProfiles.js} +13 -7
- package/src/Client.js +88 -14
- package/src/Errors.js +38 -17
- package/src/Private/rateLimit.js +10 -2
- package/src/Private/requests.js +19 -7
- package/src/Private/updater.js +9 -5
- 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/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 +382 -41
- 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 +985 -295
- /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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const Bid = require('./Bid');
|
|
2
1
|
const BaseAuction = require('./BaseAuction');
|
|
2
|
+
const Bid = require('./Bid');
|
|
3
3
|
/**
|
|
4
4
|
* Auction class
|
|
5
5
|
*/
|
|
@@ -89,6 +89,7 @@ class Auction extends BaseAuction {
|
|
|
89
89
|
return this.item;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
|
|
92
93
|
/**
|
|
93
94
|
* @typedef {string} Rarity
|
|
94
95
|
* * `VERY_SPECIAL`
|
|
@@ -101,4 +102,5 @@ class Auction extends BaseAuction {
|
|
|
101
102
|
* * `UNCOMMON`
|
|
102
103
|
* * `COMMON`
|
|
103
104
|
*/
|
|
105
|
+
|
|
104
106
|
module.exports = Auction;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {require('./Static/BingoData.js')} BingoData
|
|
3
|
+
* @typedef {require('./Static/Bingo.js')} Bingo
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Player Bingo Class
|
|
8
|
+
*/
|
|
9
|
+
class PlayerBingo {
|
|
10
|
+
/**
|
|
11
|
+
* Constructor
|
|
12
|
+
* @param {Object} data data
|
|
13
|
+
* @param {BingoData|null} bingoData bingo data
|
|
14
|
+
*/
|
|
15
|
+
constructor(data, bingoData) {
|
|
16
|
+
const events = data.success && Array.isArray(data.events) ? data.events : [];
|
|
17
|
+
/**
|
|
18
|
+
* Data per event
|
|
19
|
+
* @type {PlayerBingoDataPerEvent}
|
|
20
|
+
*/
|
|
21
|
+
this.dataPerEvent = events.map((eventData) => {
|
|
22
|
+
let doneGoals = eventData.completed_goals;
|
|
23
|
+
if (!Array.isArray(doneGoals)) doneGoals = [];
|
|
24
|
+
const enrichable = parseInt(eventData.key, 10) === bingoData?.id;
|
|
25
|
+
if (enrichable) doneGoals = populateGoals(doneGoals, bingoData.goals);
|
|
26
|
+
return {
|
|
27
|
+
eventId: parseInt(eventData.key, 10) || null,
|
|
28
|
+
points: parseInt(eventData.points, 10) || 0,
|
|
29
|
+
goalsCompleted: doneGoals,
|
|
30
|
+
enrichedGoals: enrichable
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line require-jsdoc
|
|
37
|
+
function populateGoals(achieved, all) {
|
|
38
|
+
const populatedAchieved = [];
|
|
39
|
+
const unachieved = [];
|
|
40
|
+
for (const goal of all) {
|
|
41
|
+
if (achieved.find((str) => str === goal.name)) populatedAchieved.push(goal);
|
|
42
|
+
else unachieved.push(goal);
|
|
43
|
+
}
|
|
44
|
+
populatedAchieved.unachievedGoals = unachieved;
|
|
45
|
+
return populatedAchieved;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {Object} PlayerBingoDataPerEvent
|
|
50
|
+
* @property {number} eventId ID of event
|
|
51
|
+
* @property {number} points Points acquired
|
|
52
|
+
* @property {boolean} enrichedGoals Whether the goals are enriched (populated with data from static skyblock bingp data)
|
|
53
|
+
* @property {Bingo[]|string[]} goalsCompleted Special Bingo Array if enrichedGoals is true. You can however always treat SpecialBingoArray as string[]
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
module.exports = PlayerBingo;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const rgbToHexColor = require('../../utils/rgbToHexColor');
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Item class
|
|
5
3
|
*/
|
|
@@ -22,12 +20,13 @@ class SkyblockInventoryItem {
|
|
|
22
20
|
* Item name
|
|
23
21
|
* @type {string}
|
|
24
22
|
*/
|
|
25
|
-
this.name =
|
|
23
|
+
this.name =
|
|
24
|
+
data.tag.display.Name !== null ? data.tag.display.Name.toString().replace(/§([1-9]|[a-f])|§/gm, '') : null;
|
|
26
25
|
/**
|
|
27
26
|
* Item lore
|
|
28
27
|
* @type {string}
|
|
29
28
|
*/
|
|
30
|
-
this.lore = data.tag.display.Lore.join('
|
|
29
|
+
this.lore = data.tag.display.Lore.join('\n');
|
|
31
30
|
/**
|
|
32
31
|
* Item lore
|
|
33
32
|
* @type {string[]}
|
|
@@ -40,19 +39,19 @@ class SkyblockInventoryItem {
|
|
|
40
39
|
this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
|
|
41
40
|
/**
|
|
42
41
|
* Hexadecimal color code of armor
|
|
43
|
-
* @type {string}
|
|
42
|
+
* @type {string|null}
|
|
44
43
|
*/
|
|
45
|
-
this.color = data.tag.ExtraAttributes.color
|
|
44
|
+
this.color = data.tag.ExtraAttributes.color ?? data.tag.display.color ?? null;
|
|
46
45
|
/**
|
|
47
46
|
* Item enchantments
|
|
48
|
-
* @type {
|
|
47
|
+
* @type {Record<string, number>}
|
|
49
48
|
*/
|
|
50
|
-
this.enchantments = data.tag.ExtraAttributes.enchantments
|
|
49
|
+
this.enchantments = data.tag.ExtraAttributes.enchantments ?? null;
|
|
51
50
|
/**
|
|
52
51
|
* Armor reforge
|
|
53
52
|
* @type {string}
|
|
54
53
|
*/
|
|
55
|
-
this.reforge = data.tag.ExtraAttributes.modifier
|
|
54
|
+
this.reforge = data.tag.ExtraAttributes.modifier ?? null;
|
|
56
55
|
/**
|
|
57
56
|
* Equipment gemstones (if any)
|
|
58
57
|
* @type {SkyblockItemGemstone}
|
|
@@ -60,14 +59,9 @@ class SkyblockInventoryItem {
|
|
|
60
59
|
this.gemstones = data.tag.ExtraAttributes.gems
|
|
61
60
|
? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => {
|
|
62
61
|
// eslint-disable-next-line no-new-object
|
|
63
|
-
new Object({ type: gem[0].split('_')[0], quality: gem[1] });
|
|
62
|
+
return new Object({ type: gem[0].split('_')[0], quality: gem[1] });
|
|
64
63
|
})
|
|
65
64
|
: null;
|
|
66
|
-
/**
|
|
67
|
-
* Anvil uses
|
|
68
|
-
* @type {number}
|
|
69
|
-
*/
|
|
70
|
-
this.anvilUses = data.tag.ExtraAttributes.anvil_uses ? data.tag.ExtraAttributes.anvil_uses : 0;
|
|
71
65
|
/**
|
|
72
66
|
* Damage
|
|
73
67
|
* @type {number}
|
|
@@ -82,16 +76,80 @@ class SkyblockInventoryItem {
|
|
|
82
76
|
this.rarity = parseRarity(this.loreArray[this.loreArray.length - 1]);
|
|
83
77
|
/**
|
|
84
78
|
* The amount of dungeon stars the item has (each star equates to a 10% stat boost while in dungeons)
|
|
85
|
-
* @author linearaccelerator
|
|
86
79
|
* @type {number}
|
|
87
80
|
*/
|
|
88
|
-
this.dungeonStars =
|
|
81
|
+
this.dungeonStars = data.tag.ExtraAttributes.upgrade_level ?? 0;
|
|
89
82
|
/**
|
|
90
83
|
* Dungeon gear score of the item (or null if not present)
|
|
91
84
|
* @author linearaccelerator
|
|
92
85
|
* @type {number}
|
|
93
86
|
*/
|
|
94
87
|
this.gearScore = parseGearScore(this.loreArray) || null;
|
|
88
|
+
/**
|
|
89
|
+
* UUID of the item
|
|
90
|
+
* @type {string}
|
|
91
|
+
*/
|
|
92
|
+
this.uuid = data.tag.ExtraAttributes.uuid ?? '';
|
|
93
|
+
/**
|
|
94
|
+
* Is the item soulbound
|
|
95
|
+
* @type {boolean}
|
|
96
|
+
*/
|
|
97
|
+
this.soulbound = data.tag.ExtraAttributes.donated_museum === 1;
|
|
98
|
+
/**
|
|
99
|
+
* Amount of art of war books applied to the item
|
|
100
|
+
* @type {number}
|
|
101
|
+
*/
|
|
102
|
+
this.artOfWar = data.tag.ExtraAttributes.art_of_war_count ?? 0;
|
|
103
|
+
/**
|
|
104
|
+
* Rune
|
|
105
|
+
* @type {object}
|
|
106
|
+
*/
|
|
107
|
+
this.rune = data.tag.ExtraAttributes.runes ?? null;
|
|
108
|
+
/**
|
|
109
|
+
* The amount of applied potato books
|
|
110
|
+
* @type {number}
|
|
111
|
+
*/
|
|
112
|
+
this.hotPotatoBooks = data.tag.ExtraAttributes.hot_potato_count ?? 0;
|
|
113
|
+
/**
|
|
114
|
+
* Is the item recombobulated
|
|
115
|
+
* @type {boolean}
|
|
116
|
+
*/
|
|
117
|
+
this.recombobulated = data.tag.ExtraAttributes.rarity_upgrades === 1;
|
|
118
|
+
/**
|
|
119
|
+
* Item attributes
|
|
120
|
+
* @type {object}
|
|
121
|
+
*/
|
|
122
|
+
this.attributes = data.tag.ExtraAttributes.attributes ?? {};
|
|
123
|
+
/**
|
|
124
|
+
* Hecatomb runs
|
|
125
|
+
* @type {number}
|
|
126
|
+
*/
|
|
127
|
+
this.hecatomb = data.tag.ExtraAttributes.hecatomb_s_runs ?? 0;
|
|
128
|
+
/**
|
|
129
|
+
* Champion xp
|
|
130
|
+
* @type {number}
|
|
131
|
+
*/
|
|
132
|
+
this.champion = data.tag.ExtraAttributes.champion_combat_xp ?? 0;
|
|
133
|
+
/**
|
|
134
|
+
* Cultivating
|
|
135
|
+
* @type {number}
|
|
136
|
+
*/
|
|
137
|
+
this.cultivating = data.tag.ExtraAttributes.farmed_cultivating ?? 0;
|
|
138
|
+
/**
|
|
139
|
+
* Expertise Kills
|
|
140
|
+
* @type {number}
|
|
141
|
+
*/
|
|
142
|
+
this.expertise = data.tag.ExtraAttributes.expertise_kills ?? 0;
|
|
143
|
+
/**
|
|
144
|
+
* Compact blocks Mined
|
|
145
|
+
* @type {number}
|
|
146
|
+
*/
|
|
147
|
+
this.compact = data.tag.ExtraAttributes.compact_blocks ?? 0;
|
|
148
|
+
/**
|
|
149
|
+
* Armadillos Blocks Walked
|
|
150
|
+
* @type {number}
|
|
151
|
+
*/
|
|
152
|
+
this.blocksWalked = data.tag.ExtraAttributes.blocks_walked ?? 0;
|
|
95
153
|
}
|
|
96
154
|
/**
|
|
97
155
|
* Item Name
|
|
@@ -103,7 +161,17 @@ class SkyblockInventoryItem {
|
|
|
103
161
|
}
|
|
104
162
|
// eslint-disable-next-line require-jsdoc
|
|
105
163
|
function parseRarity(stringContainingRarity) {
|
|
106
|
-
const rarityArray = [
|
|
164
|
+
const rarityArray = [
|
|
165
|
+
'COMMON',
|
|
166
|
+
'UNCOMMON',
|
|
167
|
+
'RARE',
|
|
168
|
+
'EPIC',
|
|
169
|
+
'LEGENDARY',
|
|
170
|
+
'MYTHIC',
|
|
171
|
+
'DIVINE',
|
|
172
|
+
'SPECIAL',
|
|
173
|
+
'VERY SPECIAL'
|
|
174
|
+
];
|
|
107
175
|
for (const rarity of rarityArray) {
|
|
108
176
|
if (stringContainingRarity.includes(rarity)) return rarity;
|
|
109
177
|
}
|