Nenue@0: local B = select(2,...).frame Nenue@0: local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack Nenue@0: local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo Nenue@0: local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo Nenue@0: local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') Nenue@14: local print = B.print('TrackerInfo') Nenue@0: Nenue@14: local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs Nenue@0: -------------------------------------------------------------------- Nenue@0: --- Tracker-specific data retrieval functions Nenue@0: -------------------------------------------------------------------- Nenue@13: Nenue@13: Nenue@13: ----------------------------- Nenue@13: --- AUTO_QUEST Nenue@13: AutoQuest.GetNumWatched = GetNumAutoQuestPopUps Nenue@13: AutoQuest.GetInfo = function(watchIndex) Nenue@13: return Quest.GetInfo(watchIndex) Nenue@13: end Nenue@13: Nenue@13: ----------------------------- Nenue@14: --- BONUS OBJECTIVE Nenue@14: Bonus.TasksTable = {} Nenue@14: Bonus.TasksPOI = {} Nenue@14: Bonus.TaskScenario = {} Nenue@14: Nenue@14: local taskData = {} Nenue@14: Bonus.QuestBlock = {} Nenue@14: Bonus.GetNumWatched = function() Nenue@14: Bonus.TasksTable = GetTasksTable() Nenue@14: local numTasks = 0 Nenue@14: for i, questID in ipairs(Bonus.TasksTable) do Nenue@14: local isInArea, isOnMap, numObjectives = GetTaskInfo(questID) Nenue@14: if isInArea and isOnMap then Nenue@14: numTasks = numTasks + 1 Nenue@14: end Nenue@14: end Nenue@14: Bonus.numAll = #Bonus.TasksTable Nenue@14: Bonus.numWatched = numTasks Nenue@14: return GetNumQuestLogTasks() Nenue@14: end Nenue@14: Bonus.GetInfo = function(self, watchIndex) Nenue@14: local questID = Bonus.TasksTable[watchIndex] Nenue@14: if not questID then Nenue@14: print('|cFFFF4400no quest ID for row', watchIndex) Nenue@14: return Nenue@14: end Nenue@14: Nenue@14: Nenue@14: local t= {} Nenue@14: t.isInArea, t.isOnMap, t.numObjectives = GetTaskInfo(questID) Nenue@14: Nenue@14: print('isInArea', t.isInArea, 'isOnMap', t.isOnMap, 'numObj', t.numObjectives) Nenue@14: t.displayObjectives = false Nenue@14: t.isComplete = true Nenue@14: t.questID = questID Nenue@14: if t.numObjectives >= 1 then Nenue@14: print(t.numObjectives,'objective rows') Nenue@14: t.objectives = {} Nenue@14: for i = 1, t.numObjectives do Nenue@14: t.objectives[i] = {} Nenue@14: local o = t.objectives[i] Nenue@14: o.index = i Nenue@14: o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, true) Nenue@14: Nenue@14: print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective) Nenue@14: t.displayObjectives = t.displayObjectives or o.displayAsObjective Nenue@14: t.isComplete = t.isComplete and o.finished Nenue@14: Nenue@14: end Nenue@14: end Nenue@14: Bonus.TasksTable[questID] = t Nenue@14: Nenue@14: return t Nenue@14: end Nenue@14: Nenue@14: ----------------------------- Nenue@13: --- QUEST Nenue@1: Quest.itemButtons = {} Nenue@1: Quest.freeButtons = {} Nenue@1: Quest.POI = {} Nenue@5: Quest.QuestBlock = {} Nenue@0: Quest.GetNumWatched = function() Nenue@14: Quest.numAll = GetNumQuestLogEntries() Nenue@14: Quest.numWatched = GetNumQuestWatches() Nenue@14: return Quest.numWatched Nenue@0: end Nenue@0: Quest.GetInfo = function (self, watchIndex) Nenue@0: print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') Nenue@1: local questID, title, questIndex, numObjectives, requiredMoney, isComplete, Nenue@0: startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) Nenue@13: Nenue@14: local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) Nenue@13: local questTagID, tagName = GetQuestTagInfo(questID); Nenue@13: Nenue@0: if not questID then Nenue@0: return Nenue@0: end Nenue@0: self.Info[questID] = self.Info[questID] or {} Nenue@0: Nenue@0: local q = self.Info[questID] Nenue@0: q.watchIndex = watchIndex Nenue@0: q.type = 'Quest' Nenue@0: q.questID = questID Nenue@0: q.title = title Nenue@13: q.level = level Nenue@1: q.questLogIndex = questIndex Nenue@0: q.numObjectives = numObjectives Nenue@0: q.requiredMoney = requiredMoney Nenue@0: q.isComplete = isComplete Nenue@0: q.startEvent = startEvent Nenue@0: q.isAutoComplete = isAutoComplete Nenue@0: q.failureTime = failureTime Nenue@0: q.timeElapsed = timeElapsed Nenue@0: q.questType = questType Nenue@0: q.isTask = isTask Nenue@0: q.isStory = isStory Nenue@0: q.isOnMap = isOnMap Nenue@0: q.hasLocalPOI = hasLocalPOI Nenue@0: Nenue@13: q.isDaily = ( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) Nenue@13: q.isWeekly = ( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) ) Nenue@13: q.isComplete = isComplete Nenue@13: q.isStory = isStory Nenue@13: q.isTask = isTask Nenue@14: Nenue@14: if isTask then Nenue@14: --q.task = Bonus.GetInfo(questID) Nenue@14: end Nenue@14: Nenue@13: --q.isBreadCrumb = isBreadCrumb Nenue@1: q.completionText= GetQuestLogCompletionText(questIndex) Nenue@1: q.numObjectives = GetNumQuestLeaderBoards(questIndex) Nenue@1: q.isWatched = IsQuestWatched(questIndex) Nenue@13: q.isHardWatched = IsQuestHardWatched(questIndex) Nenue@0: q.objectives = {} Nenue@0: for i = 1, q.numObjectives do Nenue@1: local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) Nenue@0: q.objectives[i] = { Nenue@14: index = i, Nenue@0: type = type, Nenue@0: text = text, Nenue@0: finished = finished Nenue@0: } Nenue@0: if type == 'event' then Nenue@0: elseif type == 'monster' then Nenue@0: elseif type == 'object' then Nenue@0: elseif type == 'reputation' then Nenue@0: elseif type == 'item' then Nenue@0: end Nenue@0: end Nenue@0: Nenue@1: local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex) Nenue@1: local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex) Nenue@0: if link or icon or charges then Nenue@0: q.specialItem = { Nenue@1: questID = questID, Nenue@1: questIndex = questIndex, Nenue@0: link = link, Nenue@0: charges = charges, Nenue@0: icon = icon, Nenue@0: start = start, Nenue@0: duration = duration, Nenue@0: enable = enable, Nenue@0: } Nenue@0: end Nenue@0: Nenue@1: Nenue@1: if QuestHasPOIInfo(questID) then Nenue@1: local distance, onContinent = GetDistanceSqToQuest(questIndex) Nenue@1: if distance ~= nil and distance > 0 then Nenue@1: self.POI[questIndex] = { Nenue@1: questIndex = questIndex, Nenue@1: questID = questID, Nenue@1: distance = distance, Nenue@1: onContinent = onContinent Nenue@1: } Nenue@1: end Nenue@1: end Nenue@1: Nenue@8: q.superTracked = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue Nenue@8: self.WatchInfo[watchIndex] = q Nenue@1: self.LogInfo[questIndex] = q Nenue@2: print('- logIndex =', questIndex, 'title =', title) Nenue@0: return q Nenue@0: end Nenue@0: Nenue@1: Quest.GetClosest = function() Nenue@1: local minID Nenue@1: local minDist = math.huge Nenue@1: for i = 1, Quest.GetNumWatched() do Nenue@1: local info = Quest.GetInfo(i) Nenue@1: if info.hasLocalPOI then Nenue@1: local distance, onContinent = GetDistanceSqToQuest(info.questIndex) Nenue@1: end Nenue@1: end Nenue@1: end Nenue@1: Nenue@6: Nenue@0: Cheevs.GetNumWatched = function(self) Nenue@0: Cheevs.trackedCheevs = {GetTrackedAchievements()} Nenue@0: return GetNumTrackedAchievements() Nenue@0: end Nenue@0: Cheevs.GetInfo = function(self, index) Nenue@0: local cheevID = Cheevs.trackedCheevs[index] Nenue@0: local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) Nenue@0: Nenue@0: self.Info[cheevID] = {} Nenue@0: local c = self.Info[cheevID] Nenue@0: c.type = 'Cheevs' Nenue@0: c.watchIndex = index Nenue@0: c.cheevID = cheevID Nenue@0: c.title = name Nenue@0: 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: points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy Nenue@0: c.numObjectives = GetAchievementNumCriteria(cheevID) Nenue@0: c.objectives = {} Nenue@0: for i = 1, c.numObjectives do Nenue@0: local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) Nenue@0: c.objectives[i] = { Nenue@14: index = i, Nenue@8: cheevID = cheevID, Nenue@0: text = description, Nenue@0: type = type, Nenue@0: finished = completed, Nenue@14: value = quantity, Nenue@14: maxValue = requiredQuantity, Nenue@0: characterName = characterName, Nenue@0: flags = flags, Nenue@0: assetID = assetID, Nenue@0: quantityString = quantityString, Nenue@0: criteriaID = criteriaID, Nenue@0: } Nenue@0: end Nenue@3: print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) Nenue@0: Nenue@0: self.WatchInfo[index] = c Nenue@0: return self.Info[cheevID] Nenue@0: end