View Single Post
11-03-08, 10:13 AM   #187
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Caellian View Post
Hi, i'm having an issue with my name coloring, not like it's really important but i really wonder what's going wrong.

Pre Patch my own pet name was happiness colored, and still is now, but once i was targetting my own pet, or someone else pet it was hostility colored.
Now i can't manage to get that behavior back, i've tried different way but never got it to work.

Here's my current coloring system, could anyone take a quick look please.

Code:
local function OverrideUpdateName(self, event, unit)
	if(self.unit ~= unit) then return end

	local r, g, b, t
	local _, class = UnitClass(unit)

	if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
		t = self.colors.tapped
	elseif(UnitIsDead(unit) or UnitIsGhost(unit) or not UnitIsConnected(unit)) then
		t = self.colors.disconnected
	elseif(unit =='pet' and GetPetHappiness()) then
		t = self.colors.happiness[GetPetHappiness()]
	elseif(UnitIsPlayer(unit)) then
		t = self.colors.class[class]
	elseif(not UnitIsPlayer(unit)) then
		r, g, b = UnitSelectionColor(unit)
	end

	if(t) then
		r, g, b = t[1], t[2], t[3]
	end

	self.Name:SetTextColor(r,g,b)
UnitSelectionColor(unit) returned that rgb value