mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-19 04:08:54 +00:00
fix(spells): some $rootScope.applying action fixes so cast-ending is
immediate instead of waiting on response. Also, slim down party population to the essentials to avoid RequestEntityTooLarge
This commit is contained in:
parent
9e69d7959f
commit
c6f7ab8a5c
2 changed files with 6 additions and 4 deletions
|
|
@ -163,20 +163,22 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
}
|
||||
|
||||
$scope.castEnd = function(target, type, $event){
|
||||
if (!$rootScope.applyingAction) return;
|
||||
$event && ($event.stopPropagation(),$event.preventDefault());
|
||||
if ($scope.spell.target != type) return Notification.text("Invalid target");
|
||||
$scope.spell.cast(User.user, target);
|
||||
var spell = $scope.spell;
|
||||
User.save();
|
||||
$http.post('/api/v2/user/class/cast/' + $scope.spell.key, {target:target, type:type}).success(function(){
|
||||
var msg = "You cast " + $scope.spell.text;
|
||||
$http.post('/api/v2/user/class/cast/' + spell.key, {target:target, type:type}).success(function(){
|
||||
var msg = "You cast " + spell.text;
|
||||
switch (type) {
|
||||
case 'task': msg += ' on ' + target.text;break;
|
||||
case 'user': msg += ' on ' + target.profile.name;break;
|
||||
case 'party': msg += ' on the Party';break;
|
||||
}
|
||||
Notification.text(msg);
|
||||
$scope.spell = null;
|
||||
});
|
||||
$scope.spell = null;
|
||||
$rootScope.applyingAction = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ api.cast = function(req, res) {
|
|||
case 'user':
|
||||
async.waterfall([
|
||||
function(cb){
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members').exec(cb);
|
||||
Group.findOne({type: 'party', members: {'$in': [user._id]}}).populate('members', 'profile.name stats achievements').exec(cb);
|
||||
},
|
||||
function(group, cb) {
|
||||
// Solo player? let's just create a faux group for simpler code
|
||||
|
|
|
|||
Loading…
Reference in a new issue