Skip to content

Commit

Permalink
Update <Player>.stats.Warlords
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Jul 25, 2024
1 parent 2633043 commit 25c1150
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 1 deletion.
127 changes: 126 additions & 1 deletion src/structures/MiniGames/Warlords.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
const divide = require('../../utils/divide');

class WarlordsClass {
/**
* @param {object} data Warlords data
* @param {string} className
*/
constructor(data, className) {
/**
* Wins
* @type {number}
*/
this.wins = data[`wins_${className}`] || 0;
/**
* Losses
* @type {number}
*/
this.losses = data[`losses_${className}`] || 0;
/**
* WLRatio
* @type {number}
*/
this.WLRatio = divide(this.wins, this.losses);
/**
* Games Played
* @type {number}
*/
this.gamesPlayed = data[`${className}_plays`];
/**
* Damage
* @type {number}
*/
this.damage = data[`damage_${className}`] || 0;
/**
* Heal
* @type {number}
*/
this.heal = data[`heal_${className}`] || 0;
/**
* Damage Prevented
* @type {number}
*/
this.damagePrevented = data[`damage_prevented_${className}`] || 0;
}
}

/**
* Warlords class
*/
Expand Down Expand Up @@ -56,7 +101,87 @@ class Warlords {
* Chosen class
* @type {string}
*/
this.class = data.chosen_class || 0;
this.class = data.chosen_class || '';
/**
* pyromancer
* @type {WarlordsClass}
*/
this.pyromancer = new WarlordsClass(data, 'pyromancer');
/**
* mage
* @type {WarlordsClass}
*/
this.mage = new WarlordsClass(data, 'mage');
/**
* thunderlord
* @type {WarlordsClass}
*/
this.thunderlord = new WarlordsClass(data, 'thunderlord');
/**
* shaman
* @type {WarlordsClass}
*/
this.shaman = new WarlordsClass(data, 'shaman');
/**
* earthwarden
* @type {WarlordsClass}
*/
this.earthwarden = new WarlordsClass(data, 'earthwarden');
/**
* aquamancer
* @type {WarlordsClass}
*/
this.aquamancer = new WarlordsClass(data, 'aquamancer');
/**
* paladin
* @type {WarlordsClass}
*/
this.paladin = new WarlordsClass(data, 'paladin');
/**
* avenger
* @type {WarlordsClass}
*/
this.avenger = new WarlordsClass(data, 'avenger');
/**
* warrior
* @type {WarlordsClass}
*/
this.warrior = new WarlordsClass(data, 'warrior');
/**
* defender
* @type {WarlordsClass}
*/
this.defender = new WarlordsClass(data, 'defender');
/**
* cryomancer
* @type {WarlordsClass}
*/
this.cryomancer = new WarlordsClass(data, 'cryomancer');
/**
* crusader
* @type {WarlordsClass}
*/
this.crusader = new WarlordsClass(data, 'crusader');
/**
* berserker
* @type {WarlordsClass}
*/
this.berserker = new WarlordsClass(data, 'berserker');
/**
* protector
* @type {WarlordsClass}
*/
this.protector = new WarlordsClass(data, 'protector');
/**
* revenant
* @type {WarlordsClass}
*/
this.revenant = new WarlordsClass(data, 'revenant');
/**
* spiritguard
* @type {WarlordsClass}
*/
this.spiritguard = new WarlordsClass(data, 'spiritguard');
}
}
module.exports = Warlords;
27 changes: 27 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,16 @@ declare module 'hypixel-api-reborn' {
WLRatio: number;
assists: number;
}
class WarlordsClass {
constructor(data: Record<string, unknown>);
wins: number;
losses: number;
WLRatio: number;
gamesPlayed: number;
damage: number;
heal: number;
damagePrevented: number;
}
class Warlords {
constructor(data: Record<string, unknown>);
coins: number;
Expand All @@ -2104,8 +2114,25 @@ declare module 'hypixel-api-reborn' {
wins: number;
losses: number;
WLRatio: number;
winstreak: number;
assists: number;
class: string;
pyromancer: WarlordsClass;
mage: WarlordsClass;
thunderlord: WarlordsClass;
shaman: WarlordsClass;
earthwarden: WarlordsClass;
aquamancer: WarlordsClass;
paladin: WarlordsClass;
avenger: WarlordsClass;
warrior: WarlordsClass;
defender: WarlordsClass;
cryomancer: WarlordsClass;
crusader: WarlordsClass;
berserker: WarlordsClass;
protector: WarlordsClass;
revenant: WarlordsClass;
spiritguard: WarlordsClass;
}
class BlitzSGKit {
constructor(data: Record<string, unknown>, kitName: string);
Expand Down

0 comments on commit 25c1150

Please sign in to comment.