# HG changeset patch # User Nenue # Date 1461253001 14400 # Node ID 1f8f9cc3d95675a16a673ed9840bd652ddfe547a # Parent e84d645c8ab8f60108ff4b87d5741b9d0ccf3f85 - module integration brought up to speed with current frame management structure diff -r e84d645c8ab8 -r 1f8f9cc3d956 Core.xml --- a/Core.xml Mon Apr 18 07:56:23 2016 -0400 +++ b/Core.xml Thu Apr 21 11:36:41 2016 -0400 @@ -27,6 +27,10 @@ + + + + diff -r e84d645c8ab8 -r 1f8f9cc3d956 Init.lua --- a/Init.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/Init.lua Thu Apr 21 11:36:41 2016 -0400 @@ -287,7 +287,7 @@ local queuedFrame = tremove(checkForConfig) while queuedFrame do B.SetConfigLayers(queuedFrame) - B.InitXMLFrame(queuedFrame) + B.UpdateXMLFrame(queuedFrame) queuedFrame = tremove(checkForConfig) end end @@ -421,7 +421,7 @@ print('['..func..'] updated', #layers, 'regions,', numAnchors, 'frames') end -local XMLFrame_SetEnabled = function(self, value) +local XMLFrame_Enable = function(self, value) local name = self:GetName() @@ -469,47 +469,10 @@ self:OnDisable() end end - - end --- Generic handlers for keeping track of XML-defined frames -B.OnLoad = function(self) - tinsert(checkForConfig, self) - self.SetEnabled = XMLFrame_SetEnabled -end -B.InitXMLFrame = function(self) - local name = self:GetName() - print('|cFF00FF00hello from '.. name) - - if self.drag then - self:RegisterForDrag('LeftButton') - else - self:EnableMouse(false) - end - - if not B.Conf[name] then - B.Conf[name] = { - enabled = true, - } - end - local c = B.Conf[name] - - if c.position then - print('restoring frame position', unpack(c.position)) - self:ClearAllPoints() - local anchorTo, relativePoint, x, y = unpack(c.position) - self:SetPoint(anchorTo, UIParent, relativePoint, x, y) - else - local a, _, b, c, d = self:GetPoint(1) - print('seeding default position', a, b, c, d) - c.position = {a, b, c, d} - end - local state = c.enabled - self:SetEnabled(state) -end - -B.OnDragStart = function(self) +local XMLFrame_OnDragStart = function(self) self.xA = self:GetLeft() self.yA = self:GetBottom() self.anchorTo, self.relativeTo, self.relativePoint, self.x, self.y = self:GetPoint(1) @@ -518,7 +481,7 @@ self:StartMoving() end -B.OnDragStop = function(self) +local XMLFrame_OnDragStop = function(self) local name = self:GetName() print(name, 'stop moving ('..self:GetLeft()..', '..self:GetBottom()..')') local xB = self:GetLeft() - self.xA @@ -527,5 +490,55 @@ self:StopMovingOrSizing() B.Conf[name].position = {self.anchorTo, self.relativePoint, self.x + xB, self.y + yB} - B.InitXMLFrame(self) -end \ No newline at end of file + B.UpdateXMLFrame(self) +end + +B.RegisterModuleFrame = function(self, moduleName) + tinsert(checkForConfig, self) + self.Enable = XMLFrame_Enable + self.moduleName = moduleName + print('|cFF00FF00XML stuff related to '.. tostring(moduleName) .. ':', name) +end + +B.UpdateXMLFrame = function(self) + + local name = self:GetName() + + + if self.drag then + self:RegisterForDrag('LeftButton') + self:SetScript('OnDragStart', XMLFrame_OnDragStart) + if self.OnDragStop then + self:SetScript('OnDragStop', function(self, ...) + self:OnDragStop(self, ...) + XMLFrame_OnDragStop(self, ...) + end) + else + self:SetScript('OnDragStop', XMLFrame_OnDragStop) + end + else + self:EnableMouse(false) + end + + if not B.Conf[name] then + B.Conf[name] = { + enabled = self.enabled, + } + end + local c = B.Conf[name] + + if not c.position then + local a, _, b, c, d = self:GetPoint(1) + print('seeding default position', a, b, c, d) + c.position = {a, b, c, d } + else + + print('restoring frame position', unpack(c.position)) + self:ClearAllPoints() + local anchorTo, relativePoint, x, y = unpack(c.position) + self:SetPoint(anchorTo, UIParent, relativePoint, x, y) + end + self:Enable(c.enabled) + + +end diff -r e84d645c8ab8 -r 1f8f9cc3d956 Minimap/Minimap.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Minimap/Minimap.lua Thu Apr 21 11:36:41 2016 -0400 @@ -0,0 +1,13 @@ +--- ${PACKAGE_NAME} +-- @file-author@ +-- @project-revision@ @project-hash@ +-- @file-revision@ @file-hash@ +-- Created: 4/21/2016 9:45 AM +local B = select(2, ...) +local T = B:RegisterModule("Cluster", _G.VeneerMiniMapCluster) + +function T:OnInitialize () + +end + + diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/Achievements.lua --- a/ObjectiveTracker/Achievements.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Achievements.lua Thu Apr 21 11:36:41 2016 -0400 @@ -18,14 +18,14 @@ Cheevs.GetNumWatched = function(self, targetID, isNew) local trackedList = {GetTrackedAchievements() } local numWatched, numAll = #trackedList, #self.WatchList - print(' |cFF00FF88GetNumWatched:|r',self.name, numWatched, ' ('..numAll..' recorded)') + print(' |cFF'..self.internalColor..'GetNumWatched:|r',self.name, numWatched, ' ('..numAll..' recorded)') local start = 1 local limit = max(numAll, #trackedList) if targetID then if not isNew and self.Info[targetID] then -- if it's only an update, we can limit the scope start = self.Info[targetID].watchIndex - print(' |cFF0088FFGetNumWatched: limit selection to['..start..'-'..limit..']') + print(' |cFF'..self.internalColor..'GetNumWatched: limit selection to['..start..'-'..limit..']') if self.InfoBlock[targetID] then self.InfoBlock[targetID]:Hide() end @@ -42,7 +42,7 @@ if not self.Info[cheevID] then self.Info[cheevID] = self:GetInfo(cheevID, index) else - print(' |cFF00FFBBGetInfo:', cheevID, 'already pulled') + print(' |cFF'..self.internalColor..'GetInfo:', cheevID, 'already pulled') end self:GetObjectives(cheevID) @@ -62,7 +62,7 @@ local id, name, points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy = GetAchievementInfo(cheevID) if not id then return nil end - print(' |cFF44AAFFGetInfo: pulling', id..',', name, earnedBy) + print(' |cFF'..self.internalColor..'GetInfo: pulling', id..',', name, earnedBy) self.Info[cheevID] = self.Info[cheevID] or {} @@ -118,47 +118,49 @@ line.criteriaID = criteriaID c.objectives[i] = line - print(' |cFF44FFDDGetObjectives:|r', i, type, description, quantityString) + print(' |cFF'..self.internalColor..'GetObjectives:|r', i, format('|cFF0088FF%02X|r(%d)', type, type), format('|cFF88FF00%01X|r', flags or 0), '|cFF00FF00'..tostring(quantity)..'|r/|cFF00FF00'.. tostring(requiredQuantity)..'|r', '"|cFF88FF00'..tostring(description)..'|r"') end end ---- Content handlers -Cheevs.UpdateLine = function(handler, block, line, data) - local print = B.print('CheevsLine') +Cheevs.UpdateObjectives = function(handler, block, block_schema) + Default.UpdateObjectives(handler, block, block_schema) + return block_schema +end + +--- assemble line info +Cheevs.UpdateLine = function(handler, block, data) + local print = lprint local attachment local text - line.progress = 0 - print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text) - if data.flags then - if band(data.flags, 0x00000001) > 0 then - line.format = "%d/%d" - attachment = T.SetWidget(line, data, 'ProgressBar', data.criteriaID) - attachment.value = data.value - attachment.maxValue = data.maxValue - attachment:SetParent(handler.frame) + local lineSchema = 'default' + print(' ', data.objectiveIndex,'|cFF'..handler.internalColor..'-|r', data.objectiveType, data.text) + if data.type == CRITERIA_TYPE_ACHIEVEMENT then + if data.value == 1 then + return nil, nil + end - print(attachment:GetNumPoints()) - for i = 1, attachment:GetNumPoints() do - print(' ',attachment:GetPoint(i)) - end - attachment.status:SetFormattedText("%d/%d", data.value, data.maxValue) - attachment:SetPoint('TOP', line, 'TOP') - line.height = attachment.height - elseif band(data.flags, 0x00000002) then - line.widget = nil - text = line.text - else - line.widget = nil - line.displayColor = 'FFFFFF' - text = line.text + text = data.text + lineSchema = (data.quantity == 1) and 'achievement_complete' or 'achievement' + elseif band(data.flags, 0x00000001) > 0 then + attachment = T.GetWidget(data, 'StatusBar', data.criteriaID) + attachment.format = "%d/%d" + attachment.value = data.value + attachment.maxValue = data.maxValue + attachment:SetParent(block) + print(attachment:GetNumPoints()) + for i = 1, attachment:GetNumPoints() do + print(' ',attachment:GetPoint(i)) end + attachment.status:SetFormattedText("%d/%d", data.value, data.maxValue) + attachment:SetPoint('TOP', line, 'TOP') + lineSchema = 'progressbar' else - - line.displayText = data.text + text = data.quantityString .. ' ' .. data.text + lineSchema = 'default' end - print(' |cFF00DD22UpdateLine:|r', data.type, data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) - return text, attachment, 'default' + print(' |cFF'..handler.internalColor..'UpdateLine:|r', data.type, data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID) + return text, attachment, lineSchema end Cheevs.Select = function(self, block) diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/BonusObjectives.lua --- a/ObjectiveTracker/BonusObjectives.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/BonusObjectives.lua Thu Apr 21 11:36:41 2016 -0400 @@ -13,27 +13,25 @@ local UnitName, GetRealmName, GetQuestObjectiveInfo, GetTasksTable, GetTaskInfo = UnitName, GetRealmName, GetQuestObjectiveInfo, GetTasksTable, GetTaskInfo local GetMapNameByID, GetCurrentMapAreaID = GetMapNameByID, GetCurrentMapAreaID -local tinsert, ipairs, pairs, tostring = tinsert, ipairs, pairs, tostring +local tinsert, ipairs, pairs, tostring, wipe = tinsert, ipairs, pairs, tostring, table.wipe local GetQuestProgressBarPercent, PERCENTAGE_STRING, GetTime = GetQuestProgressBarPercent, PERCENTAGE_STRING, GetTime -local STICKY_TASKS = true +local TASK_DISPLAY_TEST = 1 -- 1: normal (is nearby or on the map) 2: strict (is nearby) 3: data exists --- Returns a tasks table modified to include recently completed objectives local InternalGetTasksTable = function() + local print = Bonus.print local savedTasks = T.Conf.TasksLog local char = UnitName("player") local realm = GetRealmName() local tasks = GetTasksTable() for questID, data in pairs(Bonus.Info) do - - print(' -- questID:', questID, #data.objectives) + print('GetTasksTable', questID, #data.objectives) for i, o in ipairs(data.objectives) do - print(' --', i, o.text) + print('GetTasksTable', questID, i, o.text) end - end - for questID, data in pairs(savedTasks) do if questID > 0 then local found = false @@ -85,25 +83,36 @@ Bonus.Scenario = {} Bonus.QuestBlock = {} Bonus.WatchInfo = {} + +local function CanShowTask(isInArea, isOnMap, existingTask, numObjectives) + if TASK_DISPLAY_TEST == 1 then + return (isInArea) + elseif TASK_DISPLAY_TEST == 2 then + return (isInArea and(isOnMap and existingTask)) + elseif TASK_DISPLAY_TEST == 3 then + return true + end +end + function Bonus:GetNumWatched () - if true then return 0, 0, nil end - local print = iprint + + local print = self.print print(self.name, self) local tasks = InternalGetTasksTable() local numWatched = 0 local numAll = 0 local existingTasks = {} - self.WatchInfo = {} - print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks) - print(' |cFF00FFFFInternalGetTaskInfo|r:') + wipe(self.WatchList) + print('|cFF'..self.internalColor..'Bonus.GetNumWatched()|r', #tasks) + print('InternalGetTaskInfo') + for i, questID in ipairs(tasks) do local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID) - local existingTask = self.QuestBlock[questID] + local existingTask = self.InfoBlock[questID] local displayObjectiveHeader = false; - local test = (isInArea or (isOnMap and existingTask)) - --local test = true - if test then + if CanShowTask(isInArea, isOnMap, existingTask) then + print('TaskInfo', '|cFF00FF00showable objective list', questID) self.Info[questID] = self.Info[questID] or {} local t = self.Info[questID] @@ -111,10 +120,11 @@ t.areaID = GetCurrentMapAreaID() local _ t.mapName, _, _, t.isMicroDungeon, t.microDungeonMapName = GetMapInfo() - print('|cFF00FF00scooping map info (questID '..questID..'):|r', t.areaID, t.mapName) + print('InternalGetTaskInfo', 'map data', t.areaID, t.mapName) end local taskTitle + t.id = questID t.objectives = {} local taskFinished = true; for objectiveIndex = 1, numObjectives do @@ -128,7 +138,7 @@ end - print(' --', text, objectiveType, finished, displayAsObjective) + print('TaskObjective', text, objectiveType, finished, displayAsObjective) t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {} local o = t.objectives[objectiveIndex] @@ -155,26 +165,24 @@ t.id = questID t.taskIndex = i t.title = taskTitle - self.WatchInfo[i] = t + self.WatchList[i] = t + elseif existingTask then + print('TaskInfo', '|cFFFF4400hideable task', questID) + existingTask:Hide() end - print (' |cFF00FF88#', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r')) + print ('TaskInfo', i, 'questID', questID, 'inArea', isInArea, 'onMap', isOnMap, 'existing', (existingTask and 'Y' or 'N'), (test and '|cFF00FF00show|r' or '|cFFFF0088hide|r')) end - for i = 1, #self.usedBlocks do - self.usedBlocks[i]:Hide() - end - - self.numAll = #tasks - self.numWatched = #self.WatchInfo - print(' stats:', self.numAll, 'active tasks,', self.numWatched, 'nearby or animating') - --return #tasks - return #self.WatchInfo + self.numWatched = #self.WatchList + self.numAll = #existingTasks + return self.numWatched, self.numWatched, self.WatchList end --- info cleanup done when turn-ins are detected Bonus.OnTurnIn = function(self, block, questID, xp, money) + --[=[ local info = self.Info[questID] if info.rewardInfo and #info.rewardInfo >= 1 then for i, reward in ipairs(info.rewardInfo) do @@ -218,6 +226,7 @@ end print('adding', info.title, 'to cache') + --]=] end Bonus.GetInfo = function(self, taskIndex) @@ -228,20 +237,26 @@ --- Update hooks -Bonus.UpdateObjectives = function(handler, block) +Bonus.UpdateObjectives = function(handler, block, blockSchema) + block.schema = blockSchema or 'default' + local info = block.info + block.title:SetText(info.title) + + Default.UpdateObjectives(handler, block) - return 'default' + return blockSchema end -Bonus.UpdateLine = function(handler, block, line, data) +Bonus.UpdateLine = function(handler, block, data) local info = block.info local print = lprint local text, attachment = '', nil - line.displayColor = 'FFFFFF' if data.type == 'progressbar' then print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID))) local percent = 100 - attachment = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.index) + attachment = T.GetWidget(data, 'StatusBar', info.questID..'-'..data.index) + attachment:SetParent(block) + if not data.finished then percent = GetQuestProgressBarPercent(info.questID) end @@ -256,14 +271,13 @@ attachment.value = percent attachment.maxValue = 100 - attachment:SetPoint('TOP', line, 'TOP', 0, 0) attachment.status:SetFormattedText(PERCENTAGE_STRING, percent) - attachment:SetParent(handler.frame) - print(attachment.status:GetText()) + --attachment:SetParent(handler.frame) + --print(attachment.status:GetText()) print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue) end text = data.text - return text, attachment + return text, attachment, 'default' end Bonus.Select = function(handler, block) diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/DefaultTracker.lua --- a/ObjectiveTracker/DefaultTracker.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/DefaultTracker.lua Thu Apr 21 11:36:41 2016 -0400 @@ -5,6 +5,7 @@ -- Created: 4/17/2016 7:33 AM 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 @@ -34,28 +35,30 @@ local currentPosition, anchorFrame, anchorPoint --- Positioning and stuff local tick = 0 -local firstUpdate = true +local initReason = OBJECTIVE_TRACKER_UPDATE_ALL +local requiresInit function T:Update (reason, ...) if not B.Conf.VeneerObjectiveWrapper.enabled then return end - tick = tick + 1 - if firstUpdate or not reason then - reason = _G.OBJECTIVE_TRACKER_UPDATE_ALL - end - 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 @@ -82,25 +85,21 @@ end Quest.GetClosest() --T.UpdateActionButtons(reason) - if firstUpdate then - firstUpdate = nil - end end Default.UpdateTracker = function (handler, reason, id, isNew) - local print = tprint + local print = handler.print local frame = handler.frame local blockIndex = 0 - - print(format(' |cFFFF8800UpdateTracker|r(%s): %s', handler.name, reason)) + print('UpdateTracker', handler.name, reason) handler.updateReason = reason local numWatched, numAll, watchTable = handler:GetNumWatched(id, isNew) if numWatched >= 1 then if watchTable then - print('|cFF00FF00 n ID Obj wID Log Blk') + print(' WatchList', ' n ID Obj wID Log Blk') for i, w in ipairs(watchTable) do - print(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 ''))) + 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 @@ -115,7 +114,7 @@ if currentBlock then handler:AddBlock(currentBlock) else - print(' |cFFFF9900finished|r @', blockIndex) + print(' |cFF'..handler.internalColor..'finished|r @', blockIndex) break -- done with quest stuff end end @@ -124,7 +123,8 @@ 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)) + 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 @@ -158,15 +158,13 @@ handler.WatchBlock[info.watchIndex] = block end handler.BlockInfo[index] = info - handler:UpdateObjectives(block) + block.endPoint = block.titlebg + block.attachmentHeight = 0 + block.currentLine = 0 + handler:UpdateObjectives(block, block.schema) block.title:SetText(info.title) - print(' |cFFFFFF00height|r:', block.height) - print(' |cFF00FFFF)|r -> ', block, block:GetHeight()) - - block:Show() - if info.specialItem and not info.itemButton then print(' - |cFF00FFFFgenerating item button for info set') info.itemButton = T.SetItemButton(block, info) @@ -214,50 +212,27 @@ if info.schema then block.schema = info.schema end - - if info.statusKey and (Devian and Devian.InWorkspace()) then - block.debugText:SetText(tostring(info.statusKey) .. ' ' .. tostring(block.posIndex) .. ' '.. tostring(info.logIndex)) - block.debugText:Show() - end return block end -Default.UpdateObjectives = function(handler, block) +Default.UpdateObjectives = function(handler, block, block_schema, displayObjectives) local print = lprint - local block_schema = block.schema + displayObjectives = displayObjectives or true + block_schema = block_schema or block.schema local info = block.info print(' |cFF00FF00default.objectives', block:GetName()) -- reset the starting positions - block.endPoint = block.titlebg - block.attachmentHeight = 0 - block.currentLine = 0 - - local displayObjectiveHeader = false - - block.attachmentHeight = 0 local text, attachment, template - if info.description and #info.description >= 1 then - print(' |cFF00FFFF header line:|r', info.description) - text = info.description - handler:AddLine(block, text, nil) - end - - if (info.isComplete or info.numObjectives == 0) and info.completionText then - print(' overriding line #1 for completion text:', info.completionText) - text = info.completionText - handler:AddLine(block, text, nil, 'completed') - else - if info.objectives then - for i, data in ipairs(info.objectives) do + 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) - displayObjectiveHeader = true line.height = 0 - text, attachment, template = handler:UpdateLine(block, line, data) print(' |cFF88FF00#', i, data.type, text, attachment) handler:AddLine(block, text, attachment, template) - end end end @@ -278,8 +253,8 @@ return block_schema end -Default.UpdateLine = function(handler, block, line, data) - return data.text, line.widget, 'normal' +Default.UpdateLine = function(handler, block, data) + return block.info.description, nil, 'default' end Default.Select = function(handler, block) diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/Events.lua --- a/ObjectiveTracker/Events.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Events.lua Thu Apr 21 11:36:41 2016 -0400 @@ -50,15 +50,6 @@ end T.CompleteQuest = function() local questID = GetQuestID() - if T.Quest.Info[questID] then - local q = T.Quest.Info[questID] - if q.logIndex then - local block = T.Quest.LogBlock[q.logIndex] - if block then - block:Hide() - end - end - end QuestPOIUpdateIcons() return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/Frame.lua --- a/ObjectiveTracker/Frame.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Frame.lua Thu Apr 21 11:36:41 2016 -0400 @@ -13,14 +13,24 @@ 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 band, bor = bit.band, bit.bor local print = B.print('Layout') local oprint = B.print('Objectives') local bprint = B.print('Block') local tprint = B.print('Tracker') local lprint = B.print('Layout') local unitLevel = 1 -local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON -local debug = false + +local ANIM_STATE = 'Animation: %04X' +local INIT_STATE = 'Init: %04X' + +--- Bitfields of import +--- control value for everything +local OBJECTIVE_TRACKER_UPDATE_REASON = _G.OBJECTIVE_TRACKER_UPDATE_REASON +--- flags reason categories where frame layout requires initializing (starts high) +local initReason = 0xFFFF +--- flags reason categories where frame anchor updates must be delayed because of an ongoing animation (starts low) +local animateReason = 0x0000 --- FRAMES local Wrapper = _G.VeneerObjectiveWrapper @@ -65,6 +75,22 @@ --- END SCHEMA local blockPosition + +local SetAnimate = function(reason, animate) + print('comparing', animateReason, reason) + if animate then + if band(animateReason, reason) == 0 then + animateReason = animateReason + reason + end + else + if band(animateReason, reason) > 0 then + animateReason = animateReason - reason + end + end + Wrapper.AnimState:SetFormattedText(ANIM_STATE, animateReason) +end + + --- schema swapper T.UpdateSchema = function(layer, newSchema) if not (T.Conf.Schema[layer] and T.Conf.Schema[layer][newSchema]) then @@ -100,12 +126,31 @@ textColor = c.textColor lineSchema = newSchema end - tprint('|cFFFF0088UpdateSchema:|r', layer, lastSchema[layer], '->', newSchema) + tprint('|cFFFF0088 Schema:|r', layer, lastSchema[layer], '->', newSchema) end -- todo: figure out why objectives go invisible local anchorPoint, anchorFrame local abs, GetTime = math.abs, GetTime Default.AddTracker = function(handler, frame, index) + local isInitialized = true + if initReason and (band(initReason, handler.updateReason) > 0 ) then + isInitialized = false + initReason = initReason - handler.updateReason + print('|cFF00FF00%%% initialization status update:', format('%04X', initReason)) + + frame.SlideIn:SetScript('OnPlay', function() + SetAnimate(handler.updateReasonModule, true) + end) + + frame.SlideIn:SetScript('OnFinished', function() + SetAnimate(handler.updateReasonModule, false) + end) + + if initReason == 0 then + initReason = nil + end + end + if index == 1 then print('|cFF00FF00### beginning wrapper layout -----------------') anchorPoint, anchorFrame = 'TOP', Scroll @@ -114,7 +159,7 @@ frame.destinationOffset = -wrapperHeight print(frame.destinationOffset, frame.previousOffset) - if handler.initialized and (abs(frame.previousOffset - frame.destinationOffset) > 0.9) and frame:IsVisible() then + if isInitialized and (abs(frame.previousOffset - frame.destinationOffset) > 0.9) and frame:IsVisible() then if frame.wasEmpty then frame.previousOffset = -Wrapper:GetHeight() end @@ -152,6 +197,8 @@ frame:ClearAllPoints() frame:SetParent(Scroll) frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) + frame:SetPoint('LEFT', Scroll, 'LEFT') + frame:SetPoint('RIGHT', Scroll, 'RIGHT') frame.previousOffset = frame.destinationOffset handler.initialized = true end @@ -187,7 +234,7 @@ print('blockschema', blockSchema, block.schema) if blockSchema ~= block.schema then T.UpdateSchema('block', block.schema) - print('new schema detected, applicating...') + print(' ### activating block schema:|cFF0088FF', block.schema) end block:SetWidth(T.Conf.Wrapper.Width) @@ -260,10 +307,21 @@ block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, blockPosition) block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) + block:Show() self.numBlocks = self.numBlocks + 1 print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) tracker.height = tracker.height + block.height blockPosition = blockPosition - block.height + + + + if Devian and Devian.InWorkspace() then + block.DebugTab:SetParent(UIParent) + block.DebugTab:SetPoint('TOPRIGHT', block, 'TOPLEFT', 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') + block.DebugTab:Show() + end end --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) @@ -285,6 +343,14 @@ return tagPoint, tagAnchor, tagRelative end +Default.AddReward = function(handler, block, rewardInfo, tagPoint, tagAnchor, tagRelative) + local print = bprint + + for order, reward in ipairs(rewardInfo) do + + end +end + --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call. Default.AddLine = function(handler, block, text, attachment, template) local print = lprint @@ -292,27 +358,36 @@ local line = handler:GetLine(block, lineIndex) line.index = lineIndex - if template then - if line.schema ~= template then + template = template or 'default' + if template and lineSchema ~= template then print(' |cFF00FF00change schema', template) T.UpdateSchema('line', template) - line.status:SetSpacing(textSpacing) - line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) - line.status:SetPoint('RIGHT', line, 'RIGHT',0, 0) - line.status:SetTextColor(unpack(textColor)) - line.schema = template - else - print(' |cFFFFFF00keep schema', line.schema) - end end + line.status:SetSpacing(textSpacing) + line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) + line.status:SetPoint('RIGHT', line, 'RIGHT',0, 0) + line.status:SetTextColor(unpack(textColor)) line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing) line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) line:SetPoint('LEFT', block, 'LEFT') line:SetPoint('RIGHT', block, 'RIGHT') line:Show() + line:SetScript('OnMouseUp', function(self, button) + handler.OnMouseUp(block, button) + end) tprint(' |cFF0088FFAddLine|r (|cFF00FFFF'..tostring(line.schema)..'|r):', line:GetName()) + --[[ + for i = 1, line:GetNumPoints() do + tprint(' - ', line:GetPoint(i)) + end + tprint(' - ', line:GetSize()) + tprint(' - ', line:GetParent(), line:GetParent():IsVisible()) + tprint(' - ', line:IsVisible()) + --]] + + -- fill in the text, then derive pixel-rounded height @@ -321,6 +396,9 @@ -- For progressbar and timer lines, status text may be used as the title heading if attachment then + attachment:SetPoint('TOP', line, 'TOP') + attachment:SetPoint('LEFT', line, 'LEFT', textIndent, 0) + attachment:SetPoint('RIGHT', line, 'RIGHT') print(' |cFFFF0088doing things with a widget', attachment:GetSize()) line.height = attachment:GetHeight() if text then @@ -442,7 +520,6 @@ - ---------- --- Top level methods @@ -528,6 +605,10 @@ print('|cFF00FF00 ', Scroll:GetPoint(i)) end + if Devian and Devian.InWorkspace() then + Wrapper.AnimState:SetFormattedText(ANIM_STATE, animateReason) + end + Wrapper:Show() Scroller:Show() Scroll:Show() diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/ObjectiveTracker.lua --- a/ObjectiveTracker/ObjectiveTracker.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.lua Thu Apr 21 11:36:41 2016 -0400 @@ -140,6 +140,7 @@ displayName = "Notice", updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, + internalColor = '00FFFF', LogInfo = {}, QuestBlock = {}, } @@ -148,6 +149,7 @@ displayName = "Quests", updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST, updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, + internalColor = '0088FF', itemButtons = {}, freeButtons = {}, LogInfo = {}, @@ -160,12 +162,14 @@ updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT, updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT + OBJECTIVE_TRACKER_UPDATE_ACHIEVEMENT_ADDED, + internalColor = '00FF88', } T.Bonus = { name = "Bonus", displayName = "Bonus Objectives", updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE, updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_QUEST + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, + internalColor = '00FF00', QuestBlock = {}, } @@ -173,9 +177,23 @@ name = 'Scenario', displayName = 'Scenario Objectives', updateReasonModule = OBJECTIVE_TRACKER_UPDATE_MODULE_SCENARIO, - updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE + OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED + updateReasonEvents = OBJECTIVE_TRACKER_UPDATE_SCENARIO_NEW_STAGE + OBJECTIVE_TRACKER_UPDATE_SCENARIO_BONUS_DELAYED, + internalColor = '88FF00', } - +local lastLabel +local Tracker_debug = function(handler, channel) + local func = B.print(channel) + local color = handler.internalColor + return function(label, ...) + if lastLabel == label then + label = label:gsub('%a', ' ').. ' ' + else + lastLabel = label + label = '|cFF'..color..label..':|r' + end + func(label, ...) + end +end local Tracker_string = function (self) return self.name end @@ -237,6 +255,10 @@ T.indexedTrackers[handler] = frame print('|cFFFF0088' .. trackerName .. '|r created for |cFF00FFFF' .. handler.displayName .. '|r module') + handler.print = Tracker_debug(handler, 'Tracker') + handler.lprint = Tracker_debug(handler, 'Line') + handler.bprint = Tracker_debug(handler, 'Block') + T.orderedHandlers[index] = handler return true end @@ -248,12 +270,11 @@ local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID Event.QUEST_ACCEPTED = function(questLogIndex, questID, added) if ( IsQuestTask(questID) ) then - return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID + return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED + OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID, added else - - AddQuestWatch(questID) - --return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added + return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added end + AddQuestWatch(questID) end Event.QUEST_REMOVED = function(questLogIndex, questID) @@ -267,6 +288,8 @@ end elseif questID then return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added + else + return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST end end @@ -369,19 +392,6 @@ end end end -T.animateReasons = 0 -T.SetAnimate = function(reason) - print('comparing', T.animateReasons, reason) - if animate then - if band(T.animateReasons, reason) == 0 then - T.animateReasons = T.animateReasons + reason - end - else - if band(T.animateReasons, reason) > 0 then - T.animateReasons = T.animateReasons - reason - end - end -end local iprint = B.print('Info') T.SetRewards = function(t, questID) @@ -463,7 +473,6 @@ function T:OnEvent (event, ...) local isHandled - tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ...) local reason, arg1, arg2, arg3 if Event[event] then if type(Event[event]) == 'function' then @@ -478,12 +487,18 @@ Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]]) end if reason then - print('update reason:', reason, 'args:', arg1, arg2, arg3) + tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ...) T:Update(reason, arg1, arg2, arg3) else - print('no reason value returned') + tprint('OnEvent(|cFFFF4400'.. event ..'|r):', ...) + tprint('no detected reason') Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) end + local args = (reason or '0') + if arg1 then args = args .. ', ' .. tostring(arg1) end + if arg2 then args = args .. ', ' .. tostring(arg2) end + if arg3 then args = args .. ', ' .. tostring(arg3) end + tprint('OnEvent(|cFF00FF00'.. event ..'|r):', ..., '|cFFFFFF00=> Update (|r', args,'|cFFFFFF00)|r') end @@ -544,9 +559,10 @@ Scroller:Show() local from, target, to, x, y = Wrapper:GetPoint(1) - print(from, target:GetName(), to, x,y) + print(from, target, to, x,y) + T.UpdateSchema('tracker', 'default') -- run once to prime the data structure T.UpdateActionButtons() end diff -r e84d645c8ab8 -r 1f8f9cc3d956 ObjectiveTracker/ObjectiveTracker.xml --- a/ObjectiveTracker/ObjectiveTracker.xml Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.xml Thu Apr 21 11:36:41 2016 -0400 @@ -2,7 +2,18 @@ ..\FrameXML\UI.xsd"> - + + + + + + @@ -13,20 +24,12 @@ self.toggle = true - --self.drag = true - Veneer.OnLoad(self) + self.drag = true + self.OnDragStop = function() + Veneer.ObjectiveTracker.UpdateActionButtons() + end + Veneer.RegisterModuleFrame(self, 'ObjectiveTracker') - - - - Veneer.OnDragStart(self) - - - Veneer.OnDragStop(self) - Veneer.ObjectiveTracker.UpdateActionButtons() - - - @@ -54,6 +57,17 @@ + + + + + + + + + + + @@ -105,27 +119,6 @@ - - - - - - - - - - - - - - - - - local hour, min = GetGameTime() - self.time:SetFormattedText("%d:%d", hour, min) - - - + + + + + + + + + + + + + + + + + + + + + + + + local hour, min = GetGameTime() + self.time:SetFormattedText("%d:%02d", hour, min) + --self:SetWidth(self.time:GetWidth()+4) + + + + + + + + + + + + + + + + + + + + + + + + + @@ -275,6 +319,18 @@ + + + if(self.DebugTab:IsShown()) then + self.DebugTab:Show() + end + + + if(self.DebugTab:IsShown()) then + self.DebugTab:Hide() + end + + @@ -394,9 +450,9 @@ -