Fix #1909 (keep stack selected after selling item)

This commit is contained in:
Sabe Jones
2013-12-01 10:16:21 -06:00
parent 1000796ddd
commit 30a5b349f8

View File

@@ -55,22 +55,30 @@ habitrpg.controller("InventoryCtrl", ['$rootScope', '$scope', 'User', 'API_URL',
'items.eggs': user.items.eggs,
'stats.gp': User.user.stats.gp + $scope.selectedEgg.value
});
if (user.items.eggs[$scope.selectedEgg.name] < 1) {
$scope.selectedEgg = null;
}
} else if ($scope.selectedPotion) {
user.items.hatchingPotions[$scope.selectedPotion.name]--;
User.setMultiple({
'items.hatchingPotions': user.items.hatchingPotions,
'stats.gp': User.user.stats.gp + $scope.selectedPotion.value
});
if (user.items.hatchingPotions[$scope.selectedPotion.name] < 1) {
$scope.selectedPotion = null;
}
} else if ($scope.selectedFood) {
user.items.food[$scope.selectedFood.name]--;
User.setMultiple({
'items.food': user.items.food,
'stats.gp': User.user.stats.gp + $scope.selectedFood.value
});
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){
var pet = egg.name+"-"+potion.name;
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 = {};
setObj['items.pets.' + pet] = 5;