Originally Posted by Munglunch
So I can't be positive without testing the full code (im at work so I can't for another hour) BUT here is something to hopefully point you in the right direction.
Your event function has no restriction on what unit its referencing aura-wise (not sure how much this matters in context)
I added an extra key to the "indicators" object that can hold the frames unit token
Lua Code:
if cfg.indicators.enable then local indicators = CreateFrame("Frame", nil ,self) indicators:SetAllPoints(true) indicators:EnableMouse(false) self.indicators = indicators self.indicators.unit = unit -- Build the indicators for i = 1, #indicatorPositions do local position = indicatorPositions[i] local indicator = CreateFrame("Frame", nil, indicators) indicator:Hide() indicator:SetPoint(position) indicator:SetSize(5, 5) indicator:SetBackdrop(indicatorBackdrop) indicator.aura = cfg.indicators["aura"..i] indicators[position] = indicator end -- Register the event on the frame itself self:RegisterEvent("UNIT_AURA", UpdateIndicators) end
...which can then be referenced in the event function. Also don't know if "SetShown" will evaluate a string return as true or not so I altered it slightly.
Lua Code:
local function UpdateIndicators(self, event, unit) if(unit ~= self.indicators.unit) then return end for i = 1, #indicatorPositions do local position = indicatorPositions[i] local indicator = self.indicators[position] indicator:SetShown(UnitBuff(unit, indicator.aura) ~= nil) end end
..again just to help give perspective.
|
Perspective is better than nothing