view ObjectiveTracker/ObjectiveEvents.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 e837384ac363
children
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 mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Objectives')

--------------------------------------------------------------------
--- Events that are handled by Blizzard_ObjectiveTracker
--------------------------------------------------------------------

-------------------------------------------------------------------
--- Function hooks for BlizzUI compatibility
-------------------------------------------------------------------
mod.AddQuestWatch = function(questID)
    mod:Update(0x00000003)
end

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

  local info = mod.Quest.LogInfo[questIndex]

  -- remove quest refs
  local block = Quest.QuestBlock[info.questID]
  Quest.QuestBlock[info.questID] = nil
  Quest.LogBlock[questIndex] = nil

  -- remove if they still match
  if Quest.WatchInfo[info.watchIndex] == info then
    print('cleaning dead WatchInfo entry')
    Quest.WatchInfo[info.watchIndex] = nil
  end

  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
end

mod.AddTrackedAchievement = function(cheevID)
  mod.CleanWidgets()
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
end


mod.RemoveTrackedAchievement = function(cheevID)
  print('|cFFFF8800UntrackAchievement', cheevID)
  mod.CleanWidgets()
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT)
end

mod.AcceptQuest = function()
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED)
end

mod.AbandonQuest = function()
  QuestPOIUpdateIcons()
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
end
mod.TurnInQuest = function()
  QuestPOIUpdateIcons()
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST)
end
mod.AddAutoQuestPopUp = function(...)
   mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
end
mod.RemoveAutoQuestPopUp = function(...)
  mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP)
end



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