Merge pull request #2123 from HabitRPG/sabe/tweak3

Fix #2072 (add Mana delta alerts)
This commit is contained in:
Tyler Renelle 2013-12-27 07:53:12 -08:00
commit 13e1792685
3 changed files with 17 additions and 0 deletions

View file

@ -28,6 +28,8 @@ xpColor = #DCC0FB
xpText = #635673
deathColor = #4E4E4E
deathText = #ABABAB
mpColor = #c7d3e9
mpText = #003aa1
borderDarken = 20%
// alert styles
@ -57,6 +59,11 @@ borderDarken = 20%
border-color: deathColor
color: deathText
.alert-mp
background-color: mpColor
border-color: darken(mpColor,borderDarken)
color: mpText
// alert icons
.icon-gold

View file

@ -31,6 +31,13 @@ habitrpg.controller('NotificationCtrl',
}
});
$rootScope.$watch('user.stats.mp', function(after,before) {
if (after == before) return;
if (User.user.stats.lvl == 0) return;
var mana = after - before;
Notification.mp(mana);
});
$rootScope.$watch('user._tmp.drop', function(after, before){
// won't work when getting the same item twice?
if (after == before || !after) return;

View file

@ -65,6 +65,9 @@ angular.module("notificationServices", [])
},
error: function(error){
growl("<i class='icon-exclamation-sign'></i> " + error, "error");
},
mp: function(val) {
growl("<i class='icon-fire'></i> " + sign(val) + " " + round(val) + " MP", 'mp');
}
};
}