Don't auto-close levemete interactions if questionable isn't running, part 2

This commit is contained in:
Liza 2024-08-08 15:31:08 +02:00
parent 2ee9360025
commit 3a27fc1211
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 16 additions and 1 deletions

View File

@ -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 // make sure to always close the leve dialogue
if (_questData.GetAllByIssuerDataId(target.DataId).Any(x => x.QuestId is LeveId)) if (_questData.GetAllByIssuerDataId(target.DataId).Any(x => x.QuestId is LeveId))

View File

@ -47,6 +47,11 @@ internal sealed class QuestController : MiniTaskController<QuestController>
/// </summary> /// </summary>
private DateTime _safeAnimationEnd = DateTime.MinValue; private DateTime _safeAnimationEnd = DateTime.MinValue;
/// <summary>
///
/// </summary>
private DateTime _lastTaskUpdate = DateTime.Now;
public QuestController( public QuestController(
IClientState clientState, IClientState clientState,
GameFunctions gameFunctions, GameFunctions gameFunctions,
@ -443,6 +448,8 @@ internal sealed class QuestController : MiniTaskController<QuestController>
ExecuteNextStep(_automationType); ExecuteNextStep(_automationType);
else else
_logger.LogInformation("Couldn't execute next step during Stop() call"); _logger.LogInformation("Couldn't execute next step during Stop() call");
_lastTaskUpdate = DateTime.Now;
} }
else if (_automationType != EAutomationType.Manual) else if (_automationType != EAutomationType.Manual)
{ {
@ -450,6 +457,7 @@ internal sealed class QuestController : MiniTaskController<QuestController>
_automationType = EAutomationType.Manual; _automationType = EAutomationType.Manual;
_nextQuest = null; _nextQuest = null;
_gatheringQuest = null; _gatheringQuest = null;
_lastTaskUpdate = DateTime.Now;
} }
} }
@ -716,6 +724,12 @@ internal sealed class QuestController : MiniTaskController<QuestController>
return false; return false;
} }
public bool WasLastTaskUpdateWithin(TimeSpan timeSpan)
{
_logger.LogInformation("Last update: {Update}", _lastTaskUpdate);
return IsRunning || DateTime.Now <= _lastTaskUpdate.Add(timeSpan);
}
public sealed record StepProgress( public sealed record StepProgress(
DateTime StartedAt, DateTime StartedAt,
int PointMenuCounter = 0); int PointMenuCounter = 0);