Added confirmation step at begin button for quest (#9199)

* Added confirmation step at begin button for quest

* Fixed the 3 errors caused by questConfirm method in travis-ci
This commit is contained in:
Sarvesh Kakodkar
2017-11-28 07:35:05 +05:30
committed by Sabe Jones
parent b3870e5f34
commit b323abd225
2 changed files with 10 additions and 1 deletions

View File

@@ -15,7 +15,7 @@
questDialogContent(:item="questData") questDialogContent(:item="questData")
div.text-center.actions(v-if='canEditQuest') div.text-center.actions(v-if='canEditQuest')
div div
button.btn.btn-secondary(v-once, @click="questForceStart()") {{ $t('begin') }} button.btn.btn-secondary(v-once, @click="questConfirm()") {{ $t('begin') }}
// @TODO don't allow the party leader to start the quest until the leader has accepted or rejected the invitation (users get confused and think "begin" means "join quest") // @TODO don't allow the party leader to start the quest until the leader has accepted or rejected the invitation (users get confused and think "begin" means "join quest")
div div
.cancel(v-once, @click="questCancel()") {{ $t('cancel') }} .cancel(v-once, @click="questCancel()") {{ $t('cancel') }}
@@ -195,6 +195,14 @@ export default {
}, },
}, },
methods: { methods: {
async questConfirm () {
let count = 0;
for (let uuid in this.group.quest.members) {
if (this.group.quest.members[uuid]) count += 1;
}
if (!confirm(this.$t('questConfirm', { questmembers: count, totalmembers: this.group.memberCount}))) return;
this.questForceStart();
},
async questForceStart () { async questForceStart () {
let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'}); let quest = await this.$store.dispatch('quests:sendAction', {groupId: this.group._id, action: 'quests/force-start'});
this.group.quest = quest; this.group.quest = quest;

View File

@@ -78,6 +78,7 @@
"mustLvlQuest": "You must be level <%= level %> to buy this quest!", "mustLvlQuest": "You must be level <%= level %> to buy this quest!",
"mustInviteFriend": "To earn this quest, invite a friend to your Party. Invite someone now?", "mustInviteFriend": "To earn this quest, invite a friend to your Party. Invite someone now?",
"unlockByQuesting": "To unlock this quest, complete <%= title %>.", "unlockByQuesting": "To unlock this quest, complete <%= title %>.",
"questConfirm": "Are you sure? Only <%= questmembers %> of your <%= totalmembers %> party members have joined this quest! Quests start automatically when all players have joined or rejected the invitation.",
"sureCancel": "Are you sure you want to cancel this quest? All invitation acceptances will be lost. The quest owner will retain possession of the quest scroll.", "sureCancel": "Are you sure you want to cancel this quest? All invitation acceptances will be lost. The quest owner will retain possession of the quest scroll.",
"sureAbort": "Are you sure you want to abort this mission? It will abort it for everyone in your party and all progress will be lost. The quest scroll will be returned to the quest owner.", "sureAbort": "Are you sure you want to abort this mission? It will abort it for everyone in your party and all progress will be lost. The quest scroll will be returned to the quest owner.",
"doubleSureAbort": "Are you double sure? Make sure they won't hate you forever!", "doubleSureAbort": "Are you double sure? Make sure they won't hate you forever!",