View Single Post
02-21-17, 06:41 PM   #1
Baggyman
A Deviate Faerie Dragon
Join Date: Jan 2016
Posts: 12
Buff Location on Raid Frame

I'm trying to make an addon that will redirect my rejuvenations to the top right of my raid frames instead of the bottom right as resto druids have so many hots it can be hard to distinguish them especially with germination.

I would really appreciate any help, this is what I have so far:

local indicators = {}
local buffs = {“Rejuvenation”}


local function getIndicator(frame)
local indicator = indicators[frame:GetName()]
if not indicator then
indicator = CreateFrame("Button", nil, frame, "CompactAuraTemplate")
indicator:ClearAllPoints()
indicator:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -3, -2)
indicator:SetSize(22, 22)
indicator:SetAlpha(0.6)
indicators[frame:GetName()] = indicator
end
return indicator
end

local function updateBuffs(frame)
if not frame:IsVisible() then return end

local indicator = getIndicator(frame)
local buffName = nil
for i = 1, 40 do
local _, _, _, _, _, d, _, ut, _, sc, s, c = UnitBuff(frame.displayedUnit, i);
buffName = UnitBuff(frame.displayedUnit, i);
if not buffName then break end
if buffs[buffName] and ut == “player” then
indicator:SetSize(frame.buffFrames[1]:GetSize()) -- scale
CompactUnitFrame_UtilSetBuff(indicator, frame.displayedUnit, i, nil);
return
end
end
indicator:Hide()
end
hooksecurefunc("CompactUnitFrame_UpdateBuffs", updateBuffs)
  Reply With Quote