comparison AskMrRobot.lua @ 33:4ba69d2ee252 v9

fixed bug with gem changes not appearing sometimes, mainWindow crash on startup, lua error for unknown item tooltips
author yellowfive
date Sat, 18 Oct 2014 18:13:55 -0700
parents 44c285acfff0
children d964099e4783
comparison
equal deleted inserted replaced
32:a401dd0e200e 33:4ba69d2ee252
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
47 function AskMrRobot.eventListener:OnEvent(event, ...) 53 function AskMrRobot.eventListener:OnEvent(event, ...)
48 if event == "ADDON_LOADED" then 54 if event == "ADDON_LOADED" then
49 local addon = select(1, ...) 55 local addon = select(1, ...)
50 if (addon == "AskMrRobot") then 56 if (addon == "AskMrRobot") then
57 -- create main window if not created yet
58 ensureMainWindow()
59
51 AskMrRobot.InitializeSettings() 60 AskMrRobot.InitializeSettings()
52 AskMrRobot.InitializeMinimap() 61 AskMrRobot.InitializeMinimap()
53 62
54 -- listen for messages from other AMR addons 63 -- listen for messages from other AMR addons
55 RegisterAddonMessagePrefix(AskMrRobot.ChatPrefix) 64 RegisterAddonMessagePrefix(AskMrRobot.ChatPrefix)
56
57 AskMrRobot.mainWindow = AskMrRobot.AmrUI:new()
58 end 65 end
59 66
60 elseif event == "UNIT_INVENTORY_CHANGED" then 67 elseif event == "UNIT_INVENTORY_CHANGED" then
61 AskMrRobot.ScanEquipped() 68 AskMrRobot.ScanEquipped()
62 69
96 103
97 elseif event == "CHAT_MSG_ADDON" then 104 elseif event == "CHAT_MSG_ADDON" then
98 local chatPrefix, message = select(1, ...) 105 local chatPrefix, message = select(1, ...)
99 local isLogging = AskMrRobot.CombatLogTab.IsLogging() 106 local isLogging = AskMrRobot.CombatLogTab.IsLogging()
100 if (isLogging and chatPrefix == AskMrRobot.ChatPrefix) then 107 if (isLogging and chatPrefix == AskMrRobot.ChatPrefix) then
108 -- create main window if not created yet
109 ensureMainWindow()
110
101 AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message) 111 AskMrRobot.mainWindow.combatLogTab:ReadAddonMessage(message)
102 end 112 end
103 113
104 elseif event == "UPDATE_INSTANCE_INFO" or event == "PLAYER_DIFFICULTY_CHANGED" then 114 elseif event == "UPDATE_INSTANCE_INFO" or event == "PLAYER_DIFFICULTY_CHANGED" then
105 AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging() 115 -- create main window if not created yet
106 116 ensureMainWindow()
117
118 AskMrRobot.mainWindow.combatLogTab:UpdateAutoLogging()
107 end 119 end
108 120
109 end 121 end
110 122
111 AskMrRobot.eventListener:SetScript("OnEvent", AskMrRobot.eventListener.OnEvent) 123 AskMrRobot.eventListener:SetScript("OnEvent", AskMrRobot.eventListener.OnEvent)
982 -- look for any socket color information, add to our extra data 994 -- look for any socket color information, add to our extra data
983 if tokens["c"] then 995 if tokens["c"] then
984 itemObj.socketColors = {} 996 itemObj.socketColors = {}
985 for j = 1, string.len(tokens["c"]) do 997 for j = 1, string.len(tokens["c"]) do
986 table.insert(itemObj.socketColors, tonumber(string.sub(tokens["c"], j, j))) 998 table.insert(itemObj.socketColors, tonumber(string.sub(tokens["c"], j, j)))
987 end 999 end
988 end 1000 end
989 1001
990 -- look for item ID duplicate info, deals with old SoO items 1002 -- look for item ID duplicate info, deals with old SoO items
991 if tokens["d"] then 1003 if tokens["d"] then
992 itemObj.duplicateId = tonumber(tokens["d"]) 1004 itemObj.duplicateId = tonumber(tokens["d"])
1005 itemInfo[itemObj.duplicateId] = itemObj
993 end 1006 end
994 1007
995 end 1008 end
996 end 1009 end
997 1010
1050 1063
1051 end 1064 end
1052 end 1065 end
1053 1066
1054 if isTest then 1067 if isTest then
1068
1055 -- print result for debugging 1069 -- print result for debugging
1056 local blah = importData[1] 1070 --for k,v in pairs(importData) do
1057 local name, link = GetItemInfo(AskMrRobot.createItemLink(blah)) 1071 -- local blah = AskMrRobot.createItemLink(v)
1058 print(link) 1072 -- local name, link = GetItemInfo(blah)
1073 -- if link == nil then
1074 -- print(blah)
1075 -- print("bad item: " .. v.id)
1076 -- end
1077 --end
1078
1059 1079
1060 else 1080 else
1061 -- we have succeeded, record the result 1081 -- we have succeeded, record the result
1062 AskMrRobot.ImportData = importData 1082 AskMrRobot.ImportData = importData
1063 AskMrRobot.ExtraItemData = itemInfo 1083 AskMrRobot.ExtraItemData = itemInfo