From f3e1dd59fbeae95ec89aa6090e24c431c5d50296 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 22 Jul 2023 12:56:15 +0100 Subject: [PATCH] Migrate quest controller to use new message service instead of dialogHelper --- project/src/controllers/QuestController.ts | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index 1c58eec7..cfc93360 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -275,10 +275,18 @@ export class QuestController const questFromDb = this.questHelper.getQuestFromDb(acceptedQuest.qid, pmcData); // Get messageId of text to send to player as text message in game const messageId = this.questHelper.getMessageIdForQuestStart(questFromDb.startedMessageText, questFromDb.description); - const messageContent = this.dialogueHelper.createMessageContext(messageId, MessageType.QUEST_START, this.questConfig.redeemTime); + //const messageContent = this.dialogueHelper.createMessageContext(messageId, MessageType.QUEST_START, this.questConfig.redeemTime); const startedQuestRewards = this.questHelper.applyQuestReward(pmcData, acceptedQuest.qid, QuestStatus.Started, sessionID, acceptQuestResponse); - this.dialogueHelper.addDialogueMessage(questFromDb.traderId, messageContent, sessionID, startedQuestRewards); + //this.dialogueHelper.addDialogueMessage(questFromDb.traderId, messageContent, sessionID, startedQuestRewards); + + this.mailSendService.sendLocalisedNpcMessageToPlayer( + sessionID, + this.traderHelper.getTraderById(questFromDb.traderId), + MessageType.QUEST_START, + messageId, + startedQuestRewards, + this.questConfig.redeemTime); acceptQuestResponse.profileChanges[sessionID].quests = this.questHelper.acceptedUnlocked(acceptedQuest.qid, sessionID); @@ -334,9 +342,17 @@ export class QuestController } const questRewards = this.questHelper.getQuestRewardItems(repeatableQuestProfile, state); - const messageContent = this.dialogueHelper.createMessageContext(questStartedMessageKey, MessageType.QUEST_START, this.questConfig.redeemTime); + //const messageContent = this.dialogueHelper.createMessageContext(questStartedMessageKey, MessageType.QUEST_START, this.questConfig.redeemTime); - this.dialogueHelper.addDialogueMessage(repeatableQuestProfile.traderId, messageContent, sessionID, questRewards); + //this.dialogueHelper.addDialogueMessage(repeatableQuestProfile.traderId, messageContent, sessionID, questRewards); + + this.mailSendService.sendLocalisedNpcMessageToPlayer( + sessionID, + this.traderHelper.getTraderById(repeatableQuestProfile.traderId), + MessageType.QUEST_START, + questStartedMessageKey, + questRewards, + this.questConfig.redeemTime); acceptQuestResponse.profileChanges[sessionID].quests = this.questHelper.acceptedUnlocked(acceptedQuest.qid, sessionID); return acceptQuestResponse;