diff ObjectiveTracker/ObjectiveTracker.lua @ 45:dd1ae565f559

Hooks and Handlers: - correct argument mix-ups for AcceptQuest/QUEST_ACCEPTED handlers; fixes auto-watch - respond to AcknowledgeAutoAcceptQuest; fixes lingering popups - include Popup and Quest trackers in the response code for CompleteQuest; fixes content artifacts following the rollover of repeating popups seen in Ashran - clean up wacky OnEvent header Layout - add alpha blend options QuestData - reset objectives data when a quest is in a completed state; keeps old data from ever reaching the Default.x code
author Nenue
date Tue, 26 Apr 2016 14:57:18 -0400
parents 756e8aeb040b
children 1a322b92dbfa
line wrap: on
line diff
--- a/ObjectiveTracker/ObjectiveTracker.lua	Mon Apr 25 19:37:13 2016 -0400
+++ b/ObjectiveTracker/ObjectiveTracker.lua	Tue Apr 26 14:57:18 2016 -0400
@@ -23,6 +23,7 @@
 local BlizzHooks = {
   'AcceptQuest',
   'AddQuestWatch',
+  'CompleteQuest',
   'RemoveQuestWatch',
   'AbandonQuest',
   'AcknowledgeAutoAcceptQuest',
@@ -270,12 +271,14 @@
 end
 local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID
 Event.QUEST_ACCEPTED = function(questLogIndex, questID, added)
+
+  --todo: stall non-confirmed autoquests
+  AddQuestWatch(questLogIndex)
   if ( IsQuestTask(questID) ) then
     return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID, added
   else
     return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added
   end
-  AddQuestWatch(questID)
 end
 
 Event.QUEST_WATCH_LIST_CHANGED = function(questID, added)
@@ -446,12 +449,17 @@
 local Play = function(file) if Devian and Devian.InWorkspace() then PlaySoundFile(file) end end
 
 local tprint = B.print('Tracker')
+local ignoredNames = {
+  ['SelectQuestLogEntry'] = true
+}
 T.OnHookedFunc = function(name, ...)
-  print('|cFFFF8800securehook:|r', name, '|cFF00FFFFargs:|r', ...)
+  --tprint('|cFFFF8800securehook:|r', name, '|cFF00FFFFargs:|r', ...)
   local updateReason, arg1, arg2, arg3 = T[name](...)
   if updateReason then
-    print('|cFF00FFFFupdate reason:|r', updateReason, arg1, arg2, arg3)
+    tprint('OnHookedFunc(|cFF00FFFF'..name..'|r):', ...)
     T:Update(updateReason, arg1, arg2, arg3)
+  elseif not ignoredNames[name] then
+    tprint('OnHookedFunc(|cFFFF4400'..name..'|r):', ...)
   end
 end
 
@@ -468,21 +476,22 @@
     end
   else
     print('no event handler set for', event)
+    tprint('no event handler set for', event)
     Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]])
   end
   if reason then
-    tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ...)
+    local args = (reason or '0')
+    if arg1 then args = args .. ', ' .. tostring(arg1) end
+    if arg2 then args = args .. ', ' .. tostring(arg2) end
+    if arg3 then args = args .. ', ' .. tostring(arg3) end
+    print('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r')
+    tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r')
     T:Update(reason, arg1, arg2, arg3)
   else
-    print('OnEvent(|cFFFF4400'.. event ..'|r):', ...)
+    tprint('OnEvent(|cFFFF4400'.. event ..'|r):', ...)
     print('no detected reason')
     --Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]])
   end
-  local args = (reason or '0')
-  if arg1 then args = args .. ', ' .. tostring(arg1) end
-  if arg2 then args = args .. ', ' .. tostring(arg2) end
-  if arg3 then args = args .. ', ' .. tostring(arg3) end
-  tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r')
 
 end
 
@@ -506,6 +515,12 @@
   end
 
 
+  local weekDays = {'Su', 'M', 'T', 'W', 'R' ,'F', 'Sa'}
+  Wrapper.Clock:SetScript('OnUpdate', function(self)
+    local weekday, month, day, year = CalendarGetDate()
+    local hour, min = GetGameTime()
+    self.time:SetFormattedText("%s.%s.%s %d:%02d", weekDays[weekday], month, day, hour, min)
+  end)
 
   ObjectiveTrackerFrame:UnregisterAllEvents()
   ObjectiveTrackerFrame:Hide()