hypixel-api-reborn 11.2.1 → 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/package.json +8 -8
- 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/getGarden.js +7 -0
- package/src/API/skyblock/getMember.js +4 -2
- package/src/API/skyblock/getProfiles.js +4 -2
- package/src/Client.js +46 -2
- package/src/Private/requests.js +1 -1
- package/src/index.js +5 -0
- package/src/structures/House.js +54 -0
- package/src/structures/MiniGames/Arcade.js +754 -270
- package/src/structures/MiniGames/ArenaBrawl.js +97 -31
- package/src/structures/MiniGames/BlitzSurvivalGames.js +378 -127
- package/src/structures/MiniGames/BuildBattle.js +19 -8
- package/src/structures/MiniGames/CopsAndCrims.js +252 -25
- package/src/structures/MiniGames/Duels.js +899 -656
- 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/Quakecraft.js +113 -50
- package/src/structures/MiniGames/SkyWars.js +340 -195
- package/src/structures/MiniGames/SmashHeroes.js +195 -69
- package/src/structures/MiniGames/SpeedUHC.js +76 -36
- package/src/structures/MiniGames/TNTGames.js +242 -73
- package/src/structures/MiniGames/TurboKartRacers.js +55 -115
- package/src/structures/MiniGames/UHC.js +135 -124
- package/src/structures/MiniGames/VampireZ.js +70 -37
- package/src/structures/MiniGames/Warlords.js +126 -1
- package/src/structures/MiniGames/WoolWars.js +54 -4
- package/src/structures/Player.js +30 -24
- package/src/structures/SkyBlock/SkyblockGarden.js +146 -0
- package/src/structures/SkyBlock/SkyblockMember.js +12 -5
- package/src/utils/Constants.js +507 -5
- package/src/utils/SkyblockUtils.js +33 -0
- package/typings/index.d.ts +911 -802
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
const divide = require('../../utils/divide');
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
4
|
-
function getStarLevel(
|
|
5
|
-
const kills =
|
|
6
|
-
(data.kills || 0) +
|
|
7
|
-
(data.kills_solo || 0) +
|
|
8
|
-
(data['kills_red vs blue'] || 0) +
|
|
9
|
-
(data['kills_no diamonds'] || 0) +
|
|
10
|
-
(data.kills_brawl || 0) +
|
|
11
|
-
(data['kills_solo brawl'] || 0) +
|
|
12
|
-
(data['kills_duo brawl'] || 0);
|
|
13
|
-
const wins =
|
|
14
|
-
(data.wins || 0) +
|
|
15
|
-
(data.wins_solo || 0) +
|
|
16
|
-
(data['wins_red vs blue'] || 0) +
|
|
17
|
-
(data['wins_no diamonds'] || 0) +
|
|
18
|
-
(data.wins_brawl || 0) +
|
|
19
|
-
(data['wins_solo brawl'] || 0) +
|
|
20
|
-
(data['wins_duo brawl'] || 0);
|
|
4
|
+
function getStarLevel(kills, wins) {
|
|
21
5
|
const sum = Number(kills) + wins * 10;
|
|
22
6
|
let starLevel = 1;
|
|
23
7
|
const sums = [0, 1, 6, 21, 46, 96, 171, 271, 521, 1021, 1321, 1621, 1921, 2221, 2521, Infinity];
|
|
@@ -25,159 +9,186 @@ function getStarLevel(data) {
|
|
|
25
9
|
return starLevel;
|
|
26
10
|
}
|
|
27
11
|
|
|
28
|
-
|
|
29
|
-
* UHC class
|
|
30
|
-
*/
|
|
31
|
-
class UHC {
|
|
12
|
+
class UHCGamemode {
|
|
32
13
|
/**
|
|
33
14
|
* @param {object} data UHC data
|
|
15
|
+
* @param {string} mode UHC Mode Name
|
|
34
16
|
*/
|
|
35
|
-
constructor(data) {
|
|
17
|
+
constructor(data, mode) {
|
|
18
|
+
if (mode) mode = `_${mode}`;
|
|
36
19
|
/**
|
|
37
|
-
*
|
|
20
|
+
* Kills
|
|
38
21
|
* @type {number}
|
|
39
22
|
*/
|
|
40
|
-
this.
|
|
23
|
+
this.kills = data[`kills${mode}`] || 0;
|
|
41
24
|
/**
|
|
42
|
-
*
|
|
25
|
+
* Deaths
|
|
43
26
|
* @type {number}
|
|
44
27
|
*/
|
|
45
|
-
this.
|
|
28
|
+
this.deaths = data[`deaths${mode}`] || 0;
|
|
46
29
|
/**
|
|
47
|
-
*
|
|
30
|
+
* Wins
|
|
48
31
|
* @type {number}
|
|
49
32
|
*/
|
|
50
|
-
this.
|
|
51
|
-
(data.kills || 0) +
|
|
52
|
-
(data.kills_solo || 0) +
|
|
53
|
-
(data['kills_red vs blue'] || 0) +
|
|
54
|
-
(data['kills_no diamonds'] || 0) +
|
|
55
|
-
(data.kills_brawl || 0) +
|
|
56
|
-
(data['kills_solo brawl'] || 0) +
|
|
57
|
-
(data['kills_duo brawl'] || 0);
|
|
33
|
+
this.wins = data[`wins${mode}`] || 0;
|
|
58
34
|
/**
|
|
59
|
-
*
|
|
35
|
+
* Golden Heads Eaten
|
|
60
36
|
* @type {number}
|
|
61
37
|
*/
|
|
62
|
-
this.
|
|
63
|
-
(data.deaths || 0) +
|
|
64
|
-
(data.deaths_solo || 0) +
|
|
65
|
-
(data['deaths_red vs blue'] || 0) +
|
|
66
|
-
(data['deaths_no diamonds'] || 0) +
|
|
67
|
-
(data.deaths_brawl || 0) +
|
|
68
|
-
(data['deaths_solo brawl'] || 0) +
|
|
69
|
-
(data['deaths_duo brawl'] || 0);
|
|
38
|
+
this.headsEaten = data[`heads_eaten${mode}`] || 0;
|
|
70
39
|
/**
|
|
71
|
-
*
|
|
40
|
+
* Ultimates Crafted
|
|
72
41
|
* @type {number}
|
|
73
42
|
*/
|
|
74
|
-
this.
|
|
43
|
+
this.ultimatesCrafted = data[`ultimates_crafted${mode}`] || 0;
|
|
75
44
|
/**
|
|
76
|
-
*
|
|
45
|
+
* Extra Ultimates Crafted
|
|
77
46
|
* @type {number}
|
|
78
47
|
*/
|
|
79
|
-
this.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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) {
|
|
87
60
|
/**
|
|
88
|
-
*
|
|
61
|
+
* Coins
|
|
89
62
|
* @type {number}
|
|
90
63
|
*/
|
|
91
|
-
this.
|
|
92
|
-
(data.heads_eaten || 0) +
|
|
93
|
-
(data.heads_eaten_solo || 0) +
|
|
94
|
-
(data['heads_eaten_red vs blue'] || 0) +
|
|
95
|
-
(data['heads_eaten_no diamonds'] || 0) +
|
|
96
|
-
(data.heads_eaten_brawl || 0) +
|
|
97
|
-
(data['heads_eaten_solo brawl'] || 0) +
|
|
98
|
-
(data['heads_eaten_duo brawl'] || 0);
|
|
64
|
+
this.coins = data.coins || 0;
|
|
99
65
|
/**
|
|
100
|
-
*
|
|
66
|
+
* Score
|
|
101
67
|
* @type {number}
|
|
102
68
|
*/
|
|
103
|
-
this.
|
|
69
|
+
this.score = data.score || 0;
|
|
70
|
+
/**
|
|
71
|
+
* Selected Kit
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
this.kit = data.equippedKit || '';
|
|
104
75
|
/**
|
|
105
76
|
* Solo
|
|
106
|
-
* @type {
|
|
77
|
+
* @type {UHCGamemode}
|
|
107
78
|
*/
|
|
108
|
-
this.solo =
|
|
109
|
-
kills: data.kills_solo || 0,
|
|
110
|
-
deaths: data.deaths_solo || 0,
|
|
111
|
-
wins: data.wins_solo || 0,
|
|
112
|
-
headsEaten: data.heads_eaten_solo || 0
|
|
113
|
-
};
|
|
79
|
+
this.solo = new UHCGamemode(data, 'solo');
|
|
114
80
|
/**
|
|
115
|
-
*
|
|
116
|
-
* @type {
|
|
81
|
+
* Teams
|
|
82
|
+
* @type {UHCGamemode}
|
|
117
83
|
*/
|
|
118
|
-
this.team =
|
|
119
|
-
kills: data.kills || 0,
|
|
120
|
-
deaths: data.deaths || 0,
|
|
121
|
-
wins: data.wins || 0,
|
|
122
|
-
headsEaten: data.heads_eaten || 0
|
|
123
|
-
};
|
|
84
|
+
this.team = new UHCGamemode(data);
|
|
124
85
|
/**
|
|
125
86
|
* Red vs Blue
|
|
126
|
-
* @type {
|
|
87
|
+
* @type {UHCGamemode}
|
|
127
88
|
*/
|
|
128
|
-
this.redVsBlue =
|
|
129
|
-
kills: data['kills_red vs blue'] || 0,
|
|
130
|
-
deaths: data['deaths_red vs blue'] || 0,
|
|
131
|
-
wins: data['wins_red vs blue'] || 0,
|
|
132
|
-
headsEaten: data['heads_eaten_red vs blue'] || 0
|
|
133
|
-
};
|
|
89
|
+
this.redVsBlue = new UHCGamemode(data, 'red_vs_blue');
|
|
134
90
|
/**
|
|
135
91
|
* No Diamond
|
|
136
|
-
* @type {
|
|
92
|
+
* @type {UHCGamemode}
|
|
137
93
|
*/
|
|
138
|
-
this.noDiamond =
|
|
139
|
-
kills: data['kills_no diamonds'] || 0,
|
|
140
|
-
deaths: data['deaths_no diamonds'] || 0,
|
|
141
|
-
wins: data['wins_no diamonds'] || 0,
|
|
142
|
-
headsEaten: data['heads_eaten_no diamonds'] || 0
|
|
143
|
-
};
|
|
94
|
+
this.noDiamond = new UHCGamemode(data, 'no_diamonds');
|
|
144
95
|
/**
|
|
145
96
|
* Brawl
|
|
146
|
-
* @type {
|
|
97
|
+
* @type {UHCGamemode}
|
|
147
98
|
*/
|
|
148
|
-
this.brawl =
|
|
149
|
-
kills: data.kills_brawl || 0,
|
|
150
|
-
deaths: data.deaths_brawl || 0,
|
|
151
|
-
wins: data.wins_brawl || 0,
|
|
152
|
-
headsEaten: data.heads_eaten_brawl || 0
|
|
153
|
-
};
|
|
99
|
+
this.brawl = new UHCGamemode(data, 'brawl');
|
|
154
100
|
/**
|
|
155
101
|
* Solo brawl
|
|
156
|
-
* @type {
|
|
102
|
+
* @type {UHCGamemode}
|
|
157
103
|
*/
|
|
158
|
-
this.soloBrawl =
|
|
159
|
-
kills: data['kills_solo brawl'] || 0,
|
|
160
|
-
deaths: data['deaths_solo brawl'] || 0,
|
|
161
|
-
wins: data['wins_solo brawl'] || 0,
|
|
162
|
-
headsEaten: data['heads_eaten_solo brawl'] || 0
|
|
163
|
-
};
|
|
104
|
+
this.soloBrawl = new UHCGamemode(data, 'solo_brawl');
|
|
164
105
|
/**
|
|
165
106
|
* Duo Brawl
|
|
166
|
-
* @type {
|
|
167
|
-
*/
|
|
168
|
-
this.duoBrawl =
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
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);
|
|
174
192
|
}
|
|
175
193
|
}
|
|
176
|
-
/**
|
|
177
|
-
* @typedef {object} UHCModeStats
|
|
178
|
-
* @property {number} kills Kills
|
|
179
|
-
* @property {number} deaths Deaths
|
|
180
|
-
* @property {number} wins Wins
|
|
181
|
-
* @property {number} headsEaten Heads eaten
|
|
182
|
-
*/
|
|
183
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;
|
|
@@ -34,13 +34,62 @@ class WoolWars {
|
|
|
34
34
|
* @type {number}
|
|
35
35
|
*/
|
|
36
36
|
this.coins = data.coins || 0;
|
|
37
|
+
/**
|
|
38
|
+
* Wins
|
|
39
|
+
* @type {number}
|
|
40
|
+
*/
|
|
41
|
+
this.wins = data.wins || 0;
|
|
42
|
+
/**
|
|
43
|
+
* gamesPlayed
|
|
44
|
+
* @type {number}
|
|
45
|
+
*/
|
|
46
|
+
this.gamesPlayed = data.games_played || 0;
|
|
47
|
+
/**
|
|
48
|
+
* woolsPlaced
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
this.woolsPlaced = data.wool_placed || 0;
|
|
52
|
+
/**
|
|
53
|
+
* blocksBroken
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
this.blocksBroken = data.blocks_broken || 0;
|
|
57
|
+
/**
|
|
58
|
+
* placeBreakRatio
|
|
59
|
+
* @type {number}
|
|
60
|
+
*/
|
|
61
|
+
this.placeBreakRatio = divide(this.woolsPlaced, this.blocksBroken);
|
|
62
|
+
/**
|
|
63
|
+
* kills
|
|
64
|
+
* @type {number}
|
|
65
|
+
*/
|
|
66
|
+
this.kills = data.kills || 0;
|
|
67
|
+
/**
|
|
68
|
+
* deaths
|
|
69
|
+
* @type {number}
|
|
70
|
+
*/
|
|
71
|
+
this.deaths = data.deaths || 0;
|
|
72
|
+
/**
|
|
73
|
+
* KDRatio
|
|
74
|
+
* @type {number}
|
|
75
|
+
*/
|
|
76
|
+
this.KDRatio = divide(this.kills, this.deaths);
|
|
77
|
+
/**
|
|
78
|
+
* assists
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
this.assists = data.assists || 0;
|
|
82
|
+
/**
|
|
83
|
+
* powerups
|
|
84
|
+
* @type {number}
|
|
85
|
+
*/
|
|
86
|
+
this.powerups = data.powerups_gotten || 0;
|
|
37
87
|
/**
|
|
38
88
|
* Selected class, or NONE if field isn't present in API for some reason
|
|
39
89
|
* @type {'ASSAULT'|'TANK'|'GOLEM'|'SWORDSMAN'|'ENGINEER'|'ARCHER'|'NONE'}
|
|
40
90
|
*/
|
|
41
91
|
this.selectedClass = data.wool_wars?.selected_class || 'NONE';
|
|
42
92
|
this.stats = {
|
|
43
|
-
overall: WoolWars.generateStatsFor(data.wool_wars?.stats, ''),
|
|
44
93
|
assault: WoolWars.generateStatsFor(data.wool_wars?.stats, 'assault'),
|
|
45
94
|
tank: WoolWars.generateStatsFor(data.wool_wars?.stats, 'tank'),
|
|
46
95
|
golem: WoolWars.generateStatsFor(data.wool_wars?.stats, 'golem'),
|
|
@@ -86,11 +135,11 @@ class WoolWars {
|
|
|
86
135
|
// eslint-disable-next-line no-underscore-dangle
|
|
87
136
|
const workingData = (_class ? data?.classes?.[_class] : data) || {};
|
|
88
137
|
return {
|
|
89
|
-
|
|
138
|
+
wins: workingData.wins || 0,
|
|
90
139
|
gamesPlayed: workingData.games_played || 0,
|
|
91
140
|
woolsPlaced: workingData.wool_placed || 0,
|
|
92
141
|
blocksBroken: workingData.blocks_broken || 0,
|
|
93
|
-
placeBreakRatio: divide(workingData.wool_placed, workingData.blocks_broken),
|
|
142
|
+
placeBreakRatio: divide(workingData.wool_placed || 0, workingData.blocks_broken || 0),
|
|
94
143
|
kills: workingData.kills || 0,
|
|
95
144
|
deaths: workingData.deaths || 0,
|
|
96
145
|
KDRatio: divide(workingData.kills, workingData.deaths),
|
|
@@ -107,10 +156,11 @@ class WoolWars {
|
|
|
107
156
|
* @property {string} game_speed Game speed
|
|
108
157
|
* @property {string} speed Player speed
|
|
109
158
|
* @property {'Enabled'|'Disabled'} no_class No class
|
|
159
|
+
* @property {boolean} respawn_enable Respawning enabled
|
|
110
160
|
*/
|
|
111
161
|
/**
|
|
112
162
|
* @typedef {Object} WoolWarsStats
|
|
113
|
-
* @property {number}
|
|
163
|
+
* @property {number} wins wins
|
|
114
164
|
* @property {number} gamesPlayed games played
|
|
115
165
|
* @property {number} woolsPlaced wools placed
|
|
116
166
|
* @property {number} blocksBroken blocks broken
|