Don't know if you solved this, but if not, the problem was that you were trying to update things in the middle of the scan (and also, for some reason, keeping track of the priority from the last scan even though it may not even be relevant for the next one). Here's a better method that will scan
all of the buffs on the unit and only update the display once after the scan is complete.
Code:
local function raid_Auras(self, unit)
local bestPriority, bestIcon, bestType = 0
for i = 1, 40 do
local name, _, icon, _, dtype, duration, _, _, _, _, id, _, isBossDebuff = UnitAura(unit, i)
if not name then break end -- no more auras on this unit
local priority = (list.dispel and list.dispel[dtype]) and 5 or (list.raidAuras and list.raidAuras[name])
if priority and priority > bestPriority then
bestPriority = priority
bestIcon, bestType = icon, dtype
end
end
if bestIcon then
self.Graphics.Auras:Show()
self.Graphics.AurasTexture:SetTexture(bestIcon)
if beauty then
local colour = DebuffTypeColor[dtype] or DebuffTypeColor.none
self.Graphics.Auras:SetBeautyBorderColor(colour.r, colour.g, colour.b)
end
else
self.Graphics.Auras:Hide()
end
end
On a side note, since this function is only looking at buffs, there's no need to check whether each aura is of a type the player can dispel, since dispelling only applies to debuffs. However, I left that in, in case you want to apply the same code to debuffs in the future; I gave dispellable debuffs a priority of 5, since another issue was that they didn't have a priority and thus would probably cause errors when encountered.