From 28d297ec7c1688465696ba06efc2966e83bb779e Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 3 Jul 2024 21:00:04 +0200 Subject: [PATCH] API 10; DT aetheryte/aethernet data --- LLib | 2 +- QuestPaths/quest-v1.json | 45 +++++++++++++++-- .../Converter/AethernetShortcutConverter.cs | 24 +++++++++ .../V1/Converter/AetheryteConverter.cs | 22 +++++++- Questionable.Model/V1/EAetheryteLocation.cs | 44 +++++++++++++++- Questionable/ChatFunctions.cs | 6 +-- Questionable/Controller/MovementController.cs | 37 ++++++++++++-- Questionable/Controller/QuestRegistry.cs | 4 +- .../Controller/Steps/BaseFactory/Move.cs | 2 +- .../Steps/InteractionFactory/EquipItem.cs | 8 +-- .../Steps/InteractionFactory/Interact.cs | 6 +-- Questionable/DalamudInitializer.cs | 4 +- Questionable/Data/AetheryteData.cs | 37 +++++++++++++- Questionable/External/LifestreamIpc.cs | 2 +- Questionable/External/NavmeshIpc.cs | 2 +- Questionable/External/YesAlreadyIpc.cs | 4 +- Questionable/GameFunctions.cs | 46 ++++++++--------- Questionable/Questionable.csproj | 50 ++----------------- Questionable/QuestionablePlugin.cs | 3 +- Questionable/Windows/ConfigWindow.cs | 4 +- Questionable/Windows/QuestWindow.cs | 4 +- 21 files changed, 248 insertions(+), 108 deletions(-) diff --git a/LLib b/LLib index b5125d4b3..93fac6efb 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7 +Subproject commit 93fac6efb01a1272192d929fd863328271512ea4 diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index f5de559ec..847be22f0 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -223,7 +223,25 @@ "Elpis - Poieten Oikos", "Ultima Thule - Reah Tahra", "Ultima Thule - Abode of the Ea", - "Ultima Thule - Base Omicron" + "Ultima Thule - Base Omicron", + "Tuliyollal", + "Solution Nine", + "Urqopacha - Wachunpelo", + "Urqopacha - Worlar's Echo", + "Kozama'uka - Ok'hanu", + "Kozama'uka - Many Fires", + "Kozama'uka - Earthenshire", + "Yak T'el - Iq Br'aax", + "Yak T'el - Mamook", + "Shaaloani - Hhusatahwi", + "Shaaloani - Sheshenewezi Springs", + "Shaaloani - Mehwahhetsoan", + "Heritage Found - Yyasulani Station", + "Heritage Found - The Outskirts", + "Heritage Found - Electrope Strike", + "Living Memory - Leynode Mnemo", + "Living Memory - Leynode Pyro", + "Living Memory - Leynode Aero" ] }, "AethernetShortcut": { @@ -331,7 +349,29 @@ "[Radz-at-Han] Mehryde's Meyhane", "[Radz-at-Han] Kama", "[Radz-at-Han] The High Crucible of Al-Kimiya", - "[Radz-at-Han] The Gate of First Sight (Thavnair)" + "[Radz-at-Han] The Gate of First Sight (Thavnair)", + "[Tuliyollal] Aetheryte Plaza", + "[Tuliyollal] Dirigible Landing", + "[Tuliyollal] The Resplendent Quarter", + "[Tuliyollal] The For'ard Cabins", + "[Tuliyollal] Bayside Bevy Marketplace", + "[Tuliyollal] Vollok Shoonsa", + "[Tuliyollal] Wachumeqimeqi", + "[Tuliyollal] Brightploom Post", + "[Tuliyollal] Arch of the Dawn (Urqopacha)", + "[Tuliyollal] Arch of the Dawn (Kozama'uka)", + "[Tuliyollal] Ihuykatumu (Kozama'uka)", + "[Tuliyollal] Dirigible Landing (Yak T'el)", + "[Tuliyollal] Xak Tural Skygate (Shaaloani)", + "[Solution Nine] Aetheryte Plaza", + "[Solution Nine] Information Center", + "[Solution Nine] True Vue", + "[Solution Nine] Neon Stein", + "[Solution Nine] The Arcadion", + "[Solution Nine] Resolution", + "[Solution Nine] Nexus Arcade", + "[Solution Nine] Residential Sector", + "[Solution Nine] Scanning Port Nine (Heritage Found)" ] } }, @@ -345,7 +385,6 @@ }, "SkipIf": { "type": "array", - "description": "TODO Not implemented", "items": { "type": "string", "enum": [ diff --git a/Questionable.Model/V1/Converter/AethernetShortcutConverter.cs b/Questionable.Model/V1/Converter/AethernetShortcutConverter.cs index 76a06550a..d85f7479b 100644 --- a/Questionable.Model/V1/Converter/AethernetShortcutConverter.cs +++ b/Questionable.Model/V1/Converter/AethernetShortcutConverter.cs @@ -118,6 +118,30 @@ public sealed class AethernetShortcutConverter : JsonConverter StringToEnum = diff --git a/Questionable.Model/V1/Converter/AetheryteConverter.cs b/Questionable.Model/V1/Converter/AetheryteConverter.cs index 80b92f7d3..ab0dd549d 100644 --- a/Questionable.Model/V1/Converter/AetheryteConverter.cs +++ b/Questionable.Model/V1/Converter/AetheryteConverter.cs @@ -7,7 +7,6 @@ public sealed class AetheryteConverter() : EnumConverter(Val private static readonly Dictionary Values = new() { { EAetheryteLocation.Gridania, "Gridania" }, - { EAetheryteLocation.CentralShroudBentbranchMeadows, "Central Shroud - Bentbranch Meadows" }, { EAetheryteLocation.EastShroudHawthorneHut, "East Shroud - Hawthorne Hut" }, { EAetheryteLocation.SouthShroudQuarrymill, "South Shroud - Quarrymill" }, @@ -101,7 +100,26 @@ public sealed class AetheryteConverter() : EnumConverter(Val { EAetheryteLocation.ElpisPoietenOikos, "Elpis - Poieten Oikos" }, { EAetheryteLocation.UltimaThuleReahTahra, "Ultima Thule - Reah Tahra" }, { EAetheryteLocation.UltimaThuleAbodeOfTheEa, "Ultima Thule - Abode of the Ea" }, - { EAetheryteLocation.UltimaThuleBaseOmicron, "Ultima Thule - Base Omicron" } + { EAetheryteLocation.UltimaThuleBaseOmicron, "Ultima Thule - Base Omicron" }, + + { EAetheryteLocation.Tuliyollal, "Tuliyollal" }, + { EAetheryteLocation.SolutionNine, "Solution Nine" }, + { EAetheryteLocation.UrqopachaWachunpelo, "Urqopacha - Wachunpelo" }, + { EAetheryteLocation.UrqopachaWorlarsEcho, "Urqopacha - Worlar's Echo" }, + { EAetheryteLocation.KozamaukaOkHanu, "Kozama'uka - Ok'hanu" }, + { EAetheryteLocation.KozamaukaManyFires, "Kozama'uka - Many Fires" }, + { EAetheryteLocation.KozamaukaEarthenshire, "Kozama'uka - Earthenshire" }, + { EAetheryteLocation.YakTelIqBraax, "Yak T'el - Iq Br'aax" }, + { EAetheryteLocation.YakTelMamook, "Yak T'el - Mamook" }, + { EAetheryteLocation.ShaaloaniHhusatahwi, "Shaaloani - Hhusatahwi" }, + { EAetheryteLocation.ShaaloaniShesheneweziSprings, "Shaaloani - Sheshenewezi Springs" }, + { EAetheryteLocation.ShaaloaniMehwahhetsoan, "Shaaloani - Mehwahhetsoan" }, + { EAetheryteLocation.HeritageFoundYyasulaniStation, "Heritage Found - Yyasulani Station" }, + { EAetheryteLocation.HeritageFoundTheOutskirts, "Heritage Found - The Outskirts" }, + { EAetheryteLocation.HeritageFoundElectropeStrike, "Heritage Found - Electrope Strike" }, + { EAetheryteLocation.LivingMemoryLeynodeMnemo, "Living Memory - Leynode Mnemo" }, + { EAetheryteLocation.LivingMemoryLeynodePyro, "Living Memory - Leynode Pyro" }, + { EAetheryteLocation.LivingMemoryLeynodeAero, "Living Memory - Leynode Aero" }, }; public static bool IsLargeAetheryte(EAetheryteLocation aetheryte) => Values.ContainsKey(aetheryte); diff --git a/Questionable.Model/V1/EAetheryteLocation.cs b/Questionable.Model/V1/EAetheryteLocation.cs index a49a471e9..dc51f5752 100644 --- a/Questionable.Model/V1/EAetheryteLocation.cs +++ b/Questionable.Model/V1/EAetheryteLocation.cs @@ -205,5 +205,47 @@ public enum EAetheryteLocation ElpisPoietenOikos = 178, UltimaThuleReahTahra = 179, UltimaThuleAbodeOfTheEa = 180, - UltimaThuleBaseOmicron = 181 + UltimaThuleBaseOmicron = 181, + + Tuliyollal = 216, + + TuliyollalDirigibleLanding = 218, + TuliyollalTheResplendentQuarter = 219, + TuliyollalTheForardCabins = 220, + TuliyollalBaysideBevyMarketplace = 221, + TuliyollalVollokShoonsa = 222, + TuliyollalWachumeqimeqi = 223, + TuliyollalBrightploomPost = 224, + TuliyollalArchOfTheDawnUrqopacha = 225, + TuliyollalArchOfTheDawnKozamauka = 226, + TuliyollalIhuykatumu = 227, + TuliyollalDirigibleLandingYakTel = 228, + TuliyollalXakTuralSkygate = 229, + + SolutionNine = 217, + SolutionNineInformationCenter = 230, + SolutionNineTrueVue = 231, + SolutionNineNeonStein = 232, + SolutionNineTheArcadion = 233, + SolutionNineResolution = 234, + SolutionNineNexusArcade = 235, + SolutionNineResidentialSector = 236, + SolutionNineScanningPortNine = 237, + + UrqopachaWachunpelo = 200, + UrqopachaWorlarsEcho = 201, + KozamaukaOkHanu = 202, + KozamaukaManyFires = 203, + KozamaukaEarthenshire = 204, + YakTelIqBraax = 205, + YakTelMamook = 206, + ShaaloaniHhusatahwi = 207, + ShaaloaniShesheneweziSprings = 208, + ShaaloaniMehwahhetsoan = 209, + HeritageFoundYyasulaniStation = 210, + HeritageFoundTheOutskirts = 211, + HeritageFoundElectropeStrike = 212, + LivingMemoryLeynodeMnemo = 213, + LivingMemoryLeynodePyro = 214, + LivingMemoryLeynodeAero = 215, } diff --git a/Questionable/ChatFunctions.cs b/Questionable/ChatFunctions.cs index 5d7abf3f6..26ca9a223 100644 --- a/Questionable/ChatFunctions.cs +++ b/Questionable/ChatFunctions.cs @@ -65,7 +65,7 @@ internal sealed unsafe class ChatFunctions /// If the signature for this function could not be found private void SendMessageUnsafe(byte[] message) { - var uiModule = (IntPtr)Framework.Instance()->GetUiModule(); + var uiModule = (IntPtr)Framework.Instance()->GetUIModule(); using var payload = new ChatPayload(message); var mem1 = Marshal.AllocHGlobal(400); @@ -141,7 +141,7 @@ internal sealed unsafe class ChatFunctions public void UseEmote(uint dataId, EEmote emote) { - GameObject? gameObject = _gameFunctions.FindObjectByDataId(dataId); + IGameObject? gameObject = _gameFunctions.FindObjectByDataId(dataId); if (gameObject != null) { _targetManager.Target = gameObject; @@ -157,7 +157,7 @@ internal sealed unsafe class ChatFunctions private static class Signatures { internal const string SendChat = "48 89 5C 24 ?? 57 48 83 EC 20 48 8B FA 48 8B D9 45 84 C9"; - internal const string SanitiseString = "E8 ?? ?? ?? ?? EB 0A 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8D 8D"; + internal const string SanitiseString = "E8 ?? ?? ?? ?? 48 8D 4C 24 ?? 0F B6 F0 E8 ?? ?? ?? ?? 48 8D 4D C0"; } [StructLayout(LayoutKind.Explicit)] diff --git a/Questionable/Controller/MovementController.cs b/Questionable/Controller/MovementController.cs index dc9ce459b..b87afa622 100644 --- a/Questionable/Controller/MovementController.cs +++ b/Questionable/Controller/MovementController.cs @@ -9,6 +9,7 @@ using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects.Enums; using Dalamud.Game.ClientState.Objects.SubKinds; using Dalamud.Game.ClientState.Objects.Types; +using Dalamud.Plugin.Ipc.Exceptions; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.Game; using FFXIVClientStructs.FFXIV.Client.Game.Control; @@ -43,8 +44,36 @@ internal sealed class MovementController : IDisposable _logger = logger; } - public bool IsNavmeshReady => _navmeshIpc.IsReady; - public bool IsPathRunning => _navmeshIpc.IsPathRunning; + public bool IsNavmeshReady + { + get + { + try + { + return _navmeshIpc.IsReady; + } + catch (IpcNotReadyError) + { + return false; + } + } + } + + public bool IsPathRunning + { + get + { + try + { + return _navmeshIpc.IsPathRunning; + } + catch (IpcNotReadyError) + { + return false; + } + } + } + public bool IsPathfinding => _pathfindTask is { IsCompleted: false }; public DestinationData? Destination { get; set; } public DateTime MovementStartedAt { get; private set; } = DateTime.MaxValue; @@ -121,8 +150,8 @@ internal sealed class MovementController : IDisposable } else if (Destination.DataId != null) { - GameObject? gameObject = _gameFunctions.FindObjectByDataId(Destination.DataId.Value); - if (gameObject is Character or EventObj) + IGameObject? gameObject = _gameFunctions.FindObjectByDataId(Destination.DataId.Value); + if (gameObject is ICharacter or IEventObj) { if (Math.Abs(localPlayerPosition.Y - gameObject.Position.Y) < 1.95f) Stop(); diff --git a/Questionable/Controller/QuestRegistry.cs b/Questionable/Controller/QuestRegistry.cs index 9c919258c..501e44d6c 100644 --- a/Questionable/Controller/QuestRegistry.cs +++ b/Questionable/Controller/QuestRegistry.cs @@ -14,13 +14,13 @@ namespace Questionable.Controller; internal sealed class QuestRegistry { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IDataManager _dataManager; private readonly ILogger _logger; private readonly Dictionary _quests = new(); - public QuestRegistry(DalamudPluginInterface pluginInterface, IDataManager dataManager, + public QuestRegistry(IDalamudPluginInterface pluginInterface, IDataManager dataManager, ILogger logger) { _pluginInterface = pluginInterface; diff --git a/Questionable/Controller/Steps/BaseFactory/Move.cs b/Questionable/Controller/Steps/BaseFactory/Move.cs index 4cd51559d..8388df8f8 100644 --- a/Questionable/Controller/Steps/BaseFactory/Move.cs +++ b/Questionable/Controller/Steps/BaseFactory/Move.cs @@ -161,7 +161,7 @@ internal static class Move public ETaskResult Update() { - GameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); + IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); if (gameObject == null || (gameObject.Position - clientState.LocalPlayer!.Position).Length() > StopDistance) { diff --git a/Questionable/Controller/Steps/InteractionFactory/EquipItem.cs b/Questionable/Controller/Steps/InteractionFactory/EquipItem.cs index 865c171fe..22e339eb7 100644 --- a/Questionable/Controller/Steps/InteractionFactory/EquipItem.cs +++ b/Questionable/Controller/Steps/InteractionFactory/EquipItem.cs @@ -82,7 +82,7 @@ internal static class EquipItem return ETaskResult.StillRunning; if (_targetSlots.Any(x => - inventoryManager->GetInventorySlot(InventoryType.EquippedItems, x)->ItemID == _itemId)) + inventoryManager->GetInventorySlot(InventoryType.EquippedItems, x)->ItemId == _itemId)) return ETaskResult.TaskComplete; Equip(); @@ -100,7 +100,7 @@ internal static class EquipItem if (equippedContainer == null) return false; - if (_targetSlots.Any(slot => equippedContainer->GetInventorySlot(slot)->ItemID == _itemId)) + if (_targetSlots.Any(slot => equippedContainer->GetInventorySlot(slot)->ItemId == _itemId)) { logger.LogInformation("Already equipped {Item}, skipping step", _item.Name?.ToString()); return false; @@ -119,12 +119,12 @@ internal static class EquipItem for (ushort sourceSlot = 0; sourceSlot < sourceContainer->Size; sourceSlot++) { var sourceItem = sourceContainer->GetInventorySlot(sourceSlot); - if (sourceItem == null || sourceItem->ItemID != _itemId) + if (sourceItem == null || sourceItem->ItemId != _itemId) continue; // Move the item to the first available slot ushort targetSlot = _targetSlots - .Where(x => inventoryManager->GetInventorySlot(InventoryType.EquippedItems, x)->ItemID == 0) + .Where(x => inventoryManager->GetInventorySlot(InventoryType.EquippedItems, x)->ItemId == 0) .Concat(_targetSlots).First(); logger.LogInformation( diff --git a/Questionable/Controller/Steps/InteractionFactory/Interact.cs b/Questionable/Controller/Steps/InteractionFactory/Interact.cs index de6701c13..ea55513e6 100644 --- a/Questionable/Controller/Steps/InteractionFactory/Interact.cs +++ b/Questionable/Controller/Steps/InteractionFactory/Interact.cs @@ -59,7 +59,7 @@ internal static class Interact public bool Start() { - GameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); + IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); if (gameObject == null) { logger.LogWarning("No game object with dataId {DataId}", DataId); @@ -104,7 +104,7 @@ internal static class Interact if (!_interacted) { - GameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); + IGameObject? gameObject = gameFunctions.FindObjectByDataId(DataId); if (gameObject == null || !gameObject.IsTargetable || !HasAnyMarker(gameObject)) return ETaskResult.StillRunning; @@ -116,7 +116,7 @@ internal static class Interact return ETaskResult.TaskComplete; } - private unsafe bool HasAnyMarker(GameObject gameObject) + private unsafe bool HasAnyMarker(IGameObject gameObject) { if (SkipMarkerCheck || gameObject.ObjectKind != ObjectKind.EventNpc) return true; diff --git a/Questionable/DalamudInitializer.cs b/Questionable/DalamudInitializer.cs index 509bae55c..996aa8864 100644 --- a/Questionable/DalamudInitializer.cs +++ b/Questionable/DalamudInitializer.cs @@ -10,7 +10,7 @@ namespace Questionable; internal sealed class DalamudInitializer : IDisposable { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IFramework _framework; private readonly ICommandManager _commandManager; private readonly QuestController _questController; @@ -20,7 +20,7 @@ internal sealed class DalamudInitializer : IDisposable private readonly QuestWindow _questWindow; private readonly ConfigWindow _configWindow; - public DalamudInitializer(DalamudPluginInterface pluginInterface, IFramework framework, + public DalamudInitializer(IDalamudPluginInterface pluginInterface, IFramework framework, ICommandManager commandManager, QuestController questController, MovementController movementController, GameUiController gameUiController, NavigationShortcutController navigationShortcutController, WindowSystem windowSystem, QuestWindow questWindow, DebugOverlay debugOverlay, ConfigWindow configWindow) diff --git a/Questionable/Data/AetheryteData.cs b/Questionable/Data/AetheryteData.cs index cebbd2839..e69adc4a3 100644 --- a/Questionable/Data/AetheryteData.cs +++ b/Questionable/Data/AetheryteData.cs @@ -28,7 +28,7 @@ internal sealed class AetheryteData TerritoryIds = territoryIds.AsReadOnly(); TownTerritoryIds = dataManager.GetExcelSheet()! - .Where(x => x.RowId > 0 && !string.IsNullOrEmpty(x.Name) && x.TerritoryIntendedUse == 0) + .Where(x => x.RowId > 0 && !string.IsNullOrEmpty(x.Name) && x.TerritoryIntendedUse.Row == 0) .Select(x => (ushort)x.RowId) .ToList(); } @@ -214,6 +214,41 @@ internal sealed class AetheryteData { EAetheryteLocation.UltimaThuleReahTahra, new(-544.152f, 74.32666f, 269.6421f) }, { EAetheryteLocation.UltimaThuleAbodeOfTheEa, new(64.286255f, 272.48022f, -657.49603f) }, { EAetheryteLocation.UltimaThuleBaseOmicron, new(489.2804f, 437.5829f, 333.63843f) }, + + { EAetheryteLocation.Tuliyollal, new(-24.093994f, 0.77819824f, 7.583679f) }, + { EAetheryteLocation.TuliyollalDirigibleLanding, new(-413.68738f, 2.9754639f, -45.975464f) }, + { EAetheryteLocation.TuliyollalTheResplendentQuarter, new(-187.1214f, 39.93274f, 6.088318f) }, + { EAetheryteLocation.TuliyollalTheForardCabins, new(-149.73682f, -15.030151f, 198.90125f) }, + { EAetheryteLocation.TuliyollalBaysideBevyMarketplace, new(-14.999634f, -10.025269f, 135.57642f) }, + { EAetheryteLocation.TuliyollalVollokShoonsa, new(-99.13794f, 100.72473f, -222.03406f) }, + { EAetheryteLocation.TuliyollalWachumeqimeqi, new(166.27747f, -17.990417f, 38.742676f) }, + { EAetheryteLocation.TuliyollalBrightploomPost, new(71.7937f, 47.074097f, -333.21124f) }, + + { EAetheryteLocation.SolutionNine, new(-0.015319824f, 8.987488f, -0.015319824f) }, + { EAetheryteLocation.SolutionNineInformationCenter, new(-30.441833f, -6.0579224f, 209.3385f) }, + { EAetheryteLocation.SolutionNineTrueVue, new(382.6809f, 59.983154f, 76.67651f) }, + { EAetheryteLocation.SolutionNineNeonStein, new(258.28943f, 50.736206f, 148.72961f) }, + { EAetheryteLocation.SolutionNineTheArcadion, new(374.77686f, 60.01367f, 325.67322f) }, + { EAetheryteLocation.SolutionNineResolution, new(-32.059265f, 38.04065f, -345.2354f) }, + { EAetheryteLocation.SolutionNineNexusArcade, new(-160.05188f, -0.015319824f, 21.591492f) }, + { EAetheryteLocation.SolutionNineResidentialSector, new(-378.13385f, 13.992493f, 136.49194f) }, + + { EAetheryteLocation.UrqopachaWachunpelo, new(332.96704f, -160.11298f, -416.22034f) }, + { EAetheryteLocation.UrqopachaWorlarsEcho, new(465.62903f, 114.94617f, 634.9126f) }, + { EAetheryteLocation.KozamaukaOkHanu, new(-169.51251f, 6.576599f, -479.42322f) }, + { EAetheryteLocation.KozamaukaManyFires, new(541.16125f, 117.41809f, 203.60107f) }, + { EAetheryteLocation.KozamaukaEarthenshire, new(-477.53113f, 124.04053f, 311.32983f) }, + { EAetheryteLocation.YakTelIqBraax, new(-397.05505f, 23.5141f, -431.93713f) }, + { EAetheryteLocation.YakTelMamook, new(721.40076f, -132.31104f, 526.1769f) }, + { EAetheryteLocation.ShaaloaniHhusatahwi, new(386.40417f, -0.19836426f, 467.61267f) }, + { EAetheryteLocation.ShaaloaniShesheneweziSprings, new(-291.70673f, 19.08899f, -114.54956f) }, + { EAetheryteLocation.ShaaloaniMehwahhetsoan, new(311.36023f, -14.175659f, -567.74243f) }, + { EAetheryteLocation.HeritageFoundYyasulaniStation, new(514.6105f, 145.86096f, 207.56836f) }, + { EAetheryteLocation.HeritageFoundTheOutskirts, new(-223.0412f, 31.937134f, -584.03906f) }, + { EAetheryteLocation.HeritageFoundElectropeStrike, new(-219.53156f, 32.913696f, 120.77515f) }, + { EAetheryteLocation.LivingMemoryLeynodeMnemo, new(-0.22894287f, 57.175537f, 796.9634f) }, + { EAetheryteLocation.LivingMemoryLeynodePyro, new(657.98413f, 28.976807f, -284.01617f) }, + { EAetheryteLocation.LivingMemoryLeynodeAero, new(-255.26825f, 59.433838f, -397.6654f) }, } .AsReadOnly(); diff --git a/Questionable/External/LifestreamIpc.cs b/Questionable/External/LifestreamIpc.cs index 2ba2a35b9..deab3a247 100644 --- a/Questionable/External/LifestreamIpc.cs +++ b/Questionable/External/LifestreamIpc.cs @@ -10,7 +10,7 @@ internal sealed class LifestreamIpc private readonly AetheryteData _aetheryteData; private readonly ICallGateSubscriber _aethernetTeleport; - public LifestreamIpc(DalamudPluginInterface pluginInterface, AetheryteData aetheryteData) + public LifestreamIpc(IDalamudPluginInterface pluginInterface, AetheryteData aetheryteData) { _aetheryteData = aetheryteData; _aethernetTeleport = pluginInterface.GetIpcSubscriber("Lifestream.AethernetTeleport"); diff --git a/Questionable/External/NavmeshIpc.cs b/Questionable/External/NavmeshIpc.cs index cc7bbdd46..eb8c5b31a 100644 --- a/Questionable/External/NavmeshIpc.cs +++ b/Questionable/External/NavmeshIpc.cs @@ -20,7 +20,7 @@ internal sealed class NavmeshIpc private readonly ICallGateSubscriber _pathSetTolerance; private readonly ICallGateSubscriber _queryPointOnFloor; - public NavmeshIpc(DalamudPluginInterface pluginInterface) + public NavmeshIpc(IDalamudPluginInterface pluginInterface) { _isNavReady = pluginInterface.GetIpcSubscriber("vnavmesh.Nav.IsReady"); _navPathfind = diff --git a/Questionable/External/YesAlreadyIpc.cs b/Questionable/External/YesAlreadyIpc.cs index a9d20c03e..820e0e954 100644 --- a/Questionable/External/YesAlreadyIpc.cs +++ b/Questionable/External/YesAlreadyIpc.cs @@ -7,10 +7,10 @@ namespace Questionable.External; internal sealed class YesAlreadyIpc : IDisposable { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly IPluginLog _pluginLog; - public YesAlreadyIpc(DalamudPluginInterface pluginInterface, IPluginLog pluginLog) + public YesAlreadyIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog) { _pluginInterface = pluginInterface; _pluginLog = pluginLog; diff --git a/Questionable/GameFunctions.cs b/Questionable/GameFunctions.cs index a1e974924..e1777259d 100644 --- a/Questionable/GameFunctions.cs +++ b/Questionable/GameFunctions.cs @@ -6,6 +6,7 @@ using System.Numerics; using Dalamud.Game; using Dalamud.Game.ClientState.Conditions; using Dalamud.Game.ClientState.Objects; +using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Memory; using Dalamud.Plugin.Services; using Dalamud.Utility; @@ -25,8 +26,6 @@ using Questionable.Model.V1; using BattleChara = FFXIVClientStructs.FFXIV.Client.Game.Character.BattleChara; using ContentFinderCondition = Lumina.Excel.GeneratedSheets.ContentFinderCondition; using ContentTalk = Lumina.Excel.GeneratedSheets.ContentTalk; -using Emote = Lumina.Excel.GeneratedSheets.Emote; -using GameObject = Dalamud.Game.ClientState.Objects.Types.GameObject; using GrandCompany = FFXIVClientStructs.FFXIV.Client.UI.Agent.GrandCompany; using Quest = Questionable.Model.Quest; using TerritoryType = Lumina.Excel.GeneratedSheets.TerritoryType; @@ -140,17 +139,17 @@ internal sealed unsafe class GameFunctions // do the MSQ; if a side quest is the first item do that side quest. // // If no quests are marked as 'priority', accepting a new quest adds it to the top of the list. - for (int i = questManager->TrackedQuestsSpan.Length - 1; i >= 0; --i) + for (int i = questManager->TrackedQuests.Length - 1; i >= 0; --i) { ushort currentQuest; - var trackedQuest = questManager->TrackedQuestsSpan[i]; + var trackedQuest = questManager->TrackedQuests[i]; switch (trackedQuest.QuestType) { default: continue; case 1: // normal quest - currentQuest = questManager->NormalQuestsSpan[trackedQuest.Index].QuestId; + currentQuest = questManager->NormalQuests[trackedQuest.Index].QuestId; break; } @@ -284,7 +283,7 @@ internal sealed unsafe class GameFunctions playerState->IsAetherCurrentUnlocked(aetherCurrentId); } - public GameObject? FindObjectByDataId(uint dataId) + public IGameObject? FindObjectByDataId(uint dataId) { foreach (var gameObject in _objectTable) { @@ -300,15 +299,14 @@ internal sealed unsafe class GameFunctions public bool InteractWith(uint dataId) { - GameObject? gameObject = FindObjectByDataId(dataId); + IGameObject? gameObject = FindObjectByDataId(dataId); if (gameObject != null) { - _logger.LogInformation("Setting target with {DataId} to {ObjectId}", dataId, gameObject.ObjectId); + _logger.LogInformation("Setting target with {DataId} to {ObjectId}", dataId, gameObject.EntityId); _targetManager.Target = null; _targetManager.Target = gameObject; - long result = (long)TargetSystem.Instance()->InteractWithObject( - (FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject*)gameObject.Address, false); + long result = (long)TargetSystem.Instance()->InteractWithObject((GameObject*)gameObject.Address, false); _logger.LogInformation("Interact result: {Result}", result); return result > 0; @@ -328,7 +326,7 @@ internal sealed unsafe class GameFunctions public bool UseItem(uint dataId, uint itemId) { - GameObject? gameObject = FindObjectByDataId(dataId); + IGameObject? gameObject = FindObjectByDataId(dataId); if (gameObject != null) { _targetManager.Target = gameObject; @@ -343,10 +341,10 @@ internal sealed unsafe class GameFunctions public bool UseItemOnGround(uint dataId, uint itemId) { - GameObject? gameObject = FindObjectByDataId(dataId); + IGameObject? gameObject = FindObjectByDataId(dataId); if (gameObject != null) { - var position = (FFXIVClientStructs.FFXIV.Common.Math.Vector3)gameObject.Position; + Vector3 position = gameObject.Position; return ActionManager.Instance()->UseActionLocation(ActionType.KeyItem, itemId, location: &position); } @@ -355,7 +353,7 @@ internal sealed unsafe class GameFunctions public bool IsObjectAtPosition(uint dataId, Vector3 position, float distance) { - GameObject? gameObject = FindObjectByDataId(dataId); + IGameObject? gameObject = FindObjectByDataId(dataId); return gameObject != null && (gameObject.Position - position).Length() < distance; } @@ -376,18 +374,16 @@ internal sealed unsafe class GameFunctions private bool HasCharacterStatusPreventingMountOrSprint() { - var gameObject = GameObjectManager.GetGameObjectByIndex(0); - if (gameObject != null && gameObject->ObjectKind == 1) - { - var battleChara = (BattleChara*)gameObject; - StatusManager* statusManager = battleChara->GetStatusManager; - return statusManager->HasStatus(565) || - statusManager->HasStatus(404) || - statusManager->HasStatus(2729) || - statusManager->HasStatus(2730); - } + var localPlayer = _clientState.LocalPlayer; + if (localPlayer == null) + return false; - return false; + var battleChara = (BattleChara*)localPlayer.Address; + StatusManager* statusManager = battleChara->GetStatusManager(); + return statusManager->HasStatus(565) || + statusManager->HasStatus(404) || + statusManager->HasStatus(2729) || + statusManager->HasStatus(2730); } public bool Mount() diff --git a/Questionable/Questionable.csproj b/Questionable/Questionable.csproj index 86530b51a..3c0699b0f 100644 --- a/Questionable/Questionable.csproj +++ b/Questionable/Questionable.csproj @@ -1,62 +1,20 @@ - + - net8.0-windows - 0.20 - 12 - enable - true - false - false + 1.0 dist - true $(SolutionDir)=X:\ - true - portable - - $(appdata)\XIVLauncher\addon\Hooks\dev\ - - - - $(DALAMUD_HOME)/ - + + - - - - $(DalamudLibPath)Dalamud.dll - false - - - $(DalamudLibPath)ImGui.NET.dll - false - - - $(DalamudLibPath)Lumina.dll - false - - - $(DalamudLibPath)Lumina.Excel.dll - false - - - $(DalamudLibPath)Newtonsoft.Json.dll - false - - - $(DalamudLibPath)FFXIVClientStructs.dll - false - - - diff --git a/Questionable/QuestionablePlugin.cs b/Questionable/QuestionablePlugin.cs index 96d633d8b..2b8e07a60 100644 --- a/Questionable/QuestionablePlugin.cs +++ b/Questionable/QuestionablePlugin.cs @@ -7,7 +7,6 @@ using Dalamud.Interface.Windowing; using Dalamud.Plugin; using Dalamud.Plugin.Services; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Questionable.Controller; using Questionable.Controller.Steps; @@ -25,7 +24,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin { private readonly ServiceProvider? _serviceProvider; - public QuestionablePlugin(DalamudPluginInterface pluginInterface, + public QuestionablePlugin(IDalamudPluginInterface pluginInterface, IClientState clientState, ITargetManager targetManager, IFramework framework, diff --git a/Questionable/Windows/ConfigWindow.cs b/Questionable/Windows/ConfigWindow.cs index 4262f39cc..48ef339f3 100644 --- a/Questionable/Windows/ConfigWindow.cs +++ b/Questionable/Windows/ConfigWindow.cs @@ -13,7 +13,7 @@ namespace Questionable.Windows; internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly Configuration _configuration; private readonly uint[] _mountIds; @@ -23,7 +23,7 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig ["None (manually pick quest)", "Maelstrom", "Twin Adder" /*, "Immortal Flames"*/]; [SuppressMessage("Performance", "CA1861", Justification = "One time initialization")] - public ConfigWindow(DalamudPluginInterface pluginInterface, Configuration configuration, IDataManager dataManager) + public ConfigWindow(IDalamudPluginInterface pluginInterface, Configuration configuration, IDataManager dataManager) : base("Config - Questionable###QuestionableConfig", ImGuiWindowFlags.AlwaysAutoResize) { _pluginInterface = pluginInterface; diff --git a/Questionable/Windows/QuestWindow.cs b/Questionable/Windows/QuestWindow.cs index 665a158b8..0126f1809 100644 --- a/Questionable/Windows/QuestWindow.cs +++ b/Questionable/Windows/QuestWindow.cs @@ -26,7 +26,7 @@ namespace Questionable.Windows; internal sealed class QuestWindow : LWindow, IPersistableWindowConfig { - private readonly DalamudPluginInterface _pluginInterface; + private readonly IDalamudPluginInterface _pluginInterface; private readonly MovementController _movementController; private readonly QuestController _questController; private readonly GameFunctions _gameFunctions; @@ -40,7 +40,7 @@ internal sealed class QuestWindow : LWindow, IPersistableWindowConfig private readonly QuestRegistry _questRegistry; private readonly ILogger _logger; - public QuestWindow(DalamudPluginInterface pluginInterface, + public QuestWindow(IDalamudPluginInterface pluginInterface, MovementController movementController, QuestController questController, GameFunctions gameFunctions,