mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +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.seasonalShopCategories = Shared.shops.getSeasonalShopCategories(user);
|
||||||
|
|
||||||
$scope.shouldShowPremiumPetRow = function (potion) {
|
$scope.shouldShowPremiumPetRow = function (potion) {
|
||||||
potion = Content.premiumHatchingPotions[potion];
|
var premiumPotion = Content.premiumHatchingPotions[potion];
|
||||||
|
|
||||||
if (!potion) {
|
if (!premiumPotion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (user.items.hatchingPotions[potion.key] > 0) {
|
if (user.items.hatchingPotions[premiumPotion.key] > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (potion.canBuy()) {
|
if (premiumPotion.canBuy()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var pets = Object.keys(user.items.pets);
|
return $scope.hasAPetOfPotion(potion);
|
||||||
var hasAPetOfPotion = pets.find(function (pet) {
|
|
||||||
return pet.indexOf(potion.key) !== -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
return hasAPetOfPotion;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.shouldShowPremiumPetSection = function () {
|
$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) {
|
function _updateDropAnimalCount(items) {
|
||||||
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
|
$scope.petCount = Shared.count.beastMasterProgress(items.pets);
|
||||||
$scope.mountCount = Shared.count.mountMasterProgress(items.mounts);
|
$scope.mountCount = Shared.count.mountMasterProgress(items.mounts);
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ mixin mountList(eggSource, potionSource)
|
|||||||
.row: .col-md-12
|
.row: .col-md-12
|
||||||
+mountList(env.Content.dropEggs,env.Content.dropHatchingPotions)
|
+mountList(env.Content.dropEggs,env.Content.dropHatchingPotions)
|
||||||
|
|
||||||
.row: .col-md-12
|
.row(ng-if="::shouldShowPremiumMountSection()"): .col-md-12
|
||||||
h4=env.t('magicMounts')
|
h4=env.t('magicMounts')
|
||||||
menu.pets(type='list')
|
menu.pets(type='list')
|
||||||
each potion in env.Content.premiumHatchingPotions
|
each potion in env.Content.premiumHatchingPotions
|
||||||
li.customize-menu
|
li.customize-menu(ng-if="::hasAPetOfPotion('#{potion.key}')")
|
||||||
menu
|
menu
|
||||||
each egg in env.Content.dropEggs
|
each egg in env.Content.dropEggs
|
||||||
- var mountKey = egg.key + "-" + potion.key
|
- var mountKey = egg.key + "-" + potion.key
|
||||||
|
|||||||
Reference in New Issue
Block a user