punish v6.8.18.0
This commit is contained in:
commit
cfb4dea47e
316 changed files with 554088 additions and 0 deletions
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Character;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed class LandExecutor(IClientState clientState, ICondition condition, ILogger<LandExecutor> logger) : TaskExecutor<LandTask>()
|
||||
{
|
||||
private bool _landing;
|
||||
|
||||
private DateTime _continueAt;
|
||||
|
||||
protected override bool Start()
|
||||
{
|
||||
if (!condition[ConditionFlag.InFlight])
|
||||
{
|
||||
logger.LogInformation("Not flying, not attempting to land");
|
||||
return false;
|
||||
}
|
||||
_landing = AttemptLanding();
|
||||
_continueAt = DateTime.Now.AddSeconds(0.25);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
if (DateTime.Now < _continueAt)
|
||||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
if (condition[ConditionFlag.InFlight])
|
||||
{
|
||||
if (!_landing)
|
||||
{
|
||||
_landing = AttemptLanding();
|
||||
_continueAt = DateTime.Now.AddSeconds(0.25);
|
||||
}
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
private unsafe bool AttemptLanding()
|
||||
{
|
||||
Character* ptr = (Character*)(clientState.LocalPlayer?.Address ?? 0);
|
||||
if (ptr != null && ActionManager.Instance()->GetActionStatus(ActionType.GeneralAction, 23u, 3758096384uL, checkRecastActive: true, checkCastingActive: true, null) == 0)
|
||||
{
|
||||
logger.LogInformation("Attempting to land");
|
||||
return ActionManager.Instance()->UseAction(ActionType.GeneralAction, 23u, 3758096384uL, 0u, ActionManager.UseActionMode.None, 0u, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed class LandTask : ITask
|
||||
{
|
||||
public bool ShouldRedoOnInterrupt()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "Land";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,291 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Plugin.Services;
|
||||
using LLib;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller.Steps.Common;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed class MoveExecutor : TaskExecutor<MoveTask>, IToastAware, ITaskExecutor
|
||||
{
|
||||
private readonly string _cannotExecuteAtThisTime;
|
||||
|
||||
private readonly MovementController _movementController;
|
||||
|
||||
private readonly GameFunctions _gameFunctions;
|
||||
|
||||
private readonly ILogger<MoveExecutor> _logger;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
|
||||
private readonly ICondition _condition;
|
||||
|
||||
private readonly Questionable.Controller.Steps.Common.Mount.MountEvaluator _mountEvaluator;
|
||||
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
private System.Action? _startAction;
|
||||
|
||||
private Vector3 _destination;
|
||||
|
||||
private bool _canRestart;
|
||||
|
||||
private (Questionable.Controller.Steps.Common.Mount.MountExecutor Executor, Questionable.Controller.Steps.Common.Mount.MountTask Task)? _mountBeforeMovement;
|
||||
|
||||
private (Questionable.Controller.Steps.Common.Mount.UnmountExecutor Executor, Questionable.Controller.Steps.Common.Mount.UnmountTask Task)? _unmountBeforeMovement;
|
||||
|
||||
private (Questionable.Controller.Steps.Common.Mount.MountExecutor Executor, Questionable.Controller.Steps.Common.Mount.MountTask Task)? _mountDuringMovement;
|
||||
|
||||
public MoveExecutor(MovementController movementController, GameFunctions gameFunctions, ILogger<MoveExecutor> logger, IClientState clientState, ICondition condition, IDataManager dataManager, Questionable.Controller.Steps.Common.Mount.MountEvaluator mountEvaluator, IServiceProvider serviceProvider)
|
||||
{
|
||||
_movementController = movementController;
|
||||
_gameFunctions = gameFunctions;
|
||||
_logger = logger;
|
||||
_clientState = clientState;
|
||||
_condition = condition;
|
||||
_serviceProvider = serviceProvider;
|
||||
_mountEvaluator = mountEvaluator;
|
||||
_cannotExecuteAtThisTime = dataManager.GetString(579u, (LogMessage x) => x.Text);
|
||||
}
|
||||
|
||||
private void PrepareMovementIfNeeded()
|
||||
{
|
||||
if (!_gameFunctions.IsFlyingUnlocked(base.Task.TerritoryId))
|
||||
{
|
||||
base.Task = base.Task with
|
||||
{
|
||||
Fly = false,
|
||||
Land = false
|
||||
};
|
||||
}
|
||||
if (!base.Task.DisableNavmesh)
|
||||
{
|
||||
_startAction = delegate
|
||||
{
|
||||
_movementController.NavigateTo(EMovementType.Quest, base.Task.DataId, _destination, base.Task.Fly, base.Task.Sprint ?? (!_mountDuringMovement.HasValue), base.Task.StopDistance, base.Task.IgnoreDistanceToObject ? new float?(float.MaxValue) : ((float?)null), base.Task.Land);
|
||||
};
|
||||
return;
|
||||
}
|
||||
_startAction = delegate
|
||||
{
|
||||
MovementController movementController = _movementController;
|
||||
uint? dataId = base.Task.DataId;
|
||||
int num = 1;
|
||||
List<Vector3> list = new List<Vector3>(num);
|
||||
CollectionsMarshal.SetCount(list, num);
|
||||
Span<Vector3> span = CollectionsMarshal.AsSpan(list);
|
||||
int index = 0;
|
||||
span[index] = _destination;
|
||||
movementController.NavigateTo(EMovementType.Quest, dataId, list, base.Task.Fly, base.Task.Sprint ?? (!_mountDuringMovement.HasValue), base.Task.StopDistance, base.Task.IgnoreDistanceToObject ? new float?(float.MaxValue) : ((float?)null), base.Task.Land);
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool Start()
|
||||
{
|
||||
_canRestart = base.Task.RestartNavigation;
|
||||
_destination = base.Task.Destination;
|
||||
float num = base.Task.StopDistance ?? 3f;
|
||||
Vector3? vector = _clientState.LocalPlayer?.Position;
|
||||
float num2 = ((!vector.HasValue) ? float.MaxValue : Vector3.Distance(vector.Value, _destination));
|
||||
if (num2 > num)
|
||||
{
|
||||
PrepareMovementIfNeeded();
|
||||
}
|
||||
if (base.Task.Mount == true)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.MountTask mountTask = new Questionable.Controller.Steps.Common.Mount.MountTask(base.Task.TerritoryId, Questionable.Controller.Steps.Common.Mount.EMountIf.Always);
|
||||
_mountBeforeMovement = (_serviceProvider.GetRequiredService<Questionable.Controller.Steps.Common.Mount.MountExecutor>(), mountTask);
|
||||
if (!_mountBeforeMovement.Value.Executor.Start(mountTask))
|
||||
{
|
||||
_mountBeforeMovement = null;
|
||||
}
|
||||
}
|
||||
else if (base.Task.Mount == false)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.UnmountTask unmountTask = new Questionable.Controller.Steps.Common.Mount.UnmountTask();
|
||||
_unmountBeforeMovement = (_serviceProvider.GetRequiredService<Questionable.Controller.Steps.Common.Mount.UnmountExecutor>(), unmountTask);
|
||||
if (!_unmountBeforeMovement.Value.Executor.Start(unmountTask))
|
||||
{
|
||||
_unmountBeforeMovement = null;
|
||||
}
|
||||
}
|
||||
else if (!base.Task.DisableNavmesh)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.EMountIf mountIf = ((!(num2 > num) || !base.Task.Fly || !_gameFunctions.IsFlyingUnlocked(base.Task.TerritoryId)) ? Questionable.Controller.Steps.Common.Mount.EMountIf.AwayFromPosition : Questionable.Controller.Steps.Common.Mount.EMountIf.Always);
|
||||
Questionable.Controller.Steps.Common.Mount.MountTask mountTask2 = new Questionable.Controller.Steps.Common.Mount.MountTask(base.Task.TerritoryId, mountIf, _destination);
|
||||
DateTime retryAt = DateTime.Now;
|
||||
(Questionable.Controller.Steps.Common.Mount.MountExecutor, Questionable.Controller.Steps.Common.Mount.MountTask)? tuple;
|
||||
if (_mountEvaluator.EvaluateMountState(mountTask2, dryRun: true, ref retryAt) != Questionable.Controller.Steps.Common.Mount.MountResult.DontMount)
|
||||
{
|
||||
tuple = (_serviceProvider.GetRequiredService<Questionable.Controller.Steps.Common.Mount.MountExecutor>(), mountTask2);
|
||||
tuple.Value.Item1.Start(mountTask2);
|
||||
}
|
||||
else
|
||||
{
|
||||
tuple = null;
|
||||
}
|
||||
if (base.Task.Fly)
|
||||
{
|
||||
_mountBeforeMovement = tuple;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mountDuringMovement = tuple;
|
||||
}
|
||||
}
|
||||
if (!_mountBeforeMovement.HasValue && !_unmountBeforeMovement.HasValue && _startAction != null)
|
||||
{
|
||||
_startAction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
ETaskResult? eTaskResult = UpdateMountState();
|
||||
if (eTaskResult.HasValue)
|
||||
{
|
||||
return eTaskResult.GetValueOrDefault();
|
||||
}
|
||||
if (_startAction == null)
|
||||
{
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
if (_movementController.IsPathfinding || _movementController.IsPathRunning)
|
||||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
DateTime movementStartedAt = _movementController.MovementStartedAt;
|
||||
if (movementStartedAt == DateTime.MaxValue || movementStartedAt.AddSeconds(2.0) >= DateTime.Now)
|
||||
{
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
if (_canRestart && Vector3.Distance(_clientState.LocalPlayer.Position, _destination) > (base.Task.StopDistance ?? 3f) + 5f)
|
||||
{
|
||||
_canRestart = false;
|
||||
if (_clientState.TerritoryType == base.Task.TerritoryId)
|
||||
{
|
||||
_logger.LogInformation("Looks like movement was interrupted, re-attempting to move");
|
||||
_startAction();
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
_logger.LogInformation("Looks like movement was interrupted, do nothing since we're in a different territory now");
|
||||
}
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
private ETaskResult? UpdateMountState()
|
||||
{
|
||||
(Questionable.Controller.Steps.Common.Mount.MountExecutor, Questionable.Controller.Steps.Common.Mount.MountTask)? mountBeforeMovement = _mountBeforeMovement;
|
||||
if (mountBeforeMovement.HasValue)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.MountExecutor item = mountBeforeMovement.GetValueOrDefault().Item1;
|
||||
if (item != null)
|
||||
{
|
||||
if (item.Update() == ETaskResult.TaskComplete)
|
||||
{
|
||||
_logger.LogInformation("MountBeforeMovement complete");
|
||||
_mountBeforeMovement = null;
|
||||
_startAction?.Invoke();
|
||||
return null;
|
||||
}
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
}
|
||||
(Questionable.Controller.Steps.Common.Mount.UnmountExecutor, Questionable.Controller.Steps.Common.Mount.UnmountTask)? unmountBeforeMovement = _unmountBeforeMovement;
|
||||
if (unmountBeforeMovement.HasValue)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.UnmountExecutor item2 = unmountBeforeMovement.GetValueOrDefault().Item1;
|
||||
if (item2 != null)
|
||||
{
|
||||
if (item2.Update() == ETaskResult.TaskComplete)
|
||||
{
|
||||
_logger.LogInformation("UnmountBeforeMovement complete");
|
||||
_unmountBeforeMovement = null;
|
||||
_startAction?.Invoke();
|
||||
return null;
|
||||
}
|
||||
return ETaskResult.StillRunning;
|
||||
}
|
||||
}
|
||||
mountBeforeMovement = _mountDuringMovement;
|
||||
if (mountBeforeMovement.HasValue)
|
||||
{
|
||||
(Questionable.Controller.Steps.Common.Mount.MountExecutor, Questionable.Controller.Steps.Common.Mount.MountTask) valueOrDefault = mountBeforeMovement.GetValueOrDefault();
|
||||
var (mountExecutor, _) = valueOrDefault;
|
||||
if (mountExecutor != null)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.MountTask item3 = valueOrDefault.Item2;
|
||||
if ((object)item3 != null)
|
||||
{
|
||||
if (mountExecutor.Update() == ETaskResult.TaskComplete)
|
||||
{
|
||||
_logger.LogInformation("MountDuringMovement complete (mounted)");
|
||||
_mountDuringMovement = null;
|
||||
return null;
|
||||
}
|
||||
DateTime retryAt = DateTime.Now;
|
||||
if (_mountEvaluator.EvaluateMountState(item3, dryRun: true, ref retryAt) == Questionable.Controller.Steps.Common.Mount.MountResult.DontMount)
|
||||
{
|
||||
_logger.LogInformation("MountDuringMovement implicitly complete (shouldn't mount anymore)");
|
||||
_mountDuringMovement = null;
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool WasInterrupted()
|
||||
{
|
||||
DateTime retryAt = DateTime.Now;
|
||||
if (base.Task.Fly && _condition[ConditionFlag.InCombat] && !_condition[ConditionFlag.Mounted])
|
||||
{
|
||||
(Questionable.Controller.Steps.Common.Mount.MountExecutor, Questionable.Controller.Steps.Common.Mount.MountTask)? mountBeforeMovement = _mountBeforeMovement;
|
||||
if (mountBeforeMovement.HasValue)
|
||||
{
|
||||
Questionable.Controller.Steps.Common.Mount.MountTask item = mountBeforeMovement.GetValueOrDefault().Item2;
|
||||
if ((object)item != null && _mountEvaluator.EvaluateMountState(item, dryRun: true, ref retryAt) == Questionable.Controller.Steps.Common.Mount.MountResult.WhenOutOfCombat)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return base.WasInterrupted();
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
if (!_mountBeforeMovement.HasValue)
|
||||
{
|
||||
return ShouldResolveCombatBeforeNextInteraction();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ShouldResolveCombatBeforeNextInteraction()
|
||||
{
|
||||
return base.Task.InteractionType == EInteractionType.Jump;
|
||||
}
|
||||
|
||||
public bool OnErrorToast(SeString message)
|
||||
{
|
||||
if (GameFunctions.GameStringEquals(_cannotExecuteAtThisTime, message.TextValue))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed record MoveTask(ushort TerritoryId, Vector3 Destination, bool? Mount = null, float? StopDistance = null, uint? DataId = null, bool DisableNavmesh = false, bool? Sprint = null, bool Fly = false, bool Land = false, bool IgnoreDistanceToObject = false, bool RestartNavigation = true, EInteractionType InteractionType = EInteractionType.None) : ITask
|
||||
{
|
||||
public MoveTask(QuestStep step, Vector3 destination)
|
||||
: this(step.TerritoryId, destination, step.Mount, step.CalculateActualStopDistance(), step.DataId, step.DisableNavmesh, step.Sprint, step.Fly == true, step.Land == true, step.IgnoreDistanceToObject == true, step.RestartNavigationIfCancelled != false, step.InteractionType)
|
||||
{
|
||||
}
|
||||
|
||||
public bool ShouldRedoOnInterrupt()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "MoveTo(" + Destination.ToString("G", CultureInfo.InvariantCulture) + ")";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Questionable.Controller.Steps.Common;
|
||||
using Questionable.Data;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Common;
|
||||
using Questionable.Model.Questing;
|
||||
|
||||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal static class MoveTo
|
||||
{
|
||||
internal sealed class Factory(IClientState clientState, AetheryteData aetheryteData, TerritoryData territoryData, ILogger<Factory> logger) : ITaskFactory
|
||||
{
|
||||
public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
|
||||
{
|
||||
if (step.Position.HasValue)
|
||||
{
|
||||
return CreateMoveTasks(step, step.Position.Value);
|
||||
}
|
||||
if (step != null && step.DataId.HasValue && step.StopDistance.HasValue)
|
||||
{
|
||||
return new global::_003C_003Ez__ReadOnlySingleElementList<ITask>(new WaitForNearDataId(step.DataId.Value, step.StopDistance.Value));
|
||||
}
|
||||
EAetheryteLocation valueOrDefault = default(EAetheryteLocation);
|
||||
bool flag;
|
||||
if (step != null)
|
||||
{
|
||||
EInteractionType interactionType = step.InteractionType;
|
||||
if ((uint)(interactionType - 4) <= 1u)
|
||||
{
|
||||
EAetheryteLocation? aetheryte = step.Aetheryte;
|
||||
if (aetheryte.HasValue)
|
||||
{
|
||||
valueOrDefault = aetheryte.GetValueOrDefault();
|
||||
flag = true;
|
||||
goto IL_00a3;
|
||||
}
|
||||
}
|
||||
}
|
||||
flag = false;
|
||||
goto IL_00a3;
|
||||
IL_00a3:
|
||||
if (flag)
|
||||
{
|
||||
return CreateMoveTasks(step, aetheryteData.Locations[valueOrDefault]);
|
||||
}
|
||||
if (step != null && step.InteractionType == EInteractionType.AttuneAethernetShard)
|
||||
{
|
||||
EAetheryteLocation? aetheryte = step.AethernetShard;
|
||||
if (aetheryte.HasValue)
|
||||
{
|
||||
EAetheryteLocation valueOrDefault2 = aetheryte.GetValueOrDefault();
|
||||
return CreateMoveTasks(step, aetheryteData.Locations[valueOrDefault2]);
|
||||
}
|
||||
}
|
||||
return Array.Empty<ITask>();
|
||||
}
|
||||
|
||||
private IEnumerable<ITask> CreateMoveTasks(QuestStep step, Vector3 destination)
|
||||
{
|
||||
if (step.InteractionType == EInteractionType.Jump && step.JumpDestination != null && (clientState.LocalPlayer.Position - step.JumpDestination.Position).Length() <= (step.JumpDestination.StopDistance ?? 1f))
|
||||
{
|
||||
logger.LogInformation("We're at the jump destination, skipping movement");
|
||||
yield break;
|
||||
}
|
||||
yield return new WaitCondition.Task(() => clientState.TerritoryType == step.TerritoryId, "Wait(territory: " + territoryData.GetNameAndId(step.TerritoryId) + ")");
|
||||
if (!step.DisableNavmesh)
|
||||
{
|
||||
yield return new WaitNavmesh.Task();
|
||||
}
|
||||
yield return new MoveTask(step, destination);
|
||||
if (step != null)
|
||||
{
|
||||
bool? fly = step.Fly;
|
||||
if (fly.HasValue && fly == true && (step.Land ?? false))
|
||||
{
|
||||
yield return new LandTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed record NoOpTask : ITask;
|
|
@ -0,0 +1,19 @@
|
|||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed class NoOpTaskExecutor : TaskExecutor<NoOpTask>
|
||||
{
|
||||
protected override bool Start()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed record WaitForNearDataId(uint DataId, float StopDistance) : ITask
|
||||
{
|
||||
public bool ShouldRedoOnInterrupt()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Questionable.Functions;
|
||||
|
||||
namespace Questionable.Controller.Steps.Movement;
|
||||
|
||||
internal sealed class WaitForNearDataIdExecutor(GameFunctions gameFunctions, IClientState clientState) : TaskExecutor<WaitForNearDataId>()
|
||||
{
|
||||
protected override bool Start()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ETaskResult Update()
|
||||
{
|
||||
IGameObject gameObject = gameFunctions.FindObjectByDataId(base.Task.DataId);
|
||||
if (gameObject == null || (gameObject.Position - clientState.LocalPlayer.Position).Length() > base.Task.StopDistance)
|
||||
{
|
||||
throw new TaskException("Object not found or too far away, no position so we can't move");
|
||||
}
|
||||
return ETaskResult.TaskComplete;
|
||||
}
|
||||
|
||||
public override bool ShouldInterruptOnDamage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue