master #3

Open
cacahuetes wants to merge 653 commits from liza/Questionable:master into cacahuetes-ShB-Healer
4 changed files with 21 additions and 5 deletions
Showing only changes of commit 2bd649af33 - Show all commits

View File

@ -29,7 +29,8 @@
}, },
"TerritoryId": 155, "TerritoryId": 155,
"InteractionType": "Interact", "InteractionType": "Interact",
"AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
"Fly": true
} }
] ]
}, },

View File

@ -29,7 +29,8 @@
}, },
"TerritoryId": 155, "TerritoryId": 155,
"InteractionType": "Interact", "InteractionType": "Interact",
"AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
"Fly": true
} }
] ]
}, },

View File

@ -29,7 +29,8 @@
}, },
"TerritoryId": 155, "TerritoryId": 155,
"InteractionType": "Interact", "InteractionType": "Interact",
"AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
"Fly": true
} }
] ]
}, },

View File

@ -16,6 +16,7 @@ using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.Control; using FFXIVClientStructs.FFXIV.Client.Game.Control;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Questionable.Controller.NavigationOverrides; using Questionable.Controller.NavigationOverrides;
using Questionable.Data;
using Questionable.External; using Questionable.External;
using Questionable.Functions; using Questionable.Functions;
using Questionable.Model; using Questionable.Model;
@ -36,13 +37,14 @@ internal sealed class MovementController : IDisposable
private readonly ChatFunctions _chatFunctions; private readonly ChatFunctions _chatFunctions;
private readonly ICondition _condition; private readonly ICondition _condition;
private readonly MovementOverrideController _movementOverrideController; private readonly MovementOverrideController _movementOverrideController;
private readonly AetheryteData _aetheryteData;
private readonly ILogger<MovementController> _logger; private readonly ILogger<MovementController> _logger;
private CancellationTokenSource? _cancellationTokenSource; private CancellationTokenSource? _cancellationTokenSource;
private Task<List<Vector3>>? _pathfindTask; private Task<List<Vector3>>? _pathfindTask;
public MovementController(NavmeshIpc navmeshIpc, IClientState clientState, GameFunctions gameFunctions, public MovementController(NavmeshIpc navmeshIpc, IClientState clientState, GameFunctions gameFunctions,
ChatFunctions chatFunctions, ICondition condition, MovementOverrideController movementOverrideController, ChatFunctions chatFunctions, ICondition condition, MovementOverrideController movementOverrideController,
ILogger<MovementController> logger) AetheryteData aetheryteData, ILogger<MovementController> logger)
{ {
_navmeshIpc = navmeshIpc; _navmeshIpc = navmeshIpc;
_clientState = clientState; _clientState = clientState;
@ -50,6 +52,7 @@ internal sealed class MovementController : IDisposable
_chatFunctions = chatFunctions; _chatFunctions = chatFunctions;
_condition = condition; _condition = condition;
_movementOverrideController = movementOverrideController; _movementOverrideController = movementOverrideController;
_aetheryteData = aetheryteData;
_logger = logger; _logger = logger;
} }
@ -305,8 +308,18 @@ internal sealed class MovementController : IDisposable
Destination.NavmeshCalculations++; Destination.NavmeshCalculations++;
_cancellationTokenSource = new(); _cancellationTokenSource = new();
_cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30)); _cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(30));
Vector3 startPosition = _clientState.LocalPlayer!.Position;
if (fly && _aetheryteData.CalculateDistance(startPosition, _clientState.TerritoryType,
EAetheryteLocation.CoerthasCentralHighlandsCampDragonhead) < 11f)
{
startPosition = startPosition with { Y = startPosition.Y + 1f };
_logger.LogInformation("Using modified start position for flying pathfinding: {StartPosition}",
startPosition.ToString("G", CultureInfo.InvariantCulture));
}
_pathfindTask = _pathfindTask =
_navmeshIpc.Pathfind(_clientState.LocalPlayer!.Position, to, fly, _cancellationTokenSource.Token); _navmeshIpc.Pathfind(startPosition, to, fly, _cancellationTokenSource.Token);
} }
public void NavigateTo(EMovementType type, uint? dataId, List<Vector3> to, bool fly, bool sprint, public void NavigateTo(EMovementType type, uint? dataId, List<Vector3> to, bool fly, bool sprint,