# HG changeset patch # User Nenue # Date 1460598804 14400 # Node ID adcd7c328d075440c94be99d722f5940d860123f # Parent c33c17dd97e73d2c311c4510bd96f5b4bf862b12 code collation cleaning diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/Achievements.lua --- a/ObjectiveTracker/Achievements.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/Achievements.lua Wed Apr 13 21:53:24 2016 -0400 @@ -5,16 +5,60 @@ -- Created: 4/13/2016 7:48 PM local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') -local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band -local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText -local Cheevs = T.Cheevs -local format = format +local band = bit.band +local ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI = ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI +local AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement = AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement +local GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo = GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo +local GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo = GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo +local Default, Cheevs = T.DefaultHandler, T.Cheevs local print = B.print('Tracker') local lprint = B.print('Line') local iprint = B.print('Info') +--- Data retrieval +Cheevs.GetNumWatched = function(self) + print('|cFF00FF00' .. GetTime()) + Cheevs.trackedCheevs = {GetTrackedAchievements()} + return GetNumTrackedAchievements() +end +Cheevs.GetInfo = function(self, index) + local cheevID = Cheevs.trackedCheevs[index] + local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) + self.Info[cheevID] = {} + local c = self.Info[cheevID] + c.type = 'Cheevs' + c.watchIndex = index + c.cheevID = cheevID + c.title = name + c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy = + points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy + c.numObjectives = GetAchievementNumCriteria(cheevID) + c.objectives = {} + for i = 1, c.numObjectives do + local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) + c.objectives[i] = { + objectiveIndex = i, + cheevID = cheevID, + text = description, + type = type, + finished = completed, + value = quantity, + maxValue = requiredQuantity, + characterName = characterName, + flags = flags, + assetID = assetID, + quantityString = quantityString, + criteriaID = criteriaID, + } + end + print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) + self.WatchInfo[index] = c + return self.Info[cheevID] +end + +--- Content handlers Cheevs.UpdateLine = function(handler, block, line, data) local print = B.print('CheevsLine') line.progress = 0 @@ -41,8 +85,9 @@ end Cheevs.Select = function(self) - --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) + T:Update(Cheevs.updateReasonModule) end + Cheevs.Remove = function(self) RemoveTrackedAchievement(self.info.cheevID) diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/AutoQuestPopups.lua --- a/ObjectiveTracker/AutoQuestPopups.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/AutoQuestPopups.lua Wed Apr 13 21:53:24 2016 -0400 @@ -5,19 +5,46 @@ -- Created: 4/13/2016 7:49 PM local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') -local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band +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 lprint = B.print('Line') -local AutoQuest = T.AutoQuest +local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetQuestLogIndexByID, GetQuestLogTitle +--- Data retrieval +function AutoQuest:GetNumWatched () + print(self.name, self) + Quest:GetNumWatched() + self.numWatched = GetNumAutoQuestPopUps() ---- They are not exactly quests, but the aliases used to signal that a quest was pushed into your log by the environment. --- Once accepted they never appear again unless the quest is dropped (daily reset/abandon quest) -local CLICK_TO_COMPLETE = 'Click to Complete' -local CLICK_TO_ACCEPT = 'Click to Accept' + 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.title = title + popup.description = type + popup.popupType = type + popup.questID = questID + 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(CLICK_TO_ACCEPT) + block.status:SetText(T.strings.CLICK_TO_ACCEPT) end end diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/BonusObjectives.lua --- a/ObjectiveTracker/BonusObjectives.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/BonusObjectives.lua Wed Apr 13 21:53:24 2016 -0400 @@ -5,30 +5,250 @@ -- Created: 4/13/2016 7:48 PM local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') -local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band -local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText local Default, Quest = T.DefaultHandler, T.Quest -local format = format local print = B.print('Tracker') local lprint = B.print('Line') -local iprint = B.print('Info') -local Bonus = mod.Bonus +local Bonus = T.Bonus +local UnitName, GetRealmName, GetQuestObjectiveInfo, GetTasksTable, GetTaskInfo = UnitName, GetRealmName, GetQuestObjectiveInfo, GetTasksTable, GetTaskInfo +local GetMapNameByID, GetCurrentMapAreaID = GetMapNameByID, GetCurrentMapAreaID +local tinsert, ipairs, pairs, tostring = tinsert, ipairs, pairs, tostring +local GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo = GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo +local GetNumQuestLogRewards, GetQuestLogRewardInfo = GetNumQuestLogRewards, GetQuestLogRewardInfo +local GetQuestLogRewardMoney, GetMoneyString = GetQuestLogRewardMoney, GetMoneyString +local GetQuestProgressBarPercent, PERCENTAGE_STRING, GetTime = GetQuestProgressBarPercent, PERCENTAGE_STRING, GetTime ---- Module-specific data wrangling that has to happen during UpdateBlock() --- Most of this is sculpting objectives data into a parsible list. --- Some of it is additional block manipulation that doesn't quite fit with the other modules.. +local DoQuestRewards = function(t, questID) + local rewards = {} + t.numCurrencies = GetNumQuestLogRewardCurrencies(questID) + for i = 1, t.numCurrencies do + local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID) + tinsert(rewards,{ + type = 'currency', + index = i, + name = name, + texture = texture, + count = count + }); + end + -- items + t.numItems = GetNumQuestLogRewards(questID) + for i = 1, t.numItems do + local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID) + tinsert(rewards, { + type = 'item', + index = i , + name = name, + texture = texture, + count = count, + quality = quality, + isUsable = isUsable + }); + end + -- money + + local money = GetQuestLogRewardMoney(questID) + if ( money > 0 ) then + tinsert(rewards, { + type = 'money', + name = GetMoneyString(money), + texture = "Interface\\Icons\\inv_misc_coin_01", + count = 0, + }); + end + + if #rewards >= 1 then + t.rewardInfo = rewards + end +end + +--- Returns a tasks table modified to include recently completed objectives +local InternalGetTasksTable = function() + local savedTasks = T.Conf.TasksLog + local char = UnitName("player") + local realm = GetRealmName() + local tasks = GetTasksTable() + + for questID, data in pairs(Bonus.Info) do + + print(' -- questID:', questID, #data.objectives) + for i, o in ipairs(data.objectives) do + print(' --', i, o.text) + end + + end + + + for questID, data in pairs(savedTasks) do + if questID > 0 then + local found = false + for i = 1, #tasks do + if tasks[i] == questID then + found = true + break + end + end + -- if it's not part of the current table, then try to insert it where it was last found + if not found then + if data.watchIndex < #tasks then + tinsert(tasks, data.watchIndex, data) + else + tinsert(tasks, data) + end + end + end + end + return tasks +end + +--- Returns an entry from the composed tasks table if possible, otherwise makes an API pull +local InternalGetTaskInfo = function(questID) + local completedTasks = T.Conf.TasksLog + if completedTasks[questID] then + return true, true, #completedTasks[questID].objectives + else + return GetTaskInfo(questID) + end +end + +--- Same as above but for the objective entries +local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex) + local completedTasks = T.Conf.TasksLog + if ( completedTasks[questID] ) then + print('using internal data') + return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true; + else + return GetQuestObjectiveInfo(questID, objectiveIndex, false); + end +end + +--- end redundant copy of silliness +------------------------------------------------------------------------------------------ + +Bonus.Completed = {} +Bonus.POI = {} +Bonus.Scenario = {} +Bonus.QuestBlock = {} +Bonus.WatchInfo = {} +function Bonus:GetNumWatched () + print(self.name, self) + + local tasks = InternalGetTasksTable() + local numWatched = 0 + local numAll = 0 + self.WatchInfo = {} + print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks) + print(' TasksTable pull:') + for i, questID in ipairs(tasks) do + local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID) + local existingTask = self.QuestBlock[questID] + local displayObjectiveHeader = false; + local test = (isInArea or (isOnMap and existingTask)) + --local test = true + if test then + self.Info[questID] = self.Info[questID] or {} + + local t = self.Info[questID] + self.WatchInfo[i] = t + t.isInArea = isInArea + t.isOnMap = isOnMap + t.existingTask = existingTask + t.questID = questID + t.objectives = {} + t.taskIndex = i + + + DoQuestRewards(t, questID) + + local taskTitle + local taskFinished = true; + for objectiveIndex = 1, numObjectives do + local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false); + displayObjectiveHeader = displayObjectiveHeader or displayAsObjective; + if not taskTitle then + if objectiveType == 'progressbar' and not text:match('^%d%+\\%d+') then + taskTitle = text + text = '' + end + end + + + print(' --', text, objectiveType, finished, displayAsObjective) + t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {} + local o = t.objectives[objectiveIndex] + + o.objectiveIndex = objectiveIndex + o.text = text + o.objectiveType = objectiveType + o.finished = finished + o.displayAsObjective = displayAsObjective + print(' |cFF00FF88*', objectiveIndex, text) + end + + -- didn't get a name from progress bar? what about area name + if not taskTitle then + if isInArea then + taskTitle = GetMapNameByID(GetCurrentMapAreaID()) + end + end + t.title = taskTitle + end + + print (' |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r')) + end + + + self.numAll = #tasks + self.numWatched = #self.WatchInfo + print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating') + --return #tasks + return #self.WatchInfo +end + +--- info cleanup done when turn-ins are detected +Bonus.OnTurnIn = function(self, questID, xp, money) + + if #self.info.rewardInfo >= 1 then + for i, reward in ipairs(self.info.rewardInfo) do + --[[ + type = 'item', + index = i , + name = name, + texture = texture, + count = count, + quality = quality, + isUsable = isUsable + ]] + print(' reward ', i, ' ', reward.type, reward.name, reward.count) + + end + end + + print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money) + local savedTasks = B.Conf.TasksLog + + self.Info[questID].completedTime = GetTime() + self.Info[questID].animate = true + T.SetAnimate(self.watchReasonModule) + savedTasks[questID] = self.Info[questID] +end + +Bonus.GetInfo = function(self, taskIndex) + print(self.name, self) + return self.WatchInfo[taskIndex] +end + + + +--- Update hooks Bonus.UpdateObjectives = function(handler, block) Default.UpdateObjectives(handler, block) end - - Bonus.UpdateLine = function(handler, block, line, data) local info = block.info local print = lprint - line.displayColor = 'FFFFFF' line.displayText = data.text line.progress = 0 @@ -58,7 +278,6 @@ end Bonus.Select = function(self) - Bonus:OnTurnIn(self.info.questID) end Bonus.Remove = function(self) diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/Data.lua --- a/ObjectiveTracker/Data.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/Data.lua Wed Apr 13 21:53:24 2016 -0400 @@ -26,87 +26,10 @@ -------------------------------------------------------------------- -local DoQuestRewards= function(t, questID) - local rewards = {} - t.numCurrencies = GetNumQuestLogRewardCurrencies(questID) - for i = 1, t.numCurrencies do - local name, texture, count = GetQuestLogRewardCurrencyInfo(i, questID) - tinsert(rewards,{ - type = 'currency', - index = i, - name = name, - texture = texture, - count = count - }); - end - -- items - t.numItems = GetNumQuestLogRewards(questID) - for i = 1, t.numItems do - local name, texture, count, quality, isUsable = GetQuestLogRewardInfo(i, questID) - tinsert(rewards, { - type = 'item', - index = i , - name = name, - texture = texture, - count = count, - quality = quality, - isUsable = isUsable - }); - end - -- money - - local money = GetQuestLogRewardMoney(questID) - if ( money > 0 ) then - tinsert(rewards, { - type = 'money', - name = GetMoneyString(money), - texture = "Interface\\Icons\\inv_misc_coin_01", - count = 0, - }); - end - - if #rewards >= 1 then - t.rewardInfo = rewards - end -end ----------------------------- --- AUTO_QUEST -AutoQuest.LogInfo = {} -AutoQuest.LogBlock = {} -AutoQuest.QuestBlock = {} -AutoQuest.WatchBlock = {} -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.title = title - popup.description = type - popup.popupType = type - popup.questID = questID - popup.questLogIndex = questLogIndex - popup.popupIndex = popupIndex - - self.Info[questID] = popup - self.WatchInfo[popupIndex] = popup - - - return self.Info[questID] -end - ----------------------------- --- BONUS OBJECTIVE -- The default UI pops them up as you enter their relevant areas, but the data is actually available at all times. @@ -119,223 +42,3 @@ --- These functions are copied from Blizzard_BonusObjectiveTracker.lua; -- It's kind of dumb, but this avoids the risk of code taint. ---- Returns a tasks table modified to include recently completed objectives -local UnitName, GetRealmName = UnitName, GetRealmName -local InternalGetTasksTable = function() - local savedTasks = T.Conf.TasksLog - local char = UnitName("player") - local realm = GetRealmName() - local tasks = GetTasksTable() - - for questID, data in pairs(Bonus.Info) do - - print(' -- questID:', questID, #data.objectives) - for i, o in ipairs(data.objectives) do - print(' --', i, o.text) - end - - end - - - for questID, data in pairs(savedTasks) do - if questID > 0 then - local found = false - for i = 1, #tasks do - if tasks[i] == questID then - found = true - break - end - end - -- if it's not part of the current table, then try to insert it where it was last found - if not found then - if data.watchIndex < #tasks then - tinsert(tasks, data.watchIndex, data) - else - tinsert(tasks, data) - end - end - end - end - return tasks -end - ---- Returns an entry from the composed tasks table if possible, otherwise makes an API pull -local InternalGetTaskInfo = function(questID) - local completedTasks = T.Conf.TasksLog - if completedTasks[questID] then - return true, true, #completedTasks[questID].objectives - else - return GetTaskInfo(questID) - end -end - ---- Same as above but for the objective entries -local InternalGetQuestObjectiveInfo = function(questID, objectiveIndex) - local completedTasks = T.Conf.TasksLog - if ( completedTasks[questID] ) then - print('using internal data') - return completedTasks[questID].objectives[objectiveIndex], completedTasks[questID].objectiveType, true; - else - return GetQuestObjectiveInfo(questID, objectiveIndex, false); - end -end - ---- end redundant copy of silliness ------------------------------------------------------------------------------------------- - -Bonus.Completed = {} -Bonus.POI = {} -Bonus.Scenario = {} -Bonus.QuestBlock = {} -Bonus.WatchInfo = {} -function Bonus:GetNumWatched () - print(self.name, self) - - local tasks = InternalGetTasksTable() - local numWatched = 0 - local numAll = 0 - self.WatchInfo = {} - print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks) - print(' TasksTable pull:') - for i, questID in ipairs(tasks) do - local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID) - local existingTask = self.QuestBlock[questID] - local displayObjectiveHeader = false; - local test = (isInArea or (isOnMap and existingTask)) - --local test = true - if test then - self.Info[questID] = self.Info[questID] or {} - - local t = self.Info[questID] - self.WatchInfo[i] = t - t.isInArea = isInArea - t.isOnMap = isOnMap - t.existingTask = existingTask - t.questID = questID - t.objectives = {} - t.taskIndex = i - - - DoQuestRewards(t, questID) - - local taskTitle - local taskFinished = true; - for objectiveIndex = 1, numObjectives do - local text, objectiveType, finished, displayAsObjective = InternalGetQuestObjectiveInfo(questID, objectiveIndex, false); - displayObjectiveHeader = displayObjectiveHeader or displayAsObjective; - if not taskTitle then - if objectiveType == 'progressbar' and not text:match('^%d%+\\%d+') then - taskTitle = text - text = '' - end - end - - - print(' --', text, objectiveType, finished, displayAsObjective) - t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {} - local o = t.objectives[objectiveIndex] - - o.objectiveIndex = objectiveIndex - o.text = text - o.objectiveType = objectiveType - o.finished = finished - o.displayAsObjective = displayAsObjective - print(' |cFF00FF88*', objectiveIndex, text) - end - - -- didn't get a name from progress bar? what about area name - if not taskTitle then - if isInArea then - taskTitle = GetMapNameByID(GetCurrentMapAreaID()) - end - end - t.title = taskTitle - end - - print (' |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r')) - end - - - self.numAll = #tasks - self.numWatched = #self.WatchInfo - print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating') - --return #tasks - return #self.WatchInfo -end - ---- info cleanup done when turn-ins are detected -Bonus.OnTurnIn = function(self, questID, xp, money) - - if #self.info.rewardInfo >= 1 then - for i, reward in ipairs(self.info.rewardInfo) do - --[[ - type = 'item', - index = i , - name = name, - texture = texture, - count = count, - quality = quality, - isUsable = isUsable - ]] - print(' reward ', i, ' ', reward.type, reward.name, reward.count) - - end - end - - print('|cFFFF8800'..self.name..':OnTurnIn call', questID, xp, money) - local savedTasks = B.Conf.TasksLog - - self.Info[questID].completedTime = GetTime() - self.Info[questID].animate = true - T.SetAnimate(self.watchReasonModule) - savedTasks[questID] = self.Info[questID] -end - -Bonus.GetInfo = function(self, taskIndex) - print(self.name, self) - return self.WatchInfo[taskIndex] -end - - - -Cheevs.GetNumWatched = function(self) - print('|cFF00FF00' .. GetTime()) - Cheevs.trackedCheevs = {GetTrackedAchievements()} - return GetNumTrackedAchievements() -end -Cheevs.GetInfo = function(self, index) - local cheevID = Cheevs.trackedCheevs[index] - local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) - - self.Info[cheevID] = {} - local c = self.Info[cheevID] - c.type = 'Cheevs' - c.watchIndex = index - c.cheevID = cheevID - c.title = name - c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy = - points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy - c.numObjectives = GetAchievementNumCriteria(cheevID) - c.objectives = {} - for i = 1, c.numObjectives do - local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) - c.objectives[i] = { - objectiveIndex = i, - cheevID = cheevID, - text = description, - type = type, - finished = completed, - value = quantity, - maxValue = requiredQuantity, - characterName = characterName, - flags = flags, - assetID = assetID, - quantityString = quantityString, - criteriaID = criteriaID, - } - end - print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description) - - self.WatchInfo[index] = c - return self.Info[cheevID] -end diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/Frame.lua --- a/ObjectiveTracker/Frame.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/Frame.lua Wed Apr 13 21:53:24 2016 -0400 @@ -12,6 +12,7 @@ local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame +local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow local print = B.print('Tracker') local unitLevel = 1 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON @@ -142,13 +143,13 @@ local print = bprint local tracker = self.frame local info = block.info - currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) - currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) - self.currentAnchor = currentBlock - print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, tracker.height) - tracker.height = tracker.height + currentBlock.height - tracker.numBlocks = max(tracker.numBlocks, info.blockIndex) - tracker.actualBlocks = tracker.actualBlocks + 1 + block:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) + block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) + self.currentAnchor = block + print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) + tracker.height = tracker.height + block.height + self.numBlocks = max(self.numBlocks, info.blockIndex) + self.actualBlocks = self.actualBlocks + 1 end --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) @@ -216,6 +217,8 @@ return lines[lineIndex] end + + --- Creates or retrieves a complete block frame object T.GetBlock = function(handler, blockIndex) local print = bprint @@ -232,7 +235,6 @@ local c = T.Conf.Wrapper block.index = blockIndex - block.SetStyle = T.SetBlockStyle block:SetWidth(c.Width) block.title:SetSpacing(c.TitleSpacing) @@ -297,20 +299,19 @@ tracker.title:SetTextColor(unpack(headerColor)) self.currentAnchor = tracker.titlebg - local numWatched = self:GetNumWatched() - local numBlocks = self.numBlocks - local actualBlocks = 0 + self.numWatched = self:GetNumWatched() + self.actualBlocks = 0 for watchIndex = 1, 25 do blockIndex = blockIndex + 1 - if watchIndex <= numWatched then + if watchIndex <= self.numWatched then local info = self:GetInfo(watchIndex) if info then local currentBlock = self:UpdateBlock(blockIndex, info) - T.AddBlock(currentBlock) + T.AddBlock(self, currentBlock) else print(' |cFFFF0000bad GetInfo data for #'..watchIndex) end - elseif watchIndex <= numBlocks then + elseif watchIndex <= self.actualBlocks then local used = self.usedBlocks local free = self.freeBlocks print('clean up dead quest block') @@ -326,11 +327,8 @@ end end - self.numWatched = numWatched - self.numBlocks = numBlocks - self.actualBlocks = actualBlocks - if numBlocks >= 1 then + if self.actualBlocks >= 1 then tracker.height = tracker.height + headerHeight tracker:Show() @@ -341,6 +339,7 @@ if tracker.height ~= tracker.previousHeight then tracker:SetHeight(tracker.height) end + print(' |cFFFFFF00', tracker.height, tracker:GetWidth()) else tracker:Hide() tracker.wasEmpty = true @@ -696,42 +695,38 @@ end -Default.Select = function(self) - T:Update(self.watchReasonModule) +Default.Select = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Open = function(self) - T:Update(self.watchReasonModule) +Default.Open = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Remove = function(self) - T:Update(self.watchReasonModule) +Default.Remove = function(handler, block) + T:Update(handler.watchReasonModule) end -Default.Report = function(self) - print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') +Default.Report = function(handler, block) + print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') end Default.OnMouseUp = function(self, button) - print(self.handler.name, self.mainStyle, self.subStyle) if button == 'LeftButton' then if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then - self:Link() + self.Link(self.handler, self) elseif IsModifiedClick("QUESTWATCHTOGGLE") then - self:Remove() + self.Remove(self.handler, self) else - self:Select() + self.Select(self.handler, self) end elseif button == 'RightButton' then - self:Open() + self.Open(self.handler, self) end self.initialButton = nil self.modChatLink = nil self.modQuestWatch = nil - mod:Update(self.handler.updateReasonModule) + T:Update(self.handler.updateReasonModule) print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') end - Default.OnMouseDown = function(self, button) - - print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) print(self.info.title) end diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/ObjectiveTracker.lua --- a/ObjectiveTracker/ObjectiveTracker.lua Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.lua Wed Apr 13 21:53:24 2016 -0400 @@ -161,6 +161,9 @@ displayName = "Notice", updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, + LogInfo = {}, + LogBlock = {}, + QuestBlock = {}, } T.Quest = { name = "Quest", @@ -169,6 +172,9 @@ updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, itemButtons = {}, freeButtons = {}, + LogInfo = {}, + LogBlock = {}, + QuestBlock = {}, } T.Cheevs = { name = "Cheevs", @@ -181,7 +187,8 @@ name = "Bonus", displayName = "Bonus Objectives", updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, - updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED + updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, + QuestBlock = {}, } T.Scenario = { @@ -240,7 +247,10 @@ local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') frame.title:SetText(handler.displayName) frame:SetWidth(c.Width) + handler.frame = frame + handler.numBlocks = 0 + handler.actualBlocks = 0 handler.trackerName = trackerName handler.lines = {} T.orderedTrackers[index] = frame diff -r c33c17dd97e7 -r adcd7c328d07 ObjectiveTracker/ObjectiveTracker.xml --- a/ObjectiveTracker/ObjectiveTracker.xml Wed Apr 13 20:19:37 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.xml Wed Apr 13 21:53:24 2016 -0400 @@ -494,8 +494,8 @@