From e4f2a4386ddd5615f4b8b1a1e6354167563f84f0 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 19 Oct 2013 20:22:12 -0700 Subject: [PATCH] eggs: bug fixes on selling potions --- public/js/controllers/inventoryCtrl.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/public/js/controllers/inventoryCtrl.js b/public/js/controllers/inventoryCtrl.js index 8962881fb2..99c6b3b4ad 100644 --- a/public/js/controllers/inventoryCtrl.js +++ b/public/js/controllers/inventoryCtrl.js @@ -30,18 +30,18 @@ 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} } - ]); + User.setMultiple({ + 'items.eggs': $scope.userEggs, + 'stats.gp': User.user.stats.gp + $scope.selectedEgg.value + }); $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} } - ]); + User.setMultiple({ + 'items.hatchingPotions': $scope.userHatchingPotions, + 'stats.gp': User.user.stats.gp + $scope.selectedPotion.value + }); $scope.selectedPotion = null; } } @@ -58,7 +58,7 @@ habitrpg.controller("InventoryCtrl", ['$scope', 'User', } $scope.hatch = function(egg, potion){ - if ($scope.ownsPet(egg.name, potion.name)){ + if ($scope.ownsPet(egg, potion.name)){ return alert("You already have that pet, hatch a different combo.") } var pet = egg.name + '-' + potion.name;