0
-- Namespace Declaration --
0
-------------------------------------
0
-Quecho =
DongleStub("Dongle-1.0"):New("Quecho")0
-function Quecho:Initialize()
0
- self.quests = setmetatable({}, {__index = function (t,i)
0
+Quecho.quests = setmetatable({}, {__index = function (t,i)
0
+local f = CreateFrame("Frame")
0
+f:SetScript("OnEvent", function(frame, event, ...) if Quecho[event] then return Quecho[event](Quecho, event, ...) end end)
0
+f:RegisterEvent("ADDON_LOADED")
0
+function Quecho:ADDON_LOADED(event, addon)
0
+ if addon ~= "Quecho" then return end
0
-function Quecho:Enable()
0
- self:RegisterEvent("UI_INFO_MESSAGE")
0
- self:RegisterEvent("CHAT_MSG_ADDON")
0
- self:RegisterEvent("QUEST_LOG_UPDATE")
0
self:QUEST_LOG_UPDATE()
0
+ f:RegisterEvent("UI_INFO_MESSAGE")
0
+ f:RegisterEvent("CHAT_MSG_ADDON")
0
+ f:RegisterEvent("QUEST_LOG_UPDATE")
0
+ f:UnregisterEvent("ADDON_LOADED")
0
+ self.ADDON_LOADED = nil
0
+function Quecho:PrintF(...) ChatFrame1:AddMessage(string.format(...)) end
0
---------------------------
0
---------------------------
0
local sendtimes, nextpurge = {}
0
-local f = CreateFrame("Frame")
0
local function OnUpdate(f)
0
if not nextpurge then f:SetScript("OnUpdate", nil) end
0
@@ -40,7 +51,6 @@ local function OnUpdate(f)
0
for objective in pairs(objectives) do
0
local t = sendtimes[sender..objective]
0
if (t + DELAY) <= now then
0
- Quecho:Debug(1, "Purging", sender..objective)
0
sendtimes[sender..objective] = nil
0
Quecho.quests[sender][objective] = nil
0
elseif not next2 or t < next2 then next2 = t end
0
@@ -70,7 +80,6 @@ function Quecho:CHAT_MSG_ADDON(event, prefix, msg, channel, sender)
0
if prefix == "Quecho" then
0
local _, _, objective, progress = msg:find("(.+): (%d+/%d+)")
0
- self:Debug(1, sender, msg, objective, progress)
0
sendtimes[sender..objective] = GetTime()
Comments
No one has commented yet.