diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index 30b7bf0a..11d73243 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -507,17 +507,12 @@ export class QuestController // Inform client of quest changes completeQuestResponse.profileChanges[sessionID].quests.push(...questDelta); - // Check if it's a repeatable quest. If so, remove from Quests and repeatable.activeQuests list + move to repeatable.inactiveQuests + // Check if it's a repeatable quest. If so, remove from Quests for (const currentRepeatable of pmcData.RepeatableQuests) { - const repeatableQuest = currentRepeatable.activeQuests.find((x) => x._id === completedQuestId); + const repeatableQuest = currentRepeatable.activeQuests.find((activeRepeatable) => activeRepeatable._id === completedQuestId); if (repeatableQuest) { - currentRepeatable.activeQuests = currentRepeatable.activeQuests.filter((x) => - x._id !== completedQuestId - ); - currentRepeatable.inactiveQuests.push(repeatableQuest); - // Need to remove redundant scav quest object as its no longer necessary, is tracked in pmc profile if (repeatableQuest.side === "Scav") { diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index 92daaa7d..a31b7379 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -82,9 +82,9 @@ export class RepeatableQuestController * The new quests generated are again persisted in profile.RepeatableQuests * * @param {string} _info Request from client - * @param {string} sessionID Player's session id + * @param {string} sessionID Player's session id * - * @returns {array} array of "repeatableQuestObjects" as descibed above + * @returns {array} Array of "repeatableQuestObjects" as descibed above */ public getClientRepeatableQuests(_info: IEmptyRequestData, sessionID: string): IPmcDataRepeatableQuest[] { diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index c081320b..36b86449 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -21,8 +21,8 @@ import { SaveServer } from "@spt-aki/servers/SaveServer"; import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; -import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; +import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { ProfileHelper } from "./ProfileHelper"; @injectable() @@ -291,7 +291,7 @@ export class InRaidHelper const postRaidQuestStatus = postRaidQuest.status; // Find matching pre-raid quest - const preRaidQuest = preRaidQuests?.find((x) => x.qid === postRaidQuest.qid); + const preRaidQuest = preRaidQuests?.find((preRaidQuest) => preRaidQuest.qid === postRaidQuest.qid); if (!preRaidQuest) { // Some traders gives locked quests (LightKeeper) due to time-gating @@ -307,6 +307,18 @@ export class InRaidHelper // Already completed/failed before raid, skip if ([QuestStatus.Fail, QuestStatus.Success].includes(preRaidQuest.status) ) { + // Daily quests get their status altered in-raid to "AvailableForStart", + // Copy pre-raid status to post raid data + if (preRaidQuest.status === QuestStatus.Success) + { + postRaidQuest.status = QuestStatus.Success; + } + + if (preRaidQuest.status === QuestStatus.Fail) + { + postRaidQuest.status = QuestStatus.Fail; + } + continue; } @@ -339,7 +351,7 @@ export class InRaidHelper // Does failed quest have requirement to collect items from raid const questDbData = this.questHelper.getQuestFromDb(postRaidQuest.qid, pmcData); // AvailableForFinish - const matchingAffFindConditions = questDbData.conditions.AvailableForFinish.filter(x => x.conditionType === "FindItem"); + const matchingAffFindConditions = questDbData.conditions.AvailableForFinish.filter(condition => condition.conditionType === "FindItem"); const itemsToCollect: string[] = []; if (matchingAffFindConditions) { @@ -352,7 +364,7 @@ export class InRaidHelper // Remove quest items from profile as quest has failed and may still be alive // Required as restarting the quest from main menu does not remove value from CarriedQuestItems array - postRaidProfile.Stats.Eft.CarriedQuestItems = postRaidProfile.Stats.Eft.CarriedQuestItems.filter(x => !itemsToCollect.includes(x)) + postRaidProfile.Stats.Eft.CarriedQuestItems = postRaidProfile.Stats.Eft.CarriedQuestItems.filter(carriedQuestItem => !itemsToCollect.includes(carriedQuestItem)) // Remove quest item from profile now quest is failed // updateProfileBaseStats() has already passed by ref EFT.Stats, all changes applied to postRaid profile also apply to server profile