mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
eggs: add ability to sell potions / eggs
This commit is contained in:
@@ -28,6 +28,24 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User',
|
||||
}
|
||||
}
|
||||
|
||||
$scope.sellInventory = function() {
|
||||
if ($scope.selectedEgg) {
|
||||
User.user.stats.gp += $scope.selectedEgg.value;
|
||||
$scope.userEggs.splice($scope.selectedEgg.index, 1);
|
||||
User.log([
|
||||
{ op: 'set', data: {'items.eggs': $scope.userEggs} }
|
||||
]);
|
||||
$scope.selectedEgg = null;
|
||||
} else if ($scope.selectedPotion) {
|
||||
User.user.stats.gp += $scope.selectedPotion.value;
|
||||
$scope.userHatchingPotions.splice($scope.selectedPotion.index, 1);
|
||||
User.log([
|
||||
{ op: 'set', data: {'items.hatchingPotions': $scope.selectedPotion} }
|
||||
]);
|
||||
$scope.selectedPotion = null;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.ownsPet = function(egg, potion){
|
||||
if (!egg || !potion) return;
|
||||
var pet = egg.name + '-' + potion;
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
table.NPC-Alex-container
|
||||
tr
|
||||
td
|
||||
button.customize-option.sell-inventory(ng-show='selectedEgg')
|
||||
button.customize-option.sell-inventory(ng-show='selectedEgg', ng-click='sellInventory()')
|
||||
| Sell {{selectedEgg.name}} for {{selectedEgg.value}} GP
|
||||
button.customize-option.sell-inventory(ng-show='selectedPotion')
|
||||
button.customize-option.sell-inventory(ng-show='selectedPotion', ng-click='sellInventory()')
|
||||
| Sell {{selectedPotion.name}} for {{selectedPotion.value}} GP
|
||||
.NPC-Alex.pull-left(ng-show='!selectedEgg && !selectedPotion')
|
||||
td
|
||||
|
||||
Reference in New Issue
Block a user