fix cleartarget conditional

This commit is contained in:
Jrc13245
2026-03-07 16:34:26 -05:00
parent bed3bb7f1a
commit 470ad3fd24
2 changed files with 30 additions and 0 deletions
+12
View File
@@ -134,6 +134,18 @@ SlashCmdList.CLEARTARGET = ClearTarget
-- HOOK DEFINITIONS START
----------------------------------
-- /cleartarget hook
CleveRoids.Hooks.CLEARTARGET_SlashCmd = SlashCmdList.CLEARTARGET
SlashCmdList.CLEARTARGET = function(msg)
if CleveRoids.stopMacroFlag then return end
msg = msg or ""
if string.find(msg, "%[") then
CleveRoids.DoConditionalClearTarget(msg)
else
CleveRoids.Hooks.CLEARTARGET_SlashCmd()
end
end
-- /startattack hook
CleveRoids.Hooks.STARTATTACK_SlashCmd = SlashCmdList.STARTATTACK
SlashCmdList.STARTATTACK = function(msg)
+18
View File
@@ -3036,6 +3036,24 @@ function CleveRoids.DoConditionalStopCasting(msg)
return false
end
local function _clearTargetAction()
ClearTarget()
end
-- Attempts to conditionally clear target. Returns false if no conditionals are found.
function CleveRoids.DoConditionalClearTarget(msg)
if not string.find(msg, "%[") then return false end
-- PERFORMANCE: Use numeric iteration to avoid pairs() iterator allocation
local parts = CleveRoids.splitStringIgnoringQuotes(msg)
for i = 1, table.getn(parts) do
if CleveRoids.DoWithConditionals(parts[i], nil, CleveRoids.FixEmptyTarget, false, _clearTargetAction) then
return true
end
end
return false
end
-- Attempts to use or equip an item by a set of conditionals
-- Also checks if a condition is a spell so that you can mix item and spell use
-- msg: The raw message intercepted from a /use or /equip command