comparison ObjectiveTracker/ObjectiveTracker.lua @ 44:756e8aeb040b

- Default.lua - simplified the response to SuperTrackedQuestID changes - tag icons work again
author Nenue
date Mon, 25 Apr 2016 19:37:13 -0400
parents 03ed70f846de
children dd1ae565f559
comparison
equal deleted inserted replaced
43:9480bd904f4c 44:756e8aeb040b
16 local Scroller = VeneerObjectiveWrapper.scrollArea 16 local Scroller = VeneerObjectiveWrapper.scrollArea
17 local Scroll = _G.VeneerObjectiveScroll 17 local Scroll = _G.VeneerObjectiveScroll
18 local unitLevel = UnitLevel('player') 18 local unitLevel = UnitLevel('player')
19 19
20 --- Performance values 20 --- Performance values
21 --[[ 21
22 self:RegisterEvent("QUEST_LOG_UPDATE"); 22 --- Done once per ui load
23 self:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED"); 23 local BlizzHooks = {
24 self:RegisterEvent("QUEST_WATCH_LIST_CHANGED"); 24 'AcceptQuest',
25 self:RegisterEvent("QUEST_AUTOCOMPLETE"); 25 'AddQuestWatch',
26 self:RegisterEvent("QUEST_ACCEPTED"); 26 'RemoveQuestWatch',
27 self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED"); 27 'AbandonQuest',
28 self:RegisterEvent("SCENARIO_UPDATE"); 28 'AcknowledgeAutoAcceptQuest',
29 self:RegisterEvent("SCENARIO_CRITERIA_UPDATE"); 29 'AddAutoQuestPopUp',
30 self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE"); 30 'RemoveAutoQuestPopUp',
31 self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); 31 'AddTrackedAchievement',
32 self:RegisterEvent("ZONE_CHANGED"); 32 'RemoveTrackedAchievement',
33 self:RegisterEvent("QUEST_POI_UPDATE"); 33 'SetSuperTrackedQuestID',
34 self:RegisterEvent("VARIABLES_LOADED"); 34 'SelectQuestLogEntry',
35 self:RegisterEvent("QUEST_TURNED_IN"); 35 }
36 self:RegisterEvent("PLAYER_MONEY"); 36 local enabledOnly = {
37 ]] 37 ['AddQuestWatch'] = true,
38 38 }
39 39
40 --- These are the bitfields used by Blizzard_ObjectiveTracker to determine which segments get parsed. 40 --- These are the bitfields used by Blizzard_ObjectiveTracker to determine which segments get parsed.
41 --- They are replicated here so that plugins can make use of any securehook args involving this info. 41 --- They are replicated here so that plugins can make use of any securehook args involving this info.
42 local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -- 0x0100 42 local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -- 0x0100
43 local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -- 0x0200 43 local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -- 0x0200
296 SortQuestWatches(); 296 SortQuestWatches();
297 end 297 end
298 return OBJECTIVE_TRACKER_UPDATE_ALL 298 return OBJECTIVE_TRACKER_UPDATE_ALL
299 end 299 end
300 Event.SUPER_TRACKED_QUEST_CHANGED = function(questID) 300 Event.SUPER_TRACKED_QUEST_CHANGED = function(questID)
301 return OBJECTIVE_TRACKER_UPDATE_QUEST, questID 301 --return OBJECTIVE_TRACKER_UPDATE_QUEST, questID
302 end 302 end
303 Event.ZONE_CHANGED = function() 303 Event.ZONE_CHANGED = function()
304 local inMicroDungeon = IsPlayerInMicroDungeon(); 304 local inMicroDungeon = IsPlayerInMicroDungeon();
305 if ( inMicroDungeon ~= T.inMicroDungeon ) then 305 if ( inMicroDungeon ~= T.inMicroDungeon ) then
306 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then 306 if ( not WorldMapFrame:IsShown() and GetCVarBool("questPOI") ) then
361 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money 361 return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, questID, xp, money
362 end 362 end
363 end 363 end
364 T.Event = Event 364 T.Event = Event
365 365
366 --- Done once per ui load
367 local BlizzHooks = {
368 ['AcceptQuest'] = 'AcceptQuest',
369 ['AddQuestWatch'] = 'AddQuestWatch',
370 ['RemoveQuestWatch'] = 'RemoveQuestWatch',
371 ['AbandonQuest'] = 'AbandonQuest',
372 ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest',
373 ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp',
374 ['RemoveAutoQuestPopUp'] = 'RemoveAutoQuestPopUp',
375 ['AddTrackedAchievement'] = 'AddTrackedAchievement',
376 ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement',
377 ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID',
378 ['SelectQuestLogEntry'] = 'SelectQuestLogEntry',
379 }
380 local VeneerData 366 local VeneerData
381 367
382 T.SetWatchMoney = function(watchMoney, reason) 368 T.SetWatchMoney = function(watchMoney, reason)
383 if watchMoney then 369 if watchMoney then
384 if band(T.watchMoneyReasons, reason) == 0 then 370 if band(T.watchMoneyReasons, reason) == 0 then
505 local c = T.Conf.Wrapper 491 local c = T.Conf.Wrapper
506 VeneerData = _G.VeneerData 492 VeneerData = _G.VeneerData
507 VeneerData.CallLog = VeneerData.CallLog or {} 493 VeneerData.CallLog = VeneerData.CallLog or {}
508 if not T.isHooked then 494 if not T.isHooked then
509 T.isHooked = true 495 T.isHooked = true
510 for blizzFunc, veneerFunc in pairs(BlizzHooks) do 496 for _, func in ipairs(BlizzHooks) do
511 if T[veneerFunc] then 497 if T[func] then
512 hooksecurefunc(blizzFunc, function(...) return T.OnHookedFunc(blizzFunc, ...) end) 498 hooksecurefunc(func, function(...) return T.OnHookedFunc(func, ...) end)
513 else 499 else
514 hooksecurefunc(blizzFunc, function(...) 500 hooksecurefunc(func, function(...)
515 print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...) 501 print('|cFFFF0088securehook('..tostring(func)..')|r args:', ...)
516 tinsert(VeneerData.CallLog, {blizzFunc, ...}) 502 tinsert(VeneerData.CallLog, {func, ...})
517 end) 503 end)
518 end 504 end
519 end 505 end
520 end 506 end
521 507