Mercurial > wow > buffalo2
comparison ObjectiveTracker/Events.lua @ 34:9856ebc63fa4
- half solution to Update being fired multiple times during load
- change securefunc handlers to dispense a reason code; catch that reason code in the enclosure passed to hooksecurefunc, and decide whether to update or not from there.
| author | Nenue |
|---|---|
| date | Sun, 17 Apr 2016 00:21:45 -0400 |
| parents | 48b3e3959a0a |
| children | e84d645c8ab8 |
comparison
equal
deleted
inserted
replaced
| 33:64f2a9bbea79 | 34:9856ebc63fa4 |
|---|---|
| 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 T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
| 8 local print = B.print('Objectives') | 8 local print = B.print('Objectives') |
| 9 | 9 |
| 10 local _G = _G | |
| 11 local OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT | |
| 12 local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED | |
| 13 local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST | |
| 14 local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP | |
| 15 local GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID = GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID | |
| 16 local QuestPOIUpdateIcons = QuestPOIUpdateIcons | |
| 10 ------------------------------------------------------------------- | 17 ------------------------------------------------------------------- |
| 11 --- SecureHooked blizzard functions | 18 --- Deal with blizzard API calls that affect the tracker/log contents |
| 19 --- mainly just hiding blocks until they can be picked up by the next update event | |
| 12 ------------------------------------------------------------------- | 20 ------------------------------------------------------------------- |
| 13 T.AddQuestWatch = function(questID) | 21 T.AddQuestWatch = function(questID) |
| 14 T:Update(0x00000003) | 22 if not B.Conf.VeneerObjectiveWrapper.enabled then return end |
| 23 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST | |
| 15 end | 24 end |
| 16 | 25 |
| 17 local Quest = T.Quest | 26 local Quest = T.Quest |
| 18 T.RemoveQuestWatch = function(questIndex, ...) | 27 T.RemoveQuestWatch = function(questIndex, ...) |
| 19 print('|cFFFF8800RemoveQuestWatch', questIndex, ...) | 28 print('|cFFFF8800RemoveQuestWatch', questIndex, ...) |
| 20 | 29 local block = T.Quest.LogBlock[questIndex] |
| 21 local info = T.Quest.LogInfo[questIndex] | 30 if block then |
| 22 | 31 block:Hide() |
| 23 -- remove quest refs | |
| 24 local block = Quest.QuestBlock[info.questID] | |
| 25 Quest.QuestBlock[info.questID] = nil | |
| 26 Quest.LogBlock[questIndex] = nil | |
| 27 | |
| 28 -- remove if they still match | |
| 29 if Quest.WatchInfo[info.watchIndex] == info then | |
| 30 print('cleaning dead WatchInfo entry') | |
| 31 Quest.WatchInfo[info.watchIndex] = nil | |
| 32 end | 32 end |
| 33 if Quest.itemButtons[info.questID] then | 33 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST |
| 34 -- hide for now, it will get cleaned up shortly | |
| 35 Quest.itemButtons[info.questID]:Hide() | |
| 36 end | |
| 37 | |
| 38 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST) | |
| 39 end | 34 end |
| 40 | 35 |
| 41 T.AddTrackedAchievement = function(cheevID) | 36 T.AddTrackedAchievement = function(cheevID) |
| 42 T.CleanWidgets() | 37 T.CleanWidgets() |
| 43 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) | 38 return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT |
| 44 end | 39 end |
| 45 | 40 |
| 46 | 41 |
| 47 T.RemoveTrackedAchievement = function(cheevID) | 42 T.RemoveTrackedAchievement = function(cheevID) |
| 48 print('|cFFFF8800UntrackAchievement', cheevID) | |
| 49 T.CleanWidgets() | 43 T.CleanWidgets() |
| 50 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) | 44 return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT |
| 51 end | 45 end |
| 52 | 46 |
| 53 T.AcceptQuest = function() | 47 T.AcceptQuest = function() |
| 54 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED) | |
| 55 end | 48 end |
| 56 | 49 |
| 57 T.AbandonQuest = function() | 50 T.AbandonQuest = function() |
| 58 QuestPOIUpdateIcons() | 51 QuestPOIUpdateIcons() |
| 59 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST) | 52 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST |
| 60 end | 53 end |
| 61 T.TurnInQuest = function() | 54 T.CompleteQuest = function() |
| 55 local questID = GetQuestID() | |
| 56 if T.Quest.Info[questID] then | |
| 57 local q = T.Quest.Info[questID] | |
| 58 if q.logIndex then | |
| 59 local block = T.Quest.LogBlock[q.logIndex] | |
| 60 if block and block.id == questID then | |
| 61 block:Hide() | |
| 62 end | |
| 63 end | |
| 64 end | |
| 65 | |
| 62 QuestPOIUpdateIcons() | 66 QuestPOIUpdateIcons() |
| 63 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST) | 67 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST |
| 64 end | 68 end |
| 65 T.AddAutoQuestPopUp = function(...) | 69 T.AddAutoQuestPopUp = function(...) |
| 66 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP) | 70 return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP |
| 67 end | 71 end |
| 68 T.RemoveAutoQuestPopUp = function(...) | 72 T.RemoveAutoQuestPopUp = function(questID) |
| 69 T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP) | 73 return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP |
| 74 | |
| 70 end | 75 end |
| 71 | 76 |
| 72 | 77 |
| 73 | 78 |
| 74 T.SetSuperTrackedQuestID = function(questID) | 79 T.SetSuperTrackedQuestID = function(questID) |
