coa: fix CoA dispel detection timing in SUF aura scan

Previous approach baked playerCoaDispels into group.coaRaidFilter during
OnLayoutApplied, which can fire before PLAYER_LOGIN when C_Player isn't
ready yet — Venomancer and other CoA classes got cached as false and
never re-evaluated.

Fix: move all CoA logic into scan() itself so it runs on every
PLAYER_ENTERING_WORLD update. getCoaDispels() no longer caches when
C_Player is unavailable (returns nil without storing), so the first
successful in-world call populates it correctly.

updateGroup() is restored to its original form — no group.coaRaidFilter.
scan() intercepts filter=="HARMFUL|RAID", calls getCoaDispels(), and if
a dispel set is found strips |RAID and applies the per-type check inline.
This commit is contained in:
2026-05-17 10:52:50 +02:00
parent 9679966f37
commit 48ebec985b
+14 -12
View File
@@ -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
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