improve accuracy of daily quest system
Keep completed dailies inside "activeQuests" array until dailies are refreshed Adjust post-raid quest handling to ensure previously completed/failed quests keep their original status
This commit is contained in:
parent
a45cc3052e
commit
95dd27038d
@ -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")
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ export class RepeatableQuestController
|
||||
* @param {string} _info Request from client
|
||||
* @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[]
|
||||
{
|
||||
|
@ -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 = <string><unknown>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
|
||||
|
Loading…
Reference in New Issue
Block a user