From 320bb5edbe8b581032f4d5a2933f381db2b6554f Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 11 Sep 2024 16:58:07 +0200 Subject: [PATCH] Add snipe cheat --- .../The Azim Steppe/2771_Sheep Snatcher.json | 2 +- .../Alliance Raid Quests/3091_Desire.json | 2 +- .../A3.2-Yanxia 1/2495_A New Ruby Tithe.json | 6 +-- .../MSQ/B-4.1/2970_Securing the Saltery.json | 4 +- .../Pixies/Dailies/3707_Not the Beavers.json | 2 +- .../3285_A Fickle Existence.json | 2 +- .../3292_City of the Mord.json | 2 +- .../MSQ/C-Rak'tika/3323_A Little Faith.json | 2 +- .../C-Rak'tika/3330_A Beeautiful Plan.json | 2 +- .../3634_The View from Above.json | 2 +- .../E-Kholusia 2/3637_Meet the Tholls.json | 4 +- .../F-Tempest/3649_City of the Ancients.json | 2 +- .../MSQ/G-5.1/3680_Finding Good Help.json | 2 +- .../4363_Deeper into the Maze.json | 2 +- .../4406_Setting Things Straight.json | 2 +- .../MSQ/F-Labyrinthos2/4443_Wise Guides.json | 2 +- .../MSQ/G-UltimaThule/4460_x.json | 2 +- .../MSQ/G-UltimaThule/4461_Hello World.json | 2 +- .../4181_Scholarly Perspective.json | 2 +- .../4867_The Feat of Reeds.json | 2 +- .../4881_Lending a Helphand.json | 2 +- .../4921_Pick up the Pieces.json | 2 +- .../Shaaloani/5126_A Refined Perspective.json | 2 +- .../Yak T'el/5100_Carved in Stone.json | 2 +- QuestPaths/quest-v1.json | 1 + .../Converter/InteractionTypeConverter.cs | 1 + .../Questing/EInteractionType.cs | 1 + Questionable/Configuration.cs | 1 + .../Controller/Steps/Interactions/Interact.cs | 8 +++- .../Controller/Steps/Shared/WaitAtEnd.cs | 1 + .../Controller/Utils/AutoSnipeHandler.cs | 48 +++++++++++++++++++ Questionable/QuestionablePlugin.cs | 3 ++ Questionable/Windows/ConfigWindow.cs | 10 ++++ .../QuestComponents/ActiveQuestComponent.cs | 2 +- 34 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 Questionable/Controller/Utils/AutoSnipeHandler.cs diff --git a/QuestPaths/4.x - Stormblood/Aether Currents/The Azim Steppe/2771_Sheep Snatcher.json b/QuestPaths/4.x - Stormblood/Aether Currents/The Azim Steppe/2771_Sheep Snatcher.json index 3d3167ab..034df26b 100644 --- a/QuestPaths/4.x - Stormblood/Aether Currents/The Azim Steppe/2771_Sheep Snatcher.json +++ b/QuestPaths/4.x - Stormblood/Aether Currents/The Azim Steppe/2771_Sheep Snatcher.json @@ -28,7 +28,7 @@ "Z": -210.22363 }, "TerritoryId": 622, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Snipe sheep" } ] diff --git a/QuestPaths/4.x - Stormblood/Alliance Raid Quests/3091_Desire.json b/QuestPaths/4.x - Stormblood/Alliance Raid Quests/3091_Desire.json index 4242e0f7..d0c8d2a9 100644 --- a/QuestPaths/4.x - Stormblood/Alliance Raid Quests/3091_Desire.json +++ b/QuestPaths/4.x - Stormblood/Alliance Raid Quests/3091_Desire.json @@ -54,7 +54,7 @@ "Z": 208.484 }, "TerritoryId": 787, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Far on the left" } ] diff --git a/QuestPaths/4.x - Stormblood/MSQ/A3.2-Yanxia 1/2495_A New Ruby Tithe.json b/QuestPaths/4.x - Stormblood/MSQ/A3.2-Yanxia 1/2495_A New Ruby Tithe.json index b86394da..1045490b 100644 --- a/QuestPaths/4.x - Stormblood/MSQ/A3.2-Yanxia 1/2495_A New Ruby Tithe.json +++ b/QuestPaths/4.x - Stormblood/MSQ/A3.2-Yanxia 1/2495_A New Ruby Tithe.json @@ -111,7 +111,7 @@ "Z": 147.23425 }, "TerritoryId": 614, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Snipe soldiers" } ] @@ -127,7 +127,7 @@ "Z": 237.04883 }, "TerritoryId": 614, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Snipe soldiers" } ] @@ -158,7 +158,7 @@ "Z": 603.2959 }, "TerritoryId": 614, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Snipe soldiers" } ] diff --git a/QuestPaths/4.x - Stormblood/MSQ/B-4.1/2970_Securing the Saltery.json b/QuestPaths/4.x - Stormblood/MSQ/B-4.1/2970_Securing the Saltery.json index 284a29d3..b7da884e 100644 --- a/QuestPaths/4.x - Stormblood/MSQ/B-4.1/2970_Securing the Saltery.json +++ b/QuestPaths/4.x - Stormblood/MSQ/B-4.1/2970_Securing the Saltery.json @@ -62,7 +62,7 @@ "Z": 196.55139 }, "TerritoryId": 621, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Aim at jaw", "Fly": true } @@ -95,7 +95,7 @@ "Z": 282.7954 }, "TerritoryId": 621, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Fly": true, "Comment": "Aim at nearest eye" } diff --git a/QuestPaths/5.x - Shadowbringers/Allied Societies/Pixies/Dailies/3707_Not the Beavers.json b/QuestPaths/5.x - Shadowbringers/Allied Societies/Pixies/Dailies/3707_Not the Beavers.json index ae181ec1..8d99337d 100644 --- a/QuestPaths/5.x - Shadowbringers/Allied Societies/Pixies/Dailies/3707_Not the Beavers.json +++ b/QuestPaths/5.x - Shadowbringers/Allied Societies/Pixies/Dailies/3707_Not the Beavers.json @@ -28,7 +28,7 @@ "Z": 755.58093 }, "TerritoryId": 816, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Fly": true, "Comment": "Throw Porxies at Beavers" } diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/A2-Kholusia 1/3285_A Fickle Existence.json b/QuestPaths/5.x - Shadowbringers/MSQ/A2-Kholusia 1/3285_A Fickle Existence.json index d70949f9..78b6e3ca 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/A2-Kholusia 1/3285_A Fickle Existence.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/A2-Kholusia 1/3285_A Fickle Existence.json @@ -48,7 +48,7 @@ "Z": 656.9772 }, "TerritoryId": 814, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Click the guy in front of (or near) the light house stairs" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/A3-Amh Araeng 1/3292_City of the Mord.json b/QuestPaths/5.x - Shadowbringers/MSQ/A3-Amh Araeng 1/3292_City of the Mord.json index ded86bd5..813814f3 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/A3-Amh Araeng 1/3292_City of the Mord.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/A3-Amh Araeng 1/3292_City of the Mord.json @@ -48,7 +48,7 @@ "Z": -186.14484 }, "TerritoryId": 815, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Click all four foods" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3323_A Little Faith.json b/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3323_A Little Faith.json index a5286f4e..b5c2d0d6 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3323_A Little Faith.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3323_A Little Faith.json @@ -104,7 +104,7 @@ "Z": -92.97333 }, "TerritoryId": 813, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Tablet is on the right middle shelf of the table" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3330_A Beeautiful Plan.json b/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3330_A Beeautiful Plan.json index 960e9293..51a28c18 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3330_A Beeautiful Plan.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/C-Rak'tika/3330_A Beeautiful Plan.json @@ -84,7 +84,7 @@ "Z": -359.4873 }, "TerritoryId": 817, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click murals" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3634_The View from Above.json b/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3634_The View from Above.json index 2c9e1fff..5285a8a2 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3634_The View from Above.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3634_The View from Above.json @@ -73,7 +73,7 @@ "Z": 22.47644 }, "TerritoryId": 814, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click on the guy left of the the rock" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3637_Meet the Tholls.json b/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3637_Meet the Tholls.json index ee2b89dc..8396eed7 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3637_Meet the Tholls.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/E-Kholusia 2/3637_Meet the Tholls.json @@ -59,7 +59,7 @@ "Z": -616.47974 }, "TerritoryId": 814, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click red hat dwarf (always shows up in the same location)" } ] @@ -75,7 +75,7 @@ "Z": -616.47974 }, "TerritoryId": 814, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click red hat dwarf" } ] diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/F-Tempest/3649_City of the Ancients.json b/QuestPaths/5.x - Shadowbringers/MSQ/F-Tempest/3649_City of the Ancients.json index 34fa28fc..3242f9d5 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/F-Tempest/3649_City of the Ancients.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/F-Tempest/3649_City of the Ancients.json @@ -54,7 +54,7 @@ "Z": -414.38928 }, "TerritoryId": 818, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click top left (broken) window", "CompletionQuestVariablesFlags": [ null, diff --git a/QuestPaths/5.x - Shadowbringers/MSQ/G-5.1/3680_Finding Good Help.json b/QuestPaths/5.x - Shadowbringers/MSQ/G-5.1/3680_Finding Good Help.json index 19ac4906..2416c087 100644 --- a/QuestPaths/5.x - Shadowbringers/MSQ/G-5.1/3680_Finding Good Help.json +++ b/QuestPaths/5.x - Shadowbringers/MSQ/G-5.1/3680_Finding Good Help.json @@ -44,7 +44,7 @@ "Z": -161.45575 }, "TerritoryId": 814, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Help Master Chai dodge enemies" } ] diff --git a/QuestPaths/6.x - Endwalker/MSQ/A-Thavnair1-Labyrinthos1/4363_Deeper into the Maze.json b/QuestPaths/6.x - Endwalker/MSQ/A-Thavnair1-Labyrinthos1/4363_Deeper into the Maze.json index 75cf15c6..15fb42ae 100644 --- a/QuestPaths/6.x - Endwalker/MSQ/A-Thavnair1-Labyrinthos1/4363_Deeper into the Maze.json +++ b/QuestPaths/6.x - Endwalker/MSQ/A-Thavnair1-Labyrinthos1/4363_Deeper into the Maze.json @@ -119,7 +119,7 @@ "Z": -519.18823 }, "TerritoryId": 956, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Shoot Large Green Bird" } ] diff --git a/QuestPaths/6.x - Endwalker/MSQ/C-MareLamentorum/4406_Setting Things Straight.json b/QuestPaths/6.x - Endwalker/MSQ/C-MareLamentorum/4406_Setting Things Straight.json index 00c79a9a..b84bfe28 100644 --- a/QuestPaths/6.x - Endwalker/MSQ/C-MareLamentorum/4406_Setting Things Straight.json +++ b/QuestPaths/6.x - Endwalker/MSQ/C-MareLamentorum/4406_Setting Things Straight.json @@ -160,7 +160,7 @@ "Z": -654.13904 }, "TerritoryId": 959, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Find \"Runninway?\"" } ] diff --git a/QuestPaths/6.x - Endwalker/MSQ/F-Labyrinthos2/4443_Wise Guides.json b/QuestPaths/6.x - Endwalker/MSQ/F-Labyrinthos2/4443_Wise Guides.json index d7c5efa7..56b49ff6 100644 --- a/QuestPaths/6.x - Endwalker/MSQ/F-Labyrinthos2/4443_Wise Guides.json +++ b/QuestPaths/6.x - Endwalker/MSQ/F-Labyrinthos2/4443_Wise Guides.json @@ -45,7 +45,7 @@ }, "StopDistance": 5, "TerritoryId": 956, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Find Points of Interest" } ] diff --git a/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4460_x.json b/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4460_x.json index 35dcefaf..de94694b 100644 --- a/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4460_x.json +++ b/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4460_x.json @@ -104,7 +104,7 @@ "Z": 375.50916 }, "TerritoryId": 960, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Find Errant Omicron" } ] diff --git a/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4461_Hello World.json b/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4461_Hello World.json index 48ae6672..300ba565 100644 --- a/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4461_Hello World.json +++ b/QuestPaths/6.x - Endwalker/MSQ/G-UltimaThule/4461_Hello World.json @@ -44,7 +44,7 @@ "Z": 398.42822 }, "TerritoryId": 960, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Identify Anomaly (Head, Elbow or Knee)" } ] diff --git a/QuestPaths/6.x - Endwalker/Side Quests/Old Sharlayan/4181_Scholarly Perspective.json b/QuestPaths/6.x - Endwalker/Side Quests/Old Sharlayan/4181_Scholarly Perspective.json index d78b2a99..ae183516 100644 --- a/QuestPaths/6.x - Endwalker/Side Quests/Old Sharlayan/4181_Scholarly Perspective.json +++ b/QuestPaths/6.x - Endwalker/Side Quests/Old Sharlayan/4181_Scholarly Perspective.json @@ -28,7 +28,7 @@ "Z": 276.81384 }, "TerritoryId": 962, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Click ewer, head and feet", "AethernetShortcut": [ "[Old Sharlayan] Aetheryte Plaza", diff --git a/QuestPaths/7.x - Dawntrail/MSQ/A-Kozama'uka1-Urqopacha1/4867_The Feat of Reeds.json b/QuestPaths/7.x - Dawntrail/MSQ/A-Kozama'uka1-Urqopacha1/4867_The Feat of Reeds.json index c69575bd..b3a2d6b2 100644 --- a/QuestPaths/7.x - Dawntrail/MSQ/A-Kozama'uka1-Urqopacha1/4867_The Feat of Reeds.json +++ b/QuestPaths/7.x - Dawntrail/MSQ/A-Kozama'uka1-Urqopacha1/4867_The Feat of Reeds.json @@ -136,7 +136,7 @@ "Z": -532.15845 }, "TerritoryId": 1188, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Inspect Eye, Carrying Pole and Tail", "AetheryteShortcut": "Kozama'uka - Ok'hanu" } diff --git a/QuestPaths/7.x - Dawntrail/MSQ/B-Kozama'uka2-Urqopacha2/4881_Lending a Helphand.json b/QuestPaths/7.x - Dawntrail/MSQ/B-Kozama'uka2-Urqopacha2/4881_Lending a Helphand.json index 5fbb423b..29d5bcb0 100644 --- a/QuestPaths/7.x - Dawntrail/MSQ/B-Kozama'uka2-Urqopacha2/4881_Lending a Helphand.json +++ b/QuestPaths/7.x - Dawntrail/MSQ/B-Kozama'uka2-Urqopacha2/4881_Lending a Helphand.json @@ -28,7 +28,7 @@ "Z": 343.7704 }, "TerritoryId": 1188, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Click (from left to right) worn tools, Kaahe, crafting materials, untouched meal" } ] diff --git a/QuestPaths/7.x - Dawntrail/MSQ/D-Shaaloani-HeritageFound1/4921_Pick up the Pieces.json b/QuestPaths/7.x - Dawntrail/MSQ/D-Shaaloani-HeritageFound1/4921_Pick up the Pieces.json index bcace205..a5347bfe 100644 --- a/QuestPaths/7.x - Dawntrail/MSQ/D-Shaaloani-HeritageFound1/4921_Pick up the Pieces.json +++ b/QuestPaths/7.x - Dawntrail/MSQ/D-Shaaloani-HeritageFound1/4921_Pick up the Pieces.json @@ -28,7 +28,7 @@ "Z": 25.680908 }, "TerritoryId": 1185, - "InteractionType": "WaitForManualProgress", + "InteractionType": "Snipe", "Comment": "Inspect Helm, Corpse, Weapon" } ] diff --git a/QuestPaths/7.x - Dawntrail/Side Quests/Shaaloani/5126_A Refined Perspective.json b/QuestPaths/7.x - Dawntrail/Side Quests/Shaaloani/5126_A Refined Perspective.json index 4412991d..31d97375 100644 --- a/QuestPaths/7.x - Dawntrail/Side Quests/Shaaloani/5126_A Refined Perspective.json +++ b/QuestPaths/7.x - Dawntrail/Side Quests/Shaaloani/5126_A Refined Perspective.json @@ -28,7 +28,7 @@ "Z": -141.92426 }, "TerritoryId": 1190, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Click (from left to right) pump, middle of the connecting pipes, barrels" } ] diff --git a/QuestPaths/7.x - Dawntrail/Side Quests/Yak T'el/5100_Carved in Stone.json b/QuestPaths/7.x - Dawntrail/Side Quests/Yak T'el/5100_Carved in Stone.json index b50e254d..2244ebb9 100644 --- a/QuestPaths/7.x - Dawntrail/Side Quests/Yak T'el/5100_Carved in Stone.json +++ b/QuestPaths/7.x - Dawntrail/Side Quests/Yak T'el/5100_Carved in Stone.json @@ -28,7 +28,7 @@ "Z": 557.7018 }, "TerritoryId": 1189, - "InteractionType": "Instruction", + "InteractionType": "Snipe", "Comment": "Inspect Flag, Red Head, Blue Head" } ] diff --git a/QuestPaths/quest-v1.json b/QuestPaths/quest-v1.json index 8068adef..a3bfd6f9 100644 --- a/QuestPaths/quest-v1.json +++ b/QuestPaths/quest-v1.json @@ -130,6 +130,7 @@ "Jump", "Dive", "Craft", + "Snipe", "Instruction", "AcceptQuest", "CompleteQuest", diff --git a/Questionable.Model/Questing/Converter/InteractionTypeConverter.cs b/Questionable.Model/Questing/Converter/InteractionTypeConverter.cs index 8683a57a..bf856da9 100644 --- a/Questionable.Model/Questing/Converter/InteractionTypeConverter.cs +++ b/Questionable.Model/Questing/Converter/InteractionTypeConverter.cs @@ -27,6 +27,7 @@ public sealed class InteractionTypeConverter() : EnumConverter { EInteractionType.Jump, "Jump" }, { EInteractionType.Dive, "Dive" }, { EInteractionType.Craft, "Craft" }, + { EInteractionType.Snipe, "Snipe" }, { EInteractionType.Instruction, "Instruction" }, { EInteractionType.AcceptQuest, "AcceptQuest" }, { EInteractionType.CompleteQuest, "CompleteQuest" }, diff --git a/Questionable.Model/Questing/EInteractionType.cs b/Questionable.Model/Questing/EInteractionType.cs index c0b3eede..f251b5ae 100644 --- a/Questionable.Model/Questing/EInteractionType.cs +++ b/Questionable.Model/Questing/EInteractionType.cs @@ -26,6 +26,7 @@ public enum EInteractionType Jump, Dive, Craft, + Snipe, /// /// Needs to be manually continued. diff --git a/Questionable/Configuration.cs b/Questionable/Configuration.cs index 9f86cb94..3ea014cb 100644 --- a/Questionable/Configuration.cs +++ b/Questionable/Configuration.cs @@ -19,6 +19,7 @@ internal sealed class Configuration : IPluginConfiguration public bool HideInAllInstances { get; set; } = true; public bool UseEscToCancelQuesting { get; set; } = true; public bool ShowIncompleteSeasonalEvents { get; set; } = true; + public bool AutomaticallyCompleteSnipeTasks { get; set; } } internal sealed class AdvancedConfiguration diff --git a/Questionable/Controller/Steps/Interactions/Interact.cs b/Questionable/Controller/Steps/Interactions/Interact.cs index 4988b2ae..b048b7ff 100644 --- a/Questionable/Controller/Steps/Interactions/Interact.cs +++ b/Questionable/Controller/Steps/Interactions/Interact.cs @@ -16,7 +16,8 @@ namespace Questionable.Controller.Steps.Interactions; internal static class Interact { - internal sealed class Factory(GameFunctions gameFunctions, ICondition condition, ILoggerFactory loggerFactory) + internal sealed class Factory(GameFunctions gameFunctions, Configuration configuration, ICondition condition, + ILoggerFactory loggerFactory) : ITaskFactory { public IEnumerable CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step) @@ -37,6 +38,11 @@ internal static class Interact if (step.DataId == null) yield break; } + else if (step.InteractionType == EInteractionType.Snipe) + { + if (!configuration.General.AutomaticallyCompleteSnipeTasks) + yield break; + } else if (step.InteractionType != EInteractionType.Interact) yield break; diff --git a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs index 47c0fe4a..e2a0864f 100644 --- a/Questionable/Controller/Steps/Shared/WaitAtEnd.cs +++ b/Questionable/Controller/Steps/Shared/WaitAtEnd.cs @@ -49,6 +49,7 @@ internal static class WaitAtEnd case EInteractionType.WaitForManualProgress: case EInteractionType.Instruction: + case EInteractionType.Snipe: return [new WaitNextStepOrSequence()]; case EInteractionType.Duty: diff --git a/Questionable/Controller/Utils/AutoSnipeHandler.cs b/Questionable/Controller/Utils/AutoSnipeHandler.cs new file mode 100644 index 00000000..dc48c3ac --- /dev/null +++ b/Questionable/Controller/Utils/AutoSnipeHandler.cs @@ -0,0 +1,48 @@ +using System; +using Dalamud.Hooking; +using Dalamud.Plugin.Services; +using FFXIVClientStructs.FFXIV.Client.Game.Event; +using FFXIVClientStructs.FFXIV.Common.Lua; + +namespace Questionable.Controller.Utils; + +internal sealed unsafe class AutoSnipeHandler : IDisposable +{ + private readonly QuestController _questController; + private readonly Configuration _configuration; + private readonly Hook _enqueueSnipeTaskHook; + + private delegate ulong EnqueueSnipeTaskDelegate(EventSceneModuleImplBase* scene, lua_State* state); + + public AutoSnipeHandler(QuestController questController, Configuration configuration, IGameInteropProvider gameInteropProvider) + { + _questController = questController; + _configuration = configuration; + + _enqueueSnipeTaskHook = + gameInteropProvider.HookFromSignature( + "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 50 48 8B F1 48 8D 4C 24 ?? E8 ?? ?? ?? ?? 48 8B 4C 24 ??", + EnqueueSnipeTask); + } + + public void Enable() => _enqueueSnipeTaskHook.Enable(); + + private ulong EnqueueSnipeTask(EventSceneModuleImplBase* scene, lua_State* state) + { + if (_configuration.General.AutomaticallyCompleteSnipeTasks && _questController.IsRunning) + { + var val = state->top; + val->tt = 3; + val->value.n = 1; + state->top += 1; + return 1; + } + else + return _enqueueSnipeTaskHook.Original.Invoke(scene, state); + } + + public void Dispose() + { + _enqueueSnipeTaskHook.Dispose(); + } +} diff --git a/Questionable/QuestionablePlugin.cs b/Questionable/QuestionablePlugin.cs index 5c74c00b..b5be5760 100644 --- a/Questionable/QuestionablePlugin.cs +++ b/Questionable/QuestionablePlugin.cs @@ -18,6 +18,7 @@ using Questionable.Controller.Steps.Common; using Questionable.Controller.Steps.Gathering; using Questionable.Controller.Steps.Interactions; using Questionable.Controller.Steps.Leves; +using Questionable.Controller.Utils; using Questionable.Data; using Questionable.External; using Questionable.Functions; @@ -108,6 +109,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); @@ -240,6 +242,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin serviceProvider.GetRequiredService(); serviceProvider.GetRequiredService(); serviceProvider.GetRequiredService(); + serviceProvider.GetRequiredService().Enable(); } public void Dispose() diff --git a/Questionable/Windows/ConfigWindow.cs b/Questionable/Windows/ConfigWindow.cs index a419249c..e69a7c37 100644 --- a/Questionable/Windows/ConfigWindow.cs +++ b/Questionable/Windows/ConfigWindow.cs @@ -90,6 +90,16 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig Save(); } + if (ImGui.CollapsingHeader("Cheats")) + { + bool automaticallyCompleteSnipeTasks = _configuration.General.AutomaticallyCompleteSnipeTasks; + if (ImGui.Checkbox("Automatically complete snipe tasks", ref automaticallyCompleteSnipeTasks)) + { + _configuration.General.AutomaticallyCompleteSnipeTasks = automaticallyCompleteSnipeTasks; + Save(); + } + } + ImGui.EndTabItem(); } diff --git a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs index b1ffd40b..34beb090 100644 --- a/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs +++ b/Questionable/Windows/QuestComponents/ActiveQuestComponent.cs @@ -84,7 +84,7 @@ internal sealed partial class ActiveQuestComponent if (!isMinimized) { bool colored = currentStep is - { InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress }; + { InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress or EInteractionType.Snipe }; if (colored) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange); ImGui.TextUnformatted(currentStep?.Comment ??