view ObjectiveTracker/APIHooks.lua @ 60:2a636b00c31e

- buff time progress bars touched up
author Nenue
date Mon, 15 Aug 2016 07:23:56 -0400
parents dd1ae565f559
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 T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Objectives')
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 = GetQuestID
local QuestPOIUpdateIcons = QuestPOIUpdateIcons

--- Module updates triggered by user events
T.AcknowledgeAutoAcceptQuest = function(...)
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
end

T.AddQuestWatch = function(questID)
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end
T.AbandonQuest = function()
  QuestPOIUpdateIcons()
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end
T.CompleteQuest = function()
  QuestPOIUpdateIcons()
  return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST
end
T.AddAutoQuestPopUp = function(...)
  return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
end
T.RemoveAutoQuestPopUp = function(questID)
  AddQuestWatch(GetQuestLogIndexByID(questID))
  return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP
end
--- SUPER_TRACKED_QUEST_CHANGED will fires
local tprint = B.print('Tracker')
T.SetSuperTrackedQuestID = function(questID)
  tprint('SetSuperTrackedQuestID', questID)
  for index, block in ipairs(T.Quest.usedBlocks) do
    if block:IsVisible() then
      if block.info.id == questID then
        block.SelectionOverlay:Show()
      else
        block.SelectionOverlay:Hide()
      end
    end
  end
end



local previousSelection
--@debug@
local tprint = B.print('Tracker') -- @debug@
T.SelectQuestLogEntry = function(logIndex)
  --@debug@
  if previousSelection and previousSelection ~= logIndex then
    print('swapping selection from', previousSelection, 'to', logIndex)
  end--@end-debug@
  previousSelection = logIndex
end

--- Dummies for future ideas
T.RemoveQuestWatch = function(questIndex, ...) end
T.AddTrackedAchievement = function(cheevID) end
T.RemoveTrackedAchievement = function(cheevID) end
T.AcceptQuest = function() end