mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-26 13:22:38 +00:00
quests: add abort feature
This commit is contained in:
parent
8095397317
commit
ae403a55a5
5 changed files with 28 additions and 3 deletions
|
|
@ -300,6 +300,12 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||||
//User.user.invitations.party = undefined;
|
//User.user.invitations.party = undefined;
|
||||||
User.set({'invitations.party':{}});
|
User.set({'invitations.party':{}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.questAbort = function(){
|
||||||
|
if (!confirm("Are you sure you want to abort this mission? It will abort it for everyone in your party.")) return;
|
||||||
|
if (!confirm("Are you double sure? Make sure they won't hate you forever!")) return;
|
||||||
|
$rootScope.party.$questAbort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ angular.module('groupServices', ['ngResource']).
|
||||||
leave: {method: "POST", url: API_URL + '/api/v2/groups/:gid/leave'},
|
leave: {method: "POST", url: API_URL + '/api/v2/groups/:gid/leave'},
|
||||||
invite: {method: "POST", url: API_URL + '/api/v2/groups/:gid/invite'},
|
invite: {method: "POST", url: API_URL + '/api/v2/groups/:gid/invite'},
|
||||||
questAccept: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questAccept'},
|
questAccept: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questAccept'},
|
||||||
questReject: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questReject'}
|
questReject: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questReject'},
|
||||||
|
questAbort: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questAbort'}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Defer loading everything until they're requested
|
// Defer loading everything until they're requested
|
||||||
|
|
|
||||||
|
|
@ -491,5 +491,21 @@ api.questReject = function(req, res, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//TODO
|
api.questAbort = function(req, res, next){
|
||||||
function questAbort(){}
|
var group = res.locals.group;
|
||||||
|
var parallel = _.transform(group.members, function(m,v){
|
||||||
|
m.push(function(cb){
|
||||||
|
v.party.quest = {};
|
||||||
|
v.party.quest.tally.collection = {};v.markModified('party.quest');
|
||||||
|
v._v++;
|
||||||
|
v.save(cb);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
group.quest = {};
|
||||||
|
parallel.push(function(cb){group.save(cb);});
|
||||||
|
async.parallel(parallel,function(err){
|
||||||
|
if (err) return res.json(500,{err:err});
|
||||||
|
res.json(group);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ router.post('/groups/:gid/invite', auth.auth, groups.attachGroup, groups.invite)
|
||||||
router.post('/groups/:gid/removeMember', auth.auth, groups.attachGroup, groups.removeMember);
|
router.post('/groups/:gid/removeMember', auth.auth, groups.attachGroup, groups.removeMember);
|
||||||
router.post('/groups/:gid/questAccept', auth.auth, groups.attachGroupPopulated, groups.questAccept); // query={key} (optional. if provided, trigger new invite, if not, accept existing invite)
|
router.post('/groups/:gid/questAccept', auth.auth, groups.attachGroupPopulated, groups.questAccept); // query={key} (optional. if provided, trigger new invite, if not, accept existing invite)
|
||||||
router.post('/groups/:gid/questReject', auth.auth, groups.attachGroupPopulated, groups.questReject);
|
router.post('/groups/:gid/questReject', auth.auth, groups.attachGroupPopulated, groups.questReject);
|
||||||
|
router.post('/groups/:gid/questAbort', auth.auth, groups.attachGroupPopulated, groups.questAbort);
|
||||||
|
|
||||||
//GET /groups/:gid/chat
|
//GET /groups/:gid/chat
|
||||||
router.post('/groups/:gid/chat', auth.auth, groups.attachGroup, groups.postChat);
|
router.post('/groups/:gid/chat', auth.auth, groups.attachGroup, groups.postChat);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ a.pull-right.gem-wallet(popover-trigger='mouseenter', popover-title='Guild Bank'
|
||||||
i.icon-heart
|
i.icon-heart
|
||||||
| {{group.quest.progress.hp | number:0}} / {{Content.quests[group.quest.key].stats.hp}}
|
| {{group.quest.progress.hp | number:0}} / {{Content.quests[group.quest.key].stats.hp}}
|
||||||
p {{Content.quests[group.quest.key].notes}}
|
p {{Content.quests[group.quest.key].notes}}
|
||||||
|
button.btn.btn-mini.btn-danger(ng-click='questAbort()') Abort
|
||||||
|
|
||||||
// ------ Information -------
|
// ------ Information -------
|
||||||
.modal.inline-modal
|
.modal.inline-modal
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue