hypixel-api-reborn 10.0.0 → 11.0.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 +13 -0
- package/README.md +28 -16
- 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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const { divide } = require('../../utils');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wool Wars Class
|
|
5
|
+
*/
|
|
6
|
+
class WoolWars {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor
|
|
9
|
+
* @param {Record<string,unknown>} data Data from API
|
|
10
|
+
*/
|
|
11
|
+
constructor(data) {
|
|
12
|
+
/**
|
|
13
|
+
* Sheep layers, similar to prestige
|
|
14
|
+
* @type {number}
|
|
15
|
+
*/
|
|
16
|
+
this.layers = data.progression?.available_layers || 0;
|
|
17
|
+
/**
|
|
18
|
+
* Wool Wars XP
|
|
19
|
+
* @type {number}
|
|
20
|
+
*/
|
|
21
|
+
this.xp = data.progression?.experience || 0;
|
|
22
|
+
/**
|
|
23
|
+
* Wool Wars Decimal Level
|
|
24
|
+
* @type {number}
|
|
25
|
+
*/
|
|
26
|
+
this.exactLevel = WoolWars.convertXPToLevel(this.xp);
|
|
27
|
+
/**
|
|
28
|
+
* Wool wars level (as shown in game)
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
this.level = Math.floor(this.exactLevel);
|
|
32
|
+
/**
|
|
33
|
+
* Coins
|
|
34
|
+
* @type {number}
|
|
35
|
+
*/
|
|
36
|
+
this.coins = data.coins || 0;
|
|
37
|
+
/**
|
|
38
|
+
* Selected class, or NONE if field isn't present in API for some reason
|
|
39
|
+
* @type {'ASSAULT'|'TANK'|'GOLEM'|'SWORDSMAN'|'ENGINEER'|'ARCHER'|'NONE'}
|
|
40
|
+
*/
|
|
41
|
+
this.selectedClass = data.wool_wars?.selected_class || 'NONE';
|
|
42
|
+
this.stats = {
|
|
43
|
+
overall: WoolWars.generateStatsFor(data.wool_wars?.stats, ''),
|
|
44
|
+
assault: WoolWars.generateStatsFor(data.wool_wars?.stats, 'assault'),
|
|
45
|
+
tank: WoolWars.generateStatsFor(data.wool_wars?.stats, 'tank'),
|
|
46
|
+
golem: WoolWars.generateStatsFor(data.wool_wars?.stats, 'golem'),
|
|
47
|
+
swordsman: WoolWars.generateStatsFor(data.wool_wars?.stats, 'swordsman'),
|
|
48
|
+
engineer: WoolWars.generateStatsFor(data.wool_wars?.stats, 'engineer'),
|
|
49
|
+
archer: WoolWars.generateStatsFor(data.wool_wars?.stats, 'archer')
|
|
50
|
+
};
|
|
51
|
+
// Misc fields ig
|
|
52
|
+
/**
|
|
53
|
+
* Owned Cosmetics
|
|
54
|
+
* @type {string[]}
|
|
55
|
+
*/
|
|
56
|
+
this.ownedCosmetics = data.packages || [];
|
|
57
|
+
/**
|
|
58
|
+
* Private Games config
|
|
59
|
+
* @type {PrivateGamesConfig}
|
|
60
|
+
*/
|
|
61
|
+
this.privateGamesConfig = data.privategames || {};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts XP to Level
|
|
65
|
+
* @param {number} exp xp
|
|
66
|
+
* @return {number}
|
|
67
|
+
*/
|
|
68
|
+
static convertXPToLevel(exp) {
|
|
69
|
+
const minimalExp = [0, 1e3, 3e3, 6e3, 1e4, 15e3]; // NB: progression is 1k, 2k, 3k, 4k, 5k
|
|
70
|
+
const baseLevel = minimalExp.length;
|
|
71
|
+
const baseExp = minimalExp[minimalExp.length - 1];
|
|
72
|
+
const expToLevel100 = 49e4;
|
|
73
|
+
if (exp < baseExp) return minimalExp.findIndex((x) => exp < x);
|
|
74
|
+
const theoreticalLevel = (exp - baseExp) / 5e3 + baseLevel;
|
|
75
|
+
if (theoreticalLevel > 100) return 100 + this.convertXPToLevel(exp - expToLevel100);
|
|
76
|
+
return theoreticalLevel;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Generates stats per class/overall
|
|
80
|
+
* @param {Record<string, unknwon>} data data
|
|
81
|
+
* @param {string} [_class=''] Class
|
|
82
|
+
* @return {WoolWarsStats}
|
|
83
|
+
*/
|
|
84
|
+
static generateStatsFor(data, _class) {
|
|
85
|
+
// N.B i called it _class instead of class because reserved keyword
|
|
86
|
+
const workingData = (_class ? data?.['classes'][_class] : data) || {};
|
|
87
|
+
return {
|
|
88
|
+
roundWins: workingData.wins || 0,
|
|
89
|
+
gamesPlayed: workingData.games_played || 0,
|
|
90
|
+
woolsPlaced: workingData.wool_placed || 0,
|
|
91
|
+
blocksBroken: workingData.blocks_broken || 0,
|
|
92
|
+
placeBreakRatio: divide(workingData.wool_placed, workingData.blocks_broken),
|
|
93
|
+
kills: workingData.kills || 0,
|
|
94
|
+
deaths: workingData.deaths || 0,
|
|
95
|
+
KDRatio: divide(workingData.kills, workingData.deaths),
|
|
96
|
+
assists: workingData.assists || 0,
|
|
97
|
+
powerups: workingData.powerups_gotten || 0
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @typedef {Object} PrivateGamesConfig NB. There could be more fields
|
|
103
|
+
* @property {boolean} one_hit_one_kill One hit one kill
|
|
104
|
+
* @property {'Enabled'|'Disabled'} rainbow_wool Rainbow wool
|
|
105
|
+
* @property {string} health_buff Health Buff
|
|
106
|
+
* @property {string} game_speed Game speed
|
|
107
|
+
* @property {string} speed Player speed
|
|
108
|
+
* @property {'Enabled'|'Disabled'} no_class No class
|
|
109
|
+
*/
|
|
110
|
+
/**
|
|
111
|
+
* @typedef {Object} WoolWarsStats
|
|
112
|
+
* @property {number} roundWins round wins
|
|
113
|
+
* @property {number} gamesPlayed games played
|
|
114
|
+
* @property {number} woolsPlaced wools placed
|
|
115
|
+
* @property {number} blocksBroken blocks broken
|
|
116
|
+
* @property {number} placeBreakRatio broken blocks to placed wool ratio
|
|
117
|
+
* @property {number} kills kills
|
|
118
|
+
* @property {number} deaths deaths
|
|
119
|
+
* @property {number} KDRatio KDR
|
|
120
|
+
* @property {number} assists assists (not included in KDR)
|
|
121
|
+
* @property {number} powerups number of powerups picked up
|
|
122
|
+
*/
|
|
123
|
+
module.exports = WoolWars;
|
package/src/structures/Pet.js
CHANGED
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
const Utils = require('../utils');
|
|
2
|
-
/**
|
|
3
|
-
* Pet Class
|
|
4
|
-
*/
|
|
5
|
-
class Pet {
|
|
6
|
-
/**
|
|
7
|
-
* @param {string} name Name of pet
|
|
8
|
-
* @param {object} data data
|
|
9
|
-
*/
|
|
10
|
-
constructor
|
|
11
|
-
/**
|
|
12
|
-
* Is Pet Favorite
|
|
13
|
-
* @type {boolean}
|
|
14
|
-
*/
|
|
15
|
-
this.isFavorite = data.vanityFavorites ? Boolean(data.vanityFavorites.includes(name.toUpperCase())) : false;
|
|
16
|
-
name = name.replace('pet_', '');
|
|
17
|
-
/**
|
|
18
|
-
* Official Name of the pet
|
|
19
|
-
* @type {string}
|
|
20
|
-
*/
|
|
21
|
-
this.name = Utils.removeSnakeCase.recursive(name) || null;
|
|
22
|
-
/**
|
|
23
|
-
* Is Active Pet
|
|
24
|
-
* @type {boolean}
|
|
25
|
-
*/
|
|
26
|
-
this.active = data.currentPet === name.toUpperCase();
|
|
27
|
-
const stats = data.petStats && data.petStats[name.toUpperCase()];
|
|
28
|
-
/**
|
|
29
|
-
* Stats of the pet, if any
|
|
30
|
-
* @type {object}
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
module.exports = Pet;
|
|
1
|
+
const Utils = require('../utils');
|
|
2
|
+
/**
|
|
3
|
+
* Pet Class
|
|
4
|
+
*/
|
|
5
|
+
class Pet {
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} name Name of pet
|
|
8
|
+
* @param {object} data data
|
|
9
|
+
*/
|
|
10
|
+
constructor(name, data) {
|
|
11
|
+
/**
|
|
12
|
+
* Is Pet Favorite
|
|
13
|
+
* @type {boolean}
|
|
14
|
+
*/
|
|
15
|
+
this.isFavorite = data.vanityFavorites ? Boolean(data.vanityFavorites.includes(name.toUpperCase())) : false;
|
|
16
|
+
name = name.replace('pet_', '');
|
|
17
|
+
/**
|
|
18
|
+
* Official Name of the pet
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
this.name = Utils.removeSnakeCase.recursive(name) || null;
|
|
22
|
+
/**
|
|
23
|
+
* Is Active Pet
|
|
24
|
+
* @type {boolean}
|
|
25
|
+
*/
|
|
26
|
+
this.active = data.currentPet === name.toUpperCase();
|
|
27
|
+
const stats = data.petStats && data.petStats[name.toUpperCase()];
|
|
28
|
+
/**
|
|
29
|
+
* Stats of the pet, if any
|
|
30
|
+
* @type {object}
|
|
31
|
+
*/
|
|
32
|
+
if (!stats) return; // don't parse stats because there is none.
|
|
33
|
+
/**
|
|
34
|
+
* Hunger value ( 100 is highest )
|
|
35
|
+
* @type {?number}
|
|
36
|
+
*/
|
|
37
|
+
this.hunger = stats.HUNGER ? stats.HUNGER.value : null;
|
|
38
|
+
/**
|
|
39
|
+
* Last time the pet was fed ( timestamp )
|
|
40
|
+
* @type {?number}
|
|
41
|
+
*/
|
|
42
|
+
this.lastFed = stats.HUNGER ? stats.HUNGER.timestamp : null;
|
|
43
|
+
/**
|
|
44
|
+
* Last time the pet was fed ( Date )
|
|
45
|
+
* @type {?Date}
|
|
46
|
+
*/
|
|
47
|
+
this.lastFedAt = this.lastFed ? new Date(this.lastFed) : null;
|
|
48
|
+
/**
|
|
49
|
+
* Thirst value ( 100 is highest )
|
|
50
|
+
* @type {?number}
|
|
51
|
+
*/
|
|
52
|
+
this.thirst = stats.THIRST ? stats.THIRST.value : null;
|
|
53
|
+
/**
|
|
54
|
+
* Last time the pet drank ( timestamp )
|
|
55
|
+
* @type {?number}
|
|
56
|
+
*/
|
|
57
|
+
this.lastDrank = stats.THIRST ? stats.THIRST.timestamp : null;
|
|
58
|
+
/**
|
|
59
|
+
* Last time the pet drank ( Date )
|
|
60
|
+
* @type {?Date}
|
|
61
|
+
*/
|
|
62
|
+
this.lastDrankAt = this.lastDrank ? new Date(this.lastDrank) : null;
|
|
63
|
+
/**
|
|
64
|
+
* Exercise/Entertainment value ( 100 is highest )
|
|
65
|
+
* @type {?number}
|
|
66
|
+
*/
|
|
67
|
+
this.exercise = stats.EXERCISE ? stats.EXERCISE.value : null;
|
|
68
|
+
/**
|
|
69
|
+
* Last time the pet was exercised ( timestamp )
|
|
70
|
+
* @type {?number}
|
|
71
|
+
*/
|
|
72
|
+
this.lastExercised = stats.EXERCISE ? stats.EXERCISE.timestamp : null;
|
|
73
|
+
/**
|
|
74
|
+
* Last time the pet exercised ( Date )
|
|
75
|
+
* @type {?Date}
|
|
76
|
+
*/
|
|
77
|
+
this.lastExercisedAt = this.lastExercised ? new Date(this.lastExerciced) : null;
|
|
78
|
+
/**
|
|
79
|
+
* Raw Nickname, if any
|
|
80
|
+
* @type {?string}
|
|
81
|
+
*/
|
|
82
|
+
this.rawNickname = stats.name || null;
|
|
83
|
+
/**
|
|
84
|
+
* Nickname in plain text, if any
|
|
85
|
+
* @type {?string}
|
|
86
|
+
*/
|
|
87
|
+
this.nickname = stats.name ? stats.name.replace(/§([0-9]|[a-f])|§/gm, '') : null;
|
|
88
|
+
/**
|
|
89
|
+
* Pet experience
|
|
90
|
+
* @type {number}
|
|
91
|
+
*/
|
|
92
|
+
this.experience = stats.experience || 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = Pet;
|
package/src/structures/Pets.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
const Pet = require('./Pet');
|
|
2
|
-
/**
|
|
3
|
-
* Pets class
|
|
4
|
-
*/
|
|
5
|
-
class Pets {
|
|
6
|
-
/**
|
|
7
|
-
* @param {string[]} pets Array of pets
|
|
8
|
-
* @param {object} data data
|
|
9
|
-
*/
|
|
10
|
-
constructor
|
|
11
|
-
/**
|
|
12
|
-
* Array of pets
|
|
13
|
-
* @type {Pet[]}
|
|
14
|
-
*/
|
|
15
|
-
this.pets = pets.map((x) => new Pet(x, data));
|
|
16
|
-
/**
|
|
17
|
-
* Last Pet Journey ( as timestamp )
|
|
18
|
-
* @type {number|null}
|
|
19
|
-
*/
|
|
20
|
-
this.lastJourneyTimestamp = data.petJourneyTimestamp || null;
|
|
21
|
-
/**
|
|
22
|
-
* Last Pet Journey ( as Date )
|
|
23
|
-
* @type {Date|null}
|
|
24
|
-
*/
|
|
25
|
-
this.lastJourneyAt = this.lastJourneyTimestamp ? new Date(this.lastJourneyTimestamp) : null;
|
|
26
|
-
/**
|
|
27
|
-
* Pet food/drink/toys
|
|
28
|
-
* @type {PetConsumables}
|
|
29
|
-
*/
|
|
30
|
-
this.petConsumables = data.petConsumables;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @typedef {Object} PetConsumables
|
|
35
|
-
* @property {number} BAKED_POTATO Food
|
|
36
|
-
* @property {number} COOKIE Food
|
|
37
|
-
* @property {number} FEATHER Toy
|
|
38
|
-
* @property {number} HAY_BLOCK Food
|
|
39
|
-
* @property {number} SLIME_BALL Toy
|
|
40
|
-
* @property {number} COOKED_BEEF Food
|
|
41
|
-
* @property {number} RED_ROSE Food
|
|
42
|
-
* @property {number} WATER_BUCKET Drinks
|
|
43
|
-
* @property {number} MELON Food
|
|
44
|
-
* @property {number} STICK Toy
|
|
45
|
-
* @property {number} WOOD_SWORD Toy ( but not irl )
|
|
46
|
-
* @property {number} MILK_BUCKET Drinks
|
|
47
|
-
* @property {number} GOLD_RECORD Food
|
|
48
|
-
* @property {number} LEASH Toy
|
|
49
|
-
* @property {number} LAVA_BUCKET Drinks
|
|
50
|
-
* @property {number} BONE Food
|
|
51
|
-
* @property {number} MAGMA_CREAM Food
|
|
52
|
-
* @property {number} WHEAT Food
|
|
53
|
-
* @property {number} MUSHROOM_SOUP Food
|
|
54
|
-
* @property {number} BREAD Food
|
|
55
|
-
* @property {number} PUMPKIN_PIE Food
|
|
56
|
-
* @property {number} APPLE Food
|
|
57
|
-
* @property {number} CARROT_ITEM Carrots
|
|
58
|
-
* @property {number} RAW_FISH Food
|
|
59
|
-
* @property {number} PORK Food
|
|
60
|
-
* @property {number} CAKE Food
|
|
61
|
-
* @property {number} ROTTEN_FLESH Food
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
module.exports = Pets;
|
|
1
|
+
const Pet = require('./Pet');
|
|
2
|
+
/**
|
|
3
|
+
* Pets class
|
|
4
|
+
*/
|
|
5
|
+
class Pets {
|
|
6
|
+
/**
|
|
7
|
+
* @param {string[]} pets Array of pets
|
|
8
|
+
* @param {object} data data
|
|
9
|
+
*/
|
|
10
|
+
constructor(pets, data) {
|
|
11
|
+
/**
|
|
12
|
+
* Array of pets
|
|
13
|
+
* @type {Pet[]}
|
|
14
|
+
*/
|
|
15
|
+
this.pets = pets.map((x) => new Pet(x, data));
|
|
16
|
+
/**
|
|
17
|
+
* Last Pet Journey ( as timestamp )
|
|
18
|
+
* @type {number|null}
|
|
19
|
+
*/
|
|
20
|
+
this.lastJourneyTimestamp = data.petJourneyTimestamp || null;
|
|
21
|
+
/**
|
|
22
|
+
* Last Pet Journey ( as Date )
|
|
23
|
+
* @type {Date|null}
|
|
24
|
+
*/
|
|
25
|
+
this.lastJourneyAt = this.lastJourneyTimestamp ? new Date(this.lastJourneyTimestamp) : null;
|
|
26
|
+
/**
|
|
27
|
+
* Pet food/drink/toys
|
|
28
|
+
* @type {PetConsumables}
|
|
29
|
+
*/
|
|
30
|
+
this.petConsumables = data.petConsumables;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @typedef {Object} PetConsumables
|
|
35
|
+
* @property {number} BAKED_POTATO Food
|
|
36
|
+
* @property {number} COOKIE Food
|
|
37
|
+
* @property {number} FEATHER Toy
|
|
38
|
+
* @property {number} HAY_BLOCK Food
|
|
39
|
+
* @property {number} SLIME_BALL Toy
|
|
40
|
+
* @property {number} COOKED_BEEF Food
|
|
41
|
+
* @property {number} RED_ROSE Food
|
|
42
|
+
* @property {number} WATER_BUCKET Drinks
|
|
43
|
+
* @property {number} MELON Food
|
|
44
|
+
* @property {number} STICK Toy
|
|
45
|
+
* @property {number} WOOD_SWORD Toy ( but not irl )
|
|
46
|
+
* @property {number} MILK_BUCKET Drinks
|
|
47
|
+
* @property {number} GOLD_RECORD Food
|
|
48
|
+
* @property {number} LEASH Toy
|
|
49
|
+
* @property {number} LAVA_BUCKET Drinks
|
|
50
|
+
* @property {number} BONE Food
|
|
51
|
+
* @property {number} MAGMA_CREAM Food
|
|
52
|
+
* @property {number} WHEAT Food
|
|
53
|
+
* @property {number} MUSHROOM_SOUP Food
|
|
54
|
+
* @property {number} BREAD Food
|
|
55
|
+
* @property {number} PUMPKIN_PIE Food
|
|
56
|
+
* @property {number} APPLE Food
|
|
57
|
+
* @property {number} CARROT_ITEM Carrots
|
|
58
|
+
* @property {number} RAW_FISH Food
|
|
59
|
+
* @property {number} PORK Food
|
|
60
|
+
* @property {number} CAKE Food
|
|
61
|
+
* @property {number} ROTTEN_FLESH Food
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
module.exports = Pets;
|