Enable new inn behavior

This commit is contained in:
Blade Barringer
2015-05-13 08:44:08 -05:00
parent 0629b6af18
commit dca45d7845
3 changed files with 66 additions and 11 deletions
+9 -5
View File
@@ -1499,13 +1499,17 @@ api.wrap = (user, main=true) ->
_.merge plan.consecutive, {count:0, offset:0, gemCapExtra:0}
user.markModified? 'purchased.plan'
# User is resting at the inn. On cron, buffs are cleared and all dailies are reset without performing damage (fixes issue #5070)
# User is resting at the inn.
# On cron, buffs are cleared and all dailies are reset without performing damage
if user.preferences.sleep is true
user.stats.buffs = clearBuffs
# @TODO: uncomment when new dailies behavior goes live, per https://github.com/HabitRPG/habitrpg/pull/5073#issuecomment-98436542
# user.dailys.forEach (daily) ->
# daily.completed = false
# _.each daily.checklist, ((i)->i.completed=false;true)
user.dailys.forEach (daily) ->
{completed, repeat} = daily
thatDay = moment(now).subtract({days: 1})
if api.shouldDo(thatDay, repeat, user.preferences) || completed
_.each daily.checklist, ((box)->box.completed=false;true)
daily.completed = false
return
# Tally each task