Skip to content

Commit 25c1150

Browse files
committed
Update <Player>.stats.Warlords
1 parent 2633043 commit 25c1150

File tree

2 files changed

+153
-1
lines changed

2 files changed

+153
-1
lines changed

src/structures/MiniGames/Warlords.js

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,49 @@
11
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+
247
/**
348
* Warlords class
449
*/
@@ -56,7 +101,87 @@ class Warlords {
56101
* Chosen class
57102
* @type {string}
58103
*/
59-
this.class = data.chosen_class || 0;
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');
60185
}
61186
}
62187
module.exports = Warlords;

typings/index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2095,6 +2095,16 @@ declare module 'hypixel-api-reborn' {
20952095
WLRatio: number;
20962096
assists: number;
20972097
}
2098+
class WarlordsClass {
2099+
constructor(data: Record<string, unknown>);
2100+
wins: number;
2101+
losses: number;
2102+
WLRatio: number;
2103+
gamesPlayed: number;
2104+
damage: number;
2105+
heal: number;
2106+
damagePrevented: number;
2107+
}
20982108
class Warlords {
20992109
constructor(data: Record<string, unknown>);
21002110
coins: number;
@@ -2104,8 +2114,25 @@ declare module 'hypixel-api-reborn' {
21042114
wins: number;
21052115
losses: number;
21062116
WLRatio: number;
2117+
winstreak: number;
21072118
assists: number;
21082119
class: string;
2120+
pyromancer: WarlordsClass;
2121+
mage: WarlordsClass;
2122+
thunderlord: WarlordsClass;
2123+
shaman: WarlordsClass;
2124+
earthwarden: WarlordsClass;
2125+
aquamancer: WarlordsClass;
2126+
paladin: WarlordsClass;
2127+
avenger: WarlordsClass;
2128+
warrior: WarlordsClass;
2129+
defender: WarlordsClass;
2130+
cryomancer: WarlordsClass;
2131+
crusader: WarlordsClass;
2132+
berserker: WarlordsClass;
2133+
protector: WarlordsClass;
2134+
revenant: WarlordsClass;
2135+
spiritguard: WarlordsClass;
21092136
}
21102137
class BlitzSGKit {
21112138
constructor(data: Record<string, unknown>, kitName: string);

0 commit comments

Comments
 (0)