Quantcast
WoWInterface - View Single Post - TargetFrameAura manipulation
View Single Post
07-23-20, 08:20 AM   #1
glupikreten
An Aku'mai Servant
Join Date: Apr 2009
Posts: 37
TargetFrameAura manipulation

Hi,

I have this piece of code... it works in 99.99% of the cases... Can anyone tell me why it wouldn't be doing in 100% of them?

Ignore the double for loops... I tried different stuff and this was the last iteration... I know it should be only one

Code:
local function SkinTarget()
	if TargetFrame:IsShown() then
		TargetFrameHealthBarText:ClearAllPoints()
		TargetFrameHealthBarText:SetPoint("CENTER", TargetFrame, "CENTER", -50, 7)
		TargetFrameManaBarText:SetScale(0.8)

		for i = 1, 32 do
			_, spellId, _, _, _, _, unitCaster = UnitBuff("target", i)
			if (spellId) then
				frame = _G["TargetFrameBuff" .. i]
				frameBorder = _G["TargetFrameBuff" .. i .. "Border"]
				frameCount = _G["TargetFrameBuff" .. i .. "Count"]

				if (frameBorder ~= nil) then
					frameBorder:Hide()
				end

				if (frameCount ~= nil) then
					frameCount:SetFont(config.font.atari, config.buff.fontsize, config.buff.outline)
					frameCount:SetPoint(unpack(config.buff.position))
				end

				if (frame ~= nil) then
					frame:CreateBeautyBorder(config.buff.bordersize)
					frame:SetBeautyBorderTexture(config.border.default)
					frame:SetScale(config.buff.scale)
				end
			end
		end

		for i = 1, 32 do
			_, spellId, _, _, _, _, unitCaster = UnitDebuff("target", i)
			if (spellId) then
				frame = _G["TargetFrameDebuff" .. i]
				frameBorder = _G["TargetFrameDebuff" .. i .. "Border"]
				frameCount = _G["TargetFrameDebuff" .. i .. "Count"]

				if (frameBorder ~= nil) then
					frameBorder:Hide()
				end

				if (frameCount ~= nil) then
					frameCount:SetFont(config.font.atari, config.debuff.fontsize, config.debuff.outline)
					frameCount:SetPoint(unpack(config.debuff.position))
				end

				if (select(4, UnitDebuff("target", i))) then
					color = config.ReplacedDebuffTypeColor[select(4, UnitDebuff("target", i))]
				else
					color = config.ReplacedDebuffTypeColor["none"]
				end

				if (frame ~= nil) then
					frame:CreateBeautyBorder(config.debuff.bordersize)
					frame:SetBeautyBorderTexture(config.border.colorize)
					frame:SetBeautyBorderColor(color.r, color.g, color.b)
					frame:SetScale(config.buff.scale)
				end
			end
		end
	end
end

hooksecurefunc("TargetFrame_UpdateAuras", SkinTarget)
  Reply With Quote