comparison ObjectiveFrame.lua @ 19:605e8f0e46db

ObjectiveCore / Style / Events / Frame - polishing the execution path for better performance - make use of the Blizzard_ObjectiveTracker bitfield values to ensure compatibility in possible secure hooks - avoid full updates when possible (using said bitfield values to indicate targeted sections) - extreme streamlining of event handling layout: specific reason updates are invoked from API hooks; broader updates are invoked by when the event listener catches something vague like 'QUEST_LOG_UPDATE'
author Nenue
date Wed, 06 Apr 2016 07:38:35 -0400
parents d1812fb10ae6
children d5ee940de273
comparison
equal deleted inserted replaced
18:d1812fb10ae6 19:605e8f0e46db
6 local B = select(2,...).frame 6 local B = select(2,...).frame
7 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') 7 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
8 local ipairs, max, min, unpack, floor, pairs, tostring, type, band = ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band 8 local ipairs, max, min, unpack, floor, pairs, tostring, type, band = ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion 9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
11 local Quest, Bonus, Cheevs = mod.Quest, mod.Bonus, mod.Cheevs 11 local DefaultTracker, Quest, Bonus, Cheevs = mod.DefaultTracker, mod.Quest, mod.Bonus, mod.Cheevs
12 local CreateFrame = CreateFrame 12 local CreateFrame = CreateFrame
13 local print = B.print('Objectives') 13 local print = B.print('ObjWrapper')
14 local unitLevel = 1 14 local unitLevel = 1
15 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
15 -------------------------------------------------------------------- 16 --------------------------------------------------------------------
16 --- Global frame layout 17 --- Global frame layout
17 -------------------------------------------------------------------- 18 --------------------------------------------------------------------
18 19
19 --- Upvalues 20 --- Upvalues
39 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' 40 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
40 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 41 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
41 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 42 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
42 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0} 43 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0}
43 44
44 mod.InitializeWrapper = function() 45 local band = bit.band
45 46 local currentPosition, anchorFrame, anchorPoint
46 mod.SetBlockStyle(Scroller, 'Scroller', 'Normal') 47 function mod:Update (reason, dataID)
47 mod.SetBlockStyle(Scroller, 'Scroll', 'Normal') 48 local updateWrapper = 0
48 mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal') 49 local hasStuff
49 50 local insertingStuff
50 for i, name in ipairs(orderedNames) do 51 reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON
51 if not mod.orderedHandlers[i] then 52 currentPosition = 0
52 if mod.Tracker(name, i) then 53 anchorPoint = 'TOPLEFT'
53 local handler = mod[name] 54 anchorFrame = Scroll
54 local tracker = CreateFrame('Frame', 'Veneer'..name..'Tracker', Scroll, 'VeneerTrackerTemplate') 55
55 tracker.title:SetText(handler.displayName) 56 local wrapperHeight = 0
56 mod.SetBlockStyle(tracker, 'Tracker', 'Normal') 57 for id, handler in pairs(mod.orderedHandlers) do
57 handler.Tracker = tracker 58 local frame = handler.frame
58 mod.orderedTrackers[i] = tracker 59
59 mod.namedTrackers[name] = tracker 60 print(format('|cFF00FFFFbitcheck (%04X vs %04x+%04x):|r', reason, handler.updateReasonModule, handler.updateReasonEvents), band(reason, handler.updateReasonModule + handler.updateReasonEvents))
60 mod.indexedTrackers[handler] = tracker 61 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
61 print('created new tracker frames for new handler') 62 handler:Update(reason, dataID)
62 end 63 print('|cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
63 end 64 insertingStuff = true
64 end 65 else
65 66 print('|cFFFF0088'..id..'|r', 'no reason')
66 Scroller:SetScrollChild(Scroll) 67 end
67 68
68 mod.InitializeWrapperWidgets() 69 if handler.numWatched >= 1 then
69 if B.Conf.ObjectiveTrackerMinimized then 70 hasStuff = true
70 Scroller_OnShow(Scroller) 71 currentPosition = currentPosition + 1
71 end 72 frame:SetParent(Scroll)
72 mod.UpdateWrapperStyle() 73 frame:SetPoint('TOPLEFT', anchorFrame, anchorPoint, 0, 0)
73 end 74 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
74 75 anchorFrame = handler.frame
75 mod.InitializeXPTracker = function() 76 anchorPoint = 'BOTTOMLEFT'
76 local XPBar = Wrapper.XPBar 77
77 if UnitLevel('player') == 100 then 78 print('current frame height:', frame.height)
78 XPBar:Hide() 79 wrapperHeight = wrapperHeight + frame.height
79 return 80 print('|cFFFF0088total height:', wrapperHeight)
80 end 81 else
81 82 handler.frame:Hide()
82 --- xp bar 83 end
83 XPBar:SetWidth(mod.Conf.Wrapper.WrapperWidth - Wrapper.CloseButton:GetWidth()) 84 end
84 XPBar.statusbg:SetAllPoints(XPBar) 85
85 XPBar:RegisterEvent('DISABLE_XP_GAIN') 86
86 XPBar:RegisterEvent('ENABLE_XP_GAIN') 87 if hasStuff or insertingStuff then
87 XPBar:SetScript('OnEvent', mod.UpdateXP) 88
88 89 print('updating height to', wrapperHeight)
89 if not IsXPUserDisabled() then 90 Wrapper:SetHeight(wrapperHeight)
90 mod.EnableXP(XPBar) 91 Scroller:SetHeight(wrapperHeight)
91 else 92 Scroll:SetHeight(wrapperHeight)
92 mod.DisableXP(XPBar) 93 print('|cFFFF8800Wrapper:', Wrapper:GetSize())
93 end 94 for i = 1, Wrapper:GetNumPoints() do
94 95 print(' ', Wrapper:GetPoint(i))
95 mod.UpdateXP(XPBar) 96 end
96 end 97 print(' |cFF00FFFFScroller:', Scroller:GetSize())
97 98 for i = 1, Scroller:GetNumPoints() do
98 mod.EnableXP = function(self) 99 print(' ', Scroller:GetPoint(i))
99 self:RegisterEvent('PLAYER_XP_UPDATE') 100 end
100 self:RegisterEvent('PLAYER_LEVEL_UP') 101 print(' |cFF00FFFFScroll:', Scroll:GetSize())
101 self:RegisterEvent('PLAYER_UPDATE_RESTING') 102 for i = 1, Scroll:GetNumPoints() do
102 self.statusbg:SetTexture(0,0,0,.25) 103 print(' ', Scroll:GetPoint(i))
103 self:Show() 104 end
104 end 105
105 106 Wrapper:Show()
106 mod.DisableXP = function(self) 107 Scroller:Show()
107 self:UnregisterEvent('PLAYER_XP_UPDATE') 108 Scroll:Show()
108 self:UnregisterEvent('PLAYER_LEVEL_UP') 109 end
109 self:UnregisterEvent('PLAYER_UPDATE_RESTING') 110
110 self.statusbg:SetTexture(0.5,0.5,0.5,0.5) 111 end
111 self:Hide() 112
112 end 113 DefaultTracker.GetBlock = function(handler, blockIndex)
113 114 local block = handler.usedBlocks[blockIndex]
114 mod.UpdateXP = function(self, event) 115 if not handler.usedBlocks[blockIndex] then
115 if event == 'DISABLE_XP_GAIN' then 116 if #handler.freeBlocks >= 1 then
116 mod.DisableXP(self) 117 block = handler.freeBlocks[#handler.freeBlocks]
117 elseif event == 'ENABLE_XP_GAIN' then 118 handler.freeBlocks[#handler.freeBlocks] = nil
118 mod.EnableXP(self) 119 else
119 end 120 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
120 121 block.SetStyle = mod.SetBlockStyle
121 if not IsXPUserDisabled() then 122 block.Select = handler.Select
122 123 block.Open = handler.Open
123 local xp = UnitXP('player') 124 block.Remove = handler.Remove
124 local xpmax = UnitXPMax('player') 125 block.Link = handler.Link
125 local rest = GetXPExhaustion() 126 block:SetScript('OnMouseUp', handler.OnMouseUp)
126 self.foreground:SetWidth((xp/xpmax) * self:GetWidth()) 127 block:SetScript('OnMouseDown', handler.OnMouseDown)
127 if rest then 128 block.attachmentHeight = 0
128 self.rested:ClearAllPoints() 129 block:ClearAllPoints()
129 if xp == 0 then 130 end
130 self.rested:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 0) 131
131 else 132 handler.usedBlocks[blockIndex] = block
132 self.rested:SetPoint('TOPLEFT', self.fg, 'TOPRIGHT', 0, 0) 133 end
133 end 134 return handler.usedBlocks[blockIndex]
134 135 end
135 if (xp + rest) > xpmax then 136
136 self.rested:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, 0) 137 DefaultTracker.Update = function (self, reason, dataID)
137 else 138 local tracker = self.frame
138 self.rested:SetWidth((rest/xpmax) * self:GetWidth())
139 end
140 self.rested:SetPoint('BOTTOM', self, 'BOTTOM')
141 self.rested:Show()
142 else
143 self.rested:Hide()
144 end
145
146 if IsResting() then
147 self.statusbg:SetTexture(.2,.8,.2,.5)
148 else
149 self.statusbg:SetTexture(0,0,0,.25)
150 end
151 self.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or ''))
152 end
153 end
154
155
156
157 mod.UpdateTracker = function(handler)
158 local tracker = handler.Tracker
159 print('|cFFFF4400'..tracker:GetName().. '|r:Update()') 139 print('|cFFFF4400'..tracker:GetName().. '|r:Update()')
160 local blockIndex = 0 140 local blockIndex = 0
161 local trackerHeight = tracker.titleHeight 141 local trackerHeight = 0
162 142
163 143
164 previousBlock = tracker.title 144 self.currentAnchor = tracker.titlebg
165 local numWatched = handler.GetNumWatched() 145 local numWatched = self:GetNumWatched()
166 local numBlocks = handler.numBlocks 146 local numBlocks = self.numBlocks
167 local actualBlocks = 0 147 local actualBlocks = 0
168 for watchIndex = 1, 25 do 148 for watchIndex = 1, 25 do
169 blockIndex = blockIndex + 1 149 blockIndex = blockIndex + 1
170 if watchIndex <= numWatched then 150 if watchIndex <= numWatched then
171 local info = handler:GetInfo(watchIndex) 151 local info = self:GetInfo(watchIndex)
172 if info then 152 if info then
173 local currentBlock = mod.UpdateTrackerBlock(handler, blockIndex, info) 153 local currentBlock = self:UpdateBlock(blockIndex, info)
174 previousBlock = currentBlock 154 self.currentAnchor = currentBlock
175 print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height) 155 print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height)
156 print(currentBlock:IsVisible())
157 print(currentBlock:GetPoint(1))
176 trackerHeight = trackerHeight + currentBlock.height 158 trackerHeight = trackerHeight + currentBlock.height
177 numBlocks = max(numBlocks, watchIndex) 159 numBlocks = max(numBlocks, watchIndex)
178 actualBlocks = actualBlocks + 1 160 actualBlocks = actualBlocks + 1
179 else 161 else
180 print(' |cFFFF0000Failed to draw info for index #'..watchIndex) 162 print(' |cFFFF0000Failed to draw info for index #'..watchIndex)
181 end 163 end
182 164
183 elseif watchIndex <= numBlocks then 165 elseif watchIndex <= numBlocks then
184 local used = handler.usedBlocks 166 local used = self.usedBlocks
185 local free = handler.freeBlocks 167 local free = self.freeBlocks
186 print('clean up dead quest block') 168 print('clean up dead quest block')
187 if used[blockIndex] then 169 if used[blockIndex] then
188 used[blockIndex]:Hide() 170 used[blockIndex]:Hide()
189 used[blockIndex]:ClearAllPoints() 171 used[blockIndex]:ClearAllPoints()
190 free[#free+1]= used[blockIndex] 172 free[#free+1]= used[blockIndex]
193 else 175 else
194 print(' |cFFFF9900END|r @', blockIndex) 176 print(' |cFFFF9900END|r @', blockIndex)
195 break -- done with quest stuff 177 break -- done with quest stuff
196 end 178 end
197 end 179 end
198 handler.numWatched = numWatched 180 self.numWatched = numWatched
199 handler.numBlocks = numBlocks 181 self.numBlocks = numBlocks
200 handler.actualBlocks = actualBlocks 182 self.actualBlocks = actualBlocks
201 handler:Report() 183 self:Report()
202 184
185 tracker.previousHeight = tracker.height
203 if numBlocks >= 1 then 186 if numBlocks >= 1 then
204 previousBlock = nil 187 previousBlock = nil
205 tracker.height = trackerHeight 188
189 tracker.height = trackerHeight + tracker.titlebg:GetHeight()
190 tracker:SetHeight(tracker.height)
191 tracker:Show()
192
193 print(tracker.height)
194
206 else 195 else
207 tracker.height = 0 196 tracker.height = 0
197 tracker:Hide()
208 end 198 end
209 199
210 return tracker.numWatched, tracker.numAll 200 return tracker.numWatched, tracker.numAll
211 end 201 end
212 202
213 --- Updates the selected block frame to display the given info batch 203 --- Updates the selected block frame to display the given info batch
214 -- If `previousBlock` is set, it will attempt to anchor to that 204 -- If `previousBlock` is set, it will attempt to anchor to that
215 -- @param blockNum the ordered block to be updated, not a watchIndex value 205 -- @param blockNum the ordered block to be updated, not a watchIndex value
216 -- @param info the reference returned by the GetXInfo functions 206 -- @param info the reference returned by the GetXInfo functions
217 -- REMEMBER: t.info and questData[questID] are the same table 207 -- REMEMBER: t.info and questData[questID] are the same table
218 mod.UpdateTrackerBlock = function (handler, blockIndex, info) 208 DefaultTracker.UpdateBlock = function (self, blockIndex, info)
219 local print = B.print('BlockParse') 209 local print = B.print('BlockParse')
220 print(' Read list item |cFF00FFFF'..blockIndex..'|r') 210 print(' Read list item |cFF00FFFF'..blockIndex..'|r')
221 if not blockIndex or not info then 211 if not blockIndex or not info then
222 return 212 return
223 end 213 end
224 local tracker = handler.Tracker 214 local frame = self.frame
225 local t = handler:GetBlock(blockIndex) 215 local t = self:GetBlock(blockIndex)
226 t.handler = handler 216 t.handler = self
227 t.info = info 217 t.info = info
228 t.mainStyle = info.mainStyle or 'Normal' 218 t.mainStyle = info.mainStyle or 'Normal'
229 t.subStyle = info.subStyle 219 t.subStyle = info.subStyle
230 220
231 info.blockIndex = blockIndex 221 info.blockIndex = blockIndex
232 if info.questID then handler.QuestBlock[info.questID] = t end 222 if info.questID then self.QuestBlock[info.questID] = t end
233 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end 223 if info.questLogIndex then self.LogBlock[info.questLogIndex] = t end
234 if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end 224 if info.watchIndex then self.WatchBlock[info.watchIndex] = t end
235 handler.BlockInfo[blockIndex] = info 225 self.BlockInfo[blockIndex] = info
236
237 226
238 t.attachmentHeight = 0 227 t.attachmentHeight = 0
239 228 if info.isComplete then
240 229 if mod.AutoQuest.Info[info.questID] then
241
242
243
244 if info.isComplete == 1 then
245 if info.popupInfo then
246 t.status:SetText('(Click to Complete)') 230 t.status:SetText('(Click to Complete)')
231 t.status:Show()
247 else 232 else
248 t.status:SetText('Ready to turn in') 233 t.status:SetText('Ready to turn in')
234 t.status:Show()
249 end 235 end
250 elseif info.completed then 236 elseif info.completed then
251 t.status:SetText(nil) 237 t.status:SetText(nil)
238 t.status:Hide()
252 elseif info.numObjectives >= 1 then 239 elseif info.numObjectives >= 1 then
253 t.attachmentHeight = 0 240 t.attachmentHeight = 0
254 t.status:Show() 241 t.status:Show()
255 print(' lines to build:', info.numObjectives) 242 print(' lines to parse:', info.numObjectives)
256 local text = '' 243 local text = ''
257 244
258 mod.UpdateObjectives(t, info, text) 245 mod.UpdateObjectives(t, info, text)
246 print(' |cFF00FF00attachment', t.attachmentHeight)
259 elseif info.description then 247 elseif info.description then
260 t.status:SetText(info.description) 248 t.status:SetText(info.description)
249 t.status:Show()
261 else 250 else
262 t.status:SetText(nil) 251 t.status:SetText(nil)
252 t.status:Show()
263 end 253 end
264 t.title:SetText(info.title) 254 t.title:SetText(info.title)
265 print(' ', t.status:CanWordWrap(), t.status:GetStringHeight())
266 255
267 256
268 if info.specialItem and not info.itemButton then 257 if info.specialItem and not info.itemButton then
269 print(' - |cFF00FFFFgenerating item button for info set') 258 print(' - |cFF00FFFFgenerating item button for info set')
270 info.itemButton = mod.SetItemButton(t, info) 259 info.itemButton = mod.SetItemButton(t, info)
271 else 260 else
272 --info.itemButton = nil 261 --info.itemButton = nil
273 end 262 end
274 263
275 if previousBlock then 264 if self.currentAnchor then
276 t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0) 265 t:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
277 t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) 266 t:SetPoint('RIGHT', frame,'RIGHT', 0, 0)
278 print(' anchor to|cFF0088FF', previousBlock:GetName()) 267 print(' anchor to|cFF0088FF', self.currentAnchor:GetName())
279 end 268 end
280 269
281 270
282 --- metrics are calculated in SetStyle 271 --- metrics are calculated in SetStyle
283 t:SetStyle('TrackerBlock', handler.name, t.mainStyle, t.subStyle) 272 t:SetStyle('TrackerBlock', self.name, t.mainStyle, t.subStyle)
273 print(' |cFFFFFF00height|r', t.height)
284 t:Show() 274 t:Show()
285 275
286 print(' |cFF00FFFF)|r -> ', t, t:GetHeight()) 276 print(' |cFF00FFFF)|r -> ', t, t:GetHeight())
287 277
288 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', t, 'TOPRIGHT' 278 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', t, 'TOPRIGHT'
336 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (tostring(t.mainStyle) .. '/' .. tostring(t.subStyle))) 326 t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (tostring(t.mainStyle) .. '/' .. tostring(t.subStyle)))
337 end]] 327 end]]
338 return t 328 return t
339 end 329 end
340 330
331
332
341 mod.UpdateObjectives = function(block, info, text) 333 mod.UpdateObjectives = function(block, info, text)
342 local print = B.print('BlockLine') 334 local print = B.print('BlockLine')
343 print(' |cFF00FF00objective updates for', block:GetName()) 335 print(' |cFF00FF00objective updates for', block:GetName())
344 336
345 local attachmentHeight = block.attachmentHeight 337 local attachmentHeight = block.attachmentHeight
338 print(attachmentHeight)
346 if info.description and not(info.earnedBy or info.isComplete) then 339 if info.description and not(info.earnedBy or info.isComplete) then
347 print(' -- has description text:', select('#', info.description), info.description) 340 print(' -- has description text:', select('#', info.description), info.description)
348 text = info.description 341 text = info.description
349 end 342 end
350 local completionScore, completionMax = 0, 0 343 local completionScore, completionMax = 0, 0
351 344
352 for i, line in ipairs(info.objectives) do 345 for i, line in ipairs(info.objectives) do
346 print(attachmentHeight)
353 print(' |cFF88FF00objective', i) 347 print(' |cFF88FF00objective', i)
354 block.handler.ParseObjective(line, info) 348 block.handler.ParseObjective(line, info)
355 349
356 if line.title then 350 if line.title then
357 info.title = line.title 351 info.title = line.title
358 line.title = nil 352 line.title = nil
359 end 353 end
360 354
361 if line.widget then 355 if line.widget then
362 if attachmentHeight == 0 then 356 if attachmentHeight == 0 then
363 attachmentHeight = block.status.spacing 357 attachmentHeight = (block.status.spacing or block.status:GetSpacing()) * 2
358 --print(attachmentHeight)
364 end 359 end
365 line.widget:Show() 360 line.widget:Show()
366 line.widget:SetParent(block) 361 line.widget:SetParent(block)
367 line.widget:SetPoint('TOPLEFT', block.status, 'BOTTOMLEFT', 0, -attachmentHeight ) 362 line.widget:SetPoint('TOPLEFT', block.status, 'BOTTOMLEFT', 0, -attachmentHeight )
368 print(' has a widget, height is', line.widget.height) 363 print(' has a widget, height is', line.widget.height)
375 print(' has text') 370 print(' has text')
376 text = text .. ((text == '') and "" or "\n") .. '|cFF'..line.displayColor.. line.displayText .. '|r' 371 text = text .. ((text == '') and "" or "\n") .. '|cFF'..line.displayColor.. line.displayText .. '|r'
377 end 372 end
378 end 373 end
379 374
375
376
380 block.completionScore = completionScore / completionMax 377 block.completionScore = completionScore / completionMax
381 block.attachmentHeight = attachmentHeight 378 block.attachmentHeight = attachmentHeight
382 379
383 if #text >= 1 then 380 if #text >= 1 then
384 block.status:SetText(text) 381 block.status:SetText(text)
394 -- defines the following variables 391 -- defines the following variables
395 -- * height - height of whatever display widget is involved in conveying the task 392 -- * height - height of whatever display widget is involved in conveying the task
396 -- * lines - number of non-wrapped text lines to account for line space; may be discarded depending on things 393 -- * lines - number of non-wrapped text lines to account for line space; may be discarded depending on things
397 -- * money - boolean that determines listening for money events or not 394 -- * money - boolean that determines listening for money events or not
398 -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively 395 -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
399 mod.Tracker.ParseObjective = function(line, info) 396 DefaultTracker.ParseObjective = function(line, info)
400 397
401 if line.finished then 398 if line.finished then
402 line.progress = 2 399 line.progress = 2
403 elseif line.quantity > 0 then 400 elseif line.quantity > 0 then
404 line.progress = 1 401 line.progress = 1
480 477
481 478
482 mod.Quest.numButtons = 0 479 mod.Quest.numButtons = 0
483 local usedButtons = mod.Quest.itemButtons 480 local usedButtons = mod.Quest.itemButtons
484 local freeButtons = mod.Quest.freeButtons 481 local freeButtons = mod.Quest.freeButtons
482 --[=[
485 mod.UpdateWrapper = function(reason) 483 mod.UpdateWrapper = function(reason)
486 print('|cFF00FFFFUpdateWrapper:|r', reason) 484 print('|cFF00FFFFUpdateWrapper:|r', reason)
487 unitLevel = UnitLevel('player') 485 unitLevel = UnitLevel('player')
488 wrapperWidth = mod.Conf.Wrapper.WrapperWidth 486 wrapperWidth = mod.Conf.Wrapper.WrapperWidth
489 scrollWidth = mod.Conf.Wrapper.WrapperWidth 487 scrollWidth = mod.Conf.Wrapper.WrapperWidth
490 local wrapperBlocks = 0 488 local wrapperBlocks = 0
491 -- Update scroll child vertical size 489 -- Update scroll child vertical size
492 scrollHeight = 0 490 scrollHeight = 0
493 for i, handler in ipairs(orderedHandlers) do 491 for i, handler in ipairs(orderedHandlers) do
494 mod.UpdateTracker(handler) 492 mod.UpdateTracker(handler)
495 local tracker = handler.Tracker 493 local frame = handler.frame
496 if handler.actualBlocks >= 1 then 494 if handler.actualBlocks >= 1 then
497 tracker:SetParent(Scroll) 495 frame:SetParent(Scroll)
498 tracker:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight) 496 frame:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
499 tracker:SetSize(wrapperWidth, tracker.height) 497 frame:SetSize(wrapperWidth, frame.height)
500 print('|cFF00FFFF'..tracker:GetName()..'|r h:|cFF00FF00', tracker.height, '|r y:|cFF00FF00', -scrollHeight) 498 print('|cFF00FFFF'..frame:GetName()..'|r h:|cFF00FF00', frame.height, '|r y:|cFF00FF00', -scrollHeight)
501 scrollHeight = scrollHeight + tracker.height 499 scrollHeight = scrollHeight + frame.height
502 tracker:Show() 500 frame:Show()
503 else 501 else
504 tracker:Hide() 502 frame:Hide()
505 end 503 end
506 wrapperBlocks = wrapperBlocks + handler.actualBlocks 504 wrapperBlocks = wrapperBlocks + handler.actualBlocks
507 end 505 end
508 print('final scrollHeight:', scrollHeight) 506 print('final scrollHeight:', scrollHeight)
509 507
559 ) 557 )
560 --]] 558 --]]
561 mod.UpdateActionButtons() 559 mod.UpdateActionButtons()
562 560
563 end 561 end
562 --]=]
564 563
565 --- Queue any active item buttons for update for that frame 564 --- Queue any active item buttons for update for that frame
566 mod.UpdateActionButtons = function(updateReason) 565 mod.UpdateActionButtons = function(updateReason)
567 Scroller.snap_upper = 0 566 Scroller.snap_upper = 0
568 Scroller.snap_lower = 0 567 Scroller.snap_lower = 0