From a33e91df4c9fad5a894f173efad76553eee39f44 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Tue, 25 Sep 2018 15:49:27 +0200 Subject: [PATCH] add punch count and inflicted damage --- public/js/main.js | 4 ++++ src/api/highscore.js | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/public/js/main.js b/public/js/main.js index 7369fea..ea5a16c 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -167,6 +167,8 @@ m("td", numberWithCommas(player.attributes.crafted)), m("td", numberWithCommas(player.attributes.placed_nodes)), m("td", player.attributes.died), + m("td", numberWithCommas(player.attributes.punch_count)), + m("td", numberWithCommas(player.attributes.inflicted_damage)), m("td", player.attributes.played_time ? moment.duration(+player.attributes.played_time, "seconds").humanize() : ""), m("td", joined), m("td", [last_login, " ", (is_inactive?inactive:null)]), @@ -192,6 +194,8 @@ m("th", ["Craft-count", makeSortButton("crafted")]), m("th", ["Build-count", makeSortButton("placed_nodes")]), m("th", ["Death-count", makeSortButton("died")]), + m("th", ["Punch-count", makeSortButton("punch_count")]), + m("th", ["Inflicted damage", makeSortButton("inflicted_damage")]), m("th", ["Play-time", makeSortButton("played_time")]), m("th", ["Joined", makeSortButton("joined")]), m("th", ["Last login", makeSortButton("online")]), diff --git a/src/api/highscore.js b/src/api/highscore.js index c5a6a57..61d5d3f 100644 --- a/src/api/highscore.js +++ b/src/api/highscore.js @@ -27,6 +27,10 @@ app.get('/api/highscore', function (req, res) { attrJoinColumn = req.query.sort; } else if (req.query.sort == "died"){ attrJoinColumn = req.query.sort; + } else if (req.query.sort == "punch_count"){ + attrJoinColumn = req.query.sort; + } else if (req.query.sort == "inflicted_damage"){ + attrJoinColumn = req.query.sort; } else if (req.query.sort == "played_time"){ attrJoinColumn = req.query.sort; } else if (req.query.sort == "online"){ @@ -57,7 +61,7 @@ app.get('/api/highscore', function (req, res) { var promises = result.rows.map(row => { var subquery = "select attr, value from player_metadata where player = $1"; - subquery += " and attr in('crafted', 'placed_nodes', 'died', 'digged_nodes', 'xp', 'played_time', 'homedecor:player_skin')"; + subquery += " and attr in('crafted', 'placed_nodes', 'died', 'digged_nodes', 'xp', 'played_time', 'punch_count', 'inflicted_damage', 'homedecor:player_skin')"; return pool.query(subquery, [row.name])