mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 14:17:22 +01:00
Fix Magic Mount Spacing (#8015)
* fix magic mount spacing * simplify functions * function hasAPetOfPotion * var premiumPotion
This commit is contained in:
committed by
Blade Barringer
parent
998037e0a1
commit
4ad50b9d30
@@ -355,24 +355,19 @@ habitrpg.controller("InventoryCtrl",
|
||||
$scope.seasonalShopCategories = Shared.shops.getSeasonalShopCategories(user);
|
||||
|
||||
$scope.shouldShowPremiumPetRow = function (potion) {
|
||||
potion = Content.premiumHatchingPotions[potion];
|
||||
var premiumPotion = Content.premiumHatchingPotions[potion];
|
||||
|
||||
if (!potion) {
|
||||
if (!premiumPotion) {
|
||||
return false;
|
||||
}
|
||||
if (user.items.hatchingPotions[potion.key] > 0) {
|
||||
if (user.items.hatchingPotions[premiumPotion.key] > 0) {
|
||||
return true;
|
||||
}
|
||||
if (potion.canBuy()) {
|
||||
if (premiumPotion.canBuy()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var pets = Object.keys(user.items.pets);
|
||||
var hasAPetOfPotion = pets.find(function (pet) {
|
||||
return pet.indexOf(potion.key) !== -1;
|
||||
});
|
||||
|
||||
return hasAPetOfPotion;
|
||||
return $scope.hasAPetOfPotion(potion);
|
||||
};
|
||||
|
||||
$scope.shouldShowPremiumPetSection = function () {
|
||||
@@ -382,6 +377,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 pet.type === 'premium';
|
||||
});
|
||||
};
|
||||
|
||||
$scope.hasAPetOfPotion = function (potion) {
|
||||
var pets = Object.keys(user.items.pets);
|
||||
return pets.find(function (petKey) {
|
||||
var pet = Content.petInfo[petKey];
|
||||
return pet.potion === potion;
|
||||
});
|
||||
}
|
||||
|
||||
function _updateDropAnimalCount(items) {
|
||||
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
|
||||
$scope.mountCount = Shared.count.mountMasterProgress(items.mounts);
|
||||
|
||||
Reference in New Issue
Block a user