From 2bd649af3358345d9d81b728ec643a5056626065 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sun, 27 Oct 2024 16:58:43 +0100 Subject: [PATCH] Use modified position when trying to fly in Camp Dragonhead --- .../1128_Shadows Uncast (Maelstrom).json | 3 ++- .../1129_Shadows Uncast (Twin Adder).json | 3 ++- .../1130_Shadows Uncast (Immortal Flames).json | 3 ++- Questionable/Controller/MovementController.cs | 17 +++++++++++++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1128_Shadows Uncast (Maelstrom).json b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1128_Shadows Uncast (Maelstrom).json index 69dff9a1..8465af39 100644 --- a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1128_Shadows Uncast (Maelstrom).json +++ b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1128_Shadows Uncast (Maelstrom).json @@ -29,7 +29,8 @@ }, "TerritoryId": 155, "InteractionType": "Interact", - "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" + "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead", + "Fly": true } ] }, diff --git a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1129_Shadows Uncast (Twin Adder).json b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1129_Shadows Uncast (Twin Adder).json index bb2006b8..ad46e4d6 100644 --- a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1129_Shadows Uncast (Twin Adder).json +++ b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1129_Shadows Uncast (Twin Adder).json @@ -29,7 +29,8 @@ }, "TerritoryId": 155, "InteractionType": "Interact", - "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" + "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead", + "Fly": true } ] }, diff --git a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1130_Shadows Uncast (Immortal Flames).json b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1130_Shadows Uncast (Immortal Flames).json index 76187f73..0b0c6731 100644 --- a/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1130_Shadows Uncast (Immortal Flames).json +++ b/QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1130_Shadows Uncast (Immortal Flames).json @@ -29,7 +29,8 @@ }, "TerritoryId": 155, "InteractionType": "Interact", - "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead" + "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead", + "Fly": true } ] }, diff --git a/Questionable/Controller/MovementController.cs b/Questionable/Controller/MovementController.cs index bf10142f..e41b8f04 100644 --- a/Questionable/Controller/MovementController.cs +++ b/Questionable/Controller/MovementController.cs @@ -16,6 +16,7 @@ using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.Control; using Microsoft.Extensions.Logging; using Questionable.Controller.NavigationOverrides; +using Questionable.Data; using Questionable.External; using Questionable.Functions; using Questionable.Model; @@ -36,13 +37,14 @@ internal sealed class MovementController : IDisposable private readonly ChatFunctions _chatFunctions; private readonly ICondition _condition; private readonly MovementOverrideController _movementOverrideController; + private readonly AetheryteData _aetheryteData; private readonly ILogger _logger; private CancellationTokenSource? _cancellationTokenSource; private Task>? _pathfindTask; public MovementController(NavmeshIpc navmeshIpc, IClientState clientState, GameFunctions gameFunctions, ChatFunctions chatFunctions, ICondition condition, MovementOverrideController movementOverrideController, - ILogger logger) + AetheryteData aetheryteData, ILogger logger) { _navmeshIpc = navmeshIpc; _clientState = clientState; @@ -50,6 +52,7 @@ internal sealed class MovementController : IDisposable _chatFunctions = chatFunctions; _condition = condition; _movementOverrideController = movementOverrideController; + _aetheryteData = aetheryteData; _logger = logger; } @@ -305,8 +308,18 @@ internal sealed class MovementController : IDisposable Destination.NavmeshCalculations++; _cancellationTokenSource = new(); _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 = - _navmeshIpc.Pathfind(_clientState.LocalPlayer!.Position, to, fly, _cancellationTokenSource.Token); + _navmeshIpc.Pathfind(startPosition, to, fly, _cancellationTokenSource.Token); } public void NavigateTo(EMovementType type, uint? dataId, List to, bool fly, bool sprint,