mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Migrate to ClassicAPI for macro display, auras and timing
Squash of the classicapi_next branch (10 commits). ClassicAPI is now a hard requirement, and the Lua-side reimplementations it supersedes are gone: net -1087 lines across 12 files. Macro display: resolved macro actions are published through C_Macro.SetMacroDisplay, so the client draws macro buttons and the action-bar function overrides this addon used to install are removed. Ownership is per macro -- ClassicAPI keeps the macros we never claim. Auras and timing: ClassicAPI is the source of truth for non-player aura timing via the positional C_UnitAuras.UnitAura, replacing the write-only buff tracking tables and the overflow-slot fallback. Cleanup: the hasPfUI76 flag and the pfUI 7.6 branches it gated, two silently-shadowed code paths, and per-call allocations in the event and publish paths (SPELL_CAST_EVENT merged). Packaging moves to brues-code/packager@vCAPI. Macro syntax: a clause may carry a leading run of [group] blocks sharing one action, Blizzard-style -- groups are OR'd, first pass wins, and [] always passes. The ;-separated form is unchanged and mixes freely. @focus clauses with no focus set now fail quietly instead of printing "Invalid target" on the way past.
This commit is contained in:
+40
-24
@@ -697,30 +697,9 @@ local function EnsureCondHighlightPool()
|
||||
end
|
||||
end
|
||||
|
||||
-- Test whether conditionals pass for a given command + alternative text.
|
||||
-- Returns: true (passes), false (fails), nil (unconditional / no conditionals)
|
||||
local function TestConditionalPasses(cmd, alternative)
|
||||
-- Strip ? tooltip hints (irrelevant for conditional evaluation)
|
||||
if string.find(alternative, "?", 1, true) then
|
||||
alternative = string.gsub(alternative, "%?", "")
|
||||
end
|
||||
|
||||
local hasConditional = string.find(alternative, "%[") ~= nil
|
||||
|
||||
-- Dynamic commands: delegate to TestAction
|
||||
if CleveRoids.dynamicCmds[cmd] then
|
||||
local result = CleveRoids.TestAction(cmd, alternative)
|
||||
if not hasConditional then
|
||||
return nil -- unconditional
|
||||
end
|
||||
return result ~= nil and result ~= false
|
||||
end
|
||||
|
||||
-- Non-dynamic commands: parse and evaluate Keywords manually
|
||||
if not hasConditional then
|
||||
return nil -- unconditional
|
||||
end
|
||||
|
||||
-- Evaluate one single-group clause of a non-dynamic command against Keywords.
|
||||
-- Returns: true (passes), false (fails), nil (could not parse)
|
||||
local function EvaluateNonDynamic(alternative)
|
||||
local ok, action, conditionals = pcall(CleveRoids.GetParsedMsg, alternative)
|
||||
if not ok or not conditionals then
|
||||
return nil
|
||||
@@ -745,6 +724,43 @@ local function TestConditionalPasses(cmd, alternative)
|
||||
return passes
|
||||
end
|
||||
|
||||
-- Test whether conditionals pass for a given command + alternative text.
|
||||
-- Returns: true (passes), false (fails), nil (unconditional / no conditionals)
|
||||
local function TestConditionalPasses(cmd, alternative)
|
||||
-- Strip ? tooltip hints (irrelevant for conditional evaluation)
|
||||
if string.find(alternative, "?", 1, true) then
|
||||
alternative = string.gsub(alternative, "%?", "")
|
||||
end
|
||||
|
||||
local hasConditional = string.find(alternative, "%[") ~= nil
|
||||
|
||||
-- Dynamic commands: delegate to TestAction
|
||||
if CleveRoids.dynamicCmds[cmd] then
|
||||
local result = CleveRoids.TestAction(cmd, alternative)
|
||||
if not hasConditional then
|
||||
return nil -- unconditional
|
||||
end
|
||||
return result ~= nil and result ~= false
|
||||
end
|
||||
|
||||
-- Non-dynamic commands: evaluate Keywords manually. `[a][b] X` passes when
|
||||
-- any of its groups does.
|
||||
if not hasConditional then
|
||||
return nil -- unconditional
|
||||
end
|
||||
|
||||
local variants = CleveRoids.ExpandBracketGroups(alternative)
|
||||
if not variants then
|
||||
return EvaluateNonDynamic(alternative)
|
||||
end
|
||||
for i = 1, variants.n do
|
||||
if EvaluateNonDynamic(variants[i]) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
-- Find character offset ranges for each semicolon-separated alternative.
|
||||
-- Returns array of { start, finish } pairs (1-based indices within argsText).
|
||||
local function FindAlternativeOffsets(argsText)
|
||||
|
||||
Reference in New Issue
Block a user