Index: GnomishYellowPages.lua =================================================================== --- GnomishYellowPages.lua (revision 37) +++ GnomishYellowPages.lua (working copy) @@ -2617,7 +2617,7 @@ if string.find(message, "|Htrade:") then -- SaveAdvertisement(message, player) - for link in string.gmatch(message, "|c%x+|Htrade:%d+:%d+:%d+:[0-9a-fA-F]+:[A-Za-z0-9+/]+|h%[[%a%s]+%]|h|r") do + for link in string.gmatch(message, "|c%x+|Htrade:%d+:%d+:%d+:[0-9a-fA-F]+:[A-Za-z0-9+/]+|h%[.+%]|h|r") do if link then local color,profession,level,playerID,tradeName = string.match(link,"(|c%x+)|Htrade:(%d+):(%d+):%d+:([0-9a-fA-F]+):[A-Za-z0-9+/]+|h%[([%a%s]+)%]|h|r") @@ -3183,27 +3183,30 @@ end - local function OnLoad() - local guid = UnitGUID("player") - playerGUID = string.gsub(guid,"0x0+", "") - - local version, build = GetBuildInfo() - build = tonumber(build) - - if not Config then - Config = { ["WhoUpdate"] = true, ["WhoFrequency"] = 10 } - end - - Config.dataVersion = tonumber(Config.dataVersion) - - if Config.dataVersion ~= build or not Config.spellList then - if not GYPSpellData or not GYPSpellData[build] then - TradeLink:Scan(InitSystem) -- calls InitSystem with newly discovered spellList + local function OnLoad(...) + local event = ... + if event == "init" or event == "GnomishYellowPages" then + local guid = UnitGUID("player") + playerGUID = string.gsub(guid,"0x0+", "") + + local version, build = GetBuildInfo() + build = tonumber(build) + + if not Config then + Config = { ["WhoUpdate"] = true, ["WhoFrequency"] = 10 } + end + + Config.dataVersion = tonumber(Config.dataVersion) + + if Config.dataVersion ~= build or not Config.spellList then + if not GYPSpellData or not GYPSpellData[build] then + TradeLink:Scan(InitSystem) -- calls InitSystem with newly discovered spellList + else + InitSystem(GYPSpellData[build]) -- call InitSystem with packaged spell data for this build + end else - InitSystem(GYPSpellData[build]) -- call InitSystem with packaged spell data for this build + InitSystem(Config.spellList) -- call InitSystem with the current spell data end - else - InitSystem(Config.spellList) -- call InitSystem with the current spell data end end @@ -3216,10 +3219,13 @@ for v in pairs(ChatMessageTypes) do RegisterEvent(master, v, ChatEventHandler) end + + if not IsAddOnLoaded("AddonLoader") then + RegisterEvent(master, "PLAYER_ENTERING_WORLD", function() OnLoad("init") master:UnregisterEvent("PLAYER_ENTERING_WORLD") end ) + else + RegisterEvent(master, "ADDON_LOADED", function(...) OnLoad(...) master:UnregisterEvent("ADDON_LOADED") end ) + end - RegisterEvent(master, "PLAYER_ENTERING_WORLD", function() OnLoad() master:UnregisterEvent("PLAYER_ENTERING_WORLD") end ) - - master:SetScript("OnEvent", ParseEvent) master:SetScript("OnUpdate", UpdateHandler) end Index: GnomishYellowPages.toc =================================================================== --- GnomishYellowPages.toc (revision 37) +++ GnomishYellowPages.toc (working copy) @@ -4,6 +4,8 @@ ## Author: LilSparky ## SavedVariables: YPData, Config ## Version: r35 +## LoadManagers: AddonLoader +## X-LoadOn-Always: delayed GYPSpellData.lua GnomishYellowPages.lua