view ObjectiveTracker/Events.lua @ 37:e84d645c8ab8

- revised the tracker update function to build its complete data list up front and use the values as points of comparison for determining possible out of place blocks, which will be iterated over afterward to remove what wasn't re-used - also entailed revising the exact role of global event handlers and function hooks, limiting their directions of communication so one doesn't end up calling the other multiple or inifinity times - schema handling polish
author Nenue
date Mon, 18 Apr 2016 07:56:23 -0400
parents 9856ebc63fa4
children 1f8f9cc3d956
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 3/30/2016 1:23 AM
local B = select(2,...).frame
local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Objectives')

local _G = _G
local OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT
local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED
local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
local GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID = GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID
local QuestPOIUpdateIcons = QuestPOIUpdateIcons
-------------------------------------------------------------------
--- Deal with blizzard API calls that affect the tracker/log contents
--- mainly just hiding blocks until they can be picked up by the next update event
-------------------------------------------------------------------
T.AddQuestWatch = function(questID)
  if not B.Conf.VeneerObjectiveWrapper.enabled then return end
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end

local Quest = T.Quest
T.RemoveQuestWatch = function(questIndex, ...)
  print('|cFFFF8800RemoveQuestWatch', questIndex, ...)

  --return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end

T.AddTrackedAchievement = function(cheevID)
  T.CleanWidgets()
  --return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT
end


T.RemoveTrackedAchievement = function(cheevID)
  T.CleanWidgets()
  --return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT
end

T.AcceptQuest = function()
end

T.AbandonQuest = function()
  QuestPOIUpdateIcons()
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end
T.CompleteQuest = function()
  local questID = GetQuestID()
  if T.Quest.Info[questID] then
    local q = T.Quest.Info[questID]
    if q.logIndex then
      local block = T.Quest.LogBlock[q.logIndex]
      if block then
        block:Hide()
      end
    end
  end

  QuestPOIUpdateIcons()
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end
T.AddAutoQuestPopUp = function(...)
  return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
end
T.RemoveAutoQuestPopUp = function(questID)
  return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP

end



T.SetSuperTrackedQuestID = function(questID)
  --T:Update()
end