# HG changeset patch
# User Nenue
# Date 1472296194 14400
# Node ID d9d16e67725c88589b86913d42bd1df65a58bb70
# Parent cd6e78091b04a065f28828c562eab2368cff6145
- refactor objectives plugin
diff -r cd6e78091b04 -r d9d16e67725c Modules/BuffFrame.lua
--- a/Modules/BuffFrame.lua Tue Aug 23 19:50:10 2016 -0400
+++ b/Modules/BuffFrame.lua Sat Aug 27 07:09:54 2016 -0400
@@ -11,6 +11,7 @@
- BuffButtons can only be hidden/shown by blizzcode, so functions doing that have to be accounted for
--]]
+local BUFFS_PER_ROW = 12
local BUFF_BUTTON_SIZE = 48
local BUFF_BUTTON_SPACING_H = 4
local BUFF_BUTTON_SPACING_V = 14
@@ -21,10 +22,12 @@
local BORDER_SIZE_R = 0
local BORDER_SIZE_U = 4
local BORDER_SIZE_D = 0
+local BUFF_FRAMES_X = -230
+local BUFF_FRAMES_Y = -4
local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent)
-local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
+local vn, print = LibStub("LibKraken").register(Veneer, plugin)
local tprint = DEVIAN_WORKSPACE and function(...) _G.print('Timer', ...) end or function() end
local _G, UIParent = _G, UIParent
@@ -33,44 +36,42 @@
local UnitAura, GetTime, CreateFrame = UnitAura, GetTime, CreateFrame
local hooksecurefunc = hooksecurefunc
-local buttons = {}
-local buffTypes = {
+local aurasCache = {}
+local skinnedFrames = {}
+local pendingFrames = {}
+local veneers = {}
+local expirationCache = {}
+local visibility = {}
+local isHooked = {}
+
+plugin.options = {
+ nameString = 'Buff Frames',
{
- name = 'buff',
- pattern = 'BuffButton(%d)',
- filters = 'HELPFUL',
+ name = 'BuffButtonZoom',
+ type = 'slider',
+ min = 0,
+ max = 100,
+ fullwidth = true,
},
{
- name = 'debuff',
- pattern = 'DebuffButton(%d)',
- filters = 'HARMFUL',
+ name = 'BuffBorderLeft',
+ type = 'slider',
+ min = 0,
+ max = 16,
},
{
- name = 'tempenchant',
- pattern = 'TempEnchant(%d)',
- filters = 'TEMPENCHANT'
+ name = 'BuffBorderLeft',
+ type = 'slider',
+ min = 0,
+ max = 16,
}
}
-local textureMapping = {
- [1] = 16, --Main hand
- [2] = 17, --Off-hand
- [3] = 18, --Ranged
-}
-
-local tickCounter = {}
-local aurasCache = {}
-local skinnedFrames = {}
-local pendingFrames = {}
-local anchors = {}
-local expirationCache = {}
-local visibility = {}
-
-
local GetVeneer = function(frame)
- local name = frame:GetName()
- if not (_G[name..'Veneer']) then
+
+ if not (veneers[frame]) then
+ local name = frame:GetName()
print('|cFF88FF00Creating', name,'Veneer')
local veneer = vn.GetVeneer(frame, 'VeneerBuffTemplate')
local id = frame:GetID()
@@ -80,7 +81,10 @@
veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1)
veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
- veneer.progress.fg:SetColorTexture(0,1,0,1)
+ veneer.progress.bg:SetColorTexture(0,0,0,1)
+
+ veneer.progress.fg:SetColorTexture(1,1,1,1)
+ veneer.progress.fg:ClearAllPoints()
veneer.progress.fg:SetPoint('BOTTOMLEFT', BUFF_PROGRESS_INSET,BUFF_PROGRESS_INSET)
veneer.progress.fg:SetPoint('TOP', 0, -BUFF_PROGRESS_INSET)
@@ -100,10 +104,11 @@
veneer.border:Show()
+ veneers[frame] = veneer
end
- return _G[name..'Veneer']
+ return veneers[frame]
end
@@ -141,7 +146,7 @@
end
veneer.progress.fg:SetColorTexture(color.r,color.g,color.b)
- veneer.border:SetColorTexture(color.r,color.g,color.b)
+ veneer.border:SetColorTexture(0,0,0,1)
end
if duration then
duration:ClearAllPoints()
@@ -205,12 +210,8 @@
veneer.underlay:Show()
end)
- anchors[frame] = veneer
end
-local Aura_SetBorderColor = function(self, r,g,b,a) end
-local Aura_OnShow = function(self) end
-local Aura_OnHide = function(self) end
--- Set widgets to reflect the passed parameters
local UpdateVeneer = function (frame, duration, expires)
@@ -294,7 +295,6 @@
local bName = name..index
local frame = _G[bName]
if frame and frame:IsVisible() then
- tickCounter[frame] = (tickCounter[frame] or 0) + 1
local cacheDiff = CacheCheck(frame, UnitAura(frame.unit, frame:GetID(), frame.filter))
-- if the name or expirationTime changed
if (cacheDiff >= 1) then
@@ -338,9 +338,9 @@
if buff then
numBuffs = numBuffs + 1
buff:ClearAllPoints()
- if mod(numBuffs,12) == 1 then
+ if mod(numBuffs,BUFFS_PER_ROW) == 1 then
if numBuffs == 1 then
- buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
+ buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y)
plugin.currentTop = buff:GetTop()
else
buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
@@ -365,7 +365,7 @@
debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
end
topBuff = debuff
- elseif mod(numBuffs, 12) == 1 then
+ elseif mod(numBuffs, BUFFS_PER_ROW) == 1 then
debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
topBuff = debuff
else
@@ -398,7 +398,7 @@
if not veneer.duration.getHuge then
veneer.duration.getHuge = true
veneer.duration:SetFontObject(VeneerNumberFontLarge)
- veneer.duration:SetTextColor(1,0,0,1)
+ veneer.duration:SetTextColor(1,1,0,1)
end
else
if veneer.duration.getHuge then
diff -r cd6e78091b04 -r d9d16e67725c Modules/PaperDoll.lua
--- a/Modules/PaperDoll.lua Tue Aug 23 19:50:10 2016 -0400
+++ b/Modules/PaperDoll.lua Sat Aug 27 07:09:54 2016 -0400
@@ -6,7 +6,7 @@
-- Requires tooltip scraping to obtain these numbers, meaning any currently active tooltip will be cleared.
local plugin = CreateFrame('Frame', 'VeneerPaper', UIParent)
-local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
+local vn, print = LibStub("LibKraken").register(Veneer, plugin)
local slot_anchors = {
[1] = 'TOPLEFT',
diff -r cd6e78091b04 -r d9d16e67725c Options.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Options.lua Sat Aug 27 07:09:54 2016 -0400
@@ -0,0 +1,162 @@
+
+local vn, print = LibStub("LibKraken").register(Veneer, "Options")
+local plugin = CreateFrame('Frame', 'VeneerOptions', UIParent, 'TooltipBorderedFrameTemplate')
+vn.wrap(plugin)
+
+
+local fields = {}
+local templateTypes = {
+ slider = 'Slider',
+ radio = 'Frame',
+ number = 'EditBox',
+ check = 'CheckButton'
+}
+local templateNames = {
+ slider = 'OptionsSliderTemplate',
+ radio = '',
+ number = 'NumericInputSpinnerTemplate',
+ check = 'UICheckButtonTemplate'
+}
+local OnLoad, OnUpdate, OnValueChanged = {}, {}, {}
+local frameHeadings = {}
+
+local framePadding = 14
+local frameMaxWidth = 400
+
+
+local ToggleVeneerOptions = function()
+
+ plugin:Show()
+ if plugin.initialized then
+ return
+ end
+
+ local sizeChanged = false
+ local frameDepth = framePadding
+ local frameWidth = framePadding
+ local lineWidth = framePadding
+ local lineNum = 1
+ local lineColumn = 1
+
+ for i, module in ipairs(vn.modules) do
+ if module.options then
+ if not frameHeadings[module] then
+ frameHeadings[module] = plugin:CreateFontString(nil, 'OVERLAY', 'VeneerNumberFontLarge')
+ frameHeadings[module]:SetText(module.options.nameString or module:GetName())
+ frameHeadings[module].height = frameHeadings[module]:GetHeight()
+
+ frameHeadings[module]:SetPoint('TOPLEFT', plugin, 'TOPLEFT', lineColumn, -frameDepth)
+ frameDepth = frameDepth + frameHeadings[module].height
+ end
+
+ for index, args in ipairs(module.options) do
+ local fullIndex = (i*1000)+index
+ print('config field', fullIndex)
+ if not fields[fullIndex] then
+ fields[fullIndex] = {}
+ end
+ local opt = fields[fullIndex]
+
+ if not opt.frame then
+ sizeChanged = true
+
+ local configType = args.type
+ print('Creating', templateTypes[configType] or 'Frame', 'from', templateNames[configType])
+ opt.frame = CreateFrame(templateTypes[configType] or 'Frame', 'VeneerOptions' .. args.name, plugin, templateNames[configType])
+
+ if OnLoad[configType] then
+ OnLoad[configType](opt.frame, args)
+ end
+ if opt.OnLoad then
+ opt.OnLoad(opt.frame)
+ end
+
+ if args.OnUpdate then
+ opt.frame.Update = function(self)
+ OnUpdate[configType](self, args)
+ args.OnUpdate(self, args)
+ end
+ else
+ opt.frame.Update = function(self)
+ OnUpdate[configType](self, args)
+ end
+ end
+
+ opt.frame:Update()
+
+ opt.frame:SetPoint('TOPLEFT', plugin, 'TOPLEFT', lineColumn, -frameDepth)
+
+
+ opt.name = args.name
+ opt.line = lineNum
+ opt.column = lineColumn
+
+ -- measure after initializer
+ frameDepth = frameDepth + opt.frame:GetHeight()
+ lineWidth = lineWidth + opt.frame:GetWidth()
+ opt.depth = frameDepth
+ opt.width = lineWidth
+ local isOverlapped = (lineWidth > frameMaxWidth)
+ if args.fullwidth or isOverlapped then
+ lineNum = lineNum + 1
+ if isOverlapped then
+ lineWidth = framePadding + opt.frame:GetWidth()
+ lineColumn = 1
+ else
+ lineWidth = framePadding
+ lineColumn = lineColumn + 1
+ end
+ end
+
+ if lineWidth > frameWidth then
+ sizeChanged = true
+ frameWidth = lineWidth
+ end
+
+
+ end
+
+
+
+
+
+
+ end
+ end
+ end
+
+ if sizeChanged then
+ plugin:SetSize(frameWidth + framePadding, frameDepth + framePadding)
+
+ plugin:SetPoint('CENTER')
+ end
+
+end
+
+OnLoad.slider = function(self, args)
+ print('min:', args.min, 'max:', args.max, 'steps:', args.step)
+ self:SetMinMaxValues(args.min or 0, args.max or 420)
+ self:SetValueStep(1)
+ self:SetStepsPerPage(5)
+ self:SetObeyStepOnDrag(true)
+end
+
+OnUpdate.slider = function(self, args)
+ local base = args.handler or vn.db
+ self:SetValue(vn.db[self.name] or 1)
+end
+
+OnValueChanged.slider = function()
+end
+
+plugin.cmd = function(cmd)
+ cmd = string.lower(cmd)
+ if cmd:match('config') then
+ ToggleVeneerOptions()
+ return true
+ end
+end
+
+plugin.init = function()
+ --ToggleVeneerOptions()
+end
diff -r cd6e78091b04 -r d9d16e67725c Veneer.lua
--- a/Veneer.lua Tue Aug 23 19:50:10 2016 -0400
+++ b/Veneer.lua Sat Aug 27 07:09:54 2016 -0400
@@ -1,7 +1,7 @@
-- Veneer
-- Base framework for making things draggable.
-local vn, print = LibStub("LibKraken").register(VeneerController)
+local vn, print = LibStub("LibKraken").register(Veneer)
local defaults = {
@@ -178,6 +178,15 @@
SLASH_VENEER1 = "/veneer"
SLASH_VENEER2 = "/vn"
-SlashCmdList.VENEER = function()
+SlashCmdList.VENEER = function(cmd)
+ for i, module in pairs(vn.modules) do
+ if module.cmd then
+ local result = module.cmd(cmd)
+ if result then
+ return
+ end
+ end
+ end
+
ToggleVeneerConfig()
end
\ No newline at end of file
diff -r cd6e78091b04 -r d9d16e67725c Veneer.toc
--- a/Veneer.toc Tue Aug 23 19:50:10 2016 -0400
+++ b/Veneer.toc Sat Aug 27 07:09:54 2016 -0400
@@ -10,6 +10,7 @@
## OptionalDeps: Devian
Veneer.xml
+Options.lua
Modules\BuffFrame.lua
Modules\PaperDoll.lua
Modules\ObjectiveTracker.lua
\ No newline at end of file
diff -r cd6e78091b04 -r d9d16e67725c Veneer.xml
--- a/Veneer.xml Tue Aug 23 19:50:10 2016 -0400
+++ b/Veneer.xml Sat Aug 27 07:09:54 2016 -0400
@@ -3,12 +3,18 @@
+
+
+
+
+
+
-
+
@@ -132,7 +138,9 @@
-
+
+
+
@@ -151,6 +159,9 @@
+
+
+
\ No newline at end of file