Quantcast

attemp to fix bn friends coloring

yaroot [10-20-10 - 01:52]
attemp to fix bn friends coloring
Filename
core.lua
friends.lua
diff --git a/core.lua b/core.lua
old mode 100644
new mode 100755
index 142ff83..8a00b87
--- a/core.lua
+++ b/core.lua
@@ -69,11 +69,11 @@ ns.guildRankColor[0] = '|cffffffff'
 ns.diffColor = setmetatable({}, {
 	__index = function(t,i)
 		local c = i and GetQuestDifficultyColor(i)
-		if not c then return '|cffffffff' end
-		t[i] = Hex(c)
-		return t[i]
+        t[i] = c and Hex(c) or t[0]
+        return t[i]
 	end
 })
+ns.diffColor[0] = '|cffffffff'

 ns.classColor = setmetatable({}, {
 	__index = function(t,i)
diff --git a/friends.lua b/friends.lua
old mode 100644
new mode 100755
index a8fcd49..f84d821
--- a/friends.lua
+++ b/friends.lua
@@ -12,7 +12,7 @@ local function friendsFrame()
     local playerArea = GetRealZoneText()

     for i = 1, #buttons do
-        local nameText, nameColor, infoText
+        local nameText, infoText
         button = buttons[i]
         index = offset + i
         if(button:IsShown()) then
@@ -28,12 +28,12 @@ local function friendsFrame()
                 local presenceID, givenName, surname, toonName, toonID, client, isOnline, lastOnline, isAFK, isDND, messageText, noteText = BNGetFriendInfo(button.id)
                 if(isOnline and client==BNET_CLIENT_WOW) then
                     local hasFocus, toonName, client, realmName, faction, race, class, guild, zoneName, level, gameText, broadcastText, broadcastTime = BNGetToonInfo(toonID)
-                    if(givenName and surname and toonName) then
-                        if CanCooperateWithToon(toonID) then
-                            nameText = format(BATTLENET_NAME_FORMAT, givenName, surname) ..' '.. FRIENDS_WOW_NAME_COLOR_CODE .. '(' .. ns.classColor[class] .. toonName .. FRIENDS_WOW_NAME_COLOR_CODE .. ')'
-                            if(zoneName == playerArea) then
-                                infoText = format('|cff00ff00%s|r', zoneName)
-                            end
+                    if(givenName and surname and toonName and class) then
+                        -- color them all
+                        --if CanCooperateWithToon(toonID) then
+                        nameText = format(BATTLENET_NAME_FORMAT, givenName, surname) ..' '.. FRIENDS_WOW_NAME_COLOR_CODE .. '(' .. ns.classColor[class] .. ns.classColor[class] .. toonName .. FRIENDS_WOW_NAME_COLOR_CODE .. ')'
+                        if(zoneName == playerArea) then
+                            infoText = format('|cff00ff00%s|r', zoneName)
                         end
                     end
                 end
@@ -43,9 +43,6 @@ local function friendsFrame()
         if(nameText) then
             button.name:SetText(nameText)
         end
-        if(nameColor) then
-            button.name:SetTextColor(nameColor.r, nameColor.g, nameColor.b)
-        end
         if(infoText) then
             button.info:SetText(infoText)
         end