From 2c2367cf7cabfc928929d9ae3a90da321a3415de Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 20 Sep 2013 18:04:20 +0200 Subject: [PATCH] update store, fix #1553 --- public/js/controllers/tasksCtrl.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/controllers/tasksCtrl.js b/public/js/controllers/tasksCtrl.js index 9e1d143312..75366aba0b 100644 --- a/public/js/controllers/tasksCtrl.js +++ b/public/js/controllers/tasksCtrl.js @@ -87,7 +87,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', ' ------------------------ */ - $scope.$watch("user.items", function() { + var updateStore = function(){ var sorted, updated; updated = window.habitrpgShared.items.updateStore(User.user); /* Figure out whether we wanna put this in habitrpg-shared @@ -95,12 +95,16 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User', ' sorted = [updated.weapon, updated.armor, updated.head, updated.shield, updated.potion, updated.reroll]; $scope.itemStore = sorted; - }); + } + + updateStore() + $scope.buy = function(type) { var hasEnough = window.habitrpgShared.items.buyItem(User.user, type); if (hasEnough) { User.log({op: "buy",type: type}); Notification.text("Item purchased."); + updateStore(); } else { Notification.text("Not enough GP."); }