Mercurial > wow > buffalo2
comparison Modules/BuffFrame.lua @ 71:6f8661094643
- obtains veneer objects through a common function and track them as a unified table.
| author | Nenue |
|---|---|
| date | Tue, 23 Aug 2016 06:35:08 -0400 |
| parents | 1b0d7bcd252e |
| children | 95ed343c3a42 |
comparison
equal
deleted
inserted
replaced
| 70:1b0d7bcd252e | 71:6f8661094643 |
|---|---|
| 10 - TempEnchant info returns relative values only, and they don't synchronize with aura events | 10 - TempEnchant info returns relative values only, and they don't synchronize with aura events |
| 11 - BuffButtons can only be hidden/shown by blizzcode, so functions doing that have to be accounted for | 11 - BuffButtons can only be hidden/shown by blizzcode, so functions doing that have to be accounted for |
| 12 --]] | 12 --]] |
| 13 | 13 |
| 14 local BUFF_BUTTON_SIZE = 48 | 14 local BUFF_BUTTON_SIZE = 48 |
| 15 local BUFF_BUTTON_SPACING_H = 4 | |
| 16 local BUFF_BUTTON_SPACING_V = 14 | |
| 15 local BUFF_PROGRESS_SIZE = 4 | 17 local BUFF_PROGRESS_SIZE = 4 |
| 16 local BUFF_PROGRESS_INSET = 1 | 18 local BUFF_PROGRESS_INSET = 1 |
| 17 local BUFF_BUTTON_ZOOM = .15 | 19 local BUFF_BUTTON_ZOOM = .15 |
| 18 local BORDER_SIZE_L = 1 | 20 local BORDER_SIZE_L = 0 |
| 19 local BORDER_SIZE_R = 1 | 21 local BORDER_SIZE_R = 0 |
| 20 local BORDER_SIZE_U = 4 | 22 local BORDER_SIZE_U = 4 |
| 21 local BORDER_SIZE_D = 1 | 23 local BORDER_SIZE_D = 0 |
| 22 | 24 |
| 23 | 25 |
| 24 local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent) | 26 local plugin = CreateFrame('Frame', 'VeneerBuffFrame', UIParent) |
| 25 local vn, print = LibStub("LibKraken").register(VeneerController, plugin) | 27 local vn, print = LibStub("LibKraken").register(VeneerController, plugin) |
| 26 local tprint = DEVIAN_WORKSPACE and function(...) _G.print('Timer', ...) end or function() end | 28 local tprint = DEVIAN_WORKSPACE and function(...) _G.print('Timer', ...) end or function() end |
| 62 local pendingFrames = {} | 64 local pendingFrames = {} |
| 63 local anchors = {} | 65 local anchors = {} |
| 64 local expirationCache = {} | 66 local expirationCache = {} |
| 65 local visibility = {} | 67 local visibility = {} |
| 66 | 68 |
| 67 local VeneerButton_OnHide = function(self) | |
| 68 self:SetScript('OnDragStart', self.StartMoving) | |
| 69 self:SetScript('OnDragStop', self.StopMovingOrSizing) | |
| 70 self:SetMovable(false) | |
| 71 self:EnableMouse(false) | |
| 72 self:RegisterForDrag('LeftButton') | |
| 73 end | |
| 74 local VeneerButton_OnShow = function(self) | |
| 75 self:SetScript('OnDragStart', self.StartMoving) | |
| 76 self:SetScript('OnDragStop', self.StopMovingOrSizing) | |
| 77 self:SetMovable(false) | |
| 78 self:EnableMouse(false) | |
| 79 self:RegisterForDrag('LeftButton') | |
| 80 end | |
| 81 | 69 |
| 82 | 70 |
| 83 local GetVeneer = function(frame) | 71 local GetVeneer = function(frame) |
| 84 local name = frame:GetName() | 72 local name = frame:GetName() |
| 85 if not (_G[name..'Veneer']) then | 73 if not (_G[name..'Veneer']) then |
| 86 print('|cFF88FF00Creating', name,'Veneer') | 74 print('|cFF88FF00Creating', name,'Veneer') |
| 87 local veneer = CreateFrame('Frame', name..'Veneer', UIParent) | 75 local veneer = vn.GetVeneer(frame) |
| 88 local id = frame:GetID() | 76 local id = frame:GetID() |
| 89 veneer:SetAllPoints(frame) | |
| 90 veneer:SetParent(frame) | |
| 91 veneer.bg = veneer:CreateTexture() | |
| 92 veneer.bg:SetColorTexture(1,1,1,0) | |
| 93 veneer.bg:SetAllPoints(veneer) | |
| 94 veneer.bg:Show() | |
| 95 veneer:Hide() | |
| 96 veneer:EnableMouse(false) | |
| 97 | |
| 98 veneer:SetScript('OnShow', VeneerButton_OnShow) | |
| 99 veneer:SetScript('OnHide', VeneerButton_OnHide) | |
| 100 | 77 |
| 101 local position = tonumber(name:match("%d")) | 78 local position = tonumber(name:match("%d")) |
| 102 if position == 1 then | 79 if position == 1 then |
| 103 veneer:Show() | 80 veneer:Show() |
| 104 end | 81 end |
| 105 | 82 |
| 106 veneer.progress = CreateFrame('Frame', name .. 'VeneerProgress', veneer) | 83 veneer.progress = CreateFrame('Frame', name .. 'VeneerProgress', veneer) |
| 107 veneer.progress:Hide() | 84 veneer.progress:Hide() |
| 108 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 3, -6) | 85 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 0, -6) |
| 109 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', -3, -1) | 86 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1) |
| 110 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) | 87 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) |
| 111 | 88 |
| 112 veneer.progress.bg = veneer.progress:CreateTexture(nil, 'BACKGROUND') | 89 veneer.progress.bg = veneer.progress:CreateTexture(nil, 'BACKGROUND') |
| 113 veneer.progress.bg:SetColorTexture(0,0,0,1) | 90 veneer.progress.bg:SetColorTexture(0,0,0,1) |
| 114 veneer.progress.bg:SetAllPoints(veneer.progress) | 91 veneer.progress.bg:SetAllPoints(veneer.progress) |
| 196 if border then | 173 if border then |
| 197 border:Hide() | 174 border:Hide() |
| 198 hooksecurefunc(border, 'SetVertexColor', function(frame, r, g, b, a) | 175 hooksecurefunc(border, 'SetVertexColor', function(frame, r, g, b, a) |
| 199 frame:Hide() | 176 frame:Hide() |
| 200 print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) | 177 print('|cFF0088FFborder:SetVertexColor|r', r,g,b,a) |
| 201 veneer.border:SetColorTexture(r,g,b,a) | 178 veneer.progress.fg:SetColorTexture(r,g,b,a) |
| 202 end) | 179 end) |
| 203 | 180 |
| 204 local color = DebuffTypeColor["none"] | 181 local color = DebuffTypeColor["none"] |
| 205 if aurasCache[frame] and aurasCache[frame][5] then | 182 if aurasCache[frame] and aurasCache[frame][5] then |
| 206 color = DebuffTypeColor[aurasCache[frame][5]] | 183 color = DebuffTypeColor[aurasCache[frame][5]] |
| 207 end | 184 end |
| 208 | 185 |
| 209 veneer.border:SetColorTexture(color.r,color.g,color.b) | 186 veneer.progress.fg:SetColorTexture(color.r,color.g,color.b) |
| 210 end | 187 end |
| 211 if duration then | 188 if duration then |
| 212 duration:ClearAllPoints() | 189 duration:ClearAllPoints() |
| 213 --duration:SetPoint('TOP', frame, 'BOTTOM', 0, -8) | 190 --duration:SetPoint('TOP', frame, 'BOTTOM', 0, -8) |
| 214 --duration:SetFontObject(VeneerNumberFont) | 191 --duration:SetFontObject(VeneerNumberFont) |
| 390 | 367 |
| 391 local lastBuff, topBuff | 368 local lastBuff, topBuff |
| 392 for i = 1, BUFF_ACTUAL_DISPLAY do | 369 for i = 1, BUFF_ACTUAL_DISPLAY do |
| 393 local buff = _G['BuffButton'..i] | 370 local buff = _G['BuffButton'..i] |
| 394 if buff then | 371 if buff then |
| 395 if i == 1 then | 372 if mod(i,12) == 1 then |
| 396 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) | 373 if i == 1 then |
| 397 topBuff = buff | 374 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) |
| 398 elseif mod(i,12) == 1 then | 375 else |
| 399 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) | 376 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 377 end | |
| 400 topBuff = buff | 378 topBuff = buff |
| 401 else | 379 else |
| 402 buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT') | 380 buff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) |
| 403 end | 381 end |
| 404 lastBuff = buff | 382 lastBuff = buff |
| 405 end | 383 end |
| 406 end | 384 end |
| 407 | 385 |
| 408 for i = 1, DEBUFF_ACTUAL_DISPLAY do | 386 for i = 1, DEBUFF_ACTUAL_DISPLAY do |
| 409 local debuff = _G['DebuffButton'..i] | 387 local debuff = _G['DebuffButton'..i] |
| 410 if debuff then | 388 if debuff then |
| 411 if i == 1 then | 389 if i == 1 then |
| 412 if topBuff then | 390 if topBuff then |
| 413 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) | 391 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 414 else | 392 else |
| 415 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) | 393 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) |
| 416 end | 394 end |
| 417 topBuff = debuff | 395 topBuff = debuff |
| 418 elseif mod(i, 12) == 1 then | 396 elseif mod(i, 12) == 1 then |
| 419 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -14) | 397 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 420 topBuff = debuff | 398 topBuff = debuff |
| 421 else | 399 else |
| 422 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT') | 400 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) |
| 423 end | 401 end |
| 424 lastBuff = debuff | 402 lastBuff = debuff |
| 425 end | 403 end |
| 426 end | 404 end |
| 427 | 405 |
