diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index e5a848a69f..4c81a9584e 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -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; } diff --git a/src/controllers/user.js b/src/controllers/user.js index 7263766615..96e2b3cb13 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -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