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/src/structures/Player.js
CHANGED
|
@@ -13,8 +13,6 @@ const VampireZ = require('./MiniGames/VampireZ');
|
|
|
13
13
|
const BlitzSurvivalGames = require('./MiniGames/BlitzSurvivalGames');
|
|
14
14
|
const ArenaBrawl = require('./MiniGames/ArenaBrawl');
|
|
15
15
|
const Arcade = require('./MiniGames/Arcade');
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
-
const Pit = require('./MiniGames/Pit');
|
|
18
16
|
const Color = require('./Color');
|
|
19
17
|
const Game = require('./Game');
|
|
20
18
|
const PlayerCosmetics = require('./PlayerCosmetics');
|
|
@@ -25,6 +23,7 @@ const Quakecraft = require('./MiniGames/Quakecraft');
|
|
|
25
23
|
const Walls = require('./MiniGames/Walls');
|
|
26
24
|
const Warlords = require('./MiniGames/Warlords');
|
|
27
25
|
const WoolWars = require('./MiniGames/WoolWars');
|
|
26
|
+
const Pit = require('./MiniGames/Pit');
|
|
28
27
|
/**
|
|
29
28
|
* Player class
|
|
30
29
|
*/
|
|
@@ -44,21 +43,11 @@ class Player {
|
|
|
44
43
|
* @type {string}
|
|
45
44
|
*/
|
|
46
45
|
this.uuid = data.uuid;
|
|
47
|
-
/**
|
|
48
|
-
* Player nickname history known to Hypixel
|
|
49
|
-
* @type {Array<string>}
|
|
50
|
-
*/
|
|
51
|
-
this.history = data.knownAliases;
|
|
52
46
|
/**
|
|
53
47
|
* Player rank
|
|
54
48
|
* @type {PlayerRank}
|
|
55
49
|
*/
|
|
56
50
|
this.rank = getRank(data);
|
|
57
|
-
/**
|
|
58
|
-
* Player minecraft version
|
|
59
|
-
* @type {string|null}
|
|
60
|
-
*/
|
|
61
|
-
this.mcVersion = data.mcVersionRp || null;
|
|
62
51
|
/**
|
|
63
52
|
* Current chat channel, usually ALL, PARTY, or GUILD
|
|
64
53
|
* @type {string|null}
|
|
@@ -75,12 +64,12 @@ class Player {
|
|
|
75
64
|
*/
|
|
76
65
|
this.firstLogin = data.firstLogin ? new Date(data.firstLogin) : null;
|
|
77
66
|
/**
|
|
78
|
-
*
|
|
67
|
+
* Timestamp when player last logged in as Date
|
|
79
68
|
* @type {Game|null}
|
|
80
69
|
*/
|
|
81
70
|
this.lastLoginTimestamp = data.lastLogin || null;
|
|
82
71
|
/**
|
|
83
|
-
* Timestamp when player first logged in
|
|
72
|
+
* Timestamp when player first logged in unix
|
|
84
73
|
* @type {number|null}
|
|
85
74
|
*/
|
|
86
75
|
this.lastLogin = data.lastLogin ? new Date(data.lastLogin) : null;
|
|
@@ -90,8 +79,8 @@ class Player {
|
|
|
90
79
|
*/
|
|
91
80
|
this.lastLogoutTimestamp = data.lastLogout || null;
|
|
92
81
|
/**
|
|
93
|
-
* Timestamp when player first logged in
|
|
94
|
-
* @type {
|
|
82
|
+
* Timestamp when player first logged in unix
|
|
83
|
+
* @type {number|null}
|
|
95
84
|
*/
|
|
96
85
|
this.lastLogout = data.lastLogout ? new Date(data.lastLogout) : null;
|
|
97
86
|
/**
|
|
@@ -103,12 +92,18 @@ class Player {
|
|
|
103
92
|
* Player's plus color (must be a MVP+ rank)
|
|
104
93
|
* @type {Color|null}
|
|
105
94
|
*/
|
|
106
|
-
this.plusColor =
|
|
95
|
+
this.plusColor =
|
|
96
|
+
this.rank === 'MVP+' || this.rank === 'MVP++'
|
|
97
|
+
? data.rankPlusColor
|
|
98
|
+
? new Color(data.rankPlusColor)
|
|
99
|
+
: new Color('RED')
|
|
100
|
+
: null;
|
|
107
101
|
/**
|
|
108
102
|
* MVP++ prefix color
|
|
109
103
|
* @type {Color|null}
|
|
110
104
|
*/
|
|
111
|
-
this.prefixColor =
|
|
105
|
+
this.prefixColor =
|
|
106
|
+
this.rank === 'MVP++' ? (data.monthlyRankColor ? new Color(data.monthlyRankColor) : new Color('GOLD')) : null;
|
|
112
107
|
/**
|
|
113
108
|
* Player karma
|
|
114
109
|
* @type {number}
|
|
@@ -236,7 +231,7 @@ class Player {
|
|
|
236
231
|
walls: data.stats.Walls ? new Walls(data.stats.Walls) : null,
|
|
237
232
|
warlords: data.stats.Battleground ? new Warlords(data.stats.Battleground) : null,
|
|
238
233
|
woolwars: data.stats.WoolGames ? new WoolWars(data.stats.WoolGames) : null,
|
|
239
|
-
pit: null
|
|
234
|
+
pit: data.stats.Pit ? new Pit(data.stats.Pit) : null
|
|
240
235
|
}
|
|
241
236
|
: null;
|
|
242
237
|
/**
|
|
@@ -348,8 +343,8 @@ function playerLevelProgress(player) {
|
|
|
348
343
|
const percentRemaining = Math.round((100 - percent) * 100) / 100;
|
|
349
344
|
return {
|
|
350
345
|
xpToNext,
|
|
351
|
-
currentXP,
|
|
352
346
|
remainingXP,
|
|
347
|
+
currentXP,
|
|
353
348
|
percent,
|
|
354
349
|
percentRemaining
|
|
355
350
|
};
|
|
@@ -413,6 +408,7 @@ function parseClaimedRewards(data) {
|
|
|
413
408
|
* @property {BlitzSurvivalGames|null} blitzsg Blitz Survival Games
|
|
414
409
|
* @property {ArenaBrawl|null} arena Arena Brawl
|
|
415
410
|
* @property {Arcade|null} arcade Arcade
|
|
411
|
+
* @property {WoolWars|null} woolwars Wool Wars
|
|
416
412
|
*/
|
|
417
413
|
/**
|
|
418
414
|
* @typedef {Object} RanksPurchaseTime
|
|
@@ -12,7 +12,7 @@ class PlayerCosmetics {
|
|
|
12
12
|
* All cosmetics
|
|
13
13
|
* @type {string[]}
|
|
14
14
|
*/
|
|
15
|
-
this.allCosmetics = data
|
|
15
|
+
this.allCosmetics = data?.vanityMeta?.packages || undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Pets
|
|
18
18
|
* @type {Pets|null}
|
|
@@ -29,7 +29,13 @@ class PlayerCosmetics {
|
|
|
29
29
|
* @type {string[]}
|
|
30
30
|
*/
|
|
31
31
|
get suits() {
|
|
32
|
-
if (!this._suits)
|
|
32
|
+
if (!this._suits) {
|
|
33
|
+
this._suits = this.allCosmetics
|
|
34
|
+
? this.allCosmetics
|
|
35
|
+
.filter((x) => x.startsWith('suit_'))
|
|
36
|
+
.map((x) => removeSnakeCaseString(x.replace('suit_', ''))) || []
|
|
37
|
+
: [];
|
|
38
|
+
}
|
|
33
39
|
return this._suits;
|
|
34
40
|
}
|
|
35
41
|
/**
|
|
@@ -37,7 +43,13 @@ class PlayerCosmetics {
|
|
|
37
43
|
* @type {string[]}
|
|
38
44
|
*/
|
|
39
45
|
get hats() {
|
|
40
|
-
if (!this._hats)
|
|
46
|
+
if (!this._hats) {
|
|
47
|
+
this._hats = this.allCosmetics
|
|
48
|
+
? this.allCosmetics
|
|
49
|
+
.filter((x) => x.startsWith('hat_'))
|
|
50
|
+
.map((x) => removeSnakeCaseString(x.replace('hat_', ''))) || []
|
|
51
|
+
: [];
|
|
52
|
+
}
|
|
41
53
|
return this._hats;
|
|
42
54
|
}
|
|
43
55
|
/**
|
|
@@ -45,7 +57,13 @@ class PlayerCosmetics {
|
|
|
45
57
|
* @type {string[]}
|
|
46
58
|
*/
|
|
47
59
|
get gadgets() {
|
|
48
|
-
if (!this._gadgets)
|
|
60
|
+
if (!this._gadgets) {
|
|
61
|
+
this._gadgets = this.allCosmetics
|
|
62
|
+
? this.allCosmetics
|
|
63
|
+
.filter((x) => x.startsWith('gadget_'))
|
|
64
|
+
.map((x) => removeSnakeCaseString(x.replace('gadget_', ''))) || []
|
|
65
|
+
: [];
|
|
66
|
+
}
|
|
49
67
|
return this._gadgets;
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
@@ -53,7 +71,13 @@ class PlayerCosmetics {
|
|
|
53
71
|
* @type {string[]}
|
|
54
72
|
*/
|
|
55
73
|
get morphs() {
|
|
56
|
-
if (!this._morphs)
|
|
74
|
+
if (!this._morphs) {
|
|
75
|
+
this._morphs = this.allCosmetics
|
|
76
|
+
? this.allCosmetics
|
|
77
|
+
.filter((x) => x.startsWith('morph_'))
|
|
78
|
+
.map((x) => removeSnakeCaseString(x.replace('morph_', ''))) || []
|
|
79
|
+
: [];
|
|
80
|
+
}
|
|
57
81
|
return this._morphs;
|
|
58
82
|
}
|
|
59
83
|
/**
|
|
@@ -61,7 +85,13 @@ class PlayerCosmetics {
|
|
|
61
85
|
* @type {string[]}
|
|
62
86
|
*/
|
|
63
87
|
get cloaks() {
|
|
64
|
-
if (!this._cloaks)
|
|
88
|
+
if (!this._cloaks) {
|
|
89
|
+
this._cloaks = this.allCosmetics
|
|
90
|
+
? this.allCosmetics
|
|
91
|
+
.filter((x) => x.startsWith('cloak_'))
|
|
92
|
+
.map((x) => removeSnakeCaseString(x.replace('cloak_', ''))) || []
|
|
93
|
+
: [];
|
|
94
|
+
}
|
|
65
95
|
return this._cloaks;
|
|
66
96
|
}
|
|
67
97
|
/**
|
|
@@ -69,7 +99,13 @@ class PlayerCosmetics {
|
|
|
69
99
|
* @type {string[]}
|
|
70
100
|
*/
|
|
71
101
|
get taunts() {
|
|
72
|
-
if (!this._taunts)
|
|
102
|
+
if (!this._taunts) {
|
|
103
|
+
this._taunts = this.allCosmetics
|
|
104
|
+
? this.allCosmetics
|
|
105
|
+
.filter((x) => x.startsWith('taunt_'))
|
|
106
|
+
.map((x) => removeSnakeCaseString(x.replace('taunt_', ''))) || []
|
|
107
|
+
: [];
|
|
108
|
+
}
|
|
73
109
|
return this._taunts;
|
|
74
110
|
}
|
|
75
111
|
/**
|
|
@@ -77,7 +113,13 @@ class PlayerCosmetics {
|
|
|
77
113
|
* @type {string[]}
|
|
78
114
|
*/
|
|
79
115
|
get rankColors() {
|
|
80
|
-
if (!this._rankcolors)
|
|
116
|
+
if (!this._rankcolors) {
|
|
117
|
+
this._rankcolors = this.allCosmetics
|
|
118
|
+
? this.allCosmetics
|
|
119
|
+
.filter((x) => x.startsWith('rankcolor_'))
|
|
120
|
+
.map((x) => removeSnakeCaseString(x.replace('rankcolor_', ''))) || []
|
|
121
|
+
: [];
|
|
122
|
+
}
|
|
81
123
|
return this._rankcolors;
|
|
82
124
|
}
|
|
83
125
|
/**
|
|
@@ -85,7 +127,13 @@ class PlayerCosmetics {
|
|
|
85
127
|
* @type {string[]}
|
|
86
128
|
*/
|
|
87
129
|
get particlePacks() {
|
|
88
|
-
if (!this._particle)
|
|
130
|
+
if (!this._particle) {
|
|
131
|
+
this._particle = this.allCosmetics
|
|
132
|
+
? this.allCosmetics
|
|
133
|
+
.filter((x) => x.startsWith('particlepack_'))
|
|
134
|
+
.map((x) => removeSnakeCaseString(x.replace('particlepack_', ''))) || []
|
|
135
|
+
: [];
|
|
136
|
+
}
|
|
89
137
|
return this._particlepacks;
|
|
90
138
|
}
|
|
91
139
|
/**
|
|
@@ -93,7 +141,13 @@ class PlayerCosmetics {
|
|
|
93
141
|
* @type {string[]}
|
|
94
142
|
*/
|
|
95
143
|
get clickEffects() {
|
|
96
|
-
if (!this._clickfx)
|
|
144
|
+
if (!this._clickfx) {
|
|
145
|
+
this._clickfx = this.allCosmetics
|
|
146
|
+
? this.allCosmetics
|
|
147
|
+
.filter((x) => x.startsWith('clickeffects_'))
|
|
148
|
+
.map((x) => removeSnakeCaseString(x.replace('clickeffects_', ''))) || []
|
|
149
|
+
: [];
|
|
150
|
+
}
|
|
97
151
|
return this._clickfx;
|
|
98
152
|
}
|
|
99
153
|
}
|
|
@@ -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
|
}
|