Nenue@1: --- ${PACKAGE_NAME} Nenue@1: -- @file-author@ Nenue@1: -- @project-revision@ @project-hash@ Nenue@1: -- @file-revision@ @file-hash@ Nenue@1: -- Created: 3/30/2016 1:23 AM Nenue@1: local B = select(2,...).frame Nenue@1: local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') Nenue@1: local print = B.print('ObjectiveEvent') Nenue@1: Nenue@6: local isHooked Nenue@6: local SmallEvents = { Nenue@6: QUEST_ACCEPTED = 'OnQuestAccepted', Nenue@6: QUEST_REMOVED = 'OnQuestRemoved' Nenue@6: } Nenue@6: Nenue@6: local HandlerEvents = { Nenue@6: QUEST_ACCEPTED = mod.Quest, Nenue@6: QUEST_REMOVED = mod.Quest, Nenue@6: QUEST_WATCH_LIST_CHANGED = mod.Quest, Nenue@6: SUPER_TRACKED_QUEST_CHANGED = mod.Quest, Nenue@6: QUEST_LOG_UPDATE = mod.Quest, Nenue@6: TRACKED_ACHIEVEMENT_LIST_CHANGED = mod.Cheevs, Nenue@6: TRACKED_ACHIEVEMENT_UPDATE = mod.Cheevs Nenue@6: } Nenue@6: Nenue@6: local BlizzHooks = { Nenue@6: ['AddQuestWatch'] = 'AddQuestWatch', Nenue@6: ['RemoveQuestWatch'] = 'RemoveQuestWatch', Nenue@6: ['AbandonQuest'] = 'AbandonQuest', Nenue@6: ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest', Nenue@6: ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp' Nenue@6: } Nenue@6: Nenue@6: mod.SetEvents = function() Nenue@6: Nenue@6: for event, _ in pairs(SmallEvents) do Nenue@6: mod:RegisterEvent(event) Nenue@6: end Nenue@6: Nenue@6: for event, _ in pairs(HandlerEvents) do Nenue@6: mod:RegisterEvent(event) Nenue@6: end Nenue@6: mod:SetScript('OnEvent', mod.OnEvent) Nenue@6: Nenue@6: Nenue@6: if not isHooked then Nenue@6: VeneerData.CallLog = {} Nenue@6: isHooked = true Nenue@6: for blizzFunc, veneerFunc in pairs(BlizzHooks) do Nenue@6: if mod[veneerFunc] then Nenue@6: hooksecurefunc(blizzFunc, mod[veneerFunc]) Nenue@6: else Nenue@6: hooksecurefunc(blizzFunc, function(...) Nenue@6: print('catching', blizzFunc, ...) Nenue@6: tinsert(VeneerData.CallLog, {blizzFunc, ...}) Nenue@6: end) Nenue@6: end Nenue@6: end Nenue@6: Nenue@6: end Nenue@6: end Nenue@6: Nenue@6: function mod:OnEvent (event, ...) Nenue@6: local isHandled Nenue@6: if SmallEvents[event] then Nenue@6: print('|cFF00FF00'..SmallEvents[event]..'(' ..event..'|r', ...) Nenue@6: mod[SmallEvents[event]](event, ...) Nenue@6: isHandled = true Nenue@6: end Nenue@6: if HandlerEvents[event] then Nenue@6: print('|cFF0088FF'..event..'|r wrapper update') Nenue@6: mod.UpdateWrapper() Nenue@6: isHandled = true Nenue@6: end Nenue@6: if not isHandled then Nenue@6: print('|cFFFF4400'..event..'|r', ...) Nenue@6: end Nenue@6: end Nenue@6: Nenue@1: -------------------------------------------------------------------- Nenue@6: --- Events that are handled by Blizzard_ObjectiveTracker Nenue@1: -------------------------------------------------------------------- Nenue@1: print(mod:GetName()) Nenue@1: mod.OnQuestAccepted = function(_, questLogIndex, questID) Nenue@1: AddQuestWatch(questLogIndex) Nenue@1: SetSuperTrackedQuestID(questID) Nenue@1: end Nenue@1: Nenue@1: mod.OnQuestComplete = function(_, questLogIndex, questID) Nenue@1: QuestPOIUpdateIcons() Nenue@1: end Nenue@1: Nenue@1: mod.OnQuestFinished = function(_, questLogIndex, questID) Nenue@1: mod.TrackClosest() Nenue@1: RemoveQuestWatch(questLogIndex) Nenue@1: end Nenue@1: Nenue@6: Nenue@2: mod.OnQuestRemoved = function(_, questLogIndex, questID) Nenue@6: Nenue@6: mod.UpdateWrapper() Nenue@6: Nenue@2: end Nenue@2: Nenue@1: mod.OnQuestFromLocation = function(event) end Nenue@1: Nenue@6: ------------------------------------------------------------------- Nenue@6: --- Function hooks for BlizzUI compatibility Nenue@6: ------------------------------------------------------------------- Nenue@6: mod.AddQuestWatch = function(questID) Nenue@6: mod.UpdateWrapper() Nenue@1: end Nenue@6: Nenue@6: mod.RemoveQuestWatch = function(questIndex) Nenue@6: mod.UpdateWrapper() Nenue@6: end Nenue@6: Nenue@6: mod.AcceptQuest = function() Nenue@6: end Nenue@6: Nenue@6: mod.AbandonQuest = function() Nenue@6: end Nenue@6: Nenue@6: mod.TurnInQuest = function() Nenue@6: end