Created
January 18, 2014 05:08
-
-
Save lefnire/8486480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/script/index.coffee b/script/index.coffee | |
index a5d97bf..55edff6 100644 | |
--- a/script/index.coffee | |
+++ b/script/index.coffee | |
@@ -1144,14 +1144,8 @@ api.wrap = (user, main=true) -> | |
user.stats.mp = user._statsComputed.maxMP if user.stats.mp > user._statsComputed.maxMP | |
# "Perfect Day" achievement for perfect-days | |
- lvlDiv2 = Math.ceil(user.stats.lvl/2) | |
- clearBuffs = | |
- if _.find(user.dailys, (d)->!d.completed) or user.preferences.sleep is true | |
- {str:0,int:0,per:0,con:0,stealth:0,streaks:false} | |
- else | |
- user.achievements.perfect ?= 0 | |
- user.achievements.perfect++ | |
- {str:lvlDiv2,int:lvlDiv2,per:lvlDiv2,con:lvlDiv2,stealth:0,streaks:false} | |
+ perfect = true | |
+ clearBuffs = {str:0,int:0,per:0,con:0,stealth:0,streaks:false} | |
# 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 | |
@@ -1178,6 +1172,7 @@ api.wrap = (user, main=true) -> | |
thatDay = moment(now).subtract('days', n + 1) | |
scheduleMisses++ if api.shouldDo(thatDay, repeat, user.preferences) | |
if scheduleMisses > 0 | |
+ perfect = false if type is 'daily' | |
delta = user.ops.score({params:{id:task.id, direction:'down'}, query:{times:scheduleMisses, cron:true}}); | |
user.party.quest.progress.down += delta if type is 'daily' | |
@@ -1211,7 +1206,13 @@ api.wrap = (user, main=true) -> | |
user.fns.preenUserHistory() | |
user.markModified? 'history' | |
user.markModified? 'dailys' # covers dailys.*.history | |
- user.stats.buffs = clearBuffs | |
+ user.stats.buffs = | |
+ if perfect | |
+ user.achievements.perfect ?= 0 | |
+ user.achievements.perfect++ | |
+ lvlDiv2 = user.stats.lvl/2 | |
+ {str:lvlDiv2,int:lvlDiv2,per:lvlDiv2,con:lvlDiv2,stealth:0,streaks:false} | |
+ else clearBuffs | |
# After all is said and done, progress up user's effect on quest, return those values & reset the user's | |
progress = user.party.quest.progress; _progress = _.cloneDeep progress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment