# HG changeset patch
# User Nenue
# Date 1459754182 14400
# Node ID ed642234f017ee1286df3d4e5b1fab2366a6d958
# Parent 9455693fc29068c31222f3545ba6ceebf0110fc8
ObjectiveFrame
- implement proper tracker name text
- expanded tracker prototypes to cover "objective lines" formatting and accommodation of widget variables
- implement the progress bars for bonus objectives
ObjectiveStyle
- moved `UpdateWrapperStyle` over and renamed it to fit semantics
- change the formula for block.`height` to measure non-widget content only
- allows widgets to position relative to text
- size FontString `status` to match block.`height`
- full block height is acquired by adding block.`height` and block.`attachmentHeight` which is calculated during objective parsing
ObjectiveWidgets
- use string keys for generated widgets to deal with multiple objectives under the same questID, and maybe dungeon objectives
- wrapper buttons use a common code path
- specialized handlers for wheel scrolling moved over to fit semantics
diff -r 9455693fc290 -r ed642234f017 BuffFrame.xml
--- a/BuffFrame.xml Sat Apr 02 17:46:52 2016 -0400
+++ b/BuffFrame.xml Mon Apr 04 03:16:22 2016 -0400
@@ -3,6 +3,267 @@
Veneer
BuffFrame module
-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.mouseover = self:IsMouseOver()
+
+
+ if self:IsMouseOver() and not self.contains then
+ self.caster:Show()
+ else
+ self.caster:Hide()
+ end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 9455693fc290 -r ed642234f017 Core.xml
--- a/Core.xml Sat Apr 02 17:46:52 2016 -0400
+++ b/Core.xml Mon Apr 04 03:16:22 2016 -0400
@@ -21,262 +21,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- self.mouseover = self:IsMouseOver()
-
-
- if self:IsMouseOver() and not self.contains then
- self.caster:Show()
- else
- self.caster:Hide()
- end
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff -r 9455693fc290 -r ed642234f017 Init.lua
--- a/Init.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/Init.lua Mon Apr 04 03:16:22 2016 -0400
@@ -168,6 +168,8 @@
B.Conf = setmetatable(VeneerData, {__index = function(_, k) return defaults[k] end})
+
+
-- suffix tables
for name, display in pairs(displays) do
display.conf = setmetatable({}, {
@@ -236,16 +238,21 @@
for level, batch in ipairs(moduleStack) do
print('config level', level)
for name, module in pairs(batch) do
- print('integrity check', name)
+ if module.defaults then
+ print('setting defaults for module', name)
+ --[===[@non-debug@
+ if not VeneerData[name] then
+ --@end-non-debug@]===]
+ VeneerData[name] = {}
+ --[===[@non-debug@
+ end
+ --@end-non-debug@]===]
+ for k,v in pairs(module.defaults) do
+ VeneerData[name][k] = v
+ end
+ module.Conf = VeneerData[name]
+ end
- --[===[@non-debug@
- if module.defaults and not VeneerData[name] then
- --@end-non-debug@]===]
- print('Adding defaults from module ', name)
- VeneerData[name] = module.default
- --[===[@non-debug@
- end
- --@end-non-debug@]===]
end
end
diff -r 9455693fc290 -r ed642234f017 ObjectiveCore.lua
--- a/ObjectiveCore.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveCore.lua Mon Apr 04 03:16:22 2016 -0400
@@ -4,11 +4,9 @@
-- @file-revision@ @file-hash@
-- Created: 3/26/2016 1:51 AM
local B = select(2,...).frame
-local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack
-local setmetatable, type = setmetatable, type
-local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
-local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
-local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
+local pairs, setmetatable, type, tostring = pairs, setmetatable, type, tostring
+local format = string.format
+local M = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
local print = B.print('Objectives')
local ObjectiveTrackerFrame = ObjectiveTrackerFrame
@@ -33,29 +31,36 @@
local Scroll = _G.VeneerObjectiveScroll
--- Baseline defaults
-mod.defaults = {
+M.defaults = {
}
--- list used to make things happen
-mod.orderedNames = {[1] = 'AutoQuest', [2] = 'Quest', [3] = 'Cheevs'}
+M.orderedNames = {'Bonus', 'AutoQuest', 'Quest', 'Cheevs'}
--- ipairs() list of handlers for wrapper update
-mod.orderedHandlers = {}
-mod.orderedTrackers = {}
-mod.indexedTrackers = {}
+M.orderedHandlers = {}
+M.orderedTrackers = {}
+M.indexedTrackers = {}
--- pairs() list of handler frames for tracker updates
-mod.namedTrackers = {}
+M.namedTrackers = {}
--- Handler stubs
-mod.AutoQuest = {
- name = "AutoQuest"
+M.AutoQuest = {
+ name = "AutoQuest",
+ displayName = "Local Quests",
}
-mod.Quest = {
- name = "Quest"
+M.Quest = {
+ name = "Quest",
+ displayName = "Quests",
}
-mod.Cheevs = {
- name = "Cheevs"
+M.Cheevs = {
+ name = "Cheevs",
+ displayName = "Achievements",
+}
+M.Bonus = {
+ name = "Bonus",
+ displayName = "Bonus Objectives",
}
@@ -100,15 +105,15 @@
print(self, name)
local handler = setmetatable({}, {
__tostring = function() return name end,
- __call = function (self) mod.UpdateTracker(self) end
+ __call = function (self) M.UpdateTracker(self) end
})
- if type(mod.orderedHandlers[index]) == 'table' then
- return mod.orderedHandlers[index]
+ if type(M.orderedHandlers[index]) == 'table' then
+ return M.orderedHandlers[index]
end
print('take up locals first')
local preset = {}
- for k,v in pairs(mod[name]) do
+ for k,v in pairs(M[name]) do
preset[k] = true
if type(v) == 'table' then
handler[k] = {}
@@ -124,7 +129,7 @@
-- assume all tables to be local data; don't inherit or ref
handler[k] = {}
else
- handler[k] = mod.Tracker[k]
+ handler[k] = M.Tracker[k]
end
else
print(name, 'has its own', k)
@@ -134,16 +139,16 @@
for k, v in pairs(handler) do
print(string.format("%24s %8s %s", (preset[k] and '|cFFFFFFFF' or '|cFFFFFF00') .. k .. '|r', type(v), tostring(v)))
end
- mod[name] = handler
- mod.orderedHandlers[index] = handler
+ M[name] = handler
+ M.orderedHandlers[index] = handler
return true
end
-mod.Tracker = setmetatable({}, {
+M.Tracker = setmetatable({}, {
__call = CreateHandler,
__tostring = function() return 'DEFAULT_TRACKING_HANDLER' end
})
-local Tracker = mod.Tracker
+local Tracker = M.Tracker
Tracker.numWatched = 0 --- number of entries being handled
Tracker.numBlocks = 0 --- number of blocks created
Tracker.actualBlocks = 0 --- number of blocks in use
@@ -169,8 +174,14 @@
handler.freeBlocks[#handler.freeBlocks] = nil
else
block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
- block.SetStyle = mod.SetBlockStyle
- block:ClearAllPoints() -- making sure the anchors are clear in case they get added for some other template usage
+ block.SetStyle = M.SetBlockStyle
+ block.Select = handler.Select
+ block.Open = handler.Open
+ block.Remove = handler.Remove
+ block.Link = handler.Link
+ block:SetScript('OnMouseUp', handler.OnMouseUp)
+ block:SetScript('OnMouseDown', handler.OnMouseDown)
+ block:ClearAllPoints()
end
handler.usedBlocks[blockIndex] = block
@@ -178,10 +189,10 @@
return handler.usedBlocks[blockIndex]
end
-function mod:OnInitialize()
- self.InitializeTrackers()
+function M:OnInitialize()
+ self.InitializeWrapper()
self.InitializeXPTracker()
- mod.SetEvents()
+ M.SetEvents()
ObjectiveTrackerFrame:UnregisterAllEvents()
ObjectiveTrackerFrame:Hide()
diff -r 9455693fc290 -r ed642234f017 ObjectiveFrame.lua
--- a/ObjectiveFrame.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveFrame.lua Mon Apr 04 03:16:22 2016 -0400
@@ -5,9 +5,10 @@
-- Created: 3/30/2016 12:49 AM
local B = select(2,...).frame
local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local ipairs, max, min, unpack, floor, pairs, tostring, type = ipairs, max, min, unpack, floor, pairs, tostring, type
+local ipairs, max, min, unpack, floor, pairs, tostring, type, band = ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
+local Quest, Bonus, Cheevs = mod.Quest, mod.Bonus, mod.Cheevs
local CreateFrame = CreateFrame
local print = B.print('Objectives')
local unitLevel = 1
@@ -40,86 +41,32 @@
local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0}
---- These are mostly aesthetic choices so it lives here
+mod.InitializeWrapper = function()
-local Scroller_OnShow = function()
- Wrapper.watchMoneyReasons = 0;
- mod.UpdateWrapper()
- mod.SetEvents()
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Show()
- end
-end
-
-local Scroller_OnHide = function()
- local self = Wrapper
- Wrapper:UnregisterAllEvents()
- Wrapper:SetScript('OnEvent', nil)
- for i, region in ipairs(Wrapper.headerComplex) do
- region:Hide()
- end
-end
-
-local Scroller_OnMouseWheel = function(self, delta)
- local r = Scroll:GetHeight() - Scroller:GetHeight()
- local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5)
- local from = self:GetVerticalScroll()
- if s >= r then
- s = r
- elseif s < 1 then
- s = 0
- end
- self:SetVerticalScroll(s)
- B.Conf.ObjectiveScroll = s
- print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll())
-
- mod.UpdateActionButtons('SCROLLING')
-end
-
-local WrapperCloseButton_OnClick = function(self)
- Wrapper:Minimize()
- if B.Conf.FrameState[Wrapper:GetName()] == 1 then
- self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Up]])
- self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageDown-Down]])
- else
- self:GetNormalTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Up]])
- self:GetPushedTexture():SetTexture([[Interface\PaperDollInfoFrame\UI-Character-SkillsPageUp-Down]])
- end
-end
-local WrapperCloseButton_OnMouseWheel = function(self, delta)
-end
-
-mod.InitializeTrackers = function()
-
+ mod.SetBlockStyle(Scroller, 'Scroller', 'Normal')
+ mod.SetBlockStyle(Scroller, 'Scroll', 'Normal')
+ mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal')
for i, name in ipairs(orderedNames) do
if not mod.orderedHandlers[i] then
if mod.Tracker(name, i) then
local handler = mod[name]
-
local tracker = CreateFrame('Frame', 'Veneer'..name..'Tracker', Scroll, 'VeneerTrackerTemplate')
- tracker.title:SetText(name)
+ tracker.title:SetText(handler.displayName)
mod.SetBlockStyle(tracker, 'Tracker', 'Normal')
-
handler.Tracker = tracker
mod.orderedTrackers[i] = tracker
mod.namedTrackers[name] = tracker
mod.indexedTrackers[handler] = tracker
print('created new tracker frames for new handler')
-
-
end
end
end
Scroller:SetScrollChild(Scroll)
- Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
- Scroller:SetScript('OnShow', Scroller_OnShow)
- Scroller:SetScript('OnHide', Scroller_OnHide)
- Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick)
- Wrapper.close:SetScript('OnMouseWheel', WrapperCloseButton_OnMouseWheel)
- Wrapper:SetPoint(unpack(wrapperPosition))
+
+ mod.InitializeWrapperWidgets()
if B.Conf.ObjectiveTrackerMinimized then
Scroller_OnShow(Scroller)
end
@@ -208,211 +155,12 @@
-local segments = {'Left', 'Right', 'Tile'}
-mod.UpdateWrapperStyle = function()
- --[[for _, segment in ipairs(segments) do
- local texture, a1, a2, a3, a4, width = unpack(mod.defaults.Style.Wrapper.BackgroundComplex[segment])
- Wrapper['Background'..segment]:SetAtlas(texture)
- Wrapper['Background'..segment]:SetTexCoord(a1, a2, a3, a4)
- if width then
- Wrapper['Background'..segment]:SetWidth(width)
- end
- end]]
-end
-
---- Updates the selected block frame to display the given info batch
--- If `previousBlock` is set, it will attempt to anchor to that
--- @param blockNum the ordered block to be updated, not a watchIndex value
--- @param info the reference returned by the GetXInfo functions
--- REMEMBER: t.info and questData[questID] are the same table
-mod.UpdateTrackerBlock = function (handler, blockIndex, info)
- local print = B.print('ObjectiveBlockParse')
- print(' |cFF00FFFFUpdateTrackerBlock('..blockIndex..'|r')
- if not blockIndex or not info then
- return
- end
-
- local mainStyle = 'Normal'
- local subStyle
+mod.UpdateTracker = function(handler)
local tracker = handler.Tracker
-
- local t = handler:GetBlock(blockIndex)
- if previousBlock then
- t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0)
- t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
- end
- --print(t:GetName(), t:GetSize())
- --print(t:GetPoint(1))
-
- t.info = info
-
- if info.questID then handler.QuestBlock[info.questID] = t end
- if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end
- if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end
-
- info.blockIndex = blockIndex
- handler.BlockInfo[blockIndex] = info
-
- t.Select = handler.Select
- t.Open = handler.Open
- t.Remove = handler.Remove
- t.Link = handler.Link
- t:SetScript('OnMouseUp', handler.OnMouseUp)
- t:SetScript('OnMouseDown', handler.OnMouseDown)
- t.title:SetText(info.title)
-
- t.attachmentHeight = 0
- if info.isComplete then
- t.status:Show()
- t.status:SetText(info.completionText)
- elseif info.numObjectives >= 1 then
- t.attachmentHeight = textSpacing
- t.status:Show()
- print(' - objective lines:', info.numObjectives, 'can wrap:', t.status:CanWordWrap())
-
- local text = ''
-
- --- todo: implement objective displays
- -- in an accumulator loop, call upon handler for the appropriate display frame, each defining:
- -- * height - height of whatever display widget is involved in conveying the task
- -- * lines - number of non-wrapped text lines to account for line space; may be discarded depending on things
- -- * money - boolean that determines listening for money events or not
- -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
- text = mod.UpdateObjectives(t, info, text)
-
- t.status:SetText(text)
- t.status:SetWordWrap(true)
-
- elseif info.description then
- t.status:SetText(info.description)
- t.status:SetWordWrap(true)
- else
- t.status:SetText(nil)
- end
-
- if info.isComplete then
- mainStyle = 'Complete'
- end
- if info.superTracked then
- subStyle = 'Super'
- elseif info.isDaily then
- subStyle = 'Daily'
- end
-
- if info.specialItem and not info.itemButton then
- print(' - |cFF00FFFFgenerating item button for info set')
- info.itemButton = mod.SetItemButton(t, info)
- else
- --info.itemButton = nil
- end
-
- if info.level then
- local levelDiff = unitLevel - info.level
- if levelDiff > 9 then
- t.title:SetTextColor(0.7, 0.7, 0.7, 1)
- elseif levelDiff > 1 then
- t.title:SetTextColor(0.5, 1, 0.5, 1)
- elseif levelDiff < -1 then
- t.title:SetTextColor(1, 0.4, 0.25, 1)
- elseif levelDiff < -4 then
- t.title:SetTextColor(1, 0, 0, 1)
- else
- t.title:SetTextColor(1,1,1,1)
- end
- end
-
-
- if Devian and Devian.InWorkspace() then
- t.debugText:Show()
- t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (info.level and info.level or '-'))
- end
-
- --- metrics are calculated in SetStyle
- t:SetStyle('TrackerBlock', handler.name, mainStyle, subStyle)
- t:Show()
-
- print(' |cFF00FFFF)|r -> ', t, t:GetHeight())
- return t
-end
-
-mod.UpdateObjectives = function(block, info, text)
- local print = B.print('ObjectiveBlockParse')
-
- local attachmentHeight = block.attachmentHeight
- if info.description then
- print(' -- has description text:', select('#', info.description), info.description)
- text = info.description
- end
- local completionScore, completionMax = 0, 0
- for o, obj in ipairs(info.objectives) do
- --- achievement criteria
- if obj.flags then
-
-
- if bit.band(obj.flags, 0x00000001) > 0 then
- obj.type = 'ProgressBar'
- elseif bit.band(obj.flags, 0x00000002) then
- obj.type = 'Hidden'
- obj.widget = nil
- else
- obj.type = 'Text'
- obj.widget = nil
- text = text .. ((text == '') and "" or "\n") .. obj.text
- end
-
- print('obj.type =', obj.type)
- print(' ** qtyStr:', obj.quantityString, 'qty:', obj.quantity, 'assetID:', obj.assetID)
- obj.widget = mod.SetWidget(obj, info)
- if obj.finished then
- obj.progress = 2
- elseif obj.quantity > 0 then
- obj.progress = 1
- else
- obj.progress = 0
- end
-
-
- --- none of the above (most quests)
- else
- local line = obj.text
- local color = '00FFFF'
- if obj.finished then
- obj.progress = 2
- color = 'FFFFFF'
- elseif obj.type == 'monster' then
- color = 'FFFF00'
- elseif obj.type == 'item' then
- color = '44DDFF'
- elseif obj.type == 'object' then
- color = 'FF44DD'
- end
- text = text .. ((text == '') and "" or "\n") .. '|cFF'..color.. line .. '|r'
- end
-
- if obj.widget then
-
- obj.widget:Show()
- obj.widget:SetPoint('TOPLEFT', block.objectives, 'BOTTOMLEFT', 0, -attachmentHeight)
- print('have a widget, height is', obj.widget.height)
- attachmentHeight = attachmentHeight + obj.widget.height
- completionScore = completionScore + obj.progress
- completionMax = completionMax + 2
- end
-
- end
-
- block.completionScore = completionScore / completionMax
- block.attachmentHeight = attachmentHeight
-
- return text
-end
-
-mod.UpdateTracker = function(handler)
- print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r')
- local tracker = handler.Tracker
+ print('|cFFFF4400'..tracker:GetName().. '|r:Update()')
local blockIndex = 0
local trackerHeight = headerHeight
- local w = 300
+
previousBlock = tracker.title
local numWatched = handler.GetNumWatched()
@@ -425,12 +173,12 @@
if info then
local currentBlock = mod.UpdateTrackerBlock(handler, blockIndex, info)
previousBlock = currentBlock
- print('|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height)
+ print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height)
trackerHeight = trackerHeight + currentBlock.height
numBlocks = max(numBlocks, watchIndex)
actualBlocks = actualBlocks + 1
else
- print('|cFFFF0000Failed to draw info for index #'..watchIndex)
+ print(' |cFFFF0000Failed to draw info for index #'..watchIndex)
end
elseif watchIndex <= numBlocks then
@@ -444,7 +192,7 @@
used[blockIndex] = nil
end
else
- print('Stopping scan at', blockIndex)
+ print(' |cFFFF9900END|r @', blockIndex)
break -- done with quest stuff
end
end
@@ -452,36 +200,251 @@
handler.numBlocks = numBlocks
handler.actualBlocks = actualBlocks
handler:Report()
- previousBlock = nil
- if numBlocks > 0 then
+
+ if numBlocks >= 1 then
+ previousBlock = nil
tracker.height = trackerHeight
else
tracker.height = 0
end
- print('|cFF00FF88)|r ->', numBlocks, 'blocks; height', tracker.height, 'last block: ')
+ return tracker.numWatched, tracker.numAll
end
+--- Updates the selected block frame to display the given info batch
+-- If `previousBlock` is set, it will attempt to anchor to that
+-- @param blockNum the ordered block to be updated, not a watchIndex value
+-- @param info the reference returned by the GetXInfo functions
+-- REMEMBER: t.info and questData[questID] are the same table
+mod.UpdateTrackerBlock = function (handler, blockIndex, info)
+ local print = B.print('BlockParse')
+ print(' Read list item |cFF00FFFF'..blockIndex..'|r')
+ if not blockIndex or not info then
+ return
+ end
+ local tracker = handler.Tracker
+ local t = handler:GetBlock(blockIndex)
+ t.handler = handler
+ t.info = info
+ t.mainStyle = 'Normal'
+ t.subStyle = nil
+
+ info.blockIndex = blockIndex
+ if info.questID then handler.QuestBlock[info.questID] = t end
+ if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end
+ if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end
+ handler.BlockInfo[blockIndex] = info
+
+
+ t.attachmentHeight = 0
+ --if info.isComplete then
+ --t.status:Show()
+ --t.status:SetText(info.completionText)
+ --end
+
+ if info.numObjectives >= 1 then
+ t.attachmentHeight = textSpacing
+ t.status:Show()
+ print(' lines to build:', info.numObjectives)
+
+ local text = ''
+
+ mod.UpdateObjectives(t, info, text)
+ elseif info.description then
+ t.status:SetText(info.description)
+ else
+ t.status:SetText(nil)
+ end
+ t.title:SetText(info.title)
+
+
+ if info.specialItem and not info.itemButton then
+ print(' - |cFF00FFFFgenerating item button for info set')
+ info.itemButton = mod.SetItemButton(t, info)
+ else
+ --info.itemButton = nil
+ end
+
+ handler.SetBlockTags(t, info)
+
+ if previousBlock then
+ t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0)
+ t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
+ print(' anchor to|cFF0088FF', previousBlock:GetName())
+ end
+
+ --- metrics are calculated in SetStyle
+ t:SetStyle('TrackerBlock', handler.name, t.mainStyle, t.subStyle)
+ t:Show()
+
+ print(' |cFF00FFFF)|r -> ', t, t:GetHeight())
+
+
+ if Devian and Devian.InWorkspace() then
+ t.debugText:Show()
+ t.debugText:SetText(tostring(blockIndex) .. '\n' .. tostring(info.itemButton and info.itemButton:GetName()) .. "\n" .. (tostring(t.mainStyle) .. '/' .. tostring(t.subStyle)))
+ end
+ return t
+end
+
+mod.UpdateObjectives = function(block, info, text)
+ local print = B.print('BlockLine')
+ print(' |cFF00FF00objective updates for', block:GetName())
+
+ local attachmentHeight = block.attachmentHeight
+ if info.description then
+ print(' -- has description text:', select('#', info.description), info.description)
+ text = info.description
+ end
+ local completionScore, completionMax = 0, 0
+
+ for i, line in ipairs(info.objectives) do
+ print(' |cFF88FF00objective', i)
+ block.handler.ParseObjective(line, info)
+
+ if line.title then
+ info.title = line.title
+ line.title = nil
+ end
+
+
+ if line.widget then
+ line.widget:Show()
+ line.widget:SetParent(block)
+ line.widget:SetPoint('TOPLEFT', block.status, 'BOTTOMLEFT', 0, -attachmentHeight )
+ print(' has a widget, height is', line.widget.height)
+ attachmentHeight = attachmentHeight + line.widget.height
+ completionScore = completionScore + line.progress
+ completionMax = completionMax + 2
+ end
+
+ if line.displayText then
+ print(' has text')
+ text = text .. ((text == '') and "" or "\n") .. '|cFF'..line.displayColor.. line.displayText .. '|r'
+ end
+
+ end
+
+ block.completionScore = completionScore / completionMax
+ block.attachmentHeight = attachmentHeight
+
+ block.status:SetText(text)
+end
+
+--- Objective parsers
+-- defines the following variables
+-- * height - height of whatever display widget is involved in conveying the task
+-- * lines - number of non-wrapped text lines to account for line space; may be discarded depending on things
+-- * money - boolean that determines listening for money events or not
+-- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
+mod.Tracker.ParseObjective = function(line, info)
+
+ if line.finished then
+ line.progress = 2
+ elseif line.quantity > 0 then
+ line.progress = 1
+ else
+ line.progress = 0
+ end
+
+end
+
+Bonus.ParseObjective = function(line, info)
+ local print = B.print('BonusLine')
+ for k,v in pairs(line) do
+ print(k, v)
+ end
+
+ line.displayColor = 'FFFFFF'
+ if line.text and not info.title then
+ line.title = line.text
+ else
+ line.displayText = line.text
+ end
+
+ line.progess = 0
+ if line.objectiveType == 'progressbar' then
+ print(' |cFFFF0088==|r', line.type, line.text)
+ line.widgetType = 'ProgressBar'
+ print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
+ line.value = GetQuestProgressBarPercent(info.questID) or 0
+ line.maxValue = 100
+ if line.value >= line.maxValue then
+ line.progress = 1
+ elseif line.value > 0 then
+ line.progress = 2
+ end
+ line.format = PERCENTAGE_STRING
+ line.widget = mod.SetWidget(line, info, 'ProgressBar', info.questID..'-'..line.index)
+ print('line.type =', line.type)
+ print(' ** qtyStr:', line.quantityString, 'qty:', line.value, 'assetID:', line.questID)
+ else
+ line.widget = nil
+ end
+end
+
+Cheevs.ParseObjective = function(line, info)
+ local print = B.print('CheevsLine')
+ line.progress = 0
+ if line.flags then
+ if band(line.flags, 0x00000001) > 0 then
+ line.format = "%d/%d"
+ line.widget = mod.SetWidget(line, info, 'ProgressBar', line.criteriaID)
+ elseif band(line.flags, 0x00000002) then
+ line.widget = nil
+ else
+ line.widget = nil
+ line.displayColor = 'FFFFFF'
+ line.displayText = line.text
+
+ end
+ end
+ print('line.type =', line.type)
+ print(' ** qtyStr:', line.quantityString, 'qty:', line.quantity, 'assetID:', line.assetID)
+end
+
+Quest.ParseObjective = function(line)
+ local print = B.print('QuestLine')
+ print(' |cFFFF0088', line.type)
+ local color = '00FFFF'
+ line.progress = 0
+ if line.finished then
+ line.progress = 2
+ color = 'FFFFFF'
+ elseif line.type == 'monster' then
+ color = 'FFFF00'
+ elseif line.type == 'item' then
+ color = '44DDFF'
+ elseif line.type == 'object' then
+ color = 'FF44DD'
+ end
+ line.displayColor = color
+ line.displayText = line.text
+end
+
+
mod.Quest.numButtons = 0
local usedButtons = mod.Quest.itemButtons
local freeButtons = mod.Quest.freeButtons
mod.UpdateWrapper = function()
unitLevel = UnitLevel('player')
- wrapperWidth = wrapperMaxWidth
- scrollWidth = wrapperWidth
+ wrapperWidth = mod.Conf.Wrapper.WrapperWidth
+ scrollWidth = mod.Conf.Wrapper.WrapperWidth
local wrapperBlocks = 0
-- Update scroll child vertical size
scrollHeight = 0
for i, handler in ipairs(orderedHandlers) do
mod.UpdateTracker(handler)
+ local tracker = handler.Tracker
if handler.actualBlocks >= 1 then
- local tracker = handler.Tracker
- print('setting', handler.Tracker, 'to anchor to offset', -scrollHeight)
tracker:SetParent(Scroll)
tracker:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
tracker:SetSize(wrapperWidth, tracker.height)
- print('adding ', tracker.height)
+ print('|cFF00FFFF'..tracker:GetName()..'|r h:|cFF00FF00', tracker.height, '|r y:|cFF00FF00', -scrollHeight)
scrollHeight = scrollHeight + tracker.height
+ tracker:Show()
+ else
+ tracker:Hide()
end
wrapperBlocks = wrapperBlocks + handler.actualBlocks
end
@@ -513,18 +476,13 @@
end
return
end
- --wrapperHeight = scrollHeight
+ --[[wrapperHeight = scrollHeight
- print('|cFFFFFF00params:|r scroller:', scrollWidth, 'x', scrollHeight)
- print('|cFFFFFF00params:|r scroll:', scrollWidth, 'x', scrollHeight)
- print('|cFFFFFF00params:|r wrapper:', wrapperWidth, 'x', wrapperHeight)
- print('|cFFFFFF00params:|r header:', headerHeight)
+ print('|cFFFFFF00params:|r scroller:', scrollWidth .. ',' .. scrollHeight, 'scroll:', scrollWidth .. ',' .. scrollHeight,
+ 'wrapper:', wrapperWidth .. ',' .. wrapperHeight,
+ 'header:', headerHeight)]]
- mod.SetBlockStyle(Scroller, 'Scroller', 'Normal')
- mod.SetBlockStyle(Scroller, 'Scroll', 'Normal')
- mod.SetBlockStyle(Wrapper, 'Wrapper', 'Normal')
-
- Scroller:SetSize(wrapperWidth, wrapperHeight)
+ --Scroller:SetSize(wrapperWidth, wrapperHeight)
Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
@@ -536,13 +494,14 @@
--Scroller:UpdateScrollChildRect()
Wrapper:SetSize(wrapperWidth, wrapperHeight)
- -- update action buttons
+ --[[ update action buttons
print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),
'|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(),
'|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(),
'|cFF0088FFvScrollRange|r:', floor(Scroller:GetVerticalScrollRange()+.5)
)
- mod.UpdateActionButtons('FULL_UPDATE')
+ mod.UpdateActionButtons()
+ --]]
end
diff -r 9455693fc290 -r ed642234f017 ObjectiveInfo.lua
--- a/ObjectiveInfo.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveInfo.lua Mon Apr 04 03:16:22 2016 -0400
@@ -3,9 +3,9 @@
local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo
local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo
local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
-local print = B.print('Objectives')
+local print = B.print('TrackerInfo')
-local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs
+local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs
--------------------------------------------------------------------
--- Tracker-specific data retrieval functions
--------------------------------------------------------------------
@@ -13,28 +13,84 @@
-----------------------------
--- AUTO_QUEST
-AutoQuest.name = "Remote Quests"
AutoQuest.GetNumWatched = GetNumAutoQuestPopUps
AutoQuest.GetInfo = function(watchIndex)
return Quest.GetInfo(watchIndex)
end
-----------------------------
+--- BONUS OBJECTIVE
+Bonus.TasksTable = {}
+Bonus.TasksPOI = {}
+Bonus.TaskScenario = {}
+
+local taskData = {}
+Bonus.QuestBlock = {}
+Bonus.GetNumWatched = function()
+ Bonus.TasksTable = GetTasksTable()
+ local numTasks = 0
+ for i, questID in ipairs(Bonus.TasksTable) do
+ local isInArea, isOnMap, numObjectives = GetTaskInfo(questID)
+ if isInArea and isOnMap then
+ numTasks = numTasks + 1
+ end
+ end
+ Bonus.numAll = #Bonus.TasksTable
+ Bonus.numWatched = numTasks
+ return GetNumQuestLogTasks()
+end
+Bonus.GetInfo = function(self, watchIndex)
+ local questID = Bonus.TasksTable[watchIndex]
+ if not questID then
+ print('|cFFFF4400no quest ID for row', watchIndex)
+ return
+ end
+
+
+ local t= {}
+ t.isInArea, t.isOnMap, t.numObjectives = GetTaskInfo(questID)
+
+ print('isInArea', t.isInArea, 'isOnMap', t.isOnMap, 'numObj', t.numObjectives)
+ t.displayObjectives = false
+ t.isComplete = true
+ t.questID = questID
+ if t.numObjectives >= 1 then
+ print(t.numObjectives,'objective rows')
+ t.objectives = {}
+ for i = 1, t.numObjectives do
+ t.objectives[i] = {}
+ local o = t.objectives[i]
+ o.index = i
+ o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, true)
+
+ print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective)
+ t.displayObjectives = t.displayObjectives or o.displayAsObjective
+ t.isComplete = t.isComplete and o.finished
+
+ end
+ end
+ Bonus.TasksTable[questID] = t
+
+ return t
+end
+
+-----------------------------
--- QUEST
-Quest.name = "Quests"
Quest.itemButtons = {}
Quest.freeButtons = {}
Quest.POI = {}
Quest.QuestBlock = {}
Quest.GetNumWatched = function()
- return GetNumQuestWatches ()
+ Quest.numAll = GetNumQuestLogEntries()
+ Quest.numWatched = GetNumQuestWatches()
+ return Quest.numWatched
end
Quest.GetInfo = function (self, watchIndex)
print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)')
local questID, title, questIndex, numObjectives, requiredMoney, isComplete,
startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex)
- local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
+ local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex)
local questTagID, tagName = GetQuestTagInfo(questID);
if not questID then
@@ -67,6 +123,11 @@
q.isComplete = isComplete
q.isStory = isStory
q.isTask = isTask
+
+ if isTask then
+ --q.task = Bonus.GetInfo(questID)
+ end
+
--q.isBreadCrumb = isBreadCrumb
q.completionText= GetQuestLogCompletionText(questIndex)
q.numObjectives = GetNumQuestLeaderBoards(questIndex)
@@ -76,6 +137,7 @@
for i = 1, q.numObjectives do
local text, type, finished = GetQuestLogLeaderBoard(i, questIndex)
q.objectives[i] = {
+ index = i,
type = type,
text = text,
finished = finished
@@ -156,12 +218,13 @@
for i = 1, c.numObjectives do
local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
c.objectives[i] = {
+ index = i,
cheevID = cheevID,
text = description,
type = type,
finished = completed,
- quantity = quantity,
- requiredQuantity = requiredQuantity,
+ value = quantity,
+ maxValue = requiredQuantity,
characterName = characterName,
flags = flags,
assetID = assetID,
diff -r 9455693fc290 -r ed642234f017 ObjectiveStyle.lua
--- a/ObjectiveStyle.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveStyle.lua Mon Apr 04 03:16:22 2016 -0400
@@ -5,35 +5,41 @@
--- Deals with swapping between different color palettes
---
-local itemButtonSize, itemButtonSpacing = 36, 1
-local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0}
local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]]
-local titleSize, textSize = 15, 15
+local titleSize, textSize = 16, 15
local titleOutline, textOutline = "OUTLINE", "OUTLINE"
-local titleSpacing, textSpacing = 4, 3
+local titleSpacing, textSpacing = 3, 1
local unpack, type, pairs, tconcat = unpack, type, pairs, table.concat
-local wrapperMaxWidth, wrapperMaxHeight = 280, 490 -- these are the hard bounds, actual *Height variables are changed
local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
-local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24
-local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2
+local headerFont, headerSize = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 24
+local headerOutline, headerSpacing = 'OUTLINE', 2
-mod.defaults.ObjectiveWrapper = {
- ObjectiveTrackerFloat = {'BOTTOM', 'RIGHT'},
- ObjectiveTrackerParent = 'DebuffButton',
- ObjectiveTrackerSize = {250, 600},
- ObjectiveWrapperParent = '',
+mod.defaults.Wrapper = {
+ WrapperPoint = 'TOPRIGHT',
+ WrapperFloatX = -25,
+ WrapperFloatV = 'TOP',
+ WrapperFloatY = -200,
+
+ WrapperWidth = 270,
+ WrapperHeight = 600,
}
+mod.defaults.Tracker = {
+ HeaderHeight = 24,
+}
+
mod.defaults.Style = {
Format = {
Frame = {
Width = 270,
},
title = {
- Indent = 0
+ Indent = 0,
+ Spacing = 0,
},
status = {
- Indent = 5
+ Indent = 5,
+ Spacing = 0,
}
},
FontBank = {
@@ -46,6 +52,8 @@
title = {
TextColor = {1, 1, 1, 1},
Width = 270,
+ Spacing = 0,
+ Indent = 2,
},
titlebg = {
Background = {0, 0, 0, 1},
@@ -53,6 +61,7 @@
},
status = {
Width = 270,
+ Spacing = 0,
},
statusbg = {
Width = 270,
@@ -63,8 +72,6 @@
},
Wrapper = {
Frame = {
- Point = {wrapperPosition},
- MaxSize = {wrapperMaxWidth, wrapperMaxHeight},
BackgroundComplex = {Left = {'', 0, 0.4, 0,1, 100}, Right={'', 0.6,1,0,1}, Tile = {'', 0.4,.6,0,1, 100}}, },
title = {
Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline},
@@ -74,41 +81,50 @@
Normal = {
title = {
Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing,
+ Indent = 2,
+ TextColor = {1, .9, .2, 1},
},
titlebg = {
- Gradient = {MinColor = {0,0,0,0.7}, MaxColor = {0,0,0,.35}},
+ Gradient = {MinColor = {0,0,0,0.25}, MaxColor = {0,0,0,.15}},
}
}
},
TrackerBlock = {
Normal = {
titlebg = {
- Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, .19}},
+ Indent = 2,
+ Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .14}},
},
title = {
+ TextColor = {1,1,1,0.5},
Font = {titleFont, titleSize, titleOutline},
Spacing = titleSpacing,
},
status = {
- Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
+ TextColor = {1,1,1,0.5},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
},
statusbg = {
- Gradient = { MinColor = {0.2, .4, 1, 0.25}, MaxColor = {.7, 0, 0.9, .12}},
+ Gradient = { MinColor = {0.2, .4, 1, 0}, MaxColor = {.7, 0, 0.9, .11}},
}
},
Super = {
title = {
+ TextColor = {1,1,1,1},
Font = {titleFont, titleSize, titleOutline},
Spacing = titleSpacing, BackgroundFullWidth = true
},
titlebg = {
- Gradient = { MinColor = {0, .7, .6, .8}, MaxColor = {0, .7, .6, 0.2}},
+ Gradient = { MinColor = {0, .7, .6, .45}, MaxColor = {0, .7, .6, 0.23}},
},
status = {
- Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
+ TextColor = {1,1,1,1},
+ Font = {textFont, textSize, textOutline},
+ Spacing = textSpacing,
},
statusbg = {
- Gradient = { MinColor = {0, .7, .6, 0.5}, MaxColor = {0, .7, .6, 0.1} },
+ Gradient = { MinColor = {0, .7, .6, 0.40}, MaxColor = {0, .7, .6, 0.23} },
},
},
MouseDown = {
@@ -129,12 +145,14 @@
},
Complete = {
title = {
+ TextColor = {1,1,1,0.5},
Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing,
},
titlebg = {
Gradient = { MinColor = {0, 1, 0, 0.34}, MaxColor = {0, 1, 0, .17}, },
},
status = {
+ TextColor = {1,1,1,0.5},
Font = {textFont, textSize, textOutline}, Spacing = textSpacing,
},
statusbg = {
@@ -203,6 +221,7 @@
mod.regionStyles = {}
mod.SetBlockStyle = function(frame, frameType, ...)
-- var names intended to reflect argument order
+ print('|cFFFFFF00'..frame:GetName()..'|r')
--@debug@
local c = mod.defaults.Normal
local style_list = {... }
@@ -265,8 +284,6 @@
end
end
style_cache[styleName] = style
- else
- print('Cache hit: ', styleName)
end
local style = style_cache[styleName]
@@ -314,44 +331,39 @@
print('storing style func', styleName, result())
style_cache_func[styleName] = result()
- else
- print('Cache function hit:', styleName)
end
style_cache_func[styleName](frame)
--- Hardcoding the sizing vars for sanity
local normalSettings = mod.defaults.Style.Format
- frame.titleHeight = frame.title and (frame.title:GetStringHeight() + frame.title.spacing*2) or 0
- frame.statusHeight = frame.status and (frame.status:GetStringHeight() + frame.status.spacing*2 + frame.attachmentHeight) or 0
- frame.height = frame.titleHeight + frame.statusHeight
+ frame.titleHeight = frame.title and (frame.title:GetStringHeight() + (frame.title.spacing or 0)*2) or 0
+ frame.statusHeight = frame.status and (frame.status:GetStringHeight() + (frame.status.spacing or 0)*2) or 0
+ frame.height = frame.titleHeight + frame.statusHeight + (frame.attachmentHeight or 0)
frame.width = normalSettings.Frame.Width
frame.statusWidth = frame.width - normalSettings.status.Indent
frame.titleWidth = frame.width - normalSettings.title.Indent
if frame.status then
- print('status ', frame.statusHeight, normalSettings.status.Indent, 0)
+ print('status ', frame.statusHeight, normalSettings.status.Indent, 0, 'statusbg', frame.statusHeight)
frame.status:SetPoint('LEFT', frame, 'LEFT', normalSettings.status.Indent, 0)
frame.status:SetHeight(frame.statusHeight)
if frame.statusbg then
- print('statusbg', frame.statusHeight)
- frame.statusbg:SetHeight(frame.statusHeight)
+ frame.statusbg:SetHeight(frame.statusHeight + (frame.attachmentHeight or 0))
frame.statusbg:SetWidth(frame.width)
end
end
if frame.title then
- print('title ',frame.titleHeight, normalSettings.title.Indent)
+ print('title ',frame.titleHeight, normalSettings.title.Indent, 'titlebg',frame.titleHeight)
frame.title:SetPoint('LEFT', frame, 'LEFT', normalSettings.title.Indent)
frame.title:SetHeight(frame.titleHeight)
if frame.titlebg then
- print('titlebg',frame.titleHeight)
frame.titlebg:SetHeight(frame.titleHeight)
frame.titlebg:SetWidth(frame.width)
end
end
+ frame:SetSize(frame.width, frame.height)
print('sizing frame', frame.width, frame.height)
- frame:SetSize(frame.width, frame.height)
- print(frame:GetSize())
--[[
local titleSpacing, titleSpacing2 = c.Title.Spacing, (c.Title.Spacing * 2)
local textSpacing, textSpacing2 = c.Text.Spacing, (c.Text.Spacing * 2)
@@ -379,13 +391,53 @@
--]]
--print(' |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')')
end
+local segments = {'Left', 'Right', 'Tile' }
+local Wrapper = _G.VeneerObjectiveWrapper
+mod.UpdateWrapperStyle = function()
+ local c = mod.Conf.Wrapper
+ --Wrapper:ClearAllPoints()
+ --Wrapper:SetPoint(c.WrapperPoint, UIParent, c.WrapperPoint, c.WrapperFloatX, c.WrapperFloatY)
+end
+
+mod.Tracker.SetBlockTags = function(block, info)
+ if info.isComplete then
+ block.mainStyle = 'Complete'
+ end
+ if info.superTracked then
+ block.subStyle = 'Super'
+ elseif info.isDaily then
+ block.subStyle = 'Daily'
+ end
+end
+local unitLevel = UnitLevel('player')
+mod.Quest.SetBlockTags = function(block, info)
+
+ mod.Tracker.SetBlockTags(block, info)
+ if info.level then
+ local levelDiff = unitLevel - info.level
+ if levelDiff > 9 then
+ block.title:SetTextColor(0.7, 0.7, 0.7, 1)
+ elseif levelDiff > 1 then
+ block.title:SetTextColor(0.5, 1, 0.5, 1)
+ elseif levelDiff < -1 then
+ block.title:SetTextColor(1, 0.4, 0.25, 1)
+ elseif levelDiff < -4 then
+ block.title:SetTextColor(1, 0, 0, 1)
+ else
+ block.title:SetTextColor(1,1,1,1)
+ end
+ end
+end
+mod.Cheevs.SetBlockTags = function(block, info)
+ mod.Tracker.SetBlockTags(block, info)
+end
--- Argument containers
-local o = "" -- text flag
-local a1, a2, a3, a4, b1, b2, b3, b4 = 0,0,0,1, 0,0,0,1 -- color1, color2
-local f1, f2, f3 = "", 0, "" -- font
-local w1, w2 = 0, 0 -- size
-local p1, p2, p3, x, y = "", "", "", 0, 0 -- path/point args
+local o -- text flag
+local a1, a2, a3, a4, b1, b2, b3, b4 -- color1, color2
+local f1, f2, f3 -- font
+local w1, w2 -- size
+local p1, p2, p3, x, y -- path/point args
mod.SetBlockAttribute = {}
local sb = mod.SetBlockAttribute
local print = B.print('Attribute')
@@ -415,7 +467,7 @@
end
sb.Spacing = function(region, value)
- print('FontSpacing', value)
+ print('FontSpacing', region:GetName(), value)
region:SetSpacing(value)
region.spacing = value
end
@@ -446,4 +498,5 @@
sb.Size = function(region, value)
w1, w2 = unpack(value)
region:SetSize(w1, w2)
-end
\ No newline at end of file
+end
+
diff -r 9455693fc290 -r ed642234f017 ObjectiveTracker.xml
--- a/ObjectiveTracker.xml Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveTracker.xml Mon Apr 04 03:16:22 2016 -0400
@@ -1,33 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
self.toggle = true
@@ -92,11 +65,6 @@
-->
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -209,8 +200,8 @@
-
-
+
+
@@ -220,9 +211,20 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -297,7 +299,6 @@
-
diff -r 9455693fc290 -r ed642234f017 ObjectiveUI.lua
--- a/ObjectiveUI.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveUI.lua Mon Apr 04 03:16:22 2016 -0400
@@ -24,10 +24,10 @@
end
Tracker.OnMouseUp = function(self, button)
+ print(self.handler.name, self.mainStyle, self.subStyle)
if button == 'LeftButton' then
if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then
self:Link()
- self:SetStyle('TrackerBlock', self.info.type, 'Normal')
elseif IsModifiedClick("QUESTWATCHTOGGLE") then
self:Remove()
else
@@ -35,16 +35,16 @@
end
elseif button == 'RightButton' then
self:Open()
- self:SetStyle('TrackerBlock', self.info.type, 'Normal')
end
self.initialButton = nil
self.modChatLink = nil
self.modQuestWatch = nil
+ self:SetStyle('TrackerBlock', self.handler.name, self.mainStyle, self.subStyle)
print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r')
end
Tracker.OnMouseDown = function(self, button)
- self:SetStyle('TrackerBlock', 'MouseDown')
+ self:SetStyle('TrackerBlock', self.handler.name, 'MouseDown')
print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE"))
print(self.info.title)
end
diff -r 9455693fc290 -r ed642234f017 ObjectiveWidgets.lua
--- a/ObjectiveWidgets.lua Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveWidgets.lua Mon Apr 04 03:16:22 2016 -0400
@@ -5,6 +5,122 @@
local GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, IsQuestLogSpecialItemInRange, GetQuestLogSpecialItemCooldown
local CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll = CooldownFrame_SetTimer, SetItemButtonTextureVertexColor, CreateFrame, VeneerObjectiveScroll
local tremove, tinsert, tContains, pairs, setmetatable = tremove, tinsert, tContains, pairs, setmetatable
+
+--- frame refs
+local Wrapper = _G.VeneerObjectiveWrapper
+local Scroller = Wrapper.scrollArea
+local CloseButton = Wrapper.CloseButton
+local QuestMapButton = Wrapper.QuestMapButton
+local Scroll = _G.VeneerObjectiveScroll
+
+local panelButtons = {
+ CloseButton = {
+ closedSwatch = {
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ 0, 0.5, 0.5, 1,
+ 0.5, 1, 0.5, 1,
+ },
+ openSwatch = {
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ [[Interface\Buttons\UI-Panel-QuestHideButton]],
+ 0.5, 1, 0.5, 1,
+ 0, 0.5, 0.5, 1,
+ },
+ parent = 'VeneerObjectiveWrapper'
+ },
+ QuestMapButton = {
+ closedSwatch = {
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ 0, 1, 0.5, 1,
+ 0, 1, 0, 0.5,
+ },
+ openSwatch = {
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ [[Interface\QUESTFRAME\UI-QUESTMAP_BUTTON]],
+ 0, 1, 0, 0.5,
+ 0, 1, 0.5, 1,
+ }
+ }
+}
+
+local Scroller_OnShow = function()
+ Wrapper.watchMoneyReasons = 0;
+ mod.UpdateWrapper()
+ mod.SetEvents()
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Show()
+ end
+end
+
+local Scroller_OnHide = function()
+ local self = Wrapper
+ Wrapper:UnregisterAllEvents()
+ Wrapper:SetScript('OnEvent', nil)
+ for i, region in ipairs(Wrapper.headerComplex) do
+ region:Hide()
+ end
+end
+
+local Scroller_OnMouseWheel = function(self, delta)
+ local r = Scroll:GetHeight() - Scroller:GetHeight()
+ local s = B.Conf.ObjectiveScroll - delta * floor(r/5+.5)
+ local from = self:GetVerticalScroll()
+ if s >= r then
+ s = r
+ elseif s < 1 then
+ s = 0
+ end
+ self:SetVerticalScroll(s)
+ B.Conf.ObjectiveScroll = s
+ print('|cFF00FF00OnMouseWheel', 'from = ', from, 'scroll =', s, ' range =', r, 'current =', self:GetVerticalScroll())
+
+ mod.UpdateActionButtons('SCROLLING')
+end
+
+local UpdatePanelButton = function (self, state)
+ state = state and B.Conf.FrameState[state] or 1
+ local swatch = (state == 1) and self.openSwatch or self.closedSwatch
+ self:SetNormalTexture(swatch[1])
+ self:SetPushedTexture(swatch[2])
+ if #swatch >= 6 then
+ self:GetNormalTexture():SetTexCoord(swatch[3], swatch[4], swatch[5], swatch[6])
+ end
+ if #swatch == 10 then
+ self:GetPushedTexture():SetTexCoord(swatch[7], swatch[8], swatch[9], swatch[10])
+ end
+
+end
+
+local OnClick = {}
+OnClick.CloseButton = function(self)
+ Wrapper:Minimize()
+ UpdatePanelButton(self, self.parent)
+end
+
+OnClick.QuestMapButton = function()
+ ToggleWorldMap()
+end
+
+mod.InitializeWrapperWidgets = function()
+ --- tracker scroll
+ Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel)
+ Scroller:SetScript('OnShow', Scroller_OnShow)
+ Scroller:SetScript('OnHide', Scroller_OnHide)
+ for name, swatch in pairs(panelButtons) do
+ local source = swatch and swatch or panelButtons.CloseButton
+ local button = Wrapper[name]
+ button.parent = swatch.parent
+ button.openSwatch = source.openSwatch
+ button.closedSwatch = source.closedSwatch
+ if OnClick[name] then
+ button:SetScript('OnClick', OnClick[name])
+ end
+ UpdatePanelButton(button, button.parent)
+ end
+end
+
----------------------------------------------------------------------------------------
--- XML and script code lifted from "QuestKing 2" by Barjack,
--- found at http://mods.curse.com/addons/wow/questking
@@ -152,13 +268,13 @@
--- Get a usable widget for the given achievement criteria set.
-- Returns a frame object with dimensioning parameters needed to size the receiving tracker block
-mod.SetWidget = function(obj, info)
+mod.SetWidget = function(line, info, objectiveType, objectiveKey)
local print = B.print('ObjectiveWidgets')
- local widgetType = obj.type
+ local widgetType = objectiveType
local widget
- if wr[widgetType] and wr[widgetType].used[obj.criteriaID] then
- widget = wr[widgetType].used[obj.criteriaID]
- print('|cFF00FF00Updating ('..obj.criteriaID..')', widget)
+ if wr[widgetType] and wr[widgetType].used[objectiveKey] then
+ 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)
@@ -168,9 +284,11 @@
print('|cFFFFFF00Acquiring released widget', widget:GetName())
end
- wr[widgetType].used[obj.criteriaID] = widget
- widget.info = obj
- widget.parentInfo = info
+
+ wr[widgetType].used[objectiveKey] = widget
+ widget.line = line
+ widget.info = info
+ widget.key = objectiveKey
mod.InitializeWidget(widget)
return widget
end
@@ -195,7 +313,6 @@
local maxWidth = 250
frame:SetWidth(maxWidth)
- mod.UpdateWidget[frame.widgetType](frame)
frame:SetScript('OnEvent', mod.UpdateWidget[frame.widgetType])
if frame.info.isCurrency then
frame:RegisterEvent('CHAT_MSG_CURRENCY')
@@ -206,8 +323,8 @@
frame:RegisterEvent('CRITERIA_UPDATE')
frame:RegisterEvent('CRITERIA_COMPLETE')
frame:RegisterEvent('CRITERIA_EARNED')
-
- return t[frame.widgetType](frame)
+ t[frame.widgetType](frame)
+ mod.UpdateWidget[frame.widgetType](frame)
end,
})
@@ -227,10 +344,10 @@
mod.ReleaseWidget = function(frame)
local print = B.print('ObjectiveWidgets')
local reg = wr[frame.widgetType]
- if reg and reg.used[frame.info.criteriaID] then
- reg.used[frame.info.criteriaID] = nil
+ if reg and reg.used[frame.key] then
+ reg.used[frame.key] = nil
+ frame.line = nil
frame.info = nil
- frame.parentInfo = nil
frame:UnregisterAllEvents()
tinsert(reg.free, frame)
print('|cFFBBBBBBreleased from service', frame:GetName())
@@ -241,23 +358,30 @@
mod.CleanWidgets = function()
local print = B.print('ObjectiveWidgets')
local tracked = {GetTrackedAchievements() }
+ local tasks = GetTasksTable()
for type, reg in pairs(mod.WidgetRegistry) do
print('collecting', type)
- for criteriaID, frame in pairs(reg.used) do
- local id = frame.info.cheevID
+ for key, frame in pairs(reg.used) do
+ if frame.info.cheevID then
+ local id = frame.info.cheevID
- if id and not tContains(tracked, id) then
+ if id and not tContains(tracked, id) then
- print(' untracked achievement', id, 'associated with', criteriaID, frame:GetName())
- frame:Hide()
+ print(' untracked achievement', id, 'associated with', key, frame:GetName())
+ frame:Hide()
+ end
+ elseif frame.info.questID then
+ -- do something for quest task
end
end
end
end
-mod.defaults.WidgetVars = {
+
+mod.defaults.WidgetStyle = {
ProgressBar = {
+ Spacing = 4,
bg = {
Height = 20,
},
@@ -265,33 +389,42 @@
Height = 16,
},
status = {
- FontObject = _G.VeneerFontNormal
+ FontObject = _G.VeneerCriteriaFontNormal
}
}
}
mod.InitializeWidget.ProgressBar = function(self)
- local c = mod.defaults.WidgetVars.ProgressBar
- local params = mod.WidgetParams[self.widgetType]
- self.height = params.height
+ local c = mod.defaults.WidgetStyle.ProgressBar
+ self.height = c.bg.Height + c.Spacing
self:SetHeight(c.bg.Height)
self.bg:SetHeight(c.bg.Height)
self.fg:ClearAllPoints()
- self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 2, 2)
+ self.indent = (c.bg.Height - c.fg.Height) / 2
+ self.fg:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', self.indent, self.indent)
self.fg:SetHeight(c.fg.Height)
self.status:SetFontObject(c.status.FontObject)
self.status:SetText(self.info.quantityString)
end
mod.UpdateWidget.ProgressBar = function (self)
- local quantity, requiredQuantity = self.info.quantity, self.info.requiredQuantity
+ local quantity, requiredQuantity = self.line.value, self.line.maxValue
+ print('update vals:')
+ for k,v in pairs(self.line) do
+ print(k, v)
+ end
- if self.info.finished then
- self.fg:SetWidth(self.bg:GetWidth() - 4)
+ if self.line.format then
+ self.status:SetFormattedText(self.line.format, self.line.value, self.line.maxValue)
+ end
+
+
+ if self.line.finished then
+ self.fg:SetWidth(self.bg:GetWidth() - self.indent)
elseif quantity == 0 then
self.fg:Hide()
else
self.fg:Show()
- self.fg:SetWidth((self.bg:GetWidth()-4) * (quantity / requiredQuantity))
+ self.fg:SetWidth((self.bg:GetWidth() -self.indent) * (quantity / requiredQuantity))
end
end
diff -r 9455693fc290 -r ed642234f017 ObjectiveWidgets.xml
--- a/ObjectiveWidgets.xml Sat Apr 02 17:46:52 2016 -0400
+++ b/ObjectiveWidgets.xml Mon Apr 04 03:16:22 2016 -0400
@@ -19,7 +19,7 @@
-
+
@@ -31,11 +31,17 @@
-
+
+
+
+
+
+
+
-
+