Mercurial > wow > buffalo2
changeset 38:1f8f9cc3d956
- module integration brought up to speed with current frame management structure
author | Nenue |
---|---|
date | Thu, 21 Apr 2016 11:36:41 -0400 |
parents | e84d645c8ab8 |
children | 92534dc793f2 |
files | Core.xml Init.lua Minimap/Minimap.lua ObjectiveTracker/Achievements.lua ObjectiveTracker/BonusObjectives.lua ObjectiveTracker/DefaultTracker.lua ObjectiveTracker/Events.lua ObjectiveTracker/Frame.lua ObjectiveTracker/ObjectiveTracker.lua ObjectiveTracker/ObjectiveTracker.xml ObjectiveTracker/Quests.lua ObjectiveTracker/Schema.lua ObjectiveTracker/Widgets.lua ObjectiveTracker/Widgets.xml |
diffstat | 14 files changed, 533 insertions(+), 337 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <Color r="1" g="1" b="0" a="1" /> </Texture> + <Font name="VeneerActionNumberFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF" outline="NORMAL" height="15"> + <Color r="1" g="1" b="1" a="1" /> + </Font> + <Font name="VeneerNumberFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="13" > <Color r="1" g="1" b="1" a="1" /> </Font>
--- 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
--- /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 + +
--- 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)
--- 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)
--- 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)
--- 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
--- 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()
--- 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
--- 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"> - <Frame name="VeneerObjectiveWrapper" parent="UIParent" movable="true" frameStrata="LOW"> + + + <Texture file="Interface\ICONS\INV_Misc_QuestionMark" name="VeneerRewardTile" parentArray="rewardTile" alpha="0.5" hidden="true" virtual="true"> + <Color r="1" g="1" b="1" a="1" /> + <Anchors> + <Anchor point="BOTTOM" x="0" y="5" /> + </Anchors> + <TexCoords top="0.15" bottom="0.85" left="0.15" right="0.85" /> + </Texture> + + + <Frame name="VeneerObjectiveWrapper" parent="UIParent" movable="true" enableMouse="true" frameStrata="LOW"> <TitleRegion> <Size x="300" y="30" /> <Anchors> @@ -13,20 +24,12 @@ <Scripts> <OnLoad> self.toggle = true - --self.drag = true - Veneer.OnLoad(self) + self.drag = true + self.OnDragStop = function() + Veneer.ObjectiveTracker.UpdateActionButtons() + end + Veneer.RegisterModuleFrame(self, 'ObjectiveTracker') </OnLoad> - <OnShow> - </OnShow> - <OnDragStart> - Veneer.OnDragStart(self) - </OnDragStart> - <OnDragStop> - Veneer.OnDragStop(self) - Veneer.ObjectiveTracker.UpdateActionButtons() - </OnDragStop> - <!--@config@--> - <!--@end-config@--> </Scripts> <Anchors> <Anchor point="TOPRIGHT" x="-60" y="-240" /> @@ -54,6 +57,17 @@ </Layer> <Layer level="OVERLAY"> + <FontString name="$parentAnimState" inherits="VeneerStatusFont" parentKey="AnimState"> + <Anchors> + <Anchor point="TOPRIGHT" relativePoint="BOTTOMRIGHT" x="0" y="-5" /> + </Anchors> + <Color r="1" g="1" b="1" a="1" /> + </FontString> + <FontString name="$parentInitState" inherits="VeneerStatusFont" parentKey="InitState"> + <Anchors> + <Anchor point="BOTTOMRIGHT" relativePoint="TOPRIGHT" x="0" y="-5" relativeKey="$parent.AnimState" /> + </Anchors> + </FontString> </Layer> </Layers> <Frames> @@ -105,27 +119,6 @@ - <Frame name="$parentClock" parentKey="Clock" hidden="false"> - <Anchors> - <Anchor point="TOPRIGHT" x="-75" y="0" /> - </Anchors> - <Layers> - <Layer level="OVERLAY"> - <FontString inherits="VeneerNumberFont" parentKey="time" text="GAME_TIME"> - <Anchors> - <Anchor point="TOPRIGHT" /> - </Anchors> - <Color r="1" g="1" b="1" a="1" /> - </FontString> - </Layer> - </Layers> - <Scripts> - <OnUpdate> - local hour, min = GetGameTime() - self.time:SetFormattedText("%d:%d", hour, min) - </OnUpdate> - </Scripts> - </Frame> <Button name="$parentCloseButton" parentKey="CloseButton" enableMouse="true" frameStrata="MEDIUM"> <Size x="16" y="16" /> @@ -142,6 +135,57 @@ <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeKey="$parent.CloseButton" x="0" y="0" /> </Anchors> </Button> + + + <Frame name="$parentClock" parentKey="Clock" hidden="false"> + <Anchors> + <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeKey="$parent.QuestMapButton" /> + </Anchors> + <Size x="160" y="16" /> + <Layers> + <Layer level="OVERLAY"> + <FontString font="Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF" parentKey="time" text="GAME_TIME"> + <FontHeight> + <AbsValue val="16" /> + </FontHeight> + + <Anchors> + <Anchor point="CENTER" /> + </Anchors> + <Color r="1" g="1" b="1" a="1" /> + </FontString> + </Layer> + </Layers> + <Scripts> + <OnUpdate> + local hour, min = GetGameTime() + self.time:SetFormattedText("%d:%02d", hour, min) + --self:SetWidth(self.time:GetWidth()+4) + </OnUpdate> + </Scripts> + </Frame> + + + <Frame name="$parentQuestDetailsPane" parentKey="QuestDetails" hidden="true"> + <Anchors> + <Anchor point="TOP" /> + <Anchor point="LEFT" /> + <Anchor point="RIGHT" /> + </Anchors> + <Layers> + <Layer level="BACKGROUND"> + <Texture parentKey="titlebg" /> + <Texture parentKey="statusbg" /> + </Layer> + <Layer level="OVERLAY"> + <Texture parentKey="title" /> + <Texture parentKey="status" /> + + <Texture inherits="VeneerRewardTile" /> + </Layer> + </Layers> + </Frame> + </Frames> </Frame> @@ -275,6 +319,18 @@ <Frame name="VeneerTrackerBlock" virtual="true"> + <Scripts> + <OnShow> + if(self.DebugTab:IsShown()) then + self.DebugTab:Show() + end + </OnShow> + <OnHide> + if(self.DebugTab:IsShown()) then + self.DebugTab:Hide() + end + </OnHide> + </Scripts> <Animations> <AnimationGroup name="$parentSlideIn" parentKey="SlideIn" ignoreFramerateThrottle="true"> <Translation parentKey="translation" offsetX="0" offsetY="0" smoothing="OUT" order="1" duration=".25" /> @@ -394,9 +450,9 @@ - <Texture alpha="1" parentArray="rewardTile" hidden="true" /> - <Texture alpha="1" parentArray="rewardTile" hidden="true" /> - <Texture alpha="1" parentArray="rewardTile" hidden="true" /> + <Texture inherits="VeneerRewardTile" /> + <Texture inherits="VeneerRewardTile" /> + <Texture inherits="VeneerRewardTile" /> </Layer> <Layer level="OVERLAY"> <FontString name="$parentTitle" parentKey="title" inherits="VeneerTitleFont" justifyH="LEFT" justifyV="TOP"> @@ -416,11 +472,6 @@ <FontString parentArray="rewardLabel" inherits="VeneerNumberFontSmall" /> <FontString parentArray="rewardLabel" inherits="VeneerNumberFontSmall" /> <FontString parentArray="rewardLabel" inherits="VeneerNumberFontSmall" /> - <FontString name="$parentDebugText" parentKey="debugText" inherits="VeneerCriteriaFontNormal" justifyH="RIGHT" justifyV="TOP"> - <Anchors> - <Anchor point="BOTTOMRIGHT" /> - </Anchors> - </FontString> <Texture alphaMode="BLEND" parentArray="config" hidden="true"> @@ -511,6 +562,29 @@ </Layer> </Layers> </Frame> + <Frame name="$parentDebugInfo" parentKey="DebugTab" hidden="true"> + <Size x="200" y="30" /> + <Layers> + <Layer level="OVERLAY"> + + <FontString name="$parentStatus" parentKey="status" inherits="VeneerNumberFont" justifyH="RIGHT" justifyV="TOP"> + <Color r="1" g="1" b="1" a="1" /> + <Anchors> + <Anchor point="TOPRIGHT" /> + </Anchors> + </FontString> + </Layer> + <Layer level="BACKGROUND"> + <Texture> + <Anchors> + <Anchor point="BOTTOMLEFT" relativeKey="$parent.status" /> + <Anchor point="TOPRIGHT" relativeKey="$parent.status" /> + </Anchors> + <Color r="0" g="0" b="0" a="0.5" /> + </Texture> + </Layer> + </Layers> + </Frame> </Frames> </Frame>
--- a/ObjectiveTracker/Quests.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Quests.lua Thu Apr 21 11:36:41 2016 -0400 @@ -14,9 +14,11 @@ local lprint, iprint, tprint = B.print('Line'), B.print('Info'), B.print('Tracker') local print = tprint + + local superTrackQuestID, playerMoney, inScenario, showPOIs Quest.Update = function(self, reason, ...) - local print = tprint + local print = self.print print('QuestTracker:Update() received') T.UpdateActionButtons() Default.Update(self, reason, ...) @@ -26,13 +28,14 @@ local usedButtons = T.Quest.itemButtons local freeButtons = T.Quest.freeButtons -Quest.UpdateObjectives = function(handler, block) +Quest.UpdateObjectives = function(self, block) local print = lprint - print('|cFF00FFFFUpdateObjectives()') + print('|cFF'..self.internalColor..'UpdateObjectives()') local info = block.info print((info.isAccount and 'isAccount' or ''), (info.isFaction and 'isFaction' or ''), (info.isDaily and 'isDaily' or ''), (info.isWeekly and 'isWeekly' or ''), info.tagID, info.tagName) + local displayObjectives = true local block_schema = 'default' if info.isAccount then if info.isFaction then @@ -55,22 +58,23 @@ local questID, popupType = GetAutoQuestPopUp(info.logIndex) if popupType == 'COMPLETE' then print(' :: auto-complete quest :: set the message') - info.completionText = T.strings.CLICK_TO_COMPLETE + 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 end - print(' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') + self:AddLine(block, info.completionText, nil, 'complete') + displayObjectives = false + print('|cFF'..self.internalColor..' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') end - Default.UpdateObjectives(handler, block, block_schema) + Default.UpdateObjectives(self, block, block_schema, displayObjectives) return block_schema end -Quest.UpdateLine = function(handler, block, line, data) - local print = lprint +Quest.UpdateLine = function(handler, block, data) local objectiveType = data.type return data.text, nil, objectiveType end @@ -130,6 +134,7 @@ --- Get a total of things to show, and straighten out the index while we're at it --- Return the number shown, total in log, and the info table to parse Quest.GetNumWatched = function (self, id, added) + local print = self.print superTrackQuestID = GetSuperTrackedQuestID() playerMoney = GetMoney(); inScenario = C_Scenario.IsInScenario(); @@ -137,7 +142,7 @@ local numAll = GetNumQuestLogEntries() local numWatched = GetNumQuestWatches() local bottomIndex = 1 - print(' |cFF00FF88GetNumWatched:|r',self.name, numWatched, 'of', numAll) + print('GetNumWatched', self.name, numWatched, 'of', numAll) local start, limit = 1, numAll --- start a list of blocks affected by this function @@ -157,11 +162,11 @@ local watchInfo = self.WatchInfo[watchIndex] local watchBlock = self.WatchBlock[watchIndex] if watchInfo and watchInfo.questID ~= questID then - print(' |cFFBBFF00GetNumWatched: trimming WatchInfo ['..watchIndex..'] =/=', questID) + print('GetNumWatched', 'trimming WatchInfo ['..watchIndex..'] =/=', questID) self.WatchInfo[watchIndex] = nil end if watchBlock and watchBlock.info.questID ~= questID then - print(' |cFFBBFF00GetNumWatched: trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) + print('GetNumWatched', 'trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) self.WatchBlock[watchIndex] = nil tinsert(blocksChecked, watchBlock) end @@ -183,12 +188,12 @@ --- remove any orphaned blocks from view and, if possible, free it for re-use for i, block in ipairs(blocksChecked) do if not GetQuestLogIndexByID(block.info.questID, 'player') then - print(' |cFFBBFF00GetNumWatched:|r literating a block without an index |cFFBBFF00'.. block:GetName()..'|r') + print('GetNumWatched', 'iterating a block without an index |cFFBBFF00'.. block:GetName()..'|r') block:Hide() self:FreeBlock(block) end if not IsQuestWatched(block.info.logIndex) then - print(' |cFFBBFF00GetNumWatched:|r hiding untracked quest |cFFBBFF00'.. block:GetName()..'|r') + print('GetNumWatched', 'hiding untracked quest |cFFBBFF00'.. block:GetName()..'|r') block:Hide() end end @@ -207,7 +212,7 @@ local print = iprint local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) if ( not questID ) then - tprint(' |cFFFF0088GetInfo:|r', logIndex, watchIndex, '|cFFFF2299no data|r') + tprint('GetNumWatched', logIndex, watchIndex, '|cFFFF2299no data|r') return end @@ -226,7 +231,7 @@ failureTime, timeElapsed, questType = GetQuestWatchInfo(watchIndex) self.WatchList[watchIndex] = q --tprint(' |cFF88FF00GetInfo:|r set watch entry', watchIndex) - tprint(' |cFFFFBB00GetInfo:|r', logIndex, watchIndex, '|cFFFF2299'..title..'|r') + print('GetInfo:', logIndex, watchIndex, '|cFFFF2299'..title..'|r') end self.LogInfo[logIndex] = q @@ -268,7 +273,7 @@ isBreadcrumb = true; end end - print('|cFF0088FFflags:|r', (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 '')) -- completion message? local isSequenced = IsQuestSequenced(questID) @@ -474,9 +479,9 @@ q.schema = schema if Devian and Devian.InWorkspace() then - print('|cFF00DDFFstatus:|r', temp_status, '|cFF00FF00questLogIndex|r:', logIndex, title) + print('QuestStatus', temp_status, '|cFF00FF00questLogIndex|r:', logIndex, title) local temp ={} - local data_txt = '|cFFFF4400values:|r' + local data_txt = '|cFF'..self.internalColor..'values:|r' for k,v in pairs(q) do if type(v) =='number' then data_txt = data_txt .. ' |cFFFFFF00'..k..'|r: ' .. tostring(v) @@ -484,12 +489,12 @@ tinsert(temp, k) end end - print(data_txt) + print('DataStatus',data_txt) sort(temp, function(a,b) return a < b end) for i, k in ipairs(temp) do - print('|cFF00FF00'..k..'|r') + iprint('GetInfo', questID, ''..k..'|r') for kk,v in pairs(q[k]) do - print(' ', kk, '=', v) + iprint('GetInfo', questID, kk, '=', v) end end end @@ -498,10 +503,11 @@ end Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) + local print = Quest.print local objectives = {} for i = 1, numObjectives do local text, type, finished = GetQuestLogLeaderBoard(i, logIndex) - print(format(' |cFFFF4400GetObjectives:|r #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) + print('GetObjectives', format('|cFF88FF88#%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) objectives[i] = { index = i, type = type,
--- a/ObjectiveTracker/Schema.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Schema.lua Thu Apr 21 11:36:41 2016 -0400 @@ -7,7 +7,7 @@ local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local setmetatable, type, rawset = setmetatable, type, rawset -local print = B.print('Tracker') +local print = B.print('Schema') local lprint = B.print('Layout') local oprint = B.print('Objectives') T.defaults.Schema = setmetatable({}, { @@ -51,13 +51,16 @@ T.defaults.Schema.tracker = { default = { headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}, - headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'}, + headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\XOIREQE.TTF]], 13, 'OUTLINE'}, + headerHeight = 16, + headerSpacing = 0, + headerColor = {1,1,1,1}, blockSpacing = 1, } } T.defaults.Schema.block = { default = { - titleColor = {1, 0.7, 0, 1}, + titleColor = {1, 1, 1, 1}, titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .125}, textbg = {'HORIZONTAL', 0, 0, 0, 0, 0, 0, 0, 0.4 }, selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}, @@ -78,17 +81,17 @@ }, daily = { titleColor = {0, 0.7, 1, 1}, - titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, - textbg = {'HORIZONTAL', 0, .7, 1, .075, 0, 1, .7, .1}, + titlebg = {'HORIZONTAL', 0, .7, 1, 0, 0, 1, .7, .125}, + textbg = {'HORIZONTAL', 0, .7, 1, 0, 0, 1, .7, .1}, }, weekly = { titleColor = {.25, 0.7, 1, 1}, - titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125}, - textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 }, + titlebg = {'HORIZONTAL', 0, .35, .7, 0, 0, .35, .7, .125}, + textbg = {'HORIZONTAL', 0, .35, .7, .0, 0, .35, .7, .075 }, }, account = { - titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125}, - textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 }, + titlebg = {'HORIZONTAL', .1, .1, .1, 0, .1, .1, .1, .125}, + textbg = {'HORIZONTAL', .1, .1, .1, 0, .1, .1, .1, .085 }, }, -- alliance faction_1 = { @@ -103,7 +106,7 @@ } T.defaults.Schema.line = { default = { - textColor = {.5,.75,1}, + textColor = {1, 1, 1}, textSpacing = 3, textIndent = 3, }, @@ -124,7 +127,16 @@ }, item = { textColor = {1,.25,.5} - } + }, + achievement_complete = { + textColor = {1, 1, 1, 1}, + }, + achievement = { + textColor = {0, 0.7, 1, 1}, + }, + achievement_account = { + textColor = {.35, 0.7, 1, 1}, + }, } T.defaults.Schema.widget = { progressbar = {
--- a/ObjectiveTracker/Widgets.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Widgets.lua Thu Apr 21 11:36:41 2016 -0400 @@ -101,7 +101,7 @@ local OnClick = {} OnClick.CloseButton = function(self) - T:SetEnabled() + T:Enable() if T.Conf.enabled then T:Update() end @@ -275,7 +275,7 @@ --- Get a usable widget for the given achievement criteria set. -- Returns a frame object with dimensioning parameters needed to size the receiving tracker block -T.SetWidget = function(line, data, objectiveType, objectiveKey) +T.GetWidget = function(data, objectiveType, objectiveKey) local print = B.print('ObjectiveWidgets') local widgetType = objectiveType local widget @@ -283,8 +283,7 @@ widget = wr[widgetType].used[objectiveKey] print('|cFF00FF00Updating ('..objectiveKey..')', widget) elseif not wr[widgetType] or #wr[widgetType].free == 0 then - widget = CreateFrame('Frame', 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType) - + widget = CreateFrame(widgetType, 'VeneerObjective' .. widgetType .. (wr[widgetType] and (wr[widgetType].lastn+1) or (1)), VeneerObjectiveScroll, 'VeneerObjectiveCriteria' .. widgetType) print('|cFFFF0088Creating `'..widget:GetName()..'` id', wr[widgetType].lastn) else widget = tremove(wr[widgetType].free) @@ -293,7 +292,6 @@ wr[widgetType].used[objectiveKey] = widget - widget.line = line widget.objective = data widget.key = objectiveKey T.InitializeWidget(widget) @@ -397,7 +395,7 @@ local progressFont = _G.VeneerCriteriaFontNormal local lprint = B.print('Line') -T.InitializeWidget.ProgressBar = function(self) +T.InitializeWidget.StatusBar = function(self) local print = lprint local c = T.Conf.Wrapper self.height = progressHeight + c.TextSpacing @@ -406,35 +404,27 @@ self.maxValue = self.maxValue or 1 self:SetHeight(progressHeight) - self.bg:SetHeight(progressHeight) - self.bg:SetWidth(self.width) - self.fg:ClearAllPoints() - self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', progressBorder, progressBorder) - self.fg:SetHeight(progressHeight - progressBorder * 2) + self:SetMinMaxValues(0, self.maxValue) + self:SetValue(self.value) --self.status:SetFontObject(progressFont) self.status:SetText(self.objective.quantityString) end -T.UpdateWidget.ProgressBar = function (self) - local quantity, requiredQuantity = self.value, self.maxValue +T.UpdateWidget.StatusBar = function (self) + local value, maxValue = self.value, self.maxValue print('update vals:') - for k,v in pairs(self.line) do + for k,v in pairs(self) do print(k, v) end - - local progress = (quantity / requiredQuantity) - if progress >= 1 then - self.fg:Show() - self.fg:SetWidth(self.width - progressBorder * 2) - elseif progress > 0 then - self.fg:Show() + self:SetValue(self.value) + local format = self.format or '%d/%d' + self.status:SetFormattedText(format, value, maxValue) + local progress = (value / maxValue) + if progress > 0 then print('color:', 1-progress*2 , progress*2 - 1,0,1) print('width:', (self.width -progressBorder * 2) * progress) - self.fg:SetTexture(1-progress*2 , progress*2,0,1) - self.fg:SetWidth((self.width -progressBorder * 2) * progress) - else - self.fg:Hide() + self:SetStatusBarColor(1-progress*2 , progress*2,0,1) end end
--- a/ObjectiveTracker/Widgets.xml Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Widgets.xml Thu Apr 21 11:36:41 2016 -0400 @@ -1,11 +1,11 @@ <Ui> <!-- houses objective widget templates --> - <Frame name="VeneerObjectiveCriteriaProgressBar" virtual="true" hidden="true"> + <StatusBar name="VeneerObjectiveCriteriaStatusBar" drawLayer="BACKGROUND" virtual="true" hidden="true" minValue="0" maxValue="100" defaultValue="0"> <Size x="250" y="30" /> <Scripts> <OnLoad> - self.widgetType = 'ProgressBar' + self.widgetType = 'StatusBar' Veneer.ObjectiveTracker.RegisterWidget(self) </OnLoad> <OnShow> @@ -19,36 +19,41 @@ </OnEvent> </Scripts> <Layers> - <Layer level="BORDER"> - <Texture name="$parentBackground" parentKey="bg"> - <Color r="0" g="0" b="0" a="0.70" /> + <Layer level="ARTWORK"> + + <Texture parentKey="BorderLeft" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder"> + <Size x="9" y="22"/> + <TexCoords left="0.007843" right="0.043137" top="0.193548" bottom="0.774193"/> <Anchors> - <Anchor point="BOTTOMLEFT" /> - <Anchor point="TOPRIGHT" /> + <Anchor point="LEFT" x="-3" y="0" relativeKey="$parent.bg" /> </Anchors> </Texture> - </Layer> - <Layer level="ARTWORK"> - - <Texture name="$parentForeground" parentKey="fg"> - <Color r="1" g="1" b="1" a="0.7" /> + <Texture parentKey="BorderRight" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder"> + <Size x="9" y="22"/> + <TexCoords left="0.043137" right="0.007843" top="0.193548" bottom="0.774193"/> + <Anchors> + <Anchor point="RIGHT" x="3" y="0" relativeKey="$parent.bg"/> + </Anchors> </Texture> - <Texture name="$parentIcon" parentKey="icon" alphaMode="MOD"> + <Texture parentKey="BorderMid" file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder"> + <TexCoords left="0.113726" right="0.1490196" top="0.193548" bottom="0.774193"/> <Anchors> - <Anchor point="TOPLEFT" relativeKey="$parent.fg" /> - <Anchor point="BOTTOMRIGHT" relativeKey="$parent.fg" /> + <Anchor point="TOPLEFT" relativeKey="$parent.BorderLeft" relativePoint="TOPRIGHT"/> + <Anchor point="BOTTOMRIGHT" relativeKey="$parent.BorderRight" relativePoint="BOTTOMLEFT"/> </Anchors> </Texture> </Layer> <Layer level="OVERLAY"> - <FontString name="$parentStatus" parentKey="status" inherits="VeneerNumberFontSmall"> + <FontString name="$parentStatus" parentKey="status" inherits="VeneerActionNumberFont"> <Anchors> <Anchor point="CENTER" /> </Anchors> </FontString> </Layer> </Layers> - </Frame> + <BarTexture file="Interface\TargetingFrame\UI-StatusBar"/> + <BarColor r="0.26" g="0.42" b="1"/> + </StatusBar> <Frame name="VeneerObjectiveCriteriaEvent" virtual="true" hidden="true"> <Size x="250" y="24" />