Mercurial > wow > buffalo2
changeset 61:3f083d389c18
- don't send updates for BuffAnchors hook
author | Nenue |
---|---|
date | Mon, 15 Aug 2016 09:35:46 -0400 |
parents | 2a636b00c31e |
children | ef4116179e2f |
files | Modules/BuffFrame.lua Veneer.lua Veneer.xml |
diffstat | 3 files changed, 86 insertions(+), 98 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/BuffFrame.lua Mon Aug 15 07:23:56 2016 -0400 +++ b/Modules/BuffFrame.lua Mon Aug 15 09:35:46 2016 -0400 @@ -2,7 +2,7 @@ -- BuffFrame.lua -- Created: 7/27/2016 8:08 PM -- %file-revision% --- +-- Adds progress bars and cooldown swirls to buffbutton frames local PLUGIN_NAME = 'BuffFrame' local plugin = {} @@ -66,8 +66,7 @@ veneer:SetAllPoints(frame) veneer:SetParent(frame) veneer.bg = veneer:CreateTexture() - veneer.bg:SetColorTexture((id / 16),0,1-(id/16),0.5) - print(id, id/16) + veneer.bg:SetColorTexture(1,1,1,0) veneer.bg:SetAllPoints(veneer) veneer.bg:Show() veneer:Hide() @@ -87,7 +86,7 @@ veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', -3, -1) veneer.progress.bg = veneer.progress:CreateTexture(nil, 'BACKGROUND') - veneer.progress.bg:SetColorTexture(0,0,0,0.5) + veneer.progress.bg:SetColorTexture(0,0,0,1) veneer.progress.bg:SetAllPoints(veneer.progress) veneer.progress.fg = veneer.progress:CreateTexture(nil, 'ARTWORK') @@ -99,40 +98,65 @@ veneer.progress.status:SetFontObject(VeneerNumberFont) veneer.progress.status:SetPoint('TOP') + + veneer.cooldown = CreateFrame('Cooldown', name ..'VeneerCooldown', veneer, 'CooldownFrameTemplate') + veneer.cooldown:SetAllPoints(frame) + veneer.cooldown:SetReverse(true) + end return _G[name..'Veneer'] end +--- Set widgets to reflect the passed parameters local UpdateVeneer = function (frame, duration, expires) local veneer = GetVeneer(frame) - if expires and (duration ~= 0) then - veneer.progress:Show() + if expires and duration then - local startTime = (expires - duration) - local endTime = expires or 0 - print('|cFF0088FF'..frame:GetName()..'|r', 'has expiration', startTime, 'to', endTime, 'over', duration, 'frame', veneer.progress:GetWidth()) - veneer.progress:SetScript('OnUpdate', function(self) - local w = floor(veneer.progress:GetWidth()+.5) - local t = GetTime() - local progress = (t - startTime) / duration + if duration ~= 0 then + local startTime = (expires - duration) + local endTime = expires or 0 + print('|cFF0088FF'..frame:GetName()..'|r', duration, expires) + veneer.progress:Show() + veneer.elapsed = 0 + veneer.progress:SetScript('OnUpdate', function(self, elapsed) + veneer.elapsed = veneer.elapsed + elapsed - local nw = w - ceil(w * progress) - print(progress, nw, w) - if (progress >= 1) or not frame:IsVisible() then - veneer.startTime = nil - self:Hide() - self:SetScript('OnUpdate', nil) - else - self.fg:SetWidth(nw) - end - end) + local w = floor(veneer.progress:GetWidth()+.5) + local t = GetTime() + local progress = (t - startTime) / duration + + local nw = (w-2) - ceil(w * progress) + if veneer.elapsed >= 0.25 then + + print(progress, nw, w) + veneer.elapsed = 0.25 - veneer.elapsed + end + if (progress >= 1) or not frame:IsVisible() then + veneer.startTime = nil + self:Hide() + self:SetScript('OnUpdate', nil) + else + self.fg:SetWidth(nw) + end + end) + + veneer.cooldown:Show() + veneer.cooldown:SetCooldown(startTime, duration) + else + print('|cFF00FF88'..frame:GetName()..'|r', 'duration zero') + veneer.progress:SetScript('OnUpdate', nil) + veneer.progress:Hide() + veneer.cooldown:Hide() + end + else + veneer.progress:Hide() + veneer.cooldown:SetCooldown(0,0) + veneer.cooldown:Hide() + print('|cFF88FF00'..frame:GetName()..'|r', 'nil duration') end - - - veneer:Show() end @@ -162,7 +186,7 @@ end if duration then duration:ClearAllPoints() - duration:SetPoint('BOTTOM') + duration:SetPoint('TOP', frame, 'BOTTOM', 0, -8) duration:SetFontObject(VeneerNumberFont) duration:SetDrawLayer('OVERLAY') @@ -196,15 +220,12 @@ if frame and frame:IsVisible() then tickCounter[frame] = (tickCounter[frame] or 0) + 1 local cacheDiff = CacheCheck(frame, UnitAura(frame.unit, frame:GetID(), frame.filter)) - -- did something change? - if (cacheDiff >= 1) or not skinnedFrames[frame] then + -- if the name or expirationTime changed + if (cacheDiff >= 1) then print(frame:GetName(), 'diff:', cacheDiff) - tinsert(pendingFrames, frame) - end - - - if frame.expirationTime ~= expirationCache[name] then - print('|cFFBBFF00expirationTime|r', name, frame.expirationTime) + if not skinnedFrames[frame] then + tinsert(pendingFrames, frame) + end expirationCache[name] = frame.expirationTime print(unpack(aurasCache[frame])) UpdateVeneer(frame, aurasCache[frame][6], aurasCache[frame][7]) @@ -226,16 +247,15 @@ local frame = tremove(pendingFrames) tinsert(todo, frame:GetName()) - UpdateVeneer(frame) - - + -- re-apply custom anchors end print(table.concat(todo, ', ')) end --BuffButton1 --DebuffButton1 + --todo: separate frame groups and iterate over them at appropriate times if BuffButton1 then - TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0) + --TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0) end end @@ -249,16 +269,13 @@ timeString = format('%d:%02d', hours, minutes) elseif timeLeft > 60 then timeString = format('%d:%02d', minutes, seconds) - elseif timeLeft > 10 then + else timeString = format('%d', seconds) - else - timeString = format('%0.1f', mod(timeLeft, 60)) end frame.duration:SetText(timeString) frame.duration:SetVertexColor(1,1,1) - end local visibility = {} @@ -305,7 +322,7 @@ end local BuffFrame_Update = function(...) - --print('Time for udpate!', ...) + end @@ -325,5 +342,8 @@ end plugin.init = function () + + + plugin.db = vn.db[PLUGIN_NAME] end \ No newline at end of file
--- a/Veneer.lua Mon Aug 15 07:23:56 2016 -0400 +++ b/Veneer.lua Mon Aug 15 09:35:46 2016 -0400 @@ -16,7 +16,6 @@ BuffFrame = { width = 48, height = 48, - } } @@ -24,9 +23,5 @@ if (not VeneerData) or (not VeneerData.version) then VeneerData = defaults end - - - - vn.db = VeneerData end \ No newline at end of file
--- a/Veneer.xml Mon Aug 15 07:23:56 2016 -0400 +++ b/Veneer.xml Mon Aug 15 09:35:46 2016 -0400 @@ -4,56 +4,9 @@ <Font name="VeneerFont_Small" font="Fonts\FRIZQT__.TTF" outline="NORMAL" height="16" /> <Font name="VeneerFont_Large" font="Fonts\FRIZQT__.TTF" outline="NORMAL" height="24" /> + <Font name="VeneerNumberFont" font="Fonts\ARIALN.ttf" outline="NORMAL" height="14" /> + <Font name="VeneerNumberFontLarge" font="Fonts\ARIALN.ttf" outline="NORMAL" height="24" /> - <Font name="VeneerFontNormal" inherits="VeneerFont_Small"> - <Color r="1" g="1" b="1" a="1" /> - </Font> - - <Font name="VeneerFontHighlight" inherits="VeneerFont_Small" outline="NORMAL"> - <Color r="0" g=".7" b="1" a="1" /> - </Font> - <Font name="VeneerFontHighlightLarge" inherits="VeneerFont_Large"> - <Color r="0" g=".7" b="1" a="1" /> - </Font> - - - <Texture name="VnTestLine" virtual="true"> - <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\Veneer\Font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="14" > - <Color r="1" g="1" b="1" a="1" /> - </Font> - <Font name="VeneerNumberFontSmall" virtual="true" font="Interface\Addons\Veneer\Font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="12" > - <Color r="1" g="1" b="1" a="1" /> - </Font> - <Font name="VeneerTitleFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf" outline="NORMAL" height="15" > - <Color r="1" g="1" b="1" a="1" /> - </Font> - - <Font name="VeneerCriteriaFontNormal" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf" outline="NORMAL" height="16"> - <Color r="1" g="1" b="1" a="1" /> - </Font> - <Font name="VeneerCriteriaFontComplete" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf" outline="NORMAL" height="16"> - <Color r="0" g="1" b="0" a=".75" /> - </Font> - <Font name="VeneerCriteriaFontProgressed" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf" outline="NORMAL" height="16"> - <Color r="1" g="1" b="0" a="1" /> - </Font> - - <Font name="VeneerCriteriaFontFailed" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf" outline="NORMAL" height="16"> - <Color r="1" g=".4" b="0" a=".75" /> - </Font> - - <Font name="VeneerStatusFont" virtual="true" font="Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf" outline="NORMAL" height="14"> - <Color r="1" g="1" b="0" a="1" /> - </Font> - - <Frame name="VeneerHandlerTemplate" parent="UIParent" virtual="true" /> <Frame name="VeneerController" hidden="true" enableMouse="true" movable="true" parent="UIParent" frameStrata="DIALOG"> <Size x="400" y="400" /> @@ -131,6 +84,26 @@ </Frames> </Frame> + <Button name="VeneerAuraButton" inherits="SecureActionButtonTemplate" virtual="true"> + <Size x="32" y="32" /> + <Layers> + <Layer level="ARTWORK"> + <FontString inherits="VeneerFont_Small" parentKey="label"> + <Anchors> + <Anchor point="LEFT" /> + </Anchors> + </FontString> + </Layer> + </Layers> + <NormalTexture setAllPoints="true"> + + <Color a="1" r="1" g="1" b="1" /> + </NormalTexture> + <PushedTexture setAllPoints="true"> + + <Color a="1" r="1" g="0" b="0" /> + </PushedTexture> + </Button> <Script file="Veneer.lua" />