annotate ObjectiveInfo.lua @ 0:3dbcad2b387d

initial push
author Nenue
date Wed, 30 Mar 2016 02:24:56 -0400
parents
children b0447b382f36
rev   line source
Nenue@0 1 local B = select(2,...).frame
Nenue@0 2 local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack
Nenue@0 3 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
Nenue@0 4 local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
Nenue@0 5 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@0 6 local print = B.print('Objectives')
Nenue@0 7
Nenue@0 8 local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs
Nenue@0 9 --------------------------------------------------------------------
Nenue@0 10 --- Tracker-specific data retrieval functions
Nenue@0 11 --------------------------------------------------------------------
Nenue@0 12
Nenue@0 13 Quest.GetNumWatched = function()
Nenue@0 14 return GetNumQuestWatches ()
Nenue@0 15 end
Nenue@0 16 Quest.GetInfo = function (self, watchIndex)
Nenue@0 17 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
Nenue@0 18 local questID, title, questLogIndex, numObjectives, requiredMoney, isComplete,
Nenue@0 19 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
Nenue@0 20 print(GetQuestWatchInfo(watchIndex))
Nenue@0 21 if not questID then
Nenue@0 22 return
Nenue@0 23 end
Nenue@0 24 print(self.Info)
Nenue@0 25 self.Info[questID] = self.Info[questID] or {}
Nenue@0 26
Nenue@0 27 local q = self.Info[questID]
Nenue@0 28 q.watchIndex = watchIndex
Nenue@0 29 q.type = 'Quest'
Nenue@0 30 q.questID = questID
Nenue@0 31 q.title = title
Nenue@0 32 q.questLogIndex = questLogIndex
Nenue@0 33 q.numObjectives = numObjectives
Nenue@0 34 q.requiredMoney = requiredMoney
Nenue@0 35 q.isComplete = isComplete
Nenue@0 36 q.startEvent = startEvent
Nenue@0 37 q.isAutoComplete = isAutoComplete
Nenue@0 38 q.failureTime = failureTime
Nenue@0 39 q.timeElapsed = timeElapsed
Nenue@0 40 q.questType = questType
Nenue@0 41 q.isTask = isTask
Nenue@0 42 q.isStory = isStory
Nenue@0 43 q.isOnMap = isOnMap
Nenue@0 44 q.hasLocalPOI = hasLocalPOI
Nenue@0 45
Nenue@0 46 --- Start QuestLogEntry calls
Nenue@0 47 -----------------------------------------
Nenue@0 48 SelectQuestLogEntry(questLogIndex)
Nenue@0 49 q.greenRange = GetQuestGreenRange()
Nenue@0 50 q.isDaily = QuestIsDaily()
Nenue@0 51 q.isWeekly = QuestIsWeekly()
Nenue@0 52 -----------------------------------------
Nenue@0 53
Nenue@0 54 --- End QuestLogEntry calls
Nenue@0 55 print(' |cFF0088FF', q.isDaily, q.isWeekly)
Nenue@0 56
Nenue@0 57 q.isComplete = IsQuestComplete(questID)
Nenue@0 58 q.isBreadCrumb = IsBreadcrumbQuest(questID)
Nenue@0 59 q.isStoryQuest = IsStoryQuest(questID)
Nenue@0 60 q.completionText= GetQuestLogCompletionText(questLogIndex)
Nenue@0 61 q.trackingID = questID
Nenue@0 62 q.superTracked = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue
Nenue@0 63 q.numObjectives = GetNumQuestLeaderBoards(questLogIndex)
Nenue@0 64 q.objectives = {}
Nenue@0 65 for i = 1, q.numObjectives do
Nenue@0 66 local text, type, finished = GetQuestLogLeaderBoard(i, questLogIndex)
Nenue@0 67 q.objectives[i] = {
Nenue@0 68 type = type,
Nenue@0 69 text = text,
Nenue@0 70 finished = finished
Nenue@0 71 }
Nenue@0 72 if type == 'event' then
Nenue@0 73 elseif type == 'monster' then
Nenue@0 74 elseif type == 'object' then
Nenue@0 75 elseif type == 'reputation' then
Nenue@0 76 elseif type == 'item' then
Nenue@0 77 end
Nenue@0 78 end
Nenue@0 79
Nenue@0 80 local link, icon, charges = GetQuestLogSpecialItemInfo(questLogIndex)
Nenue@0 81 local start, duration, enable = GetQuestLogSpecialItemCooldown(questLogIndex)
Nenue@0 82 if link or icon or charges then
Nenue@0 83 q.specialItem = {
Nenue@0 84 link = link,
Nenue@0 85 charges = charges,
Nenue@0 86 icon = icon,
Nenue@0 87 start = start,
Nenue@0 88 duration = duration,
Nenue@0 89 enable = enable,
Nenue@0 90 }
Nenue@0 91 end
Nenue@0 92
Nenue@0 93 self.LogInfo[questLogIndex] = q
Nenue@0 94 print('|cFF0088FFGetQuestInfo('..questID..')|r', questLogIndex, title)
Nenue@0 95 return q
Nenue@0 96 end
Nenue@0 97
Nenue@0 98 Cheevs.GetNumWatched = function(self)
Nenue@0 99 Cheevs.trackedCheevs = {GetTrackedAchievements()}
Nenue@0 100 return GetNumTrackedAchievements()
Nenue@0 101 end
Nenue@0 102 Cheevs.GetInfo = function(self, index)
Nenue@0 103 local cheevID = Cheevs.trackedCheevs[index]
Nenue@0 104 local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID)
Nenue@0 105
Nenue@0 106 print('|cFF00FF00', GetAchievementNumCriteria(cheevID))
Nenue@0 107 self.Info[cheevID] = {}
Nenue@0 108 local c = self.Info[cheevID]
Nenue@0 109 c.type = 'Cheevs'
Nenue@0 110 c.watchIndex = index
Nenue@0 111 c.cheevID = cheevID
Nenue@0 112 c.title = name
Nenue@0 113 c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy =
Nenue@0 114 points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy
Nenue@0 115 c.numObjectives = GetAchievementNumCriteria(cheevID)
Nenue@0 116 c.objectives = {}
Nenue@0 117 for i = 1, c.numObjectives do
Nenue@0 118 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
Nenue@0 119 c.objectives[i] = {
Nenue@0 120 text = description,
Nenue@0 121 type = type,
Nenue@0 122 finished = completed,
Nenue@0 123 quantity = quantity,
Nenue@0 124 requiredQuantity = requiredQuantity,
Nenue@0 125 characterName = characterName,
Nenue@0 126 flags = flags,
Nenue@0 127 assetID = assetID,
Nenue@0 128 quantityString = quantityString,
Nenue@0 129 criteriaID = criteriaID,
Nenue@0 130 }
Nenue@0 131 end
Nenue@0 132
Nenue@0 133 self.WatchInfo[index] = c
Nenue@0 134 return self.Info[cheevID]
Nenue@0 135 end