changeset 35:d964099e4783 v10

fixed loading bug that some users were having
author yellowfive
date Sat, 18 Oct 2014 21:57:16 -0700
parents 3769130aaf8d
children b8df1bb7cfae
files AskMrRobot.lua AskMrRobot.toc
diffstat 2 files changed, 17 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.lua	Sat Oct 18 18:14:14 2014 -0700
+++ b/AskMrRobot.lua	Sat Oct 18 21:57:16 2014 -0700
@@ -44,22 +44,15 @@
 local _amrLDB
 local _minimapIcon
 
-function ensureMainWindow()
-    if AskMrRobot.mainWindow == nil then
-        AskMrRobot.mainWindow = AskMrRobot.AmrUI:new()
-    end
-end
-
 function AskMrRobot.eventListener:OnEvent(event, ...)
 	if event == "ADDON_LOADED" then
         local addon = select(1, ...)
         if (addon == "AskMrRobot") then
-            -- create main window if not created yet
-            ensureMainWindow()
-            
             AskMrRobot.InitializeSettings()
             AskMrRobot.InitializeMinimap()
             
+            AskMrRobot.mainWindow = AskMrRobot.AmrUI:new()
+            
             -- listen for messages from other AMR addons
             RegisterAddonMessagePrefix(AskMrRobot.ChatPrefix)
         end
@@ -105,17 +98,15 @@
         local chatPrefix, message = select(1, ...)
         local isLogging = AskMrRobot.CombatLogTab.IsLogging()
         if (isLogging and chatPrefix == AskMrRobot.ChatPrefix) then
-            -- create main window if not created yet
-            ensureMainWindow()
-            
-            AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message)
+            if AskMrRobot.mainWindow then
+                AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message)
+            end
         end
         
     elseif event == "UPDATE_INSTANCE_INFO" or event == "PLAYER_DIFFICULTY_CHANGED" then
-        -- create main window if not created yet
-        ensureMainWindow()
-    	
-        AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging()
+        if AskMrRobot.mainWindow then
+            AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging()
+        end
 	end
  
 end
@@ -1068,12 +1059,14 @@
     
         -- print result for debugging
         --for k,v in pairs(importData) do
-        --    local blah = AskMrRobot.createItemLink(v)
-        --    local name, link = GetItemInfo(blah)
-        --    if link == nil then
-        --        print(blah)
-        --        print("bad item: " .. v.id)
-        --    end
+         --   local blah = AskMrRobot.createItemLink(v)
+        --    print(blah)
+            --local name, link = GetItemInfo(blah)
+            --print(link)
+            --if link == nil then
+            --    print(blah)
+            --    print("bad item: " .. v.id)
+            --end
         --end
         
         
--- a/AskMrRobot.toc	Sat Oct 18 18:14:14 2014 -0700
+++ b/AskMrRobot.toc	Sat Oct 18 21:57:16 2014 -0700
@@ -1,7 +1,7 @@
 ## Interface: 60000
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 9
+## Version: 10
 ## Notes: Exports/Imports data to/from askmrrobot.com.
 ## URL: www.askmrrobot.com
 ## DefaultState: Enabled