diff ObjectiveUI.lua @ 19:605e8f0e46db

ObjectiveCore / Style / Events / Frame - polishing the execution path for better performance - make use of the Blizzard_ObjectiveTracker bitfield values to ensure compatibility in possible secure hooks - avoid full updates when possible (using said bitfield values to indicate targeted sections) - extreme streamlining of event handling layout: specific reason updates are invoked from API hooks; broader updates are invoked by when the event listener catches something vague like 'QUEST_LOG_UPDATE'
author Nenue
date Wed, 06 Apr 2016 07:38:35 -0400
parents 880828018bf4
children d5ee940de273
line wrap: on
line diff
--- a/ObjectiveUI.lua	Tue Apr 05 02:38:01 2016 -0400
+++ b/ObjectiveUI.lua	Wed Apr 06 07:38:35 2016 -0400
@@ -6,7 +6,7 @@
 local B = select(2,...).frame
 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
 local print = B.print('Objectives')
-local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs
+local DefaultTracker, AutoQuest, Quest, Cheevs = mod.DefaultTracker, mod.AutoQuest, mod.Quest, mod.Cheevs
 local itemButtonSize, itemButtonSpacing =  36, 1
 local tremove, tremovebyval = table.remove, table.removebyval
 
@@ -16,14 +16,14 @@
 --- -
 --------------------------------------------------------------------
 
-Tracker.Select = function(self) end
-Tracker.Open = function(self) end
-Tracker.Remove = function(self) end
-Tracker.Report = function(self)
+DefaultTracker.Select = function(self) end
+DefaultTracker.Open = function(self) end
+DefaultTracker.Remove = function(self) end
+DefaultTracker.Report = function(self)
   print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.')
 end
 
-Tracker.OnMouseUp = function(self, button)
+DefaultTracker.OnMouseUp = function(self, button)
   print(self.handler.name, self.mainStyle, self.subStyle)
   if button == 'LeftButton' then
     if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
@@ -43,12 +43,13 @@
   print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
 end
 
-Tracker.OnMouseDown = function(self, button)
+DefaultTracker.OnMouseDown = function(self, button)
   self:SetStyle('TrackerBlock', self.handler.name, 'MouseDown')
   print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
   print(self.info.title)
 end
 
+
 AutoQuest.Select = function(self)
   if self.info.popupType == 'OFFER'  then
     ShowQuestOffer(self.info.questIndex)
@@ -58,13 +59,12 @@
   RemoveAutoQuestPopUp(self.info.questID)
 end
 
-Quest.Select = function(self) -- remote quests will get listed here as well, so their turn-in data needs to be checked
-  if AutoQuest.Info[self.info.questID] then
-    AutoQuest.Select(self)
+Quest.Select = function(self)
+  if self.info.isAutoComplete and self.info.isComplete then
+    ShowQuestComplete(self.info.questLogIndex)
   else
     SetSuperTrackedQuestID(self.info.questID)
   end
-  mod.UpdateWrapper()
 end
 
 Quest.Link = function(self)
@@ -92,7 +92,7 @@
   RemoveTrackedAchievement(self.info.cheevID)
 end
 Cheevs.OnMouseUp = function(self, button)
-  Tracker.OnMouseUp(self, button)
+  DefaultTracker.OnMouseUp(self, button)
 end
 Cheevs.Link = function(self)
   local achievementLink = GetAchievementLink(self.info.cheevID);