From 9b82da064f00b55bc06b7167657be30c016d9db6 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Fri, 2 Jan 2015 18:52:25 -0600 Subject: [PATCH] Moved the beastMaster modal alert from notifications to inside the hatching function --- public/js/controllers/inventoryCtrl.js | 7 +++++++ public/js/controllers/notificationCtrl.js | 11 ----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index 0a71510508..557f4a24d5 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -85,6 +85,13 @@ habitrpg.controller("InventoryCtrl", user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}}); $scope.selectedEgg = null; $scope.selectedPotion = null; + + // Checks if beastmaster has been reached for the first time + if(!User.user.achievements.beastMaster + && Shared.countPets(null, User.user.items.pets) >= 90) { + User.user.achievements.beastMaster = true; + $rootScope.openModal('achievements/beastMaster'); + } } $scope.purchase = function(type, item){ diff --git a/public/js/controllers/notificationCtrl.js b/public/js/controllers/notificationCtrl.js index 5e6fc38087..9d21ffbed5 100644 --- a/public/js/controllers/notificationCtrl.js +++ b/public/js/controllers/notificationCtrl.js @@ -104,17 +104,6 @@ habitrpg.controller('NotificationCtrl', $rootScope.openModal('achievements/ultimateGear'); }); - // Watches number of pets and displays beastMaster modal when 90 are found - $rootScope.$watch('user.items.pets', function(after, before){ - if(_.size(after) === _.size(before) || - Shared.countPets(null, after) < 90) return; - if (User.user.achievements.beastMaster == undefined) { - User.user.achievements.beastMaster = true; - $rootScope.openModal('achievements/beastMaster'); - } - }, true); - - // Watches number of mounts and displays mountMaster modal when 90 are raised $rootScope.$watch('user.items.mounts', function(after, before){ if(_.size(after) === _.size(before) ||