Store `AvailableAfter value in statusTimer of timelocked quest

Send locked quest to client when requested
Delete `availableAfter` property when accepting a quest
This commit is contained in:
Dev 2023-10-10 16:18:55 +01:00
parent 8edc43e9de
commit 76d8b944d5
2 changed files with 14 additions and 6 deletions

View File

@ -145,8 +145,6 @@ export class QuestController
if (unlockTime > this.timeUtil.getTimestamp())
{
this.logger.debug(`Quest ${quest.QuestName} is locked for another ${unlockTime - this.timeUtil.getTimestamp()} seconds`);
haveCompletedPreviousQuest = false;
break;
}
}
}
@ -435,11 +433,13 @@ export class QuestController
// Add diff of quests before completion vs after for client response
const questDelta = this.questHelper.getDeltaQuests(beforeQuests, this.getClientQuests(sessionID));
completeQuestResponse.profileChanges[sessionID].quests = questDelta;
// Send newly available + failed quests into function
// Check newly available + failed quests for timegates and add them to profile
this.addTimeLockedQuestsToProfile(pmcData, [...questDelta, ...questsToFail], body.qid);
// Inform client of quest changes
completeQuestResponse.profileChanges[sessionID].quests = questDelta;
// Check if it's a repeatable quest. If so, remove from Quests and repeatable.activeQuests list + move to repeatable.inactiveQuests
for (const currentRepeatable of pmcData.RepeatableQuests)
{
@ -546,7 +546,10 @@ export class QuestController
qid: quest._id,
startTime: 0,
status: QuestStatus.AvailableAfter,
statusTimers: {},
statusTimers: {
// eslint-disable-next-line @typescript-eslint/naming-convention
"9": this.timeUtil.getTimestamp()
},
availableAfter: availableAfterTimestamp
});
}

View File

@ -328,6 +328,11 @@ export class QuestHelper
existingQuest.statusTimers[newState] = this.timeUtil.getTimestamp();
existingQuest.completedConditions = [];
if (existingQuest.availableAfter)
{
delete existingQuest.availableAfter;
}
return existingQuest;
}