View Single Post
08-20-12, 02:02 AM   #2
mich125
A Fallenroot Satyr
Join Date: Jan 2010
Posts: 27
So far i got this code, and nameplates smooth texture works now, any idea what to add to 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();
	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)