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
|
||||
|
||||
@@ -187,11 +187,19 @@ CleveRoids.ignoreKeywords = {
|
||||
_operators = true, -- Metadata for AND/OR operator tracking
|
||||
_groups = true, -- Grouped conditional values for AND/OR evaluation
|
||||
multiscan = true, -- Processed before Keywords loop (target resolution)
|
||||
mouseuse = true, -- Post-cast modifier: auto-click AOE targeting circle at cursor
|
||||
cursor = true, -- Modifier: place ground-target spell/item at cursor (CastAtCursor)
|
||||
stopattack = true, -- Post-cast modifier: stop autoattack after cast (CheapShot pattern)
|
||||
}
|
||||
|
||||
-- Deprecated conditional names, rewritten to their current keyword in ParseMsg
|
||||
-- before anything downstream (evaluation, _groups) sees them. This is the path
|
||||
-- for renamed *modifiers* -- ignoreKeywords entries, which have no Keywords
|
||||
-- predicate that an alias could just point at the way [stl] does for [stealth].
|
||||
-- MacroErrorChecker also reads this table, so the old names stay valid syntax.
|
||||
CleveRoids.conditionalAliases = {
|
||||
mouseuse = "cursor", -- pre-ClassicAPI name, back when it clicked the AoE reticle
|
||||
}
|
||||
|
||||
-- TODO: Localize?
|
||||
CleveRoids.countedItemTypes = {
|
||||
["Consumable"] = true,
|
||||
|
||||
@@ -35,6 +35,14 @@ if CleveRoids.ignoreKeywords then
|
||||
end
|
||||
end
|
||||
|
||||
-- Deprecated names still valid in macros; ParseMsg rewrites them to the current
|
||||
-- keyword, so they never reach Keywords/ignoreKeywords under their old name.
|
||||
if CleveRoids.conditionalAliases then
|
||||
for alias, _ in pairs(CleveRoids.conditionalAliases) do
|
||||
VALID_CONDITIONALS[alias] = true
|
||||
end
|
||||
end
|
||||
|
||||
-- Known valid commands
|
||||
local VALID_COMMANDS = {
|
||||
-- Core commands NOT registered via SlashCmdList (so not auto-discoverable):
|
||||
|
||||
Reference in New Issue
Block a user