From 0e07eafbf9d0ae48a6523cf125785aa70e5e8b3c Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 27 Jul 2026 22:32:01 -0500 Subject: [PATCH] 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. --- ClassicAPI.lua | 19 +++++++++++++++++++ Conditionals.lua | 20 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/ClassicAPI.lua b/ClassicAPI.lua index 3da1921..c481b90 100644 --- a/ClassicAPI.lua +++ b/ClassicAPI.lua @@ -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 -------------------------------------------------------------------------------- diff --git a/Conditionals.lua b/Conditionals.lua index 5bd365b..8a072c0 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -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