From f5e9568cef15eefe2c3683a5456b59cd8df19435 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Fri, 16 Jan 2015 21:33:58 -0600 Subject: [PATCH] Consolidated calcTriadBingo function --- public/js/controllers/inventoryCtrl.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index de5a82333e..02572e7f7f 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -78,11 +78,16 @@ habitrpg.controller("InventoryCtrl", } $scope.calcTriadBingo = function() { + var hasPets = Shared.countPets(null, User.user.items.pets) >= 90 ; + var hasMounts = Shared.countMounts(null, User.user.items.mounts) >= 90; + + if(!(hasPets && hasMounts)) return false; + for (var p in User.user.items.pets) { if(User.user.items.pets[p] < 0) return false; } return true; - }; + } $scope.hatch = function(egg, potion){ var eggName = Content.eggs[egg.key].text(); @@ -101,10 +106,7 @@ habitrpg.controller("InventoryCtrl", // Checks if Triad Bingo has been reached for the first time if(!User.user.achievements.triadBingo - && Shared.countPets(null, User.user.items.pets) >= 90 - && Shared.countMounts(null, User.user.items.mounts) >= 90 && $scope.calcTriadBingo()) { - User.user.achievements.triadBingo = true; $rootScope.openModal('achievements/triadBingo'); }