From b2cf1df434618f711b418115481a19f317ddc4de Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 29 May 2024 00:17:19 +0200 Subject: [PATCH] Polished First Half of Elpis --- Questionable/Controller/QuestController.cs | 30 +++++++++++-- Questionable/GameFunctions.cs | 15 +++++++ .../V1/Converter/InteractionTypeConverter.cs | 1 + Questionable/Model/V1/EInteractionType.cs | 1 + Questionable/Model/V1/QuestStep.cs | 2 + .../4419_Return to the Crystarium.json | 6 ++- .../MSQ/E-Elpis/4420_Hope Upon a Flower.json | 27 ++++++++---- .../MSQ/E-Elpis/4421_Petalouda Hunt.json | 6 +-- .../4423_Ponder Warrant Cherish Welcome.json | 2 + .../MSQ/E-Elpis/4424_Lives Apart.json | 18 +++++++- .../4425_Their Greatest Contribution.json | 42 ++++++++++++++----- .../MSQ/E-Elpis/4426_Aether to Aether.json | 37 +++++++++++++++- .../MSQ/E-Elpis/4427_A Sentimental Gift.json | 15 ++++++- .../E-Elpis/4428_Verdict and Execution.json | 2 + .../4429_Travelers at the Crossroads.json | 1 + Questionable/QuestSchema/schema_v1.json | 5 +++ Questionable/Windows/DebugWindow.cs | 21 ++++++++++ 17 files changed, 197 insertions(+), 34 deletions(-) diff --git a/Questionable/Controller/QuestController.cs b/Questionable/Controller/QuestController.cs index 3bc4b7ba..c38b1627 100644 --- a/Questionable/Controller/QuestController.cs +++ b/Questionable/Controller/QuestController.cs @@ -339,7 +339,7 @@ internal sealed class QuestController if (step.TargetTerritoryId == _clientState.TerritoryType) { - // no more movement + _pluginLog.Information("Skipping any movement"); } else if (step.Position != null) { @@ -349,7 +349,6 @@ internal sealed class QuestController else distance = step.StopDistance ?? MovementController.DefaultStopDistance; - _pluginLog.Information($"Stop dist: {distance}"); var position = _clientState.LocalPlayer?.Position ?? new Vector3(); float actualDistance = (position - step.Position.Value).Length(); @@ -473,7 +472,12 @@ internal sealed class QuestController if (_gameFunctions.Unmount()) return; - if (step is { DataId: not null, ItemId: not null }) + if (step is { DataId: not null, ItemId: not null, GroundTarget: true }) + { + _gameFunctions.UseItemOnGround(step.DataId.Value, step.ItemId.Value); + IncreaseStepCount(); + } + else if (step is { DataId: not null, ItemId: not null }) { _gameFunctions.UseItem(step.DataId.Value, step.ItemId.Value); IncreaseStepCount(); @@ -507,6 +511,26 @@ internal sealed class QuestController _gameFunctions.UseEmote(step.DataId.Value, step.Emote.Value); IncreaseStepCount(); } + else if (step.Emote != null) + { + _gameFunctions.UseEmote(step.Emote.Value); + IncreaseStepCount(); + } + + break; + + case EInteractionType.Say: + if (_condition[ConditionFlag.Mounted]) + { + _gameFunctions.Unmount(); + return; + } + + if (!string.IsNullOrEmpty(step.ChatMessage)) + { + _gameFunctions.ExecuteCommand($"/say {step.ChatMessage}"); + IncreaseStepCount(); + } break; diff --git a/Questionable/GameFunctions.cs b/Questionable/GameFunctions.cs index 8619b5c9..14499a72 100644 --- a/Questionable/GameFunctions.cs +++ b/Questionable/GameFunctions.cs @@ -355,6 +355,16 @@ internal sealed unsafe class GameFunctions } } + public void UseItemOnGround(uint dataId, uint itemId) + { + GameObject? gameObject = FindObjectByDataId(dataId); + if (gameObject != null) + { + var position = (FFXIVClientStructs.FFXIV.Common.Math.Vector3)gameObject.Position; + ActionManager.Instance()->UseActionLocation(ActionType.KeyItem, itemId, gameObject.ObjectId, &position); + } + } + public void UseEmote(uint dataId, EEmote emote) { GameObject? gameObject = FindObjectByDataId(dataId); @@ -365,6 +375,11 @@ internal sealed unsafe class GameFunctions } } + public void UseEmote(EEmote emote) + { + ExecuteCommand($"{_emoteCommands[emote]} motion"); + } + public bool IsObjectAtPosition(uint dataId, Vector3 position) { GameObject? gameObject = FindObjectByDataId(dataId); diff --git a/Questionable/Model/V1/Converter/InteractionTypeConverter.cs b/Questionable/Model/V1/Converter/InteractionTypeConverter.cs index 1bab6dc7..e6786e3c 100644 --- a/Questionable/Model/V1/Converter/InteractionTypeConverter.cs +++ b/Questionable/Model/V1/Converter/InteractionTypeConverter.cs @@ -17,6 +17,7 @@ public sealed class InteractionTypeConverter : JsonConverter { EInteractionType.AttuneAetherCurrent, "AttuneAetherCurrent" }, { EInteractionType.Combat, "Combat" }, { EInteractionType.UseItem, "UseItem" }, + { EInteractionType.Say, "Say" }, { EInteractionType.Emote, "Emote" }, { EInteractionType.WaitForObjectAtPosition, "WaitForNpcAtPosition" }, { EInteractionType.ManualAction, "ManualAction" } diff --git a/Questionable/Model/V1/EInteractionType.cs b/Questionable/Model/V1/EInteractionType.cs index 9e9311b1..9c9c8d38 100644 --- a/Questionable/Model/V1/EInteractionType.cs +++ b/Questionable/Model/V1/EInteractionType.cs @@ -9,6 +9,7 @@ public enum EInteractionType AttuneAetherCurrent, Combat, UseItem, + Say, Emote, WaitForObjectAtPosition, ManualAction diff --git a/Questionable/Model/V1/QuestStep.cs b/Questionable/Model/V1/QuestStep.cs index 1a4dbfbc..404e6910 100644 --- a/Questionable/Model/V1/QuestStep.cs +++ b/Questionable/Model/V1/QuestStep.cs @@ -33,9 +33,11 @@ public class QuestStep public uint? AetherCurrentId { get; set; } public uint? ItemId { get; set; } + public bool? GroundTarget { get; set; } [JsonConverter(typeof(EmoteConverter))] public EEmote? Emote { get; set; } + public string ChatMessage { get; set; } [JsonConverter(typeof(EnemySpawnTypeConverter))] public EEnemySpawnType? EnemySpawnType { get; set; } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4419_Return to the Crystarium.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4419_Return to the Crystarium.json index b295c1e1..c813dc9c 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4419_Return to the Crystarium.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4419_Return to the Crystarium.json @@ -29,7 +29,9 @@ "Z": 305.80603 }, "TerritoryId": 813, - "InteractionType": "Interact" + "InteractionType": "Interact", + "AetheryteShortcut": "Lakeland - Fort Jobb", + "Fly": true } ] }, @@ -46,6 +48,7 @@ "TerritoryId": 819, "InteractionType": "ManualAction", "Comment": "Cutscene Interaction needed", + "AetheryteShortcut": "Crystarium", "AethernetShortcut": [ "[Crystarium] Aetheryte Plaza", "[Crystarium] The Cabinet of Curiosity" @@ -63,6 +66,7 @@ "Y": -37.7, "Z": -208.85028 }, + "StopDistance": 6, "TerritoryId": 819, "InteractionType": "Interact" } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4420_Hope Upon a Flower.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4420_Hope Upon a Flower.json index 2699e71f..d232461d 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4420_Hope Upon a Flower.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4420_Hope Upon a Flower.json @@ -12,6 +12,7 @@ "Y": -37.7, "Z": -208.85028 }, + "StopDistance": 6, "TerritoryId": 819, "InteractionType": "Interact" } @@ -37,18 +38,23 @@ ] }, { - "Sequence": 2, + "Sequence": 3, "Steps": [ { - "DataId": 2012128, "Position": { - "X": -0.001528129, - "Y": 4.931927, - "Z": 0.01416349 + "X": -6.1157894, + "Y": 2.0849845, + "Z": -4.654831 }, "TerritoryId": 1031, - "InteractionType": "ManualAction", - "Comment": "Interact with Aetheryte (Navmesh can't jump)" + "InteractionType": "WalkTo" + }, + { + "DataId": 2012128, + "TerritoryId": 1031, + "InteractionType": "Interact", + "Comment": "Interact with Aetheryte (Navmesh can't jump)", + "$": "QuestVariables after: 16 0 16 0 0 16" }, { "DataId": 1039993, @@ -58,7 +64,8 @@ "Z": -9.353821 }, "TerritoryId": 1031, - "InteractionType": "Interact" + "InteractionType": "Interact", + "$": "QuestVariables after: 32 1 16 0 0 144" }, { "DataId": 1039994, @@ -68,7 +75,8 @@ "Z": 2.1209717 }, "TerritoryId": 1031, - "InteractionType": "Interact" + "InteractionType": "Interact", + "$": "QuestVariables after: 49 1 16 0 0 208" }, { "DataId": 1039995, @@ -107,6 +115,7 @@ "Y": 44.32154, "Z": 771.4198 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4421_Petalouda Hunt.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4421_Petalouda Hunt.json index 7fddea41..3782a480 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4421_Petalouda Hunt.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4421_Petalouda Hunt.json @@ -12,6 +12,7 @@ "Y": 44.32154, "Z": 771.4198 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } @@ -37,11 +38,6 @@ "Steps": [ { "DataId": 1039998, - "Position": { - "X": 206.0426, - "Y": 20.561113, - "Z": 629.14465 - }, "TerritoryId": 961, "InteractionType": "ManualAction", "Comment": "Capture Mobs with less than 50% HP" diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4423_Ponder Warrant Cherish Welcome.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4423_Ponder Warrant Cherish Welcome.json index 955cd7e0..28f0c21e 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4423_Ponder Warrant Cherish Welcome.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4423_Ponder Warrant Cherish Welcome.json @@ -12,6 +12,7 @@ "Y": -1.1050489, "Z": 158.0376 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } @@ -42,6 +43,7 @@ "Y": 11.703674, "Z": 126.878784 }, + "StopDistance": 6, "TerritoryId": 961, "InteractionType": "AttuneAetheryte" }, diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4424_Lives Apart.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4424_Lives Apart.json index 40515e3b..807b85e4 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4424_Lives Apart.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4424_Lives Apart.json @@ -58,8 +58,22 @@ "Z": 1.5411377 }, "TerritoryId": 961, - "InteractionType": "ManualAction", - "Comment": "Use Quest Item on ground locations" + "InteractionType": "UseItem", + "ItemId": 2003234, + "GroundTarget": true, + "$": "QuestValues after: 1 16 0 0 0 128" + }, + { + "DataId": 2012132, + "Position": { + "X": 373.18982, + "Y": 2.9754639, + "Z": 10.788086 + }, + "TerritoryId": 961, + "InteractionType": "UseItem", + "ItemId": 2003234, + "GroundTarget": true } ] }, diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4425_Their Greatest Contribution.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4425_Their Greatest Contribution.json index fae40825..40923502 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4425_Their Greatest Contribution.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4425_Their Greatest Contribution.json @@ -43,7 +43,18 @@ "Z": 107.9021 }, "TerritoryId": 961, - "InteractionType": "AttuneAetherCurrent" + "InteractionType": "AttuneAetherCurrent", + "AetherCurrentId": 2818374 + }, + { + "Position": { + "X": 346.73517, + "Y": -15.572778, + "Z": -105.96149 + }, + "TerritoryId": 961, + "InteractionType": "WalkTo", + "Comment": "Needs manual jumping" }, { "DataId": 1040052, @@ -75,6 +86,17 @@ { "Sequence": 4, "Steps": [ + { + "Position": { + "X": 339.039, + "Y": -14.322072, + "Z": -101.509995 + }, + "StopDistance": 0.5, + "TerritoryId": 961, + "InteractionType": "WalkTo", + "DisableNavmesh": true + }, { "DataId": 2012022, "Position": { @@ -83,7 +105,8 @@ "Z": 2.5177002 }, "TerritoryId": 961, - "InteractionType": "AttuneAetherCurrent" + "InteractionType": "AttuneAetherCurrent", + "AetherCurrentId": 2818376 }, { "DataId": 1040061, @@ -93,7 +116,7 @@ "Z": -104.631165 }, "TerritoryId": 961, - "InteractionType": "ManualAction", + "InteractionType": "Say", "ChatMessage": "I have a favor to ask" } ] @@ -109,7 +132,7 @@ "Z": -104.631165 }, "TerritoryId": 961, - "InteractionType": "ManualAction", + "InteractionType": "Say", "ChatMessage": "Please, Emet-Selch" } ] @@ -118,14 +141,10 @@ "Sequence": 6, "Steps": [ { - "Position": { - "X": -64.09766, - "Y": -15.335736, - "Z": -84.71621 - }, "TerritoryId": 961, "InteractionType": "Emote", - "Emote": "wave" + "Emote": "wave", + "Comment": "Need to jump manually" } ] }, @@ -140,7 +159,8 @@ "Z": 88.91431 }, "TerritoryId": 961, - "InteractionType": "Interact" + "InteractionType": "Interact", + "AetheryteShortcut": "Elpis - Anagnorisis" } ] } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4426_Aether to Aether.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4426_Aether to Aether.json index 86783bc8..4262112a 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4426_Aether to Aether.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4426_Aether to Aether.json @@ -12,6 +12,7 @@ "Y": 10.385857, "Z": 89.34155 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } @@ -20,6 +21,25 @@ { "Sequence": 1, "Steps": [ + { + "Position": { + "X": -137.80992, + "Y": -26.995626, + "Z": 543.8281 + }, + "TerritoryId": 961, + "InteractionType": "WalkTo" + }, + { + "Position": { + "X": -137.80992, + "Y": -26.995626, + "Z": 543.8281 + }, + "TerritoryId": 961, + "InteractionType": "ManualAction", + "Comment": "Jump on Ledge" + }, { "DataId": 2012023, "Position": { @@ -28,7 +48,18 @@ "Z": 551.5067 }, "TerritoryId": 961, - "InteractionType": "AttuneAetherCurrent" + "InteractionType": "AttuneAetherCurrent", + "AetherCurrentId": 2818377 + }, + { + "Position": { + "X": -139.15512, + "Y": -27.030453, + "Z": 535.6933 + }, + "TerritoryId": 961, + "InteractionType": "WalkTo", + "DisableNavmesh": true }, { "DataId": 1040073, @@ -53,7 +84,8 @@ "Z": 490.53174 }, "TerritoryId": 961, - "InteractionType": "AttuneAetherCurrent" + "InteractionType": "AttuneAetherCurrent", + "AetherCurrentId": 2818378 }, { "DataId": 1040080, @@ -102,6 +134,7 @@ "Y": -22.394821, "Z": 527.88574 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4427_A Sentimental Gift.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4427_A Sentimental Gift.json index a12e0213..79627174 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4427_A Sentimental Gift.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4427_A Sentimental Gift.json @@ -12,6 +12,7 @@ "Y": -22.39482, "Z": 525.47485 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } @@ -27,6 +28,7 @@ "Y": -22.394821, "Z": 527.88574 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } @@ -120,6 +122,15 @@ { "Sequence": 7, "Steps": [ + { + "Position": { + "X": -734.30804, + "Y": -28.391644, + "Z": 432.59787 + }, + "TerritoryId": 961, + "InteractionType": "WalkTo" + }, { "DataId": 2012021, "Position": { @@ -128,7 +139,9 @@ "Z": 411.12378 }, "TerritoryId": 961, - "InteractionType": "AttuneAetherCurrent" + "InteractionType": "AttuneAetherCurrent", + "AetherCurrentId": 2818375, + "DisableNavmesh": true }, { "DataId": 2012141, diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4428_Verdict and Execution.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4428_Verdict and Execution.json index ec8a8112..6b4040f2 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4428_Verdict and Execution.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4428_Verdict and Execution.json @@ -58,6 +58,7 @@ }, "TerritoryId": 961, "InteractionType": "Combat", + "EnemySpawnType": "AutoOnEnterArea", "KillEnemyDataIds": [ 14075, 14074 @@ -90,6 +91,7 @@ "Y": -22.39482, "Z": 504.90576 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } diff --git a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4429_Travelers at the Crossroads.json b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4429_Travelers at the Crossroads.json index bfed8039..7d19f42f 100644 --- a/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4429_Travelers at the Crossroads.json +++ b/Questionable/QuestPaths/Endwalker/MSQ/E-Elpis/4429_Travelers at the Crossroads.json @@ -12,6 +12,7 @@ "Y": -22.39482, "Z": 505.08887 }, + "StopDistance": 5, "TerritoryId": 961, "InteractionType": "Interact" } diff --git a/Questionable/QuestSchema/schema_v1.json b/Questionable/QuestSchema/schema_v1.json index 45cd7534..b1030690 100644 --- a/Questionable/QuestSchema/schema_v1.json +++ b/Questionable/QuestSchema/schema_v1.json @@ -96,6 +96,7 @@ "AttuneAetherCurrent", "Combat", "UseItem", + "Say", "Emote", "WaitForNpcAtPosition", "ManualAction" @@ -303,6 +304,10 @@ "deny" ] }, + "ChatMessage": { + "type": "string", + "description": "The text to use with /say" + }, "ItemId": { "type": ["number", "null"], "description": "The Item to use", diff --git a/Questionable/Windows/DebugWindow.cs b/Questionable/Windows/DebugWindow.cs index daf1ea2f..96bfcef0 100644 --- a/Questionable/Windows/DebugWindow.cs +++ b/Questionable/Windows/DebugWindow.cs @@ -107,6 +107,27 @@ internal sealed class DebugWindow : Window var q = _gameFunctions.GetCurrentQuest(); ImGui.Text($"Current Quest: {q.CurrentQuest} → {q.Sequence}"); + var questManager = QuestManager.Instance(); + if (questManager != null) + { + for (int i = 0; i < 1 /*questManager->TrackedQuestsSpan.Length*/; ++i) + { + var trackedQuest = questManager->TrackedQuestsSpan[i]; + switch (trackedQuest.QuestType) + { + default: + ImGui.Text($"Tracked quest {i}: {trackedQuest.QuestType}, {trackedQuest.Index}"); + break; + + case 1: + ImGui.Text( + $"Tracked quest: {questManager->NormalQuestsSpan[trackedQuest.Index].QuestId}, {trackedQuest.Index}"); + break; + } + } + } + + if (_targetManager.Target != null) { ImGui.Separator();