mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
update store, fix #1553
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user