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.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);
|
||||
|
||||
@@ -26,11 +26,11 @@ mixin mountList(eggSource, potionSource)
|
||||
.row: .col-md-12
|
||||
+mountList(env.Content.dropEggs,env.Content.dropHatchingPotions)
|
||||
|
||||
.row: .col-md-12
|
||||
.row(ng-if="::shouldShowPremiumMountSection()"): .col-md-12
|
||||
h4=env.t('magicMounts')
|
||||
menu.pets(type='list')
|
||||
each potion in env.Content.premiumHatchingPotions
|
||||
li.customize-menu
|
||||
li.customize-menu(ng-if="::hasAPetOfPotion('#{potion.key}')")
|
||||
menu
|
||||
each egg in env.Content.dropEggs
|
||||
- var mountKey = egg.key + "-" + potion.key
|
||||
|
||||
Reference in New Issue
Block a user