annotate 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
rev   line source
Nenue@28 1 --- ${PACKAGE_NAME}
Nenue@28 2 -- @file-author@
Nenue@28 3 -- @project-revision@ @project-hash@
Nenue@28 4 -- @file-revision@ @file-hash@
Nenue@28 5 -- Created: 4/13/2016 7:49 PM
Nenue@28 6 local B = select(2,...).frame
Nenue@28 7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@29 8 local print = B.print('Info')
Nenue@29 9 local lprint = B.print('Line')
Nenue@29 10 local AutoQuest, Quest = T.AutoQuest, T.Quest
Nenue@28 11 local ShowQuestOffer, ShowQuestComplete, RemoveAutoQuestPopUp = ShowQuestOffer, ShowQuestComplete, RemoveAutoQuestPopUp
Nenue@29 12 local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle
Nenue@29 13 --- Data retrieval
Nenue@29 14 function AutoQuest:GetNumWatched ()
Nenue@29 15 print(self.name, self)
Nenue@29 16 Quest:GetNumWatched()
Nenue@29 17 self.numWatched = GetNumAutoQuestPopUps()
Nenue@28 18
Nenue@29 19 return self.numWatched
Nenue@29 20 end
Nenue@29 21 AutoQuest.GetInfo = function(self, popupIndex)
Nenue@29 22
Nenue@29 23
Nenue@29 24 local questID, type = GetAutoQuestPopUp(popupIndex)
Nenue@29 25 local questLogIndex = GetQuestLogIndexByID(questID)
Nenue@29 26 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questLogIndex)
Nenue@29 27
Nenue@29 28 self.Info[questID] = self.Info[questID] or {}
Nenue@29 29 local popup = self.Info[questID]
Nenue@30 30 popup.questID = questID
Nenue@30 31 popup.id = questID
Nenue@29 32 popup.title = title
Nenue@29 33 popup.description = type
Nenue@29 34 popup.popupType = type
Nenue@29 35 popup.questLogIndex = questLogIndex
Nenue@29 36 popup.popupIndex = popupIndex
Nenue@29 37
Nenue@29 38 self.Info[questID] = popup
Nenue@29 39 self.WatchInfo[popupIndex] = popup
Nenue@29 40
Nenue@29 41
Nenue@29 42 return self.Info[questID]
Nenue@29 43 end
Nenue@29 44
Nenue@28 45 AutoQuest.UpdateObjectives = function(handler, block)
Nenue@28 46 local print = lprint
Nenue@28 47 if block.info.type == 'OFFER' then
Nenue@29 48 block.status:SetText(T.strings.CLICK_TO_ACCEPT)
Nenue@28 49 end
Nenue@28 50 end
Nenue@28 51
Nenue@28 52 AutoQuest.Select = function(self)
Nenue@28 53
Nenue@28 54 if self.info.popupType == 'OFFER' then
Nenue@28 55 ShowQuestOffer(self.info.questIndex)
Nenue@28 56 else
Nenue@28 57 ShowQuestComplete(self.info.questIndex)
Nenue@28 58 end
Nenue@28 59 RemoveAutoQuestPopUp(self.info.questID)
Nenue@28 60 end
Nenue@28 61
Nenue@28 62 AutoQuest.Link = T.Quest.Link