]> git.example.dev Git - binbsis50.git/commitdiff
added a score threshold to prevent users from cheating their highscores
authorLuigi Pinca <luigipinca@gmail.com>
Sat, 4 Jan 2014 11:24:18 +0000 (12:24 +0100)
committerLuigi Pinca <luigipinca@gmail.com>
Sat, 4 Jan 2014 11:24:18 +0000 (12:24 +0100)
lib/stats.js
package.json

index e279549ab693f00bdb454d220dadb54739945150..d4fa7e3ebdfb1336293543d1d10918b3be0578b1 100644 (file)
@@ -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);
index 34891233dffe8669e55a518105bf26b807040258..1ec368965e943fc54b1764a0e949be26d3ffde93 100644 (file)
@@ -30,5 +30,5 @@
     "start": "node app.js"
   },
   "subdomain": "binb",
-  "version": "0.4.0"
+  "version": "0.4.1"
 }