From 99cb77d3cf67efcfea130c6323061197001b3b8f Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 17 Oct 2023 16:31:21 +0100 Subject: [PATCH] Save scav quests into scav profile when accepting them --- project/src/controllers/QuestController.ts | 22 ++++++++++++++----- .../controllers/RepeatableQuestController.ts | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index 57dc9343..90d580f6 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -326,12 +326,11 @@ export class QuestController { const acceptQuestResponse = this.eventOutputHolder.getOutput(sessionID); - const state = QuestStatus.Started; - const newQuest = this.questHelper.getQuestReadyForProfile(pmcData, state, acceptedQuest); + const desiredQuestState = QuestStatus.Started; + const newQuest = this.questHelper.getQuestReadyForProfile(pmcData, desiredQuestState, acceptedQuest); pmcData.Quests.push(newQuest); - + const repeatableQuestProfile = this.getRepeatableQuestFromProfile(pmcData, acceptedQuest); - if (!repeatableQuestProfile) { this.logger.error(this.localisationService.getText("repeatable-accepted_repeatable_quest_not_found_in_active_quests", acceptedQuest.qid)); @@ -339,6 +338,18 @@ export class QuestController throw new Error(this.localisationService.getText("repeatable-unable_to_accept_quest_see_log")); } + // Scav quests need to be added to scav profile + if (repeatableQuestProfile.side === "Scav") + { + const fullProfile = this.profileHelper.getFullProfile(sessionID); + if (!fullProfile.characters.scav.Quests) + { + fullProfile.characters.scav.Quests = []; + } + + fullProfile.characters.scav.Quests.push(newQuest); + } + const locale = this.localeService.getLocaleDb(); const questStartedMessageKey = this.questHelper.getMessageIdForQuestStart(repeatableQuestProfile.startedMessageText, repeatableQuestProfile.description); @@ -361,7 +372,7 @@ export class QuestController } } - const questRewards = this.questHelper.getQuestRewardItems(repeatableQuestProfile, state); + const questRewards = this.questHelper.getQuestRewardItems(repeatableQuestProfile, desiredQuestState); this.mailSendService.sendLocalisedNpcMessageToPlayer( sessionID, @@ -372,6 +383,7 @@ export class QuestController this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime)); acceptQuestResponse.profileChanges[sessionID].quests = this.questHelper.getNewlyAccessibleQuestsWhenStartingQuest(acceptedQuest.qid, sessionID); + return acceptQuestResponse; } diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index 410d868f..768dd7c9 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -133,6 +133,7 @@ export class RepeatableQuestController // introduce a dynamic quest pool to avoid duplicates const questTypePool = this.generateQuestPool(repeatableConfig, pmcData.Info.Level); + // Add daily quests for (let i = 0; i < repeatableConfig.numQuests; i++) { let quest = null;