diff ObjectiveTracker/APIHooks.lua @ 44:756e8aeb040b

- Default.lua - simplified the response to SuperTrackedQuestID changes - tag icons work again
author Nenue
date Mon, 25 Apr 2016 19:37:13 -0400
parents ObjectiveTracker/Events.lua@03ed70f846de
children dd1ae565f559
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ObjectiveTracker/APIHooks.lua	Mon Apr 25 19:37:13 2016 -0400
@@ -0,0 +1,65 @@
+--- ${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.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)
+  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
+  T.SuperTrackedQuestID = questID
+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
\ No newline at end of file