diff --git a/ShadowedUnitFrames/modules/auras.lua b/ShadowedUnitFrames/modules/auras.lua index 8f95e0d..4ce8168 100644 --- a/ShadowedUnitFrames/modules/auras.lua +++ b/ShadowedUnitFrames/modules/auras.lua @@ -21,7 +21,12 @@ local COA_CLASS_DISPELS = { local function getCoaDispels() if playerCoaDispels ~= nil then return playerCoaDispels end local cp = _G.C_Player - if cp and cp.IsCustomClass and cp:IsCustomClass() then + if not cp or not cp.IsCustomClass then + -- C_Player not yet initialised (called before PLAYER_LOGIN); don't + -- cache — retry on the next scan so we pick it up once in-world. + return nil + end + if cp:IsCustomClass() then local _, token = UnitClass("player") playerCoaDispels = token and COA_CLASS_DISPELS[token] or false else @@ -337,17 +342,7 @@ local function updateGroup(self, type, config, reverseConfig) -- This is a bit of an odd filter, when used with a HELPFUL filter, it will only return buffs you can cast on group members -- When used with HARMFUL it will only return debuffs you can cure if( config.raid ) then - local coa = group.type == "debuffs" and getCoaDispels() - if coa then - -- CoA custom class: keep filter as plain "HARMFUL" and let scan() - -- apply the per-type check via group.coaRaidFilter. - group.coaRaidFilter = coa - else - group.filter = group.filter .. "|RAID" - group.coaRaidFilter = nil - end - else - group.coaRaidFilter = nil + group.filter = group.filter .. "|RAID" end for id, button in pairs(group.buttons) do @@ -517,6 +512,13 @@ end local function scan(parent, frame, type, config, filter) if( frame.totalAuras >= frame.maxAuras or not config.enabled ) then return end + -- CoA: |RAID is not honoured for custom classes; override with manual type check. + local coaFilter + if filter == "HARMFUL|RAID" then + coaFilter = getCoaDispels() + if coaFilter then filter = "HARMFUL" end + end + local isFriendly = UnitIsFriend(frame.parent.unit, "player") local index = 0 while( true ) do @@ -524,7 +526,7 @@ local function scan(parent, frame, type, config, filter) local name, rank, texture, count, auraType, duration, endTime, caster, isStealable = UnitAura(frame.parent.unit, index, filter) if( not name ) then break end - if( ( not frame.coaRaidFilter or (auraType and frame.coaRaidFilter[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.blacklist[type] and not parent.blacklist[name] ) ) then -- Create any buttons we need frame.totalAuras = frame.totalAuras + 1 if( #(frame.buttons) < frame.totalAuras ) then