Mercurial > wow > askmrrobot
comparison AskMrRobot.lua @ 35:d964099e4783 v10
fixed loading bug that some users were having
author | yellowfive |
---|---|
date | Sat, 18 Oct 2014 21:57:16 -0700 |
parents | 4ba69d2ee252 |
children | 4d1a9865c90e |
comparison
equal
deleted
inserted
replaced
34:3769130aaf8d | 35:d964099e4783 |
---|---|
42 AskMrRobot.mainWindow = nil | 42 AskMrRobot.mainWindow = nil |
43 | 43 |
44 local _amrLDB | 44 local _amrLDB |
45 local _minimapIcon | 45 local _minimapIcon |
46 | 46 |
47 function ensureMainWindow() | |
48 if AskMrRobot.mainWindow == nil then | |
49 AskMrRobot.mainWindow = AskMrRobot.AmrUI:new() | |
50 end | |
51 end | |
52 | |
53 function AskMrRobot.eventListener:OnEvent(event, ...) | 47 function AskMrRobot.eventListener:OnEvent(event, ...) |
54 if event == "ADDON_LOADED" then | 48 if event == "ADDON_LOADED" then |
55 local addon = select(1, ...) | 49 local addon = select(1, ...) |
56 if (addon == "AskMrRobot") then | 50 if (addon == "AskMrRobot") then |
57 -- create main window if not created yet | |
58 ensureMainWindow() | |
59 | |
60 AskMrRobot.InitializeSettings() | 51 AskMrRobot.InitializeSettings() |
61 AskMrRobot.InitializeMinimap() | 52 AskMrRobot.InitializeMinimap() |
53 | |
54 AskMrRobot.mainWindow = AskMrRobot.AmrUI:new() | |
62 | 55 |
63 -- listen for messages from other AMR addons | 56 -- listen for messages from other AMR addons |
64 RegisterAddonMessagePrefix(AskMrRobot.ChatPrefix) | 57 RegisterAddonMessagePrefix(AskMrRobot.ChatPrefix) |
65 end | 58 end |
66 | 59 |
103 | 96 |
104 elseif event == "CHAT_MSG_ADDON" then | 97 elseif event == "CHAT_MSG_ADDON" then |
105 local chatPrefix, message = select(1, ...) | 98 local chatPrefix, message = select(1, ...) |
106 local isLogging = AskMrRobot.CombatLogTab.IsLogging() | 99 local isLogging = AskMrRobot.CombatLogTab.IsLogging() |
107 if (isLogging and chatPrefix == AskMrRobot.ChatPrefix) then | 100 if (isLogging and chatPrefix == AskMrRobot.ChatPrefix) then |
108 -- create main window if not created yet | 101 if AskMrRobot.mainWindow then |
109 ensureMainWindow() | 102 AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message) |
110 | 103 end |
111 AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message) | |
112 end | 104 end |
113 | 105 |
114 elseif event == "UPDATE_INSTANCE_INFO" or event == "PLAYER_DIFFICULTY_CHANGED" then | 106 elseif event == "UPDATE_INSTANCE_INFO" or event == "PLAYER_DIFFICULTY_CHANGED" then |
115 -- create main window if not created yet | 107 if AskMrRobot.mainWindow then |
116 ensureMainWindow() | 108 AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging() |
117 | 109 end |
118 AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging() | |
119 end | 110 end |
120 | 111 |
121 end | 112 end |
122 | 113 |
123 AskMrRobot.eventListener:SetScript("OnEvent", AskMrRobot.eventListener.OnEvent) | 114 AskMrRobot.eventListener:SetScript("OnEvent", AskMrRobot.eventListener.OnEvent) |
1066 | 1057 |
1067 if isTest then | 1058 if isTest then |
1068 | 1059 |
1069 -- print result for debugging | 1060 -- print result for debugging |
1070 --for k,v in pairs(importData) do | 1061 --for k,v in pairs(importData) do |
1071 -- local blah = AskMrRobot.createItemLink(v) | 1062 -- local blah = AskMrRobot.createItemLink(v) |
1072 -- local name, link = GetItemInfo(blah) | 1063 -- print(blah) |
1073 -- if link == nil then | 1064 --local name, link = GetItemInfo(blah) |
1074 -- print(blah) | 1065 --print(link) |
1075 -- print("bad item: " .. v.id) | 1066 --if link == nil then |
1076 -- end | 1067 -- print(blah) |
1068 -- print("bad item: " .. v.id) | |
1069 --end | |
1077 --end | 1070 --end |
1078 | 1071 |
1079 | 1072 |
1080 else | 1073 else |
1081 -- we have succeeded, record the result | 1074 -- we have succeeded, record the result |