From 84fc05d4557a3e17a970aee7cd609d64f36b019f Mon Sep 17 00:00:00 2001 From: Pine Date: Sat, 9 Dec 2023 02:50:56 -0500 Subject: [PATCH] Proper queueing for macros with multiple GCDs. --- Redirect/GameHooks.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Redirect/GameHooks.cs b/Redirect/GameHooks.cs index 27c1592..18e33c6 100644 --- a/Redirect/GameHooks.cs +++ b/Redirect/GameHooks.cs @@ -237,10 +237,6 @@ private unsafe bool TryActionCallback(IntPtr action_manager, ActionType type, ui return TryActionHook.Original(action_manager, type, id, target, param, origin, unk, location); } - // Macro queueing - // Known origins : 0 - bar, 1 - queue, 2 - macro - origin = origin == 2 && Configuration.EnableMacroQueueing ? 0 : origin; - // Actions placed on bars try to use their base action, so we need to get the upgraded version var adjusted_id = ActionManager.MemberFunctionPointers.GetAdjustedActionId((ActionManager*)action_manager, id); @@ -250,6 +246,18 @@ private unsafe bool TryActionCallback(IntPtr action_manager, ActionType type, ui // The actual action that will be used var adjusted_row = Actions.GetRow(adjusted_id); + // Macro queueing with instant exit if it cannot be cast + // Known origins : 0 - bar, 1 - queue, 2 - macro + if (origin == 2 && Configuration.EnableMacroQueueing) { + // Check status, ignoring all cooldowns, just checking if it's available or not. + var status = ActionManager.MemberFunctionPointers.GetActionStatus((ActionManager*)action_manager, type, adjusted_id, (uint)target, false, false, null); + // Do NOT queue if it's unavailable. + if (status == 572) { + return false; + } + origin = 0; + } + if (adjusted_row is null || !adjusted_row.HasOptionalTargeting()) { return TryActionHook.Original(action_manager, type, id, target, param, origin, unk, location); }