Mercurial > wow > buffalo2
changeset 44:756e8aeb040b
- Default.lua
- simplified the response to SuperTrackedQuestID changes
- tag icons work again
author | Nenue |
---|---|
date | Mon, 25 Apr 2016 19:37:13 -0400 |
parents | 9480bd904f4c |
children | dd1ae565f559 |
files | Init.lua ObjectiveTracker/APIHooks.lua ObjectiveTracker/Block.lua ObjectiveTracker/Default.lua ObjectiveTracker/Events.lua ObjectiveTracker/Layout.lua ObjectiveTracker/ObjectiveTracker.lua ObjectiveTracker/ObjectiveTracker.xml ObjectiveTracker/QuestData.lua ObjectiveTracker/Schema.lua ObjectiveTracker/Update.lua |
diffstat | 11 files changed, 508 insertions(+), 537 deletions(-) [+] |
line wrap: on
line diff
--- a/Init.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/Init.lua Mon Apr 25 19:37:13 2016 -0400 @@ -410,20 +410,20 @@ end end - print(B.Conf.ConfigMode) + --print(B.Conf.ConfigMode) display.anchor:EnableMouse(B.Conf.ConfigMode) end for id, region in pairs(layers) do - print(id, region:GetName(), func) + --print(id, region:GetName(), func) region[func](region) end - print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames') + --print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames') end local XMLFrame_Enable = function(self, value) local name = self:GetName() - + local print = B.print('XML') if not B.Conf[name] then B.Conf[name] = { @@ -471,8 +471,9 @@ end end --- Generic handlers for keeping track of XML-defined frames - +local print = B.print('XML') local XMLFrame_OnDragStart = function(self) + local print = B.print('XML') self.xA = self:GetLeft() self.yA = self:GetBottom() self.anchorTo, self.relativeTo, self.relativePoint, self.x, self.y = self:GetPoint(1) @@ -482,6 +483,7 @@ end local XMLFrame_OnDragStop = function(self) + local print = B.print('XML') local name = self:GetName() print(name, 'stop moving ('..self:GetLeft()..', '..self:GetBottom()..')') local xB = self:GetLeft() - self.xA @@ -494,13 +496,15 @@ end B.RegisterModuleFrame = function(self, moduleName) + local print = B.print('XML') tinsert(checkForConfig, self) self.Enable = XMLFrame_Enable self.moduleName = moduleName - print('|cFF00FF00XML stuff related to '.. tostring(moduleName) .. ':', name) + print('|cFF00FF00XML stuff related to '.. tostring(moduleName) .. ':', self:GetName()) end B.UpdateXMLFrame = function(self) + local print = B.print('XML') local name = self:GetName() @@ -510,6 +514,7 @@ self:SetScript('OnDragStart', XMLFrame_OnDragStart) if self.OnDragStop then self:SetScript('OnDragStop', function(self, ...) + print('|cFFFF0088end of dragging') self:OnDragStop(self, ...) XMLFrame_OnDragStop(self, ...) end)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ObjectiveTracker/APIHooks.lua Mon Apr 25 19:37:13 2016 -0400 @@ -0,0 +1,65 @@ +--- ${PACKAGE_NAME} +-- @file-author@ +-- @project-revision@ @project-hash@ +-- @file-revision@ @file-hash@ +-- Created: 3/30/2016 1:23 AM +local B = select(2,...).frame +local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') +local print = B.print('Objectives') +local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST +local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP +local GetQuestID = GetQuestID +local QuestPOIUpdateIcons = QuestPOIUpdateIcons + +--- Module updates triggered by user events + +T.AddQuestWatch = function(questID) + return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST +end +T.AbandonQuest = function() + QuestPOIUpdateIcons() + return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST +end +T.CompleteQuest = function() + QuestPOIUpdateIcons() + return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST +end +T.AddAutoQuestPopUp = function(...) + return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP +end +T.RemoveAutoQuestPopUp = function(questID) + return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP +end +--- SUPER_TRACKED_QUEST_CHANGED will fires +local tprint = B.print('Tracker') +T.SetSuperTrackedQuestID = function(questID) + tprint('SetSuperTrackedQuestID', questID) + for index, block in ipairs(T.Quest.usedBlocks) do + if block:IsVisible() then + if block.info.id == questID then + block.SelectionOverlay:Show() + else + block.SelectionOverlay:Hide() + end + end + end + T.SuperTrackedQuestID = questID +end + + +local previousSelection +--@debug@ +local tprint = B.print('Tracker') -- @debug@ +T.SelectQuestLogEntry = function(logIndex) + --@debug@ + if previousSelection and previousSelection ~= logIndex then + print('swapping selection from', previousSelection, 'to', logIndex) + end--@end-debug@ + previousSelection = logIndex +end + +--- Dummies for future ideas +T.RemoveQuestWatch = function(questIndex, ...) end +T.AddTrackedAchievement = function(cheevID) end +T.RemoveTrackedAchievement = function(cheevID) end +T.AcceptQuest = function() end \ No newline at end of file
--- a/ObjectiveTracker/Block.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/Block.lua Mon Apr 25 19:37:13 2016 -0400 @@ -99,8 +99,8 @@ local used = self.usedBlocks local free = self.freeBlocks - if block then - print(block.info.id, index) + if block and block.isAnimating then + return block end -- if the frame entry is still good, sort heaps @@ -140,15 +140,16 @@ block.posIndex = tMove(free, used, block) print(' |cFF00FF00('..source..')|r |cFF0088FF'..self.name..'|r.|cFF00FFBBusedBlocks['..block.posIndex..'] =|r', block:GetName()) end - block.blockFadeOut:SetScript('OnFinished', blockFadeOut_OnFinished) - block:SetScript('OnHide', function(self) - fprint(self:GetName(), '|cFF00FF00HIDE|r', debugstack(1,3,1)) - if(self.DebugTab:IsShown()) then - self.DebugTab:Hide() - end - self.blockFadeOut:SetScript('OnFinished', blockFadeOut_OnFinished) - self.isAnimating = nil - end) + + block.blockFadeOut:SetScript('OnFinished', blockFadeOut_OnFinished) + block:SetScript('OnHide', function(self) + fprint(self:GetName(), '|cFF00FF00HIDE|r', debugstack(1,3,1)) + if(self.DebugTab:IsShown()) then + self.DebugTab:Hide() + end + self.blockFadeOut:SetScript('OnFinished', blockFadeOut_OnFinished) + self.isAnimating = nil + end) print(' used/free: |cFFFFFF00' .. #self.usedBlocks .. '|r/|cFF00FFFF'..#self.freeBlocks ..'|r') return block end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ObjectiveTracker/Default.lua Mon Apr 25 19:37:13 2016 -0400 @@ -0,0 +1,287 @@ +--- ${PACKAGE_NAME} +-- @file-author@ +-- @project-revision@ @project-hash@ +-- @file-revision@ @file-hash@ +-- Created: 4/17/2016 7:33 AM +--- These are the first layer of methods invoked by event handlers + +local B = select(2,...).frame +local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') +local Devian = Devian +local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band +local IsResting, UnitXP, UnitXPMax, GetXPExhaustion, tinsert, tremove = IsResting, UnitXP, UnitXPMax, GetXPExhaustion, table.insert, table.remove +local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent +local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText +local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent +local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs +local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame +local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow +local print = B.print('Tracker') +local oprint = B.print('Objectives') +local bprint = B.print('Block') +local tprint = B.print('Tracker') +local lprint = B.print('Line') +local unitLevel = 1 +local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON +local debug = false + +--- FRAMES +local Wrapper = _G.VeneerObjectiveWrapper +local Scroller = Wrapper.scrollArea +local Scroll = _G.VeneerObjectiveScroll +local orderedHandlers = T.orderedHandlers +local orderedNames = T.orderedNames + + +--- Placing the Update functions here since they shouldn't be messing with schema stuff +local currentPosition, anchorFrame, anchorPoint +--- Positioning and stuff +local tick = 0 +local initReason = OBJECTIVE_TRACKER_UPDATE_ALL +local requiresInit +function T:Update (reason, ...) + if not B.Conf.VeneerObjectiveWrapper.enabled then + return + end + tick = tick + 1 + local print = tprint + local hasStuff = false + local insertingStuff = false + + if initReason then + reason = initReason + initReason = nil + elseif not reason then + reason = OBJECTIVE_TRACKER_UPDATE_ALL + end + print(format('|cFFBB0066Update:|r |cFFFF%04X%d|r ', tick, lshift(reason, 4)), reason, ...) + currentPosition = 0 + + for id, handler in pairs(T.orderedHandlers) do + local frame = handler.frame + + print('') + if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then + insertingStuff = handler:UpdateTracker(reason, ...) + else + print(' |cFFFF4400Update:|r skipping',handler.name) + end + + if handler.numWatched >= 1 then + hasStuff = true + currentPosition = currentPosition + 1 + Default.AddTracker(handler, frame, currentPosition) + frame.wasEmpty = nil + else + frame.destinationOffset = 0 + if not frame.wasEmpty and not frame.fadeOut:IsPlaying() then + frame.fadeOut:Play() + end + frame.wasEmpty = true + end + end + + -- do these whenever there is content or content is being added + if hasStuff or insertingStuff then + T:FinishWrapper() + end + Quest.GetClosest() + T.UpdateActionButtons(reason) +end + +Default.UpdateTracker = function (handler, reason, id, isNew) + local print = handler.print + local frame = handler.frame + local blockIndex = 0 + print('MODULE:'..handler.name, 'message:', reason, 'id:', id, (isNew and '|cFF88FF88' or '|cFF555555')..'isNew|r') + handler.updateReason = reason + local numWatched, numAll, watchTable = handler:GetNumWatched(id, isNew) + + if numWatched >= 1 then + if watchTable then + print(' WatchList', ' n ID Obj wID Log Blk') + for i, w in ipairs(watchTable) do + print(' WatchList', format('%2d => %6d %3d %3d %3s %s', i, w.id, w.numObjectives, w.watchIndex, (w.logIndex or ''), (handler.InfoBlock[w.id] and handler.InfoBlock[w.id]:GetName() or ''))) + end + end + end + + handler.numWatched = numWatched + handler.numAll = numAll + handler.numBlocks = 0 + handler.currentBlock = 0 + handler.currentAnchor = frame.titlebg + for blockIndex = 1, numWatched do + local currentBlock = handler:UpdateBlock(blockIndex, id, isNew) + if currentBlock then + handler:AddBlock(currentBlock) + else + print(' |cFF'..handler.internalColor..'finished|r @', blockIndex) + break -- done with quest stuff + end + end + + local numBlocks = handler.numBlocks + local used = handler.usedBlocks + local free = handler.freeBlocks + print(format('#### %s ## |cFFFF8800%04X|r --- blocks |cFFFF8800%d|r, (used/free: |cFFFF8800%d|r/|cFFFF8800%d|r)', handler.name, band(reason, handler.updateReasonModule + handler.updateReasonEvents, reason), numBlocks, #used, #free)) + + return numWatched, numAll +end + +Default.UpdateBlock = function (handler, index) + --@debug@ + local print = bprint -- @end-debug@ + if not index then + return + end + local info = handler.WatchList[index] -- should match up with whatever the internal watch list has + if not info then + return + end + local frame = handler.frame + local block = handler:GetBlock(info.id) + + --@debug@ + handler.print('UpdateBlock', '|cFF00FFFF'..index..'|r|cFF0099FF', info.id ,'|r', (block.isAnimating and 'animating' or 'static'))--@end-debug@ + if block.isAnimating then + -- Nothing to do, leave it as is + return block + end + + block.handler = handler + block.info = info + info.blockIndex = index + --@debug@ + local keyInfo--@end-debug@ + if info.id then + handler.InfoBlock[info.id] = block + --@debug@ + keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'InfoBlock[' .. info.id .. '] = *' .. block:GetName():gsub('%D', '') --@end-debug@ + end + if info.logIndex then + handler.LogBlock[info.logIndex] = block + --@debug@ + keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'LogBlock[' .. info.logIndex .. '] = ' .. block:GetName():gsub('%D', '')--@end-debug@ + end + if info.watchIndex then + handler.WatchBlock[info.watchIndex] = block + --@debug@ + keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'WatchBlock[' .. info.watchIndex .. '] = ' .. block:GetName():gsub('%D', '')--@end-debug@ + end + --@debug@ + if keyInfo then print(' assigned', keyInfo) end--@end-debug@ + handler.BlockInfo[index] = info + block.endPoint = block.titlebg + block.attachmentHeight = 0 + block.currentLine = 0 + local attachments, override_schema = handler:UpdateObjectives(block, block.schema) + + + block.title:SetText(info.title) + + if info.specialItem and not info.itemButton then + --@debug@ + print(' - |cFF00FFFFgenerating item button for info set')--@end-debug@ + info.itemButton = T.SetItemButton(block, info) + end + + + if info.selected then + block.SelectionOverlay:Show() + else + block.SelectionOverlay:Hide() + end + + if info.tagInfo then + handler:AddTags(block, info.tagInfo, info.tagCoords) + end + + if override_schema then + block.schema = override_schema + elseif info.schema then + block.schema = info.schema + end + return block +end + +Default.UpdateObjectives = function(handler, block, block_schema, displayObjectives) + local print = lprint + displayObjectives = displayObjectives or true + block_schema = block_schema or block.schema + local info = block.info + print(' |cFF00FF00default.objectives', block:GetName()) + -- reset the starting positions + local text, attachment, template + local numAttachments = 0 + + if info.objectives and displayObjectives then + for i, data in ipairs(info.objectives) do + text, attachment, template = handler:UpdateLine(block, data) + if text or attachment then + local line = handler:GetLine(block) + line.height = 0 + print(' |cFF88FF00#', i, data.type, text, attachment) + handler:AddLine(block, text, attachment, template) + end + if attachment then + numAttachments = numAttachments + 1 + end + end + end + + if block.currentLine < block.numLines then + print(' - cull', block.currentLine, block.numLines) + for i = block.currentLine + 1, block.numLines do + print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) + block.lines[i]:ClearAllPoints() + block.lines[i]:Hide() + end + end + + if block.currentLine > 0 then + block.attachmentHeight = block.attachmentHeight + print(' |cFF00FF00attachment:', block.attachmentHeight) + end + return numAttachments, block_schema +end + +Default.UpdateLine = function(handler, block, data) + return block.info.description, nil, 'default' +end + +Default.Select = function(handler, block) + T:Update() +end +Default.Open = function(handler, block) + T:Update(handler.updateReasonModule) +end +Default.Remove = function(handler, block) + T:Update(handler.updateReasonModule) +end +Default.Report = function(handler, block) + print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') +end + +function Default:OnMouseUp (button) + print(self.handler.name, button, IsModifiedClick('CHATLINK'), IsModifiedClick("QUESTWATCHTOGGLE")) + if button == 'LeftButton' then + if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then + self.Link(self.handler, self) + elseif IsModifiedClick("QUESTWATCHTOGGLE") then + self.Remove(self.handler, self) + else + self.Select(self.handler, self) + end + elseif button == 'RightButton' then + self.Open(self.handler, self) + end + self.initialButton = nil + self.modChatLink = nil + self.modQuestWatch = nil + --T:Update(self.handler.updateReasonModule) + print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') +end +function Default:OnMouseDown (button) + --print(self.info.title) +end
--- a/ObjectiveTracker/Events.lua Mon Apr 25 13:51:58 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ ---- ${PACKAGE_NAME} --- @file-author@ --- @project-revision@ @project-hash@ --- @file-revision@ @file-hash@ --- Created: 3/30/2016 1:23 AM -local B = select(2,...).frame -local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') -local print = B.print('Objectives') - -local _G = _G -local OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT -local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST_ADDED -local OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -local OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP = OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -local GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID = GetQuestID, GetQuestLogIndexByID, AddQuestWatch, SetSuperTrackedQuestID -local QuestPOIUpdateIcons = QuestPOIUpdateIcons -------------------------------------------------------------------- ---- Deal with blizzard API calls that affect the tracker/log contents ---- mainly just hiding blocks until they can be picked up by the next update event -------------------------------------------------------------------- -T.AddQuestWatch = function(questID) - if not B.Conf.VeneerObjectiveWrapper.enabled then return end - return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -end - -local Quest = T.Quest -T.RemoveQuestWatch = function(questIndex, ...) - print('|cFFFF8800RemoveQuestWatch', questIndex, ...) - - --return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -end - -T.AddTrackedAchievement = function(cheevID) - --return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT -end - - -T.RemoveTrackedAchievement = function(cheevID) - --return OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT -end - -T.AcceptQuest = function() -end - -T.AbandonQuest = function() - QuestPOIUpdateIcons() - return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -end -T.CompleteQuest = function() - local questID = GetQuestID() - - QuestPOIUpdateIcons() - return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST -end -T.AddAutoQuestPopUp = function(...) - return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP -end -T.RemoveAutoQuestPopUp = function(questID) - return OBJECTIVE_TRACKER_UPDATE_MODULE_AUTO_QUEST_POPUP - -end - - - -T.SetSuperTrackedQuestID = function(questID) - --T:Update() -end - -local previousSelection -local tprint = B.print('Tracker') -T.SelectQuestLogEntry = function(logIndex) - if previousSelection and previousSelection ~= logIndex then - print('swapping selection from', previousSelection, 'to', logIndex) - end - previousSelection = logIndex -end \ No newline at end of file
--- a/ObjectiveTracker/Layout.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/Layout.lua Mon Apr 25 19:37:13 2016 -0400 @@ -240,63 +240,60 @@ local info = block.info block.index = blockIndex - -- if animating, skip this segment - if not block.isAnimating then - print('blockschema', blockSchema, block.schema) - if blockSchema ~= block.schema then - T.UpdateSchema('block', block.schema) - print(' ### activating block schema:|cFF0088FF', block.schema) - end - - block:SetWidth(T.Conf.Wrapper.Width) - block.title:SetSpacing(titleSpacing) - block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) - block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) - block.title:SetTextColor(unpack(titleColor)) - block.titlebg:SetTexture(1,1,1,1) - block.titlebg:SetGradientAlpha(unpack(titlebg)) - block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) - block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) - block.status:SetSpacing(textSpacing) - block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) - block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) - block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) - block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) - block.statusbg:SetTexture(1,1,1,1) - block.statusbg:SetGradientAlpha(unpack(textbg)) - block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) - block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) - block.SelectionOverlay:SetPoint('BOTTOMRIGHT') - - local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 - for i, tile in ipairs(block.rewardTile) do - --print(rewardSize) - tile:SetSize(rewardSize, rewardSize) - tile:ClearAllPoints() - tile:SetPoint(anchor, target, point, x, y) - block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) - anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 - end - - - local titleHeight = floor(block.title:GetHeight()+.5) - local titlebgHeight = titleHeight + titleSpacing*2 - block.titlebg:SetHeight(titlebgHeight) - - local statusHeight = floor(block.status:GetHeight()+.5) - local statusbgHeight = statusHeight + textSpacing*2 - local attachmentHeight =floor(block.attachmentHeight + .5) - - self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName()) - self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')') - if attachmentHeight > 0 then - attachmentHeight = attachmentHeight + textSpacing - end - - block.height = titlebgHeight + attachmentHeight - block:SetHeight(block.height) + print('blockschema', blockSchema, block.schema) + if blockSchema ~= block.schema then + T.UpdateSchema('block', block.schema) + print(' ### activating block schema:|cFF0088FF', block.schema) end + block:SetWidth(T.Conf.Wrapper.Width) + block.title:SetSpacing(titleSpacing) + block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) + block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) + block.title:SetTextColor(unpack(titleColor)) + block.titlebg:SetTexture(1,1,1,1) + block.titlebg:SetGradientAlpha(unpack(titlebg)) + block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) + block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) + block.status:SetSpacing(textSpacing) + block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) + block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) + block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) + block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) + block.statusbg:SetTexture(1,1,1,1) + block.statusbg:SetGradientAlpha(unpack(textbg)) + block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) + block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) + block.SelectionOverlay:SetPoint('BOTTOMRIGHT') + + + local titleHeight = floor(block.title:GetHeight()+.5) + local titlebgHeight = titleHeight + titleSpacing*2 + block.titlebg:SetHeight(titlebgHeight) + + local statusHeight = floor(block.status:GetHeight()+.5) + local statusbgHeight = statusHeight + textSpacing*2 + local attachmentHeight =floor(block.attachmentHeight + .5) + + if attachmentHeight > 0 then + attachmentHeight = attachmentHeight + textSpacing + end + + block.height = titlebgHeight + attachmentHeight + block:SetHeight(block.height) + + local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 + for i, tile in ipairs(block.rewardTile) do + --print(rewardSize) + tile:SetSize(rewardSize, rewardSize) + tile:ClearAllPoints() + tile:SetPoint(anchor, target, point, x, y) + block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) + anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 + end + + self.print('AddBlock', 'anchor to|cFF0088FF', self.currentAnchor:GetName()) + self.print('AddBlock', 'attachment:|cFF00FF00', attachmentHeight, '|rtitle:|cFF00FF00', titlebgHeight, '|r('.. titleHeight..')') if block.debug then local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide' for _, region in ipairs(block.debug) do @@ -329,26 +326,30 @@ if Devian and Devian.InWorkspace() then block.DebugTab:SetParent(UIParent) - block.DebugTab:SetPoint('TOPRIGHT', block, 'TOPLEFT', 0, 0) + block.DebugTab:SetPoint('RIGHT', block.titlebg, 'LEFT', 0, 0) block.DebugTab.status:SetText(tostring(block.schema) .. ' @|cFF00FF00' .. tostring(block.posIndex) .. '|r #|cFFFFFF00'.. tostring(info.logIndex or info.id) .. '|r'.. - ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r') + ' H|cFFFFFF00' .. tostring(block.height) .. ' L|cFF00FFFF' .. tostring(block.numLines) ..'|r ' .. (info.statusKey or '')) block.DebugTab:Show() end end + +local tagOrder = {'completion', 'frequency', 'type'} --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) -Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) +Default.AddTags = function (handler, block, tagInfo, tagCoords) local print = bprint - for order, tagName in ipairs(block.info.tagInfo) do - local tag = block[tagName] - if block.tagCoords[tagName] and tag then - tag:SetTexCoord(unpack(block.tagCoords[tagName])) + local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT' + handler.print('AddTag', block:GetName(), tagInfo, tagCoords) + for order, key in ipairs(tagOrder) do + local tag = block[key .. 'Tag'] + if tag and tagInfo[key] then + tag:SetTexCoord(unpack(tagInfo[key])) tag:Show() tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' else - block[tagName]:Hide() + block[key .. 'Tag']:Hide() end end
--- a/ObjectiveTracker/ObjectiveTracker.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.lua Mon Apr 25 19:37:13 2016 -0400 @@ -18,24 +18,24 @@ local unitLevel = UnitLevel('player') --- Performance values ---[[ - self:RegisterEvent("QUEST_LOG_UPDATE"); - self:RegisterEvent("TRACKED_ACHIEVEMENT_LIST_CHANGED"); - self:RegisterEvent("QUEST_WATCH_LIST_CHANGED"); - self:RegisterEvent("QUEST_AUTOCOMPLETE"); - self:RegisterEvent("QUEST_ACCEPTED"); - self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED"); - self:RegisterEvent("SCENARIO_UPDATE"); - self:RegisterEvent("SCENARIO_CRITERIA_UPDATE"); - self:RegisterEvent("TRACKED_ACHIEVEMENT_UPDATE"); - self:RegisterEvent("ZONE_CHANGED_NEW_AREA"); - self:RegisterEvent("ZONE_CHANGED"); - self:RegisterEvent("QUEST_POI_UPDATE"); - self:RegisterEvent("VARIABLES_LOADED"); - self:RegisterEvent("QUEST_TURNED_IN"); - self:RegisterEvent("PLAYER_MONEY"); - ]] +--- Done once per ui load +local BlizzHooks = { + 'AcceptQuest', + 'AddQuestWatch', + 'RemoveQuestWatch', + 'AbandonQuest', + 'AcknowledgeAutoAcceptQuest', + 'AddAutoQuestPopUp', + 'RemoveAutoQuestPopUp', + 'AddTrackedAchievement', + 'RemoveTrackedAchievement', + 'SetSuperTrackedQuestID', + 'SelectQuestLogEntry', +} +local enabledOnly = { + ['AddQuestWatch'] = true, +} --- These are the bitfields used by Blizzard_ObjectiveTracker to determine which segments get parsed. --- They are replicated here so that plugins can make use of any securehook args involving this info. @@ -298,7 +298,7 @@ return OBJECTIVE_TRACKER_UPDATE_ALL end Event.SUPER_TRACKED_QUEST_CHANGED = function(questID) - return OBJECTIVE_TRACKER_UPDATE_QUEST, questID + --return OBJECTIVE_TRACKER_UPDATE_QUEST, questID end Event.ZONE_CHANGED = function() local inMicroDungeon = IsPlayerInMicroDungeon(); @@ -363,20 +363,6 @@ end T.Event = Event ---- Done once per ui load -local BlizzHooks = { - ['AcceptQuest'] = 'AcceptQuest', - ['AddQuestWatch'] = 'AddQuestWatch', - ['RemoveQuestWatch'] = 'RemoveQuestWatch', - ['AbandonQuest'] = 'AbandonQuest', - ['AcknowledgeAutoAcceptQuest'] = 'AcknowledgeAutoAcceptQuest', - ['AddAutoQuestPopUp'] = 'AddAutoQuestPopUp', - ['RemoveAutoQuestPopUp'] = 'RemoveAutoQuestPopUp', - ['AddTrackedAchievement'] = 'AddTrackedAchievement', - ['RemoveTrackedAchievement'] = 'RemoveTrackedAchievement', - ['SetSuperTrackedQuestID'] = 'SetSuperTrackedQuestID', - ['SelectQuestLogEntry'] = 'SelectQuestLogEntry', -} local VeneerData T.SetWatchMoney = function(watchMoney, reason) @@ -507,13 +493,13 @@ VeneerData.CallLog = VeneerData.CallLog or {} if not T.isHooked then T.isHooked = true - for blizzFunc, veneerFunc in pairs(BlizzHooks) do - if T[veneerFunc] then - hooksecurefunc(blizzFunc, function(...) return T.OnHookedFunc(blizzFunc, ...) end) + for _, func in ipairs(BlizzHooks) do + if T[func] then + hooksecurefunc(func, function(...) return T.OnHookedFunc(func, ...) end) else - hooksecurefunc(blizzFunc, function(...) - print('|cFFFF0088securehook('..tostring(blizzFunc)..')|r args:', ...) - tinsert(VeneerData.CallLog, {blizzFunc, ...}) + hooksecurefunc(func, function(...) + print('|cFFFF0088securehook('..tostring(func)..')|r args:', ...) + tinsert(VeneerData.CallLog, {func, ...}) end) end end
--- a/ObjectiveTracker/ObjectiveTracker.xml Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.xml Mon Apr 25 19:37:13 2016 -0400 @@ -41,14 +41,7 @@ </Animations> </Frame> - <Frame name="VeneerObjectiveWrapper" parent="UIParent" movable="true" enableMouse="true" frameStrata="LOW"> - <TitleRegion> - <Size x="300" y="30" /> - <Anchors> - <Anchor point="TOP" /> - <Anchor point="BOTTOM" relativePoint="TOP" x="0" y="-30" /> - </Anchors> - </TitleRegion> + <Frame name="VeneerObjectiveWrapper" parent="UIParent" movable="true" enableMouse="true" frameStrata="LOW" clampedToScreen="true"> <Scripts> <OnLoad> self.toggle = true @@ -468,7 +461,7 @@ <Anchor point="RIGHT" relativeKey="$parent" /> </Anchors> </FontString> - <FontString name="$parentStatus" parentKey="status" inherits="VeneerCriteriaFontNormal" justifyH="LEFT" justifyV="TOP" wordwrap="true"> + <FontString name="$parentStatus" parentKey="status" inherits="VeneerCriteriaFontNormal" justifyH="LEFT" justifyV="TOP" wordwrap="true" > <Anchors> <Anchor point="TOP" relativeKey="$parent.statusbg" /> <Anchor point="LEFT" relativeKey="$parent" /> @@ -576,7 +569,7 @@ <FontString name="$parentStatus" parentKey="status" inherits="VeneerNumberFont" justifyH="RIGHT" justifyV="TOP"> <Color r="1" g="1" b="1" a="1" /> <Anchors> - <Anchor point="TOPRIGHT" /> + <Anchor point="RIGHT" /> </Anchors> </FontString> </Layer> @@ -683,8 +676,8 @@ <Script file="Layout.lua" /> <Script file="Block.lua" /> <Script file="RewardFrame.lua" /> - <Script file="Update.lua" /> - <Script file="Events.lua" /> + <Script file="Default.lua" /> + <Script file="APIHooks.lua" /> <Script file="Widgets.lua" /> <!-- <Script file="ObjectiveStyle.lua" /> --> <!-- <Script file="ObjectiveInfo.lua" /> -->
--- a/ObjectiveTracker/QuestData.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/QuestData.lua Mon Apr 25 19:37:13 2016 -0400 @@ -54,20 +54,14 @@ end local completionText if info.isComplete then - if info.isAutoComplete then - local questID, popupType = GetAutoQuestPopUp(info.logIndex) - if popupType == 'COMPLETE' then - print(' :: auto-complete quest :: set the message') - self:AddLine(block, T.strings.CLICK_TO_COMPLETE, nil, 'complete') - end - else - if not completionText or info.completionText then - info.completionText = GetQuestLogCompletionText(info.logIndex) - end + if T.Conf.ShowCompletionText then + self:AddLine(block, info.completionText, nil, 'complete') end - self:AddLine(block, info.completionText, nil, 'complete') - displayObjectives = false + if not T.Conf.ShowObjectivesWhenComplete then + displayObjectives = false + end print('|cFF'..self.internalColor..' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') + block_schema = 'complete' end Default.UpdateObjectives(self, block, block_schema, displayObjectives) @@ -115,7 +109,6 @@ local numAll = GetNumQuestLogEntries() local numWatched = GetNumQuestWatches() local bottomIndex = 1 - print('GetNumWatched', self.name, numWatched, 'of', numAll) local start, limit = 1, numAll if id and not added then @@ -126,6 +119,7 @@ end numAnimating = 0 + local numEntries = 0 for logIndex = start, limit do local reason1, reason2 = '', '' local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) @@ -161,28 +155,34 @@ -- add to watch index if: the questID is non-zero if questID ~= 0 then - self.Info[questID] = self:GetInfo(logIndex, watchIndex) - print('GetQuests', format('request info |cFF00FF00%2d|r |cFFFFFF00%6d|r |cFFFF4400%3s|r', logIndex, questID, tostring(watchIndex or ''))) + self:GetInfo(logIndex, watchIndex) + print('GetQuests', format('request info |cFF00FF00%2d|r |cFFFFFF00%6d|r |cFFFF4400%3s|r |cFF00FFFF%3s|r', logIndex, questID, tostring(watchIndex or ''), numEntries)) end end + + --- After GetInfo pass, look for any non-conformant blocks and deal with them - for _, block in pairs(blocksChecked) do + for index, block in ipairs(self.usedBlocks) do + local logIndex = GetQuestLogIndexByID(block.info.questID, 'player') + print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r') -- animating blocks have been evaluated if not block.isAnimating then if not logIndex then self:ClearBlock(block) + print('GetNumWatched', 'trim dropped quest', block:GetName()) elseif not IsQuestWatched(block.info.logIndex) then self:ClearBlock(block) + print('GetNumWatched', 'trim untracked quest', block:GetName()) end end - blocksChecked[block] = nil end self.numWatched = numWatched self.numAll = numAll + print('GetNumWatched', 'RESULT', numWatched, 'of', numAll) return numWatched, numAll, self.WatchList end @@ -192,13 +192,15 @@ -- Manifest of line data to be displayed in relation to the tracked object Quest.GetInfo = function (self, logIndex, watchIndex) local print = iprint + print('') local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) if ( not questID ) then tprint('GetNumWatched', logIndex, watchIndex, '|cFFFF2299no data|r') - return + return 0 end Quest.Info[questID] = Quest.Info[questID] or {} + local numEntries = 0 local q = Quest.Info[questID] q.questID = questID q.id = questID @@ -208,22 +210,13 @@ local numObjectives, requiredMoney, isAutoComplete, failureTime, timeElapsed, questType = 0, 0, nil, false, false, 0 if watchIndex then + self.print('WatchIndex', watchIndex) local _ - _,_,_, numObjectives, requiredMoney, _, _, isAutoComplete, + _, _, _, numObjectives, requiredMoney, _, _, isAutoComplete, failureTime, timeElapsed, questType = GetQuestWatchInfo(watchIndex) - - -- ensure that the entry being populated isn't animating - if self.WatchBlock[watchIndex] then - local checkIndex = watchIndex - while self.WatchBlock[checkIndex + numAnimating] and self.WatchBlock[checkIndex + numAnimating].isAnimating do - print(self.WatchBlock[checkIndex + numAnimating]:GetName(), 'is in an animation sequence') - numAnimating = numAnimating + 1 - end - end - - self.WatchList[watchIndex + numAnimating] = q + self.WatchList[watchIndex] = q --tprint(' |cFF88FF00GetInfo:|r set watch entry', watchIndex) - print('GetInfo:', logIndex, watchIndex, '|cFFFF2299'..title..'|r') + self.print('WatchIndex', logIndex, watchIndex + numAnimating, '|cFFFF2299'..title..'|r') end self.LogInfo[logIndex] = q @@ -265,21 +258,22 @@ isBreadcrumb = true; end end - print('QuestFlags', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or '')) + print('QuestFlags', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or ''), numObjectives) -- completion message? local isSequenced = IsQuestSequenced(questID) local temp_status = '' if ( isComplete ) then temp_status = 'COMPLETED_OBJECTIVES' - objectives = Quest.GetObjectives(questLogIndex, numObjectives, true, isSequenced, isStory) + --objectives = Quest.GetObjectives(logIndex, numObjectives, true, isSequenced, isStory) + q.objectives = objectives if ( isAutoComplete ) then temp_status = 'AUTOCOMPLETE_OBJECTIVES' completionText = _G.QUEST_WATCH_CLICK_TO_COMPLETE else if ( isBreadcrumb ) then temp_status = 'COMPLETE_BREADCRUMB' - completionText = GetQuestLogCompletionText(questLogIndex) + completionText = GetQuestLogCompletionText(logIndex) else temp_status = 'COMPLETE_READY_FOR_TURN_IN' completionText = _G.QUEST_WATCH_QUEST_READY @@ -331,7 +325,6 @@ end end end - q.objectives = objectives q.moneyInfo = moneyInfo q.timerInfo = timerInfo q.completionText = completionText @@ -386,28 +379,24 @@ tagID = QUEST_TAG_ACCOUNT isAccount = true end - tagInfo['typeTag'] = tagID - tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] + tagInfo['type'] = QUEST_TAG_TCOORDS[tagID] elseif ( factionGroup) then tagID = "ALLIANCE" if ( factionGroup == LE_QUEST_FACTION_HORDE ) then tagID = "HORDE" end isFaction = true - tagInfo['typeTag'] = tagID - tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] + tagInfo['type'] = QUEST_TAG_TCOORDS[tagID] end if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then tagID = 'DAILY' - tagInfo['frequencyTag'] = tagID - tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] + tagInfo['frequency'] = QUEST_TAG_TCOORDS[tagID] isDaily = true schema = 'daily' elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then tagID = 'WEEKLY' - tagInfo['frequencyTag'] = tagID - tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] + tagInfo['frequency'] = QUEST_TAG_TCOORDS[tagID] isWeekly = true schema = 'weekly' elseif( questTagID ) then @@ -415,16 +404,13 @@ end if( isComplete ) then - tagInfo['completionTag'] = 'COMPLETED' + tagInfo['completion'] = QUEST_TAG_TCOORDS['COMPLETED'] elseif ( questFailed ) then - tagInfo['completionTag'] = 'FAILED' + tagInfo['completion'] = QUEST_TAG_TCOORDS['FAILED'] end - tagCoords['completionTag'] = QUEST_TAG_TCOORDS[tagInfo['completionTag']] q.tagInfo = tagInfo - q.tagCoords = tagCoords - -- establishes the primary block tag for view compacting - q.tagID = tagID + q.tagID = tagID -- defining primary tags for compact view q.tagName = tagName -- action button information @@ -492,7 +478,7 @@ end end - return q + return numEntries end Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory)
--- a/ObjectiveTracker/Schema.lua Mon Apr 25 13:51:58 2016 -0400 +++ b/ObjectiveTracker/Schema.lua Mon Apr 25 19:37:13 2016 -0400 @@ -73,6 +73,10 @@ textSpacing = 3, rewardSize = 24, }, + complete = { + titleColor = {.25,1,.25}, + titlebg = {'HORIZONTAL', .25, 1, .25, .125, 0, 1, .7, .25}, + }, achievement = { titleColor = {0, 0.7, 1, 1}, },
--- a/ObjectiveTracker/Update.lua Mon Apr 25 13:51:58 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,289 +0,0 @@ ---- ${PACKAGE_NAME} --- @file-author@ --- @project-revision@ @project-hash@ --- @file-revision@ @file-hash@ --- Created: 4/17/2016 7:33 AM ---- Baseline update work -local B = select(2,...).frame -local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') -local Devian = Devian -local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band -local IsResting, UnitXP, UnitXPMax, GetXPExhaustion, tinsert, tremove = IsResting, UnitXP, UnitXPMax, GetXPExhaustion, table.insert, table.remove -local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent -local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText -local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent -local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs -local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame -local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow -local print = B.print('Tracker') -local oprint = B.print('Objectives') -local bprint = B.print('Block') -local tprint = B.print('Tracker') -local lprint = B.print('Line') -local unitLevel = 1 -local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON -local debug = false - ---- FRAMES -local Wrapper = _G.VeneerObjectiveWrapper -local Scroller = Wrapper.scrollArea -local Scroll = _G.VeneerObjectiveScroll -local orderedHandlers = T.orderedHandlers -local orderedNames = T.orderedNames - - ---- Placing the Update functions here since they shouldn't be messing with schema stuff -local currentPosition, anchorFrame, anchorPoint ---- Positioning and stuff -local tick = 0 -local initReason = OBJECTIVE_TRACKER_UPDATE_ALL -local requiresInit -function T:Update (reason, ...) - if not B.Conf.VeneerObjectiveWrapper.enabled then - return - end - tick = tick + 1 - local print = tprint - local hasStuff = false - local insertingStuff = false - - if initReason then - reason = initReason - initReason = nil - elseif not reason then - reason = OBJECTIVE_TRACKER_UPDATE_ALL - end - print(format('|cFFBB0066Update:|r |cFFFF%04X%d|r ', tick, lshift(reason, 4)), reason, ...) - currentPosition = 0 - - for id, handler in pairs(T.orderedHandlers) do - local frame = handler.frame - - print('') - if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then - insertingStuff = handler:UpdateTracker(reason, ...) - else - print(' |cFFFF4400Update:|r skipping',handler.name) - end - - if handler.numWatched >= 1 then - hasStuff = true - currentPosition = currentPosition + 1 - Default.AddTracker(handler, frame, currentPosition) - frame.wasEmpty = nil - else - frame.destinationOffset = 0 - if not frame.wasEmpty and not frame.fadeOut:IsPlaying() then - frame.fadeOut:Play() - end - frame.wasEmpty = true - end - end - - -- do these whenever there is content or content is being added - if hasStuff or insertingStuff then - T:FinishWrapper() - end - Quest.GetClosest() - T.UpdateActionButtons(reason) -end - -Default.UpdateTracker = function (handler, reason, id, isNew) - local print = handler.print - local frame = handler.frame - local blockIndex = 0 - print('MODULE:'..handler.name, 'message:', reason, 'id:', id, (isNew and '|cFF88FF88' or '|cFF555555')..'isNew|r') - handler.updateReason = reason - local numWatched, numAll, watchTable = handler:GetNumWatched(id, isNew) - - if numWatched >= 1 then - if watchTable then - print(' WatchList', ' n ID Obj wID Log Blk') - for i, w in ipairs(watchTable) do - print(' WatchList', format('%2d => %6d %3d %3d %3s %s', i, w.id, w.numObjectives, w.watchIndex, (w.logIndex or ''), (handler.InfoBlock[w.id] and handler.InfoBlock[w.id]:GetName() or ''))) - end - end - end - - handler.numWatched = numWatched - handler.numAll = numAll - handler.numBlocks = 0 - handler.currentBlock = 0 - handler.currentAnchor = frame.titlebg - for blockIndex = 1, numWatched do - local currentBlock = handler:UpdateBlock(blockIndex, id, isNew) - if currentBlock then - handler:AddBlock(currentBlock) - else - print(' |cFF'..handler.internalColor..'finished|r @', blockIndex) - break -- done with quest stuff - end - end - - local numBlocks = handler.numBlocks - local used = handler.usedBlocks - local free = handler.freeBlocks - print(format('#### %s ## |cFFFF8800%04X|r --- blocks |cFFFF8800%d|r, (used/free: |cFFFF8800%d|r/|cFFFF8800%d|r)', handler.name, band(reason, handler.updateReasonModule + handler.updateReasonEvents, reason), numBlocks, #used, #free)) - - return numWatched, numAll -end - -Default.UpdateBlock = function (handler, index) - --@debug@ - local print = bprint -- @end-debug@ - if not index then - return - end - local info = handler.WatchList[index] -- should match up with whatever the internal watch list has - if not info then - return - end - --@debug@ - print(' Updating |cFF00FF00'..handler.displayName..'|r|cFF00FFFF'..index..'|r|cFF0099FF', info.id ,'|r')--@end-debug@ - local frame = handler.frame - local block = handler:GetBlock(info.id) - - if block.isAnimating then - -- Nothing to do, leave it as is - return block - end - - block.handler = handler - block.info = info - info.blockIndex = index - --@debug@ - local keyInfo--@end-debug@ - if info.id then - handler.InfoBlock[info.id] = block - --@debug@ - keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'InfoBlock[' .. info.id .. '] = *' .. block:GetName():gsub('%D', '') --@end-debug@ - end - if info.logIndex then - handler.LogBlock[info.logIndex] = block - --@debug@ - keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'LogBlock[' .. info.logIndex .. '] = ' .. block:GetName():gsub('%D', '')--@end-debug@ - end - if info.watchIndex then - handler.WatchBlock[info.watchIndex] = block - --@debug@ - keyInfo = (keyInfo and (keyInfo..', ') or '') .. 'WatchBlock[' .. info.watchIndex .. '] = ' .. block:GetName():gsub('%D', '')--@end-debug@ - end - --@debug@ - if keyInfo then print(' assigned', keyInfo) end--@end-debug@ - handler.BlockInfo[index] = info - block.endPoint = block.titlebg - block.attachmentHeight = 0 - block.currentLine = 0 - local attachments, override_schema = handler:UpdateObjectives(block, block.schema) - - block.title:SetText(info.title) - - if info.specialItem and not info.itemButton then - --@debug@ - print(' - |cFF00FFFFgenerating item button for info set')--@end-debug@ - info.itemButton = T.SetItemButton(block, info) - else - --info.itemButton = nil - end - - local tagPoint, tagAnchor, tagRelative, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 - - - if info.selected then - block.SelectionOverlay:Show() - else - block.SelectionOverlay:Hide() - end - - if info.tagInfo then - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) - end - - if info.schema then - block.schema = info.schema - end - return block -end - -Default.UpdateObjectives = function(handler, block, block_schema, displayObjectives) - local print = lprint - displayObjectives = displayObjectives or true - block_schema = block_schema or block.schema - local info = block.info - print(' |cFF00FF00default.objectives', block:GetName()) - -- reset the starting positions - local text, attachment, template - local numAttachments = 0 - - if info.objectives and displayObjectives then - for i, data in ipairs(info.objectives) do - text, attachment, template = handler:UpdateLine(block, data) - if text or attachment then - local line = handler:GetLine(block) - line.height = 0 - print(' |cFF88FF00#', i, data.type, text, attachment) - handler:AddLine(block, text, attachment, template) - end - if attachment then - numAttachments = numAttachments + 1 - end - end - end - - if block.currentLine < block.numLines then - print(' - cull', block.currentLine, block.numLines) - for i = block.currentLine + 1, block.numLines do - print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) - block.lines[i]:ClearAllPoints() - block.lines[i]:Hide() - end - end - - if block.currentLine > 0 then - block.attachmentHeight = block.attachmentHeight - print(' |cFF00FF00attachment:', block.attachmentHeight) - end - return numAttachments, block_schema -end - -Default.UpdateLine = function(handler, block, data) - return block.info.description, nil, 'default' -end - -Default.Select = function(handler, block) - T:Update() -end -Default.Open = function(handler, block) - T:Update(handler.updateReasonModule) -end -Default.Remove = function(handler, block) - T:Update(handler.updateReasonModule) -end -Default.Report = function(handler, block) - print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') -end - -function Default:OnMouseUp (button) - print(self.handler.name, self.mainStyle, self.subStyle) - if button == 'LeftButton' then - if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then - self.Link(self.handler, self) - elseif IsModifiedClick("QUESTWATCHTOGGLE") then - self.Remove(self.handler, self) - else - self.Select(self.handler, self) - end - elseif button == 'RightButton' then - self.Open(self.handler, self) - end - self.initialButton = nil - self.modChatLink = nil - self.modQuestWatch = nil - --T:Update(self.handler.updateReasonModule) - print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') -end -function Default:OnMouseDown (button) - print(self.info.title) -end