mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Add [equipset]/[noequipset] conditionals for equipment sets
Checks whether a saved ClassicAPI equipment set is currently equipped, via C_EquipmentSet.GetEquipmentSetInfo's isEquipped flag (wrapped as ClassicAPI.IsEquipmentSetEquipped). Named [equipset] rather than [set] to avoid colliding with the existing tier/item-set piece-count conditional. Supports OR-lists ([equipset:Raid/Farm]) and negation ([noequipset:PvP]). Pairs with the conditional /equipset command: swap with one, branch on the other.
This commit is contained in:
@@ -155,6 +155,25 @@ function API.GetItemSetInfo(setID)
|
||||
return C_Item.GetItemSetInfo(setID)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Equipment Set
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- True if the saved equipment set named `name` is currently equipped -- every
|
||||
-- resolvable item in its target slot (a missing bank-stored piece doesn't
|
||||
-- disqualify, matching C_EquipmentSet.GetEquipmentSetInfo's isEquipped). Name is
|
||||
-- an exact, case-sensitive match per GetEquipmentSetID. Returns false for an
|
||||
-- unknown name or a client without the EquipmentSet API. Powers [equipset]/
|
||||
-- [noequipset]; the swap side is the reclaimed /equipset command.
|
||||
function API.IsEquipmentSetEquipped(name)
|
||||
if not name or name == "" then return false end
|
||||
if type(C_EquipmentSet) ~= "table" then return false end
|
||||
local setID = C_EquipmentSet.GetEquipmentSetID(name)
|
||||
if not setID then return false end
|
||||
local _, _, _, isEquipped = C_EquipmentSet.GetEquipmentSetInfo(setID)
|
||||
return isEquipped and true or false
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Spell
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@@ -5836,6 +5836,26 @@ CleveRoids.Keywords = {
|
||||
end, conditionals, "noset")
|
||||
end,
|
||||
|
||||
-- [equipset:Name] — true if the saved equipment set "Name" is currently
|
||||
-- equipped (ClassicAPI equipment manager, distinct from [set] tier pieces).
|
||||
-- [equipset:Raid/PvP] = either set equipped. Names are case-sensitive; use _
|
||||
-- for spaces, e.g. [equipset:My_Raid_Set].
|
||||
equipset = function(conditionals)
|
||||
return Multi(conditionals.equipset, function(v)
|
||||
local name = (type(v) == "table") and v.name or v
|
||||
return CleveRoids.ClassicAPI.IsEquipmentSetEquipped(name)
|
||||
end, conditionals, "equipset")
|
||||
end,
|
||||
|
||||
-- [noequipset:Name] — true if that equipment set is NOT currently equipped.
|
||||
-- [noequipset:Raid/PvP] = neither equipped (De Morgan's).
|
||||
noequipset = function(conditionals)
|
||||
return NegatedMulti(conditionals.noequipset, function(v)
|
||||
local name = (type(v) == "table") and v.name or v
|
||||
return not CleveRoids.ClassicAPI.IsEquipmentSetEquipped(name)
|
||||
end, conditionals, "noequipset")
|
||||
end,
|
||||
|
||||
-- [inbag:Item] — true if item exists in bags or equipped
|
||||
-- [inbag:Item<12] — true if bag count of Item is less than 12
|
||||
-- Supports multi-value: [inbag:Item1/Item2 inbag:Item3] = (Item1 OR Item2) AND Item3
|
||||
|
||||
Reference in New Issue
Block a user