diff --git a/AutoHook/AutoHook.cs b/AutoHook/AutoHook.cs index 63d1070..09cd53d 100644 --- a/AutoHook/AutoHook.cs +++ b/AutoHook/AutoHook.cs @@ -24,7 +24,6 @@ public class AutoHook : IDalamudPlugin private static AutoGig AutoGig = null!; - public HookingManager HookManager; PlayerResources PlayerResources; diff --git a/AutoHook/AutoHook.csproj b/AutoHook/AutoHook.csproj index daebdae..c89e499 100644 --- a/AutoHook/AutoHook.csproj +++ b/AutoHook/AutoHook.csproj @@ -2,7 +2,7 @@ Det - 2.4.2.2 + 2.4.2.3 Auto hooks for you https://github.com/InitialDet/AutoHook Release;Debug diff --git a/AutoHook/Classes/AvailableAutoCast.cs b/AutoHook/Classes/AvailableAutoCast.cs index 40e3468..e49c57a 100644 --- a/AutoHook/Classes/AvailableAutoCast.cs +++ b/AutoHook/Classes/AvailableAutoCast.cs @@ -184,7 +184,7 @@ public override bool CastCondition() if (PlayerResources.HasStatus(IDs.Status.PrizeCatch)) return false; - if (PlayerResources.HasStatus(IDs.Status.MakeshiftBait) && !AutoCastsConfig.EnableMakeshiftPatience) + if (PlayerResources.HasStatus(IDs.Status.MakeshiftBait) && !_acConfig.EnableMakeshiftPatience) return false; return true; @@ -208,7 +208,7 @@ public override bool CastCondition() if (PlayerResources.HasStatus(IDs.Status.PrizeCatch)) return false; - if (PlayerResources.HasStatus(IDs.Status.MakeshiftBait) && !AutoCastsConfig.EnableMakeshiftPatience) + if (PlayerResources.HasStatus(IDs.Status.MakeshiftBait) && !_acConfig.EnableMakeshiftPatience) return false; return true; diff --git a/AutoHook/Classes/BaseActionCast.cs b/AutoHook/Classes/BaseActionCast.cs index fa27c69..149ebb0 100644 --- a/AutoHook/Classes/BaseActionCast.cs +++ b/AutoHook/Classes/BaseActionCast.cs @@ -1,18 +1,12 @@ using AutoHook.Configurations; -using AutoHook.Data; using AutoHook.Utils; -using Dalamud.Logging; using FFXIVClientStructs.FFXIV.Client.Game; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace AutoHook.Classes; public abstract class BaseActionCast { protected BaitConfig? _baitConfig = null; + protected readonly static AutoCastsConfig _acConfig = Service.Configuration.AutoCastsCfg; protected BaseActionCast(string name, uint id, ActionType actionType = ActionType.Spell) { @@ -56,7 +50,7 @@ public bool IsAvailableToCast(BaitConfig? baitConfig) if (!Enabled) return false; - if (DoesCancelMooch && AutoCastsConfig.IsMoochAvailable && AutoCastsConfig.DontCancelMooch) + if (DoesCancelMooch && PlayerResources.IsMoochAvailable() && _acConfig.DontCancelMooch) return false; uint currentGp = PlayerResources.GetCurrentGP(); diff --git a/AutoHook/Configurations/AutoCastsConfig.cs b/AutoHook/Configurations/AutoCastsConfig.cs index fc7c1e3..5476eff 100644 --- a/AutoHook/Configurations/AutoCastsConfig.cs +++ b/AutoHook/Configurations/AutoCastsConfig.cs @@ -1,8 +1,6 @@ -using System.Collections.Generic; using AutoHook.Classes; using AutoHook.Data; using AutoHook.Utils; -using Dalamud.Logging; using FFXIVClientStructs.FFXIV.Client.Game; namespace AutoHook.Configurations; @@ -17,9 +15,9 @@ public class AutoCastsConfig public bool OnlyMoochIntuition = false; public bool EnablePatience = false; - public static bool EnableMakeshiftPatience = false; + public bool EnableMakeshiftPatience = false; - public static bool DontCancelMooch = true; + public bool DontCancelMooch = true; public uint SelectedPatienceID = IDs.Actions.Patience2; // Default to Patience2 @@ -53,7 +51,6 @@ public class AutoCastsConfig public bool EnableCordialFirst = false; - public static bool IsMoochAvailable = false; // i could make the code more optimized but im too lazy rn. public AutoCast? GetNextAutoCast(BaitConfig? baitConfig) @@ -63,8 +60,6 @@ public class AutoCastsConfig BaitConfig = baitConfig; - IsMoochAvailable = CheckMoochAvailable(); - if (!PlayerResources.ActionAvailable(IDs.Actions.Cast)) return null; @@ -158,18 +153,6 @@ private bool UseMooch(out uint id) return false; } - private bool CheckMoochAvailable() - { - if (PlayerResources.ActionAvailable(IDs.Actions.Mooch)) - return true; - - else if (PlayerResources.ActionAvailable(IDs.Actions.Mooch2)) - return true; - - return false; - } - - private BaseActionCast? GetCordials() { bool useCordial = false; diff --git a/AutoHook/Ui/TabAutoCasts.cs b/AutoHook/Ui/TabAutoCasts.cs index d69259b..c87e046 100644 --- a/AutoHook/Ui/TabAutoCasts.cs +++ b/AutoHook/Ui/TabAutoCasts.cs @@ -30,7 +30,7 @@ public override void DrawHeader() if (cfg.EnableAll) { ImGui.SameLine(); - if (DrawUtil.Checkbox("Don't Cancel Mooch", ref AutoCastsConfig.DontCancelMooch, "Actions that cancel mooch wont be used (e.g. Chum, Fish Eyes, Prize Catch etc.)")) + if (DrawUtil.Checkbox("Don't Cancel Mooch", ref cfg.DontCancelMooch, "Actions that cancel mooch wont be used (e.g. Chum, Fish Eyes, Prize Catch etc.)")) { Service.Configuration.Save(); } @@ -102,7 +102,7 @@ private void DrawExtraOptionsAutoMooch() Service.Configuration.Save(); } - if (ImGui.Checkbox("Only use when Fisher's Intution is active", ref cfg.OnlyMoochIntuition)) + if (ImGui.Checkbox("Only use when Fisher's Intution is active##fi_mooch", ref cfg.OnlyMoochIntuition)) { Service.Configuration.Save(); } @@ -130,11 +130,11 @@ private void DrawPatience() private void DrawExtraOptionsPatience() { - var enabled = AutoCastsConfig.EnableMakeshiftPatience; + var enabled = cfg.EnableMakeshiftPatience; - if (DrawUtil.Checkbox("Use when Makeshift Bait is active", ref enabled)) + if (DrawUtil.Checkbox("Use when Makeshift Bait is active##patience_makeshift", ref enabled)) { - AutoCastsConfig.EnableMakeshiftPatience = enabled; + cfg.EnableMakeshiftPatience = enabled; Service.Configuration.Save(); } @@ -244,7 +244,7 @@ private void DrawExtraOptionPrizeCatch() if (DrawUtil.Checkbox("Only use when Mooch II is on NOT available - READ >>>", ref cfg.AutoPrizeCatch.UseWhenMoochIIOnCD, ">Make sure 'Use Mooch II' is enabled or else it wont work<\nThis could save you 100gp if going only for mooches")) { } - if (DrawUtil.Checkbox("Only use when Identical Cast is active", ref cfg.AutoPrizeCatch.UseOnlyWithIdenticalCast)) + if (DrawUtil.Checkbox("Only use when Identical Cast is active##ic_prize_catch", ref cfg.AutoPrizeCatch.UseOnlyWithIdenticalCast)) { } } @@ -267,7 +267,7 @@ private void DrawChum() private void DrawExtraOptionsChum() { - if (DrawUtil.Checkbox("Only use when Fisher's Intution is active", ref cfg.AutoChum.OnlyUseWithIntuition)) + if (DrawUtil.Checkbox("Only use when Fisher's Intution is active##fi_chum", ref cfg.AutoChum.OnlyUseWithIntuition)) { } } diff --git a/AutoHook/Ui/TabBaseConfig.cs b/AutoHook/Ui/TabBaseConfig.cs index f945ae8..58d3449 100644 --- a/AutoHook/Ui/TabBaseConfig.cs +++ b/AutoHook/Ui/TabBaseConfig.cs @@ -208,7 +208,7 @@ public void DrawCheckBoxDoubleTripleHook(BaitConfig cfg) ImGui.TextColored(ImGuiColors.DalamudYellow, "Double/Triple Hook Settings"); ImGui.Spacing(); - ImGui.Checkbox("Only use when Identical Cast is active", ref cfg.UseDHTHOnlySurfaceSlap); + ImGui.Checkbox("Only use when Identical Cast is active##surface_slap", ref cfg.UseDHTHOnlySurfaceSlap); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); @@ -298,7 +298,7 @@ public void DrawAutoMooch(BaitConfig cfg) Service.Configuration.Save(); } - if (ImGui.Checkbox("Only use when Fisher's Intution is active", ref cfg.OnlyMoochIntuition)) + if (ImGui.Checkbox("Only use when Fisher's Intution is active##Mooch", ref cfg.OnlyMoochIntuition)) { Service.Configuration.Save(); } diff --git a/AutoHook/Ui/TabGeneral.cs b/AutoHook/Ui/TabGeneral.cs index 4cf8d9a..69edf07 100644 --- a/AutoHook/Ui/TabGeneral.cs +++ b/AutoHook/Ui/TabGeneral.cs @@ -144,15 +144,17 @@ private void DrawChangelog() ImGui.TextWrapped("- Added changelog button"); ImGui.Separator(); - ImGui.TextWrapped("2.4.2.1"); - ImGui.TextWrapped("- Gig hitbox enabled by default"); - ImGui.Separator(); - ImGui.Spacing(); + + if (ImGui.TreeNode("2.4.2.X - Small Fixes")) + { + ImGui.TextWrapped("- Gig hitbox is now enabled by default"); + ImGui.TextWrapped("- Fixed the order of the Chum Timer Min/Max fields"); + ImGui.TextWrapped("- Fixed some options not saving correctly"); + ImGui.TreePop(); + } - ImGui.TextWrapped("2.4.2.2"); - ImGui.TextWrapped("- Fixed order of Chum Timer Min/Max fields"); ImGui.Separator(); - ImGui.Spacing(); + ImGui.Spacing(); if (ImGui.BeginChild("old_versions", new Vector2(0, 150), true)) { diff --git a/AutoHook/Utils/PlayerResources.cs b/AutoHook/Utils/PlayerResources.cs index 3a33c82..20d9a8a 100644 --- a/AutoHook/Utils/PlayerResources.cs +++ b/AutoHook/Utils/PlayerResources.cs @@ -45,6 +45,18 @@ public void Dispose() //receiveActionEffectHook?.Disable(); } + + public static bool IsMoochAvailable() + { + if (ActionAvailable(IDs.Actions.Mooch)) + return true; + + else if (ActionAvailable(IDs.Actions.Mooch2)) + return true; + + return false; + } + public static bool HasStatus(uint statusID) { if (Service.ClientState.LocalPlayer?.StatusList == null) @@ -141,7 +153,6 @@ public static unsafe float GetPotCooldown() public static unsafe bool HaveItemInInventory(uint id, bool isHQ = false) => InventoryManager.Instance()->GetInventoryItemCount(id, isHQ) > 0; - static bool isCastingDelay = false; static uint NextActionID = 0; static uint LastActionID = 0; @@ -179,7 +190,6 @@ public static void CastActionDelayed(uint id, ActionType actionType = ActionType } } - static bool isCastingNoDelay = false; public static void CastActionNoDelay(uint id, ActionType actionType = ActionType.Spell) @@ -203,23 +213,6 @@ public static void CastActionNoDelay(uint id, ActionType actionType = ActionType isCastingNoDelay = false; } - /* - private void ReceiveActionEffectDetour(int sourceObjectId, IntPtr sourceActor, IntPtr position, IntPtr effectHeader, IntPtr effectArray, IntPtr effectTrail) - { - receiveActionEffectHook!.Original(sourceObjectId, sourceActor, position, effectHeader, effectArray, effectTrail); - - ActionEffectHeader header = Marshal.PtrToStructure(effectHeader); - - if (sourceObjectId == Service.ClientState.LocalPlayer?.ObjectId) - { - if (header.ActionId == LastActionID) - { - LastActionID = NextActionID; - ResetAutoCast(); - } - } - }*/ - public static async void ResetAutoCast() { if (delay <= 0) @@ -247,14 +240,4 @@ private static int ConditionalDelay() => _ => 0, }; - [StructLayout(LayoutKind.Explicit)] - private struct ActionEffectHeader - { - [FieldOffset(0x0)] public long TargetObjectId; - [FieldOffset(0x8)] public uint ActionId; - [FieldOffset(0x14)] public uint UnkObjectId; - [FieldOffset(0x18)] public ushort Sequence; - [FieldOffset(0x1A)] public ushort Unk_1A; - } - }