Convert sptDev profiles quest starter email function to use mail send service

This commit is contained in:
Dev 2023-07-22 14:02:13 +01:00
parent ab912f519f
commit c3a4caa38a
4 changed files with 10 additions and 17 deletions

View File

@ -28,6 +28,7 @@ import { EventOutputHolder } from "../routers/EventOutputHolder";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { MailSendService } from "../services/MailSendService";
import { ProfileFixerService } from "../services/ProfileFixerService";
import { HashUtil } from "../utils/HashUtil";
import { TimeUtil } from "../utils/TimeUtil";
@ -44,6 +45,7 @@ export class ProfileController
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("ProfileFixerService") protected profileFixerService: ProfileFixerService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("MailSendService") protected mailSendService: MailSendService,
@inject("PlayerScavGenerator") protected playerScavGenerator: PlayerScavGenerator,
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
@inject("TraderHelper") protected traderHelper: TraderHelper,
@ -232,9 +234,15 @@ export class ProfileController
// Get messageId of text to send to player as text message in game
// Copy of code from QuestController.acceptQuest()
const messageId = this.questHelper.getMessageIdForQuestStart(questFromDb.startedMessageText, questFromDb.description);
const messageContent = this.dialogueHelper.createMessageContext(messageId, MessageType.QUEST_START, 99999);
const itemRewards = this.questHelper.applyQuestReward(profileDetails.characters.pmc, quest.qid, QuestStatus.Started, sessionID, response);
this.dialogueHelper.addDialogueMessage(questFromDb.traderId, messageContent, sessionID, itemRewards);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
this.traderHelper.getTraderById(questFromDb.traderId),
MessageType.QUEST_START,
messageId,
itemRewards,
this.timeUtil.getHoursAsSeconds(100));
}
}

View File

@ -275,10 +275,7 @@ 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 startedQuestRewards = this.questHelper.applyQuestReward(pmcData, acceptedQuest.qid, QuestStatus.Started, sessionID, acceptQuestResponse);
//this.dialogueHelper.addDialogueMessage(questFromDb.traderId, messageContent, sessionID, startedQuestRewards);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
@ -342,9 +339,6 @@ export class QuestController
}
const questRewards = this.questHelper.getQuestRewardItems(<IQuest><unknown>repeatableQuestProfile, state);
//const messageContent = this.dialogueHelper.createMessageContext(questStartedMessageKey, MessageType.QUEST_START, this.questConfig.redeemTime);
//this.dialogueHelper.addDialogueMessage(repeatableQuestProfile.traderId, messageContent, sessionID, questRewards);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,

View File

@ -519,9 +519,6 @@ export class QuestHelper
// Create a dialog message for completing the quest.
const quest = this.getQuestFromDb(failRequest.qid, pmcData);
//const messageContent = this.dialogueHelper.createMessageContext(quest.failMessageText, MessageType.QUEST_FAIL, this.questConfig.redeemTime);
//this.dialogueHelper.addDialogueMessage(quest.traderId, messageContent, sessionID, questRewards);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
this.traderHelper.getTraderById(quest.traderId),

View File

@ -147,12 +147,6 @@ export class RagfairServerHelper
*/
public returnItems(sessionID: string, returnedItems: Item[]): void
{
//const messageContent = this.dialogueHelper.createMessageContext(undefined, MessageType.MESSAGE_WITH_ITEMS, this.questConfig.redeemTime);
//const locale = this.localeService.getLocaleDb();
//messageContent.text = locale[RagfairServerHelper.goodsReturnedTemplate];
//this.dialogueHelper.addDialogueMessage(Traders.RAGMAN, messageContent, sessionID, returnedItems);
this.mailSendService.sendLocalisedNpcMessageToPlayer(
sessionID,
Traders.RAGMAN,