View Single Post
08-20-12, 06:53 AM   #6
mich125
A Fallenroot Satyr
Join Date: Jan 2010
Posts: 27
So this should be done like this?, couse ive just tested it, but it still doesnt display hp% ;(

Code:
local numChildren = -1;
local handledNameplates = {};
local TEXTURE_PATH = "Interface\\AddOns\\Nameplates\\images\\smooth"; --Set the new statusbar texture path

local function SkinPlate(frame)
	local healthBar, castBar = frame:GetChildren()
	local glowRegion, overlayRegion, highlightRegion, nameTextRegion, levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion = frame:GetRegions()
	local _, castbarOverlay, shieldedRegion, spellIconRegion = castBar:GetRegions()
	healthBar:SetStatusBarTexture(TEXTURE_PATH);
	castBar:SetStatusBarTexture(TEXTURE_PATH);

	handledNameplates[frame:GetName()] = true;
end

local function HookFrames(...)
	for index = 1, select('#', ...) do
		local frame = select(index, ...);
		
		if(not handledNameplates[frame:GetName()] and (frame:GetName() and frame:GetName():find("NamePlate%d"))) then
			SkinPlate(frame);
		end
	end
end


CreateFrame('Frame'):SetScript('OnUpdate', function(self, elapsed)
	if(WorldFrame:GetNumChildren() ~= numChildren) then
		numChildren = WorldFrame:GetNumChildren();
		HookFrames(WorldFrame:GetChildren());
	end	
end)