From f218a52bf278034ce9a015f940dd61ff28537529 Mon Sep 17 00:00:00 2001 From: Cole Gleason Date: Thu, 2 Jan 2014 13:41:50 -0600 Subject: [PATCH] Add Critical Hit notification by watching user._tmp.crit --- public/js/controllers/notificationCtrl.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/js/controllers/notificationCtrl.js b/public/js/controllers/notificationCtrl.js index 795cf91538..c980ac13f8 100644 --- a/public/js/controllers/notificationCtrl.js +++ b/public/js/controllers/notificationCtrl.js @@ -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;