hypixel-api-reborn 11.2.0 → 11.3.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 +1 -1
- package/eslint.config.mjs +71 -0
- package/package.json +14 -20
- package/src/API/getAchievements.js +1 -0
- package/src/API/getBoosters.js +1 -0
- package/src/API/getChallenges.js +1 -0
- package/src/API/getGameCounts.js +1 -0
- package/src/API/getGuild.js +4 -3
- package/src/API/getGuildAchievements.js +1 -0
- package/src/API/getLeaderboards.js +1 -1
- package/src/API/getPlayer.js +1 -0
- package/src/API/getQuests.js +1 -0
- package/src/API/getRecentGames.js +5 -9
- package/src/API/getServerInfo.js +40 -37
- package/src/API/getStatus.js +1 -0
- package/src/API/getWatchdogStats.js +1 -0
- package/src/API/housing/getActiveHouses.js +7 -0
- package/src/API/housing/getHouse.js +9 -0
- package/src/API/housing/getPlayerHouses.js +11 -0
- package/src/API/index.js +6 -1
- package/src/API/skyblock/getAuction.js +8 -6
- package/src/API/skyblock/getAuctions.js +15 -12
- package/src/API/skyblock/getAuctionsByPlayer.js +1 -1
- package/src/API/skyblock/getBazaar.js +1 -3
- package/src/API/skyblock/getBingo.js +1 -2
- package/src/API/skyblock/getBingoByPlayer.js +3 -3
- package/src/API/skyblock/getEndedAuctions.js +1 -0
- package/src/API/skyblock/getFireSales.js +1 -1
- package/src/API/skyblock/getGarden.js +7 -0
- package/src/API/skyblock/getGovernment.js +1 -2
- package/src/API/skyblock/getMember.js +5 -2
- package/src/API/skyblock/getMuseum.js +1 -0
- package/src/API/skyblock/getNews.js +1 -0
- package/src/API/skyblock/getProfiles.js +5 -2
- package/src/Client.js +88 -16
- package/src/Private/rateLimit.js +7 -11
- package/src/Private/requests.js +12 -13
- package/src/Private/updater.js +2 -3
- package/src/Private/uuidCache.js +1 -2
- package/src/Private/validate.js +19 -19
- package/src/index.js +5 -0
- package/src/structures/APIIncident.js +1 -2
- package/src/structures/APIStatus.js +0 -1
- package/src/structures/Boosters/Booster.js +9 -8
- package/src/structures/Game.js +1 -1
- package/src/structures/Guild/Guild.js +19 -36
- package/src/structures/Guild/GuildMember.js +2 -2
- package/src/structures/House.js +54 -0
- package/src/structures/MiniGames/Arcade.js +798 -312
- package/src/structures/MiniGames/ArenaBrawl.js +98 -32
- package/src/structures/MiniGames/BedWars.js +197 -194
- package/src/structures/MiniGames/BlitzSurvivalGames.js +381 -129
- package/src/structures/MiniGames/BuildBattle.js +19 -8
- package/src/structures/MiniGames/CopsAndCrims.js +253 -25
- package/src/structures/MiniGames/Duels.js +905 -664
- package/src/structures/MiniGames/MegaWalls.js +390 -51
- package/src/structures/MiniGames/MurderMystery.js +151 -30
- package/src/structures/MiniGames/Paintball.js +31 -11
- package/src/structures/MiniGames/Pit.js +4 -5
- package/src/structures/MiniGames/Quakecraft.js +113 -50
- package/src/structures/MiniGames/SkyWars.js +528 -372
- package/src/structures/MiniGames/SmashHeroes.js +201 -73
- package/src/structures/MiniGames/SpeedUHC.js +77 -24
- package/src/structures/MiniGames/TNTGames.js +242 -73
- package/src/structures/MiniGames/TurboKartRacers.js +55 -115
- package/src/structures/MiniGames/UHC.js +144 -132
- package/src/structures/MiniGames/VampireZ.js +70 -37
- package/src/structures/MiniGames/Warlords.js +126 -1
- package/src/structures/MiniGames/WoolWars.js +60 -9
- package/src/structures/Pet.js +1 -1
- package/src/structures/Player.js +43 -128
- package/src/structures/PlayerCosmetics.js +5 -4
- package/src/structures/SkyBlock/Auctions/AuctionInfo.js +2 -1
- package/src/structures/SkyBlock/Auctions/BaseAuction.js +1 -1
- package/src/structures/SkyBlock/News/SkyblockNews.js +15 -15
- package/src/structures/SkyBlock/PlayerBingo.js +7 -14
- package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
- package/src/structures/SkyBlock/SkyblockInventoryItem.js +4 -28
- package/src/structures/SkyBlock/SkyblockMember.js +90 -228
- package/src/structures/SkyBlock/SkyblockPet.js +3 -4
- package/src/structures/SkyBlock/Static/Bingo.js +10 -11
- package/src/structures/SkyBlock/Static/BingoData.js +1 -1
- package/src/structures/Static/Achievement.js +16 -15
- package/src/structures/Static/AchievementTier.js +2 -2
- package/src/structures/Static/Quest.js +2 -2
- package/src/utils/Constants.js +522 -520
- package/src/utils/{guildExp.js → Guild.js} +42 -12
- package/src/utils/Player.js +112 -0
- package/src/utils/SkyblockUtils.js +482 -192
- package/src/utils/arrayTools.js +1 -1
- package/src/utils/divide.js +1 -1
- package/src/utils/index.js +2 -1
- package/src/utils/isGuildID.js +1 -1
- package/src/utils/oscillation.js +4 -2
- package/src/utils/removeSnakeCase.js +11 -7
- package/src/utils/rgbToHexColor.js +1 -1
- package/src/utils/romanize.js +3 -3
- package/src/utils/toUuid.js +4 -4
- package/src/utils/varInt.js +2 -2
- package/typings/index.d.ts +1186 -967
- package/src/utils/toIGN.js +0 -24
|
@@ -1,182 +1,194 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
1
|
const divide = require('../../utils/divide');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
4
|
+
function getStarLevel(kills, wins) {
|
|
5
|
+
const sum = Number(kills) + wins * 10;
|
|
6
|
+
let starLevel = 1;
|
|
7
|
+
const sums = [0, 1, 6, 21, 46, 96, 171, 271, 521, 1021, 1321, 1621, 1921, 2221, 2521, Infinity];
|
|
8
|
+
starLevel += sums.map((x) => x * 10 - sum).findIndex((x) => 0 < x) - 1;
|
|
9
|
+
return starLevel;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class UHCGamemode {
|
|
7
13
|
/**
|
|
8
14
|
* @param {object} data UHC data
|
|
15
|
+
* @param {string} mode UHC Mode Name
|
|
9
16
|
*/
|
|
10
|
-
constructor(data) {
|
|
17
|
+
constructor(data, mode) {
|
|
18
|
+
if (mode) mode = `_${mode}`;
|
|
11
19
|
/**
|
|
12
|
-
*
|
|
20
|
+
* Kills
|
|
13
21
|
* @type {number}
|
|
14
22
|
*/
|
|
15
|
-
this.
|
|
23
|
+
this.kills = data[`kills${mode}`] || 0;
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* Deaths
|
|
18
26
|
* @type {number}
|
|
19
27
|
*/
|
|
20
|
-
this.
|
|
28
|
+
this.deaths = data[`deaths${mode}`] || 0;
|
|
21
29
|
/**
|
|
22
|
-
*
|
|
30
|
+
* Wins
|
|
23
31
|
* @type {number}
|
|
24
32
|
*/
|
|
25
|
-
this.
|
|
26
|
-
(data.kills || 0) +
|
|
27
|
-
(data.kills_solo || 0) +
|
|
28
|
-
(data['kills_red vs blue'] || 0) +
|
|
29
|
-
(data['kills_no diamonds'] || 0) +
|
|
30
|
-
(data.kills_brawl || 0) +
|
|
31
|
-
(data['kills_solo brawl'] || 0) +
|
|
32
|
-
(data['kills_duo brawl'] || 0);
|
|
33
|
+
this.wins = data[`wins${mode}`] || 0;
|
|
33
34
|
/**
|
|
34
|
-
*
|
|
35
|
+
* Golden Heads Eaten
|
|
35
36
|
* @type {number}
|
|
36
37
|
*/
|
|
37
|
-
this.
|
|
38
|
-
(data.deaths || 0) +
|
|
39
|
-
(data.deaths_solo || 0) +
|
|
40
|
-
(data['deaths_red vs blue'] || 0) +
|
|
41
|
-
(data['deaths_no diamonds'] || 0) +
|
|
42
|
-
(data.deaths_brawl || 0) +
|
|
43
|
-
(data['deaths_solo brawl'] || 0) +
|
|
44
|
-
(data['deaths_duo brawl'] || 0);
|
|
38
|
+
this.headsEaten = data[`heads_eaten${mode}`] || 0;
|
|
45
39
|
/**
|
|
46
|
-
*
|
|
40
|
+
* Ultimates Crafted
|
|
47
41
|
* @type {number}
|
|
48
42
|
*/
|
|
49
|
-
this.
|
|
43
|
+
this.ultimatesCrafted = data[`ultimates_crafted${mode}`] || 0;
|
|
50
44
|
/**
|
|
51
|
-
*
|
|
45
|
+
* Extra Ultimates Crafted
|
|
52
46
|
* @type {number}
|
|
53
47
|
*/
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
this.extraUltimatesCrafted = data[`extra_ultimates_crafted${mode}`] || 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* UHC class
|
|
54
|
+
*/
|
|
55
|
+
class UHC {
|
|
56
|
+
/**
|
|
57
|
+
* @param {object} data UHC data
|
|
58
|
+
*/
|
|
59
|
+
constructor(data) {
|
|
62
60
|
/**
|
|
63
|
-
*
|
|
61
|
+
* Coins
|
|
64
62
|
* @type {number}
|
|
65
63
|
*/
|
|
66
|
-
this.
|
|
67
|
-
(data.heads_eaten || 0) +
|
|
68
|
-
(data.heads_eaten_solo || 0) +
|
|
69
|
-
(data['heads_eaten_red vs blue'] || 0) +
|
|
70
|
-
(data['heads_eaten_no diamonds'] || 0) +
|
|
71
|
-
(data.heads_eaten_brawl || 0) +
|
|
72
|
-
(data['heads_eaten_solo brawl'] || 0) +
|
|
73
|
-
(data['heads_eaten_duo brawl'] || 0);
|
|
64
|
+
this.coins = data.coins || 0;
|
|
74
65
|
/**
|
|
75
|
-
*
|
|
66
|
+
* Score
|
|
76
67
|
* @type {number}
|
|
77
68
|
*/
|
|
78
|
-
this.
|
|
69
|
+
this.score = data.score || 0;
|
|
70
|
+
/**
|
|
71
|
+
* Selected Kit
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
this.kit = data.equippedKit || '';
|
|
79
75
|
/**
|
|
80
76
|
* Solo
|
|
81
|
-
* @type {
|
|
77
|
+
* @type {UHCGamemode}
|
|
82
78
|
*/
|
|
83
|
-
this.solo =
|
|
84
|
-
kills: data.kills_solo || 0,
|
|
85
|
-
deaths: data.deaths_solo || 0,
|
|
86
|
-
wins: data.wins_solo || 0,
|
|
87
|
-
headsEaten: data.heads_eaten_solo || 0
|
|
88
|
-
};
|
|
79
|
+
this.solo = new UHCGamemode(data, 'solo');
|
|
89
80
|
/**
|
|
90
|
-
*
|
|
91
|
-
* @type {
|
|
81
|
+
* Teams
|
|
82
|
+
* @type {UHCGamemode}
|
|
92
83
|
*/
|
|
93
|
-
this.team =
|
|
94
|
-
kills: data.kills || 0,
|
|
95
|
-
deaths: data.deaths || 0,
|
|
96
|
-
wins: data.wins || 0,
|
|
97
|
-
headsEaten: data.heads_eaten || 0
|
|
98
|
-
};
|
|
84
|
+
this.team = new UHCGamemode(data);
|
|
99
85
|
/**
|
|
100
86
|
* Red vs Blue
|
|
101
|
-
* @type {
|
|
87
|
+
* @type {UHCGamemode}
|
|
102
88
|
*/
|
|
103
|
-
this.redVsBlue =
|
|
104
|
-
kills: data['kills_red vs blue'] || 0,
|
|
105
|
-
deaths: data['deaths_red vs blue'] || 0,
|
|
106
|
-
wins: data['wins_red vs blue'] || 0,
|
|
107
|
-
headsEaten: data['heads_eaten_red vs blue'] || 0
|
|
108
|
-
};
|
|
89
|
+
this.redVsBlue = new UHCGamemode(data, 'red_vs_blue');
|
|
109
90
|
/**
|
|
110
91
|
* No Diamond
|
|
111
|
-
* @type {
|
|
92
|
+
* @type {UHCGamemode}
|
|
112
93
|
*/
|
|
113
|
-
this.noDiamond =
|
|
114
|
-
kills: data['kills_no diamonds'] || 0,
|
|
115
|
-
deaths: data['deaths_no diamonds'] || 0,
|
|
116
|
-
wins: data['wins_no diamonds'] || 0,
|
|
117
|
-
headsEaten: data['heads_eaten_no diamonds'] || 0
|
|
118
|
-
};
|
|
94
|
+
this.noDiamond = new UHCGamemode(data, 'no_diamonds');
|
|
119
95
|
/**
|
|
120
96
|
* Brawl
|
|
121
|
-
* @type {
|
|
97
|
+
* @type {UHCGamemode}
|
|
122
98
|
*/
|
|
123
|
-
this.brawl =
|
|
124
|
-
kills: data.kills_brawl || 0,
|
|
125
|
-
deaths: data.deaths_brawl || 0,
|
|
126
|
-
wins: data.wins_brawl || 0,
|
|
127
|
-
headsEaten: data.heads_eaten_brawl || 0
|
|
128
|
-
};
|
|
99
|
+
this.brawl = new UHCGamemode(data, 'brawl');
|
|
129
100
|
/**
|
|
130
101
|
* Solo brawl
|
|
131
|
-
* @type {
|
|
102
|
+
* @type {UHCGamemode}
|
|
132
103
|
*/
|
|
133
|
-
this.soloBrawl =
|
|
134
|
-
kills: data['kills_solo brawl'] || 0,
|
|
135
|
-
deaths: data['deaths_solo brawl'] || 0,
|
|
136
|
-
wins: data['wins_solo brawl'] || 0,
|
|
137
|
-
headsEaten: data['heads_eaten_solo brawl'] || 0
|
|
138
|
-
};
|
|
104
|
+
this.soloBrawl = new UHCGamemode(data, 'solo_brawl');
|
|
139
105
|
/**
|
|
140
106
|
* Duo Brawl
|
|
141
|
-
* @type {
|
|
142
|
-
*/
|
|
143
|
-
this.duoBrawl =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
107
|
+
* @type {UHCGamemode}
|
|
108
|
+
*/
|
|
109
|
+
this.duoBrawl = new UHCGamemode(data, 'duo_brawl');
|
|
110
|
+
/**
|
|
111
|
+
* Wins
|
|
112
|
+
* @type {number}
|
|
113
|
+
*/
|
|
114
|
+
this.wins =
|
|
115
|
+
this.solo.wins +
|
|
116
|
+
this.team.wins +
|
|
117
|
+
this.redVsBlue.wins +
|
|
118
|
+
this.noDiamond.wins +
|
|
119
|
+
this.brawl.wins +
|
|
120
|
+
this.soloBrawl.wins +
|
|
121
|
+
this.duoBrawl.wins;
|
|
122
|
+
/**
|
|
123
|
+
* Kills
|
|
124
|
+
* @type {number}
|
|
125
|
+
*/
|
|
126
|
+
this.kills =
|
|
127
|
+
this.solo.kills +
|
|
128
|
+
this.team.kills +
|
|
129
|
+
this.redVsBlue.kills +
|
|
130
|
+
this.noDiamond.kills +
|
|
131
|
+
this.brawl.kills +
|
|
132
|
+
this.soloBrawl.kills +
|
|
133
|
+
this.duoBrawl.kills;
|
|
134
|
+
/**
|
|
135
|
+
* Deaths
|
|
136
|
+
* @type {number}
|
|
137
|
+
*/
|
|
138
|
+
this.deaths =
|
|
139
|
+
this.solo.deaths +
|
|
140
|
+
this.team.deaths +
|
|
141
|
+
this.redVsBlue.deaths +
|
|
142
|
+
this.noDiamond.deaths +
|
|
143
|
+
this.brawl.deaths +
|
|
144
|
+
this.soloBrawl.deaths +
|
|
145
|
+
this.duoBrawl.deaths;
|
|
146
|
+
/**
|
|
147
|
+
* Kill/Death ratio
|
|
148
|
+
* @type {number}
|
|
149
|
+
*/
|
|
150
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
151
|
+
/**
|
|
152
|
+
* Heads eaten
|
|
153
|
+
* @type {number}
|
|
154
|
+
*/
|
|
155
|
+
this.headsEaten =
|
|
156
|
+
this.solo.headsEaten +
|
|
157
|
+
this.team.headsEaten +
|
|
158
|
+
this.redVsBlue.headsEaten +
|
|
159
|
+
this.noDiamond.headsEaten +
|
|
160
|
+
this.brawl.headsEaten +
|
|
161
|
+
this.soloBrawl.headsEaten +
|
|
162
|
+
this.duoBrawl.headsEaten;
|
|
163
|
+
/**
|
|
164
|
+
* Ultimates Crafted
|
|
165
|
+
* @type {number}
|
|
166
|
+
*/
|
|
167
|
+
this.ultimatesCrafted =
|
|
168
|
+
this.solo.ultimatesCrafted +
|
|
169
|
+
this.team.ultimatesCrafted +
|
|
170
|
+
this.redVsBlue.ultimatesCrafted +
|
|
171
|
+
this.noDiamond.ultimatesCrafted +
|
|
172
|
+
this.brawl.ultimatesCrafted +
|
|
173
|
+
this.soloBrawl.ultimatesCrafted +
|
|
174
|
+
this.duoBrawl.ultimatesCrafted;
|
|
175
|
+
/**
|
|
176
|
+
* Extra Ultimates Crafted
|
|
177
|
+
* @type {number}
|
|
178
|
+
*/
|
|
179
|
+
this.extraUltimatesCrafted =
|
|
180
|
+
this.solo.extraUltimatesCrafted +
|
|
181
|
+
this.team.extraUltimatesCrafted +
|
|
182
|
+
this.redVsBlue.extraUltimatesCrafted +
|
|
183
|
+
this.noDiamond.extraUltimatesCrafted +
|
|
184
|
+
this.brawl.extraUltimatesCrafted +
|
|
185
|
+
this.soloBrawl.extraUltimatesCrafted +
|
|
186
|
+
this.duoBrawl.extraUltimatesCrafted;
|
|
187
|
+
/**
|
|
188
|
+
* Star level
|
|
189
|
+
* @type {number}
|
|
190
|
+
*/
|
|
191
|
+
this.starLevel = getStarLevel(this.kills, this.wins);
|
|
149
192
|
}
|
|
150
193
|
}
|
|
151
|
-
// eslint-disable-next-line require-jsdoc
|
|
152
|
-
function getStarLevel(data) {
|
|
153
|
-
const kills =
|
|
154
|
-
(data.kills || 0) +
|
|
155
|
-
(data.kills_solo || 0) +
|
|
156
|
-
(data['kills_red vs blue'] || 0) +
|
|
157
|
-
(data['kills_no diamonds'] || 0) +
|
|
158
|
-
(data.kills_brawl || 0) +
|
|
159
|
-
(data['kills_solo brawl'] || 0) +
|
|
160
|
-
(data['kills_duo brawl'] || 0);
|
|
161
|
-
const wins =
|
|
162
|
-
(data.wins || 0) +
|
|
163
|
-
(data.wins_solo || 0) +
|
|
164
|
-
(data['wins_red vs blue'] || 0) +
|
|
165
|
-
(data['wins_no diamonds'] || 0) +
|
|
166
|
-
(data.wins_brawl || 0) +
|
|
167
|
-
(data['wins_solo brawl'] || 0) +
|
|
168
|
-
(data['wins_duo brawl'] || 0);
|
|
169
|
-
const sum = kills * 1 + wins * 10;
|
|
170
|
-
let starLevel = 1;
|
|
171
|
-
const sums = [0, 1, 6, 21, 46, 96, 171, 271, 521, 1021, 1321, 1621, 1921, 2221, 2521, Infinity];
|
|
172
|
-
starLevel += sums.map((x) => x * 10 - sum).findIndex((x) => x > 0) - 1;
|
|
173
|
-
return starLevel;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @typedef {object} UHCModeStats
|
|
177
|
-
* @property {number} kills Kills
|
|
178
|
-
* @property {number} deaths Deaths
|
|
179
|
-
* @property {number} wins Wins
|
|
180
|
-
* @property {number} headsEaten Heads eaten
|
|
181
|
-
*/
|
|
182
194
|
module.exports = UHC;
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
const divide = require('../../utils/divide');
|
|
2
|
+
|
|
3
|
+
class VampireZRole {
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} data VampireZ data
|
|
6
|
+
* @param {string} role VampireZ Role
|
|
7
|
+
*/
|
|
8
|
+
constructor(data, role) {
|
|
9
|
+
/**
|
|
10
|
+
* Kills
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.kills = data[`${role}_kills`];
|
|
14
|
+
/**
|
|
15
|
+
* Deaths
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
this.deaths = data[`${role}_deaths`];
|
|
19
|
+
/**
|
|
20
|
+
* KDRatio
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
24
|
+
/**
|
|
25
|
+
* Wins
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
this.wins = data[`${role}_wins`];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
2
32
|
/**
|
|
3
33
|
* VampireZ class
|
|
4
34
|
*/
|
|
@@ -13,48 +43,51 @@ class VampireZ {
|
|
|
13
43
|
*/
|
|
14
44
|
this.coins = data.coins || 0;
|
|
15
45
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @type {
|
|
46
|
+
* Gold Bought
|
|
47
|
+
* @type {number}
|
|
18
48
|
*/
|
|
19
|
-
this.
|
|
20
|
-
kills: data.human_kills || 0,
|
|
21
|
-
deaths: data.human_deaths || 0,
|
|
22
|
-
KDRatio: divide(data.human_kills, data.human_wins),
|
|
23
|
-
wins: data.human_wins || 0
|
|
24
|
-
};
|
|
49
|
+
this.goldBought = data.gold_bought || 0;
|
|
25
50
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @type {
|
|
51
|
+
* Blood
|
|
52
|
+
* @type {boolean}
|
|
53
|
+
*/
|
|
54
|
+
this.blood = data.blood || false;
|
|
55
|
+
/**
|
|
56
|
+
* Zombie Kills
|
|
57
|
+
* @type {number}
|
|
28
58
|
*/
|
|
29
|
-
this.
|
|
30
|
-
kills: data.zombie_kills || 0
|
|
31
|
-
};
|
|
59
|
+
this.zombieKills = data.zombie_kills || 0;
|
|
32
60
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @type {
|
|
61
|
+
* Human Stats
|
|
62
|
+
* @type {VampireZRole}
|
|
35
63
|
*/
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
this.human = new VampireZRole(data, 'human');
|
|
65
|
+
/**
|
|
66
|
+
* Vampire Stats
|
|
67
|
+
* @type {VampireZRole}
|
|
68
|
+
*/
|
|
69
|
+
this.vampire = new VampireZRole(data, 'vampire');
|
|
70
|
+
/**
|
|
71
|
+
* Kills
|
|
72
|
+
* @type {number}
|
|
73
|
+
*/
|
|
74
|
+
this.kills = this.human.kills + this.vampire.kills;
|
|
75
|
+
/**
|
|
76
|
+
* Deaths
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
this.deaths = this.human.deaths + this.vampire.deaths;
|
|
80
|
+
/**
|
|
81
|
+
* KDRatio
|
|
82
|
+
* @type {number}
|
|
83
|
+
*/
|
|
84
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
85
|
+
/**
|
|
86
|
+
* Wins
|
|
87
|
+
* @type {number}
|
|
88
|
+
*/
|
|
89
|
+
this.wins = this.human.wins + this.vampire.wins;
|
|
41
90
|
}
|
|
42
91
|
}
|
|
43
|
-
|
|
44
|
-
* @typedef {object} VampireZHumanStats
|
|
45
|
-
* @property {number} kills Kills
|
|
46
|
-
* @property {number} deaths Deaths
|
|
47
|
-
* @property {number} KDRatio Kill Death ratio
|
|
48
|
-
* @property {number} wins Wins
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {object} VampireZZombieStats
|
|
52
|
-
* @property {number} kills Kills
|
|
53
|
-
*/
|
|
54
|
-
/**
|
|
55
|
-
* @typedef {object} VampireZVampireStats
|
|
56
|
-
* @property {number} kills Kills
|
|
57
|
-
* @property {number} deaths Deaths
|
|
58
|
-
* @property {number} KDRatio Kill Death ratio
|
|
59
|
-
*/
|
|
92
|
+
|
|
60
93
|
module.exports = VampireZ;
|
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
const divide = require('../../utils/divide');
|
|
2
|
+
|
|
3
|
+
class WarlordsClass {
|
|
4
|
+
/**
|
|
5
|
+
* @param {object} data Warlords data
|
|
6
|
+
* @param {string} className
|
|
7
|
+
*/
|
|
8
|
+
constructor(data, className) {
|
|
9
|
+
/**
|
|
10
|
+
* Wins
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
this.wins = data[`wins_${className}`] || 0;
|
|
14
|
+
/**
|
|
15
|
+
* Losses
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
this.losses = data[`losses_${className}`] || 0;
|
|
19
|
+
/**
|
|
20
|
+
* WLRatio
|
|
21
|
+
* @type {number}
|
|
22
|
+
*/
|
|
23
|
+
this.WLRatio = divide(this.wins, this.losses);
|
|
24
|
+
/**
|
|
25
|
+
* Games Played
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
this.gamesPlayed = data[`${className}_plays`];
|
|
29
|
+
/**
|
|
30
|
+
* Damage
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
this.damage = data[`damage_${className}`] || 0;
|
|
34
|
+
/**
|
|
35
|
+
* Heal
|
|
36
|
+
* @type {number}
|
|
37
|
+
*/
|
|
38
|
+
this.heal = data[`heal_${className}`] || 0;
|
|
39
|
+
/**
|
|
40
|
+
* Damage Prevented
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
this.damagePrevented = data[`damage_prevented_${className}`] || 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
2
47
|
/**
|
|
3
48
|
* Warlords class
|
|
4
49
|
*/
|
|
@@ -56,7 +101,87 @@ class Warlords {
|
|
|
56
101
|
* Chosen class
|
|
57
102
|
* @type {string}
|
|
58
103
|
*/
|
|
59
|
-
this.class = data.chosen_class ||
|
|
104
|
+
this.class = data.chosen_class || '';
|
|
105
|
+
/**
|
|
106
|
+
* pyromancer
|
|
107
|
+
* @type {WarlordsClass}
|
|
108
|
+
*/
|
|
109
|
+
this.pyromancer = new WarlordsClass(data, 'pyromancer');
|
|
110
|
+
/**
|
|
111
|
+
* mage
|
|
112
|
+
* @type {WarlordsClass}
|
|
113
|
+
*/
|
|
114
|
+
this.mage = new WarlordsClass(data, 'mage');
|
|
115
|
+
/**
|
|
116
|
+
* thunderlord
|
|
117
|
+
* @type {WarlordsClass}
|
|
118
|
+
*/
|
|
119
|
+
this.thunderlord = new WarlordsClass(data, 'thunderlord');
|
|
120
|
+
/**
|
|
121
|
+
* shaman
|
|
122
|
+
* @type {WarlordsClass}
|
|
123
|
+
*/
|
|
124
|
+
this.shaman = new WarlordsClass(data, 'shaman');
|
|
125
|
+
/**
|
|
126
|
+
* earthwarden
|
|
127
|
+
* @type {WarlordsClass}
|
|
128
|
+
*/
|
|
129
|
+
this.earthwarden = new WarlordsClass(data, 'earthwarden');
|
|
130
|
+
/**
|
|
131
|
+
* aquamancer
|
|
132
|
+
* @type {WarlordsClass}
|
|
133
|
+
*/
|
|
134
|
+
this.aquamancer = new WarlordsClass(data, 'aquamancer');
|
|
135
|
+
/**
|
|
136
|
+
* paladin
|
|
137
|
+
* @type {WarlordsClass}
|
|
138
|
+
*/
|
|
139
|
+
this.paladin = new WarlordsClass(data, 'paladin');
|
|
140
|
+
/**
|
|
141
|
+
* avenger
|
|
142
|
+
* @type {WarlordsClass}
|
|
143
|
+
*/
|
|
144
|
+
this.avenger = new WarlordsClass(data, 'avenger');
|
|
145
|
+
/**
|
|
146
|
+
* warrior
|
|
147
|
+
* @type {WarlordsClass}
|
|
148
|
+
*/
|
|
149
|
+
this.warrior = new WarlordsClass(data, 'warrior');
|
|
150
|
+
/**
|
|
151
|
+
* defender
|
|
152
|
+
* @type {WarlordsClass}
|
|
153
|
+
*/
|
|
154
|
+
this.defender = new WarlordsClass(data, 'defender');
|
|
155
|
+
/**
|
|
156
|
+
* cryomancer
|
|
157
|
+
* @type {WarlordsClass}
|
|
158
|
+
*/
|
|
159
|
+
this.cryomancer = new WarlordsClass(data, 'cryomancer');
|
|
160
|
+
/**
|
|
161
|
+
* crusader
|
|
162
|
+
* @type {WarlordsClass}
|
|
163
|
+
*/
|
|
164
|
+
this.crusader = new WarlordsClass(data, 'crusader');
|
|
165
|
+
/**
|
|
166
|
+
* berserker
|
|
167
|
+
* @type {WarlordsClass}
|
|
168
|
+
*/
|
|
169
|
+
this.berserker = new WarlordsClass(data, 'berserker');
|
|
170
|
+
/**
|
|
171
|
+
* protector
|
|
172
|
+
* @type {WarlordsClass}
|
|
173
|
+
*/
|
|
174
|
+
this.protector = new WarlordsClass(data, 'protector');
|
|
175
|
+
/**
|
|
176
|
+
* revenant
|
|
177
|
+
* @type {WarlordsClass}
|
|
178
|
+
*/
|
|
179
|
+
this.revenant = new WarlordsClass(data, 'revenant');
|
|
180
|
+
/**
|
|
181
|
+
* spiritguard
|
|
182
|
+
* @type {WarlordsClass}
|
|
183
|
+
*/
|
|
184
|
+
this.spiritguard = new WarlordsClass(data, 'spiritguard');
|
|
60
185
|
}
|
|
61
186
|
}
|
|
62
187
|
module.exports = Warlords;
|