annotate ObjectiveTracker/Frame.lua @ 39:92534dc793f2

- restore the previous QuestLogSelection after pulling for selection-restricted quest data; fixes icon mixups while quest map is open - moved progressbar builders into the schema environment, with all the other Frame.lua functions; prep for configuration access - relegate the various removal events to a framescript in their corresponding blocks; this takes care of resolving dead frames
author Nenue
date Thu, 21 Apr 2016 16:43:37 -0400
parents 1f8f9cc3d956
children
rev   line source
Nenue@28 1 --- ${PACKAGE_NAME}
Nenue@28 2 -- @file-author@
Nenue@28 3 -- @project-revision@ @project-hash@
Nenue@28 4 -- @file-revision@ @file-hash@
Nenue@28 5 -- Created: 3/30/2016 12:49 AM
Nenue@39 6 --- Everything that involves directly placing elements on the screen goes here. Sizing, spacing, tiling, etc.
Nenue@28 7 local B = select(2,...).frame
Nenue@35 8 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@28 9 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
Nenue@34 10 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion, tinsert, tremove = IsResting, UnitXP, UnitXPMax, GetXPExhaustion, table.insert, table.remove
Nenue@28 11 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
Nenue@28 12 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
Nenue@28 13 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent
Nenue@35 14 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs
Nenue@28 15 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame
Nenue@29 16 local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow
Nenue@38 17 local band, bor = bit.band, bit.bor
Nenue@35 18 local print = B.print('Layout')
Nenue@34 19 local oprint = B.print('Objectives')
Nenue@34 20 local bprint = B.print('Block')
Nenue@34 21 local tprint = B.print('Tracker')
Nenue@35 22 local lprint = B.print('Layout')
Nenue@28 23 local unitLevel = 1
Nenue@38 24
Nenue@38 25 local ANIM_STATE = 'Animation: %04X'
Nenue@38 26 local INIT_STATE = 'Init: %04X'
Nenue@38 27
Nenue@38 28 --- Bitfields of import
Nenue@38 29 --- control value for everything
Nenue@38 30 local OBJECTIVE_TRACKER_UPDATE_REASON = _G.OBJECTIVE_TRACKER_UPDATE_REASON
Nenue@38 31 --- flags reason categories where frame layout requires initializing (starts high)
Nenue@38 32 local initReason = 0xFFFF
Nenue@38 33 --- flags reason categories where frame anchor updates must be delayed because of an ongoing animation (starts low)
Nenue@38 34 local animateReason = 0x0000
Nenue@28 35
Nenue@34 36 --- FRAMES
Nenue@28 37 local Wrapper = _G.VeneerObjectiveWrapper
Nenue@28 38 local Scroller = Wrapper.scrollArea
Nenue@28 39 local Scroll = _G.VeneerObjectiveScroll
Nenue@35 40 local orderedHandlers = T.orderedHandlers
Nenue@35 41 local orderedNames = T.orderedNames
Nenue@28 42
Nenue@34 43 --- FRAME TEMP VARIABLES
Nenue@37 44 local wrapperWidth, wrapperHeight = 0, 0
Nenue@28 45 local scrollWidth, scrollHeight
Nenue@34 46
Nenue@34 47 --- SCHEMA VARIABLES
Nenue@34 48 local schemaName, lastSchema = {
Nenue@34 49 tracker = '',
Nenue@34 50 block = '',
Nenue@34 51 line = ''
Nenue@34 52 }, {}
Nenue@34 53 local trackerSchema, blockSchema, lineSchema
Nenue@34 54
Nenue@28 55 local itemButtonSize, itemButtonSpacing = 36, 1
Nenue@34 56 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
Nenue@34 57 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
Nenue@34 58 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
Nenue@34 59 local rewardSize = 24
Nenue@28 60
Nenue@30 61 local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2
Nenue@28 62 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}
Nenue@28 63 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'
Nenue@28 64
Nenue@31 65 local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2}
Nenue@28 66 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'
Nenue@34 67 local titleColor = {0,.7,1,1}
Nenue@28 68
Nenue@28 69 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
Nenue@28 70 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'
Nenue@39 71 local textColor = {1,1,1,1 }
Nenue@39 72
Nenue@39 73 local widgetTextFont, widgetTextSize, widgetTextOutline = [[Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF]], 11, 'OUTLINE'
Nenue@39 74 local widgetTextColor = {1,1,1,1 }
Nenue@39 75 local widgetHeight, widgetBorder = 17, 1
Nenue@39 76
Nenue@28 77
Nenue@28 78 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
Nenue@28 79 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
Nenue@28 80 local titleIndent, textIndent,selectionIndent = 2, 5, 50
Nenue@34 81 --- END SCHEMA
Nenue@35 82 local blockPosition
Nenue@35 83
Nenue@38 84
Nenue@38 85 local SetAnimate = function(reason, animate)
Nenue@38 86 print('comparing', animateReason, reason)
Nenue@38 87 if animate then
Nenue@38 88 if band(animateReason, reason) == 0 then
Nenue@38 89 animateReason = animateReason + reason
Nenue@38 90 end
Nenue@38 91 else
Nenue@38 92 if band(animateReason, reason) > 0 then
Nenue@38 93 animateReason = animateReason - reason
Nenue@38 94 end
Nenue@38 95 end
Nenue@38 96 Wrapper.AnimState:SetFormattedText(ANIM_STATE, animateReason)
Nenue@38 97 end
Nenue@38 98
Nenue@38 99
Nenue@34 100 --- schema swapper
Nenue@35 101 T.UpdateSchema = function(layer, newSchema)
Nenue@35 102 if not (T.Conf.Schema[layer] and T.Conf.Schema[layer][newSchema]) then
Nenue@34 103 return
Nenue@34 104 elseif schemaName[layer] == newSchema then
Nenue@34 105 return
Nenue@34 106 end
Nenue@34 107 lastSchema[layer] = schemaName[layer]
Nenue@34 108 schemaName[layer] = newSchema
Nenue@35 109 local c = T.Conf.Schema[layer][newSchema]
Nenue@28 110
Nenue@34 111 if layer == 'tracker' then
Nenue@34 112 headerHeight, headerSpacing = c.headerHeight, c.headerSpacing
Nenue@34 113 headerColor = c.headerColor
Nenue@34 114 headerbg = c.headerbg
Nenue@37 115 headerFont, headerSize, headerOutline = unpack(c.headerFont)
Nenue@34 116 trackerSchema = newSchema
Nenue@34 117 elseif layer == 'block' then
Nenue@34 118 titlebg = c.titlebg
Nenue@37 119 titleFont, titleSize, titleOutline = unpack(c.titleFont)
Nenue@34 120 selectionbg = c.selectionbg
Nenue@34 121 titleSpacing, textSpacing, blockSpacing = c.titleSpacing, c.textSpacing, c.blockSpacing
Nenue@37 122 titleIndent, textIndent,selectionIndent = c.titleIndex, c.textIndex, c.selectionIndent
Nenue@34 123 titleColor = c.titleColor
Nenue@37 124 print(unpack(c.titleColor))
Nenue@34 125 rewardSize = 24
Nenue@37 126 textFont, textSize, textOutline = unpack(c.textFont)
Nenue@34 127 textbg = c.textbg
Nenue@34 128 textIndent = c.textIndent
Nenue@34 129 rewardSize = c.rewardSize
Nenue@37 130 blockSchema = newSchema
Nenue@34 131 elseif layer == 'line' then
Nenue@34 132 textColor = c.textColor
Nenue@34 133 lineSchema = newSchema
Nenue@39 134 elseif layer == 'widget' then
Nenue@39 135 widgetTextColor = c.textSpacing
Nenue@39 136 widgetTextFont, widgetTextSize, widgetTextOutline = unpack(c.textFont)
Nenue@34 137 end
Nenue@38 138 tprint('|cFFFF0088 Schema:|r', layer, lastSchema[layer], '->', newSchema)
Nenue@34 139 end
Nenue@35 140 -- todo: figure out why objectives go invisible
Nenue@35 141 local anchorPoint, anchorFrame
Nenue@35 142 local abs, GetTime = math.abs, GetTime
Nenue@35 143 Default.AddTracker = function(handler, frame, index)
Nenue@38 144 local isInitialized = true
Nenue@38 145 if initReason and (band(initReason, handler.updateReason) > 0 ) then
Nenue@38 146 isInitialized = false
Nenue@38 147 initReason = initReason - handler.updateReason
Nenue@38 148 print('|cFF00FF00%%% initialization status update:', format('%04X', initReason))
Nenue@38 149
Nenue@38 150 frame.SlideIn:SetScript('OnPlay', function()
Nenue@38 151 SetAnimate(handler.updateReasonModule, true)
Nenue@38 152 end)
Nenue@38 153
Nenue@38 154 frame.SlideIn:SetScript('OnFinished', function()
Nenue@38 155 SetAnimate(handler.updateReasonModule, false)
Nenue@38 156 end)
Nenue@38 157
Nenue@38 158 if initReason == 0 then
Nenue@38 159 initReason = nil
Nenue@38 160 end
Nenue@38 161 end
Nenue@38 162
Nenue@35 163 if index == 1 then
Nenue@35 164 print('|cFF00FF00### beginning wrapper layout -----------------')
Nenue@35 165 anchorPoint, anchorFrame = 'TOP', Scroll
Nenue@35 166 wrapperHeight = 0
Nenue@35 167 end
Nenue@35 168
Nenue@35 169 frame.destinationOffset = -wrapperHeight
Nenue@35 170 print(frame.destinationOffset, frame.previousOffset)
Nenue@38 171 if isInitialized and (abs(frame.previousOffset - frame.destinationOffset) > 0.9) and frame:IsVisible() then
Nenue@35 172 if frame.wasEmpty then
Nenue@35 173 frame.previousOffset = -Wrapper:GetHeight()
Nenue@35 174 end
Nenue@35 175
Nenue@35 176 local postFrame, postPoint = anchorFrame, anchorPoint
Nenue@35 177 local delta = frame.destinationOffset - frame.previousOffset
Nenue@35 178 local _, _, _, _, offset = frame:GetPoint(1)
Nenue@35 179 print(' |cFF00FFBBpushing', frame:GetName(), delta, 'pixels, from', frame.previousOffset, '(', offset, ')')
Nenue@35 180 frame.SlideIn.translation:SetTarget(frame)
Nenue@35 181 frame.SlideIn.translation:SetOffset(0, delta)
Nenue@35 182 frame.SlideIn:Play()
Nenue@35 183 --for i, b in ipairs(handler.usedBlocks) do
Nenue@35 184 --b.SlideIn.translation:SetOffset(0, delta)
Nenue@35 185 -- b.SlideIn:Play()
Nenue@35 186 --end
Nenue@35 187 local start = GetTime()
Nenue@35 188 frame.SlideIn:SetScript('OnFinished', function()
Nenue@35 189 print(' |cFF00BBFF'..frame:GetName(), 'moved', delta, 'over duration of ', GetTime()-start)
Nenue@35 190 frame:SetParent(Scroll)
Nenue@35 191 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset)
Nenue@35 192 frame.previousOffset = frame.destinationOffset
Nenue@35 193 frame.SlideIn:SetScript('OnFinished', nil)
Nenue@35 194 if Wrapper.destinationHeight then
Nenue@35 195 Wrapper:SetHeight(Wrapper.destinationHeight)
Nenue@35 196 Scroller:SetHeight(Wrapper.destinationHeight)
Nenue@35 197 Scroll:SetHeight(Wrapper.destinationHeight)
Nenue@35 198 Wrapper.previousHeight = Wrapper.destinationHeight
Nenue@35 199 Wrapper.destinationHeight = nil
Nenue@35 200 end
Nenue@35 201
Nenue@35 202 end)
Nenue@35 203 else
Nenue@37 204 print(' |cFF00BBFFpinning '..handler.name..' to', anchorFrame:GetName(), anchorPoint, '|rcurrent frame height:', frame.height)
Nenue@35 205 print(' |cFFFF0088total height:', wrapperHeight)
Nenue@35 206 frame:ClearAllPoints()
Nenue@35 207 frame:SetParent(Scroll)
Nenue@35 208 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset)
Nenue@38 209 frame:SetPoint('LEFT', Scroll, 'LEFT')
Nenue@38 210 frame:SetPoint('RIGHT', Scroll, 'RIGHT')
Nenue@35 211 frame.previousOffset = frame.destinationOffset
Nenue@35 212 handler.initialized = true
Nenue@35 213 end
Nenue@35 214
Nenue@35 215 frame.title:SetFont(headerFont, headerSize, headerOutline)
Nenue@35 216 frame.titlebg:SetHeight(headerHeight)
Nenue@35 217 frame.title:SetTextColor(unpack(headerColor))
Nenue@35 218
Nenue@35 219 if frame.height ~= frame.previousHeight then
Nenue@35 220 frame:SetHeight(frame.height)
Nenue@35 221 end
Nenue@35 222
Nenue@35 223 frame:Show()
Nenue@35 224 if frame.wasEmpty then
Nenue@35 225 frame.headerFade:Play()
Nenue@35 226 frame.wasEmpty = nil
Nenue@35 227 end
Nenue@35 228
Nenue@35 229 wrapperHeight = wrapperHeight + frame.height
Nenue@35 230 anchorFrame = handler.frame
Nenue@35 231 anchorPoint = 'BOTTOM'
Nenue@35 232
Nenue@35 233 end
Nenue@28 234
Nenue@30 235 Default.AddBlock = function(self, block, blockIndex)
Nenue@30 236 local blockIndex = blockIndex or (self.currentBlock + 1)
Nenue@28 237 local print = bprint
Nenue@28 238 local tracker = self.frame
Nenue@28 239 local info = block.info
Nenue@30 240
Nenue@35 241 block.index = blockIndex
Nenue@35 242
Nenue@37 243 print('blockschema', blockSchema, block.schema)
Nenue@34 244 if blockSchema ~= block.schema then
Nenue@37 245 T.UpdateSchema('block', block.schema)
Nenue@38 246 print(' ### activating block schema:|cFF0088FF', block.schema)
Nenue@37 247 end
Nenue@34 248
Nenue@37 249 block:SetWidth(T.Conf.Wrapper.Width)
Nenue@37 250 block.title:SetSpacing(titleSpacing)
Nenue@37 251 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
Nenue@37 252 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0)
Nenue@37 253 block.title:SetTextColor(unpack(titleColor))
Nenue@37 254 block.titlebg:SetTexture(1,1,1,1)
Nenue@37 255 block.titlebg:SetGradientAlpha(unpack(titlebg))
Nenue@37 256 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
Nenue@37 257 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
Nenue@37 258 block.status:SetSpacing(textSpacing)
Nenue@37 259 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
Nenue@37 260 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
Nenue@37 261 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
Nenue@37 262 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
Nenue@37 263 block.statusbg:SetTexture(1,1,1,1)
Nenue@37 264 block.statusbg:SetGradientAlpha(unpack(textbg))
Nenue@37 265 block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg))
Nenue@37 266 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
Nenue@37 267 block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
Nenue@37 268
Nenue@37 269 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2
Nenue@37 270 for i, tile in ipairs(block.rewardTile) do
Nenue@37 271 --print(rewardSize)
Nenue@37 272 tile:SetSize(rewardSize, rewardSize)
Nenue@37 273 tile:ClearAllPoints()
Nenue@37 274 tile:SetPoint(anchor, target, point, x, y)
Nenue@37 275 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0)
Nenue@37 276 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0
Nenue@34 277 end
Nenue@34 278
Nenue@35 279
Nenue@35 280 local titleHeight = floor(block.title:GetHeight()+.5)
Nenue@35 281 local titlebgHeight = titleHeight + titleSpacing*2
Nenue@35 282 block.titlebg:SetHeight(titlebgHeight)
Nenue@35 283
Nenue@35 284 local statusHeight = floor(block.status:GetHeight()+.5)
Nenue@35 285 local statusbgHeight = statusHeight + textSpacing*2
Nenue@35 286 local attachmentHeight =floor(block.attachmentHeight + .5)
Nenue@35 287
Nenue@35 288 print(' |cFF0088FFanchor to', self.currentAnchor:GetName())
Nenue@35 289 print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')')
Nenue@35 290 if attachmentHeight > 0 then
Nenue@35 291 attachmentHeight = attachmentHeight + textSpacing
Nenue@35 292 end
Nenue@35 293
Nenue@35 294 block.height = titlebgHeight + attachmentHeight
Nenue@35 295 block:SetHeight(block.height)
Nenue@35 296
Nenue@34 297 if block.debug then
Nenue@34 298 local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide'
Nenue@34 299 for _, region in ipairs(block.debug) do
Nenue@34 300 region[func]()
Nenue@34 301 end
Nenue@34 302 end
Nenue@34 303
Nenue@35 304 --- Handler vars
Nenue@35 305 if blockIndex == 1 then
Nenue@35 306 tracker.previousHeight = tracker.height
Nenue@35 307 tracker.height = headerHeight
Nenue@35 308 blockPosition = -headerHeight
Nenue@35 309 tprint(' |cFF88FF00AddBlock:|r new layout: headerHeight =', headerHeight, 'previousHeight =', tracker.previousHeight)
Nenue@35 310 else
Nenue@35 311 blockPosition = blockPosition
Nenue@35 312 tprint(' |cFF8888FFAddBlock:|r advancing: height =', tracker.height)
Nenue@35 313 end
Nenue@30 314 self.currentBlock = blockIndex
Nenue@29 315 self.currentAnchor = block
Nenue@35 316
Nenue@35 317 block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, blockPosition)
Nenue@35 318 block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
Nenue@38 319 block:Show()
Nenue@35 320 self.numBlocks = self.numBlocks + 1
Nenue@29 321 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height)
Nenue@29 322 tracker.height = tracker.height + block.height
Nenue@35 323 blockPosition = blockPosition - block.height
Nenue@38 324
Nenue@38 325
Nenue@38 326
Nenue@38 327 if Devian and Devian.InWorkspace() then
Nenue@38 328 block.DebugTab:SetParent(UIParent)
Nenue@38 329 block.DebugTab:SetPoint('TOPRIGHT', block, 'TOPLEFT', 0, 0)
Nenue@38 330 block.DebugTab.status:SetText(tostring(block.schema) .. ' @|cFF00FF00' .. tostring(block.posIndex) .. '|r #|cFFFFFF00'.. tostring(info.logIndex or info.id) .. '|r'..
Nenue@38 331 ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r')
Nenue@38 332 block.DebugTab:Show()
Nenue@38 333 end
Nenue@28 334 end
Nenue@28 335
Nenue@28 336 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
Nenue@30 337 Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative)
Nenue@28 338 local print = bprint
Nenue@30 339
Nenue@30 340 for order, tagName in ipairs(block.info.tagInfo) do
Nenue@30 341 local tag = block[tagName]
Nenue@30 342 if block.tagCoords[tagName] and tag then
Nenue@30 343 tag:SetTexCoord(unpack(block.tagCoords[tagName]))
Nenue@30 344 tag:Show()
Nenue@30 345 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
Nenue@30 346 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
Nenue@30 347 else
Nenue@30 348 block[tagName]:Hide()
Nenue@30 349 end
Nenue@28 350 end
Nenue@30 351
Nenue@28 352 return tagPoint, tagAnchor, tagRelative
Nenue@28 353 end
Nenue@28 354
Nenue@38 355 Default.AddReward = function(handler, block, rewardInfo, tagPoint, tagAnchor, tagRelative)
Nenue@38 356 local print = bprint
Nenue@38 357
Nenue@38 358 for order, reward in ipairs(rewardInfo) do
Nenue@38 359
Nenue@38 360 end
Nenue@38 361 end
Nenue@38 362
Nenue@28 363 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call.
Nenue@30 364 Default.AddLine = function(handler, block, text, attachment, template)
Nenue@28 365 local print = lprint
Nenue@30 366 local lineIndex = block.currentLine + 1
Nenue@34 367 local line = handler:GetLine(block, lineIndex)
Nenue@36 368
Nenue@31 369 line.index = lineIndex
Nenue@38 370 template = template or 'default'
Nenue@38 371 if template and lineSchema ~= template then
Nenue@35 372 print(' |cFF00FF00change schema', template)
Nenue@35 373 T.UpdateSchema('line', template)
Nenue@34 374 end
Nenue@38 375 line.status:SetSpacing(textSpacing)
Nenue@38 376 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
Nenue@38 377 line.status:SetPoint('RIGHT', line, 'RIGHT',0, 0)
Nenue@38 378 line.status:SetTextColor(unpack(textColor))
Nenue@34 379 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing)
Nenue@37 380 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
Nenue@37 381 line:SetPoint('LEFT', block, 'LEFT')
Nenue@37 382 line:SetPoint('RIGHT', block, 'RIGHT')
Nenue@28 383 line:Show()
Nenue@38 384 line:SetScript('OnMouseUp', function(self, button)
Nenue@38 385 handler.OnMouseUp(block, button)
Nenue@38 386 end)
Nenue@28 387
Nenue@34 388
Nenue@35 389 tprint(' |cFF0088FFAddLine|r (|cFF00FFFF'..tostring(line.schema)..'|r):', line:GetName())
Nenue@38 390 --[[
Nenue@38 391 for i = 1, line:GetNumPoints() do
Nenue@38 392 tprint(' - ', line:GetPoint(i))
Nenue@38 393 end
Nenue@38 394 tprint(' - ', line:GetSize())
Nenue@38 395 tprint(' - ', line:GetParent(), line:GetParent():IsVisible())
Nenue@38 396 tprint(' - ', line:IsVisible())
Nenue@38 397 --]]
Nenue@38 398
Nenue@38 399
Nenue@34 400
Nenue@34 401
Nenue@34 402 -- fill in the text, then derive pixel-rounded height
Nenue@30 403 line.status:SetText(text)
Nenue@34 404 line.height = floor(line.status:GetStringHeight()+.5)
Nenue@30 405
Nenue@30 406 -- For progressbar and timer lines, status text may be used as the title heading
Nenue@30 407 if attachment then
Nenue@38 408 attachment:SetPoint('TOP', line, 'TOP')
Nenue@38 409 attachment:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
Nenue@38 410 attachment:SetPoint('RIGHT', line, 'RIGHT')
Nenue@35 411 print(' |cFFFF0088doing things with a widget', attachment:GetSize())
Nenue@34 412 line.height = attachment:GetHeight()
Nenue@34 413 if text then
Nenue@34 414 line.height = max(line.height, line.status:GetStringHeight())
Nenue@31 415 end
Nenue@34 416 if attachment.status:GetText() then
Nenue@34 417 line.height = max(line.height, attachment.status:GetStringHeight())
Nenue@34 418 end
Nenue@30 419 attachment:Show()
Nenue@30 420 end
Nenue@30 421
Nenue@34 422 line:SetHeight(line.height)
Nenue@34 423 block.attachmentHeight = block.attachmentHeight + line.height + textSpacing
Nenue@35 424
Nenue@35 425 local debug_points = ''
Nenue@35 426 for i = 1, line:GetNumPoints() do
Nenue@35 427 local point, parent, anchor = line:GetPoint(i)
Nenue@35 428 debug_points = debug_points .. tostring(parent:GetName()) .. ', ' .. anchor .. ' '
Nenue@35 429 end
Nenue@35 430
Nenue@35 431 print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height,
Nenue@35 432 "|cFF0088FFpoint:|r", debug_points, "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N'))
Nenue@30 433 block.currentLine = lineIndex
Nenue@36 434 block.endPoint = line -- edge used for the next block
Nenue@31 435
Nenue@31 436 return lineIndex
Nenue@28 437 end
Nenue@28 438
Nenue@28 439 --- Creates or retrieves a complete line data object
Nenue@30 440 Default.GetLine = function(handler, block, lineIndex)
Nenue@28 441 local print = lprint
Nenue@28 442 local blockIndex = block.index
Nenue@30 443 local lines = block.lines
Nenue@30 444 if not lineIndex then
Nenue@30 445 lineIndex = block.currentLine + 1
Nenue@34 446 print(' |cFFFFFF00generating a frame')
Nenue@28 447 end
Nenue@30 448
Nenue@30 449 block.numLines = max(block.numLines, lineIndex)
Nenue@30 450
Nenue@28 451 if not lines[lineIndex] then
Nenue@28 452 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
Nenue@28 453 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective')
Nenue@28 454 local line = lines[lineIndex]
Nenue@28 455 line.index = lineIndex
Nenue@28 456 line.height = 0
Nenue@37 457 line.schema = ''
Nenue@28 458 B.SetConfigLayers(line)
Nenue@28 459
Nenue@28 460 if debug then
Nenue@28 461 for _, region in ipairs(lines[lineIndex].debug) do
Nenue@28 462 region:Show()
Nenue@28 463 end
Nenue@28 464 end
Nenue@28 465
Nenue@28 466 end
Nenue@28 467 return lines[lineIndex]
Nenue@28 468 end
Nenue@28 469
Nenue@29 470
Nenue@29 471
Nenue@28 472 --- Creates or retrieves a complete block frame object
Nenue@34 473 --- todo: make it use data index to avoid re-coloring every block
Nenue@37 474 Default.GetBlock = function(handler, index)
Nenue@28 475 local print = bprint
Nenue@37 476 print('|cFF0088FFgetting a block for index', index ..',', #handler.usedBlocks,'used', #handler.freeBlocks, 'free')
Nenue@37 477 local block = handler.InfoBlock[index]
Nenue@35 478 local used = handler.usedBlocks
Nenue@28 479
Nenue@34 480 if not block then
Nenue@28 481 if #handler.freeBlocks >= 1 then
Nenue@34 482 block = tremove(handler.freeBlocks)
Nenue@35 483 tinsert(handler.usedBlocks, block)
Nenue@35 484 block.posIndex = #handler.usedBlocks
Nenue@35 485 print(' |cFF00FF00 assigning from free heap', block:GetName())
Nenue@28 486 else
Nenue@34 487
Nenue@35 488 local blockIndex = (#handler.usedBlocks + #handler.freeBlocks) + 1
Nenue@30 489 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock')
Nenue@35 490 --block:SetParent()
Nenue@37 491 block.schema = ''
Nenue@30 492 block.lines = {}
Nenue@30 493 block.numLines = 0
Nenue@30 494 block.currentLine = 0
Nenue@34 495 block.attachmentHeight = 0
Nenue@35 496 block.offset = 0
Nenue@34 497 B.SetConfigLayers(block)
Nenue@28 498 --- methods for event handlers
Nenue@28 499
Nenue@28 500 block.Select = handler.Select
Nenue@28 501 block.Open = handler.Open
Nenue@28 502 block.Remove = handler.Remove
Nenue@28 503 block.Link = handler.Link
Nenue@28 504 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end)
Nenue@28 505 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end)
Nenue@28 506 block:ClearAllPoints()
Nenue@34 507 block.index = blockIndex
Nenue@35 508 print(' |cFF00FFBBcreating new|r', block:GetName())
Nenue@28 509 end
Nenue@37 510 handler.InfoBlock[index] = block
Nenue@34 511 tinsert(handler.usedBlocks, block)
Nenue@35 512 block.posIndex = #handler.usedBlocks
Nenue@34 513 else
Nenue@34 514 print(' |cFFFFFF00use existing block|r', block:GetName())
Nenue@35 515 local found = false
Nenue@35 516 for i, entry in ipairs(used) do
Nenue@35 517 if entry == block then
Nenue@35 518 found = true
Nenue@35 519 break
Nenue@35 520 end
Nenue@35 521 end
Nenue@35 522 if not found then
Nenue@35 523 tinsert(used, block)
Nenue@35 524 block.posIndex = #used
Nenue@35 525 end
Nenue@28 526 end
Nenue@34 527 return block
Nenue@28 528 end
Nenue@28 529
Nenue@34 530
Nenue@30 531
Nenue@28 532 ----------
Nenue@28 533 --- Top level methods
Nenue@28 534
Nenue@28 535
Nenue@35 536 T.UpdateBlockAction = function (block, itemButton)
Nenue@35 537 local print = bprint
Nenue@28 538 print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
Nenue@28 539 if itemButton.questID ~= block.info.questID then
Nenue@28 540 print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
Nenue@28 541 -- something happened between this and last frame, go back and set new probes
Nenue@35 542 return T.UpdateActionButtons()
Nenue@28 543 end
Nenue@28 544
Nenue@28 545 local previousItem = itemButton.previousItem
Nenue@28 546 local upper_bound = Scroller:GetTop() + Scroller.snap_upper
Nenue@28 547 local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
Nenue@28 548 local point, anchor, relative
Nenue@28 549
Nenue@28 550 if block:GetBottom() < lower_bound then
Nenue@28 551 print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
Nenue@28 552 if previousItem then
Nenue@28 553 print('adjusting', previousItem:GetName())
Nenue@28 554 previousItem:ClearAllPoints()
Nenue@28 555 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
Nenue@28 556 end
Nenue@28 557 itemButton:ClearAllPoints()
Nenue@28 558 itemButton.x = Wrapper:GetLeft() -4
Nenue@28 559 itemButton.y = Wrapper:GetBottom()
Nenue@28 560 point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@28 561 Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
Nenue@28 562
Nenue@28 563 elseif block:GetTop() > upper_bound then
Nenue@28 564 print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
Nenue@28 565 itemButton:ClearAllPoints()
Nenue@28 566 if previousItem then
Nenue@28 567 print('latch onto another piece')
Nenue@28 568 point, anchor, relative ='TOP', previousItem, 'BOTTOM'
Nenue@28 569 itemButton.x = 0
Nenue@28 570 itemButton.y = -itemButtonSpacing
Nenue@28 571 else
Nenue@28 572 print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
Nenue@28 573 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@28 574 itemButton.x = Scroller:GetLeft() -4
Nenue@28 575 itemButton.y = Scroller:GetTop()
Nenue@28 576 end
Nenue@28 577 itemButton:Show()
Nenue@28 578 Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
Nenue@28 579 else
Nenue@28 580 print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
Nenue@28 581 itemButton:ClearAllPoints()
Nenue@28 582 itemButton.x = block:GetLeft() - itemButtonSpacing
Nenue@28 583 itemButton.y = block:GetTop()
Nenue@28 584 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@28 585 end
Nenue@28 586
Nenue@28 587 itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
Nenue@28 588 itemButton:Show()
Nenue@28 589 end
Nenue@28 590
Nenue@35 591 T.UpdateItemButtonCooldown = function(button)
Nenue@28 592
Nenue@28 593 end
Nenue@28 594
Nenue@35 595 function T:FinishWrapper ()
Nenue@35 596 if wrapperHeight > Wrapper.previousHeight then
Nenue@35 597 Wrapper:SetHeight(wrapperHeight)
Nenue@35 598 Scroller:SetHeight(wrapperHeight*3)
Nenue@35 599 Scroll:SetHeight(wrapperHeight)
Nenue@35 600 Wrapper.previousHeight = wrapperHeight
Nenue@35 601 Wrapper.destinationHeight = wrapperHeight
Nenue@35 602 end
Nenue@35 603 Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
Nenue@35 604 print('|cFF00FF00### end of wrapper layout', Wrapper:GetSize())
Nenue@35 605 print(' |cFF00FF00Scroller:', Scroller:GetSize())
Nenue@35 606 print(' |cFF00FF00Scroll:', Scroll:GetSize())
Nenue@35 607 for i = 1, Wrapper:GetNumPoints() do
Nenue@35 608 print('|cFF00FF00 ', Wrapper:GetPoint(i))
Nenue@35 609 end
Nenue@35 610 for i = 1, Scroller:GetNumPoints() do
Nenue@35 611 print('|cFF00FF00 ', Scroller:GetPoint(i))
Nenue@35 612 end
Nenue@35 613 for i = 1, Scroll:GetNumPoints() do
Nenue@35 614 print('|cFF00FF00 ', Scroll:GetPoint(i))
Nenue@35 615 end
Nenue@34 616
Nenue@38 617 if Devian and Devian.InWorkspace() then
Nenue@38 618 Wrapper.AnimState:SetFormattedText(ANIM_STATE, animateReason)
Nenue@38 619 end
Nenue@38 620
Nenue@35 621 Wrapper:Show()
Nenue@35 622 Scroller:Show()
Nenue@35 623 Scroll:Show()
Nenue@28 624 end
Nenue@28 625
Nenue@39 626
Nenue@39 627 -----------------------------------------
Nenue@39 628 -- Criteria frames
Nenue@39 629
Nenue@39 630 --[[
Nenue@39 631 text = description,
Nenue@39 632 type = type,
Nenue@39 633 finished = completed,
Nenue@39 634 quantity = quantity,
Nenue@39 635 requiredQuantity = requiredQuantity,
Nenue@39 636 characterName = characterName,
Nenue@39 637 flags = flags,
Nenue@39 638 assetID = assetID,
Nenue@39 639 quantityString = quantityString,
Nenue@39 640 criteriaID = criteriaID,
Nenue@39 641 ]]
Nenue@39 642 local newWidgetID = 0
Nenue@39 643 T.WidgetRegistry = {}
Nenue@39 644 local wr = T.WidgetRegistry
Nenue@39 645
Nenue@39 646 --- Get a usable widget for the given achievement criteria set.
Nenue@39 647 -- Returns a frame object with dimensioning parameters needed to size the receiving tracker block
Nenue@39 648 T.GetWidget = function(data, objectiveType, objectiveKey)
Nenue@39 649 local print = B.print('ObjectiveWidgets')
Nenue@39 650 local widgetType = objectiveType
Nenue@39 651 local widget
Nenue@39 652 local isNew
Nenue@39 653 if wr[widgetType] and wr[widgetType].used[objectiveKey] then
Nenue@39 654 widget = wr[widgetType].used[objectiveKey]
Nenue@39 655 print('|cFF00FF00Updating ('..objectiveKey..')', widget)
Nenue@39 656 elseif not wr[widgetType] or #wr[widgetType].free == 0 then
Nenue@39 657 -- creating a new frame
Nenue@39 658 isNew = true
Nenue@39 659 widget = CreateFrame(widgetType, 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType)
Nenue@39 660 print('|cFFFF0088Creating `'..widget:GetName()..'` id', wr[widgetType].lastn)
Nenue@39 661 T.UpdateSchema(widgetType, data.schema or 'default')
Nenue@39 662 else
Nenue@39 663 -- recycling for a different criteria set
Nenue@39 664 isNew = true
Nenue@39 665 widget = tremove(wr[widgetType].free)
Nenue@39 666 print('|cFFFFFF00Acquiring released widget', widget:GetName())
Nenue@39 667 end
Nenue@39 668
Nenue@39 669
Nenue@39 670 wr[widgetType].used[objectiveKey] = widget
Nenue@39 671 widget.objective = data
Nenue@39 672 widget.key = objectiveKey
Nenue@39 673 T.InitializeWidget(widget, isNew)
Nenue@39 674 return widget
Nenue@39 675 end
Nenue@39 676
Nenue@39 677 --- WidgetTemplate 'OnLoad'
Nenue@39 678 T.RegisterWidget = function(frame)
Nenue@39 679 local print = B.print('ObjectiveWidgets')
Nenue@39 680 local widgetType = frame.widgetType
Nenue@39 681 if not wr[frame.widgetType] then
Nenue@39 682 print('|cFFFF4400[[WidgetTemplate]]|r', widgetType)
Nenue@39 683 wr[widgetType] = { lastn = 1, free = {}, used = {}, usedIndex = {}, freeIndex = {} }
Nenue@39 684 else
Nenue@39 685 print('|cFF0088FF+ [[WidgetTemplate]]r', widgetType, wr[widgetType].lastn)
Nenue@39 686 wr[widgetType].lastn = wr[widgetType].lastn + 1
Nenue@39 687 end
Nenue@39 688 end
Nenue@39 689 --- WidgetTemplate 'OnShow'
Nenue@39 690 local wrapperWidth, textIndent
Nenue@39 691 T.InitializeWidget = setmetatable({}, {
Nenue@39 692 __call = function(t, frame, isNew, ...)
Nenue@39 693 -- todo: config pull
Nenue@39 694 if not wrapperWidth then
Nenue@39 695 wrapperWidth = T.Conf.Wrapper.Width
Nenue@39 696 textIndent = T.Conf.Wrapper.TextIndent
Nenue@39 697 end
Nenue@39 698
Nenue@39 699 tprint('Initialize', frame:GetName(), isNew, ...)
Nenue@39 700 frame:SetWidth(wrapperWidth - textIndent * 2)
Nenue@39 701 frame:SetScript('OnEvent', T.UpdateWidget[frame.widgetType])
Nenue@39 702 frame:RegisterEvent('QUEST_LOG_UPDATE')
Nenue@39 703 frame:RegisterEvent('TRACKED_ACHIEVEMENT_UPDATE')
Nenue@39 704 frame:RegisterEvent('TRACKED_ACHIEVEMENT_LIST_CHANGED')
Nenue@39 705 frame:RegisterEvent('CRITERIA_UPDATE')
Nenue@39 706 frame:RegisterEvent('CRITERIA_COMPLETE')
Nenue@39 707 frame:RegisterEvent('CRITERIA_EARNED')
Nenue@39 708 t[frame.widgetType](frame, isNew)
Nenue@39 709 T.UpdateWidget[frame.widgetType](frame, isNew)
Nenue@39 710 end,
Nenue@39 711 })
Nenue@39 712
Nenue@39 713 --- WidgetTemplate 'OnEvent'
Nenue@39 714 T.UpdateWidget = setmetatable({}, {
Nenue@39 715 __call = function(t, frame, isNew, ...)
Nenue@39 716 tprint('Update', frame:GetName(), isNew, ...)
Nenue@39 717 if not frame.widgetType then
Nenue@39 718 return
Nenue@39 719 end
Nenue@39 720
Nenue@39 721 return t[frame.widgetType](frame, isNew)
Nenue@39 722 end
Nenue@39 723 })
Nenue@39 724
Nenue@39 725
Nenue@39 726 local progressHeight = 17
Nenue@39 727 local progressBorder = 1
Nenue@39 728 local progressFont = _G.VeneerCriteriaFontNormal
Nenue@39 729
Nenue@39 730 local lprint = B.print('Line')
Nenue@39 731 T.InitializeWidget.StatusBar = function(self, isNew)
Nenue@39 732 local print = lprint
Nenue@39 733 local c = T.Conf.Wrapper
Nenue@39 734
Nenue@39 735 tprint(self:GetName(), isNew)
Nenue@39 736 if isNew then
Nenue@39 737 self.maxValue = self.maxValue or 1
Nenue@39 738 self:SetMinMaxValues(0, self.maxValue)
Nenue@39 739
Nenue@39 740 self:SetHeight(widgetHeight)
Nenue@39 741 self.height = widgetHeight
Nenue@39 742
Nenue@39 743 self.status:SetFont(widgetTextFont, widgetTextSize, widgetTextOutline)
Nenue@39 744 self.status:SetTextColor(unpack(widgetTextColor))
Nenue@39 745 end
Nenue@39 746 self.value = self.value or 1
Nenue@39 747 self:SetValue(self.value)
Nenue@39 748
Nenue@39 749 self.status:SetText(self.objective.quantityString)
Nenue@39 750 end
Nenue@39 751
Nenue@39 752 T.UpdateWidget.StatusBar = function (self)
Nenue@39 753 local value, maxValue = self.value, self.maxValue
Nenue@39 754 print('update vals:')
Nenue@39 755 for k,v in pairs(self) do
Nenue@39 756 print(k, v)
Nenue@39 757 end
Nenue@39 758 self.width = self.width or self:GetWidth()
Nenue@39 759 self:SetValue(self.value)
Nenue@39 760 local format = self.format or '%d/%d'
Nenue@39 761 self.status:SetFormattedText(format, value, maxValue)
Nenue@39 762 local progress = (value / maxValue)
Nenue@39 763 if progress > 0 then
Nenue@39 764 print('color:', 1-progress*2 , progress*2 - 1,0,1)
Nenue@39 765 print('width:', (self.width -progressBorder * 2) * progress)
Nenue@39 766 self:SetStatusBarColor(1-progress*2 , progress*2,0,1)
Nenue@39 767 end
Nenue@39 768 end
Nenue@39 769
Nenue@39 770
Nenue@39 771 T.InitializeWidget.Hidden = function (self)
Nenue@39 772 self.height = 0
Nenue@39 773 end
Nenue@39 774 T.UpdateWidget.Hidden = function (self)
Nenue@39 775 self.height= 0
Nenue@39 776 end
Nenue@39 777
Nenue@39 778
Nenue@39 779 --- Queue any active item buttons for update for that frame
Nenue@39 780 local iprint = B.print('ItemButton')
Nenue@39 781 local Quest = T.Quest
Nenue@39 782 local IsQuestWatched, InCombatLockdown = IsQuestWatched, InCombatLockdown
Nenue@39 783 T.UpdateActionButtons = function(updateReason)
Nenue@39 784 local print = iprint
Nenue@39 785 Scroller.snap_upper = 0
Nenue@39 786 Scroller.snap_lower = 0
Nenue@39 787 local print = B.print('ItemButton')
Nenue@39 788 if updateReason then
Nenue@39 789 print = B.print('IB_'..updateReason)
Nenue@39 790 end
Nenue@39 791
Nenue@39 792 local previousItem
Nenue@39 793 for questID, itemButton in pairs(Quest.itemButtons) do
Nenue@39 794 local info= T.Quest.Info[questID]
Nenue@39 795
Nenue@39 796 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
Nenue@39 797 local block = T.Quest.QuestBlock[questID]
Nenue@39 798 if block then
Nenue@39 799 -- Dispatch the probe
Nenue@39 800 if IsQuestWatched(info.logIndex) then
Nenue@39 801 itemButton.previousItem = previousItem
Nenue@39 802 print(' |cFFFFFF00probing', block:GetName())
Nenue@39 803 block:SetScript('OnUpdate', function()
Nenue@39 804 if block:GetBottom() and not InCombatLockdown() then
Nenue@39 805 print(' '..block:GetName()..' |cFF00FF00probe hit!')
Nenue@39 806 T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
Nenue@39 807 block:SetScript('OnUpdate', nil)
Nenue@39 808
Nenue@39 809 end
Nenue@39 810 end)
Nenue@39 811 previousItem = itemButton
Nenue@39 812 else
Nenue@39 813 print('hidden block or unwatched quest')
Nenue@39 814 itemButton.previousItem = nil
Nenue@39 815 itemButton:Hide()
Nenue@39 816 end
Nenue@39 817 elseif itemButton:IsVisible() then
Nenue@39 818 print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
Nenue@39 819 itemButton.previousItem = nil
Nenue@39 820 itemButton:Hide()
Nenue@39 821 else
Nenue@39 822 print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
Nenue@39 823 end
Nenue@39 824 end
Nenue@39 825 end