forked from liza/Questionable
Handle some interruption/error
This commit is contained in:
parent
bb9dd90878
commit
3ce82ec585
@ -28,6 +28,7 @@ internal abstract class MiniTaskController<T> : IDisposable
|
|||||||
private readonly ILogger<T> _logger;
|
private readonly ILogger<T> _logger;
|
||||||
|
|
||||||
private readonly string _actionCanceledText;
|
private readonly string _actionCanceledText;
|
||||||
|
private readonly string _eventCanceledText;
|
||||||
private readonly string _cantExecuteDueToStatusText;
|
private readonly string _cantExecuteDueToStatusText;
|
||||||
|
|
||||||
protected MiniTaskController(IChatGui chatGui, ICondition condition, IServiceProvider serviceProvider,
|
protected MiniTaskController(IChatGui chatGui, ICondition condition, IServiceProvider serviceProvider,
|
||||||
@ -39,6 +40,7 @@ internal abstract class MiniTaskController<T> : IDisposable
|
|||||||
_interruptHandler = interruptHandler;
|
_interruptHandler = interruptHandler;
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
|
|
||||||
|
_eventCanceledText = dataManager.GetString<LogMessage>(1318, x => x.Text)!;
|
||||||
_actionCanceledText = dataManager.GetString<LogMessage>(1314, x => x.Text)!;
|
_actionCanceledText = dataManager.GetString<LogMessage>(1314, x => x.Text)!;
|
||||||
_cantExecuteDueToStatusText = dataManager.GetString<LogMessage>(7728, x => x.Text)!;
|
_cantExecuteDueToStatusText = dataManager.GetString<LogMessage>(7728, x => x.Text)!;
|
||||||
_interruptHandler.Interrupted += HandleInterruption;
|
_interruptHandler.Interrupted += HandleInterruption;
|
||||||
@ -190,10 +192,13 @@ internal abstract class MiniTaskController<T> : IDisposable
|
|||||||
|
|
||||||
private void InterruptWithoutCombat()
|
private void InterruptWithoutCombat()
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Interrupted, attempting to redo previous tasks (not in combat)");
|
if (_taskQueue.CurrentTaskExecutor is not SinglePlayerDuty.WaitSinglePlayerDutyExecutor)
|
||||||
_taskQueue.InterruptWith([new WaitAtEnd.WaitDelay()]);
|
{
|
||||||
|
_logger.LogWarning("Interrupted, attempting to redo previous tasks (not in combat)");
|
||||||
|
|
||||||
LogTasksAfterInterruption();
|
_taskQueue.InterruptWith([new WaitAtEnd.WaitDelay()]);
|
||||||
|
LogTasksAfterInterruption();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LogTasksAfterInterruption()
|
private void LogTasksAfterInterruption()
|
||||||
@ -219,7 +224,8 @@ internal abstract class MiniTaskController<T> : IDisposable
|
|||||||
!_condition[ConditionFlag.InFlight] &&
|
!_condition[ConditionFlag.InFlight] &&
|
||||||
_taskQueue.CurrentTaskExecutor?.ShouldInterruptOnDamage() == true)
|
_taskQueue.CurrentTaskExecutor?.ShouldInterruptOnDamage() == true)
|
||||||
InterruptQueueWithCombat();
|
InterruptQueueWithCombat();
|
||||||
else if (GameFunctions.GameStringEquals(_cantExecuteDueToStatusText, message.TextValue))
|
else if (GameFunctions.GameStringEquals(_cantExecuteDueToStatusText, message.TextValue) ||
|
||||||
|
GameFunctions.GameStringEquals(_eventCanceledText, message.TextValue))
|
||||||
InterruptWithoutCombat();
|
InterruptWithoutCombat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user