Quantcast

blah

yaroot [10-18-10 - 12:00]
blah
Filename
battlefield.lua
diff --git a/battlefield.lua b/battlefield.lua
index 8349b89..781e796 100644
--- a/battlefield.lua
+++ b/battlefield.lua
@@ -1,42 +1,43 @@
-if(1) then return end
+local parent, ns = ...
+local myname = UnitName'player'

-if(enable_bgscoreboard) then
-    hooksecurefunc('WorldStateScoreFrame_Update', function()
-        local inArena = IsActiveBattlefieldArena()
-        for i = 1, MAX_WORLDSTATE_SCORE_BUTTONS do
-            local index = FauxScrollFrame_GetOffset(WorldStateScoreScrollFrame) + i
-            local name, killingBlows, honorableKills, deaths, honorGained, faction, rank, race, class, classToken, damageDone, healingDone = GetBattlefieldScore(index)
-            -- faction: Battlegrounds: Horde = 0, Alliance = 1 / Arenas: Green Team = 0, Yellow Team = 1
-            if name then
-                local n, r = strsplit('-', name, 2)
-                n = classColorHex[classToken] .. n .. '|r'
-                if n == myName then
-                    n = '> ' .. n .. ' <'
-                end
-
-                if r then
-                    local color
-                    if inArena then
-                        if faction == 1 then
-                            color = '|cffffd100'
-                        else
-                            color = '|cff19ff19'
-                        end
+hooksecurefunc('WorldStateScoreFrame_Update', function()
+    local inArena = IsActiveBattlefieldArena()
+    local offset = FauxScrollFrame_GetOffset(WorldStateScoreScrollFrame)
+
+    for i = 1, MAX_WORLDSTATE_SCORE_BUTTONS do
+        local index = offset + i
+        local name, killingBlows, honorableKills, deaths, honorGained, faction, rank, race, class, classToken, damageDone, healingDone = GetBattlefieldScore(index)
+        -- faction: Battlegrounds: Horde = 0, Alliance = 1 / Arenas: Green Team = 0, Yellow Team = 1
+        if name then
+            local n, r = strsplit('-', name, 2)
+            n = ns.classColor[classToken] .. n .. '|r'
+            if n == myname then
+                n = '> ' .. n .. ' <'
+            end
+
+            if r then
+                local color
+                if inArena then
+                    if faction == 1 then
+                        color = '|cffffd100'
                     else
-                        if faction == 1 then
-                            color = '|cff00adf0'
-                        else
-                            color = '|cffff1919'
-                        end
+                        color = '|cff19ff19'
+                    end
+                else
+                    if faction == 1 then
+                        color = '|cff00adf0'
+                    else
+                        color = '|cffff1919'
                     end
-                    r = color .. r .. '|r'
-                    n = n .. '|cffffffff-|r' .. r
                 end
-
-                local buttonNameText = getglobal('WorldStateScoreButton' .. i .. 'NameText')
-                buttonNameText:SetText(n)
+                r = color .. r .. '|r'
+                n = n .. '|cffffffff-|r' .. r
             end
+
+            local buttonNameText = getglobal('WorldStateScoreButton' .. i .. 'NameText')
+            buttonNameText:SetText(n)
         end
-    end)
-end
+    end
+end)