From 5fd7ff9bbf55cb75a0bbe89f832da5db56caf2a0 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 12 Dec 2013 20:23:32 -0700 Subject: [PATCH] migrate flags.rest => preferences.sleep --- dist/habitrpg-shared.js | 5 +++-- script/index.coffee | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dist/habitrpg-shared.js b/dist/habitrpg-shared.js index eece98fed6..2cf00e0413 100644 --- a/dist/habitrpg-shared.js +++ b/dist/habitrpg-shared.js @@ -10448,11 +10448,12 @@ var process=require("__browserify_process");(function() { if (!(daysMissed > 0)) { return; } + user.auth.timestamps.loggedin = new Date(); user.lastCron = now; if (user.items.lastDrop.count > 0) { user.items.lastDrop.count = 0; } - if (user.flags.rest === true) { + if (user.preferences.sleep === true) { return; } todoTally = 0; @@ -10912,7 +10913,7 @@ var process=require("__browserify_process");(function() { user._wrapped = true; user.ops = { sleep: function(req, cb) { - user.flags.rest = !user.flags.rest; + user.preferences.sleep = !user.preferences.sleep; return cb(null, req); }, clearCompleted: function(req, cb) { diff --git a/script/index.coffee b/script/index.coffee index 0014993d23..0bde28c1ab 100644 --- a/script/index.coffee +++ b/script/index.coffee @@ -317,6 +317,8 @@ api.cron = (user, options={}) -> daysMissed = api.daysSince user.lastCron, _.defaults({now}, user.preferences) return unless daysMissed > 0 + user.auth.timestamps.loggedin = new Date() + user.lastCron = now # Reset the lastDrop count to zero @@ -325,7 +327,7 @@ api.cron = (user, options={}) -> # User is resting at the inn. Used to be we un-checked each daily without performing calculation (see commits before fb29e35) # but to prevent abusing the inn (http://goo.gl/GDb9x) we now do *not* calculate dailies, and simply set lastCron to today - return if user.flags.rest is true + return if user.preferences.sleep is true # Tally each task todoTally = 0 @@ -630,7 +632,7 @@ api.wrap = (user) -> user.ops = sleep: (req, cb) -> - user.flags.rest = !user.flags.rest + user.preferences.sleep = !user.preferences.sleep cb null, req clearCompleted: (req, cb) ->