diff --git a/website/client-old/js/controllers/inventoryCtrl.js b/website/client-old/js/controllers/inventoryCtrl.js index 9bfe5ddfa7..20a5c0837d 100644 --- a/website/client-old/js/controllers/inventoryCtrl.js +++ b/website/client-old/js/controllers/inventoryCtrl.js @@ -378,18 +378,22 @@ habitrpg.controller("InventoryCtrl", }; $scope.shouldShowPremiumMountSection = function () { - var pets = Object.keys(user.items.pets); - return pets.find(function (petKey) { - var pet = Content.petInfo[petKey]; + return findPet(function (pet) { return pet.type === 'premium'; }); }; $scope.hasAPetOfPotion = function (potion) { + return findPet(function (pet) { + return pet.potion === potion; + }); + }; + + function findPet (fn) { var pets = Object.keys(user.items.pets); return pets.find(function (petKey) { var pet = Content.petInfo[petKey]; - return pet.potion === potion; + return fn(pet); }); }