prevent Quest progress message in Party chat when user is Resting in the Inn (#10636)

* prevent quest progress message in party chat when user is resting in the inn

* improve comment

* update tests now that the test group includes a new member (sleeping quest participant)

* adjust a test to fix lint failure (and make the test better)

* fix order of element assignments in test array
This commit is contained in:
Alys
2018-08-28 23:04:16 +10:00
committed by Matteo Pagliazzi
parent 0002148326
commit 1d597039ca
2 changed files with 112 additions and 13 deletions

View File

@@ -1091,6 +1091,8 @@ schema.methods._processCollectionQuest = async function processCollectionQuest (
};
schema.statics.processQuestProgress = async function processQuestProgress (user, progress) {
if (user.preferences.sleep) return;
let group = await this.getGroup({user, groupId: 'party'});
if (!_isOnQuest(user, progress, group)) return;
@@ -1101,7 +1103,7 @@ schema.statics.processQuestProgress = async function processQuestProgress (user,
let questType = quest.boss ? 'Boss' : 'Collection';
await group[`_process${questType}Quest`]({
await group[`_process${questType}Quest`]({ // _processBossQuest, _processCollectionQuest
user,
progress,
group,
@@ -1131,6 +1133,7 @@ process.nextTick(() => {
// returns a promise
schema.statics.tavernBoss = async function tavernBoss (user, progress) {
if (!progress) return;
if (user.preferences.sleep) return;
// hack: prevent crazy damage to world boss
let dmg = Math.min(900, Math.abs(progress.up || 0));