Use modified position when trying to fly in Camp Dragonhead
authorLiza Carvelli <liza@carvel.li>
Sun, 27 Oct 2024 15:58:43 +0000 (16:58 +0100)
committerLiza Carvelli <liza@carvel.li>
Sun, 27 Oct 2024 15:58:43 +0000 (16:58 +0100)
QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1128_Shadows Uncast (Maelstrom).json
QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1129_Shadows Uncast (Twin Adder).json
QuestPaths/2.x - A Realm Reborn/Unlocks/Dungeons/1130_Shadows Uncast (Immortal Flames).json
Questionable/Controller/MovementController.cs

index 69dff9a1267a6f45ef99ec2bcb70d770a15dce8a..8465af3996b6a3017f9438edd53ccb0ceedd9063 100644 (file)
@@ -29,7 +29,8 @@
           },
           "TerritoryId": 155,
           "InteractionType": "Interact",
-          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead"
+          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
+          "Fly": true
         }
       ]
     },
index bb2006b8510aa3fd2d9089bcf0c2dcba510d0359..ad46e4d61a6e6783316c567fb7875490e48ca471 100644 (file)
@@ -29,7 +29,8 @@
           },
           "TerritoryId": 155,
           "InteractionType": "Interact",
-          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead"
+          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
+          "Fly": true
         }
       ]
     },
index 76187f73ba7b375e3a88fe87fe7c18bbf3ba8bfd..0b0c67313718e9db8ab694d1d7bed8e2437e0815 100644 (file)
@@ -29,7 +29,8 @@
           },
           "TerritoryId": 155,
           "InteractionType": "Interact",
-          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead"
+          "AetheryteShortcut": "Coerthas Central Highlands - Camp Dragonhead",
+          "Fly": true
         }
       ]
     },
index bf10142fa68173db091a69ec6a4fe06e8f115b04..e41b8f04b8523bac715bccf24a7bd89ba0ee0cd3 100644 (file)
@@ -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<MovementController> _logger;
     private CancellationTokenSource? _cancellationTokenSource;
     private Task<List<Vector3>>? _pathfindTask;
 
     public MovementController(NavmeshIpc navmeshIpc, IClientState clientState, GameFunctions gameFunctions,
         ChatFunctions chatFunctions, ICondition condition, MovementOverrideController movementOverrideController,
-        ILogger<MovementController> logger)
+        AetheryteData aetheryteData, ILogger<MovementController> 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<Vector3> to, bool fly, bool sprint,