Only send failed message to player if failure message text length is great than 0 (after having whitespace trimmed)

This commit is contained in:
Dev 2024-04-12 11:29:50 +01:00
parent 364e590960
commit 765c2ae270

View File

@ -734,14 +734,17 @@ export class QuestHelper
// Quest found and no repeatable found
if (quest && !matchingRepeatableQuest)
{
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
this.traderHelper.getTraderById(quest?.traderId ?? matchingRepeatableQuest?.traderId), // Can be null when repeatable quest has been moved to inactiveQuests
MessageType.QUEST_FAIL,
quest.failMessageText,
questRewards,
this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime),
);
if (quest.failMessageText.trim().length > 0)
{
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
this.traderHelper.getTraderById(quest?.traderId ?? matchingRepeatableQuest?.traderId), // Can be null when repeatable quest has been moved to inactiveQuests
MessageType.QUEST_FAIL,
quest.failMessageText,
questRewards,
this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime),
);
}
}
output.profileChanges[sessionID].quests.push(...this.failedUnlocked(failRequest.qid, sessionID));