Merge pull request #7911 from crookedneighbor/fix_magic_pets_spacing

fix(client): Correct logic to show premium pets
This commit is contained in:
Blade Barringer
2016-08-23 17:20:17 -05:00
committed by GitHub
2 changed files with 30 additions and 2 deletions

View File

@@ -357,6 +357,34 @@ habitrpg.controller("InventoryCtrl",
$scope.timeTravelersCategories = Shared.shops.getTimeTravelersCategories(user);
$scope.seasonalShopCategories = Shared.shops.getSeasonalShopCategories(user);
$scope.shouldShowPremiumPetRow = function (potion) {
potion = Content.premiumHatchingPotions[potion];
if (!potion) {
return false;
}
if (user.items.hatchingPotions[potion.key] > 0) {
return true;
}
if (potion.canBuy()) {
return true;
}
var pets = Object.keys(user.items.pets);
var hasAPetOfPotion = pets.find(function (pet) {
return pet.indexOf(potion.key) !== -1;
});
return hasAPetOfPotion;
};
$scope.shouldShowPremiumPetSection = function () {
var potions = Content.premiumHatchingPotions;
return Object.keys(potions).find(function (potion) {
return $scope.shouldShowPremiumPetRow(potions[potion].key);
});
};
function _updateDropAnimalCount(items) {
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
$scope.mountCount = Shared.count.mountMasterProgress(items.mounts);