hypixel-api-reborn 8.3.0 → 10.0.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 +2 -2
- package/package.json +9 -9
- package/src/API/getAPIStatus.js +2 -1
- package/src/API/getBoosters.js +1 -0
- package/src/API/getFriends.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +4 -2
- package/src/API/getKeyInfo.js +1 -0
- package/src/API/getLeaderboards.js +1 -0
- package/src/API/getPlayer.js +18 -3
- package/src/API/getRankedSkyWars.js +11 -0
- package/src/API/getRecentGames.js +1 -0
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/index.js +23 -9
- package/src/API/skyblock/getEndedSkyblockAuctions.js +1 -0
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +1 -0
- package/src/API/skyblock/getSkyblockBazaar.js +1 -0
- package/src/API/skyblock/getSkyblockMember.js +1 -0
- package/src/API/skyblock/getSkyblockNews.js +1 -0
- package/src/API/skyblock/getSkyblockProfiles.js +1 -0
- package/src/Client.js +57 -13
- package/src/Errors.js +3 -1
- package/src/Private/defaultCache.js +78 -0
- package/src/Private/rateLimit.js +4 -4
- package/src/Private/requests.js +24 -9
- package/src/Private/updater.js +45 -0
- package/src/Private/validate.js +6 -4
- package/src/structures/Game.js +3 -3
- package/src/structures/Guild/Guild.js +7 -1
- package/src/structures/MiniGames/Arcade.js +8 -8
- package/src/structures/MiniGames/BedWars.js +22 -0
- package/src/structures/MiniGames/Duels.js +291 -60
- package/src/structures/MiniGames/SkyWars.js +14 -6
- package/src/structures/MiniGames/SkyWarsRanked.js +45 -0
- package/src/structures/MiniGames/TurboKartRacers.js +130 -0
- package/src/structures/Player.js +15 -23
- package/src/structures/ServerInfo.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +4 -4
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +29 -1
- package/src/structures/SkyBlock/SkyblockMember.js +25 -13
- package/src/utils/Constants.js +14 -0
- package/src/utils/index.js +13 -9
- package/src/utils/rgbToHexColor.js +8 -0
- package/src/utils/romanize.js +13 -0
- package/src/utils/varInt.js +1 -1
- package/typings/index.d.ts +423 -358
|
@@ -41,6 +41,136 @@ class TurboKartRacers {
|
|
|
41
41
|
* @type {number}
|
|
42
42
|
*/
|
|
43
43
|
this.boxPickups = data.box_pickups || 0;
|
|
44
|
+
/**
|
|
45
|
+
* Horn
|
|
46
|
+
* @type {'DEFAULT' | 'SHY' | 'ALIEN' | 'TAXI' | 'KLAXON' | 'TRICYCLE' | 'ALARM' | 'KLOON' | 'TEDDY' | 'TRUCK' | 'JERRY'}
|
|
47
|
+
*/
|
|
48
|
+
this.horn = data.horn || 'DEFAULT';
|
|
49
|
+
/**
|
|
50
|
+
* Retro Map Plays
|
|
51
|
+
* @type {number}
|
|
52
|
+
*/
|
|
53
|
+
this.retroPlays = data.retro_plays || 0;
|
|
54
|
+
/**
|
|
55
|
+
* Hypixel GP Map Plays
|
|
56
|
+
* @type {number}
|
|
57
|
+
*/
|
|
58
|
+
this.hypixelgpPlays = data.hypixelgp_plays || 0;
|
|
59
|
+
/**
|
|
60
|
+
* Olympus Map Plays
|
|
61
|
+
* @type {number}
|
|
62
|
+
*/
|
|
63
|
+
this.olympusPlays = data.olympus_plays || 0;
|
|
64
|
+
/**
|
|
65
|
+
* Jungle Rush Map Plays
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
this.junglerushPlays = data.junglerush_plays || 0;
|
|
69
|
+
/**
|
|
70
|
+
* Canyon Map Plays
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
this.canyonPlays = data.canyon_plays || 0;
|
|
74
|
+
/**
|
|
75
|
+
* Retro Bronze Trophies
|
|
76
|
+
* @type {number}
|
|
77
|
+
*/
|
|
78
|
+
this.retroBronzeTrophies = data.bronze_trophy_retro || 0;
|
|
79
|
+
/**
|
|
80
|
+
* Jungle Rush Map Plays
|
|
81
|
+
* @type {number}
|
|
82
|
+
*/
|
|
83
|
+
this.retroSilverTrophies = data.silver_trophy_retro || 0;
|
|
84
|
+
/**
|
|
85
|
+
* Jungle Rush Map Plays
|
|
86
|
+
* @type {number}
|
|
87
|
+
*/
|
|
88
|
+
this.retroGoldTrophies = data.gold_trophy_retro || 0;
|
|
89
|
+
/**
|
|
90
|
+
* hypixelgp Bronze Trophies
|
|
91
|
+
* @type {number}
|
|
92
|
+
*/
|
|
93
|
+
this.hypixelgpBronzeTrophies = data.bronze_trophy_hypixelgp || 0;
|
|
94
|
+
/**
|
|
95
|
+
* hypixelgp Silver Trophies
|
|
96
|
+
* @type {number}
|
|
97
|
+
*/
|
|
98
|
+
this.hypixelgpSilverTrophies = data.silver_trophy_hypixelgp || 0;
|
|
99
|
+
/**
|
|
100
|
+
* hypixelgp Gold Trophies
|
|
101
|
+
* @type {number}
|
|
102
|
+
*/
|
|
103
|
+
this.hypixelgpGoldTrophies = data.gold_trophy_hypixelgp || 0;
|
|
104
|
+
/**
|
|
105
|
+
* olympus Bronze Trophies
|
|
106
|
+
* @type {number}
|
|
107
|
+
*/
|
|
108
|
+
this.olympusBronzeTrophies = data.bronze_trophy_olympus || 0;
|
|
109
|
+
/**
|
|
110
|
+
* olympus Silver Trophies
|
|
111
|
+
* @type {number}
|
|
112
|
+
*/
|
|
113
|
+
this.olympusSilverTrophies = data.silver_trophy_olympus || 0;
|
|
114
|
+
/**
|
|
115
|
+
* olympus Gold Trophies
|
|
116
|
+
* @type {number}
|
|
117
|
+
*/
|
|
118
|
+
this.olympusGoldTrophies = data.gold_trophy_olympus || 0;
|
|
119
|
+
/**
|
|
120
|
+
* junglerush Bronze Trophies
|
|
121
|
+
* @type {number}
|
|
122
|
+
*/
|
|
123
|
+
this.junglerushBronzeTrophies = data.bronze_trophy_junglerush || 0;
|
|
124
|
+
/**
|
|
125
|
+
* junglerush Silver Trophies
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
this.junglerushSilverTrophies = data.silver_trophy_junglerush || 0;
|
|
129
|
+
/**
|
|
130
|
+
* junglerush Gold Trophies
|
|
131
|
+
* @type {number}
|
|
132
|
+
*/
|
|
133
|
+
this.junglerushGoldTrophies = data.gold_trophy_junglerush || 0;
|
|
134
|
+
/**
|
|
135
|
+
* Canyon Bronze Trophies
|
|
136
|
+
* @type {number}
|
|
137
|
+
*/
|
|
138
|
+
this.canyonBronzeTrophies = data.gold_trophy_canyon || 0;
|
|
139
|
+
/**
|
|
140
|
+
* Canyon Silver Trophies
|
|
141
|
+
* @type {number}
|
|
142
|
+
*/
|
|
143
|
+
this.canyonSilverTrophies = data.gold_trophy_canyon || 0;
|
|
144
|
+
/**
|
|
145
|
+
* Canyon Gold Trophies
|
|
146
|
+
* @type {number}
|
|
147
|
+
*/
|
|
148
|
+
this.canyonGoldTrophies = data.gold_trophy_canyon || 0;
|
|
149
|
+
/**
|
|
150
|
+
* Bananas Recived
|
|
151
|
+
* @type {number}
|
|
152
|
+
*/
|
|
153
|
+
this.bananaHitsReceived = data.banana_hits_received || 0;
|
|
154
|
+
/**
|
|
155
|
+
* Bananas Sent
|
|
156
|
+
* @type {number}
|
|
157
|
+
*/
|
|
158
|
+
this.bananaHitsSent = data.banana_hits_sent || 0;
|
|
159
|
+
/**
|
|
160
|
+
* Blue Torpedos Hit
|
|
161
|
+
* @type {number}
|
|
162
|
+
*/
|
|
163
|
+
this.blueTorpedoHit = data.blue_torpedo_hit || 0;
|
|
164
|
+
/**
|
|
165
|
+
* Grand Prix Status
|
|
166
|
+
* @type {boolean}
|
|
167
|
+
*/
|
|
168
|
+
this.grandPrix = data.grand_prix || 'false';
|
|
169
|
+
/**
|
|
170
|
+
* Grand Prix Tokens
|
|
171
|
+
* @type {number}
|
|
172
|
+
*/
|
|
173
|
+
this.grandPrixTokens = data.grand_prix_tokens || 0;
|
|
44
174
|
}
|
|
45
175
|
}
|
|
46
176
|
module.exports = TurboKartRacers;
|
package/src/structures/Player.js
CHANGED
|
@@ -15,7 +15,6 @@ const ArenaBrawl = require('./MiniGames/ArenaBrawl');
|
|
|
15
15
|
const Arcade = require('./MiniGames/Arcade');
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
17
|
const Pit = require('./MiniGames/Pit');
|
|
18
|
-
const getRecentGames = require('../API/getRecentGames');
|
|
19
18
|
const Color = require('./Color');
|
|
20
19
|
const Game = require('./Game');
|
|
21
20
|
const PlayerCosmetics = require('./PlayerCosmetics');
|
|
@@ -31,9 +30,9 @@ const Warlords = require('./MiniGames/Warlords');
|
|
|
31
30
|
class Player {
|
|
32
31
|
/**
|
|
33
32
|
* @param {object} data Player data
|
|
34
|
-
* @param {
|
|
33
|
+
* @param {Record<string, any>} extraPayload extra data requested alongside player
|
|
35
34
|
*/
|
|
36
|
-
constructor (data,
|
|
35
|
+
constructor (data, extraPayload) {
|
|
37
36
|
/**
|
|
38
37
|
* Player nickname
|
|
39
38
|
* @type {string}
|
|
@@ -103,18 +102,12 @@ class Player {
|
|
|
103
102
|
* Player's plus color (must be a MVP+ rank)
|
|
104
103
|
* @type {Color|null}
|
|
105
104
|
*/
|
|
106
|
-
this.plusColor = this.rank === 'MVP+' || this.rank === 'MVP++' ? (data.rankPlusColor ? new Color(data.rankPlusColor) :
|
|
105
|
+
this.plusColor = this.rank === 'MVP+' || this.rank === 'MVP++' ? (data.rankPlusColor ? new Color(data.rankPlusColor) : new Color('RED')) : null;
|
|
107
106
|
/**
|
|
108
107
|
* MVP++ prefix color
|
|
109
108
|
* @type {Color|null}
|
|
110
109
|
*/
|
|
111
110
|
this.prefixColor = this.rank === 'MVP++' ? (data.monthlyRankColor ? new Color(data.monthlyRankColor) : new Color('GOLD')) : null;
|
|
112
|
-
/**
|
|
113
|
-
* Player's guild. Guild option must be `true`. <br>
|
|
114
|
-
* Example: {@link Client#getPlayer}
|
|
115
|
-
* @type {Guild}
|
|
116
|
-
*/
|
|
117
|
-
this.guild = data.guild ? data.guild : null;
|
|
118
111
|
/**
|
|
119
112
|
* Player karma
|
|
120
113
|
* @type {number}
|
|
@@ -206,18 +199,21 @@ class Player {
|
|
|
206
199
|
*/
|
|
207
200
|
this.levelProgress = playerLevelProgress(data);
|
|
208
201
|
/**
|
|
209
|
-
* Player
|
|
210
|
-
* @
|
|
202
|
+
* Player's Guild if requested in options
|
|
203
|
+
* @type {Guild|null}
|
|
211
204
|
*/
|
|
212
|
-
this.
|
|
213
|
-
|
|
214
|
-
|
|
205
|
+
this.guild = extraPayload?.guild || null;
|
|
206
|
+
/**
|
|
207
|
+
* Recent Games if requested in options
|
|
208
|
+
* @type {RecentGame[]|null}
|
|
209
|
+
*/
|
|
210
|
+
this.recentGames = extraPayload?.recentGames || null;
|
|
215
211
|
/**
|
|
216
212
|
* Player stats for each mini-game
|
|
217
213
|
* @type {PlayerStats}
|
|
218
214
|
*/
|
|
219
215
|
this.stats = (data.stats ? {
|
|
220
|
-
skywars: (data.stats.SkyWars ? new SkyWars(data.stats.SkyWars) : null),
|
|
216
|
+
skywars: (data.stats.SkyWars ? new SkyWars(data.stats.SkyWars, extraPayload?.rankedSW || null) : null),
|
|
221
217
|
bedwars: (data.stats.Bedwars ? new BedWars(data.stats.Bedwars) : null),
|
|
222
218
|
uhc: (data.stats.UHC ? new UHC(data.stats.UHC) : null),
|
|
223
219
|
speeduhc: (data.stats.SpeedUHC ? new SpeedUHC(data.stats.SpeedUHC) : null),
|
|
@@ -287,14 +283,11 @@ function getRank (player) {
|
|
|
287
283
|
rank = player.prefix.replace(/§[0-9|a-z]|\[|\]/g, '');
|
|
288
284
|
} else if (player.rank && player.rank !== 'NORMAL') {
|
|
289
285
|
switch (player.rank) {
|
|
290
|
-
case 'MODERATOR':
|
|
291
|
-
rank = 'Moderator';
|
|
292
|
-
break;
|
|
293
286
|
case 'YOUTUBER':
|
|
294
287
|
rank = 'YouTube';
|
|
295
288
|
break;
|
|
296
|
-
case '
|
|
297
|
-
rank = '
|
|
289
|
+
case 'GAME_MASTER':
|
|
290
|
+
rank = 'Game Master';
|
|
298
291
|
break;
|
|
299
292
|
case 'ADMIN':
|
|
300
293
|
rank = 'Admin';
|
|
@@ -405,8 +398,7 @@ function parseClaimedRewards (data) {
|
|
|
405
398
|
* * `MVP`
|
|
406
399
|
* * `MVP+`
|
|
407
400
|
* * `MVP++`
|
|
408
|
-
* * `
|
|
409
|
-
* * `Moderator`
|
|
401
|
+
* * `Game Master`
|
|
410
402
|
* * `Admin`
|
|
411
403
|
* * `YouTube`
|
|
412
404
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const dateRegExp = /(\d{1,2})(?:st|nd|rd|th|) ([A-z]+) (\d+)/;
|
|
2
|
-
const versionRegExp = /v\d+(
|
|
2
|
+
const versionRegExp = /v\d+(\.\d+){1,}/;
|
|
3
3
|
/**
|
|
4
4
|
* SkyblockNews
|
|
5
5
|
*/
|
|
@@ -61,8 +61,8 @@ function parseDate(stringDate) {
|
|
|
61
61
|
* @returns {string | null}
|
|
62
62
|
*/
|
|
63
63
|
function parseVer(stringVer) {
|
|
64
|
-
const
|
|
65
|
-
if (!
|
|
66
|
-
return
|
|
64
|
+
const matches = versionRegExp.exec(stringVer);
|
|
65
|
+
if (!matches.length) return null; // this shouldn't really happen
|
|
66
|
+
return matches[0];
|
|
67
67
|
}
|
|
68
68
|
module.exports = SkyblockNews;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const rgbToHexColor = require('../../utils/rgbToHexColor');
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Item class
|
|
3
5
|
*/
|
|
@@ -36,11 +38,30 @@ class SkyblockInventoryItem {
|
|
|
36
38
|
* @type {string}
|
|
37
39
|
*/
|
|
38
40
|
this.loreForEmbed = this.lore.replace(/§([0-9]|[a-f])|§/gm, '').replace(/<br>/gm, '\n');
|
|
41
|
+
/**
|
|
42
|
+
* Hexadecimal color code of armor
|
|
43
|
+
* @type {string}
|
|
44
|
+
*/
|
|
45
|
+
this.color = data.tag.ExtraAttributes.color ? rgbToHexColor(data.tag.ExtraAttributes.color.split(':')) : null;
|
|
39
46
|
/**
|
|
40
47
|
* Item enchantments
|
|
41
48
|
* @type {object}
|
|
42
49
|
*/
|
|
43
50
|
this.enchantments = data.tag.ExtraAttributes.enchantments ? data.tag.ExtraAttributes.enchantments : null;
|
|
51
|
+
/**
|
|
52
|
+
* Armor reforge
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
this.reforge = data.tag.ExtraAttributes.modifier ? data.tag.ExtraAttributes.modifier : null;
|
|
56
|
+
/**
|
|
57
|
+
* Equipment gemstones (if any)
|
|
58
|
+
* @type {SkyblockItemGemstone}
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line no-new-object
|
|
61
|
+
this.gemstones = data.tag.ExtraAttributes.gems ? Object.entries(data.tag.ExtraAttributes.gems).map((gem) => new Object({
|
|
62
|
+
type: gem[0].split('_')[0],
|
|
63
|
+
quality: gem[1]
|
|
64
|
+
})) : null;
|
|
44
65
|
/**
|
|
45
66
|
* Anvil uses
|
|
46
67
|
* @type {number}
|
|
@@ -85,7 +106,7 @@ class SkyblockInventoryItem {
|
|
|
85
106
|
* @return {string}
|
|
86
107
|
*/
|
|
87
108
|
function parseRarity (stringContainingRarity) {
|
|
88
|
-
const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', '
|
|
109
|
+
const rarityArray = ['COMMON', 'UNCOMMON', 'RARE', 'EPIC', 'LEGENDARY', 'MYTHIC', 'DIVINE', 'SPECIAL', 'VERY SPECIAL'];
|
|
89
110
|
for (const rarity of rarityArray) {
|
|
90
111
|
if (stringContainingRarity.includes(rarity)) return rarity;
|
|
91
112
|
}
|
|
@@ -99,4 +120,11 @@ function parseGearScore (lore) {
|
|
|
99
120
|
if (line.match(/Gear Score: §[0-9a-f](\d+)/)) return Number(line.match(/Gear Score: §d(\d+)/)[1]);
|
|
100
121
|
}
|
|
101
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @typedef {object} SkyblockItemGemstone
|
|
126
|
+
* @property {string} type Gemstone type
|
|
127
|
+
* @property {string} quality Gemstone quality (rough, flawed, fine, flawless, perfect)
|
|
128
|
+
*/
|
|
129
|
+
|
|
102
130
|
module.exports = SkyblockInventoryItem;
|
|
@@ -12,7 +12,7 @@ class SkyblockMember {
|
|
|
12
12
|
/**
|
|
13
13
|
* @param {object} data Skyblock member data
|
|
14
14
|
*/
|
|
15
|
-
constructor
|
|
15
|
+
constructor(data) {
|
|
16
16
|
/**
|
|
17
17
|
* Skyblock member UUID
|
|
18
18
|
* @type {string}
|
|
@@ -53,22 +53,22 @@ class SkyblockMember {
|
|
|
53
53
|
* Last save timestamp
|
|
54
54
|
* @type {number}
|
|
55
55
|
*/
|
|
56
|
-
this.
|
|
56
|
+
this.lastSaveTimestamp = data.m.last_save;
|
|
57
57
|
/**
|
|
58
58
|
* Last save timestamp as Date
|
|
59
59
|
* @type {Date}
|
|
60
60
|
*/
|
|
61
61
|
this.lastSaveAt = new Date(data.m.last_save);
|
|
62
|
+
/**
|
|
63
|
+
* Last save timestamp
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
this.lastDeathTimestamp = data.m.last_death;
|
|
62
67
|
/**
|
|
63
68
|
* Last death timestamp as Date
|
|
64
69
|
* @type {Date}
|
|
65
70
|
*/
|
|
66
71
|
this.lastDeathAt = new Date(skyblock_year_0 + data.m.last_death * 1000);
|
|
67
|
-
/**
|
|
68
|
-
* Last save timestamp
|
|
69
|
-
* @type {number}
|
|
70
|
-
*/
|
|
71
|
-
this.lastDeath = data.m.last_death;
|
|
72
72
|
/**
|
|
73
73
|
* Equipped armor
|
|
74
74
|
* @return {Promise<SkyblockMemberArmor>}
|
|
@@ -84,6 +84,18 @@ class SkyblockMember {
|
|
|
84
84
|
};
|
|
85
85
|
return armor;
|
|
86
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Wardrobe contents
|
|
89
|
+
* @return {Promise<SkyblockMemberItem[]>}
|
|
90
|
+
*/
|
|
91
|
+
this.getWardrobe = async () => {
|
|
92
|
+
const base64 = data.m?.wardrobe_contents?.data;
|
|
93
|
+
if (!base64) return [];
|
|
94
|
+
const decoded = await decode(base64);
|
|
95
|
+
const armor = decoded.filter((item) => Object.keys(item).length !== 0)
|
|
96
|
+
.map((item) => new SkyblockInventoryItem(item));
|
|
97
|
+
return armor;
|
|
98
|
+
};
|
|
87
99
|
/**
|
|
88
100
|
* Collected fairy souls
|
|
89
101
|
* @type {number}
|
|
@@ -184,14 +196,14 @@ class SkyblockMember {
|
|
|
184
196
|
* Skyblock Member pet score
|
|
185
197
|
* @return {number}
|
|
186
198
|
*/
|
|
187
|
-
getPetScore
|
|
199
|
+
getPetScore() {
|
|
188
200
|
return this.pets.reduce((acc, cur) => acc + (cur.petScore || 0), 0);
|
|
189
201
|
}
|
|
190
202
|
/**
|
|
191
203
|
* UUID
|
|
192
204
|
* @return {string}
|
|
193
205
|
*/
|
|
194
|
-
toString
|
|
206
|
+
toString() {
|
|
195
207
|
return this.uuid;
|
|
196
208
|
}
|
|
197
209
|
}
|
|
@@ -199,7 +211,7 @@ class SkyblockMember {
|
|
|
199
211
|
* @param {object} data
|
|
200
212
|
* @return {object}
|
|
201
213
|
*/
|
|
202
|
-
function getSkills
|
|
214
|
+
function getSkills(data) {
|
|
203
215
|
const skillsObject = {};
|
|
204
216
|
if (!objectPath.has(data, 'experience_skill_foraging')) {
|
|
205
217
|
if (data.player) {
|
|
@@ -221,7 +233,7 @@ function getSkills (data) {
|
|
|
221
233
|
* @param {object} data
|
|
222
234
|
* @return {object}
|
|
223
235
|
*/
|
|
224
|
-
function getSlayer
|
|
236
|
+
function getSlayer(data) {
|
|
225
237
|
if (!objectPath.has(data, 'slayer_bosses')) {
|
|
226
238
|
return null;
|
|
227
239
|
}
|
|
@@ -235,7 +247,7 @@ function getSlayer (data) {
|
|
|
235
247
|
* @param {object} data
|
|
236
248
|
* @return {object}
|
|
237
249
|
*/
|
|
238
|
-
function getDungeons
|
|
250
|
+
function getDungeons(data) {
|
|
239
251
|
if (!objectPath.has(data, 'dungeons')) {
|
|
240
252
|
return null;
|
|
241
253
|
}
|
|
@@ -256,7 +268,7 @@ function getDungeons (data) {
|
|
|
256
268
|
* @param {object} data
|
|
257
269
|
* @return {jacobData}
|
|
258
270
|
*/
|
|
259
|
-
function getJacobData
|
|
271
|
+
function getJacobData(data) {
|
|
260
272
|
if (!data.m.jacob2) {
|
|
261
273
|
return {
|
|
262
274
|
medals: {
|
package/src/utils/Constants.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
skyblock_year_0: 1.5602757e+12,
|
|
3
3
|
|
|
4
|
+
duels_divisions: [
|
|
5
|
+
{ name: 'Rookie', key: 'rookie' },
|
|
6
|
+
{ name: 'Iron', key: 'iron' },
|
|
7
|
+
{ name: 'Gold', key: 'gold' },
|
|
8
|
+
{ name: 'Diamond', key: 'diamond' },
|
|
9
|
+
{ name: 'Master', key: 'master' },
|
|
10
|
+
{ name: 'Legend', key: 'legend' },
|
|
11
|
+
{ name: 'Grandmaster', key: 'grandmaster' },
|
|
12
|
+
{ name: 'Godlike', key: 'godlike' },
|
|
13
|
+
{ name: 'WORLD ELITE', key: 'world_elite' },
|
|
14
|
+
{ name: 'WORLD MASTER', key: 'world_master' },
|
|
15
|
+
{ name: 'WORLD\'S BEST', key: 'worlds_best' }
|
|
16
|
+
],
|
|
17
|
+
|
|
4
18
|
leveling_xp: {
|
|
5
19
|
1: 50,
|
|
6
20
|
2: 125,
|
package/src/utils/index.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
module.exports = {
|
|
2
|
+
arrayTool: require('./arrayTools'),
|
|
3
|
+
Constants: require('./Constants'),
|
|
4
|
+
divide: require('./divide'),
|
|
5
|
+
isGuildID: require('./isGuildID'),
|
|
6
|
+
isUUID: require('./isUUID'),
|
|
7
|
+
oscillation: require('./oscillation'),
|
|
8
|
+
removeSnakeCase: require('./removeSnakeCase'),
|
|
9
|
+
SkyblockUtils: require('./SkyblockUtils'),
|
|
10
|
+
toIGN: require('./toIGN'),
|
|
11
|
+
toUuid: require('./toUuid'),
|
|
12
|
+
varInt: require('./varInt')
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module.exports = (num) => {
|
|
2
|
+
if (isNaN(num)) return NaN;
|
|
3
|
+
const digits = String(+num).split('');
|
|
4
|
+
const key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM',
|
|
5
|
+
'', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC',
|
|
6
|
+
'', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
|
|
7
|
+
let roman = '';
|
|
8
|
+
let i = 3;
|
|
9
|
+
while (i--) {
|
|
10
|
+
roman = (key[+ digits.pop() + (i * 10)] || '') + roman;
|
|
11
|
+
}
|
|
12
|
+
return Array(+digits.join('') + 1).join('M') + roman;
|
|
13
|
+
};
|