From 8edc43e9de2cf25d35ecab20311e1bd6c8162a9d Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 10 Oct 2023 14:46:23 +0100 Subject: [PATCH] Do not send timelocked quests to client until timer is passed --- project/src/controllers/QuestController.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index d3c0ed5b..68c045a8 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -135,6 +135,20 @@ export class QuestController haveCompletedPreviousQuest = false; break; } + + // Has a wait timer + if (conditionToFulfil._props.availableAfter > 0) + { + // Compare current time to unlock time for previous quest + const previousQuestCompleteTime = prerequisiteQuest.statusTimers[prerequisiteQuest.status]; + const unlockTime = previousQuestCompleteTime + conditionToFulfil._props.availableAfter; + if (unlockTime > this.timeUtil.getTimestamp()) + { + this.logger.debug(`Quest ${quest.QuestName} is locked for another ${unlockTime - this.timeUtil.getTimestamp()} seconds`); + haveCompletedPreviousQuest = false; + break; + } + } } // Previous quest not completed, skip