1
0
Fork 0

Add snipe cheat

chore-fix-dt-dungeon-unlock
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
},
"TerritoryId": 622,
"InteractionType": "Instruction",
"InteractionType": "Snipe",
"Comment": "Snipe sheep"
}
]

View File

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

View File

@ -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"
}
]

View File

@ -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"
}

View File

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

View File

@ -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"
}
]

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
}
]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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"
}

View File

@ -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"
}
]

View File

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

View File

@ -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"
}
]

View File

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

View File

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

View File

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

View File

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

View File

@ -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

View File

@ -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<ITask> 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;

View File

@ -49,6 +49,7 @@ internal static class WaitAtEnd
case EInteractionType.WaitForManualProgress:
case EInteractionType.Instruction:
case EInteractionType.Snipe:
return [new WaitNextStepOrSequence()];
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.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<GameFunctions>();
serviceCollection.AddSingleton<ChatFunctions>();
serviceCollection.AddSingleton<QuestFunctions>();
serviceCollection.AddSingleton<AutoSnipeHandler>();
serviceCollection.AddSingleton<AetherCurrentData>();
serviceCollection.AddSingleton<AetheryteData>();
@ -240,6 +242,7 @@ public sealed class QuestionablePlugin : IDalamudPlugin
serviceProvider.GetRequiredService<LeveUiController>();
serviceProvider.GetRequiredService<QuestionableIpc>();
serviceProvider.GetRequiredService<DalamudInitializer>();
serviceProvider.GetRequiredService<AutoSnipeHandler>().Enable();
}
public void Dispose()

View File

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

View File

@ -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 ??