fix stopmacro usability broken due to removal of nampower handling

This commit is contained in:
Jrc13245
2025-12-15 08:34:57 -05:00
parent 1c76c12ff1
commit 8a97fa849c
3 changed files with 39 additions and 9 deletions
+19 -8
View File
@@ -19,7 +19,7 @@ do
-- naturally via SuperMacro_RunMacro. This avoids conflicts with SuperMacro's keybinding system.
local INTERCEPT = {
cast=true, castsequence=true, use=true,
startattack=true, stopattack=true, stopcasting=true,
startattack=true, stopattack=true, stopcasting=true, stopmacro=true,
target=true, retarget=true, cancelaura=true, unbuff=true,
unqueue=true, unshift=true, equip=true, equipmh=true, equipoh=true,
-- runmacro intentionally NOT included - see note above
@@ -62,6 +62,11 @@ do
CRM.Hooks.RunLine = CRM.Hooks.RunLine or orig_RunLine
_G.RunLine = function(...)
-- Check stopmacro flag before processing any line
if CRM.stopMacroFlag then
return true -- Skip this line, tell SM we handled it
end
-- SuperMacro calls RunLine(line) one line at a time; handle first arg.
local text = arg and arg[1]
@@ -114,15 +119,21 @@ do
CRM.SM_RunLineHooked = true
-- Redirect global RunMacro to SuperMacro_RunMacro so all macro execution
-- goes through RunLine (where our hook intercepts CRM commands).
-- This ensures both SuperMacro and CleveRoids features work together.
-- Hook SuperMacro_RunMacro to clear stopmacro flag at macro start
-- and redirect global RunMacro so all macro execution goes through RunLine
if type(_G.SuperMacro_RunMacro) == "function" then
_G.RunMacro = function(index)
return _G.SuperMacro_RunMacro(index)
local orig_SuperMacro_RunMacro = _G.SuperMacro_RunMacro
CRM.Hooks.SuperMacro_RunMacro = orig_SuperMacro_RunMacro
local function hooked_RunMacro(index)
-- Clear stopmacro flag at macro start
CRM.stopMacroFlag = false
return orig_SuperMacro_RunMacro(index)
end
-- Also update the Macro alias
_G.Macro = _G.SuperMacro_RunMacro
_G.SuperMacro_RunMacro = hooked_RunMacro
_G.RunMacro = hooked_RunMacro
_G.Macro = hooked_RunMacro
end
end
+17 -1
View File
@@ -1217,11 +1217,21 @@ function CleveRoids.ExecuteMacroBody(body,inline)
local lines = CleveRoids.splitString(body, "\n")
if inline then lines = CleveRoids.splitString(body, "\\n"); end
-- Clear stopmacro flag at start of macro execution
CleveRoids.stopMacroFlag = false
if CleveRoids.macroRefDebug then
CleveRoids.Print("|cff00ffff[MacroRef]|r ExecuteMacroBody called with " .. table.getn(lines) .. " lines")
end
for k,v in pairs(lines) do
-- Check stopmacro flag before each line
if CleveRoids.stopMacroFlag then
if CleveRoids.macroRefDebug then
CleveRoids.Print("|cffff8800[MacroRef]|r Stopped at line " .. k .. " due to /stopmacro")
end
break
end
if CleveRoids.macroRefDebug then
CleveRoids.Print("|cff88ff88[MacroRef]|r Executing line " .. k .. ": " .. string.sub(v, 1, 60))
end
@@ -2091,7 +2101,8 @@ function CleveRoids.DoWithConditionals(msg, hook, fixEmptyTargetFunc, targetBefo
end
if action == "STOPMACRO" then
-- No-op: Nampower DLL handles spell queue timing natively
-- Set flag to stop subsequent lines in current macro
CleveRoids.stopMacroFlag = true
return true
end
@@ -3639,6 +3650,11 @@ local function CRM_SM_InstallHook()
}
RunLine = function(...)
-- Check stopmacro flag before processing any line
if CleveRoids.stopMacroFlag then
return true -- Skip this line, tell SM we handled it
end
local text = (arg and arg[1]) or nil
if type(text) == "string" then
+3
View File
@@ -120,6 +120,9 @@ CleveRoids._originalArgsBuffer = {}
CleveRoids.queuedSpell = nil
CleveRoids.lastCastSpell = nil
-- Macro execution control
CleveRoids.stopMacroFlag = false
CleveRoids.ignoreKeywords = {
action = true,
ignoretooltip = true,