Do you need to check for a buff? It seems you could alter the frames regardless of buff so long as you only do it once for each (assuming frame:CreateBeautyBorder creates a new frame each time)
Something more like:
Lua Code:
-- This probalby only needs to run once at startup
TargetFrameHealthBarText:ClearAllPoints()
TargetFrameHealthBarText:SetPoint("CENTER", TargetFrame, "CENTER", -50, 7)
TargetFrameManaBarText:SetScale(0.8)
local MaxReached
local function SkinTarget()
if MaxReached then return end -- Why keep doing it
if TargetFrame:IsShown() then
for i = 1, MAX_TARGET_BUFFS do
frame = _G["TargetFrameBuff" .. i]
if not frame then break end
if not frame.BeautyBorder then -- Have we adjusted this frame before?
frame:CreateBeautyBorder(config.buff.bordersize)
frame:SetBeautyBorderTexture(config.border.default)
frame:SetScale(config.buff.scale)
frame.BeautyBorder = true
frameBorder = _G["TargetFrameBuff" .. i .. "Border"]
frameCount = _G["TargetFrameBuff" .. i .. "Count"]
frameBorder:Hide()
frameCount:SetFont(config.font.atari, config.buff.fontsize, config.buff.outline)
frameCount:SetPoint(unpack(config.buff.position))
if i == MAX_TARGET_BUFFS then
MaxReached = true
end
end
end
end
end