forked from aly/qstbak
muffin v7.4.19
This commit is contained in:
parent
f82b9ce2a2
commit
afafd5e377
9 changed files with 896 additions and 796 deletions
|
|
@ -9,6 +9,7 @@ using Questionable.Controller.Steps.Common;
|
|||
using Questionable.Controller.Steps.Interactions;
|
||||
using Questionable.Controller.Steps.Movement;
|
||||
using Questionable.Controller.Steps.Shared;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Controller;
|
||||
|
|
@ -17,6 +18,8 @@ internal sealed class SeasonalDutyController : MiniTaskController<SeasonalDutyCo
|
|||
{
|
||||
private readonly MovementController _movementController;
|
||||
|
||||
private readonly GameFunctions _gameFunctions;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
|
||||
private readonly ILogger<SeasonalDutyController> _logger;
|
||||
|
|
@ -49,10 +52,11 @@ internal sealed class SeasonalDutyController : MiniTaskController<SeasonalDutyCo
|
|||
}
|
||||
}
|
||||
|
||||
public SeasonalDutyController(IChatGui chatGui, ICondition condition, IServiceProvider serviceProvider, InterruptHandler interruptHandler, IDataManager dataManager, ILogger<SeasonalDutyController> logger, MovementController movementController, IClientState clientState)
|
||||
public SeasonalDutyController(IChatGui chatGui, ICondition condition, IServiceProvider serviceProvider, InterruptHandler interruptHandler, IDataManager dataManager, ILogger<SeasonalDutyController> logger, MovementController movementController, GameFunctions gameFunctions, IClientState clientState)
|
||||
: base(chatGui, condition, serviceProvider, interruptHandler, dataManager, logger)
|
||||
{
|
||||
_movementController = movementController;
|
||||
_gameFunctions = gameFunctions;
|
||||
_clientState = clientState;
|
||||
_logger = logger;
|
||||
}
|
||||
|
|
@ -89,26 +93,41 @@ internal sealed class SeasonalDutyController : MiniTaskController<SeasonalDutyCo
|
|||
|
||||
private void EnqueueDutyCycle()
|
||||
{
|
||||
if (_currentDuty != null)
|
||||
if (_currentDuty == null)
|
||||
{
|
||||
SeasonalDutyDefinition currentDuty = _currentDuty;
|
||||
_logger.LogInformation("Enqueuing seasonal duty cycle for {DutyName}", currentDuty.Name);
|
||||
if (_clientState.TerritoryType != currentDuty.TerritoryId && _clientState.TerritoryType != currentDuty.DutyTerritoryId)
|
||||
{
|
||||
_taskQueue.Enqueue(new AetheryteShortcut.Task(null, null, currentDuty.Aetheryte, currentDuty.TerritoryId));
|
||||
}
|
||||
if (currentDuty.AethernetShortcut != null)
|
||||
{
|
||||
_taskQueue.Enqueue(new AethernetShortcut.Task(currentDuty.AethernetShortcut.From, currentDuty.AethernetShortcut.To));
|
||||
}
|
||||
_taskQueue.Enqueue(new MoveTask(currentDuty.TerritoryId, currentDuty.NpcPosition, null, 3f));
|
||||
_taskQueue.Enqueue(new Mount.UnmountTask());
|
||||
_taskQueue.Enqueue(new Interact.Task(currentDuty.NpcDataId, null, EInteractionType.Interact, SkipMarkerCheck: true));
|
||||
_taskQueue.Enqueue(new WaitCondition.Task(() => _clientState.TerritoryType == _currentDuty.DutyTerritoryId, $"Wait(territory: {currentDuty.DutyTerritoryId})"));
|
||||
_taskQueue.Enqueue(new ClearObjectsWithAction.ClearTask(currentDuty.DataIds, currentDuty.Action, currentDuty.DutyTerritoryId, currentDuty.StopDistance, currentDuty.WaypointPositions));
|
||||
_taskQueue.Enqueue(new WaitCondition.Task(() => _clientState.TerritoryType != _currentDuty.DutyTerritoryId, "Wait(duty end)"));
|
||||
_taskQueue.Enqueue(new WaitAtEnd.WaitDelay(TimeSpan.FromSeconds(3L)));
|
||||
return;
|
||||
}
|
||||
SeasonalDutyDefinition duty = _currentDuty;
|
||||
_logger.LogInformation("Enqueuing seasonal duty cycle for {DutyName}", duty.Name);
|
||||
if (_clientState.TerritoryType != duty.DutyTerritoryId)
|
||||
{
|
||||
if (_clientState.TerritoryType != duty.TerritoryId)
|
||||
{
|
||||
_taskQueue.Enqueue(new AetheryteShortcut.Task(null, null, duty.Aetheryte, duty.TerritoryId));
|
||||
}
|
||||
if (duty.AethernetShortcut != null)
|
||||
{
|
||||
_taskQueue.Enqueue(new AethernetShortcut.Task(duty.AethernetShortcut.From, duty.AethernetShortcut.To));
|
||||
}
|
||||
_taskQueue.Enqueue(new MoveTask(duty.TerritoryId, duty.NpcPosition, null, 3f));
|
||||
_taskQueue.Enqueue(new Mount.UnmountTask());
|
||||
bool interacted = false;
|
||||
_taskQueue.Enqueue(new WaitCondition.Task(delegate
|
||||
{
|
||||
if (_clientState.TerritoryType == _currentDuty.DutyTerritoryId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!interacted)
|
||||
{
|
||||
interacted = _gameFunctions.InteractWith(duty.NpcDataId);
|
||||
}
|
||||
return false;
|
||||
}, $"InteractAndWait(territory: {duty.DutyTerritoryId})"));
|
||||
}
|
||||
_taskQueue.Enqueue(new ClearObjectsWithAction.ClearTask(duty.DataIds, duty.Action, duty.DutyTerritoryId, duty.StopDistance, duty.WaypointPositions));
|
||||
_taskQueue.Enqueue(new WaitCondition.Task(() => _clientState.TerritoryType != _currentDuty.DutyTerritoryId, "Wait(duty end)"));
|
||||
_taskQueue.Enqueue(new WaitAtEnd.WaitDelay(TimeSpan.FromSeconds(3L)));
|
||||
}
|
||||
|
||||
public override void Stop(string label)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue