Skip to content

Commit

Permalink
Update BuildBattle
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Jul 12, 2024
1 parent b7eb0a6 commit 78f64d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
25 changes: 18 additions & 7 deletions src/structures/MiniGames/BuildBattle.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const divide = require('../../utils/divide');
/**
* BuildBattle class
*/
Expand All @@ -11,11 +12,26 @@ class BuildBattle {
* @type {number}
*/
this.score = data.score || 0;
/**
* Total wins
* @type {number}
*/
this.totalWins = data.wins || 0;
/**
* Played games
* @type {number}
*/
this.playedGames = data.games_played || 0;
this.games = data.games_played || 0;
/**
* Win Loss ratio
* @type {number}
*/
this.WLRatio = divide(this.totalWins, this.games);
/**
* Amount of super votes the player has
* @type {number}
*/
this.superVotes = data.super_votes || 0;
/**
* Coins
* @type {number}
Expand All @@ -26,18 +42,13 @@ class BuildBattle {
* @type {number}
*/
this.totalVotes = data.total_votes || 0;
/**
* Total wins
* @type {number}
*/
this.totalWins = data.wins || 0;
/**
* Wins for each mode
* @type {BuildBattleWins}
*/
this.wins = {
solo: data.wins_solo_normal || 0,
team: data.wins_teams_normal || 0,
teams: data.wins_teams_normal || 0,
pro: data.wins_solo_pro || 0,
gtb: data.wins_guess_the_build || 0
};
Expand Down
8 changes: 5 additions & 3 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4060,13 +4060,15 @@ declare module 'hypixel-api-reborn' {
class BuildBattle {
constructor(data: Record<string, unknown>);
score: number;
playedGames: number;
totalWins: number;
games: number;
WLRatio: number;
superVotes: number;
coins: number;
totalVotes: number;
totalWins: number;
wins: {
solo: number;
team: number;
teams: number;
pro: number;
gtb: number;
};
Expand Down

0 comments on commit 78f64d0

Please sign in to comment.