annotate Modules/BuffFrame.lua @ 81:65ec88b30eb8

- OrderHall plugin converted to a general world state cluster. Includes: - Suramar ancient mana - Artifact power/XP progress - OrderHall bar shrinker
author Nenue
date Mon, 17 Oct 2016 04:57:32 -0400
parents bb6b532c5d2f
children 16b300d96724
rev   line source
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@75 14 local BUFFS_PER_ROW = 12
Nenue@64 15 local BUFF_BUTTON_SIZE = 48
Nenue@71 16 local BUFF_BUTTON_SPACING_H = 4
Nenue@71 17 local BUFF_BUTTON_SPACING_V = 14
Nenue@64 18 local BUFF_PROGRESS_SIZE = 4
Nenue@64 19 local BUFF_PROGRESS_INSET = 1
Nenue@68 20 local BUFF_BUTTON_ZOOM = .15
Nenue@79 21 local BORDER_SIZE_L = 1
Nenue@79 22 local BORDER_SIZE_R = 1
Nenue@79 23 local BORDER_SIZE_U = 1
Nenue@79 24 local BORDER_SIZE_D = 1
Nenue@75 25 local BUFF_FRAMES_X = -230
Nenue@75 26 local BUFF_FRAMES_Y = -4
Nenue@64 27
Nenue@62 28
Nenue@62 29 local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent)
Nenue@75 30 local vn, print = LibStub("LibKraken").register(Veneer, plugin)
Nenue@68 31 local tprint = DEVIAN_WORKSPACE and function(...) _G.print('Timer', ...) end or function() end
Nenue@59 32
Nenue@68 33 local _G, UIParent = _G, UIParent
Nenue@68 34 local tinsert, tremove, unpack, select, tconcat = table.insert, table.remove, unpack, select, table.concat
Nenue@68 35 local floor, tonumber, format = math.floor, tonumber, string.format
Nenue@68 36 local UnitAura, GetTime, CreateFrame = UnitAura, GetTime, CreateFrame
Nenue@68 37 local hooksecurefunc = hooksecurefunc
Nenue@59 38
Nenue@75 39 local aurasCache = {}
Nenue@75 40 local skinnedFrames = {}
Nenue@75 41 local pendingFrames = {}
Nenue@75 42 local veneers = {}
Nenue@75 43 local expirationCache = {}
Nenue@75 44 local visibility = {}
Nenue@75 45 local isHooked = {}
Nenue@75 46
Nenue@75 47 plugin.options = {
Nenue@75 48 nameString = 'Buff Frames',
Nenue@59 49 {
Nenue@75 50 name = 'BuffButtonZoom',
Nenue@75 51 type = 'slider',
Nenue@75 52 min = 0,
Nenue@75 53 max = 100,
Nenue@75 54 fullwidth = true,
Nenue@59 55 },
Nenue@59 56 {
Nenue@75 57 name = 'BuffBorderLeft',
Nenue@75 58 type = 'slider',
Nenue@75 59 min = 0,
Nenue@75 60 max = 16,
Nenue@59 61 },
Nenue@59 62 {
Nenue@75 63 name = 'BuffBorderLeft',
Nenue@75 64 type = 'slider',
Nenue@75 65 min = 0,
Nenue@75 66 max = 16,
Nenue@59 67 }
Nenue@59 68 }
Nenue@59 69
Nenue@59 70
Nenue@59 71 local GetVeneer = function(frame)
Nenue@75 72
Nenue@75 73 if not (veneers[frame]) then
Nenue@75 74 local name = frame:GetName()
Nenue@68 75 print('|cFF88FF00Creating', name,'Veneer')
Nenue@73 76 local veneer = vn.GetVeneer(frame, 'VeneerBuffTemplate')
Nenue@60 77 local id = frame:GetID()
Nenue@59 78
Nenue@59 79
Nenue@79 80 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', -1, -7)
Nenue@79 81 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 1, -2)
Nenue@68 82 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2))
Nenue@59 83
Nenue@75 84 veneer.progress.bg:SetColorTexture(0,0,0,1)
Nenue@75 85
Nenue@75 86 veneer.progress.fg:SetColorTexture(1,1,1,1)
Nenue@75 87 veneer.progress.fg:ClearAllPoints()
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@74 92 veneer.duration:ClearAllPoints()
Nenue@74 93 veneer.duration:SetPoint('BOTTOM', veneer, 'BOTTOM', 0, 2)
Nenue@59 94
Nenue@69 95 veneer.count:SetFontObject(VeneerNumberFont)
Nenue@74 96 veneer.count:ClearAllPoints()
Nenue@74 97 veneer.count:SetPoint('TOPRIGHT', veneer, 'TOPRIGHT', -3, -3)
Nenue@80 98 veneer.count:SetJustifyH('RIGHT')
Nenue@80 99 veneer.count:SetSize(30,30)
Nenue@68 100
Nenue@73 101 veneer.underlay:SetParent(UIParent)
Nenue@73 102 veneer.underlay:SetFrameStrata('BACKGROUND')
Nenue@79 103 veneer.border:SetColorTexture(0,0,0,1)
Nenue@68 104 veneer.border:SetPoint('TOPLEFT', veneer, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U)
Nenue@68 105 veneer.border:SetPoint('BOTTOMRIGHT', veneer, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D)
Nenue@68 106 veneer.border:Show()
Nenue@68 107
Nenue@69 108
Nenue@75 109 veneers[frame] = veneer
Nenue@59 110 end
Nenue@59 111
Nenue@59 112
Nenue@75 113 return veneers[frame]
Nenue@59 114 end
Nenue@59 115
Nenue@68 116
Nenue@68 117 -- Associates skinning elements with said button
Nenue@68 118 local SkinFrame = function(name)
Nenue@68 119 local frame = _G[name ]
Nenue@68 120 if skinnedFrames[frame] then
Nenue@68 121 print('|cFFFF4400Attempting to skin a frame that already went through.|r')
Nenue@68 122 return
Nenue@68 123 end
Nenue@68 124 print('|cFFFFFF00Adopting', name)
Nenue@68 125
Nenue@68 126 local icon = _G[name .. 'Icon']
Nenue@68 127 local border = _G[name .. 'Border']
Nenue@68 128 local count = _G[name .. 'Count']
Nenue@68 129 local duration = _G[name .. 'Duration']
Nenue@69 130 local veneer = GetVeneer(frame)
Nenue@68 131
Nenue@68 132 skinnedFrames[frame] = frame
Nenue@68 133 frame:SetSize(BUFF_BUTTON_SIZE,BUFF_BUTTON_SIZE)
Nenue@68 134
Nenue@78 135
Nenue@68 136 local offset = BUFF_BUTTON_ZOOM/2
Nenue@68 137 icon:SetTexCoord(offset, 1 - offset, offset, 1 - offset)
Nenue@68 138 if border then
Nenue@68 139 border:Hide()
Nenue@68 140 hooksecurefunc(border, 'SetVertexColor', function(frame, r, g, b, a)
Nenue@68 141 frame:Hide()
Nenue@68 142 print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a)
Nenue@71 143 veneer.progress.fg:SetColorTexture(r,g,b,a)
Nenue@79 144 veneer.border:Show()
Nenue@68 145 end)
Nenue@68 146
Nenue@79 147
Nenue@79 148
Nenue@68 149 local color = DebuffTypeColor["none"]
Nenue@68 150 if aurasCache[frame] and aurasCache[frame][5] then
Nenue@68 151 color = DebuffTypeColor[aurasCache[frame][5]]
Nenue@68 152 end
Nenue@68 153
Nenue@71 154 veneer.progress.fg:SetColorTexture(color.r,color.g,color.b)
Nenue@75 155 veneer.border:SetColorTexture(0,0,0,1)
Nenue@79 156 veneer.border:Show()
Nenue@79 157 else
Nenue@79 158 veneer.border:SetColorTexture(0,0,0,1)
Nenue@79 159 veneer.border:Show()
Nenue@68 160 end
Nenue@68 161 if duration then
Nenue@68 162 duration:ClearAllPoints()
Nenue@69 163 --duration:SetPoint('TOP', frame, 'BOTTOM', 0, -8)
Nenue@69 164 --duration:SetFontObject(VeneerNumberFont)
Nenue@69 165 --duration:SetDrawLayer('OVERLAY')
Nenue@68 166
Nenue@69 167 hooksecurefunc(duration, 'Hide', function(self, text)
Nenue@69 168 veneer.duration:Hide()
Nenue@69 169 end)
Nenue@69 170 hooksecurefunc(duration, 'Show', function(self, text)
Nenue@69 171 veneer.duration:Show()
Nenue@69 172 end)
Nenue@69 173 end
Nenue@69 174 if count then
Nenue@69 175 count:ClearAllPoints()
Nenue@69 176 hooksecurefunc(count, 'SetText', function(self, text)
Nenue@74 177 print(self:GetName(), 'SetText', text)
Nenue@74 178 local n = veneer.count:GetNumPoints()
Nenue@74 179 for i = 1, n do
Nenue@74 180 print(i, veneer.count:GetPoint(n))
Nenue@74 181 end
Nenue@74 182 veneer.count:Show()
Nenue@69 183 veneer.count:SetText(text)
Nenue@69 184 end)
Nenue@74 185 hooksecurefunc(count, 'Hide', function(self)
Nenue@74 186 if veneer.count.isUpdating then
Nenue@74 187 print('|cFFFF4400blocked Hide hook|r')
Nenue@74 188 return
Nenue@74 189 end
Nenue@74 190
Nenue@74 191 print(self:GetName(), 'Hide')
Nenue@69 192 veneer.count:Hide()
Nenue@69 193 end)
Nenue@74 194 hooksecurefunc(count, 'Show', function(self)
Nenue@74 195 print(self:GetName(), 'Show')
Nenue@69 196 veneer.count:Show()
Nenue@69 197 end)
Nenue@68 198 end
Nenue@68 199
Nenue@68 200
Nenue@68 201 hooksecurefunc(frame, "Hide", function(self)
Nenue@68 202 local isVisible = self:IsVisible()
Nenue@68 203 if isVisible ~= visibility[self] then
Nenue@68 204 visibility[self] = isVisible
Nenue@68 205 end
Nenue@68 206 veneer:Hide()
Nenue@73 207 veneer.underlay:Hide()
Nenue@68 208 end)
Nenue@68 209
Nenue@68 210 hooksecurefunc(frame, 'Show', function(self)
Nenue@68 211 veneer:Show()
Nenue@68 212 local isVisible = self:IsVisible()
Nenue@68 213 if isVisible ~= visibility[self] then
Nenue@68 214 print('|cFFFFFF00SHOW|r', self:GetName())
Nenue@68 215 visibility[self] = isVisible
Nenue@68 216 end
Nenue@74 217 veneer.underlay:Show()
Nenue@68 218 end)
Nenue@68 219
Nenue@68 220 end
Nenue@68 221
Nenue@68 222
Nenue@61 223 --- Set widgets to reflect the passed parameters
Nenue@59 224 local UpdateVeneer = function (frame, duration, expires)
Nenue@59 225 local veneer = GetVeneer(frame)
Nenue@68 226 -- is it a new button?
Nenue@68 227 if not skinnedFrames[frame] then
Nenue@68 228 SkinFrame(frame:GetName())
Nenue@68 229 end
Nenue@68 230
Nenue@59 231
Nenue@61 232 if expires and duration then
Nenue@61 233 if duration ~= 0 then
Nenue@61 234 local startTime = (expires - duration)
Nenue@61 235 local endTime = expires or 0
Nenue@61 236 print('|cFF0088FF'..frame:GetName()..'|r', duration, expires)
Nenue@61 237 veneer.progress:Show()
Nenue@61 238 veneer.elapsed = 0
Nenue@61 239 veneer.progress:SetScript('OnUpdate', function(self, elapsed)
Nenue@61 240 veneer.elapsed = veneer.elapsed + elapsed
Nenue@60 241
Nenue@67 242 local w = floor(veneer.progress:GetWidth()+.5) - (BUFF_PROGRESS_INSET*2)
Nenue@61 243 local t = GetTime()
Nenue@61 244 local progress = (t - startTime) / duration
Nenue@61 245
Nenue@67 246 local nw = (w - (w * progress))
Nenue@61 247 if veneer.elapsed >= 0.25 then
Nenue@61 248
Nenue@68 249 tprint(t, startTime, floor(progress*100), w * progress, nw, w)
Nenue@61 250 veneer.elapsed = 0.25 - veneer.elapsed
Nenue@61 251 end
Nenue@61 252 if (progress >= 1) or not frame:IsVisible() then
Nenue@61 253 veneer.startTime = nil
Nenue@61 254 self:Hide()
Nenue@61 255 self:SetScript('OnUpdate', nil)
Nenue@61 256 else
Nenue@61 257 self.fg:SetWidth(nw)
Nenue@61 258 end
Nenue@61 259 end)
Nenue@61 260
Nenue@61 261 veneer.cooldown:Show()
Nenue@61 262 veneer.cooldown:SetCooldown(startTime, duration)
Nenue@61 263 else
Nenue@61 264 print('|cFF00FF88'..frame:GetName()..'|r', 'duration zero')
Nenue@61 265 veneer.progress:SetScript('OnUpdate', nil)
Nenue@61 266 veneer.progress:Hide()
Nenue@61 267 veneer.cooldown:Hide()
Nenue@61 268 end
Nenue@61 269 else
Nenue@61 270 veneer.progress:Hide()
Nenue@61 271 veneer.cooldown:SetCooldown(0,0)
Nenue@61 272 veneer.cooldown:Hide()
Nenue@61 273 print('|cFF88FF00'..frame:GetName()..'|r', 'nil duration')
Nenue@59 274 end
Nenue@59 275 veneer:Show()
Nenue@59 276 end
Nenue@59 277
Nenue@59 278
Nenue@59 279 --- Provides the number of changed indices for use in deciding between partial and full veneer updates
Nenue@59 280 local CacheCheck = function(frame, ...)
Nenue@59 281 aurasCache[frame] = aurasCache[frame] or {}
Nenue@59 282 local hasChange = 0
Nenue@59 283 local numVals = select('#',...)
Nenue@59 284 for i = 1, numVals do
Nenue@59 285 local arg = select(i, ...)
Nenue@59 286 if aurasCache[frame][i] ~= arg then
Nenue@59 287 hasChange = hasChange + 1
Nenue@59 288 end
Nenue@59 289 aurasCache[frame][i] = arg
Nenue@59 290 end
Nenue@59 291 return hasChange
Nenue@59 292 end
Nenue@59 293
Nenue@59 294 local AuraButton_Update = function(name, index, filter)
Nenue@59 295 local bName = name..index
Nenue@59 296 local frame = _G[bName]
Nenue@59 297 if frame and frame:IsVisible() then
Nenue@59 298 local cacheDiff = CacheCheck(frame, UnitAura(frame.unit, frame:GetID(), frame.filter))
Nenue@61 299 -- if the name or expirationTime changed
Nenue@61 300 if (cacheDiff >= 1) then
Nenue@68 301 print('|cFFFF4400', frame:GetName(), 'diff:', cacheDiff)
Nenue@61 302 if not skinnedFrames[frame] then
Nenue@61 303 tinsert(pendingFrames, frame)
Nenue@61 304 end
Nenue@59 305 expirationCache[name] = frame.expirationTime
Nenue@59 306 print(unpack(aurasCache[frame]))
Nenue@68 307
Nenue@59 308 UpdateVeneer(frame, aurasCache[frame][6], aurasCache[frame][7])
Nenue@59 309 end
Nenue@59 310
Nenue@59 311 end
Nenue@59 312 end
Nenue@59 313
Nenue@59 314 local BuffFrame_UpdateAllBuffAnchors = function()
Nenue@59 315 local todo = {}
Nenue@59 316 if #pendingFrames >= 1 then
Nenue@59 317
Nenue@59 318 print('|cFFBBFF00AllBuffAnchors|r', #pendingFrames)
Nenue@59 319 while pendingFrames[1] do
Nenue@59 320 local frame = tremove(pendingFrames)
Nenue@59 321 tinsert(todo, frame:GetName())
Nenue@59 322
Nenue@61 323 -- re-apply custom anchors
Nenue@59 324 end
Nenue@68 325 print(tconcat(todo, ', '))
Nenue@59 326 end
Nenue@59 327 --BuffButton1
Nenue@59 328 --DebuffButton1
Nenue@61 329 --todo: separate frame groups and iterate over them at appropriate times
Nenue@60 330 if BuffButton1 then
Nenue@78 331
Nenue@68 332 TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0)
Nenue@60 333 end
Nenue@60 334
Nenue@70 335 local lastBuff, topBuff
Nenue@74 336 local numBuffs = 0
Nenue@70 337 for i = 1, BUFF_ACTUAL_DISPLAY do
Nenue@70 338 local buff = _G['BuffButton'..i]
Nenue@70 339 if buff then
Nenue@74 340 numBuffs = numBuffs + 1
Nenue@74 341 buff:ClearAllPoints()
Nenue@75 342 if mod(numBuffs,BUFFS_PER_ROW) == 1 then
Nenue@74 343 if numBuffs == 1 then
Nenue@80 344 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', BUFF_FRAMES_X, BUFF_FRAMES_Y)
Nenue@74 345 plugin.currentTop = buff:GetTop()
Nenue@71 346 else
Nenue@71 347 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
Nenue@71 348 end
Nenue@70 349 topBuff = buff
Nenue@70 350 else
Nenue@71 351 buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
Nenue@70 352 end
Nenue@70 353 lastBuff = buff
Nenue@70 354 end
Nenue@70 355 end
Nenue@70 356
Nenue@74 357 numBuffs = 0
Nenue@70 358 for i = 1, DEBUFF_ACTUAL_DISPLAY do
Nenue@70 359 local debuff = _G['DebuffButton'..i]
Nenue@70 360 if debuff then
Nenue@74 361 numBuffs = numBuffs + 1
Nenue@74 362 if numBuffs == 1 then
Nenue@70 363 if topBuff then
Nenue@71 364 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
Nenue@70 365 else
Nenue@70 366 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6)
Nenue@70 367 end
Nenue@70 368 topBuff = debuff
Nenue@75 369 elseif mod(numBuffs, BUFFS_PER_ROW) == 1 then
Nenue@71 370 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V)
Nenue@70 371 topBuff = debuff
Nenue@70 372 else
Nenue@71 373 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0)
Nenue@70 374 end
Nenue@70 375 lastBuff = debuff
Nenue@70 376 end
Nenue@70 377 end
Nenue@70 378
Nenue@74 379 if lastBuff then
Nenue@74 380 plugin.currentBottom = lastBuff:GetBottom()
Nenue@74 381 end
Nenue@59 382 end
Nenue@59 383
Nenue@59 384 local AuraButton_UpdateDuration = function(frame, timeLeft)
Nenue@69 385 local veneer = GetVeneer(frame)
Nenue@60 386 local hours = floor(timeLeft/3600)
Nenue@60 387 local minutes = floor(mod(timeLeft, 3600)/60)
Nenue@60 388 local seconds = floor(mod(timeLeft, 60))
Nenue@60 389 local timeString = '%ds'
Nenue@59 390 if timeLeft > 3600 then
Nenue@60 391 timeString = format('%d:%02d', hours, minutes)
Nenue@60 392 elseif timeLeft > 60 then
Nenue@60 393 timeString = format('%d:%02d', minutes, seconds)
Nenue@61 394 else
Nenue@60 395 timeString = format('%d', seconds)
Nenue@59 396 end
Nenue@59 397
Nenue@74 398 if timeLeft < 10 then
Nenue@74 399 if not veneer.duration.getHuge then
Nenue@74 400 veneer.duration.getHuge = true
Nenue@74 401 veneer.duration:SetFontObject(VeneerNumberFontLarge)
Nenue@75 402 veneer.duration:SetTextColor(1,1,0,1)
Nenue@74 403 end
Nenue@74 404 else
Nenue@74 405 if veneer.duration.getHuge then
Nenue@74 406 veneer.duration.getHuge = nil
Nenue@74 407 veneer.duration:SetFontObject(VeneerNumberFont)
Nenue@74 408 veneer.duration:SetTextColor(1,1,1,1)
Nenue@74 409 end
Nenue@74 410
Nenue@74 411 end
Nenue@74 412
Nenue@60 413
Nenue@69 414 veneer.duration:SetText(timeString)
Nenue@59 415 end
Nenue@59 416
Nenue@59 417
Nenue@59 418 -- Obtains the first instance of Tenchant use
Nenue@59 419
Nenue@59 420 local TemporaryEnchantFrame_Update = function(...)
Nenue@59 421 local numVals = select('#', ...)
Nenue@59 422 local numItems = numVals / 4
Nenue@59 423 if numItems >= 1 then
Nenue@59 424 for itemIndex = numItems, 1, -1 do
Nenue@59 425 local frame = _G['TempEnchant'..itemIndex]
Nenue@59 426 local hasEnchant, timeRemaining, enchantCharges = select((4 * (itemIndex -1)) + 1, ...)
Nenue@59 427
Nenue@59 428
Nenue@59 429 if hasEnchant then
Nenue@59 430 local endTime = floor(GetTime()*1000) + timeRemaining
Nenue@59 431
Nenue@59 432
Nenue@59 433 --print(endTime)
Nenue@59 434 if endTime ~= expirationCache[frame] then
Nenue@59 435 if expirationCache[frame] then
Nenue@59 436 print(endTime, expirationCache[frame], endTime - expirationCache[frame])
Nenue@59 437 end
Nenue@59 438 expirationCache[frame] = endTime
Nenue@59 439 print('push tempenchant timer update', timeRemaining / 1000, GetTime()+(timeRemaining/1000))
Nenue@59 440 UpdateVeneer(frame, timeRemaining/1000, GetTime()+(timeRemaining/1000))
Nenue@59 441 end
Nenue@59 442 else
Nenue@59 443 GetVeneer(frame):Hide()
Nenue@59 444 end
Nenue@59 445
Nenue@59 446 end
Nenue@59 447
Nenue@59 448 end
Nenue@59 449
Nenue@59 450 end
Nenue@59 451
Nenue@59 452 local BuffFrame_Update = function(...)
Nenue@61 453
Nenue@59 454 end
Nenue@59 455
Nenue@59 456
Nenue@59 457 hooksecurefunc("BuffFrame_Update", BuffFrame_Update)
Nenue@59 458 hooksecurefunc("AuraButton_UpdateDuration", AuraButton_UpdateDuration)
Nenue@59 459 hooksecurefunc("AuraButton_Update", AuraButton_Update)
Nenue@59 460 hooksecurefunc("BuffFrame_UpdateAllBuffAnchors", BuffFrame_UpdateAllBuffAnchors)
Nenue@59 461 hooksecurefunc("TemporaryEnchantFrame_Update", TemporaryEnchantFrame_Update)
Nenue@59 462
Nenue@59 463 -- The TempEnchant frames are hardcoded in the base FrameXML, so get them now
Nenue@59 464 for i = 1, 3 do
Nenue@59 465
Nenue@59 466 SkinFrame('TempEnchant'..i)
Nenue@68 467 _G['TempEnchant'..i..'Border']:SetVertexColor(0.5,0,1,1)
Nenue@59 468
Nenue@59 469 end
Nenue@59 470
Nenue@80 471 local OrderHallCommandBarMod = CreateFrame('Frame')
Nenue@80 472 function OrderHallCommandBarMod:Refresh()
Nenue@80 473 OrderHallCommandBar.Background:SetAlpha(0.5)
Nenue@80 474 OrderHallCommandBar:ClearAllPoints()
Nenue@80 475 OrderHallCommandBar:SetPoint('TOP')
Nenue@80 476 OrderHallCommandBar:SetWidth(580)
Nenue@80 477 end
Nenue@80 478 function OrderHallCommandBarMod:Setup()
Nenue@80 479 if OrderHallCommandBar then
Nenue@80 480 print('mapping orderhall bar')
Nenue@80 481 hooksecurefunc(OrderHallCommandBar, 'Show', OrderHallCommandBarMod.Refresh)
Nenue@80 482 self:Refresh()
Nenue@80 483 self:UnregisterEvent('ADDON_LOADED')
Nenue@80 484 else
Nenue@80 485 self:RegisterEvent('ADDON_LOADED')
Nenue@80 486 self:SetScript('OnEvent', OrderHallCommandBarMod.Setup)
Nenue@80 487 end
Nenue@80 488 end
Nenue@59 489 plugin.init = function ()
Nenue@59 490 plugin.db = vn.db[PLUGIN_NAME]
Nenue@80 491 OrderHallCommandBarMod:Setup()
Nenue@59 492 end