Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Smash Heroes stats #505

Merged
merged 1 commit into from
Oct 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions processors/games/SuperSmash.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,79 @@
/* eslint-disable camelcase */
/*
* SuperSmash
*/

const {
getWeeklyStat,
getMonthlyStat,
getRatio,
} = require('../../util/utility');

module.exports = ({
coins = 0,
kills = 0,
deaths = 0,
smashLevel = 0,
wins = 0,
losses = 0,
quits = 0,
games = 0,
win_streak = 0,
kills_weekly_a = 0,
kills_weekly_b = 0,
kills_monthly_a = 0,
kills_monthly_b = 0,
losses_weekly_a = 0,
losses_weekly_b = 0,
losses_monthly_a = 0,
losses_monthly_b = 0,
games_weekly_a = 0,
games_weekly_b = 0,
games_monthly_a = 0,
games_monthly_b = 0,
wins_weekly_a = 0,
wins_weekly_b = 0,
wins_monthly_a = 0,
wins_monthly_b = 0,
active_class = null,
class_stats = {},
'votes_Strawberry Towers': votes_StrawberryTowers = 0,
votes_Toybox = 0,
votes_Gunmetal = 0,
'votes_Color Clash': votes_ColorClash = 0,
votes_Triplets = 0,
votes_Luxor = 0,
votes_Cubed = 0,
}) => ({
coins,
kills,
deaths,
smash_level: smashLevel,
kd: getRatio(kills, deaths),
wins,
losses,
quits,
win_streak,
wl: getRatio(wins, losses),
games_played: games,
weekly_kills: getWeeklyStat(kills_weekly_a, kills_weekly_b),
weekly_wins: getWeeklyStat(wins_weekly_a, wins_weekly_b),
weekly_losses: getWeeklyStat(losses_weekly_a, losses_weekly_b),
weekly_games_played: getWeeklyStat(games_weekly_a, games_weekly_b),
monthly_kills: getMonthlyStat(kills_monthly_a, kills_monthly_b),
monthly_wins: getMonthlyStat(wins_monthly_a, wins_monthly_b),
monthly_losses: getMonthlyStat(losses_monthly_a, losses_monthly_b),
monthly_games_played: getMonthlyStat(games_monthly_a, games_monthly_b),
active_class,
class_stats,

votes: {
strawberry_towers: votes_StrawberryTowers,
toybox: votes_Toybox,
gunmetal: votes_Gunmetal,
color_clash: votes_ColorClash,
triplets: votes_Triplets,
luxor: votes_Luxor,
cubed: votes_Cubed,
},
});
82 changes: 82 additions & 0 deletions routes/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,88 @@ const playerObject = {
},
},
},
Smash: {
description: 'Player stats in Smash Heroes',
type: 'object',
properties: {
coins: {
description: 'Current coins in Smash Heroes',
type: 'integer',
},
kills: {
description: 'Amount of kills in Smash Heroes',
type: 'integer',
},
deaths: {
description: 'Amount of deaths in Smash Heroes',
type: 'integer',
},
smash_level: {
description: 'Player\'s Smash Level',
type: 'integer',
},
kd: {
description: 'Current kill/death ratio in Smash Heroes',
type: 'number',
},
wins: {
description: 'Amount of wins in Smash Heroes',
type: 'integer',
},
losses: {
description: 'Amount of losses in Smash Heroes',
type: 'integer',
},
quits: {
description: 'Number of times the player has left mid-game in Smash Heroes',
type: 'integer',
},
win_streak: {
description: 'Current consecutive wins in Smash Heroes',
type: 'integer',
},
wl: {
description: 'Current win/loss ratio in Smash Heroes',
type: 'number',
},
games_played: {
description: 'Total number of Smash Heroes games played',
type: 'integer',
},
weekly_kills: {
description: 'Current weekly kills in Smash Heroes',
type: 'integer',
},
weekly_wins: {
description: 'Current weekly wins in Smash Heroes',
type: 'integer',
},
weekly_losses: {
description: 'Current weekly losses in Smash Heroes',
type: 'integer',
},
weekly_games_played: {
description: 'Smash Heroes games played this week',
type: 'integer',
},
monthly_kills: {
description: 'Current monthly kills in Smash Heroes',
type: 'integer',
},
monthly_wins: {
description: 'Current monthly wins in Smash Heroes',
type: 'integer',
},
monthly_losses: {
description: 'Current monthly losses in Smash Heroes',
type: 'integer',
},
monthly_games_played: {
description: 'Smash Heroes games played this month',
type: 'integer',
},
},
},
},
},
},
Expand Down