Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
5:e9b61fd5f607 | 6:589de8ea05b9 |
---|---|
5 -- Created: 3/30/2016 1:23 AM | 5 -- Created: 3/30/2016 1:23 AM |
6 local B = select(2,...).frame | 6 local B = select(2,...).frame |
7 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 7 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
8 local print = B.print('ObjectiveEvent') | 8 local print = B.print('ObjectiveEvent') |
9 | 9 |
10 local isHooked | |
11 local SmallEvents = { | |
12 QUEST_ACCEPTED = 'OnQuestAccepted', | |
13 QUEST_REMOVED = 'OnQuestRemoved' | |
14 } | |
15 | |
16 local HandlerEvents = { | |
17 QUEST_ACCEPTED = mod.Quest, | |
18 QUEST_REMOVED = mod.Quest, | |
19 QUEST_WATCH_LIST_CHANGED = mod.Quest, | |
20 SUPER_TRACKED_QUEST_CHANGED = mod.Quest, | |
21 QUEST_LOG_UPDATE = mod.Quest, | |
22 TRACKED_ACHIEVEMENT_LIST_CHANGED = mod.Cheevs, | |
23 TRACKED_ACHIEVEMENT_UPDATE = mod.Cheevs | |
24 } | |
25 | |
26 local BlizzHooks = { | |
27 ['AddQuestWatch'] = 'AddQuestWatch', | |
28 ['RemoveQuestWatch'] = 'RemoveQuestWatch', | |
29 ['AbandonQuest'] = 'AbandonQuest', | |
30 ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest', | |
31 ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp' | |
32 } | |
33 | |
34 mod.SetEvents = function() | |
35 | |
36 for event, _ in pairs(SmallEvents) do | |
37 mod:RegisterEvent(event) | |
38 end | |
39 | |
40 for event, _ in pairs(HandlerEvents) do | |
41 mod:RegisterEvent(event) | |
42 end | |
43 mod:SetScript('OnEvent', mod.OnEvent) | |
44 | |
45 | |
46 if not isHooked then | |
47 VeneerData.CallLog = {} | |
48 isHooked = true | |
49 for blizzFunc, veneerFunc in pairs(BlizzHooks) do | |
50 if mod[veneerFunc] then | |
51 hooksecurefunc(blizzFunc, mod[veneerFunc]) | |
52 else | |
53 hooksecurefunc(blizzFunc, function(...) | |
54 print('catching', blizzFunc, ...) | |
55 tinsert(VeneerData.CallLog, {blizzFunc, ...}) | |
56 end) | |
57 end | |
58 end | |
59 | |
60 end | |
61 end | |
62 | |
63 function mod:OnEvent (event, ...) | |
64 local isHandled | |
65 if SmallEvents[event] then | |
66 print('|cFF00FF00'..SmallEvents[event]..'(' ..event..'|r', ...) | |
67 mod[SmallEvents[event]](event, ...) | |
68 isHandled = true | |
69 end | |
70 if HandlerEvents[event] then | |
71 print('|cFF0088FF'..event..'|r wrapper update') | |
72 mod.UpdateWrapper() | |
73 isHandled = true | |
74 end | |
75 if not isHandled then | |
76 print('|cFFFF4400'..event..'|r', ...) | |
77 end | |
78 end | |
79 | |
10 -------------------------------------------------------------------- | 80 -------------------------------------------------------------------- |
11 --- Specialized event handlers | 81 --- Events that are handled by Blizzard_ObjectiveTracker |
12 -------------------------------------------------------------------- | 82 -------------------------------------------------------------------- |
13 print(mod:GetName()) | 83 print(mod:GetName()) |
14 mod.OnQuestAccepted = function(_, questLogIndex, questID) | 84 mod.OnQuestAccepted = function(_, questLogIndex, questID) |
15 AddQuestWatch(questLogIndex) | 85 AddQuestWatch(questLogIndex) |
16 SetSuperTrackedQuestID(questID) | 86 SetSuperTrackedQuestID(questID) |
23 mod.OnQuestFinished = function(_, questLogIndex, questID) | 93 mod.OnQuestFinished = function(_, questLogIndex, questID) |
24 mod.TrackClosest() | 94 mod.TrackClosest() |
25 RemoveQuestWatch(questLogIndex) | 95 RemoveQuestWatch(questLogIndex) |
26 end | 96 end |
27 | 97 |
98 | |
28 mod.OnQuestRemoved = function(_, questLogIndex, questID) | 99 mod.OnQuestRemoved = function(_, questLogIndex, questID) |
100 | |
101 mod.UpdateWrapper() | |
102 | |
29 end | 103 end |
30 | 104 |
31 mod.OnQuestFromLocation = function(event) end | 105 mod.OnQuestFromLocation = function(event) end |
32 | 106 |
33 mod.OnAddQuestWatch = function(questID) | 107 ------------------------------------------------------------------- |
34 mod.UpdateActionButtons() | 108 --- Function hooks for BlizzUI compatibility |
109 ------------------------------------------------------------------- | |
110 mod.AddQuestWatch = function(questID) | |
111 mod.UpdateWrapper() | |
35 end | 112 end |
113 | |
114 mod.RemoveQuestWatch = function(questIndex) | |
115 mod.UpdateWrapper() | |
116 end | |
117 | |
118 mod.AcceptQuest = function() | |
119 end | |
120 | |
121 mod.AbandonQuest = function() | |
122 end | |
123 | |
124 mod.TurnInQuest = function() | |
125 end |