Add snipe cheat

This commit is contained in:
Liza 2024-09-11 16:58:07 +02:00
parent 8b07532080
commit 320bb5edbe
Signed by: liza
GPG Key ID: 7199F8D727D55F67
34 changed files with 102 additions and 30 deletions

View File

@ -28,7 +28,7 @@
"Z": -210.22363 "Z": -210.22363
}, },
"TerritoryId": 622, "TerritoryId": 622,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Snipe sheep" "Comment": "Snipe sheep"
} }
] ]

View File

@ -54,7 +54,7 @@
"Z": 208.484 "Z": 208.484
}, },
"TerritoryId": 787, "TerritoryId": 787,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Far on the left" "Comment": "Far on the left"
} }
] ]

View File

@ -111,7 +111,7 @@
"Z": 147.23425 "Z": 147.23425
}, },
"TerritoryId": 614, "TerritoryId": 614,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Snipe soldiers" "Comment": "Snipe soldiers"
} }
] ]
@ -127,7 +127,7 @@
"Z": 237.04883 "Z": 237.04883
}, },
"TerritoryId": 614, "TerritoryId": 614,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Snipe soldiers" "Comment": "Snipe soldiers"
} }
] ]
@ -158,7 +158,7 @@
"Z": 603.2959 "Z": 603.2959
}, },
"TerritoryId": 614, "TerritoryId": 614,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Snipe soldiers" "Comment": "Snipe soldiers"
} }
] ]

View File

@ -62,7 +62,7 @@
"Z": 196.55139 "Z": 196.55139
}, },
"TerritoryId": 621, "TerritoryId": 621,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Aim at jaw", "Comment": "Aim at jaw",
"Fly": true "Fly": true
} }
@ -95,7 +95,7 @@
"Z": 282.7954 "Z": 282.7954
}, },
"TerritoryId": 621, "TerritoryId": 621,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Fly": true, "Fly": true,
"Comment": "Aim at nearest eye" "Comment": "Aim at nearest eye"
} }

View File

@ -28,7 +28,7 @@
"Z": 755.58093 "Z": 755.58093
}, },
"TerritoryId": 816, "TerritoryId": 816,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Fly": true, "Fly": true,
"Comment": "Throw Porxies at Beavers" "Comment": "Throw Porxies at Beavers"
} }

View File

@ -48,7 +48,7 @@
"Z": 656.9772 "Z": 656.9772
}, },
"TerritoryId": 814, "TerritoryId": 814,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Click the guy in front of (or near) the light house stairs" "Comment": "Click the guy in front of (or near) the light house stairs"
} }
] ]

View File

@ -48,7 +48,7 @@
"Z": -186.14484 "Z": -186.14484
}, },
"TerritoryId": 815, "TerritoryId": 815,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Click all four foods" "Comment": "Click all four foods"
} }
] ]

View File

@ -104,7 +104,7 @@
"Z": -92.97333 "Z": -92.97333
}, },
"TerritoryId": 813, "TerritoryId": 813,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Tablet is on the right middle shelf of the table" "Comment": "Tablet is on the right middle shelf of the table"
} }
] ]

View File

@ -84,7 +84,7 @@
"Z": -359.4873 "Z": -359.4873
}, },
"TerritoryId": 817, "TerritoryId": 817,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click murals" "Comment": "Click murals"
} }
] ]

View File

@ -73,7 +73,7 @@
"Z": 22.47644 "Z": 22.47644
}, },
"TerritoryId": 814, "TerritoryId": 814,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click on the guy left of the the rock" "Comment": "Click on the guy left of the the rock"
} }
] ]

View File

@ -59,7 +59,7 @@
"Z": -616.47974 "Z": -616.47974
}, },
"TerritoryId": 814, "TerritoryId": 814,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click red hat dwarf (always shows up in the same location)" "Comment": "Click red hat dwarf (always shows up in the same location)"
} }
] ]
@ -75,7 +75,7 @@
"Z": -616.47974 "Z": -616.47974
}, },
"TerritoryId": 814, "TerritoryId": 814,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click red hat dwarf" "Comment": "Click red hat dwarf"
} }
] ]

View File

@ -54,7 +54,7 @@
"Z": -414.38928 "Z": -414.38928
}, },
"TerritoryId": 818, "TerritoryId": 818,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click top left (broken) window", "Comment": "Click top left (broken) window",
"CompletionQuestVariablesFlags": [ "CompletionQuestVariablesFlags": [
null, null,

View File

@ -44,7 +44,7 @@
"Z": -161.45575 "Z": -161.45575
}, },
"TerritoryId": 814, "TerritoryId": 814,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Help Master Chai dodge enemies" "Comment": "Help Master Chai dodge enemies"
} }
] ]

View File

@ -119,7 +119,7 @@
"Z": -519.18823 "Z": -519.18823
}, },
"TerritoryId": 956, "TerritoryId": 956,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Shoot Large Green Bird" "Comment": "Shoot Large Green Bird"
} }
] ]

View File

@ -160,7 +160,7 @@
"Z": -654.13904 "Z": -654.13904
}, },
"TerritoryId": 959, "TerritoryId": 959,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Find \"Runninway?\"" "Comment": "Find \"Runninway?\""
} }
] ]

View File

@ -45,7 +45,7 @@
}, },
"StopDistance": 5, "StopDistance": 5,
"TerritoryId": 956, "TerritoryId": 956,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Find Points of Interest" "Comment": "Find Points of Interest"
} }
] ]

View File

@ -104,7 +104,7 @@
"Z": 375.50916 "Z": 375.50916
}, },
"TerritoryId": 960, "TerritoryId": 960,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Find Errant Omicron" "Comment": "Find Errant Omicron"
} }
] ]

View File

@ -44,7 +44,7 @@
"Z": 398.42822 "Z": 398.42822
}, },
"TerritoryId": 960, "TerritoryId": 960,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Identify Anomaly (Head, Elbow or Knee)" "Comment": "Identify Anomaly (Head, Elbow or Knee)"
} }
] ]

View File

@ -28,7 +28,7 @@
"Z": 276.81384 "Z": 276.81384
}, },
"TerritoryId": 962, "TerritoryId": 962,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Click ewer, head and feet", "Comment": "Click ewer, head and feet",
"AethernetShortcut": [ "AethernetShortcut": [
"[Old Sharlayan] Aetheryte Plaza", "[Old Sharlayan] Aetheryte Plaza",

View File

@ -136,7 +136,7 @@
"Z": -532.15845 "Z": -532.15845
}, },
"TerritoryId": 1188, "TerritoryId": 1188,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Inspect Eye, Carrying Pole and Tail", "Comment": "Inspect Eye, Carrying Pole and Tail",
"AetheryteShortcut": "Kozama'uka - Ok'hanu" "AetheryteShortcut": "Kozama'uka - Ok'hanu"
} }

View File

@ -28,7 +28,7 @@
"Z": 343.7704 "Z": 343.7704
}, },
"TerritoryId": 1188, "TerritoryId": 1188,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Click (from left to right) worn tools, Kaahe, crafting materials, untouched meal" "Comment": "Click (from left to right) worn tools, Kaahe, crafting materials, untouched meal"
} }
] ]

View File

@ -28,7 +28,7 @@
"Z": 25.680908 "Z": 25.680908
}, },
"TerritoryId": 1185, "TerritoryId": 1185,
"InteractionType": "WaitForManualProgress", "InteractionType": "Snipe",
"Comment": "Inspect Helm, Corpse, Weapon" "Comment": "Inspect Helm, Corpse, Weapon"
} }
] ]

View File

@ -28,7 +28,7 @@
"Z": -141.92426 "Z": -141.92426
}, },
"TerritoryId": 1190, "TerritoryId": 1190,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Click (from left to right) pump, middle of the connecting pipes, barrels" "Comment": "Click (from left to right) pump, middle of the connecting pipes, barrels"
} }
] ]

View File

@ -28,7 +28,7 @@
"Z": 557.7018 "Z": 557.7018
}, },
"TerritoryId": 1189, "TerritoryId": 1189,
"InteractionType": "Instruction", "InteractionType": "Snipe",
"Comment": "Inspect Flag, Red Head, Blue Head" "Comment": "Inspect Flag, Red Head, Blue Head"
} }
] ]

View File

@ -130,6 +130,7 @@
"Jump", "Jump",
"Dive", "Dive",
"Craft", "Craft",
"Snipe",
"Instruction", "Instruction",
"AcceptQuest", "AcceptQuest",
"CompleteQuest", "CompleteQuest",

View File

@ -27,6 +27,7 @@ public sealed class InteractionTypeConverter() : EnumConverter<EInteractionType>
{ EInteractionType.Jump, "Jump" }, { EInteractionType.Jump, "Jump" },
{ EInteractionType.Dive, "Dive" }, { EInteractionType.Dive, "Dive" },
{ EInteractionType.Craft, "Craft" }, { EInteractionType.Craft, "Craft" },
{ EInteractionType.Snipe, "Snipe" },
{ EInteractionType.Instruction, "Instruction" }, { EInteractionType.Instruction, "Instruction" },
{ EInteractionType.AcceptQuest, "AcceptQuest" }, { EInteractionType.AcceptQuest, "AcceptQuest" },
{ EInteractionType.CompleteQuest, "CompleteQuest" }, { EInteractionType.CompleteQuest, "CompleteQuest" },

View File

@ -26,6 +26,7 @@ public enum EInteractionType
Jump, Jump,
Dive, Dive,
Craft, Craft,
Snipe,
/// <summary> /// <summary>
/// Needs to be manually continued. /// Needs to be manually continued.

View File

@ -19,6 +19,7 @@ internal sealed class Configuration : IPluginConfiguration
public bool HideInAllInstances { get; set; } = true; public bool HideInAllInstances { get; set; } = true;
public bool UseEscToCancelQuesting { get; set; } = true; public bool UseEscToCancelQuesting { get; set; } = true;
public bool ShowIncompleteSeasonalEvents { get; set; } = true; public bool ShowIncompleteSeasonalEvents { get; set; } = true;
public bool AutomaticallyCompleteSnipeTasks { get; set; }
} }
internal sealed class AdvancedConfiguration internal sealed class AdvancedConfiguration

View File

@ -16,7 +16,8 @@ namespace Questionable.Controller.Steps.Interactions;
internal static class Interact 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 : ITaskFactory
{ {
public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step) public IEnumerable<ITask> CreateAllTasks(Quest quest, QuestSequence sequence, QuestStep step)
@ -37,6 +38,11 @@ internal static class Interact
if (step.DataId == null) if (step.DataId == null)
yield break; yield break;
} }
else if (step.InteractionType == EInteractionType.Snipe)
{
if (!configuration.General.AutomaticallyCompleteSnipeTasks)
yield break;
}
else if (step.InteractionType != EInteractionType.Interact) else if (step.InteractionType != EInteractionType.Interact)
yield break; yield break;

View File

@ -49,6 +49,7 @@ internal static class WaitAtEnd
case EInteractionType.WaitForManualProgress: case EInteractionType.WaitForManualProgress:
case EInteractionType.Instruction: case EInteractionType.Instruction:
case EInteractionType.Snipe:
return [new WaitNextStepOrSequence()]; return [new WaitNextStepOrSequence()];
case EInteractionType.Duty: case EInteractionType.Duty:

View File

@ -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<EnqueueSnipeTaskDelegate> _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<EnqueueSnipeTaskDelegate>(
"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();
}
}

View File

@ -18,6 +18,7 @@ using Questionable.Controller.Steps.Common;
using Questionable.Controller.Steps.Gathering; using Questionable.Controller.Steps.Gathering;
using Questionable.Controller.Steps.Interactions; using Questionable.Controller.Steps.Interactions;
using Questionable.Controller.Steps.Leves; using Questionable.Controller.Steps.Leves;
using Questionable.Controller.Utils;
using Questionable.Data; using Questionable.Data;
using Questionable.External; using Questionable.External;
using Questionable.Functions; using Questionable.Functions;
@ -108,6 +109,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
serviceCollection.AddSingleton<GameFunctions>(); serviceCollection.AddSingleton<GameFunctions>();
serviceCollection.AddSingleton<ChatFunctions>(); serviceCollection.AddSingleton<ChatFunctions>();
serviceCollection.AddSingleton<QuestFunctions>(); serviceCollection.AddSingleton<QuestFunctions>();
serviceCollection.AddSingleton<AutoSnipeHandler>();
serviceCollection.AddSingleton<AetherCurrentData>(); serviceCollection.AddSingleton<AetherCurrentData>();
serviceCollection.AddSingleton<AetheryteData>(); serviceCollection.AddSingleton<AetheryteData>();
@ -240,6 +242,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
serviceProvider.GetRequiredService<LeveUiController>(); serviceProvider.GetRequiredService<LeveUiController>();
serviceProvider.GetRequiredService<QuestionableIpc>(); serviceProvider.GetRequiredService<QuestionableIpc>();
serviceProvider.GetRequiredService<DalamudInitializer>(); serviceProvider.GetRequiredService<DalamudInitializer>();
serviceProvider.GetRequiredService<AutoSnipeHandler>().Enable();
} }
public void Dispose() public void Dispose()

View File

@ -90,6 +90,16 @@ internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig
Save(); 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(); ImGui.EndTabItem();
} }

View File

@ -84,7 +84,7 @@ internal sealed partial class ActiveQuestComponent
if (!isMinimized) if (!isMinimized)
{ {
bool colored = currentStep is bool colored = currentStep is
{ InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress }; { InteractionType: EInteractionType.Instruction or EInteractionType.WaitForManualProgress or EInteractionType.Snipe };
if (colored) if (colored)
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange); ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange);
ImGui.TextUnformatted(currentStep?.Comment ?? ImGui.TextUnformatted(currentStep?.Comment ??