fix(notifications): Don't double-modal

Corrects behavior of the Notifications controller so that it skips showing the generic levelup modal if it's going to display the quest scroll version.
This commit is contained in:
Sabe Jones
2015-10-13 17:01:07 -04:00
parent 6505824cb6
commit 5bfea172ee

View File

@@ -53,6 +53,15 @@ habitrpg.controller('NotificationCtrl',
Notification.mp(mana);
});
$rootScope.$watch('user.stats.lvl', function(after, before) {
if ((after === before) || (User.user._tmp && User.user._tmp.drop && (User.user._tmp.drop.type === 'Quest'))) return;
if (after > before) {
Notification.lvl();
$rootScope.playSound('Level_Up');
$rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'});
}
});
$rootScope.$watch('user._tmp.crit', function(after, before){
if (after == before || !after) return;
var amount = User.user._tmp.crit * 100 - 100;
@@ -148,15 +157,6 @@ habitrpg.controller('NotificationCtrl',
}
});
$rootScope.$watch('user.stats.lvl', function(after, before) {
if (after == before) return;
if (after > before) {
Notification.lvl();
$rootScope.playSound('Level_Up');
$rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'});
}
});
// Completed quest modal
$scope.$watch('user.party.quest.completed', function(after, before){
if (!after) return;