mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Add conditional support to /equipset via ClassicAPI equipment sets
ClassicAPI registers a bare /equipset that resolves a name and calls C_EquipmentSet.UseEquipmentSet with no conditional layer. DoEquipSet routes it through DoWithConditionals like the other /equip* commands, so it gains [combat]/[mod]/@unit/etc. and ';'-separated fallthrough (first set whose conditionals pass wins). Console.lua reclaims the EQUIP_SET handler (keeping ClassicAPI's localized aliases) and falls back to registering /equipset itself if the API command isn't present.
This commit is contained in:
@@ -3596,6 +3596,32 @@ function CleveRoids.DoEquipRing2(msg)
|
||||
return false
|
||||
end
|
||||
|
||||
-- Equip a ClassicAPI equipment set by name. msg is the resolved set name (after
|
||||
-- conditional parsing). ClassicAPI's own /equipset is a bare
|
||||
-- GetEquipmentSetID -> UseEquipmentSet with no conditional support; routing it
|
||||
-- through DoWithConditionals adds [combat]/[mod]/@unit/etc. and ";"-separated
|
||||
-- fallthrough (first set whose conditionals pass wins). Nil-guarded so a client
|
||||
-- without the EquipmentSet API just no-ops instead of erroring.
|
||||
local function _equipSetAction(msg)
|
||||
if not msg or msg == "" then return false end
|
||||
if type(C_EquipmentSet) ~= "table" then return false end
|
||||
local setID = C_EquipmentSet.GetEquipmentSetID(msg)
|
||||
if not setID then return false end
|
||||
C_EquipmentSet.UseEquipmentSet(setID)
|
||||
return true
|
||||
end
|
||||
|
||||
function CleveRoids.DoEquipSet(msg)
|
||||
local parts = CleveRoids.splitStringIgnoringQuotes(msg)
|
||||
for i = 1, table.getn(parts) do
|
||||
local v = string.gsub(parts[i], "^%?", "")
|
||||
if CleveRoids.DoWithConditionals(v, _equipSetAction, CleveRoids.FixEmptyTarget, false, _equipSetAction) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function CleveRoids.DoCancelForm(msg)
|
||||
local handled
|
||||
-- PERFORMANCE: Use numeric iteration to avoid pairs() iterator allocation
|
||||
|
||||
Reference in New Issue
Block a user