From d241fd1b5e2e33e8a371bab8e1c4c73c09a5c5c9 Mon Sep 17 00:00:00 2001 From: Florian Berthold Date: Sun, 31 May 2026 15:11:21 +0200 Subject: [PATCH] feat(filters): match aura whitelist/blacklist by spell ID, not just name CoA's 3.3.5 client returns spellId as the 11th UnitAura value (stock 3.3.5a stops at 10). The scan loop now captures it and the whitelist/blacklist match on name OR spellId. The filter 'add' box accepts a numeric spell ID (stored as a numeric key so it matches UnitAura's spellId) and the list view resolves IDs to 'Name (ID)' via GetSpellInfo. Fixes ambiguity from name-only matching where CoA custom spells share display names across ranks/variants. --- ShadowedUF_Options/config.lua | 19 +++++++++++++++---- ShadowedUnitFrames/localization/enUS.lua | 2 ++ ShadowedUnitFrames/modules/auras.lua | 8 +++++--- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ShadowedUF_Options/config.lua b/ShadowedUF_Options/config.lua index f895b76..91f346a 100644 --- a/ShadowedUF_Options/config.lua +++ b/ShadowedUF_Options/config.lua @@ -3760,14 +3760,17 @@ local function loadFilterOptions() add = { order = 0, type = "input", - name = L["Aura name"], + name = L["Aura name or spell ID"], + desc = L["Enter an exact aura name, or a numeric spell ID for precise matching (CoA's client exposes aura spell IDs)."], --dialogControl = "Aura_EditBox", hidden = false, set = function(info, value) local filterType = info[#(info) - 3] local filter = filterMap[info[#(info) - 2]] - ShadowUF.db.profile.filters[filterType][filter][value] = true + -- A purely-numeric entry is stored as a number so it matches the + -- spellId returned by UnitAura; anything else stays a name string. + ShadowUF.db.profile.filters[filterType][filter][tonumber(value) or value] = true reloadUnitAuras() rebuildFilters() @@ -3844,9 +3847,17 @@ local function loadFilterOptions() type = "description", -- Odd I know, AceConfigDialog-3.0 expands descriptions to full width if width is nil -- on the other hand we can't set width to "normal" so tricking it - width = "", + width = "", fontSize = "medium", - name = function(info) return spellMap[info[#(info)]] end, + name = function(info) + local entry = spellMap[info[#(info)]] + -- Numeric entries are spell IDs; show "Name (ID)" when the client can resolve it. + if( type(entry) == "number" ) then + local spellName = GetSpellInfo(entry) + return spellName and string.format("%s (%d)", spellName, entry) or tostring(entry) + end + return entry + end, } local spellRow = { diff --git a/ShadowedUnitFrames/localization/enUS.lua b/ShadowedUnitFrames/localization/enUS.lua index dc6c48f..e895bce 100644 --- a/ShadowedUnitFrames/localization/enUS.lua +++ b/ShadowedUnitFrames/localization/enUS.lua @@ -48,6 +48,8 @@ L["Ascending"] = "Ascending" L["Aura border style"] = "Aura border style" L["Aura filters"] = "Aura filters" L["Aura name"] = "Aura name" +L["Aura name or spell ID"] = "Aura name or spell ID" +L["Enter an exact aura name, or a numeric spell ID for precise matching (CoA's client exposes aura spell IDs)."] = "Enter an exact aura name, or a numeric spell ID for precise matching (CoA's client exposes aura spell IDs)." L["Auras"] = "Auras" L["Aura types to filter"] = "Aura types to filter" L["B"] = "B" diff --git a/ShadowedUnitFrames/modules/auras.lua b/ShadowedUnitFrames/modules/auras.lua index a7e6e65..f8ae826 100644 --- a/ShadowedUnitFrames/modules/auras.lua +++ b/ShadowedUnitFrames/modules/auras.lua @@ -531,10 +531,12 @@ local function scan(parent, frame, type, config, filter) local index = 0 while( true ) do index = index + 1 - local name, rank, texture, count, auraType, duration, endTime, caster, isStealable = UnitAura(frame.parent.unit, index, filter) + -- CoA's 3.3.5 client returns spellId as the 11th value (stock 3.3.5a stops at 10), + -- which lets the whitelist/blacklist match by ID as well as by name. + local name, rank, texture, count, auraType, duration, endTime, caster, isStealable, _, spellId = UnitAura(frame.parent.unit, index, filter) if( not name ) then break end - - if( ( not coaFilter or (auraType and coaFilter[auraType]) ) and ( not config.player or playerUnits[caster] ) and ( not parent.whitelist[type] and not parent.blacklist[type] or parent.whitelist[type] and parent.whitelist[name] or parent.blacklist[type] and not parent.blacklist[name] ) ) then + + if( ( not coaFilter or (auraType and coaFilter[auraType]) ) and ( not config.player or playerUnits[caster] ) and ( not parent.whitelist[type] and not parent.blacklist[type] or parent.whitelist[type] and ( parent.whitelist[name] or parent.whitelist[spellId] ) or parent.blacklist[type] and not ( parent.blacklist[name] or parent.blacklist[spellId] ) ) ) then -- Create any buttons we need frame.totalAuras = frame.totalAuras + 1 if( #(frame.buttons) < frame.totalAuras ) then