hypixel-api-reborn 10.0.0 → 11.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/.prettierrc +13 -0
- package/README.md +27 -15
- package/package.json +60 -58
- package/src/API/getAPIStatus.js +8 -8
- package/src/API/getBoosters.js +6 -6
- package/src/API/getGameCounts.js +6 -6
- package/src/API/getGuild.js +18 -18
- package/src/API/getLeaderboards.js +13 -13
- package/src/API/getPlayer.js +22 -27
- package/src/API/getRecentGames.js +18 -18
- package/src/API/getServerInfo.js +66 -77
- package/src/API/getStatus.js +8 -8
- package/src/API/getWatchdogStats.js +6 -6
- package/src/API/index.js +19 -23
- package/src/API/skyblock/getEndedSkyblockAuctions.js +10 -10
- package/src/API/skyblock/getSkyblockAuctions.js +64 -64
- package/src/API/skyblock/getSkyblockAuctionsByPlayer.js +11 -11
- package/src/API/skyblock/getSkyblockBazaar.js +10 -10
- package/src/API/skyblock/getSkyblockMember.js +28 -25
- package/src/API/skyblock/getSkyblockNews.js +6 -6
- package/src/API/skyblock/getSkyblockProfiles.js +44 -41
- package/src/Client.js +406 -450
- package/src/Errors.js +44 -39
- package/src/Private/defaultCache.js +77 -78
- package/src/Private/rateLimit.js +79 -98
- package/src/Private/requests.js +65 -54
- package/src/Private/updater.js +45 -45
- package/src/Private/uuidCache.js +37 -33
- package/src/Private/validate.js +97 -97
- package/src/index.js +82 -83
- package/src/structures/APIIncident.js +78 -78
- package/src/structures/APIStatus.js +47 -47
- package/src/structures/Boosters/Booster.js +83 -87
- package/src/structures/Color.js +129 -129
- package/src/structures/Game.js +164 -160
- package/src/structures/GameCounts.js +151 -151
- package/src/structures/Guild/Guild.js +204 -218
- package/src/structures/Guild/GuildMember.js +66 -66
- package/src/structures/Guild/GuildRank.js +48 -48
- package/src/structures/ItemBytes.js +33 -36
- package/src/structures/Leaderboard.js +31 -31
- package/src/structures/MiniGames/Arcade.js +567 -569
- package/src/structures/MiniGames/ArenaBrawl.js +52 -56
- package/src/structures/MiniGames/BedWars.js +423 -351
- package/src/structures/MiniGames/BlitzSurvivalGames.js +172 -148
- package/src/structures/MiniGames/BuildBattle.js +53 -53
- package/src/structures/MiniGames/CopsAndCrims.js +90 -90
- package/src/structures/MiniGames/Duels.js +694 -630
- package/src/structures/MiniGames/MegaWalls.js +137 -137
- package/src/structures/MiniGames/MurderMystery.js +93 -93
- package/src/structures/MiniGames/Paintball.js +67 -67
- package/src/structures/MiniGames/Pit.js +19 -19
- package/src/structures/MiniGames/Quakecraft.js +101 -101
- package/src/structures/MiniGames/SkyWars.js +508 -559
- package/src/structures/MiniGames/SmashHeroes.js +144 -151
- package/src/structures/MiniGames/SpeedUHC.js +115 -57
- package/src/structures/MiniGames/TNTGames.js +116 -116
- package/src/structures/MiniGames/TurboKartRacers.js +201 -176
- package/src/structures/MiniGames/UHC.js +164 -143
- package/src/structures/MiniGames/VampireZ.js +60 -60
- package/src/structures/MiniGames/Walls.js +52 -52
- package/src/structures/MiniGames/Warlords.js +62 -62
- package/src/structures/MiniGames/WoolWars.js +123 -0
- package/src/structures/Pet.js +96 -97
- package/src/structures/Pets.js +64 -64
- package/src/structures/Player.js +433 -449
- package/src/structures/PlayerCosmetics.js +100 -95
- package/src/structures/RecentGame.js +57 -57
- package/src/structures/ServerInfo.js +78 -78
- package/src/structures/SkyBlock/Auctions/Auction.js +104 -104
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +54 -54
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +45 -45
- package/src/structures/SkyBlock/Auctions/Bid.js +48 -48
- package/src/structures/SkyBlock/Auctions/PartialAuction.js +25 -25
- package/src/structures/SkyBlock/Bazzar/Order.js +38 -38
- package/src/structures/SkyBlock/Bazzar/Product.js +53 -53
- package/src/structures/SkyBlock/News/SkyblockNews.js +60 -68
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +124 -130
- package/src/structures/SkyBlock/SkyblockMember.js +820 -687
- package/src/structures/SkyBlock/SkyblockPet.js +71 -71
- package/src/structures/SkyBlock/SkyblockProfile.js +60 -60
- package/src/structures/Status.js +41 -41
- package/src/structures/Watchdog/Stats.js +36 -36
- package/src/utils/Constants.js +2789 -809
- package/src/utils/SkyblockUtils.js +208 -164
- package/src/utils/arrayTools.js +4 -4
- package/src/utils/divide.js +5 -5
- package/src/utils/guildExp.js +57 -67
- package/src/utils/index.js +13 -13
- package/src/utils/isGuildID.js +3 -3
- package/src/utils/isUUID.js +5 -5
- package/src/utils/oscillation.js +15 -23
- package/src/utils/removeSnakeCase.js +22 -35
- package/src/utils/rgbToHexColor.js +8 -8
- package/src/utils/romanize.js +11 -13
- package/src/utils/toIGN.js +20 -20
- package/src/utils/toUuid.js +19 -19
- package/src/utils/varInt.js +17 -21
- package/typings/index.d.ts +3532 -2644
- package/src/API/getFriends.js +0 -14
- package/src/API/getKeyInfo.js +0 -10
- package/src/API/getRankedSkyWars.js +0 -11
- package/src/structures/Friend.js +0 -38
- package/src/structures/KeyInfo.js +0 -42
- package/src/structures/MiniGames/SkyWarsRanked.js +0 -45
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
const APIIncident = require('./APIIncident');
|
|
2
|
-
/**
|
|
3
|
-
* API status class
|
|
4
|
-
*/
|
|
5
|
-
class APIStatus {
|
|
6
|
-
/**
|
|
7
|
-
* @param {object} data API status data
|
|
8
|
-
*/
|
|
9
|
-
constructor
|
|
10
|
-
/**
|
|
11
|
-
* Source url
|
|
12
|
-
* @type {string|null}
|
|
13
|
-
*/
|
|
14
|
-
this.sourceUrl = data.feedUrl || null;
|
|
15
|
-
/**
|
|
16
|
-
* Title
|
|
17
|
-
* @type {string|null}
|
|
18
|
-
*/
|
|
19
|
-
this.title = data.title || null;
|
|
20
|
-
/**
|
|
21
|
-
* Description
|
|
22
|
-
* @type {string|null}
|
|
23
|
-
*/
|
|
24
|
-
this.description = data.description || null;
|
|
25
|
-
/**
|
|
26
|
-
* API incident
|
|
27
|
-
* @type {APIIncident[]}
|
|
28
|
-
*/
|
|
29
|
-
this.incidents = data.items.map((x) => new APIIncident(x));
|
|
30
|
-
/**
|
|
31
|
-
* All incidents that aren't completed/resolved
|
|
32
|
-
* @author linearaccelerator
|
|
33
|
-
* @type {APIIncident[]}
|
|
34
|
-
* @version >6.0.1
|
|
35
|
-
*/
|
|
36
|
-
this.currentIncidents = this.incidents.filter((i) => !i.isResolved);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Status Title
|
|
40
|
-
* @return {string}
|
|
41
|
-
*/
|
|
42
|
-
toString() {
|
|
43
|
-
return this.title;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = APIStatus;
|
|
1
|
+
const APIIncident = require('./APIIncident');
|
|
2
|
+
/**
|
|
3
|
+
* API status class
|
|
4
|
+
*/
|
|
5
|
+
class APIStatus {
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} data API status data
|
|
8
|
+
*/
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* Source url
|
|
12
|
+
* @type {string|null}
|
|
13
|
+
*/
|
|
14
|
+
this.sourceUrl = data.feedUrl || null;
|
|
15
|
+
/**
|
|
16
|
+
* Title
|
|
17
|
+
* @type {string|null}
|
|
18
|
+
*/
|
|
19
|
+
this.title = data.title || null;
|
|
20
|
+
/**
|
|
21
|
+
* Description
|
|
22
|
+
* @type {string|null}
|
|
23
|
+
*/
|
|
24
|
+
this.description = data.description || null;
|
|
25
|
+
/**
|
|
26
|
+
* API incident
|
|
27
|
+
* @type {APIIncident[]}
|
|
28
|
+
*/
|
|
29
|
+
this.incidents = data.items.map((x) => new APIIncident(x));
|
|
30
|
+
/**
|
|
31
|
+
* All incidents that aren't completed/resolved
|
|
32
|
+
* @author linearaccelerator
|
|
33
|
+
* @type {APIIncident[]}
|
|
34
|
+
* @version >6.0.1
|
|
35
|
+
*/
|
|
36
|
+
this.currentIncidents = this.incidents.filter((i) => !i.isResolved);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Status Title
|
|
40
|
+
* @return {string}
|
|
41
|
+
*/
|
|
42
|
+
toString() {
|
|
43
|
+
return this.title;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = APIStatus;
|
|
@@ -1,87 +1,83 @@
|
|
|
1
|
-
const Game = require('../Game');
|
|
2
|
-
/**
|
|
3
|
-
* Booster class
|
|
4
|
-
*/
|
|
5
|
-
class Booster {
|
|
6
|
-
/**
|
|
7
|
-
* @param {object} data
|
|
8
|
-
*/
|
|
9
|
-
constructor
|
|
10
|
-
/**
|
|
11
|
-
* Booster's purchaser's UUID
|
|
12
|
-
* @type {String}
|
|
13
|
-
*/
|
|
14
|
-
this.purchaser = data.purchaserUuid;
|
|
15
|
-
/**
|
|
16
|
-
* Booster's multiplier
|
|
17
|
-
* @type {Number}
|
|
18
|
-
*/
|
|
19
|
-
this.amount = data.amount;
|
|
20
|
-
/**
|
|
21
|
-
* Booster's length in seconds
|
|
22
|
-
* @type {Number}
|
|
23
|
-
*/
|
|
24
|
-
this.originalLength = data.originalLength;
|
|
25
|
-
/**
|
|
26
|
-
* Length remaining in seconds
|
|
27
|
-
* @type {Number}
|
|
28
|
-
*/
|
|
29
|
-
this.remaining = data.length;
|
|
30
|
-
/**
|
|
31
|
-
* Date activated timestamp
|
|
32
|
-
* @type {Number}
|
|
33
|
-
*/
|
|
34
|
-
this.activatedTimestamp = data.dateActivated;
|
|
35
|
-
/**
|
|
36
|
-
* Date activated
|
|
37
|
-
* @type {Date}
|
|
38
|
-
*/
|
|
39
|
-
this.activated = new Date(data.dateActivated);
|
|
40
|
-
/**
|
|
41
|
-
* Game type
|
|
42
|
-
* @type {Game}
|
|
43
|
-
*/
|
|
44
|
-
this.game = data.gameType ? new Game(data.gameType) : null;
|
|
45
|
-
/**
|
|
46
|
-
* Is Booster Active
|
|
47
|
-
* @type {boolean}
|
|
48
|
-
*/
|
|
49
|
-
this.isActive = Array.isArray(data.stacked);
|
|
50
|
-
/**
|
|
51
|
-
* Booster type : either 'QUEUED', 'STACKED'* or 'ACTIVE'.
|
|
52
|
-
* *STACKED is always queued, when active, they disappear into stackers of the active game booster
|
|
53
|
-
* @type {string}
|
|
54
|
-
*/
|
|
55
|
-
this.type = parseType(data);
|
|
56
|
-
/**
|
|
57
|
-
* Stacked by ( if any )
|
|
58
|
-
* @type {string[]}
|
|
59
|
-
*/
|
|
60
|
-
this.stackers = Array.isArray(data.stacked) ? Array.from(data.stacked) : [];
|
|
61
|
-
/**
|
|
62
|
-
* Possibly expired booster
|
|
63
|
-
* Works by checking if date.length is negative
|
|
64
|
-
* @type {boolean}
|
|
65
|
-
*/
|
|
66
|
-
this.expired = data.length < 0;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Beautiful format
|
|
70
|
-
* @return {string}
|
|
71
|
-
*/
|
|
72
|
-
toString
|
|
73
|
-
return `${this.purchaser}'s booster in ${this.game}`;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (!data.stacked) return 'QUEUED';
|
|
85
|
-
return 'ACTIVE';
|
|
86
|
-
}
|
|
87
|
-
module.exports = Booster;
|
|
1
|
+
const Game = require('../Game');
|
|
2
|
+
/**
|
|
3
|
+
* Booster class
|
|
4
|
+
*/
|
|
5
|
+
class Booster {
|
|
6
|
+
/**
|
|
7
|
+
* @param {object} data
|
|
8
|
+
*/
|
|
9
|
+
constructor(data) {
|
|
10
|
+
/**
|
|
11
|
+
* Booster's purchaser's UUID
|
|
12
|
+
* @type {String}
|
|
13
|
+
*/
|
|
14
|
+
this.purchaser = data.purchaserUuid;
|
|
15
|
+
/**
|
|
16
|
+
* Booster's multiplier
|
|
17
|
+
* @type {Number}
|
|
18
|
+
*/
|
|
19
|
+
this.amount = data.amount;
|
|
20
|
+
/**
|
|
21
|
+
* Booster's length in seconds
|
|
22
|
+
* @type {Number}
|
|
23
|
+
*/
|
|
24
|
+
this.originalLength = data.originalLength;
|
|
25
|
+
/**
|
|
26
|
+
* Length remaining in seconds
|
|
27
|
+
* @type {Number}
|
|
28
|
+
*/
|
|
29
|
+
this.remaining = data.length;
|
|
30
|
+
/**
|
|
31
|
+
* Date activated timestamp
|
|
32
|
+
* @type {Number}
|
|
33
|
+
*/
|
|
34
|
+
this.activatedTimestamp = data.dateActivated;
|
|
35
|
+
/**
|
|
36
|
+
* Date activated
|
|
37
|
+
* @type {Date}
|
|
38
|
+
*/
|
|
39
|
+
this.activated = new Date(data.dateActivated);
|
|
40
|
+
/**
|
|
41
|
+
* Game type
|
|
42
|
+
* @type {Game}
|
|
43
|
+
*/
|
|
44
|
+
this.game = data.gameType ? new Game(data.gameType) : null;
|
|
45
|
+
/**
|
|
46
|
+
* Is Booster Active
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
*/
|
|
49
|
+
this.isActive = Array.isArray(data.stacked);
|
|
50
|
+
/**
|
|
51
|
+
* Booster type : either 'QUEUED', 'STACKED'* or 'ACTIVE'.
|
|
52
|
+
* *STACKED is always queued, when active, they disappear into stackers of the active game booster
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
this.type = parseType(data);
|
|
56
|
+
/**
|
|
57
|
+
* Stacked by ( if any )
|
|
58
|
+
* @type {string[]}
|
|
59
|
+
*/
|
|
60
|
+
this.stackers = Array.isArray(data.stacked) ? Array.from(data.stacked) : [];
|
|
61
|
+
/**
|
|
62
|
+
* Possibly expired booster
|
|
63
|
+
* Works by checking if date.length is negative
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
*/
|
|
66
|
+
this.expired = data.length < 0;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Beautiful format
|
|
70
|
+
* @return {string}
|
|
71
|
+
*/
|
|
72
|
+
toString() {
|
|
73
|
+
return `${this.purchaser}'s booster in ${this.game}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// eslint-disable-next-line require-jsdoc
|
|
78
|
+
function parseType(data) {
|
|
79
|
+
if (data.stacked === true) return 'STACKED';
|
|
80
|
+
if (!data.stacked) return 'QUEUED';
|
|
81
|
+
return 'ACTIVE';
|
|
82
|
+
}
|
|
83
|
+
module.exports = Booster;
|
package/src/structures/Color.js
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Color class
|
|
3
|
-
*/
|
|
4
|
-
class Color {
|
|
5
|
-
/**
|
|
6
|
-
* @param {ColorCode} color Color code
|
|
7
|
-
*/
|
|
8
|
-
constructor
|
|
9
|
-
this.color = color;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Returns regular color name
|
|
14
|
-
* @return {ColorString}
|
|
15
|
-
*/
|
|
16
|
-
toString
|
|
17
|
-
const ColorStrings = {
|
|
18
|
-
BLACK: 'Black',
|
|
19
|
-
DARK_BLUE: 'Dark Blue',
|
|
20
|
-
DARK_GREEN: 'Dark Green',
|
|
21
|
-
DARK_AQUA: 'Dark Aqua',
|
|
22
|
-
DARK_RED: 'Dark Red',
|
|
23
|
-
DARK_PURPLE: 'Dark Purple',
|
|
24
|
-
GOLD: 'Gold',
|
|
25
|
-
GRAY: 'Gray',
|
|
26
|
-
DARK_GRAY: 'Dark Gray',
|
|
27
|
-
BLUE: 'Blue',
|
|
28
|
-
GREEN: 'Green',
|
|
29
|
-
AQUA: 'Aqua',
|
|
30
|
-
RED: 'Red',
|
|
31
|
-
LIGHT_PURPLE: 'Light Purple',
|
|
32
|
-
YELLOW: 'Yellow',
|
|
33
|
-
WHITE: 'White'
|
|
34
|
-
};
|
|
35
|
-
return ColorStrings[this.color];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Returns color HEX code
|
|
40
|
-
* @return {ColorHex}
|
|
41
|
-
*/
|
|
42
|
-
toHex
|
|
43
|
-
const ColorHex = {
|
|
44
|
-
BLACK: '#000000',
|
|
45
|
-
DARK_BLUE: '#0000AA',
|
|
46
|
-
DARK_GREEN: '#008000',
|
|
47
|
-
DARK_AQUA: '#00AAAA',
|
|
48
|
-
DARK_RED: '#AA0000',
|
|
49
|
-
DARK_PURPLE: '#AA00AA',
|
|
50
|
-
GOLD: '#FFAA00',
|
|
51
|
-
GRAY: '#AAAAAA',
|
|
52
|
-
DARK_GRAY: '#555555',
|
|
53
|
-
BLUE: '#5555FF',
|
|
54
|
-
GREEN: '#3CE63C',
|
|
55
|
-
AQUA: '#3CE6E6',
|
|
56
|
-
RED: '#FF5555',
|
|
57
|
-
LIGHT_PURPLE: '#FF55FF',
|
|
58
|
-
YELLOW: '#FFFF55',
|
|
59
|
-
WHITE: '#FFFFFF'
|
|
60
|
-
};
|
|
61
|
-
return ColorHex[this.color];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Returns color code
|
|
66
|
-
* @return {ColorCode}
|
|
67
|
-
*/
|
|
68
|
-
toCode
|
|
69
|
-
return this.color;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @typedef {string} ColorCode
|
|
74
|
-
* * `BLACK`
|
|
75
|
-
* * `DARK_BLUE`
|
|
76
|
-
* * `DARK_GREEN`
|
|
77
|
-
* * `DARK_AQUA`
|
|
78
|
-
* * `DARK_RED`
|
|
79
|
-
* * `DARK_PURPLE`
|
|
80
|
-
* * `GOLD`
|
|
81
|
-
* * `GRAY`
|
|
82
|
-
* * `DARK_GRAY`
|
|
83
|
-
* * `BLUE`
|
|
84
|
-
* * `GREEN`
|
|
85
|
-
* * `AQUA`
|
|
86
|
-
* * `RED`
|
|
87
|
-
* * `LIGHT_PURPLE`
|
|
88
|
-
* * `YELLOW`
|
|
89
|
-
* * `WHITE`
|
|
90
|
-
*/
|
|
91
|
-
/**
|
|
92
|
-
* @typedef {string} ColorString
|
|
93
|
-
* * BLACK: `Black`
|
|
94
|
-
* * DARK_BLUE: `Dark Blue`
|
|
95
|
-
* * DARK_GREEN: `Dark Green`
|
|
96
|
-
* * DARK_AQUA: `Dark Aqua`
|
|
97
|
-
* * DARK_RED: `Dark Red`
|
|
98
|
-
* * DARK_PURPLE: `Dark Purple`
|
|
99
|
-
* * GOLD: `Gold`
|
|
100
|
-
* * GRAY: `Gray`
|
|
101
|
-
* * DARK_GRAY: `Dark Gray`
|
|
102
|
-
* * BLUE: `Blue`,
|
|
103
|
-
* * GREEN: `Green`
|
|
104
|
-
* * AQUA: `Aqua`
|
|
105
|
-
* * RED: `Red`
|
|
106
|
-
* * LIGHT_PURPLE: `Light Purple`
|
|
107
|
-
* * YELLOW: `Yellow`
|
|
108
|
-
* * WHITE: `White`
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* @typedef {string} ColorHex
|
|
112
|
-
* * BLACK: `#000000`
|
|
113
|
-
* * DARK_BLUE: `#0000AA`
|
|
114
|
-
* * DARK_GREEN: `#008000`
|
|
115
|
-
* * DARK_AQUA: `#00AAAA`
|
|
116
|
-
* * DARK_RED: `#AA0000`
|
|
117
|
-
* * DARK_PURPLE: `#AA00AA`
|
|
118
|
-
* * GOLD: `#FFAA00`
|
|
119
|
-
* * GRAY: `#AAAAAA`
|
|
120
|
-
* * DARK_GRAY: `#555555`
|
|
121
|
-
* * BLUE: `#5555FF`
|
|
122
|
-
* * GREEN: `#3CE63C`
|
|
123
|
-
* * AQUA: `#3CE6E6`
|
|
124
|
-
* * RED: `#FF5555`
|
|
125
|
-
* * LIGHT_PURPLE: `#FF55FF`
|
|
126
|
-
* * YELLOW: `#FFFF55`
|
|
127
|
-
* * WHITE: `#FFFFFF`
|
|
128
|
-
*/
|
|
129
|
-
module.exports = Color;
|
|
1
|
+
/**
|
|
2
|
+
* Color class
|
|
3
|
+
*/
|
|
4
|
+
class Color {
|
|
5
|
+
/**
|
|
6
|
+
* @param {ColorCode} color Color code
|
|
7
|
+
*/
|
|
8
|
+
constructor(color) {
|
|
9
|
+
this.color = color;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns regular color name
|
|
14
|
+
* @return {ColorString}
|
|
15
|
+
*/
|
|
16
|
+
toString() {
|
|
17
|
+
const ColorStrings = {
|
|
18
|
+
BLACK: 'Black',
|
|
19
|
+
DARK_BLUE: 'Dark Blue',
|
|
20
|
+
DARK_GREEN: 'Dark Green',
|
|
21
|
+
DARK_AQUA: 'Dark Aqua',
|
|
22
|
+
DARK_RED: 'Dark Red',
|
|
23
|
+
DARK_PURPLE: 'Dark Purple',
|
|
24
|
+
GOLD: 'Gold',
|
|
25
|
+
GRAY: 'Gray',
|
|
26
|
+
DARK_GRAY: 'Dark Gray',
|
|
27
|
+
BLUE: 'Blue',
|
|
28
|
+
GREEN: 'Green',
|
|
29
|
+
AQUA: 'Aqua',
|
|
30
|
+
RED: 'Red',
|
|
31
|
+
LIGHT_PURPLE: 'Light Purple',
|
|
32
|
+
YELLOW: 'Yellow',
|
|
33
|
+
WHITE: 'White'
|
|
34
|
+
};
|
|
35
|
+
return ColorStrings[this.color];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Returns color HEX code
|
|
40
|
+
* @return {ColorHex}
|
|
41
|
+
*/
|
|
42
|
+
toHex() {
|
|
43
|
+
const ColorHex = {
|
|
44
|
+
BLACK: '#000000',
|
|
45
|
+
DARK_BLUE: '#0000AA',
|
|
46
|
+
DARK_GREEN: '#008000',
|
|
47
|
+
DARK_AQUA: '#00AAAA',
|
|
48
|
+
DARK_RED: '#AA0000',
|
|
49
|
+
DARK_PURPLE: '#AA00AA',
|
|
50
|
+
GOLD: '#FFAA00',
|
|
51
|
+
GRAY: '#AAAAAA',
|
|
52
|
+
DARK_GRAY: '#555555',
|
|
53
|
+
BLUE: '#5555FF',
|
|
54
|
+
GREEN: '#3CE63C',
|
|
55
|
+
AQUA: '#3CE6E6',
|
|
56
|
+
RED: '#FF5555',
|
|
57
|
+
LIGHT_PURPLE: '#FF55FF',
|
|
58
|
+
YELLOW: '#FFFF55',
|
|
59
|
+
WHITE: '#FFFFFF'
|
|
60
|
+
};
|
|
61
|
+
return ColorHex[this.color];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Returns color code
|
|
66
|
+
* @return {ColorCode}
|
|
67
|
+
*/
|
|
68
|
+
toCode() {
|
|
69
|
+
return this.color;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @typedef {string} ColorCode
|
|
74
|
+
* * `BLACK`
|
|
75
|
+
* * `DARK_BLUE`
|
|
76
|
+
* * `DARK_GREEN`
|
|
77
|
+
* * `DARK_AQUA`
|
|
78
|
+
* * `DARK_RED`
|
|
79
|
+
* * `DARK_PURPLE`
|
|
80
|
+
* * `GOLD`
|
|
81
|
+
* * `GRAY`
|
|
82
|
+
* * `DARK_GRAY`
|
|
83
|
+
* * `BLUE`
|
|
84
|
+
* * `GREEN`
|
|
85
|
+
* * `AQUA`
|
|
86
|
+
* * `RED`
|
|
87
|
+
* * `LIGHT_PURPLE`
|
|
88
|
+
* * `YELLOW`
|
|
89
|
+
* * `WHITE`
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* @typedef {string} ColorString
|
|
93
|
+
* * BLACK: `Black`
|
|
94
|
+
* * DARK_BLUE: `Dark Blue`
|
|
95
|
+
* * DARK_GREEN: `Dark Green`
|
|
96
|
+
* * DARK_AQUA: `Dark Aqua`
|
|
97
|
+
* * DARK_RED: `Dark Red`
|
|
98
|
+
* * DARK_PURPLE: `Dark Purple`
|
|
99
|
+
* * GOLD: `Gold`
|
|
100
|
+
* * GRAY: `Gray`
|
|
101
|
+
* * DARK_GRAY: `Dark Gray`
|
|
102
|
+
* * BLUE: `Blue`,
|
|
103
|
+
* * GREEN: `Green`
|
|
104
|
+
* * AQUA: `Aqua`
|
|
105
|
+
* * RED: `Red`
|
|
106
|
+
* * LIGHT_PURPLE: `Light Purple`
|
|
107
|
+
* * YELLOW: `Yellow`
|
|
108
|
+
* * WHITE: `White`
|
|
109
|
+
*/
|
|
110
|
+
/**
|
|
111
|
+
* @typedef {string} ColorHex
|
|
112
|
+
* * BLACK: `#000000`
|
|
113
|
+
* * DARK_BLUE: `#0000AA`
|
|
114
|
+
* * DARK_GREEN: `#008000`
|
|
115
|
+
* * DARK_AQUA: `#00AAAA`
|
|
116
|
+
* * DARK_RED: `#AA0000`
|
|
117
|
+
* * DARK_PURPLE: `#AA00AA`
|
|
118
|
+
* * GOLD: `#FFAA00`
|
|
119
|
+
* * GRAY: `#AAAAAA`
|
|
120
|
+
* * DARK_GRAY: `#555555`
|
|
121
|
+
* * BLUE: `#5555FF`
|
|
122
|
+
* * GREEN: `#3CE63C`
|
|
123
|
+
* * AQUA: `#3CE6E6`
|
|
124
|
+
* * RED: `#FF5555`
|
|
125
|
+
* * LIGHT_PURPLE: `#FF55FF`
|
|
126
|
+
* * YELLOW: `#FFFF55`
|
|
127
|
+
* * WHITE: `#FFFFFF`
|
|
128
|
+
*/
|
|
129
|
+
module.exports = Color;
|