mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix: Armoire sends back data from server rather than relying on client
closes #5376
This commit is contained in:
@@ -259,6 +259,11 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
||||
User.buy({params:{key:item.key}});
|
||||
};
|
||||
|
||||
$scope.buyArmoire = function () {
|
||||
playRewardSound($scope.armoire);
|
||||
User.buyArmoire();
|
||||
}
|
||||
|
||||
/*
|
||||
------------------------
|
||||
Hiding Tasks
|
||||
|
||||
@@ -355,6 +355,17 @@ angular.module('habitrpg')
|
||||
callOpsFunctionAndRequest('buy', 'buy', "POST", data.params.key, data);
|
||||
},
|
||||
|
||||
buyArmoire: function () {
|
||||
$http({
|
||||
method: "POST",
|
||||
url: '/api/v3/user/buy-armoire',
|
||||
})
|
||||
.then(function (response) {
|
||||
Notification.text(response.data.message);
|
||||
sync();
|
||||
})
|
||||
},
|
||||
|
||||
buyQuest: function (data) {
|
||||
callOpsFunctionAndRequest('buyQuest', 'buy-quest', "POST", data.params.key, data);
|
||||
},
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
mixin reward(item)
|
||||
mixin reward(item, action)
|
||||
- action = action || "buy(" + item + ")"
|
||||
|
||||
li.task.reward-item(popover-trigger='mouseenter', popover-placement='top', popover='{{::#{item}.notes()}}')&attributes(attributes)
|
||||
// right-hand side control buttons
|
||||
.task-meta-controls
|
||||
@@ -8,8 +10,8 @@ mixin reward(item)
|
||||
.task-controls.task-primary
|
||||
input.reward.visuallyhidden(
|
||||
type='checkbox',
|
||||
ui-keypress='{13:"buy(#{item})"}')
|
||||
a.money.btn-buy.item-btn(ng-class='::{highValue: #{item}.value >= 1000}', ng-click='::buy(#{item})')
|
||||
ui-keypress='{13:"#{action}"}')
|
||||
a.money.btn-buy.item-btn(ng-class='::{highValue: #{item}.value >= 1000}', ng-click='::#{action}')
|
||||
span.shop_gold
|
||||
span.reward-cost {{::#{item}.value}}
|
||||
// main content
|
||||
@@ -19,5 +21,5 @@ mixin reward(item)
|
||||
ul.items.rewards(ng-if='main && list.type=="reward"')
|
||||
+reward('item')(ng-repeat='item in itemStore')
|
||||
+reward('healthPotion')
|
||||
+reward('armoire')(ng-if='user.flags.armoireEnabled',
|
||||
+reward('armoire', 'buyArmoire()')(ng-if='user.flags.armoireEnabled',
|
||||
popover='{{armoire.notes(user, armoireCount(user.items.gear.owned))}}')
|
||||
|
||||
Reference in New Issue
Block a user