view ObjectiveTracker/AutoQuestPopups.lua @ 30:7583684becf4

- implement procedural block contents generation - redo anchor calculations to allow for transitional animation - attempt to sort out event handling quirks related to autopopup quest completion and turn-in - revise the data structures created by the different GetInfo's - start on trimming out redundant variables
author Nenue
date Thu, 14 Apr 2016 17:11:13 -0400
parents adcd7c328d07
children 48b3e3959a0a
line wrap: on
line source
--- ${PACKAGE_NAME}
-- @file-author@
-- @project-revision@ @project-hash@
-- @file-revision@ @file-hash@
-- Created: 4/13/2016 7:49 PM
local B = select(2,...).frame
local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Info')
local lprint = B.print('Line')
local AutoQuest, Quest = T.AutoQuest, T.Quest
local ShowQuestOffer, ShowQuestComplete, RemoveAutoQuestPopUp = ShowQuestOffer, ShowQuestComplete, RemoveAutoQuestPopUp
local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle
--- Data retrieval
function AutoQuest:GetNumWatched ()
  print(self.name, self)
  Quest:GetNumWatched()
  self.numWatched = GetNumAutoQuestPopUps()

  return self.numWatched
end
AutoQuest.GetInfo = function(self, popupIndex)


  local questID, type = GetAutoQuestPopUp(popupIndex)
  local questLogIndex = GetQuestLogIndexByID(questID)
  local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questLogIndex)

  self.Info[questID] = self.Info[questID] or {}
  local popup = self.Info[questID]
  popup.questID = questID
  popup.id = questID
  popup.title = title
  popup.description = type
  popup.popupType = type
  popup.questLogIndex = questLogIndex
  popup.popupIndex = popupIndex

  self.Info[questID] = popup
  self.WatchInfo[popupIndex] = popup


  return self.Info[questID]
end

AutoQuest.UpdateObjectives = function(handler, block)
  local print = lprint
  if block.info.type == 'OFFER' then
    block.status:SetText(T.strings.CLICK_TO_ACCEPT)
  end
end

AutoQuest.Select = function(self)

  if self.info.popupType == 'OFFER'  then
    ShowQuestOffer(self.info.questIndex)
  else
    ShowQuestComplete(self.info.questIndex)
  end
  RemoveAutoQuestPopUp(self.info.questID)
end

AutoQuest.Link = T.Quest.Link