Do not send timelocked quests to client until timer is passed

This commit is contained in:
Dev 2023-10-10 14:46:23 +01:00
parent 117c965948
commit 8edc43e9de

View File

@ -135,6 +135,20 @@ export class QuestController
haveCompletedPreviousQuest = false; haveCompletedPreviousQuest = false;
break; 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 // Previous quest not completed, skip