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