[#1394] add drop notifications back in

This commit is contained in:
Tyler Renelle
2013-09-17 12:16:16 -04:00
parent 9d633eceaf
commit f26b0a2cf5
5 changed files with 15 additions and 7 deletions

View File

@@ -33,6 +33,11 @@ habitrpg.controller('NotificationCtrl',
}
});
$rootScope.$watch('user._tmp.drop', function(after, before){
if (after == before || !after) return;
$rootScope.modals.drop = true;
});
// FIXME: this isn't working for some reason
/*_.each(['weapon', 'head', 'chest', 'shield'], function(watched){
$rootScope.$watch('user.items.' + watched, function(before, after){

View File

@@ -712,6 +712,7 @@ api.batchUpdate = function(req, res, next) {
}
response = user.toJSON();
response.wasModified = res.locals.wasModified;
if (response._tmp && response._tmp.drop) response.wasModified = true;
res.json(200, response);
return console.log("Reply sent");
});

View File

@@ -240,6 +240,7 @@ UserSchema.methods.toJSON = function() {
//});
//delete doc.tasks
doc.filters = {};
doc._tmp = this._tmp; // be sure to send down drop notifs
return doc;
};

View File

@@ -7,3 +7,4 @@ include ./why-ads
include ./more-gems
include ./members
include ./settings
include ./pets

View File

@@ -1,21 +1,21 @@
div(modal='modals.pets.dropsEnabled')
div(modal='modals.dropsEnabled')
.modal-header
h3 Drops Enabled!
.modal-body
p
span.item-drop-icon(ng-class='Pet_Egg_{{user.items.eggs.0.name}}')
span.item-drop-icon(class='Pet_Egg_{{user.items.eggs.0.name}}')
| You've unlocked the Drop System! Now when you complete tasks, you have a small chance of finding an item. And guess what, you just found a
strong {{user.items.eggs.0.text}} egg
| ! {{user.items.eggs.0.notes}}
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.pets.dropsEnabled=false') Close
div(modal='modals.pets.itemDropped')
div(modal='modals.drop')
.modal-header
h3 An item has dropped!
.modal-body
p
span.item-drop-icon(ng-class='Pet_{{_drop.type}}_{{_drop.name}}')
| {{_drop.dialog}}
span.item-drop-icon(class='Pet_{{user._tmp.drop.type}}_{{user._tmp.drop.name}}')
| {{user._tmp.drop.dialog}}
.modal-footer
button.btn.btn-default.cancel(ng-click='modals.pets.itemDropped=false') Close
button.btn.btn-default.cancel(ng-click='modals.drop = false') Close