mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Add ClassicAPI dispel-type conditionals via C_UnitAuras
Introduce ClassicAPI.lua, a feature-detection layer for the ClassicAPI client mod that mirrors NampowerAPI's HasMinimumVersion pattern (IsAvailable / HasMinimumVersion / HasUnitAuras). UnitHasDispelType scans a unit's auras via C_UnitAuras and reports the dispel type, scanning debuffs or buffs based on a helpful flag. Add conditionals backed by it: - Debuff side (defensive cleanse): [magic] [curse] [disease] [poison] [dispellable] + negations - Buff side (offensive dispel/strip): [magicbuff] [dispellablebuff] + negations All are no-arg booleans, default to @target (honor @unit), and degrade gracefully without ClassicAPI: positive checks return false, negated return true, since vanilla cannot read aura dispel types. The existing ValidateAura path is untouched. MacroErrorChecker auto-accepts them via the Keywords table; they're registered in BOOLEAN_CONDITIONALS so they parse as flags. Loaded after NampowerAPI in the TOC.
This commit is contained in:
@@ -6515,6 +6515,87 @@ CleveRoids.Keywords = {
|
||||
end, conditionals, "nomydebuff")
|
||||
end,
|
||||
|
||||
-- Dispel-type conditionals (ClassicAPI C_UnitAuras).
|
||||
-- [magic]/[curse]/[disease]/[poison] = target has a debuff of that dispel
|
||||
-- type; [dispellable] = target has any dispellable debuff. These require the
|
||||
-- ClassicAPI client mod; without it the positive checks return false and the
|
||||
-- negated checks return true (graceful degradation — vanilla cannot read
|
||||
-- aura dispel types). They honor @unit like [debuff] does.
|
||||
magic = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Magic")
|
||||
end,
|
||||
|
||||
nomagic = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Magic")
|
||||
end,
|
||||
|
||||
curse = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Curse")
|
||||
end,
|
||||
|
||||
nocurse = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Curse")
|
||||
end,
|
||||
|
||||
disease = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Disease")
|
||||
end,
|
||||
|
||||
nodisease = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Disease")
|
||||
end,
|
||||
|
||||
poison = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Poison")
|
||||
end,
|
||||
|
||||
nopoison = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Poison")
|
||||
end,
|
||||
|
||||
dispellable = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "any")
|
||||
end,
|
||||
|
||||
nodispellable = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "any")
|
||||
end,
|
||||
|
||||
-- Buff-side dispel-type conditionals (offensive dispel / strip / purge).
|
||||
-- [magicbuff] = unit has a dispellable Magic buff (the only kind offensive
|
||||
-- dispel removes in 1.12); [dispellablebuff] = unit has any dispel-typed
|
||||
-- buff. Same ClassicAPI requirement and graceful degradation as the debuff
|
||||
-- variants. The `true` arg makes UnitHasDispelType scan buffs, not debuffs.
|
||||
magicbuff = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Magic", true)
|
||||
end,
|
||||
|
||||
nomagicbuff = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "Magic", true)
|
||||
end,
|
||||
|
||||
dispellablebuff = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "any", true)
|
||||
end,
|
||||
|
||||
nodispellablebuff = function(conditionals)
|
||||
if not conditionals.target then return false end
|
||||
return not CleveRoids.ClassicAPI.UnitHasDispelType(conditionals.target, "any", true)
|
||||
end,
|
||||
|
||||
power = function(conditionals)
|
||||
return Multi(conditionals.power, function(args)
|
||||
if type(args) ~= "table" then return false end
|
||||
|
||||
Reference in New Issue
Block a user