Mercurial > wow > buffalo2
diff ObjectiveEvents.lua @ 6:589de8ea05b9
- validate tracked objects' existence by use of those handler.Info tables we made
- apply collision checking to action buttons when their corresponding entry has scrolled out
author | Nenue |
---|---|
date | Fri, 01 Apr 2016 01:30:42 -0400 |
parents | a2396b03ce63 |
children | 7923243ae972 |
line wrap: on
line diff
--- a/ObjectiveEvents.lua Thu Mar 31 15:58:08 2016 -0400 +++ b/ObjectiveEvents.lua Fri Apr 01 01:30:42 2016 -0400 @@ -7,8 +7,78 @@ local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local print = B.print('ObjectiveEvent') +local isHooked +local SmallEvents = { + QUEST_ACCEPTED = 'OnQuestAccepted', + QUEST_REMOVED = 'OnQuestRemoved' +} + +local HandlerEvents = { + QUEST_ACCEPTED = mod.Quest, + QUEST_REMOVED = mod.Quest, + QUEST_WATCH_LIST_CHANGED = mod.Quest, + SUPER_TRACKED_QUEST_CHANGED = mod.Quest, + QUEST_LOG_UPDATE = mod.Quest, + TRACKED_ACHIEVEMENT_LIST_CHANGED = mod.Cheevs, + TRACKED_ACHIEVEMENT_UPDATE = mod.Cheevs +} + +local BlizzHooks = { + ['AddQuestWatch'] = 'AddQuestWatch', + ['RemoveQuestWatch'] = 'RemoveQuestWatch', + ['AbandonQuest'] = 'AbandonQuest', + ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest', + ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp' +} + +mod.SetEvents = function() + + for event, _ in pairs(SmallEvents) do + mod:RegisterEvent(event) + end + + for event, _ in pairs(HandlerEvents) do + mod:RegisterEvent(event) + end + mod:SetScript('OnEvent', mod.OnEvent) + + + if not isHooked then + VeneerData.CallLog = {} + isHooked = true + for blizzFunc, veneerFunc in pairs(BlizzHooks) do + if mod[veneerFunc] then + hooksecurefunc(blizzFunc, mod[veneerFunc]) + else + hooksecurefunc(blizzFunc, function(...) + print('catching', blizzFunc, ...) + tinsert(VeneerData.CallLog, {blizzFunc, ...}) + end) + end + end + + end +end + +function mod:OnEvent (event, ...) + local isHandled + if SmallEvents[event] then + print('|cFF00FF00'..SmallEvents[event]..'(' ..event..'|r', ...) + mod[SmallEvents[event]](event, ...) + isHandled = true + end + if HandlerEvents[event] then + print('|cFF0088FF'..event..'|r wrapper update') + mod.UpdateWrapper() + isHandled = true + end + if not isHandled then + print('|cFFFF4400'..event..'|r', ...) + end +end + -------------------------------------------------------------------- ---- Specialized event handlers +--- Events that are handled by Blizzard_ObjectiveTracker -------------------------------------------------------------------- print(mod:GetName()) mod.OnQuestAccepted = function(_, questLogIndex, questID) @@ -25,11 +95,31 @@ RemoveQuestWatch(questLogIndex) end + mod.OnQuestRemoved = function(_, questLogIndex, questID) + + mod.UpdateWrapper() + end mod.OnQuestFromLocation = function(event) end -mod.OnAddQuestWatch = function(questID) - mod.UpdateActionButtons() +------------------------------------------------------------------- +--- Function hooks for BlizzUI compatibility +------------------------------------------------------------------- +mod.AddQuestWatch = function(questID) + mod.UpdateWrapper() end + +mod.RemoveQuestWatch = function(questIndex) + mod.UpdateWrapper() +end + +mod.AcceptQuest = function() +end + +mod.AbandonQuest = function() +end + +mod.TurnInQuest = function() +end \ No newline at end of file