Mercurial > wow > buffalo2
comparison ObjectiveTracker/Frame.lua @ 34:9856ebc63fa4
- half solution to Update being fired multiple times during load
- change securefunc handlers to dispense a reason code; catch that reason code in the enclosure passed to hooksecurefunc, and decide whether to update or not from there.
| author | Nenue |
|---|---|
| date | Sun, 17 Apr 2016 00:21:45 -0400 |
| parents | 64f2a9bbea79 |
| children | 69d03f8e293e |
comparison
equal
deleted
inserted
replaced
| 33:64f2a9bbea79 | 34:9856ebc63fa4 |
|---|---|
| 4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
| 5 -- Created: 3/30/2016 12:49 AM | 5 -- Created: 3/30/2016 12:49 AM |
| 6 local B = select(2,...).frame | 6 local B = select(2,...).frame |
| 7 local Module = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 7 local Module = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
| 8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band | 8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band |
| 9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion | 9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion, tinsert, tremove = IsResting, UnitXP, UnitXPMax, GetXPExhaustion, table.insert, table.remove |
| 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent | 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent |
| 11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText | 11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText |
| 12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent | 12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent |
| 13 local Default, AutoQuest, Quest, Bonus, Cheevs = Module.DefaultHandler, Module.AutoQuest, Module.Quest, Module.Bonus, Module.Cheevs | 13 local Default, AutoQuest, Quest, Bonus, Cheevs = Module.DefaultHandler, Module.AutoQuest, Module.Quest, Module.Bonus, Module.Cheevs |
| 14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame | 14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame |
| 15 local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow | 15 local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow |
| 16 local print = B.print('Tracker') | 16 local print = B.print('Tracker') |
| 17 local oprint = B.print('Objectives') | |
| 18 local bprint = B.print('Block') | |
| 19 local tprint = B.print('Tracker') | |
| 20 local lprint = B.print('Line') | |
| 17 local unitLevel = 1 | 21 local unitLevel = 1 |
| 18 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON | 22 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON |
| 19 local debug = false | 23 local debug = false |
| 20 | 24 |
| 21 --- Upvalues | 25 --- FRAMES |
| 22 local Wrapper = _G.VeneerObjectiveWrapper | 26 local Wrapper = _G.VeneerObjectiveWrapper |
| 23 local Scroller = Wrapper.scrollArea | 27 local Scroller = Wrapper.scrollArea |
| 24 local Scroll = _G.VeneerObjectiveScroll | 28 local Scroll = _G.VeneerObjectiveScroll |
| 25 local orderedHandlers = Module.orderedHandlers | 29 local orderedHandlers = Module.orderedHandlers |
| 26 local orderedNames = Module.orderedNames | 30 local orderedNames = Module.orderedNames |
| 27 | 31 |
| 28 --- Temp values set during updates | 32 --- FRAME TEMP VARIABLES |
| 29 local wrapperWidth, wrapperHeight | 33 local wrapperWidth, wrapperHeight |
| 30 local scrollWidth, scrollHeight | 34 local scrollWidth, scrollHeight |
| 31 local previousBlock | 35 |
| 32 local currentBlock | 36 --- SCHEMA VARIABLES |
| 33 --- todo: source these from config | 37 local schemaName, lastSchema = { |
| 38 tracker = '', | |
| 39 block = '', | |
| 40 line = '' | |
| 41 }, {} | |
| 42 local trackerSchema, blockSchema, lineSchema | |
| 43 | |
| 34 local itemButtonSize, itemButtonSpacing = 36, 1 | 44 local itemButtonSize, itemButtonSpacing = 36, 1 |
| 35 | |
| 36 local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2 | |
| 37 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} | |
| 38 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' | |
| 39 | |
| 40 local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2} | |
| 41 local titlebg_daily = {'HORIZONTAL', 0, .7, 1, 0, 0, 1, .7, .2 } | |
| 42 local titlebg_account = {'HORIZONTAL', 0, .45, 1, 0, 0, .45, 1, .2} | |
| 43 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' | |
| 44 | |
| 45 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } | |
| 46 local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 } | |
| 47 local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 } | |
| 48 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE' | |
| 49 | |
| 50 | |
| 51 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} | |
| 52 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 | |
| 53 local titleIndent, textIndent,selectionIndent = 2, 5, 50 | |
| 54 | |
| 55 local lineColors = { | |
| 56 normal = { | |
| 57 text = {.5,.75,1}, | |
| 58 }, | |
| 59 completed = { | |
| 60 text = {0, 1, 0} | |
| 61 }, | |
| 62 failed = { | |
| 63 text = {1,0,0 } | |
| 64 }, | |
| 65 autocomplete = { | |
| 66 text = {0,1,0 } | |
| 67 }, | |
| 68 object = { | |
| 69 text = {0,1,1} | |
| 70 }, | |
| 71 monster = { | |
| 72 text = {1,1,0} | |
| 73 }, | |
| 74 item = { | |
| 75 text = {1,.25,.5} | |
| 76 } | |
| 77 } | |
| 78 | |
| 79 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed | 45 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed |
| 80 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' | 46 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' |
| 81 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } | 47 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } |
| 82 local rewardSize = 24 | 48 local rewardSize = 24 |
| 83 local oprint = B.print('Objectives') | 49 |
| 84 local bprint = B.print('Block') | 50 local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2 |
| 85 local tprint = B.print('Tracker') | 51 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} |
| 86 local lprint = B.print('Line') | 52 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' |
| 53 | |
| 54 local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2} | |
| 55 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' | |
| 56 local titleColor = {0,.7,1,1} | |
| 57 | |
| 58 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } | |
| 59 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE' | |
| 60 local textColor = {1,1,1,1} | |
| 61 | |
| 62 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} | |
| 63 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 | |
| 64 local titleIndent, textIndent,selectionIndent = 2, 5, 50 | |
| 65 --- END SCHEMA | |
| 66 --- schema swapper | |
| 67 Module.UpdateSchema = function(layer, newSchema) | |
| 68 if not (Module.Conf.Schema[layer] and Module.Conf.Schema[layer][newSchema]) then | |
| 69 return | |
| 70 elseif schemaName[layer] == newSchema then | |
| 71 return | |
| 72 end | |
| 73 lastSchema[layer] = schemaName[layer] | |
| 74 schemaName[layer] = newSchema | |
| 75 local c = Module.Conf.Schema[layer][newSchema] | |
| 76 | |
| 77 if layer == 'tracker' then | |
| 78 headerHeight, headerSpacing = c.headerHeight, c.headerSpacing | |
| 79 headerColor = c.headerColor | |
| 80 headerbg = c.headerbg | |
| 81 headerFont, headerSize, headerOutline = c.headerFont, c.headerSize, c.headerOutline | |
| 82 trackerSchema = newSchema | |
| 83 elseif layer == 'block' then | |
| 84 titlebg = c.titlebg | |
| 85 titleFont, titleSize, titleOutline = c.titleFont, c.titleSize, c.titleOutline | |
| 86 selectionbg = c.selectionbg | |
| 87 titleSpacing, textSpacing, blockSpacing = c.titleSpacing, c.textSpacing, c.blockSpacing | |
| 88 titleIndent, textIndent,selectionIndent = 2, 5, 50 | |
| 89 titleColor = c.titleColor | |
| 90 rewardSize = 24 | |
| 91 blockSchema = newSchema | |
| 92 textFont, textSize, textOutline = c.textFont, c.textSize, c.textOutline | |
| 93 textbg = c.textbg | |
| 94 textIndent = c.textIndent | |
| 95 rewardSize = c.rewardSize | |
| 96 elseif layer == 'line' then | |
| 97 textColor = c.textColor | |
| 98 lineSchema = newSchema | |
| 99 end | |
| 100 print('|cFFFF0088UpdateSchema:|r', layer, lastSchema[layer], '->', newSchema) | |
| 101 end | |
| 87 | 102 |
| 88 Default.AddBlock = function(self, block, blockIndex) | 103 Default.AddBlock = function(self, block, blockIndex) |
| 89 local blockIndex = blockIndex or (self.currentBlock + 1) | 104 local blockIndex = blockIndex or (self.currentBlock + 1) |
| 90 local print = bprint | 105 local print = bprint |
| 91 local tracker = self.frame | 106 local tracker = self.frame |
| 92 local info = block.info | 107 local info = block.info |
| 93 | 108 |
| 109 if blockSchema ~= block.schema then | |
| 110 print('new schema detected, applicating...') | |
| 111 block.schema = blockSchema | |
| 112 block:SetWidth(Module.Conf.Wrapper.Width) | |
| 113 block.title:SetSpacing(titleSpacing) | |
| 114 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) | |
| 115 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) | |
| 116 block.titlebg:SetTexture(1,1,1,1) | |
| 117 block.titlebg:SetGradientAlpha(unpack(titlebg)) | |
| 118 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) | |
| 119 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) | |
| 120 block.status:SetSpacing(textSpacing) | |
| 121 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) | |
| 122 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) | |
| 123 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) | |
| 124 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) | |
| 125 block.statusbg:SetTexture(1,1,1,1) | |
| 126 block.statusbg:SetGradientAlpha(unpack(textbg)) | |
| 127 block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) | |
| 128 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) | |
| 129 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') | |
| 130 | |
| 131 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 | |
| 132 for i, tile in ipairs(block.rewardTile) do | |
| 133 print(rewardSize) | |
| 134 tile:SetSize(rewardSize, rewardSize) | |
| 135 tile:ClearAllPoints() | |
| 136 tile:SetPoint(anchor, target, point, x, y) | |
| 137 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) | |
| 138 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 | |
| 139 end | |
| 140 end | |
| 141 | |
| 142 if block.debug then | |
| 143 local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide' | |
| 144 for _, region in ipairs(block.debug) do | |
| 145 region[func]() | |
| 146 end | |
| 147 end | |
| 148 | |
| 149 -- positioned by offset since they tend to swap contents | |
| 94 block.index = blockIndex | 150 block.index = blockIndex |
| 95 block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, block.offset) | 151 block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, block.offset) |
| 96 block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) | 152 block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) |
| 97 self.currentBlock = blockIndex | 153 self.currentBlock = blockIndex |
| 98 self.currentAnchor = block | 154 self.currentAnchor = block |
| 99 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) | 155 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) |
| 100 tracker.height = tracker.height + block.height | 156 tracker.height = tracker.height + block.height |
| 101 self.numBlocks = max(self.numBlocks, blockIndex) | |
| 102 self.actualBlocks = self.actualBlocks + 1 | 157 self.actualBlocks = self.actualBlocks + 1 |
| 103 end | 158 end |
| 104 | 159 |
| 105 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) | 160 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) |
| 106 Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) | 161 Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) |
| 123 | 178 |
| 124 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call. | 179 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call. |
| 125 Default.AddLine = function(handler, block, text, attachment, template) | 180 Default.AddLine = function(handler, block, text, attachment, template) |
| 126 local print = lprint | 181 local print = lprint |
| 127 local lineIndex = block.currentLine + 1 | 182 local lineIndex = block.currentLine + 1 |
| 128 local line = handler:GetLine(block) | 183 local line = handler:GetLine(block, lineIndex) |
| 129 line.index = lineIndex | 184 line.index = lineIndex |
| 130 line:ClearAllPoints() | 185 if line.schema ~= template then |
| 131 line:SetPoint('LEFT', block, 'LEFT', 0, 0) | 186 print(' |cFF00FF00change schema', template) |
| 132 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, 0) | 187 Module.UpdateSchema('line', template) |
| 133 line:SetPoint('RIGHT', block, 'RIGHT', 0, 0) | 188 line.status:SetSpacing(textSpacing) |
| 189 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) | |
| 190 line.status:SetPoint('RIGHT', line, 'RIGHT', -textIndent, 0) | |
| 191 line.status:SetTextColor(unpack(textColor)) | |
| 192 line.schema = template | |
| 193 else | |
| 194 print(' |cFFFFFF00keep schema', template) | |
| 195 end | |
| 196 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing) | |
| 134 line:Show() | 197 line:Show() |
| 135 | 198 |
| 136 print(' |cFF0088FFAddLine >>|r', block, '::', block.endPoint:GetName(),'"'.. text .. '"', attachment, template) | 199 |
| 200 print(' |cFF0088FFAddLine >>|r', block, '::', block.endPoint:GetName(),'"'.. text .. '"', attachment, template) | |
| 201 | |
| 202 | |
| 203 -- fill in the text, then derive pixel-rounded height | |
| 137 line.status:SetText(text) | 204 line.status:SetText(text) |
| 138 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing | 205 line.height = floor(line.status:GetStringHeight()+.5) |
| 139 line:SetHeight(line.height) | |
| 140 | |
| 141 local r, g, b, a = 1, 1, 1, 1 | |
| 142 if lineColors[template] then | |
| 143 r, g, b = unpack(lineColors[template].text) | |
| 144 end | |
| 145 line.status:SetTextColor(r, g, b, a) | |
| 146 | 206 |
| 147 -- For progressbar and timer lines, status text may be used as the title heading | 207 -- For progressbar and timer lines, status text may be used as the title heading |
| 148 if attachment then | 208 if attachment then |
| 149 local widgetOffset = 0 | 209 print(' |cFFFF0088doing things with a widget', attachment:GetSize()) |
| 150 line.height = attachment:GetHeight() + textSpacing | 210 line.height = attachment:GetHeight() |
| 151 if text and #text >= 1 then | 211 if text then |
| 152 widgetOffset = line.status:GetHeight() + textSpacing | 212 line.height = max(line.height, line.status:GetStringHeight()) |
| 153 line.height = line.height + floor(line.status:GetStringHeight()+.5) + textSpacing | 213 end |
| 154 print(' |cFFFF0088doing things with captioned widget') | 214 if attachment.status:GetText() then |
| 155 else | 215 line.height = max(line.height, attachment.status:GetStringHeight()) |
| 156 print(' |cFFFF0088doing things with a widget') | 216 end |
| 157 end | |
| 158 attachment:SetPoint('TOP', line, 'TOP', 0, -widgetOffset) | |
| 159 attachment:Show() | 217 attachment:Show() |
| 160 end | 218 end |
| 161 | 219 |
| 162 block.attachmentHeight = block.attachmentHeight + line.height | 220 line:SetHeight(line.height) |
| 163 print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height, | 221 block.attachmentHeight = block.attachmentHeight + line.height + textSpacing |
| 222 print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height, | |
| 164 "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N')) | 223 "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N')) |
| 165 block.currentLine = lineIndex | 224 block.currentLine = lineIndex |
| 166 block.endPoint = line.statusbg -- edge used for the next block | 225 block.endPoint = line.statusbg -- edge used for the next block |
| 167 | 226 |
| 168 return lineIndex | 227 return lineIndex |
| 173 local print = lprint | 232 local print = lprint |
| 174 local blockIndex = block.index | 233 local blockIndex = block.index |
| 175 local lines = block.lines | 234 local lines = block.lines |
| 176 if not lineIndex then | 235 if not lineIndex then |
| 177 lineIndex = block.currentLine + 1 | 236 lineIndex = block.currentLine + 1 |
| 178 print(' fetching the "next" line:', lineIndex) | 237 print(' |cFFFFFF00generating a frame') |
| 179 else | |
| 180 print(' fetching explicit offset:', lineIndex) | |
| 181 end | 238 end |
| 182 | 239 |
| 183 block.numLines = max(block.numLines, lineIndex) | 240 block.numLines = max(block.numLines, lineIndex) |
| 184 print(' |cFF00FFFFposition|r', block.currentLine, '|cFF00FFFFof|r|cFFFFFF00' , block.numLines) | |
| 185 | 241 |
| 186 if not lines[lineIndex] then | 242 if not lines[lineIndex] then |
| 187 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex) | 243 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex) |
| 188 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective') | 244 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective') |
| 189 local line = lines[lineIndex] | 245 local line = lines[lineIndex] |
| 190 line.index = lineIndex | 246 line.index = lineIndex |
| 191 line.height = 0 | 247 line.height = 0 |
| 192 line.status:SetSpacing(textSpacing) | |
| 193 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) | |
| 194 B.SetConfigLayers(line) | 248 B.SetConfigLayers(line) |
| 195 | |
| 196 if lines[lineIndex+1] then | |
| 197 lines[lineIndex+1]:ClearAllPoints() | |
| 198 end | |
| 199 | 249 |
| 200 if debug then | 250 if debug then |
| 201 for _, region in ipairs(lines[lineIndex].debug) do | 251 for _, region in ipairs(lines[lineIndex].debug) do |
| 202 region:Show() | 252 region:Show() |
| 203 end | 253 end |
| 208 end | 258 end |
| 209 | 259 |
| 210 | 260 |
| 211 | 261 |
| 212 --- Creates or retrieves a complete block frame object | 262 --- Creates or retrieves a complete block frame object |
| 213 Default.GetBlock = function(handler, blockIndex) | 263 --- todo: make it use data index to avoid re-coloring every block |
| 264 Default.GetBlock = function(handler, logIndex) | |
| 214 local print = bprint | 265 local print = bprint |
| 215 local block = handler.usedBlocks[blockIndex] | 266 print('|cFFFFFF00getting a block for logID', logIndex ..',', #handler.usedBlocks,'used', #handler.freeBlocks, 'free') |
| 216 | 267 local block = handler.LogBlock[logIndex] |
| 217 if not handler.usedBlocks[blockIndex] then | 268 |
| 269 if not block then | |
| 218 if #handler.freeBlocks >= 1 then | 270 if #handler.freeBlocks >= 1 then |
| 219 block = handler.freeBlocks[#handler.freeBlocks] | 271 block = tremove(handler.freeBlocks) |
| 220 handler.freeBlocks[#handler.freeBlocks] = nil | 272 print(' assigning from free heap|cFF00FFFF', block:GetName()) |
| 221 else | 273 else |
| 274 | |
| 275 local blockIndex = handler.numBlocks + 1 | |
| 222 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock') | 276 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock') |
| 223 | |
| 224 local c = Module.Conf.Wrapper | |
| 225 block.index = blockIndex | |
| 226 block.lines = {} | 277 block.lines = {} |
| 227 block.numLines = 0 | 278 block.numLines = 0 |
| 228 block.currentLine = 0 | 279 block.currentLine = 0 |
| 229 block:SetWidth(c.Width) | 280 block.attachmentHeight = 0 |
| 230 | 281 B.SetConfigLayers(block) |
| 231 block.title:SetSpacing(c.TitleSpacing) | |
| 232 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) | |
| 233 block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) | |
| 234 | |
| 235 block.titlebg:SetTexture(1,1,1,1) | |
| 236 block.titlebg:SetGradientAlpha(unpack(titlebg)) | |
| 237 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) | |
| 238 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) | |
| 239 | |
| 240 block.status:SetSpacing(c.TextSpacing) | |
| 241 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) | |
| 242 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) | |
| 243 | |
| 244 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) | |
| 245 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) | |
| 246 block.statusbg:SetTexture(1,1,1,1) | |
| 247 block.statusbg:SetGradientAlpha(unpack(textbg)) | |
| 248 | |
| 249 block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg)) | |
| 250 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) | |
| 251 block.SelectionOverlay:SetPoint('BOTTOMRIGHT') | |
| 252 | |
| 253 --block.icon:SetSize(rewardSize, rewardSize) | |
| 254 --block.icon:SetPoint() | |
| 255 local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 | |
| 256 for i, tile in ipairs(block.rewardTile) do | |
| 257 print(rewardSize) | |
| 258 tile:SetSize(rewardSize, rewardSize) | |
| 259 tile:ClearAllPoints() | |
| 260 tile:SetPoint(anchor, target, point, x, y) | |
| 261 block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, -2) | |
| 262 anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 | |
| 263 end | |
| 264 | |
| 265 | |
| 266 --- methods for event handlers | 282 --- methods for event handlers |
| 267 | 283 |
| 268 block.Select = handler.Select | 284 block.Select = handler.Select |
| 269 block.Open = handler.Open | 285 block.Open = handler.Open |
| 270 block.Remove = handler.Remove | 286 block.Remove = handler.Remove |
| 271 block.Link = handler.Link | 287 block.Link = handler.Link |
| 272 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end) | 288 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end) |
| 273 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end) | 289 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end) |
| 274 block.attachmentHeight = 0 | |
| 275 block:ClearAllPoints() | 290 block:ClearAllPoints() |
| 276 | 291 block.index = blockIndex |
| 277 B.SetConfigLayers(block) | 292 handler.numBlocks = max(handler.numBlocks, blockIndex) |
| 278 | 293 |
| 279 if debug then | 294 print(' |cFFFFFF00creating new|r', block:GetName()) |
| 280 for _, region in ipairs(block.debug) do | 295 end |
| 281 region:Show() | 296 handler.LogBlock[logIndex] = block |
| 282 end | 297 tinsert(handler.usedBlocks, block) |
| 283 end | 298 else |
| 284 end | 299 print(' |cFFFFFF00use existing block|r', block:GetName()) |
| 285 handler.usedBlocks[blockIndex] = block | 300 end |
| 286 end | 301 return block |
| 287 return handler.usedBlocks[blockIndex] | |
| 288 end | 302 end |
| 289 | 303 |
| 290 local currentPosition, anchorFrame, anchorPoint | 304 local currentPosition, anchorFrame, anchorPoint |
| 291 --- Positioning and stuff | 305 --- Positioning and stuff |
| 292 local tick = 0 | 306 local tick = 0 |
| 293 local maxReason = 0 | 307 local firstUpdate = true |
| 294 function Module:Update (reason, ...) | 308 function Module:Update (reason, ...) |
| 309 if not B.Conf.VeneerObjectiveWrapper.enabled then | |
| 310 return | |
| 311 end | |
| 312 | |
| 295 tick = tick + 1 | 313 tick = tick + 1 |
| 296 -- is this the first time updating? | 314 if firstUpdate or not reason then |
| 297 if maxReason == 0 then | 315 reason = _G.OBJECTIVE_TRACKER_UPDATE_ALL |
| 298 reason = OBJECTIVE_TRACKER_UPDATE_ALL | |
| 299 elseif not reason then | |
| 300 reason = OBJECTIVE_TRACKER_UPDATE_REASON | |
| 301 end | 316 end |
| 302 | 317 |
| 303 local print = tprint | 318 local print = tprint |
| 304 local updateWrapper = 0 | 319 local updateWrapper = 0 |
| 305 local hasStuff | 320 local hasStuff |
| 306 local insertingStuff | 321 local insertingStuff |
| 307 | 322 |
| 308 print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...) | 323 print(format('|cFFBB0066Update:|r |cFFFF%04X%d|r ', tick, lshift(reason, 4)), reason, ...) |
| 309 currentPosition = 0 | 324 currentPosition = 0 |
| 310 anchorPoint = 'TOP' | 325 anchorPoint = 'TOP' |
| 311 anchorFrame = Scroll | 326 anchorFrame = Scroll |
| 312 | 327 |
| 313 local wrapperHeight = 0 | 328 local wrapperHeight = 0 |
| 314 for id, handler in pairs(Module.orderedHandlers) do | 329 for id, handler in pairs(Module.orderedHandlers) do |
| 315 local frame = handler.frame | 330 local frame = handler.frame |
| 316 | 331 |
| 317 print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents))) | 332 |
| 318 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then | 333 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then |
| 319 handler:UpdateTracker(reason, ...) | 334 handler:UpdateTracker(reason, ...) |
| 320 print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched) | |
| 321 insertingStuff = true | 335 insertingStuff = true |
| 322 else | 336 else |
| 323 print(' |cFFFF0088'..id..'|r', 'no reason to update') | 337 print(' |cFFFF0088'..id..'|r', 'no reason to update') |
| 324 end | 338 end |
| 325 | 339 |
| 326 if handler.numWatched >= 1 then | 340 if handler.numWatched >= 1 then |
| 341 | |
| 342 print(format('|cFF88FFBB%s and(%04X, %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents))) | |
| 327 hasStuff = true | 343 hasStuff = true |
| 328 currentPosition = currentPosition + 1 | 344 currentPosition = currentPosition + 1 |
| 329 frame.destinationOffset = -wrapperHeight | 345 frame.destinationOffset = -wrapperHeight |
| 330 if frame.previousOffset ~= wrapperHeight and frame:IsVisible() then | 346 if (not firstUpdate) and frame.previousOffset ~= wrapperHeight and frame:IsVisible() then |
| 331 print(frame.SlideIn.translation) | 347 print(frame.SlideIn.translation) |
| 332 local postFrame, postPoint = anchorFrame, anchorPoint | 348 local postFrame, postPoint = anchorFrame, anchorPoint |
| 333 local delta = frame.destinationOffset - frame.previousOffset | 349 local delta = frame.destinationOffset - frame.previousOffset |
| 334 local _, _, _, _, offset = frame:GetPoint(1) | 350 local _, _, _, _, offset = frame:GetPoint(1) |
| 335 print(' |cFF00BBFFstart slide for', delta, 'pixels, from', frame.previousOffset, '(', offset, ')') | 351 print(' |cFF00BBFFstart slide for', delta, 'pixels, from', frame.previousOffset, '(', offset, ')') |
| 338 frame.SlideIn:Play() | 354 frame.SlideIn:Play() |
| 339 for i, b in ipairs(handler.usedBlocks) do | 355 for i, b in ipairs(handler.usedBlocks) do |
| 340 b.SlideIn.translation:SetOffset(0, delta) | 356 b.SlideIn.translation:SetOffset(0, delta) |
| 341 b.SlideIn:Play() | 357 b.SlideIn:Play() |
| 342 end | 358 end |
| 359 local start = GetTime() | |
| 343 frame.SlideIn:SetScript('OnFinished', function() | 360 frame.SlideIn:SetScript('OnFinished', function() |
| 344 print(' |cFF00BBFFsliding finished:', delta, 'pixels covered') | 361 print(' |cFF00BBFFsliding finished:', delta, 'pixels covered; duration:', GetTime()-start) |
| 345 frame:SetParent(Scroll) | 362 frame:SetParent(Scroll) |
| 346 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) | 363 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) |
| 347 frame.previousOffset = frame.destinationOffset | 364 frame.previousOffset = frame.destinationOffset |
| 348 frame.SlideIn:SetScript('OnFinished', nil) | 365 frame.SlideIn:SetScript('OnFinished', nil) |
| 349 if Wrapper.destinationHeight then | 366 if Wrapper.destinationHeight then |
| 354 Wrapper.destinationHeight = nil | 371 Wrapper.destinationHeight = nil |
| 355 end | 372 end |
| 356 | 373 |
| 357 end) | 374 end) |
| 358 else | 375 else |
| 359 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint) | 376 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint, '|rcurrent frame height:', frame.height) |
| 377 print(' |cFFFF0088total height:', wrapperHeight) | |
| 360 frame:SetParent(Scroll) | 378 frame:SetParent(Scroll) |
| 361 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) | 379 frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) |
| 362 end | 380 end |
| 363 | 381 |
| 364 frame:Show() | 382 frame:Show() |
| 365 anchorFrame = handler.frame | 383 anchorFrame = handler.frame |
| 366 anchorPoint = 'BOTTOM' | 384 anchorPoint = 'BOTTOM' |
| 367 | 385 |
| 368 print('current frame height:', frame.height) | |
| 369 wrapperHeight = wrapperHeight + frame.height | 386 wrapperHeight = wrapperHeight + frame.height |
| 370 print('|cFFFF0088total height:', wrapperHeight) | |
| 371 else | 387 else |
| 388 | |
| 389 print(' |cFFFF4400GetNumWatched:|r',handler.name, '0') | |
| 372 frame:SetPoint('TOP', Scroll, 'TOP', 0, 0) | 390 frame:SetPoint('TOP', Scroll, 'TOP', 0, 0) |
| 373 frame.destinationOffset = 0 | 391 frame.destinationOffset = 0 |
| 374 frame.previousOffset = 0 | 392 frame.previousOffset = 0 |
| 375 handler.frame:Hide() | 393 handler.frame:Hide() |
| 376 end | 394 end |
| 404 Scroller:Show() | 422 Scroller:Show() |
| 405 Scroll:Show() | 423 Scroll:Show() |
| 406 end | 424 end |
| 407 Quest.GetClosest() | 425 Quest.GetClosest() |
| 408 --Module.UpdateActionButtons(reason) | 426 --Module.UpdateActionButtons(reason) |
| 427 if firstUpdate then | |
| 428 firstUpdate = nil | |
| 429 end | |
| 409 end | 430 end |
| 410 | 431 |
| 411 --- Content generator base | 432 --- Content generator base |
| 412 Default.UpdateTracker = function (handler, reason, id, isNew) | 433 Default.UpdateTracker = function (handler, reason, id, isNew) |
| 413 local print = tprint | 434 local print = tprint |
| 420 tracker.titlebg:SetHeight(headerHeight) | 441 tracker.titlebg:SetHeight(headerHeight) |
| 421 tracker.title:SetTextColor(unpack(headerColor)) | 442 tracker.title:SetTextColor(unpack(headerColor)) |
| 422 | 443 |
| 423 handler.updateReason = reason | 444 handler.updateReason = reason |
| 424 handler.numWatched = handler:GetNumWatched() | 445 handler.numWatched = handler:GetNumWatched() |
| 446 if handler.numWatched >= 1 then | |
| 447 | |
| 448 print(' |cFF00FF88GetNumWatched:|r',handler.name, handler.numWatched, 'of', handler.numAll) | |
| 449 end | |
| 450 | |
| 425 handler.currentBlock = 0 | 451 handler.currentBlock = 0 |
| 426 handler.currentAnchor = tracker.titlebg | 452 handler.currentAnchor = tracker.titlebg |
| 427 local blockPosition = -headerHeight | 453 local blockPosition = -headerHeight |
| 428 for blockIndex = 1, handler.numWatched do | 454 for blockIndex = 1, handler.numWatched do |
| 429 local currentBlock = handler:UpdateBlock(blockIndex, id, isNew) | 455 local currentBlock = handler:UpdateBlock(blockIndex, id, isNew) |
| 435 print(' |cFFFF9900END|r @', blockIndex) | 461 print(' |cFFFF9900END|r @', blockIndex) |
| 436 break -- done with quest stuff | 462 break -- done with quest stuff |
| 437 end | 463 end |
| 438 end | 464 end |
| 439 | 465 |
| 440 for i = handler.currentBlock+1, handler.numBlocks do | 466 |
| 441 local used = handler.usedBlocks | 467 local numBlocks = handler.numBlocks |
| 468 local used = handler.usedBlocks | |
| 469 if numBlocks < #used then | |
| 470 print(' |cFF0088FFcull the dead: showing|r', numBlocks, '|cFF0088FF out of|r', #used) | |
| 442 local free = handler.freeBlocks | 471 local free = handler.freeBlocks |
| 443 print('clean up dead quest block') | 472 local remaining = #used |
| 444 if used[i] then | 473 for i = #used, 1, -1 do |
| 445 used[i]:Hide() | 474 print(' -', 'i='.. i, 'watchIndex='..used[i].info.watchIndex) |
| 446 used[i]:ClearAllPoints() | 475 if used[i].info.watchIndex > numBlocks then |
| 447 free[#free+1]= used[blockIndex] | 476 print(' clean up dead quest block') |
| 448 used[i] = nil | 477 local released = tremove(used, i) |
| 478 released:Hide() | |
| 479 released:ClearAllPoints() | |
| 480 tinsert(free, used[blockIndex]) | |
| 481 end | |
| 449 end | 482 end |
| 450 end | 483 end |
| 451 | 484 |
| 452 | 485 |
| 453 if handler.currentBlock >= 1 then | 486 if handler.currentBlock >= 1 then |
| 467 tracker.wasEmpty = true | 500 tracker.wasEmpty = true |
| 468 end | 501 end |
| 469 | 502 |
| 470 return tracker.numWatched, tracker.numAll | 503 return tracker.numWatched, tracker.numAll |
| 471 end | 504 end |
| 505 | |
| 472 | 506 |
| 473 --- Updates the selected block frame to display the given info batch | 507 --- Updates the selected block frame to display the given info batch |
| 474 -- If `previousBlock` is set, it will attempt to anchor to that | 508 -- If `previousBlock` is set, it will attempt to anchor to that |
| 475 -- @param blockNum the ordered block to be updated, not a watchIndex value | 509 -- @param blockNum the ordered block to be updated, not a watchIndex value |
| 476 -- @param info the reference returned by the GetXInfo functions | 510 -- @param info the reference returned by the GetXInfo functions |
| 477 -- REMEMBER: t.info and questData[questID] are the same table | 511 -- REMEMBER: t.info and questData[questID] are the same table |
| 478 Default.UpdateBlock = function (handler, blockIndex, id, added) | 512 Default.UpdateBlock = function (handler, blockIndex, id, added) |
| 479 local print = bprint | 513 local print = bprint |
| 480 print(' Updating |cFF00FF00'..handler.displayName..'|r|cFF00FFFF'..blockIndex..'|r') | |
| 481 if not blockIndex then | 514 if not blockIndex then |
| 482 return | 515 return |
| 483 end | 516 end |
| 484 local info = handler:GetInfo(blockIndex) -- should match up with whatever the internal watch list has | 517 local info = handler:GetInfo(blockIndex) -- should match up with whatever the internal watch list has |
| 485 if not info then | 518 if not info then |
| 486 return | 519 return |
| 487 end | 520 end |
| 521 print(' Updating |cFF00FF00'..handler.displayName..'|r|cFF00FFFF'..blockIndex..'|r|cFF0099FF', info.id ,'|r') | |
| 488 local frame = handler.frame | 522 local frame = handler.frame |
| 489 local block = handler:GetBlock(blockIndex) | 523 local block = handler:GetBlock(info.id) |
| 490 | 524 |
| 491 block.questID = info.questID | 525 if added then |
| 492 if id == info.questID then | 526 -- do something if the block is being assigned a new thing |
| 493 --block.questFadeIn:Play() | |
| 494 end | 527 end |
| 495 | 528 |
| 496 block.handler = handler | 529 block.handler = handler |
| 497 block.info = info | 530 block.info = info |
| 498 block.mainStyle = info.mainStyle or 'Normal' | |
| 499 block.subStyle = info.subStyle | |
| 500 | 531 |
| 501 info.blockIndex = blockIndex | 532 info.blockIndex = blockIndex |
| 502 if info.questID then handler.QuestBlock[info.questID] = block end | 533 if info.questID then handler.QuestBlock[info.questID] = block end |
| 503 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end | 534 if info.logIndex then handler.LogBlock[info.logIndex] = block end |
| 504 if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end | 535 if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end |
| 505 handler.BlockInfo[blockIndex] = info | 536 handler.BlockInfo[blockIndex] = info |
| 506 handler:UpdateObjectives(block) | 537 local newSchema = handler:UpdateObjectives(block) |
| 538 if newSchema and newSchema ~= blockSchema then | |
| 539 Module.UpdateSchema('block', newSchema) | |
| 540 end | |
| 507 | 541 |
| 508 block.title:SetText(info.title) | 542 block.title:SetText(info.title) |
| 509 local titleHeight = floor(block.title:GetHeight()+.5) | 543 local titleHeight = floor(block.title:GetHeight()+.5) |
| 510 local titlebgHeight = titleHeight + titleSpacing*2 | 544 local titlebgHeight = titleHeight + titleSpacing*2 |
| 511 block.titlebg:SetHeight(titlebgHeight) | 545 block.titlebg:SetHeight(titlebgHeight) |
| 514 local statusbgHeight = statusHeight + textSpacing*2 | 548 local statusbgHeight = statusHeight + textSpacing*2 |
| 515 local attachmentHeight =floor(block.attachmentHeight + .5) | 549 local attachmentHeight =floor(block.attachmentHeight + .5) |
| 516 | 550 |
| 517 print(' |cFF0088FFanchor to', handler.currentAnchor:GetName()) | 551 print(' |cFF0088FFanchor to', handler.currentAnchor:GetName()) |
| 518 print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')') | 552 print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')') |
| 519 --block.titlebg:SetHeight(block.title:GetHeight() + Module.Conf.Wrapper.TitleSpacing) | 553 if attachmentHeight > 0 then |
| 554 attachmentHeight = attachmentHeight + textSpacing | |
| 555 end | |
| 556 | |
| 520 block.height = titlebgHeight + attachmentHeight | 557 block.height = titlebgHeight + attachmentHeight |
| 521 | 558 |
| 522 if statusHeight > 1 then | |
| 523 block.height = block.height + statusbgHeight | |
| 524 print(' status:', statusbgHeight, '('.. statusHeight..')') | |
| 525 else | |
| 526 print(' |cFFFF0088 skipped') | |
| 527 end | |
| 528 block:SetHeight(block.height) | 559 block:SetHeight(block.height) |
| 529 | 560 |
| 530 print(' |cFFFFFF00height|r:', block.height) | 561 print(' |cFFFFFF00height|r:', block.height) |
| 531 print(' |cFF00FFFF)|r -> ', block, block:GetHeight()) | 562 print(' |cFF00FFFF)|r -> ', block, block:GetHeight()) |
| 532 | 563 |
| 576 if info.tagInfo then | 607 if info.tagInfo then |
| 577 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) | 608 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) |
| 578 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) | 609 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) |
| 579 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) | 610 tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) |
| 580 end | 611 end |
| 612 | |
| 613 if info.statusKey and (Devian and Devian.InWorkspace()) then | |
| 614 block.debugText:SetText(info.statusKey) | |
| 615 block.debugText:Show() | |
| 616 end | |
| 581 return block | 617 return block |
| 582 end | 618 end |
| 583 | 619 |
| 584 | 620 |
| 585 | 621 |
| 586 | 622 |
| 587 --- Does the main iterations for populating block content. | 623 --- Does the main iterations for populating block content. |
| 588 -- Hooked by corresponding handler functions where additional details need to be sorted. | 624 -- Hooked by corresponding handler functions where additional details need to be sorted. |
| 589 Default.UpdateObjectives = function(handler, block) | 625 Default.UpdateObjectives = function(handler, block, block_schema) |
| 590 local print = lprint | 626 local print = lprint |
| 591 local info = block.info | 627 local info = block.info |
| 592 print('|cFF00FF00default.objectives', block:GetName()) | 628 print('|cFF00FF00default.objectives', block:GetName()) |
| 593 -- reset the starting positions | 629 -- reset the starting positions |
| 594 block.endPoint = block.titlebg | 630 block.endPoint = block.titlebg |
| 616 for i, data in ipairs(info.objectives) do | 652 for i, data in ipairs(info.objectives) do |
| 617 local line = handler:GetLine(block) | 653 local line = handler:GetLine(block) |
| 618 displayObjectiveHeader = true | 654 displayObjectiveHeader = true |
| 619 line.height = 0 | 655 line.height = 0 |
| 620 text, attachment, template = handler:UpdateLine(block, line, data) | 656 text, attachment, template = handler:UpdateLine(block, line, data) |
| 621 print(' |cFF88FF00#', i, data.type, text) | 657 print(' |cFF88FF00#', i, data.type, text, attachment) |
| 622 handler:AddLine(block, text, attachment, template) | 658 handler:AddLine(block, text, attachment, template) |
| 623 | 659 |
| 624 end | 660 end |
| 625 end | 661 end |
| 626 end | 662 end |
| 627 | 663 |
| 628 if info.statusKey and (Devian and Devian.InWorkspace()) then | 664 |
| 629 handler:AddLine(block, info.statusKey, nil) | 665 if block.currentLine < block.numLines then |
| 630 end | 666 print(' - cull', block.currentLine, block.numLines) |
| 631 | 667 for i = block.currentLine + 1, block.numLines do |
| 632 for i = block.currentLine + 1, block.numLines do | 668 print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) |
| 633 print(i, block.numLines) | 669 block.lines[i]:ClearAllPoints() |
| 634 print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) | 670 block.lines[i]:Hide() |
| 635 block.lines[i]:ClearAllPoints() | 671 end |
| 636 block.lines[i]:Hide() | |
| 637 end | 672 end |
| 638 | 673 |
| 639 if block.currentLine > 0 then | 674 if block.currentLine > 0 then |
| 640 block.attachmentHeight = block.attachmentHeight + textSpacing | 675 block.attachmentHeight = block.attachmentHeight + textSpacing |
| 641 print(' |cFF00FF00attachment:', block.attachmentHeight) | 676 print(' |cFF00FF00attachment:', block.attachmentHeight) |
| 642 end | 677 end |
| 678 return block_schema | |
| 643 end | 679 end |
| 644 | 680 |
| 645 | 681 |
| 646 --- Module-specific display variables | 682 --- Module-specific display variables |
| 647 -- * height - height of whatever display widget is involved in conveying the task | 683 -- * height - height of whatever display widget is involved in conveying the task |
| 679 | 715 |
| 680 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName()) | 716 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName()) |
| 681 local block = Module.Quest.QuestBlock[questID] | 717 local block = Module.Quest.QuestBlock[questID] |
| 682 if block then | 718 if block then |
| 683 -- Dispatch the probe | 719 -- Dispatch the probe |
| 684 if IsQuestWatched(info.questLogIndex) then | 720 if IsQuestWatched(info.logIndex) then |
| 685 itemButton.previousItem = previousItem | 721 itemButton.previousItem = previousItem |
| 686 print(' |cFFFFFF00probing', block:GetName()) | 722 print(' |cFFFFFF00probing', block:GetName()) |
| 687 block:SetScript('OnUpdate', function() | 723 block:SetScript('OnUpdate', function() |
| 688 if block:GetBottom() and not InCombatLockdown() then | 724 if block:GetBottom() and not InCombatLockdown() then |
| 689 print(' '..block:GetName()..' |cFF00FF00probe hit!') | 725 print(' '..block:GetName()..' |cFF00FF00probe hit!') |
| 765 | 801 |
| 766 Module.UpdateItemButtonCooldown = function(button) | 802 Module.UpdateItemButtonCooldown = function(button) |
| 767 | 803 |
| 768 end | 804 end |
| 769 | 805 |
| 806 | |
| 770 Default.Select = function(handler, block) | 807 Default.Select = function(handler, block) |
| 771 Module:Update(handler.watchReasonModule) | 808 Module:Update(handler.watchReasonModule) |
| 772 end | 809 end |
| 773 Default.Open = function(handler, block) | 810 Default.Open = function(handler, block) |
| 774 Module:Update(handler.watchReasonModule) | 811 Module:Update(handler.watchReasonModule) |
