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@0: local print = B.print('Objectives') Nenue@0: Nenue@0: local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, 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.name = "Remote Quests" 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@13: --- QUEST Nenue@13: Quest.name = "Quests" Nenue@1: Quest.itemButtons = {} Nenue@1: Quest.freeButtons = {} Nenue@1: Quest.POI = {} Nenue@5: Quest.QuestBlock = {} Nenue@0: Quest.GetNumWatched = function() Nenue@0: return GetNumQuestWatches () 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@13: local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, 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@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@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@8: cheevID = cheevID, Nenue@0: text = description, Nenue@0: type = type, Nenue@0: finished = completed, Nenue@0: quantity = quantity, Nenue@0: requiredQuantity = 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