diff --git a/Questionable/Controller/GameUiController.cs b/Questionable/Controller/GameUiController.cs index d8c314eeb..8e92e2310 100644 --- a/Questionable/Controller/GameUiController.cs +++ b/Questionable/Controller/GameUiController.cs @@ -337,7 +337,8 @@ internal sealed class GameUiController : IDisposable } } - if (_questController.IsRunning && _questController.NextQuest == null) + if ((_questController.IsRunning || _questController.WasLastTaskUpdateWithin(TimeSpan.FromSeconds(5))) + && _questController.NextQuest == null) { // make sure to always close the leve dialogue if (_questData.GetAllByIssuerDataId(target.DataId).Any(x => x.QuestId is LeveId)) diff --git a/Questionable/Controller/QuestController.cs b/Questionable/Controller/QuestController.cs index cb1cb91db..34ff86b02 100644 --- a/Questionable/Controller/QuestController.cs +++ b/Questionable/Controller/QuestController.cs @@ -47,6 +47,11 @@ internal sealed class QuestController : MiniTaskController /// private DateTime _safeAnimationEnd = DateTime.MinValue; + /// + /// + /// + private DateTime _lastTaskUpdate = DateTime.Now; + public QuestController( IClientState clientState, GameFunctions gameFunctions, @@ -443,6 +448,8 @@ internal sealed class QuestController : MiniTaskController ExecuteNextStep(_automationType); else _logger.LogInformation("Couldn't execute next step during Stop() call"); + + _lastTaskUpdate = DateTime.Now; } else if (_automationType != EAutomationType.Manual) { @@ -450,6 +457,7 @@ internal sealed class QuestController : MiniTaskController _automationType = EAutomationType.Manual; _nextQuest = null; _gatheringQuest = null; + _lastTaskUpdate = DateTime.Now; } } @@ -716,6 +724,12 @@ internal sealed class QuestController : MiniTaskController return false; } + public bool WasLastTaskUpdateWithin(TimeSpan timeSpan) + { + _logger.LogInformation("Last update: {Update}", _lastTaskUpdate); + return IsRunning || DateTime.Now <= _lastTaskUpdate.Add(timeSpan); + } + public sealed record StepProgress( DateTime StartedAt, int PointMenuCounter = 0);