From: Luigi Pinca Date: Sat, 4 Jan 2014 11:24:18 +0000 (+0100) Subject: added a score threshold to prevent users from cheating their highscores X-Git-Url: https://git.saalbach.dev/?a=commitdiff_plain;h=fe0ad4d276fd1f2dd6ba6e8d98081611b52372aa;p=binbsis50.git added a score threshold to prevent users from cheating their highscores --- diff --git a/lib/stats.js b/lib/stats.js index e279549..d4fa7e3 100644 --- a/lib/stats.js +++ b/lib/stats.js @@ -57,11 +57,18 @@ module.exports = function(username, stats) { , 'bestscore' , 'bestguesstime' , 'worstguesstime' + , 'totguesstime' + , 'guessed' ]; db.hmget(args, function(err, replies) { if (err) { return console.error(err.message); } + if (stats.guesstime < 1000) { + stats.guesstime = replies[4] !== '0' + ? Math.round(replies[3] / replies[4]) + : 15000; + } if (stats.userscore > replies[0]) { // Set personal best multi.hset(key, 'bestscore', stats.userscore); diff --git a/package.json b/package.json index 3489123..1ec3689 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,5 @@ "start": "node app.js" }, "subdomain": "binb", - "version": "0.4.0" + "version": "0.4.1" }