annotate ObjectiveTracker/BonusObjectives.lua @ 27:c3aa94bc6be2

collating module-specific function into their own files and dropping the UI and Style scripts
author Nenue
date Wed, 13 Apr 2016 20:18:50 -0400
parents
children adcd7c328d07
rev   line source
Nenue@27 1 --- ${PACKAGE_NAME}
Nenue@27 2 -- @file-author@
Nenue@27 3 -- @project-revision@ @project-hash@
Nenue@27 4 -- @file-revision@ @file-hash@
Nenue@27 5 -- Created: 4/13/2016 7:48 PM
Nenue@27 6 local B = select(2,...).frame
Nenue@27 7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@27 8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
Nenue@27 9 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
Nenue@27 10 local Default, Quest = T.DefaultHandler, T.Quest
Nenue@27 11 local format = format
Nenue@27 12 local print = B.print('Tracker')
Nenue@27 13 local lprint = B.print('Line')
Nenue@27 14 local iprint = B.print('Info')
Nenue@27 15 local Bonus = mod.Bonus
Nenue@27 16
Nenue@27 17
Nenue@27 18 --- Module-specific data wrangling that has to happen during UpdateBlock()
Nenue@27 19 -- Most of this is sculpting objectives data into a parsible list.
Nenue@27 20 -- Some of it is additional block manipulation that doesn't quite fit with the other modules..
Nenue@27 21 Bonus.UpdateObjectives = function(handler, block)
Nenue@27 22 Default.UpdateObjectives(handler, block)
Nenue@27 23 end
Nenue@27 24
Nenue@27 25
Nenue@27 26
Nenue@27 27 Bonus.UpdateLine = function(handler, block, line, data)
Nenue@27 28 local info = block.info
Nenue@27 29 local print = lprint
Nenue@27 30
Nenue@27 31
Nenue@27 32 line.displayColor = 'FFFFFF'
Nenue@27 33 line.displayText = data.text
Nenue@27 34 line.progress = 0
Nenue@27 35 print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
Nenue@27 36 if data.objectiveType == 'progressbar' then
Nenue@27 37 line.widgetType = 'ProgressBar'
Nenue@27 38 print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
Nenue@27 39 data.value = GetQuestProgressBarPercent(info.questID) or 0
Nenue@27 40 data.maxValue = 100
Nenue@27 41 if data.value >= data.maxValue then
Nenue@27 42 line.progress = 1
Nenue@27 43 elseif data.value > 0 then
Nenue@27 44 line.progress = 2
Nenue@27 45 end
Nenue@27 46 line.format = PERCENTAGE_STRING
Nenue@27 47 local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
Nenue@27 48 print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
Nenue@27 49 widget:SetPoint('TOP', line, 'TOP', 0, 0)
Nenue@27 50
Nenue@27 51 line.widget = widget
Nenue@27 52 line.height = widget.height
Nenue@27 53 else
Nenue@27 54 line.displayText = data.text
Nenue@27 55 line.widget = nil
Nenue@27 56 end
Nenue@27 57 return line
Nenue@27 58 end
Nenue@27 59
Nenue@27 60 Bonus.Select = function(self)
Nenue@27 61
Nenue@27 62 Bonus:OnTurnIn(self.info.questID)
Nenue@27 63 end
Nenue@27 64 Bonus.Remove = function(self)
Nenue@27 65
Nenue@27 66 end