Nenue@59
|
1 -- Veneer
|
Nenue@59
|
2 -- BuffFrame.lua
|
Nenue@59
|
3 -- Created: 7/27/2016 8:08 PM
|
Nenue@59
|
4 -- %file-revision%
|
Nenue@62
|
5 --[[
|
Nenue@62
|
6 Adds progress bars and cooldown swirls to buffbutton frames
|
Nenue@60
|
7
|
Nenue@62
|
8 Known Limitations:
|
Nenue@62
|
9 - Individual BuffButton frames are created upon use, making it difficult to do any sort of securestate priming
|
Nenue@62
|
10 - TempEnchant info returns relative values only, and they don't synchronize with aura events
|
Nenue@62
|
11 - BuffButtons can only be hidden/shown by blizzcode, so functions doing that have to be accounted for
|
Nenue@62
|
12 --]]
|
Nenue@62
|
13
|
Nenue@64
|
14 local BUFF_BUTTON_SIZE = 48
|
Nenue@71
|
15 local BUFF_BUTTON_SPACING_H = 4
|
Nenue@71
|
16 local BUFF_BUTTON_SPACING_V = 14
|
Nenue@64
|
17 local BUFF_PROGRESS_SIZE = 4
|
Nenue@64
|
18 local BUFF_PROGRESS_INSET = 1
|
Nenue@68
|
19 local BUFF_BUTTON_ZOOM = .15
|
Nenue@71
|
20 local BORDER_SIZE_L = 0
|
Nenue@71
|
21 local BORDER_SIZE_R = 0
|
Nenue@70
|
22 local BORDER_SIZE_U = 4
|
Nenue@71
|
23 local BORDER_SIZE_D = 0
|
Nenue@64
|
24
|
Nenue@62
|
25
|
Nenue@62
|
26 local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent)
|
Nenue@59
|
27 local vn, print = LibStub("LibKraken").register(VeneerController, plugin)
|
Nenue@68
|
28 local tprint = DEVIAN_WORKSPACE and function(...) _G.print('Timer', ...) end or function() end
|
Nenue@59
|
29
|
Nenue@68
|
30 local _G, UIParent = _G, UIParent
|
Nenue@68
|
31 local tinsert, tremove, unpack, select, tconcat = table.insert, table.remove, unpack, select, table.concat
|
Nenue@68
|
32 local floor, tonumber, format = math.floor, tonumber, string.format
|
Nenue@68
|
33 local UnitAura, GetTime, CreateFrame = UnitAura, GetTime, CreateFrame
|
Nenue@68
|
34 local hooksecurefunc = hooksecurefunc
|
Nenue@59
|
35
|
Nenue@59
|
36 local buttons = {}
|
Nenue@59
|
37 local buffTypes = {
|
Nenue@59
|
38 {
|
Nenue@59
|
39 name = 'buff',
|
Nenue@59
|
40 pattern = 'BuffButton(%d)',
|
Nenue@59
|
41 filters = 'HELPFUL',
|
Nenue@59
|
42 },
|
Nenue@59
|
43 {
|
Nenue@59
|
44 name = 'debuff',
|
Nenue@59
|
45 pattern = 'DebuffButton(%d)',
|
Nenue@59
|
46 filters = 'HARMFUL',
|
Nenue@59
|
47 },
|
Nenue@59
|
48 {
|
Nenue@59
|
49 name = 'tempenchant',
|
Nenue@59
|
50 pattern = 'TempEnchant(%d)',
|
Nenue@59
|
51 filters = 'TEMPENCHANT'
|
Nenue@59
|
52 }
|
Nenue@59
|
53 }
|
Nenue@59
|
54
|
Nenue@59
|
55 local textureMapping = {
|
Nenue@59
|
56 [1] = 16, --Main hand
|
Nenue@59
|
57 [2] = 17, --Off-hand
|
Nenue@59
|
58 [3] = 18, --Ranged
|
Nenue@59
|
59 }
|
Nenue@59
|
60
|
Nenue@59
|
61 local tickCounter = {}
|
Nenue@59
|
62 local aurasCache = {}
|
Nenue@59
|
63 local skinnedFrames = {}
|
Nenue@59
|
64 local pendingFrames = {}
|
Nenue@59
|
65 local anchors = {}
|
Nenue@59
|
66 local expirationCache = {}
|
Nenue@68
|
67 local visibility = {}
|
Nenue@59
|
68
|
Nenue@59
|
69
|
Nenue@59
|
70
|
Nenue@59
|
71 local GetVeneer = function(frame)
|
Nenue@59
|
72 local name = frame:GetName()
|
Nenue@69
|
73 if not (_G[name..'Veneer']) then
|
Nenue@68
|
74 print('|cFF88FF00Creating', name,'Veneer')
|
Nenue@73
|
75 local veneer = vn.GetVeneer(frame, 'VeneerBuffTemplate')
|
Nenue@60
|
76 local id = frame:GetID()
|
Nenue@59
|
77
|
Nenue@59
|
78 local position = tonumber(name:match("%d"))
|
Nenue@59
|
79 if position == 1 then
|
Nenue@59
|
80 veneer:Show()
|
Nenue@59
|
81 end
|
Nenue@59
|
82
|
Nenue@71
|
83 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 0, -6)
|
Nenue@71
|
84 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1)
|
Nenue@68
|
85 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
|
Nenue@59
|
86
|
Nenue@59
|
87 veneer.progress.fg:SetColorTexture(0,1,0,1)
|
Nenue@68
|
88 veneer.progress.fg:SetPoint('BOTTOMLEFT', BUFF_PROGRESS_INSET,BUFF_PROGRESS_INSET)
|
Nenue@68
|
89 veneer.progress.fg:SetPoint('TOP', 0, -BUFF_PROGRESS_INSET)
|
Nenue@59
|
90
|
Nenue@73
|
91 veneer.duration:SetFontObject(VeneerNumberFont)
|
Nenue@73
|
92 veneer.duration:SetPoint('TOP', veneer, 'BOTTOM', 0, -2)
|
Nenue@59
|
93
|
Nenue@69
|
94 veneer.count:SetFontObject(VeneerNumberFont)
|
Nenue@69
|
95 veneer.count:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -3, 3)
|
Nenue@68
|
96
|
Nenue@73
|
97 veneer.underlay:SetParent(UIParent)
|
Nenue@73
|
98 veneer.underlay:SetFrameStrata('BACKGROUND')
|
Nenue@73
|
99 veneer.border:SetColorTexture(0,0,0,1)
|
Nenue@68
|
100 veneer.border:SetPoint('TOPLEFT', veneer, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U)
|
Nenue@68
|
101 veneer.border:SetPoint('BOTTOMRIGHT', veneer, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D)
|
Nenue@68
|
102 veneer.border:Show()
|
Nenue@68
|
103
|
Nenue@69
|
104
|
Nenue@59
|
105 end
|
Nenue@59
|
106
|
Nenue@59
|
107
|
Nenue@69
|
108 return _G[name..'Veneer']
|
Nenue@59
|
109 end
|
Nenue@59
|
110
|
Nenue@68
|
111
|
Nenue@68
|
112 -- Associates skinning elements with said button
|
Nenue@68
|
113 local SkinFrame = function(name)
|
Nenue@68
|
114 local frame = _G[name ]
|
Nenue@68
|
115 if skinnedFrames[frame] then
|
Nenue@68
|
116 print('|cFFFF4400Attempting to skin a frame that already went through.|r')
|
Nenue@68
|
117 return
|
Nenue@68
|
118 end
|
Nenue@68
|
119 print('|cFFFFFF00Adopting', name)
|
Nenue@68
|
120
|
Nenue@68
|
121 local icon = _G[name .. 'Icon']
|
Nenue@68
|
122 local border = _G[name .. 'Border']
|
Nenue@68
|
123 local count = _G[name .. 'Count']
|
Nenue@68
|
124 local duration = _G[name .. 'Duration']
|
Nenue@69
|
125 local veneer = GetVeneer(frame)
|
Nenue@68
|
126
|
Nenue@68
|
127 skinnedFrames[frame] = frame
|
Nenue@68
|
128 frame:SetSize(BUFF_BUTTON_SIZE,BUFF_BUTTON_SIZE)
|
Nenue@68
|
129
|
Nenue@68
|
130 local offset = BUFF_BUTTON_ZOOM/2
|
Nenue@68
|
131 icon:SetTexCoord(offset, 1 - offset, offset, 1 - offset)
|
Nenue@68
|
132 if border then
|
Nenue@68
|
133 border:Hide()
|
Nenue@68
|
134 hooksecurefunc(border, 'SetVertexColor', function(frame, r, g, b, a)
|
Nenue@68
|
135 frame:Hide()
|
Nenue@68
|
136 print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
|
Nenue@71
|
137 veneer.progress.fg:SetColorTexture(r,g,b,a)
|
Nenue@68
|
138 end)
|
Nenue@68
|
139
|
Nenue@68
|
140 local color = DebuffTypeColor["none"]
|
Nenue@68
|
141 if aurasCache[frame] and aurasCache[frame][5] then
|
Nenue@68
|
142 color = DebuffTypeColor[aurasCache[frame][5]]
|
Nenue@68
|
143 end
|
Nenue@68
|
144
|
Nenue@71
|
145 veneer.progress.fg:SetColorTexture(color.r,color.g,color.b)
|
Nenue@73
|
146 veneer.border:SetColorTexture(color.r,color.g,color.b)
|
Nenue@68
|
147 end
|
Nenue@68
|
148 if duration then
|
Nenue@68
|
149 duration:ClearAllPoints()
|
Nenue@69
|
150 --duration:SetPoint('TOP', frame, 'BOTTOM', 0, -8)
|
Nenue@69
|
151 --duration:SetFontObject(VeneerNumberFont)
|
Nenue@69
|
152 --duration:SetDrawLayer('OVERLAY')
|
Nenue@68
|
153
|
Nenue@69
|
154 hooksecurefunc(duration, 'Hide', function(self, text)
|
Nenue@69
|
155 veneer.duration:Hide()
|
Nenue@69
|
156 end)
|
Nenue@69
|
157 hooksecurefunc(duration, 'Show', function(self, text)
|
Nenue@69
|
158 veneer.duration:Show()
|
Nenue@69
|
159 end)
|
Nenue@69
|
160 end
|
Nenue@69
|
161 if count then
|
Nenue@69
|
162 count:ClearAllPoints()
|
Nenue@69
|
163 hooksecurefunc(count, 'SetText', function(self, text)
|
Nenue@69
|
164 self:Hide()
|
Nenue@69
|
165 veneer.count:SetText(text)
|
Nenue@69
|
166 end)
|
Nenue@69
|
167 hooksecurefunc(count, 'Hide', function(self, text)
|
Nenue@69
|
168 veneer.count:Hide()
|
Nenue@69
|
169 end)
|
Nenue@69
|
170 hooksecurefunc(count, 'Show', function(self, text)
|
Nenue@69
|
171 veneer.count:Show()
|
Nenue@69
|
172 end)
|
Nenue@68
|
173 end
|
Nenue@68
|
174
|
Nenue@68
|
175
|
Nenue@68
|
176 hooksecurefunc(frame, "Hide", function(self)
|
Nenue@68
|
177 local isVisible = self:IsVisible()
|
Nenue@68
|
178 if isVisible ~= visibility[self] then
|
Nenue@68
|
179 visibility[self] = isVisible
|
Nenue@68
|
180 end
|
Nenue@68
|
181 veneer:Hide()
|
Nenue@73
|
182 veneer.underlay:Hide()
|
Nenue@68
|
183 end)
|
Nenue@68
|
184
|
Nenue@68
|
185 hooksecurefunc(frame, 'Show', function(self)
|
Nenue@68
|
186 veneer:Show()
|
Nenue@70
|
187 veneer.count:Show()
|
Nenue@68
|
188 veneer.border:Show()
|
Nenue@68
|
189 local isVisible = self:IsVisible()
|
Nenue@68
|
190 if isVisible ~= visibility[self] then
|
Nenue@68
|
191 print('|cFFFFFF00SHOW|r', self:GetName())
|
Nenue@68
|
192 visibility[self] = isVisible
|
Nenue@68
|
193 end
|
Nenue@68
|
194 end)
|
Nenue@68
|
195
|
Nenue@68
|
196 anchors[frame] = veneer
|
Nenue@68
|
197 end
|
Nenue@68
|
198
|
Nenue@68
|
199 local Aura_SetBorderColor = function(self, r,g,b,a) end
|
Nenue@68
|
200 local Aura_OnShow = function(self) end
|
Nenue@68
|
201 local Aura_OnHide = function(self) end
|
Nenue@68
|
202
|
Nenue@61
|
203 --- Set widgets to reflect the passed parameters
|
Nenue@59
|
204 local UpdateVeneer = function (frame, duration, expires)
|
Nenue@59
|
205 local veneer = GetVeneer(frame)
|
Nenue@68
|
206 -- is it a new button?
|
Nenue@68
|
207 if not skinnedFrames[frame] then
|
Nenue@68
|
208 SkinFrame(frame:GetName())
|
Nenue@68
|
209 end
|
Nenue@68
|
210
|
Nenue@68
|
211 if frame.filter == 'HARMFUL' then
|
Nenue@68
|
212
|
Nenue@68
|
213 veneer.border:Show()
|
Nenue@68
|
214 end
|
Nenue@68
|
215
|
Nenue@59
|
216
|
Nenue@61
|
217 if expires and duration then
|
Nenue@61
|
218 if duration ~= 0 then
|
Nenue@61
|
219 local startTime = (expires - duration)
|
Nenue@61
|
220 local endTime = expires or 0
|
Nenue@61
|
221 print('|cFF0088FF'..frame:GetName()..'|r', duration, expires)
|
Nenue@61
|
222 veneer.progress:Show()
|
Nenue@61
|
223 veneer.elapsed = 0
|
Nenue@61
|
224 veneer.progress:SetScript('OnUpdate', function(self, elapsed)
|
Nenue@61
|
225 veneer.elapsed = veneer.elapsed + elapsed
|
Nenue@60
|
226
|
Nenue@67
|
227 local w = floor(veneer.progress:GetWidth()+.5) - (BUFF_PROGRESS_INSET*2)
|
Nenue@61
|
228 local t = GetTime()
|
Nenue@61
|
229 local progress = (t - startTime) / duration
|
Nenue@61
|
230
|
Nenue@67
|
231 local nw = (w - (w * progress))
|
Nenue@61
|
232 if veneer.elapsed >= 0.25 then
|
Nenue@61
|
233
|
Nenue@68
|
234 tprint(t, startTime, floor(progress*100), w * progress, nw, w)
|
Nenue@61
|
235 veneer.elapsed = 0.25 - veneer.elapsed
|
Nenue@61
|
236 end
|
Nenue@61
|
237 if (progress >= 1) or not frame:IsVisible() then
|
Nenue@61
|
238 veneer.startTime = nil
|
Nenue@61
|
239 self:Hide()
|
Nenue@61
|
240 self:SetScript('OnUpdate', nil)
|
Nenue@61
|
241 else
|
Nenue@61
|
242 self.fg:SetWidth(nw)
|
Nenue@61
|
243 end
|
Nenue@61
|
244 end)
|
Nenue@61
|
245
|
Nenue@61
|
246 veneer.cooldown:Show()
|
Nenue@61
|
247 veneer.cooldown:SetCooldown(startTime, duration)
|
Nenue@61
|
248 else
|
Nenue@61
|
249 print('|cFF00FF88'..frame:GetName()..'|r', 'duration zero')
|
Nenue@61
|
250 veneer.progress:SetScript('OnUpdate', nil)
|
Nenue@61
|
251 veneer.progress:Hide()
|
Nenue@61
|
252 veneer.cooldown:Hide()
|
Nenue@61
|
253 end
|
Nenue@61
|
254 else
|
Nenue@61
|
255 veneer.progress:Hide()
|
Nenue@61
|
256 veneer.cooldown:SetCooldown(0,0)
|
Nenue@61
|
257 veneer.cooldown:Hide()
|
Nenue@61
|
258 print('|cFF88FF00'..frame:GetName()..'|r', 'nil duration')
|
Nenue@59
|
259 end
|
Nenue@59
|
260 veneer:Show()
|
Nenue@59
|
261 end
|
Nenue@59
|
262
|
Nenue@59
|
263
|
Nenue@59
|
264 --- Provides the number of changed indices for use in deciding between partial and full veneer updates
|
Nenue@59
|
265 local CacheCheck = function(frame, ...)
|
Nenue@59
|
266 aurasCache[frame] = aurasCache[frame] or {}
|
Nenue@59
|
267 local hasChange = 0
|
Nenue@59
|
268 local numVals = select('#',...)
|
Nenue@59
|
269 for i = 1, numVals do
|
Nenue@59
|
270 local arg = select(i, ...)
|
Nenue@59
|
271 if aurasCache[frame][i] ~= arg then
|
Nenue@59
|
272 hasChange = hasChange + 1
|
Nenue@59
|
273 end
|
Nenue@59
|
274 aurasCache[frame][i] = arg
|
Nenue@59
|
275 end
|
Nenue@59
|
276 return hasChange
|
Nenue@59
|
277 end
|
Nenue@59
|
278
|
Nenue@59
|
279 local AuraButton_Update = function(name, index, filter)
|
Nenue@59
|
280 local bName = name..index
|
Nenue@59
|
281 local frame = _G[bName]
|
Nenue@59
|
282 if frame and frame:IsVisible() then
|
Nenue@59
|
283 tickCounter[frame] = (tickCounter[frame] or 0) + 1
|
Nenue@59
|
284 local cacheDiff = CacheCheck(frame, UnitAura(frame.unit, frame:GetID(), frame.filter))
|
Nenue@61
|
285 -- if the name or expirationTime changed
|
Nenue@61
|
286 if (cacheDiff >= 1) then
|
Nenue@68
|
287 print('|cFFFF4400', frame:GetName(), 'diff:', cacheDiff)
|
Nenue@61
|
288 if not skinnedFrames[frame] then
|
Nenue@61
|
289 tinsert(pendingFrames, frame)
|
Nenue@61
|
290 end
|
Nenue@59
|
291 expirationCache[name] = frame.expirationTime
|
Nenue@59
|
292 print(unpack(aurasCache[frame]))
|
Nenue@68
|
293
|
Nenue@59
|
294 UpdateVeneer(frame, aurasCache[frame][6], aurasCache[frame][7])
|
Nenue@59
|
295 end
|
Nenue@59
|
296
|
Nenue@59
|
297 end
|
Nenue@59
|
298 end
|
Nenue@59
|
299
|
Nenue@59
|
300 local BuffFrame_UpdateAllBuffAnchors = function()
|
Nenue@59
|
301 local todo = {}
|
Nenue@59
|
302 if #pendingFrames >= 1 then
|
Nenue@59
|
303
|
Nenue@59
|
304 print('|cFFBBFF00AllBuffAnchors|r', #pendingFrames)
|
Nenue@59
|
305 while pendingFrames[1] do
|
Nenue@59
|
306 local frame = tremove(pendingFrames)
|
Nenue@59
|
307 tinsert(todo, frame:GetName())
|
Nenue@59
|
308
|
Nenue@61
|
309 -- re-apply custom anchors
|
Nenue@59
|
310 end
|
Nenue@68
|
311 print(tconcat(todo, ', '))
|
Nenue@59
|
312 end
|
Nenue@59
|
313 --BuffButton1
|
Nenue@59
|
314 --DebuffButton1
|
Nenue@61
|
315 --todo: separate frame groups and iterate over them at appropriate times
|
Nenue@60
|
316 if BuffButton1 then
|
Nenue@68
|
317 TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0)
|
Nenue@60
|
318 end
|
Nenue@60
|
319
|
Nenue@70
|
320 local lastBuff, topBuff
|
Nenue@70
|
321 for i = 1, BUFF_ACTUAL_DISPLAY do
|
Nenue@70
|
322 local buff = _G['BuffButton'..i]
|
Nenue@70
|
323 if buff then
|
Nenue@71
|
324 if mod(i,12) == 1 then
|
Nenue@71
|
325 if i == 1 then
|
Nenue@71
|
326 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
|
Nenue@71
|
327 else
|
Nenue@71
|
328 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
|
Nenue@71
|
329 end
|
Nenue@70
|
330 topBuff = buff
|
Nenue@70
|
331 else
|
Nenue@71
|
332 buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
|
Nenue@70
|
333 end
|
Nenue@70
|
334 lastBuff = buff
|
Nenue@70
|
335 end
|
Nenue@70
|
336 end
|
Nenue@70
|
337
|
Nenue@70
|
338 for i = 1, DEBUFF_ACTUAL_DISPLAY do
|
Nenue@70
|
339 local debuff = _G['DebuffButton'..i]
|
Nenue@70
|
340 if debuff then
|
Nenue@70
|
341 if i == 1 then
|
Nenue@70
|
342 if topBuff then
|
Nenue@71
|
343 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
|
Nenue@70
|
344 else
|
Nenue@70
|
345 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
|
Nenue@70
|
346 end
|
Nenue@70
|
347 topBuff = debuff
|
Nenue@70
|
348 elseif mod(i, 12) == 1 then
|
Nenue@71
|
349 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
|
Nenue@70
|
350 topBuff = debuff
|
Nenue@70
|
351 else
|
Nenue@71
|
352 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
|
Nenue@70
|
353 end
|
Nenue@70
|
354 lastBuff = debuff
|
Nenue@70
|
355 end
|
Nenue@70
|
356 end
|
Nenue@70
|
357
|
Nenue@59
|
358 end
|
Nenue@59
|
359
|
Nenue@59
|
360 local AuraButton_UpdateDuration = function(frame, timeLeft)
|
Nenue@69
|
361 local veneer = GetVeneer(frame)
|
Nenue@60
|
362 local hours = floor(timeLeft/3600)
|
Nenue@60
|
363 local minutes = floor(mod(timeLeft, 3600)/60)
|
Nenue@60
|
364 local seconds = floor(mod(timeLeft, 60))
|
Nenue@60
|
365 local timeString = '%ds'
|
Nenue@59
|
366 if timeLeft > 3600 then
|
Nenue@60
|
367 timeString = format('%d:%02d', hours, minutes)
|
Nenue@60
|
368 elseif timeLeft > 60 then
|
Nenue@60
|
369 timeString = format('%d:%02d', minutes, seconds)
|
Nenue@61
|
370 else
|
Nenue@60
|
371 timeString = format('%d', seconds)
|
Nenue@59
|
372 end
|
Nenue@59
|
373
|
Nenue@60
|
374
|
Nenue@69
|
375 veneer.duration:SetText(timeString)
|
Nenue@69
|
376 veneer.duration:SetVertexColor(1,1,1)
|
Nenue@59
|
377 end
|
Nenue@59
|
378
|
Nenue@59
|
379
|
Nenue@59
|
380 -- Obtains the first instance of Tenchant use
|
Nenue@59
|
381
|
Nenue@59
|
382 local TemporaryEnchantFrame_Update = function(...)
|
Nenue@59
|
383 local numVals = select('#', ...)
|
Nenue@59
|
384 local numItems = numVals / 4
|
Nenue@59
|
385 if numItems >= 1 then
|
Nenue@59
|
386 for itemIndex = numItems, 1, -1 do
|
Nenue@59
|
387 local frame = _G['TempEnchant'..itemIndex]
|
Nenue@59
|
388 local hasEnchant, timeRemaining, enchantCharges = select((4 * (itemIndex -1)) + 1, ...)
|
Nenue@59
|
389
|
Nenue@59
|
390
|
Nenue@59
|
391 if hasEnchant then
|
Nenue@59
|
392 local endTime = floor(GetTime()*1000) + timeRemaining
|
Nenue@59
|
393
|
Nenue@59
|
394
|
Nenue@59
|
395 --print(endTime)
|
Nenue@59
|
396 if endTime ~= expirationCache[frame] then
|
Nenue@59
|
397 if expirationCache[frame] then
|
Nenue@59
|
398 print(endTime, expirationCache[frame], endTime - expirationCache[frame])
|
Nenue@59
|
399 end
|
Nenue@59
|
400 expirationCache[frame] = endTime
|
Nenue@59
|
401 print('push tempenchant timer update', timeRemaining / 1000, GetTime()+(timeRemaining/1000))
|
Nenue@59
|
402 UpdateVeneer(frame, timeRemaining/1000, GetTime()+(timeRemaining/1000))
|
Nenue@59
|
403 end
|
Nenue@59
|
404 else
|
Nenue@59
|
405 GetVeneer(frame):Hide()
|
Nenue@59
|
406 end
|
Nenue@59
|
407
|
Nenue@59
|
408 end
|
Nenue@59
|
409
|
Nenue@59
|
410 end
|
Nenue@59
|
411
|
Nenue@59
|
412 end
|
Nenue@59
|
413
|
Nenue@59
|
414 local BuffFrame_Update = function(...)
|
Nenue@61
|
415
|
Nenue@59
|
416 end
|
Nenue@59
|
417
|
Nenue@59
|
418
|
Nenue@59
|
419 hooksecurefunc("BuffFrame_Update", BuffFrame_Update)
|
Nenue@59
|
420 hooksecurefunc("AuraButton_UpdateDuration", AuraButton_UpdateDuration)
|
Nenue@59
|
421 hooksecurefunc("AuraButton_Update", AuraButton_Update)
|
Nenue@59
|
422 hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", BuffFrame_UpdateAllBuffAnchors)
|
Nenue@59
|
423 hooksecurefunc("TemporaryEnchantFrame_Update", TemporaryEnchantFrame_Update)
|
Nenue@59
|
424
|
Nenue@59
|
425 -- The TempEnchant frames are hardcoded in the base FrameXML, so get them now
|
Nenue@59
|
426 for i = 1, 3 do
|
Nenue@59
|
427
|
Nenue@59
|
428 SkinFrame('TempEnchant'..i)
|
Nenue@68
|
429 _G['TempEnchant'..i..'Border']:SetVertexColor(0.5,0,1,1)
|
Nenue@59
|
430
|
Nenue@59
|
431 end
|
Nenue@59
|
432
|
Nenue@59
|
433 plugin.init = function ()
|
Nenue@61
|
434
|
Nenue@61
|
435
|
Nenue@61
|
436
|
Nenue@59
|
437 plugin.db = vn.db[PLUGIN_NAME]
|
Nenue@59
|
438 end |