diff ObjectiveCore.lua @ 16:880828018bf4

ObjectiveEvents - trim down the number of events that fire full updates - begin the general outline for determining which trackers need to refresh - handlers for accepting and completing auto-popup quests ObjectiveFrame - correct variables for money reward calculation - make sure everythign is scaling to the font strings and that the font strings aren't being pinned by SetSize ObjectiveInfo - implementation of autoquest popups - discern between internal and client bonus objective indexes - acquire the correct data set from bonus objective query ObjectiveStyle - look for a style table under the previously interpreted set before deferring standard options - horizontal/vertical options in gradient - remove height-fixing for font strings
author Nenue
date Tue, 05 Apr 2016 00:39:12 -0400
parents ed642234f017
children 605e8f0e46db
line wrap: on
line diff
--- a/ObjectiveCore.lua	Mon Apr 04 03:41:28 2016 -0400
+++ b/ObjectiveCore.lua	Tue Apr 05 00:39:12 2016 -0400
@@ -6,9 +6,9 @@
 local B = select(2,...).frame
 local pairs, setmetatable, type, tostring = pairs, setmetatable, type, tostring
 local format = string.format
-local M = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
 local print = B.print('Objectives')
-local ObjectiveTrackerFrame = ObjectiveTrackerFrame
+local ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame = ObjectiveTrackerFrame, VeneerObjectiveScroll, CreateFrame
 
 --[[
   Full quest info is available if:
@@ -25,95 +25,95 @@
     - Its binary completion status
 
 ]]
---- Global Frames
-local Wrapper = _G.VeneerObjectiveWrapper
-local Scroller = Wrapper.scrollArea
-local Scroll = _G.VeneerObjectiveScroll
+
+
+--- Performance values
+--[[
+  self:RegisterEvent("QUEST_LOG_UPDATE");
+	self:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED");
+	self:RegisterEvent("QUEST_WATCH_LIST_CHANGED");
+	self:RegisterEvent("QUEST_AUTOCOMPLETE");
+	self:RegisterEvent("QUEST_ACCEPTED");
+	self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED");
+	self:RegisterEvent("SCENARIO_UPDATE");
+	self:RegisterEvent("SCENARIO_CRITERIA_UPDATE");
+	self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE");
+	self:RegisterEvent("ZONE_CHANGED_NEW_AREA");
+	self:RegisterEvent("ZONE_CHANGED");
+	self:RegisterEvent("QUEST_POI_UPDATE");
+	self:RegisterEvent("VARIABLES_LOADED");
+	self:RegisterEvent("QUEST_TURNED_IN");
+	self:RegisterEvent("PLAYER_MONEY");
+ ]]
+mod.Reason ={
+  UPDATE_MASK_AUTOQUEST            = 0x00000001,
+  UPDATE_MASK_QUEST                = 0x00000002,
+  UPDATE_MASK_BONUS                = 0x00000004,
+  UPDATE_MASK_CHEEVS               = 0x00000008,
+  UPDATE_MASK_ALL                  = 0x00000017,
+
+  QUEST_LOG_UPDATE                 = 0x00000003,
+  TRACKED_ACHIEVEMENT_LIST_CHANGED = 0x00000008,
+  QUEST_WATCH_LIST_CHANGED         = 0x00000003,
+  QUEST_AUTOCOMPLETE               = 0x00000003,
+  QUEST_ACCEPTED                   = 0x00000003,
+  SUPER_TRACKED_QUEST_CHANGED      = 0x00000002,
+  SCENARIO_UPDATE                  = 0x00000004,
+  SCENARIO_CRITERIA_UPDATE         = 0x00000004,
+  TRACKED_ACHIEVEMENT_UPDATE       = 0x00000008,
+  ZONE_CHANGED_NEW_AREA            = 0x00000017,
+  ZONE_CHANGED                     = 0x00000017,
+  QUEST_POI_UPDATE                 = 0x00000003,
+  QUEST_TURNED_IN                  = 0x00000003,
+}
+mod.MoneyReasons = 0
 
 --- Baseline defaults
-M.defaults = {
-
-}
+mod.defaults = {}
 
 --- list used to make things happen
-M.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
+mod.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
 
 --- ipairs() list of handlers for wrapper update
-M.orderedHandlers = {}
-M.orderedTrackers = {}
-M.indexedTrackers = {}
+mod.orderedHandlers = {}
+mod.orderedTrackers = {}
+mod.indexedTrackers = {}
 --- pairs() list of handler frames for tracker updates
-M.namedTrackers = {}
+mod.namedTrackers = {}
 
 --- Handler stubs
-M.AutoQuest = {
+mod.AutoQuest = {
   name = "AutoQuest",
-  displayName = "Local Quests",
+  displayName = "Notice",
 }
-M.Quest = {
+mod.Quest = {
   name = "Quest",
   displayName = "Quests",
 }
-M.Cheevs = {
+mod.Cheevs = {
   name = "Cheevs",
   displayName = "Achievements",
 }
-M.Bonus = {
+mod.Bonus = {
   name = "Bonus",
   displayName = "Bonus Objectives",
 }
 
-
---- Temp values set during updates
-local wrapperWidth, wrapperHeight
-local scrollWidth, scrollHeight
-local previousBlock
-local currentBlock
-
-local frame_guide_init = function(self)
-  self.testU = self.testU or self:CreateTexture('TestU', 'OVERLAY', 'VnTestLine')
-  self.testB = self.testB or self:CreateTexture('TestB', 'OVERLAY', 'VnTestLine')
-  self.testL = self.testL or self:CreateTexture('TestL', 'OVERLAY', 'VnTestLine')
-  self.testR = self.testR or self:CreateTexture('TestR', 'OVERLAY', 'VnTestLine')
-end
-local frame_guide = function(self, target)
-  if not target then return end
-  if target:IsDragging() then return end
-  local thickness = 1
-  local midX, midY = target:GetCenter()
-  local width, height = target:GetWidth() * 1.5, target:GetHeight() * 1.5
-  --print('frame', target:GetLeft(), target:GetTop(), target:GetRight(), target:GetBottom())
-  self.testB:ClearAllPoints()
-  self.testB:SetPoint('TOP', UIParent, 'BOTTOMLEFT', midX, target:GetBottom())
-  self.testB:SetSize(width,thickness)
-
-  self.testU:ClearAllPoints()
-  self.testU:SetPoint('BOTTOM', UIParent, 'BOTTOMLEFT', midX, target:GetTop())
-  self.testU:SetSize(width,thickness)
-
-  self.testL:ClearAllPoints()
-  self.testL:SetPoint('RIGHT', UIParent, 'BOTTOMLEFT', target:GetLeft(), midY)
-  self.testL:SetSize(thickness,height)
-
-  self.testR:ClearAllPoints()
-  self.testR:SetPoint('LEFT', UIParent, 'BOTTOMLEFT', target:GetRight(), midY)
-  self.testR:SetSize(thickness,height)
-end
-
 --- Handler template
 local CreateHandler = function (self, name, index)
   print(self, name)
-  local handler = setmetatable({}, {
+
+  local handler = setmetatable(mod[name] or {}, {
     __tostring = function() return name end,
-    __call = function (self) M.UpdateTracker(self) end
+    __call = function (self) mod.UpdateTracker(self) end
   })
-  if type(M.orderedHandlers[index]) == 'table' then
-    return M.orderedHandlers[index]
+  if type(mod.orderedHandlers[index]) == 'table' then
+    return mod.orderedHandlers[index]
   end
 
   print('take up locals first')
   local preset = {}
-  for k,v in pairs(M[name]) do
+  for k,v in pairs(mod[name]) do
     preset[k] = true
     if type(v) == 'table' then
       handler[k] = {}
@@ -122,6 +122,7 @@
     end
   end
 
+
   print('resulting handler contents')
   for k, v in pairs(self) do
     if not handler[k] then
@@ -129,7 +130,7 @@
         -- assume all tables to be local data; don't inherit or ref
         handler[k] = {}
       else
-        handler[k] = M.Tracker[k]
+        handler[k] = mod.Tracker[k]
       end
     else
       print(name, 'has its own', k)
@@ -137,18 +138,20 @@
   end
   print('|cFFFF4400'..tostring(name)..'|r:')
   for k, v in pairs(handler) do
-    print(string.format("%24s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v)))
+    print(format("%24s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v)))
   end
-  M[name] = handler
-  M.orderedHandlers[index] = handler
+
+  mod[name] = handler
+
+  mod.orderedHandlers[index] = handler
   return true
 end
 
-M.Tracker = setmetatable({}, {
+mod.Tracker = setmetatable({}, {
   __call = CreateHandler,
   __tostring = function() return 'DEFAULT_TRACKING_HANDLER' end
 })
-local Tracker = M.Tracker
+local Tracker = mod.Tracker
 Tracker.numWatched = 0   --- number of entries being handled
 Tracker.numBlocks = 0    --- number of blocks created
 Tracker.actualBlocks = 0 --- number of blocks in use
@@ -159,10 +162,8 @@
 Tracker.Watched = {}     -- find by watchIndex
 Tracker.Info = {}        -- find by data ID
 Tracker.BlockInfo = {}   -- find by block ID
-Tracker.LogInfo = {}     -- find by log ID (quest log mainly)
-Tracker.WatchInfo = {}
-Tracker.LogBlock = {}
-Tracker.WatchBlock = {}
+Tracker.WatchInfo = {}   -- find data  by watch index
+Tracker.WatchBlock = {}  -- find block by watch index
 
 
 
@@ -173,8 +174,8 @@
       block = handler.freeBlocks[#handler.freeBlocks]
       handler.freeBlocks[#handler.freeBlocks] = nil
     else
-      block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
-      block.SetStyle = M.SetBlockStyle
+      block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, VeneerObjectiveScroll, 'VeneerTrackerBlock')
+      block.SetStyle = mod.SetBlockStyle
       block.Select = handler.Select
       block.Open = handler.Open
       block.Remove = handler.Remove
@@ -189,38 +190,10 @@
   return handler.usedBlocks[blockIndex]
 end
 
-function M:OnInitialize()
+function mod:OnInitialize()
   self.InitializeWrapper()
   self.InitializeXPTracker()
-  M.SetEvents()
+  mod.SetEvents()
   ObjectiveTrackerFrame:UnregisterAllEvents()
   ObjectiveTrackerFrame:Hide()
-
 end
-
---[[
-QUESTLINE_UPDATE	This event is not yet documented
-QUESTTASK_UPDATE	This event is not yet documented
-QUEST_ACCEPTED	Fires when a new quest is added to the player's quest log (which is what happens after a player accepts a quest).
-QUEST_ACCEPT_CONFIRM	Fires when certain kinds of quests (e.g. NPC escort quests) are started by another member of the player's group
-QUEST_AUTOCOMPLETE	Fires when a quest is automatically completed (remote handin available)
-QUEST_BOSS_EMOTE	This event is not yet documented
-QUEST_CHOICE_CLOSE	This event is not yet documented
-QUEST_CHOICE_UPDATE	This event is not yet documented
-QUEST_COMPLETE	Fires when the player is looking at the "Complete" page for a quest, at a questgiver.
-QUEST_DETAIL	Fires when details of an available quest are presented by a questgiver
-QUEST_FINISHED	Fires when the player ends interaction with a questgiver or ends a stage of the questgiver dialog
-QUEST_GREETING	Fires when a questgiver presents a greeting along with a list of active or available quests
-QUEST_ITEM_UPDATE	Fires when information about items in a questgiver dialog is updated
-QUEST_LOG_UPDATE	Fires when the game client receives updates relating to the player's quest log (this event is not just related to the quests inside it)
-QUEST_POI_UPDATE	This event is not yet documented
-QUEST_PROGRESS	Fires when interacting with a questgiver about an active quest
-QUEST_REMOVED	This event is not yet documented
-QUEST_TURNED_IN	Fired when a quest is turned in
-QUEST_WATCH_LIST_CHANGED	This event is not yet documented
-QUEST_WATCH_OBJECTIVES_CHANGED	This event is not yet documented
-QUEST_WATCH_UPDATE	Fires when the player's status regarding a quest's objectives changes, for instance picking up a required object or killing a mob for that quest. All forms of (quest objective) progress changes will trigger this event.]
-
-TRACKED_ACHIEVEMENT_LIST_CHANGED	This event is not yet documented
-TRACKED_ACHIEVEMENT_UPDATE	Fires when the player's progress changes on an achievement marked for watching in the objectives tracker
- ]]
\ No newline at end of file