Quantcast

-Updated for 4.0

Xruptor [10-14-10 - 23:50]
-Updated for 4.0
Filename
LagBar.lua
LagBar.toc
LagBar.xml
diff --git a/LagBar.lua b/LagBar.lua
index 54dc845..b6b28a7 100644
--- a/LagBar.lua
+++ b/LagBar.lua
@@ -1,6 +1,20 @@
 --LagBar by Xruptor
+local LagBar = CreateFrame("frame", "LagBar", UIParent)
+
+LagBar:SetScript('OnEvent', function(self, event, ...)
+	if self[event] then
+		self[event](self, event, ...)
+	end
+end)
+
+if IsLoggedIn() then LagBar:PLAYER_LOGIN() else LagBar:RegisterEvent('PLAYER_LOGIN') end
+
+function LagBar:PLAYER_LOGIN()
+	LagBar:Enable()
+	self:UnregisterEvent("PLAYER_LOGIN")
+	self.PLAYER_LOGIN = nil
+end

-LagBar = {};
 LagBar.version = GetAddOnMetadata("LagBar", "Version")
 LagBar.PL_Lock = false

@@ -112,7 +126,7 @@ function LagBar:DrawGUI()

 			end)

-		lbFrame:SetScript("OnUpdate", function()
+		lbFrame:SetScript("OnUpdate", function(self, arg1)

 				LagBar:OnUpdate(arg1);

diff --git a/LagBar.toc b/LagBar.toc
index 1ca876b..3e88474 100644
--- a/LagBar.toc
+++ b/LagBar.toc
@@ -1,7 +1,7 @@
-## Interface: 30300
+## Interface: 40000
 ## Title: LagBar
 ## Author: Xruptor
-## Version:  1.5
+## Version:  2.0
 ## Notes: Displays a simple bar with some Latency Information.
 ## SavedVariables: LagBar_DB
-LagBar.xml
+LagBar.lua
diff --git a/LagBar.xml b/LagBar.xml
deleted file mode 100644
index 33903bd..0000000
--- a/LagBar.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
-    <Script file="LagBar.lua"/>
-    <Frame name="LagBarFrame_Startup">
-        <Scripts>
-            <OnLoad>
-            	this:RegisterEvent("ADDON_LOADED");
-            </OnLoad>
-	     <OnEvent>
-		if LagBar then
-			LagBar.OnEvent(this, event, arg1, arg2, arg3, arg4, ...);
-		end
-	     </OnEvent>
-        </Scripts>
-    </Frame>
-</Ui>