Save scav quests into scav profile when accepting them

This commit is contained in:
Dev 2023-10-17 16:31:21 +01:00
parent 650a3173c8
commit 99cb77d3cf
2 changed files with 18 additions and 5 deletions

View File

@ -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(<IQuest><unknown>repeatableQuestProfile, state);
const questRewards = this.questHelper.getQuestRewardItems(<IQuest><unknown>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;
}

View File

@ -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;