mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Fix #1909 (keep stack selected after selling item)
This commit is contained in:
@@ -55,21 +55,29 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
'items.eggs': user.items.eggs,
|
'items.eggs': user.items.eggs,
|
||||||
'stats.gp': User.user.stats.gp + $scope.selectedEgg.value
|
'stats.gp': User.user.stats.gp + $scope.selectedEgg.value
|
||||||
});
|
});
|
||||||
$scope.selectedEgg = null;
|
if (user.items.eggs[$scope.selectedEgg.name] < 1) {
|
||||||
|
$scope.selectedEgg = null;
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($scope.selectedPotion) {
|
} else if ($scope.selectedPotion) {
|
||||||
user.items.hatchingPotions[$scope.selectedPotion.name]--;
|
user.items.hatchingPotions[$scope.selectedPotion.name]--;
|
||||||
User.setMultiple({
|
User.setMultiple({
|
||||||
'items.hatchingPotions': user.items.hatchingPotions,
|
'items.hatchingPotions': user.items.hatchingPotions,
|
||||||
'stats.gp': User.user.stats.gp + $scope.selectedPotion.value
|
'stats.gp': User.user.stats.gp + $scope.selectedPotion.value
|
||||||
});
|
});
|
||||||
$scope.selectedPotion = null;
|
if (user.items.hatchingPotions[$scope.selectedPotion.name] < 1) {
|
||||||
|
$scope.selectedPotion = null;
|
||||||
|
}
|
||||||
|
|
||||||
} else if ($scope.selectedFood) {
|
} else if ($scope.selectedFood) {
|
||||||
user.items.food[$scope.selectedFood.name]--;
|
user.items.food[$scope.selectedFood.name]--;
|
||||||
User.setMultiple({
|
User.setMultiple({
|
||||||
'items.food': user.items.food,
|
'items.food': user.items.food,
|
||||||
'stats.gp': User.user.stats.gp + $scope.selectedFood.value
|
'stats.gp': User.user.stats.gp + $scope.selectedFood.value
|
||||||
});
|
});
|
||||||
$scope.selectedFood = null;
|
if (user.items.food[$scope.selectedFood.name] < 1) {
|
||||||
|
$scope.selectedFood = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -81,7 +89,7 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
|
|||||||
$scope.hatch = function(egg, potion){
|
$scope.hatch = function(egg, potion){
|
||||||
var pet = egg.name+"-"+potion.name;
|
var pet = egg.name+"-"+potion.name;
|
||||||
if (user.items.pets[pet])
|
if (user.items.pets[pet])
|
||||||
return alert("You already have that pet, hatch a different combo.");
|
return alert("You already have that pet. Try hatching a different combination!");
|
||||||
|
|
||||||
var setObj = {};
|
var setObj = {};
|
||||||
setObj['items.pets.' + pet] = 5;
|
setObj['items.pets.' + pet] = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user