mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Alias [mouseuse] to [cursor] via a conditional alias table
Adds CleveRoids.conditionalAliases, applied in ParseMsg so a deprecated name is rewritten to its current keyword before anything downstream (evaluation, _groups) sees it. This is the mechanism for renamed modifiers, which -- unlike predicates such as [stl] -> [stealth] -- have no Keywords function an alias could simply point at. [mouseuse] now resolves to [cursor], routing old macros through ClassicAPI's C_Spell.CastAtCursor / C_Item.UseAtCursor. Drops the post-cast block that cast normally and then faked a mouse click via CameraOrSelectOrMoveStart/Stop to place the AoE circle, along with its workaround for that call spuriously starting auto-attack. MacroErrorChecker seeds VALID_CONDITIONALS from the alias table, so the old names stay valid syntax without needing a placeholder ignoreKeywords entry.
This commit is contained in:
@@ -1933,6 +1933,9 @@ function CleveRoids.ParseMsg(msg)
|
||||
-- e.g., distance:30:facing>1 → condition="distance", args="30:facing>1")
|
||||
local conditionGroup = CleveRoids.splitStringIgnoringQuotes(conditionGroups, ":")
|
||||
local condition = conditionGroup[1]
|
||||
-- Rewrite deprecated names (e.g. mouseuse -> cursor) so old macros
|
||||
-- keep working and only the current keyword exists downstream.
|
||||
condition = CleveRoids.conditionalAliases[condition] or condition
|
||||
local args = conditionGroup[2]
|
||||
for _cgi = 3, table.getn(conditionGroup) do
|
||||
args = (args or "") .. ":" .. conditionGroup[_cgi]
|
||||
@@ -2586,22 +2589,6 @@ function CleveRoids.DoWithConditionals(msg, hook, fixEmptyTargetFunc, targetBefo
|
||||
end
|
||||
end
|
||||
|
||||
-- [mouseuse] modifier: auto-click the AOE targeting circle at cursor position
|
||||
if conditionals.mouseuse and SpellIsTargeting() then
|
||||
local wasAttacking = CleveRoids.CurrentSpell.autoAttack
|
||||
CameraOrSelectOrMoveStart()
|
||||
CameraOrSelectOrMoveStop()
|
||||
-- CameraOrSelectOrMoveStart can start auto-attack as a side effect.
|
||||
-- Stop it immediately if it wasn't active before.
|
||||
if not wasAttacking then
|
||||
local slot = CleveRoids.GetProxyActionSlot(CleveRoids.Localized.Attack)
|
||||
if slot and CleveRoids.Hooks.IsCurrentAction(slot) then
|
||||
AttackTarget()
|
||||
CleveRoids.CurrentSpell.autoAttack = false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if needRetarget then
|
||||
TargetLastTarget()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user