Nenue@27: --- ${PACKAGE_NAME} Nenue@27: -- @file-author@ Nenue@27: -- @project-revision@ @project-hash@ Nenue@27: -- @file-revision@ @file-hash@ Nenue@27: -- Created: 4/13/2016 7:48 PM Nenue@27: local B = select(2,...).frame Nenue@27: local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') Nenue@27: local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band Nenue@27: local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText Nenue@27: local Default, Quest = T.DefaultHandler, T.Quest Nenue@27: local format = format Nenue@27: local print = B.print('Tracker') Nenue@27: local lprint = B.print('Line') Nenue@27: local iprint = B.print('Info') Nenue@27: local Bonus = mod.Bonus Nenue@27: Nenue@27: Nenue@27: --- Module-specific data wrangling that has to happen during UpdateBlock() Nenue@27: -- Most of this is sculpting objectives data into a parsible list. Nenue@27: -- Some of it is additional block manipulation that doesn't quite fit with the other modules.. Nenue@27: Bonus.UpdateObjectives = function(handler, block) Nenue@27: Default.UpdateObjectives(handler, block) Nenue@27: end Nenue@27: Nenue@27: Nenue@27: Nenue@27: Bonus.UpdateLine = function(handler, block, line, data) Nenue@27: local info = block.info Nenue@27: local print = lprint Nenue@27: Nenue@27: Nenue@27: line.displayColor = 'FFFFFF' Nenue@27: line.displayText = data.text Nenue@27: line.progress = 0 Nenue@27: print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text) Nenue@27: if data.objectiveType == 'progressbar' then Nenue@27: line.widgetType = 'ProgressBar' Nenue@27: print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID))) Nenue@27: data.value = GetQuestProgressBarPercent(info.questID) or 0 Nenue@27: data.maxValue = 100 Nenue@27: if data.value >= data.maxValue then Nenue@27: line.progress = 1 Nenue@27: elseif data.value > 0 then Nenue@27: line.progress = 2 Nenue@27: end Nenue@27: line.format = PERCENTAGE_STRING Nenue@27: local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex) Nenue@27: print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue) Nenue@27: widget:SetPoint('TOP', line, 'TOP', 0, 0) Nenue@27: Nenue@27: line.widget = widget Nenue@27: line.height = widget.height Nenue@27: else Nenue@27: line.displayText = data.text Nenue@27: line.widget = nil Nenue@27: end Nenue@27: return line Nenue@27: end Nenue@27: Nenue@27: Bonus.Select = function(self) Nenue@27: Nenue@27: Bonus:OnTurnIn(self.info.questID) Nenue@27: end Nenue@27: Bonus.Remove = function(self) Nenue@27: Nenue@27: end