Quantcast

fix wholist

yaroot [10-18-10 - 11:46]
fix wholist
Filename
who.lua
diff --git a/who.lua b/who.lua
index 8679de4..39ffcef 100644
--- a/who.lua
+++ b/who.lua
@@ -1,23 +1,21 @@
-if(1) then return end
+local parent, ns = ...

-if(enable_wholist) then
-    hooksecurefunc('WhoList_Update', function()
-        local whoIndex
-        local whoOffset = FauxScrollFrame_GetOffset(WhoListScrollFrame)
-
-        local playerZone = GetRealZoneText()
-        local playerGuild = GetGuildInfo'player'
-        local playerRace = UnitRace'player'
-
-        for i=1, WHOS_TO_DISPLAY, 1 do
-            whoIndex = whoOffset + i
-            local nameText = getglobal('WhoFrameButton'..i..'Name')
-            local levelText = getglobal('WhoFrameButton'..i..'Level')
-            local classText = getglobal('WhoFrameButton'..i..'Class')
-            local variableText = getglobal('WhoFrameButton'..i..'Variable')
-
-            local name, guild, level, race, class, zone, classFileName = GetWhoInfo(whoIndex)
-            if not name then return end
+hooksecurefunc('WhoList_Update', function()
+    local whoOffset = FauxScrollFrame_GetOffset(WhoListScrollFrame)
+
+    local playerZone = GetRealZoneText()
+    local playerGuild = GetGuildInfo'player'
+    local playerRace = UnitRace'player'
+
+    for i=1, WHOS_TO_DISPLAY, 1 do
+        local index = whoOffset + i
+        local nameText = getglobal('WhoFrameButton'..i..'Name')
+        local levelText = getglobal('WhoFrameButton'..i..'Level')
+        local classText = getglobal('WhoFrameButton'..i..'Class')
+        local variableText = getglobal('WhoFrameButton'..i..'Variable')
+
+        local name, guild, level, race, class, zone, classFileName = GetWhoInfo(index)
+        if(name) then
             if zone == playerZone then
                 zone = '|cff00ff00' .. zone
             end
@@ -28,11 +26,11 @@ if(enable_wholist) then
                 race = '|cff00ff00' .. race
             end
             local columnTable = { zone, guild, race }
-
-            nameText:SetVertexColor(unpack(classColors[class]))
-            levelText:SetText(diffColor[level] .. level)
+
+            nameText:SetText(ns.classColor[classFileName] .. name)
+            levelText:SetText(ns.diffColor[level] .. level)
             variableText:SetText(columnTable[UIDropDownMenu_GetSelectedID(WhoFrameDropDown)])
         end
-    end)
-end
+    end
+end)