Merge pull request #2237 from colegleason/crit-notif

Add Critical Hit notification by watching user._tmp.crit
This commit is contained in:
Tyler Renelle 2014-01-02 12:00:48 -08:00
commit 4c6ebb6f14

View file

@ -38,6 +38,14 @@ habitrpg.controller('NotificationCtrl',
Notification.mp(mana);
});
$rootScope.$watch('user._tmp.crit', function(after, before){
if (after == before || !after) return;
var amount = User.user._tmp.crit * 100 - 100;
// reset the crit counter
User.user._tmp.crit = undefined;
Notification.text("Critical Hit! Bonus: " + amount + "%");
});
$rootScope.$watch('user._tmp.drop', function(after, before){
// won't work when getting the same item twice?
if (after == before || !after) return;