Merge branch 'develop' of https://github.com/HabitRPG/habitrpg into develop

This commit is contained in:
Matteo Pagliazzi
2015-03-26 19:37:22 +01:00
5 changed files with 18 additions and 4 deletions
+8 -1
View File
@@ -7049,7 +7049,7 @@ api.wrap = function(user, main) {
{user}
*/
cron: function(options) {
var clearBuffs, daysMissed, expTally, lvl, lvlDiv2, now, perfect, plan, progress, todoTally, _base, _base1, _base2, _base3, _progress, _ref, _ref1, _ref2;
var clearBuffs, daysMissed, expTally, lvl, lvlDiv2, now, perfect, plan, progress, todoTally, _base, _base1, _base2, _base3, _base4, _progress, _ref, _ref1, _ref2, _ref3;
if (options == null) {
options = {};
}
@@ -7222,6 +7222,13 @@ api.wrap = function(user, main) {
if (user.stats.mp > user._statsComputed.maxMP) {
user.stats.mp = user._statsComputed.maxMP;
}
if ((_base4 = user.flags).cronCount == null) {
_base4.cronCount = 0;
}
user.flags.cronCount++;
if ((_ref3 = options.ga) != null) {
_ref3.event('cron', user.flags.cronCount).send();
}
progress = user.party.quest.progress;
_progress = _.cloneDeep(progress);
_.merge(progress, {
+5
View File
@@ -1559,6 +1559,11 @@ api.wrap = (user, main=true) ->
user.stats.mp += _.max([10,.1 * user._statsComputed.maxMP])
user.stats.mp = user._statsComputed.maxMP if user.stats.mp > user._statsComputed.maxMP
# Analytics
user.flags.cronCount?=0
user.flags.cronCount++
options.ga?.event('cron', user.flags.cronCount).send(); #TODO userId for cohort
# 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
_.merge progress, {down:0,up:0}
+2 -1
View File
@@ -155,7 +155,7 @@ function($rootScope, User, $timeout, $state) {
}
_.each(chapters, function(chapter, k){
_(chapter).flatten().each(function(step) {
_(chapter).flatten().each(function(step, i) {
step.content = "<div><div class='" + (env.worldDmg.guide ? "npc_justin_broken" : "npc_justin") + " float-left'></div>" + step.content + "</div>";
$(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
step.onShow = function(){
@@ -165,6 +165,7 @@ function($rootScope, User, $timeout, $state) {
$state.go(step.state);
return $timeout(function(){});
}
window.ga && ga('send', 'event', 'tour', k, i+1);
}
step.onHide = function(){
if (step.final) { // -2 indicates complete
+1 -1
View File
@@ -262,7 +262,7 @@ api.update = function(req, res, next) {
api.cron = function(req, res, next) {
var user = res.locals.user,
progress = user.fns.cron(),
progress = user.fns.cron({ga:ga}),
ranCron = user.isModified(),
quest = shared.content.quests[user.party.quest.key];
+2 -1
View File
@@ -145,7 +145,8 @@ var UserSchema = new Schema({
// Used to track the status of recapture emails sent to each user,
// can be 0 - no email sent - 1, 2, 3 or 4 - 4 means no more email will be sent to the user
recaptureEmailsPhase: {type: Number, 'default': 0},
communityGuidelinesAccepted: {type: Boolean, 'default': false}
communityGuidelinesAccepted: {type: Boolean, 'default': false},
cronCount: {type:Number, 'default':0}
},
history: {
exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined