Quantcast

and.. the hook is back

yaroot [12-06-11 - 06:04]
and.. the hook is back
Filename
core.lua
guild.lua
diff --git a/core.lua b/core.lua
index c9572ce..aac4b05 100644
--- a/core.lua
+++ b/core.lua
@@ -104,9 +104,6 @@ do
 end

 if CUSTOM_CLASS_COLORS then
-	local function callBack()
-		wipe(classColor)
-	end
-	CUSTOM_CLASS_COLORS:RegisterCallback(callBack)
+	CUSTOM_CLASS_COLORS:RegisterCallback(function() wipe(classColor) end)
 end

diff --git a/guild.lua b/guild.lua
index 7581351..d4d32ec 100644
--- a/guild.lua
+++ b/guild.lua
@@ -1,58 +1,53 @@

 local _, ns = ...
 local ycc = ns.ycc
+local _VIEW

+local function setview(view)
+    _VIEW = view
+end

 local function update()
-    local _VIEW = GetCVar'guildRosterView'
-
-    if(_VIEW == 'tradeskill') then return end
-
+    _VIEW = _VIEW or GetCVar'guildRosterView'
     local playerArea = GetRealZoneText()
     local buttons = GuildRosterContainer.buttons

     for i, button in ipairs(buttons) do
         -- why the fuck no continue?
         if(button:IsShown() and button.online and button.guildIndex) then
-            local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPnts, achievementRank, isMobile = GetGuildRosterInfo(button.guildIndex)
-            local displayedName = ycc.classColor[classFileName] .. name
-            if(isMobile) then
-                name = ChatFrame_GetMobileEmbeddedTexture(73/255, 177/255, 73/255) .. name
-            end
-
-            if(_VIEW == 'playerStatus') then
-                button.string1:SetText(ycc.diffColor[level] .. level)
-                button.string2:SetText(displayedName)
-                if(zone == playerArea) then
-                    button.string3:SetText('|cff00ff00' .. zone)
+            if(_VIEW == 'tradeskill') then
+                local skillID, isCollapsed, iconTexture, headerName, numOnline, numVisible, numPlayers, playerName, class, online, zone, skill, classFileName, isMobile = GetGuildTradeSkillInfo(button.guildIndex)
+                if((not headerName) and playerName) then
+                    --button.string1:SetText(ycc.classColor[classFileName] .. playerName)
+                    local c = ycc.classColorRaw[classFileName]
+                    button.string1:SetTextColor(c.r, c.g, c.b)
+                    if(zone == playerArea) then
+                        button.string2:SetText('|cff00ff00' .. zone)
+                    end
                 end
-            elseif(_VIEW == 'guildStatus') then
-                button.string1:SetText(displayedName)
-                if(rankIndex and rank) then
-                    button.string2:SetText(ycc.guildRankColor[rankIndex] .. rank)
-                end
-            elseif(_VIEW == 'achievement') then
-                button.string1:SetText(ycc.diffColor[level] .. level)
-                if(classFileName and name) then
-                    button.string2:SetText(displayedName)
-                end
-            elseif(_VIEW == 'weeklyxp' or _VIEW == 'totalxp') then
-                button.string1:SetText(ycc.diffColor[level] .. level)
-                button.string2:SetText(displayedName)
-            end
-        end
-    end
-end
+            else
+                local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPnts, achievementRank, isMobile = GetGuildRosterInfo(button.guildIndex)
+                local displayedName = ycc.classColor[classFileName] .. name

-local function tradeupdate()
-    local myZone = GetRealZoneText()
-    for i, button in ipairs(GuildRosterContainer.buttons) do
-        if(button:IsShown() and button.online and button.guildIndex) then
-			local skillID, isCollapsed, iconTexture, headerName, numOnline, numVisible, numPlayers, playerName, class, online, zone, skill, classFileName, isMobile = GetGuildTradeSkillInfo(button.guildIndex)
-            if(not headerName) then
-                button.string1:SetText(ycc.classColor[classFileName] .. playerName)
-                if(zone == myZone) then
-                    button.string2:SetText('|cff00ff00' .. zone)
+                if(_VIEW == 'playerStatus') then
+                    button.string1:SetText(ycc.diffColor[level] .. level)
+                    button.string2:SetText(displayedName)
+                    if(zone == playerArea) then
+                        button.string3:SetText('|cff00ff00' .. zone)
+                    end
+                elseif(_VIEW == 'guildStatus') then
+                    button.string1:SetText(displayedName)
+                    if(rankIndex and rank) then
+                        button.string2:SetText(ycc.guildRankColor[rankIndex] .. rank)
+                    end
+                elseif(_VIEW == 'achievement') then
+                    button.string1:SetText(ycc.diffColor[level] .. level)
+                    if(classFileName and name) then
+                        button.string2:SetText(displayedName)
+                    end
+                elseif(_VIEW == 'weeklyxp' or _VIEW == 'totalxp') then
+                    button.string1:SetText(ycc.diffColor[level] .. level)
+                    button.string2:SetText(displayedName)
                 end
             end
         end
@@ -61,12 +56,13 @@ end

 local loaded = false
 hooksecurefunc('GuildFrame_LoadUI', function()
-    if(loaded) then return end
-    loaded = true
-
-    hooksecurefunc('GuildRoster_Update', update)
-    hooksecurefunc(GuildRosterContainer, 'update', update)
-    hooksecurefunc('GuildRoster_UpdateTradeSkills', tradeupdate)
+    if(loaded) then
+        return
+    else
+        loaded = true
+        hooksecurefunc('GuildRoster_SetView', setview)
+        hooksecurefunc('GuildRoster_Update', update)
+        hooksecurefunc(GuildRosterContainer, 'update', update)
+    end
 end)

-