Nenue@1
|
1 --- ${PACKAGE_NAME}
|
Nenue@1
|
2 -- @file-author@
|
Nenue@1
|
3 -- @project-revision@ @project-hash@
|
Nenue@1
|
4 -- @file-revision@ @file-hash@
|
Nenue@1
|
5 -- Created: 3/30/2016 12:49 AM
|
Nenue@1
|
6 local B = select(2,...).frame
|
Nenue@23
|
7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
|
Nenue@23
|
8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
|
Nenue@2
|
9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
|
Nenue@2
|
10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
|
Nenue@23
|
11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
|
Nenue@23
|
12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent
|
Nenue@23
|
13 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs
|
Nenue@23
|
14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame
|
Nenue@21
|
15 local print = B.print('Tracker')
|
Nenue@13
|
16 local unitLevel = 1
|
Nenue@19
|
17 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
|
Nenue@21
|
18 local debug = false
|
Nenue@1
|
19 --------------------------------------------------------------------
|
Nenue@1
|
20 --- Global frame layout
|
Nenue@1
|
21 --------------------------------------------------------------------
|
Nenue@1
|
22
|
Nenue@1
|
23 --- Upvalues
|
Nenue@23
|
24 local Wrapper = _G.VeneerObjectiveWrapper
|
Nenue@1
|
25 local Scroller = Wrapper.scrollArea
|
Nenue@23
|
26 local Scroll = _G.VeneerObjectiveScroll
|
Nenue@23
|
27 local orderedHandlers = T.orderedHandlers
|
Nenue@23
|
28 local orderedNames = T.orderedNames
|
Nenue@1
|
29
|
Nenue@1
|
30 --- Temp values set during updates
|
Nenue@1
|
31 local wrapperWidth, wrapperHeight
|
Nenue@1
|
32 local scrollWidth, scrollHeight
|
Nenue@1
|
33 local previousBlock
|
Nenue@1
|
34 local currentBlock
|
Nenue@10
|
35 --- todo: source these from config
|
Nenue@6
|
36 local itemButtonSize, itemButtonSpacing = 36, 1
|
Nenue@1
|
37 local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
|
Nenue@21
|
38 local titleSize, textSize = 16, 16
|
Nenue@23
|
39 local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
|
Nenue@23
|
40 local titlebg_daily, textbg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
|
Nenue@23
|
41 local textbg_account,titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}, {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 }
|
Nenue@23
|
42 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
|
Nenue@1
|
43 local titleOutline, textOutline = "OUTLINE", "OUTLINE"
|
Nenue@23
|
44 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
|
Nenue@23
|
45 local titleIndent, textIndent,selectionIndent = 2, 5, 50
|
Nenue@12
|
46 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
|
Nenue@2
|
47 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
|
Nenue@1
|
48 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
|
Nenue@2
|
49 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
|
Nenue@22
|
50 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
|
Nenue@22
|
51 local rewardSize = 32
|
Nenue@21
|
52 local oprint = B.print('Objectives')
|
Nenue@21
|
53 local bprint = B.print('Block')
|
Nenue@21
|
54 local tprint = B.print('Tracker')
|
Nenue@21
|
55 local lprint = B.print('Line')
|
Nenue@1
|
56
|
Nenue@19
|
57 local currentPosition, anchorFrame, anchorPoint
|
Nenue@3
|
58
|
Nenue@23
|
59 T.colors ={
|
Nenue@23
|
60 default = {
|
Nenue@23
|
61 titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125},
|
Nenue@23
|
62 textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 },
|
Nenue@23
|
63 selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225},
|
Nenue@23
|
64 },
|
Nenue@23
|
65 daily = {
|
Nenue@23
|
66 titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125},
|
Nenue@23
|
67 textbg = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 },
|
Nenue@23
|
68 },
|
Nenue@23
|
69 weekly = {
|
Nenue@23
|
70 titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125},
|
Nenue@23
|
71 textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 },
|
Nenue@23
|
72 },
|
Nenue@23
|
73 account = {
|
Nenue@23
|
74 titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125},
|
Nenue@23
|
75 textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 },
|
Nenue@23
|
76 },
|
Nenue@23
|
77 -- alliance
|
Nenue@23
|
78 faction_1 = {
|
Nenue@23
|
79 titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
|
Nenue@23
|
80 textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
|
Nenue@23
|
81 },
|
Nenue@23
|
82 -- horde
|
Nenue@23
|
83 faction_2 = {
|
Nenue@23
|
84 titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
|
Nenue@23
|
85 textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
|
Nenue@23
|
86 }
|
Nenue@23
|
87 }
|
Nenue@23
|
88
|
Nenue@23
|
89 T.AddBlock = function(handler, block)
|
Nenue@23
|
90 local print = bprint
|
Nenue@23
|
91 end
|
Nenue@23
|
92
|
Nenue@23
|
93 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
|
Nenue@23
|
94 T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative)
|
Nenue@23
|
95 local print = bprint
|
Nenue@23
|
96 local tag = block[tagName]
|
Nenue@23
|
97 if block.info[tagName] and tag then
|
Nenue@23
|
98 tag:SetTexCoord(unpack(block.info[tagName]))
|
Nenue@23
|
99 tag:Show()
|
Nenue@23
|
100 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
|
Nenue@23
|
101 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
|
Nenue@23
|
102 else
|
Nenue@23
|
103 block[tagName]:Hide()
|
Nenue@23
|
104 end
|
Nenue@23
|
105 return tagPoint, tagAnchor, tagRelative
|
Nenue@23
|
106 end
|
Nenue@23
|
107
|
Nenue@23
|
108 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call.
|
Nenue@23
|
109 T.AddLine = function(block, line)
|
Nenue@21
|
110 local print = lprint
|
Nenue@23
|
111 line:ClearAllPoints()
|
Nenue@23
|
112 line:SetPoint('LEFT', block, 'LEFT', 0, 0)
|
Nenue@23
|
113 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing)
|
Nenue@23
|
114 line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
|
Nenue@23
|
115 line:SetHeight(line.height)
|
Nenue@23
|
116 line:Show()
|
Nenue@23
|
117
|
Nenue@23
|
118 block.endIndex = line.index
|
Nenue@23
|
119 block.numLines = block.numLines + 1
|
Nenue@23
|
120 block.attachmentHeight = block.attachmentHeight + (line.height + textSpacing)
|
Nenue@23
|
121 print(' |cFF0088FFsetting line #'..block.numLines..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height,
|
Nenue@23
|
122 "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N'))
|
Nenue@23
|
123 block.endPoint = line
|
Nenue@23
|
124 end
|
Nenue@23
|
125
|
Nenue@23
|
126 --- Creates or retrieves a complete line data object
|
Nenue@23
|
127 T.GetLine = function(handler, block, lineIndex)
|
Nenue@23
|
128 local print = lprint
|
Nenue@23
|
129 local blockIndex = block.index
|
Nenue@23
|
130 if not block.lines then
|
Nenue@23
|
131 block.lines = {}
|
Nenue@21
|
132 end
|
Nenue@23
|
133 local lines = block.lines
|
Nenue@21
|
134 if not lines[lineIndex] then
|
Nenue@23
|
135 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
|
Nenue@23
|
136 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective')
|
Nenue@21
|
137 local line = lines[lineIndex]
|
Nenue@21
|
138 line.index = lineIndex
|
Nenue@21
|
139 line.height = 0
|
Nenue@21
|
140 line.status:SetSpacing(textSpacing)
|
Nenue@21
|
141 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
|
Nenue@21
|
142 B.SetConfigLayers(line)
|
Nenue@2
|
143
|
Nenue@21
|
144 if lines[lineIndex+1] then
|
Nenue@21
|
145 lines[lineIndex+1]:ClearAllPoints()
|
Nenue@19
|
146 end
|
Nenue@19
|
147
|
Nenue@21
|
148 if debug then
|
Nenue@21
|
149 for _, region in ipairs(lines[lineIndex].debug) do
|
Nenue@21
|
150 region:Show()
|
Nenue@21
|
151 end
|
Nenue@19
|
152 end
|
Nenue@19
|
153
|
Nenue@13
|
154 end
|
Nenue@21
|
155 return lines[lineIndex]
|
Nenue@2
|
156 end
|
Nenue@2
|
157
|
Nenue@23
|
158 --- Creates or retrieves a complete block frame object
|
Nenue@23
|
159 T.GetBlock = function(handler, blockIndex)
|
Nenue@21
|
160 local print = bprint
|
Nenue@19
|
161 local block = handler.usedBlocks[blockIndex]
|
Nenue@21
|
162
|
Nenue@19
|
163 if not handler.usedBlocks[blockIndex] then
|
Nenue@19
|
164 if #handler.freeBlocks >= 1 then
|
Nenue@19
|
165 block = handler.freeBlocks[#handler.freeBlocks]
|
Nenue@19
|
166 handler.freeBlocks[#handler.freeBlocks] = nil
|
Nenue@19
|
167 else
|
Nenue@19
|
168 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
|
Nenue@21
|
169
|
Nenue@23
|
170
|
Nenue@23
|
171
|
Nenue@23
|
172 local c = T.Conf.Wrapper
|
Nenue@23
|
173 block.index = blockIndex
|
Nenue@23
|
174 block.SetStyle = T.SetBlockStyle
|
Nenue@21
|
175 block:SetWidth(c.Width)
|
Nenue@21
|
176
|
Nenue@21
|
177 block.title:SetSpacing(c.TitleSpacing)
|
Nenue@21
|
178 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
|
Nenue@21
|
179
|
Nenue@21
|
180 block.titlebg:SetTexture(1,1,1,1)
|
Nenue@23
|
181 block.titlebg:SetGradientAlpha(unpack(colors.default.titlebg))
|
Nenue@21
|
182 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
|
Nenue@21
|
183 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
|
Nenue@21
|
184
|
Nenue@21
|
185 block.status:SetSpacing(c.TextSpacing)
|
Nenue@21
|
186 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
|
Nenue@21
|
187 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
|
Nenue@21
|
188
|
Nenue@21
|
189 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
|
Nenue@21
|
190 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
|
Nenue@21
|
191 block.statusbg:SetTexture(1,1,1,1)
|
Nenue@23
|
192 block.statusbg:SetGradientAlpha(unpack(colors.default.textbg))
|
Nenue@21
|
193
|
Nenue@23
|
194 block.SelectionOverlay:SetGradientAlpha(unpack(colors.default.selectionbg))
|
Nenue@23
|
195 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
|
Nenue@21
|
196 block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
|
Nenue@21
|
197
|
Nenue@22
|
198 block.icon:SetSize(rewardSize, rewardSize)
|
Nenue@22
|
199 block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
|
Nenue@21
|
200
|
Nenue@21
|
201
|
Nenue@21
|
202 --- methods for event handlers
|
Nenue@21
|
203
|
Nenue@19
|
204 block.Select = handler.Select
|
Nenue@19
|
205 block.Open = handler.Open
|
Nenue@19
|
206 block.Remove = handler.Remove
|
Nenue@19
|
207 block.Link = handler.Link
|
Nenue@19
|
208 block:SetScript('OnMouseUp', handler.OnMouseUp)
|
Nenue@19
|
209 block:SetScript('OnMouseDown', handler.OnMouseDown)
|
Nenue@19
|
210 block.attachmentHeight = 0
|
Nenue@19
|
211 block:ClearAllPoints()
|
Nenue@21
|
212
|
Nenue@21
|
213 B.SetConfigLayers(block)
|
Nenue@21
|
214
|
Nenue@21
|
215 if debug then
|
Nenue@21
|
216 for _, region in ipairs(block.debug) do
|
Nenue@21
|
217 region:Show()
|
Nenue@21
|
218 end
|
Nenue@21
|
219 end
|
Nenue@19
|
220 end
|
Nenue@19
|
221 handler.usedBlocks[blockIndex] = block
|
Nenue@2
|
222 end
|
Nenue@19
|
223 return handler.usedBlocks[blockIndex]
|
Nenue@2
|
224 end
|
Nenue@2
|
225
|
Nenue@23
|
226 --- Module-specific data wrangling that has to happen during UpdateBlock()
|
Nenue@23
|
227 -- Most of this is sculpting objectives data into a parsible list.
|
Nenue@23
|
228 -- Some of it is additional block manipulation that doesn't quite fit with the other modules..
|
Nenue@23
|
229 Bonus.UpdateObjectives = function(handler, block)
|
Nenue@23
|
230 Default.UpdateObjectives(handler, block)
|
Nenue@21
|
231 end
|
Nenue@14
|
232
|
Nenue@23
|
233
|
Nenue@23
|
234 --- They are not exactly quests, but the aliases used to signal that a quest was pushed into your log by the environment.
|
Nenue@23
|
235 -- Once accepted they never appear again unless the quest is dropped (daily reset/abandon quest)
|
Nenue@23
|
236 local CLICK_TO_COMPLETE = 'Click to Complete'
|
Nenue@23
|
237 local CLICK_TO_ACCEPT = 'Click to Accept'
|
Nenue@23
|
238 AutoQuest.UpdateObjectives = function(handler, block)
|
Nenue@23
|
239 local print = lprint
|
Nenue@23
|
240 if block.info.type == 'OFFER' then
|
Nenue@23
|
241 block.status:SetText(CLICK_TO_ACCEPT)
|
Nenue@23
|
242 end
|
Nenue@23
|
243 end
|
Nenue@23
|
244
|
Nenue@23
|
245
|
Nenue@23
|
246
|
Nenue@23
|
247
|
Nenue@23
|
248 --- Does the main iterations for populating block content.
|
Nenue@23
|
249 -- Hooked by corresponding handler functions where additional details need to be sorted.
|
Nenue@21
|
250 Default.UpdateObjectives = function(handler, block)
|
Nenue@21
|
251 local print = lprint
|
Nenue@21
|
252 local info = block.info
|
Nenue@23
|
253 print(' |cFF00FF00default objectives routine', block:GetName())
|
Nenue@1
|
254
|
Nenue@23
|
255 -- reset the starting positions
|
Nenue@23
|
256 block.attachmentHeight = 0
|
Nenue@23
|
257 block.endPoint = block.titlebg
|
Nenue@21
|
258 local completionScore, completionMax = 0, 0
|
Nenue@21
|
259 local displayObjectiveHeader = false
|
Nenue@21
|
260
|
Nenue@21
|
261 if info.description and #info.description >= 1 then
|
Nenue@21
|
262 print(' |cFF00FFFF header line:|r', info.description)
|
Nenue@21
|
263 block.status:SetText(info.description)
|
Nenue@21
|
264 displayObjectiveHeader = true
|
Nenue@21
|
265 end
|
Nenue@21
|
266
|
Nenue@23
|
267 --- The first line is going to be used no matter what, so it is hard-pulled.
|
Nenue@23
|
268 -- It also ensures that we're in the right position for cleaning up the leftover lines.
|
Nenue@23
|
269 local lineIndex = 1
|
Nenue@23
|
270 local line = T.GetLine(handler, block, lineIndex)
|
Nenue@21
|
271
|
Nenue@23
|
272 block.numLines = 0
|
Nenue@23
|
273 block.attachmentHeight = 0
|
Nenue@23
|
274 if info.isComplete then
|
Nenue@23
|
275 print(' overriding line #1 for a completed block')
|
Nenue@23
|
276 if line.widget then
|
Nenue@23
|
277 line.widget:Hide()
|
Nenue@23
|
278 end
|
Nenue@23
|
279 line.status:SetText(info.completionText)
|
Nenue@23
|
280 line.height = floor(line.status:GetHeight()+.5) + textSpacing
|
Nenue@23
|
281 T.AddLine(block, line)
|
Nenue@23
|
282 else
|
Nenue@23
|
283 if info.objectives then
|
Nenue@23
|
284 for i, data in ipairs(info.objectives) do
|
Nenue@23
|
285 print(' |cFF88FF00#', i, data.type, data.text)
|
Nenue@23
|
286 displayObjectiveHeader = true
|
Nenue@23
|
287 line.height = 0
|
Nenue@23
|
288 handler:UpdateLine(block, line, data)
|
Nenue@22
|
289
|
Nenue@23
|
290 -- For progressbar and timer lines, status text may be used as the title heading
|
Nenue@23
|
291 if line.widget then
|
Nenue@23
|
292 local widgetPosition = 0
|
Nenue@23
|
293 --- WIDGET POSITION -------------------------------------------------
|
Nenue@23
|
294 line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition)
|
Nenue@23
|
295 line.widget:Show()
|
Nenue@23
|
296 line.height = line.widget:GetHeight() + textSpacing
|
Nenue@23
|
297 ---------------------------------------------------------------------
|
Nenue@23
|
298 if line.displayText and #line.displayText >= 1 then
|
Nenue@23
|
299 widgetPosition = line.status:GetHeight() + textSpacing
|
Nenue@23
|
300 line.status:SetText(line.displayText)
|
Nenue@23
|
301 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height
|
Nenue@23
|
302 print(' - progressbar has text, adjust')
|
Nenue@23
|
303 end
|
Nenue@23
|
304 elseif line.displayText then
|
Nenue@22
|
305 line.status:SetText(line.displayText)
|
Nenue@23
|
306 line.height = floor(line.status:GetStringHeight()+.5)
|
Nenue@22
|
307 end
|
Nenue@22
|
308
|
Nenue@23
|
309 T.AddLine(block, line)
|
Nenue@19
|
310
|
Nenue@23
|
311 --print(' sz', line:GetWidth(), line:GetHeight(), 'pt', line:GetPoint(1))
|
Nenue@23
|
312 --print(' |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg)
|
Nenue@19
|
313
|
Nenue@23
|
314 lineIndex = lineIndex + 1
|
Nenue@23
|
315 line = T.GetLine(handler, block, lineIndex)
|
Nenue@21
|
316 end
|
Nenue@14
|
317 end
|
Nenue@14
|
318 end
|
Nenue@14
|
319
|
Nenue@23
|
320 while (block.lines[lineIndex+1]) do
|
Nenue@23
|
321 print(' - hide |cFFFF0088'..lineIndex..'|r')
|
Nenue@23
|
322 block.lines[lineIndex]:Hide()
|
Nenue@23
|
323 lineIndex = lineIndex +1
|
Nenue@23
|
324 end
|
Nenue@19
|
325
|
Nenue@19
|
326
|
Nenue@23
|
327
|
Nenue@23
|
328 if lineIndex > 0 then
|
Nenue@23
|
329 block.attachmentHeight = block.attachmentHeight + textSpacing * 2
|
Nenue@23
|
330 print(' |cFF00FF00attachment:', block.attachmentHeight)
|
Nenue@23
|
331 end
|
Nenue@23
|
332
|
Nenue@23
|
333
|
Nenue@23
|
334 --[[
|
Nenue@23
|
335 local lines = handler.lines[block.index]
|
Nenue@23
|
336 if lines and #lines > block.numLines then
|
Nenue@23
|
337 print(' |cFFFF008' .. (#lines - block.numLines) .. ' extra lines to hide.')
|
Nenue@23
|
338 for i = block.numLines + 1, #lines do
|
Nenue@23
|
339 print(' hide', i, lines[i]:GetName())
|
Nenue@23
|
340 lines[i]:Hide()
|
Nenue@23
|
341 end
|
Nenue@23
|
342 end
|
Nenue@23
|
343 ]]
|
Nenue@23
|
344
|
Nenue@21
|
345
|
Nenue@21
|
346 if debug then
|
Nenue@21
|
347 for i, region in ipairs(block.debug) do
|
Nenue@21
|
348 for j = 1, region:GetNumPoints() do
|
Nenue@21
|
349 local _, target = region:GetPoint(j)
|
Nenue@21
|
350 if target:IsVisible() then
|
Nenue@21
|
351 region:Hide()
|
Nenue@21
|
352 else
|
Nenue@21
|
353 region:Show()
|
Nenue@21
|
354 end
|
Nenue@21
|
355 end
|
Nenue@21
|
356 end
|
Nenue@21
|
357 end
|
Nenue@21
|
358
|
Nenue@14
|
359 block.completionScore = completionScore / completionMax
|
Nenue@21
|
360 end
|
Nenue@14
|
361
|
Nenue@21
|
362
|
Nenue@21
|
363 --- Module-specific display variables
|
Nenue@14
|
364 -- * height - height of whatever display widget is involved in conveying the task
|
Nenue@14
|
365 -- * money - boolean that determines listening for money events or not
|
Nenue@14
|
366 -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
|
Nenue@14
|
367
|
Nenue@21
|
368
|
Nenue@21
|
369
|
Nenue@21
|
370 Bonus.UpdateLine = function(handler, block, line, data)
|
Nenue@21
|
371 local info = block.info
|
Nenue@21
|
372 local print = lprint
|
Nenue@21
|
373
|
Nenue@21
|
374
|
Nenue@21
|
375 line.displayColor = 'FFFFFF'
|
Nenue@22
|
376 line.displayText = data.text
|
Nenue@21
|
377 line.progress = 0
|
Nenue@21
|
378 print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
|
Nenue@21
|
379 if data.objectiveType == 'progressbar' then
|
Nenue@21
|
380 line.widgetType = 'ProgressBar'
|
Nenue@21
|
381 print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
|
Nenue@21
|
382 data.value = GetQuestProgressBarPercent(info.questID) or 0
|
Nenue@21
|
383 data.maxValue = 100
|
Nenue@21
|
384 if data.value >= data.maxValue then
|
Nenue@21
|
385 line.progress = 1
|
Nenue@21
|
386 elseif data.value > 0 then
|
Nenue@21
|
387 line.progress = 2
|
Nenue@21
|
388 end
|
Nenue@21
|
389 line.format = PERCENTAGE_STRING
|
Nenue@23
|
390 local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
|
Nenue@21
|
391 print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
|
Nenue@22
|
392 widget:SetPoint('TOP', line, 'TOP', 0, 0)
|
Nenue@21
|
393
|
Nenue@21
|
394 line.widget = widget
|
Nenue@21
|
395 line.height = widget.height
|
Nenue@21
|
396 else
|
Nenue@21
|
397 line.displayText = data.text
|
Nenue@21
|
398 line.widget = nil
|
Nenue@21
|
399 end
|
Nenue@21
|
400 return line
|
Nenue@21
|
401 end
|
Nenue@21
|
402
|
Nenue@21
|
403 Cheevs.UpdateLine = function(handler, block, line, data)
|
Nenue@21
|
404 local print = B.print('CheevsLine')
|
Nenue@21
|
405 line.progress = 0
|
Nenue@21
|
406 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
|
Nenue@21
|
407 if data.flags then
|
Nenue@21
|
408 if band(data.flags, 0x00000001) > 0 then
|
Nenue@21
|
409 line.format = "%d/%d"
|
Nenue@23
|
410 line.widget = T.SetWidget(line, data, 'ProgressBar', data.criteriaID)
|
Nenue@21
|
411 line.height = line.widget.height
|
Nenue@21
|
412 elseif band(data.flags, 0x00000002) then
|
Nenue@21
|
413 line.widget = nil
|
Nenue@21
|
414 else
|
Nenue@21
|
415 line.widget = nil
|
Nenue@21
|
416 line.displayColor = 'FFFFFF'
|
Nenue@21
|
417 line.displayText = line.text
|
Nenue@21
|
418
|
Nenue@21
|
419 end
|
Nenue@21
|
420 else
|
Nenue@21
|
421
|
Nenue@21
|
422 line.displayText = data.text
|
Nenue@21
|
423 end
|
Nenue@21
|
424 print('line.type =', data.type)
|
Nenue@21
|
425 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
|
Nenue@21
|
426 end
|
Nenue@21
|
427 Default.UpdateLine = function(block, line)
|
Nenue@14
|
428 if line.finished then
|
Nenue@14
|
429 line.progress = 2
|
Nenue@14
|
430 elseif line.quantity > 0 then
|
Nenue@14
|
431 line.progress = 1
|
Nenue@14
|
432 else
|
Nenue@14
|
433 line.progress = 0
|
Nenue@14
|
434 end
|
Nenue@21
|
435 return line
|
Nenue@14
|
436 end
|
Nenue@14
|
437
|
Nenue@14
|
438
|
Nenue@23
|
439 T.Quest.numButtons = 0
|
Nenue@23
|
440 local usedButtons = T.Quest.itemButtons
|
Nenue@23
|
441 local freeButtons = T.Quest.freeButtons
|
Nenue@19
|
442 --[=[
|
Nenue@23
|
443 T.UpdateWrapper = function(reason)
|
Nenue@16
|
444 print('|cFF00FFFFUpdateWrapper:|r', reason)
|
Nenue@13
|
445 unitLevel = UnitLevel('player')
|
Nenue@23
|
446 wrapperWidth = T.Conf.Wrapper.WrapperWidth
|
Nenue@23
|
447 scrollWidth = T.Conf.Wrapper.WrapperWidth
|
Nenue@1
|
448 local wrapperBlocks = 0
|
Nenue@1
|
449 -- Update scroll child vertical size
|
Nenue@1
|
450 scrollHeight = 0
|
Nenue@1
|
451 for i, handler in ipairs(orderedHandlers) do
|
Nenue@23
|
452 T.UpdateTracker(handler)
|
Nenue@19
|
453 local frame = handler.frame
|
Nenue@1
|
454 if handler.actualBlocks >= 1 then
|
Nenue@19
|
455 frame:SetParent(Scroll)
|
Nenue@19
|
456 frame:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
|
Nenue@19
|
457 frame:SetSize(wrapperWidth, frame.height)
|
Nenue@19
|
458 print('|cFF00FFFF'..frame:GetName()..'|r h:|cFF00FF00', frame.height, '|r y:|cFF00FF00', -scrollHeight)
|
Nenue@19
|
459 scrollHeight = scrollHeight + frame.height
|
Nenue@19
|
460 frame:Show()
|
Nenue@14
|
461 else
|
Nenue@19
|
462 frame:Hide()
|
Nenue@1
|
463 end
|
Nenue@1
|
464 wrapperBlocks = wrapperBlocks + handler.actualBlocks
|
Nenue@1
|
465 end
|
Nenue@1
|
466 print('final scrollHeight:', scrollHeight)
|
Nenue@1
|
467
|
Nenue@1
|
468
|
Nenue@1
|
469
|
Nenue@1
|
470 -- Update frame dimensions
|
Nenue@1
|
471 if scrollHeight > wrapperMaxHeight then
|
Nenue@1
|
472 print(' is larger than', wrapperMaxHeight)
|
Nenue@1
|
473 wrapperHeight = wrapperMaxHeight
|
Nenue@1
|
474 else
|
Nenue@1
|
475 wrapperHeight = scrollHeight
|
Nenue@9
|
476 B.Conf.ObjectiveScroll = 0
|
Nenue@1
|
477 end
|
Nenue@1
|
478 scrollWidth = floor(scrollWidth+.5)
|
Nenue@1
|
479 scrollHeight = floor(scrollHeight+.5)
|
Nenue@1
|
480 wrapperWidth = floor(wrapperWidth+.5)
|
Nenue@1
|
481 wrapperHeight = floor(wrapperHeight+.5)
|
Nenue@1
|
482 headerHeight = floor(headerHeight+.5)
|
Nenue@1
|
483
|
Nenue@1
|
484 if wrapperBlocks >= 1 then
|
Nenue@10
|
485 for i, region in ipairs(Wrapper.headerComplex) do
|
Nenue@2
|
486 region:Show()
|
Nenue@2
|
487 end
|
Nenue@1
|
488 else
|
Nenue@10
|
489 for i, region in ipairs(Wrapper.headerComplex) do
|
Nenue@2
|
490 region:Hide()
|
Nenue@2
|
491 end
|
Nenue@1
|
492 return
|
Nenue@1
|
493 end
|
Nenue@14
|
494 --[[wrapperHeight = scrollHeight
|
Nenue@1
|
495
|
Nenue@14
|
496 print('|cFFFFFF00params:|r scroller:', scrollWidth .. ',' .. scrollHeight, 'scroll:', scrollWidth .. ',' .. scrollHeight,
|
Nenue@14
|
497 'wrapper:', wrapperWidth .. ',' .. wrapperHeight,
|
Nenue@14
|
498 'header:', headerHeight)]]
|
Nenue@1
|
499
|
Nenue@14
|
500 --Scroller:SetSize(wrapperWidth, wrapperHeight)
|
Nenue@13
|
501 Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
|
Nenue@1
|
502 Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
|
Nenue@1
|
503
|
Nenue@7
|
504
|
Nenue@1
|
505 Scroll:SetSize(scrollWidth, scrollHeight)
|
Nenue@7
|
506 Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0)
|
Nenue@1
|
507 Scroll:SetPoint('RIGHT', Scroller, 'RIGHT')
|
Nenue@1
|
508
|
Nenue@1
|
509 --Scroller:UpdateScrollChildRect()
|
Nenue@13
|
510 Wrapper:SetSize(wrapperWidth, wrapperHeight)
|
Nenue@1
|
511
|
Nenue@14
|
512 --[[ update action buttons
|
Nenue@6
|
513 print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),
|
Nenue@6
|
514 '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(),
|
Nenue@6
|
515 '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(),
|
Nenue@6
|
516 '|cFF0088FFvScrollRange|r:', floor(Scroller:GetVerticalScrollRange()+.5)
|
Nenue@6
|
517 )
|
Nenue@18
|
518 --]]
|
Nenue@23
|
519 T.UpdateActionButtons()
|
Nenue@1
|
520
|
Nenue@1
|
521 end
|
Nenue@19
|
522 --]=]
|
Nenue@1
|
523
|
Nenue@21
|
524
|
Nenue@21
|
525 Default.Update = function (self, reason, ...)
|
Nenue@21
|
526 local print = tprint
|
Nenue@21
|
527 local tracker = self.frame
|
Nenue@21
|
528 local blockIndex = 0
|
Nenue@21
|
529 local trackerHeight = floor(tracker.titlebg:GetHeight()+.5)
|
Nenue@21
|
530
|
Nenue@21
|
531 self.currentAnchor = tracker.titlebg
|
Nenue@21
|
532 local numWatched = self:GetNumWatched()
|
Nenue@21
|
533 local numBlocks = self.numBlocks
|
Nenue@21
|
534 local actualBlocks = 0
|
Nenue@21
|
535 for watchIndex = 1, 25 do
|
Nenue@21
|
536 blockIndex = blockIndex + 1
|
Nenue@21
|
537 if watchIndex <= numWatched then
|
Nenue@21
|
538 local info = self:GetInfo(watchIndex)
|
Nenue@21
|
539 if info then
|
Nenue@21
|
540 local currentBlock = self:UpdateBlock(blockIndex, info)
|
Nenue@22
|
541 currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
|
Nenue@21
|
542 currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
|
Nenue@21
|
543 self.currentAnchor = currentBlock
|
Nenue@22
|
544 print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, trackerHeight)
|
Nenue@21
|
545 trackerHeight = trackerHeight + currentBlock.height
|
Nenue@21
|
546 numBlocks = max(numBlocks, watchIndex)
|
Nenue@21
|
547 actualBlocks = actualBlocks + 1
|
Nenue@21
|
548 else
|
Nenue@21
|
549 print(' |cFFFF0000bad GetInfo data for #'..watchIndex)
|
Nenue@21
|
550 end
|
Nenue@21
|
551
|
Nenue@21
|
552 elseif watchIndex <= numBlocks then
|
Nenue@21
|
553 local used = self.usedBlocks
|
Nenue@21
|
554 local free = self.freeBlocks
|
Nenue@21
|
555 print('clean up dead quest block')
|
Nenue@21
|
556 if used[blockIndex] then
|
Nenue@21
|
557 used[blockIndex]:Hide()
|
Nenue@21
|
558 used[blockIndex]:ClearAllPoints()
|
Nenue@21
|
559 free[#free+1]= used[blockIndex]
|
Nenue@21
|
560 used[blockIndex] = nil
|
Nenue@21
|
561 end
|
Nenue@21
|
562 else
|
Nenue@21
|
563 print(' |cFFFF9900END|r @', blockIndex)
|
Nenue@21
|
564 break -- done with quest stuff
|
Nenue@21
|
565 end
|
Nenue@21
|
566 end
|
Nenue@21
|
567 self.numWatched = numWatched
|
Nenue@21
|
568 self.numBlocks = numBlocks
|
Nenue@21
|
569 self.actualBlocks = actualBlocks
|
Nenue@21
|
570
|
Nenue@21
|
571 tracker.previousHeight = tracker.height
|
Nenue@21
|
572 if numBlocks >= 1 then
|
Nenue@21
|
573 previousBlock = nil
|
Nenue@21
|
574
|
Nenue@22
|
575 tracker.height = trackerHeight
|
Nenue@21
|
576 tracker:SetHeight(tracker.height)
|
Nenue@21
|
577 tracker:Show()
|
Nenue@21
|
578
|
Nenue@21
|
579
|
Nenue@21
|
580 else
|
Nenue@21
|
581 tracker.height = 0
|
Nenue@21
|
582 tracker:Hide()
|
Nenue@21
|
583 end
|
Nenue@21
|
584
|
Nenue@21
|
585 return tracker.numWatched, tracker.numAll
|
Nenue@21
|
586 end
|
Nenue@21
|
587
|
Nenue@21
|
588 --- Updates the selected block frame to display the given info batch
|
Nenue@21
|
589 -- If `previousBlock` is set, it will attempt to anchor to that
|
Nenue@21
|
590 -- @param blockNum the ordered block to be updated, not a watchIndex value
|
Nenue@21
|
591 -- @param info the reference returned by the GetXInfo functions
|
Nenue@21
|
592 -- REMEMBER: t.info and questData[questID] are the same table
|
Nenue@23
|
593 Default.UpdateBlock = function (handler, blockIndex, info)
|
Nenue@21
|
594 local print = bprint
|
Nenue@21
|
595 print(' Read list item |cFF00FFFF'..blockIndex..'|r')
|
Nenue@21
|
596 if not blockIndex or not info then
|
Nenue@21
|
597 return
|
Nenue@21
|
598 end
|
Nenue@23
|
599 local frame = handler.frame
|
Nenue@23
|
600 local block = T.GetBlock(handler, blockIndex)
|
Nenue@23
|
601 block.handler = handler
|
Nenue@21
|
602 block.info = info
|
Nenue@21
|
603 block.mainStyle = info.mainStyle or 'Normal'
|
Nenue@21
|
604 block.subStyle = info.subStyle
|
Nenue@21
|
605
|
Nenue@21
|
606 info.blockIndex = blockIndex
|
Nenue@23
|
607 if info.questID then handler.QuestBlock[info.questID] = block end
|
Nenue@23
|
608 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end
|
Nenue@23
|
609 if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end
|
Nenue@23
|
610 handler.BlockInfo[blockIndex] = info
|
Nenue@21
|
611
|
Nenue@21
|
612 block.endPoint = block.titlebg
|
Nenue@21
|
613 block.attachmentHeight = 0
|
Nenue@23
|
614 handler:UpdateObjectives(block)
|
Nenue@21
|
615
|
Nenue@21
|
616 block.title:SetText(info.title)
|
Nenue@21
|
617 local titleHeight = floor(block.title:GetHeight()+.5)
|
Nenue@21
|
618 local statusHeight = floor(block.status:GetHeight()+.5)
|
Nenue@21
|
619 local attachmentHeight =floor(block.attachmentHeight + .5)
|
Nenue@21
|
620 local titlebgHeight = titleHeight + titleSpacing*2
|
Nenue@21
|
621 local statusbgHeight = statusHeight + textSpacing*2
|
Nenue@21
|
622
|
Nenue@21
|
623 block.titlebg:SetHeight(titlebgHeight)
|
Nenue@21
|
624
|
Nenue@21
|
625
|
Nenue@23
|
626 print(' |cFF0088FFanchor to', handler.currentAnchor:GetName())
|
Nenue@21
|
627
|
Nenue@21
|
628 print(' |cFF00FF00total sizes:')
|
Nenue@21
|
629 print(' attachment:', attachmentHeight)
|
Nenue@21
|
630 print(' title:', titlebgHeight, '('.. titleHeight..')')
|
Nenue@23
|
631 --block.titlebg:SetHeight(block.title:GetHeight() + T.Conf.Wrapper.TitleSpacing)
|
Nenue@21
|
632 block.height = titlebgHeight + attachmentHeight
|
Nenue@21
|
633 if statusHeight > 1 then
|
Nenue@21
|
634 block.height = block.height + statusbgHeight
|
Nenue@21
|
635 print(' status:', statusbgHeight, '('.. statusHeight..')')
|
Nenue@21
|
636 else
|
Nenue@21
|
637 print(' |cFFFF0088 skipped')
|
Nenue@21
|
638 end
|
Nenue@21
|
639 block:SetHeight(block.height)
|
Nenue@21
|
640
|
Nenue@21
|
641 print(' |cFFFFFF00height|r:', block.height)
|
Nenue@21
|
642 print(' |cFF00FFFF)|r -> ', block, block:GetHeight())
|
Nenue@21
|
643
|
Nenue@21
|
644 block:Show()
|
Nenue@21
|
645
|
Nenue@21
|
646 if info.specialItem and not info.itemButton then
|
Nenue@21
|
647 print(' - |cFF00FFFFgenerating item button for info set')
|
Nenue@23
|
648 info.itemButton = T.SetItemButton(block, info)
|
Nenue@21
|
649 else
|
Nenue@21
|
650 --info.itemButton = nil
|
Nenue@21
|
651 end
|
Nenue@21
|
652
|
Nenue@21
|
653 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
|
Nenue@21
|
654 if info.rewardInfo then
|
Nenue@21
|
655 print('has immediate reward')
|
Nenue@21
|
656 if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
|
Nenue@21
|
657 block.icon:Show()
|
Nenue@21
|
658 block.iconLabel:SetText(info.rewardInfo[1].count)
|
Nenue@22
|
659 block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
|
Nenue@21
|
660 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
|
Nenue@21
|
661 block.icon:SetTexture(info.rewardInfo[1].texture)
|
Nenue@21
|
662 end
|
Nenue@21
|
663 else
|
Nenue@21
|
664 block.icon:Hide()
|
Nenue@21
|
665 end
|
Nenue@21
|
666
|
Nenue@21
|
667 if info.selected then
|
Nenue@21
|
668 block.SelectionOverlay:Show()
|
Nenue@21
|
669 else
|
Nenue@21
|
670 block.SelectionOverlay:Hide()
|
Nenue@21
|
671 end
|
Nenue@23
|
672 -- workaround for scrollchild issue where layers fall out of sync: in this case, it's by 1 vertical pixel
|
Nenue@23
|
673 --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1)
|
Nenue@23
|
674 --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1)
|
Nenue@21
|
675
|
Nenue@23
|
676 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@23
|
677 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@23
|
678 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative)
|
Nenue@21
|
679
|
Nenue@21
|
680 return block
|
Nenue@21
|
681 end
|
Nenue@21
|
682 ----------
|
Nenue@21
|
683 --- Top level methods
|
Nenue@21
|
684
|
Nenue@21
|
685 local tick = 0
|
Nenue@23
|
686 function T:Update (reason, ...)
|
Nenue@21
|
687 tick = tick + 1
|
Nenue@21
|
688 local print = tprint
|
Nenue@21
|
689 reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON
|
Nenue@21
|
690 local updateWrapper = 0
|
Nenue@21
|
691 local hasStuff
|
Nenue@21
|
692 local insertingStuff
|
Nenue@21
|
693
|
Nenue@23
|
694 print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...)
|
Nenue@21
|
695 currentPosition = 0
|
Nenue@21
|
696 anchorPoint = 'TOP'
|
Nenue@21
|
697 anchorFrame = Scroll
|
Nenue@21
|
698
|
Nenue@21
|
699 local wrapperHeight = 0
|
Nenue@23
|
700 for id, handler in pairs(T.orderedHandlers) do
|
Nenue@21
|
701 local frame = handler.frame
|
Nenue@21
|
702
|
Nenue@22
|
703 print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
|
Nenue@21
|
704 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
|
Nenue@21
|
705 handler:Update(reason, ...)
|
Nenue@21
|
706 print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
|
Nenue@21
|
707 insertingStuff = true
|
Nenue@21
|
708 else
|
Nenue@21
|
709 print(' |cFFFF0088'..id..'|r', 'no reason to update')
|
Nenue@21
|
710 end
|
Nenue@21
|
711
|
Nenue@21
|
712 if handler.numWatched >= 1 then
|
Nenue@21
|
713 hasStuff = true
|
Nenue@21
|
714 currentPosition = currentPosition + 1
|
Nenue@21
|
715 frame:SetParent(Scroll)
|
Nenue@21
|
716 frame:SetPoint('TOP', anchorFrame, anchorPoint, 0, 0)
|
Nenue@21
|
717 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
|
Nenue@21
|
718 anchorFrame = handler.frame
|
Nenue@21
|
719 anchorPoint = 'BOTTOM'
|
Nenue@21
|
720
|
Nenue@21
|
721 print('current frame height:', frame.height)
|
Nenue@21
|
722 wrapperHeight = wrapperHeight + frame.height
|
Nenue@21
|
723 print('|cFFFF0088total height:', wrapperHeight)
|
Nenue@21
|
724 else
|
Nenue@21
|
725 handler.frame:Hide()
|
Nenue@21
|
726 end
|
Nenue@21
|
727 end
|
Nenue@21
|
728
|
Nenue@21
|
729
|
Nenue@21
|
730 if hasStuff or insertingStuff then
|
Nenue@21
|
731 print('updating height to', wrapperHeight)
|
Nenue@21
|
732 Wrapper:SetHeight(wrapperHeight)
|
Nenue@21
|
733 Scroller:SetHeight(wrapperHeight)
|
Nenue@21
|
734 Scroll:SetHeight(wrapperHeight)
|
Nenue@21
|
735 Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
|
Nenue@21
|
736 print('|cFFFF8800Wrapper:', Wrapper:GetSize())
|
Nenue@21
|
737 for i = 1, Wrapper:GetNumPoints() do
|
Nenue@21
|
738 print(' ', Wrapper:GetPoint(i))
|
Nenue@21
|
739 end
|
Nenue@21
|
740 print(' |cFF00FFFFScroller:', Scroller:GetSize())
|
Nenue@21
|
741 for i = 1, Scroller:GetNumPoints() do
|
Nenue@21
|
742 print(' ', Scroller:GetPoint(i))
|
Nenue@21
|
743 end
|
Nenue@21
|
744 print(' |cFF00FFFFScroll:', Scroll:GetSize())
|
Nenue@21
|
745 for i = 1, Scroll:GetNumPoints() do
|
Nenue@21
|
746 print(' ', Scroll:GetPoint(i))
|
Nenue@21
|
747 end
|
Nenue@21
|
748
|
Nenue@21
|
749 Wrapper:Show()
|
Nenue@21
|
750 Scroller:Show()
|
Nenue@21
|
751 Scroll:Show()
|
Nenue@21
|
752 end
|
Nenue@23
|
753 Quest.GetClosest()
|
Nenue@21
|
754
|
Nenue@21
|
755 end
|
Nenue@21
|
756
|
Nenue@1
|
757 --- Queue any active item buttons for update for that frame
|
Nenue@23
|
758 T.UpdateActionButtons = function(updateReason)
|
Nenue@6
|
759 Scroller.snap_upper = 0
|
Nenue@6
|
760 Scroller.snap_lower = 0
|
Nenue@6
|
761 local print = B.print('ItemButton')
|
Nenue@6
|
762 if updateReason then
|
Nenue@6
|
763 print = B.print('IB_'..updateReason)
|
Nenue@6
|
764 end
|
Nenue@6
|
765
|
Nenue@1
|
766 local previousItem
|
Nenue@2
|
767 for questID, itemButton in pairs(usedButtons) do
|
Nenue@23
|
768 local info= T.Quest.Info[questID]
|
Nenue@6
|
769
|
Nenue@5
|
770 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
|
Nenue@23
|
771 local block = T.Quest.QuestBlock[questID]
|
Nenue@1
|
772 if block then
|
Nenue@5
|
773 -- Dispatch the probe
|
Nenue@6
|
774 if IsQuestWatched(info.questLogIndex) then
|
Nenue@6
|
775 itemButton.previousItem = previousItem
|
Nenue@5
|
776 print(' |cFFFFFF00probing', block:GetName())
|
Nenue@1
|
777 block:SetScript('OnUpdate', function()
|
Nenue@5
|
778 if block:GetBottom() and not InCombatLockdown() then
|
Nenue@5
|
779 print(' '..block:GetName()..' |cFF00FF00probe hit!')
|
Nenue@23
|
780 T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
|
Nenue@5
|
781 block:SetScript('OnUpdate', nil)
|
Nenue@22
|
782
|
Nenue@5
|
783 end
|
Nenue@5
|
784 end)
|
Nenue@6
|
785 previousItem = itemButton
|
Nenue@1
|
786 else
|
Nenue@5
|
787 print('hidden block or unwatched quest')
|
Nenue@6
|
788 itemButton.previousItem = nil
|
Nenue@5
|
789 itemButton:Hide()
|
Nenue@1
|
790 end
|
Nenue@8
|
791 elseif itemButton:IsVisible() then
|
Nenue@8
|
792 print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
|
Nenue@6
|
793 itemButton.previousItem = nil
|
Nenue@6
|
794 itemButton:Hide()
|
Nenue@8
|
795 else
|
Nenue@8
|
796 print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
|
Nenue@1
|
797 end
|
Nenue@1
|
798 end
|
Nenue@1
|
799 end
|
Nenue@1
|
800
|
Nenue@23
|
801 T.UpdateBlockAction = function (block, itemButton)
|
Nenue@5
|
802 print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
|
Nenue@5
|
803 if itemButton.questID ~= block.info.questID then
|
Nenue@5
|
804 print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
|
Nenue@6
|
805 -- something happened between this and last frame, go back and set new probes
|
Nenue@23
|
806 return T.UpdateActionButtons()
|
Nenue@2
|
807 end
|
Nenue@2
|
808
|
Nenue@6
|
809 local previousItem = itemButton.previousItem
|
Nenue@6
|
810 local upper_bound = Scroller:GetTop() + Scroller.snap_upper
|
Nenue@6
|
811 local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
|
Nenue@6
|
812 local point, anchor, relative
|
Nenue@6
|
813
|
Nenue@6
|
814 if block:GetBottom() < lower_bound then
|
Nenue@6
|
815 print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
|
Nenue@1
|
816 if previousItem then
|
Nenue@6
|
817 print('adjusting', previousItem:GetName())
|
Nenue@1
|
818 previousItem:ClearAllPoints()
|
Nenue@6
|
819 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
|
Nenue@1
|
820 end
|
Nenue@1
|
821 itemButton:ClearAllPoints()
|
Nenue@6
|
822 itemButton.x = Wrapper:GetLeft() -4
|
Nenue@6
|
823 itemButton.y = Wrapper:GetBottom()
|
Nenue@6
|
824 point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@6
|
825 Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
|
Nenue@6
|
826
|
Nenue@6
|
827 elseif block:GetTop() > upper_bound then
|
Nenue@6
|
828 print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
|
Nenue@6
|
829 itemButton:ClearAllPoints()
|
Nenue@6
|
830 if previousItem then
|
Nenue@6
|
831 print('latch onto another piece')
|
Nenue@6
|
832 point, anchor, relative ='TOP', previousItem, 'BOTTOM'
|
Nenue@6
|
833 itemButton.x = 0
|
Nenue@6
|
834 itemButton.y = -itemButtonSpacing
|
Nenue@6
|
835 else
|
Nenue@6
|
836 print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
|
Nenue@6
|
837 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@6
|
838 itemButton.x = Scroller:GetLeft() -4
|
Nenue@6
|
839 itemButton.y = Scroller:GetTop()
|
Nenue@6
|
840 end
|
Nenue@1
|
841 itemButton:Show()
|
Nenue@6
|
842 Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
|
Nenue@1
|
843 else
|
Nenue@6
|
844 print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
|
Nenue@1
|
845 itemButton:ClearAllPoints()
|
Nenue@6
|
846 itemButton.x = block:GetLeft() - itemButtonSpacing
|
Nenue@6
|
847 itemButton.y = block:GetTop()
|
Nenue@6
|
848 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
|
Nenue@1
|
849 end
|
Nenue@6
|
850
|
Nenue@6
|
851 itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
|
Nenue@6
|
852 itemButton:Show()
|
Nenue@1
|
853 end
|
Nenue@1
|
854
|
Nenue@23
|
855 T.UpdateItemButtonCooldown = function(button)
|
Nenue@1
|
856
|
Nenue@1
|
857 end
|
Nenue@18
|
858
|
Nenue@18
|
859 local unitLevel = UnitLevel('player')
|
Nenue@18
|
860
|
Nenue@18
|
861
|