Mercurial > wow > buffalo2
comparison Modules/BuffFrame.lua @ 74:cd6e78091b04
- clear points from anything that is xml
| author | Nenue |
|---|---|
| date | Tue, 23 Aug 2016 19:50:10 -0400 |
| parents | 95ed343c3a42 |
| children | d9d16e67725c |
comparison
equal
deleted
inserted
replaced
| 73:95ed343c3a42 | 74:cd6e78091b04 |
|---|---|
| 73 if not (_G[name..'Veneer']) then | 73 if not (_G[name..'Veneer']) then |
| 74 print('|cFF88FF00Creating', name,'Veneer') | 74 print('|cFF88FF00Creating', name,'Veneer') |
| 75 local veneer = vn.GetVeneer(frame, 'VeneerBuffTemplate') | 75 local veneer = vn.GetVeneer(frame, 'VeneerBuffTemplate') |
| 76 local id = frame:GetID() | 76 local id = frame:GetID() |
| 77 | 77 |
| 78 local position = tonumber(name:match("%d")) | |
| 79 if position == 1 then | |
| 80 veneer:Show() | |
| 81 end | |
| 82 | 78 |
| 83 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 0, -6) | 79 veneer.progress:SetPoint('BOTTOMLEFT', veneer, 'BOTTOMLEFT', 0, -6) |
| 84 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1) | 80 veneer.progress:SetPoint('TOPRIGHT', veneer, 'BOTTOMRIGHT', 0, -1) |
| 85 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) | 81 veneer.progress:SetHeight(BUFF_PROGRESS_SIZE + (BUFF_PROGRESS_INSET * 2)) |
| 86 | 82 |
| 87 veneer.progress.fg:SetColorTexture(0,1,0,1) | 83 veneer.progress.fg:SetColorTexture(0,1,0,1) |
| 88 veneer.progress.fg:SetPoint('BOTTOMLEFT', BUFF_PROGRESS_INSET,BUFF_PROGRESS_INSET) | 84 veneer.progress.fg:SetPoint('BOTTOMLEFT', BUFF_PROGRESS_INSET,BUFF_PROGRESS_INSET) |
| 89 veneer.progress.fg:SetPoint('TOP', 0, -BUFF_PROGRESS_INSET) | 85 veneer.progress.fg:SetPoint('TOP', 0, -BUFF_PROGRESS_INSET) |
| 90 | 86 |
| 91 veneer.duration:SetFontObject(VeneerNumberFont) | 87 veneer.duration:SetFontObject(VeneerNumberFont) |
| 92 veneer.duration:SetPoint('TOP', veneer, 'BOTTOM', 0, -2) | 88 veneer.duration:ClearAllPoints() |
| 89 veneer.duration:SetPoint('BOTTOM', veneer, 'BOTTOM', 0, 2) | |
| 93 | 90 |
| 94 veneer.count:SetFontObject(VeneerNumberFont) | 91 veneer.count:SetFontObject(VeneerNumberFont) |
| 95 veneer.count:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -3, 3) | 92 veneer.count:ClearAllPoints() |
| 93 veneer.count:SetPoint('TOPRIGHT', veneer, 'TOPRIGHT', -3, -3) | |
| 96 | 94 |
| 97 veneer.underlay:SetParent(UIParent) | 95 veneer.underlay:SetParent(UIParent) |
| 98 veneer.underlay:SetFrameStrata('BACKGROUND') | 96 veneer.underlay:SetFrameStrata('BACKGROUND') |
| 99 veneer.border:SetColorTexture(0,0,0,1) | 97 veneer.border:SetColorTexture(0,0,0,0) |
| 100 veneer.border:SetPoint('TOPLEFT', veneer, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U) | 98 veneer.border:SetPoint('TOPLEFT', veneer, 'TOPLEFT', -BORDER_SIZE_L, BORDER_SIZE_U) |
| 101 veneer.border:SetPoint('BOTTOMRIGHT', veneer, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D) | 99 veneer.border:SetPoint('BOTTOMRIGHT', veneer, 'BOTTOMRIGHT', BORDER_SIZE_R, -BORDER_SIZE_D) |
| 102 veneer.border:Show() | 100 veneer.border:Show() |
| 103 | 101 |
| 104 | 102 |
| 159 end) | 157 end) |
| 160 end | 158 end |
| 161 if count then | 159 if count then |
| 162 count:ClearAllPoints() | 160 count:ClearAllPoints() |
| 163 hooksecurefunc(count, 'SetText', function(self, text) | 161 hooksecurefunc(count, 'SetText', function(self, text) |
| 162 print(self:GetName(), 'SetText', text) | |
| 163 local n = veneer.count:GetNumPoints() | |
| 164 for i = 1, n do | |
| 165 print(i, veneer.count:GetPoint(n)) | |
| 166 end | |
| 167 veneer.count.isUpdating = true | |
| 164 self:Hide() | 168 self:Hide() |
| 169 veneer.count:Show() | |
| 165 veneer.count:SetText(text) | 170 veneer.count:SetText(text) |
| 166 end) | 171 veneer.count.isUpdating = false |
| 167 hooksecurefunc(count, 'Hide', function(self, text) | 172 end) |
| 173 hooksecurefunc(count, 'Hide', function(self) | |
| 174 if veneer.count.isUpdating then | |
| 175 print('|cFFFF4400blocked Hide hook|r') | |
| 176 return | |
| 177 end | |
| 178 | |
| 179 print(self:GetName(), 'Hide') | |
| 168 veneer.count:Hide() | 180 veneer.count:Hide() |
| 169 end) | 181 end) |
| 170 hooksecurefunc(count, 'Show', function(self, text) | 182 hooksecurefunc(count, 'Show', function(self) |
| 183 print(self:GetName(), 'Show') | |
| 171 veneer.count:Show() | 184 veneer.count:Show() |
| 172 end) | 185 end) |
| 173 end | 186 end |
| 174 | 187 |
| 175 | 188 |
| 182 veneer.underlay:Hide() | 195 veneer.underlay:Hide() |
| 183 end) | 196 end) |
| 184 | 197 |
| 185 hooksecurefunc(frame, 'Show', function(self) | 198 hooksecurefunc(frame, 'Show', function(self) |
| 186 veneer:Show() | 199 veneer:Show() |
| 187 veneer.count:Show() | |
| 188 veneer.border:Show() | |
| 189 local isVisible = self:IsVisible() | 200 local isVisible = self:IsVisible() |
| 190 if isVisible ~= visibility[self] then | 201 if isVisible ~= visibility[self] then |
| 191 print('|cFFFFFF00SHOW|r', self:GetName()) | 202 print('|cFFFFFF00SHOW|r', self:GetName()) |
| 192 visibility[self] = isVisible | 203 visibility[self] = isVisible |
| 193 end | 204 end |
| 205 veneer.underlay:Show() | |
| 194 end) | 206 end) |
| 195 | 207 |
| 196 anchors[frame] = veneer | 208 anchors[frame] = veneer |
| 197 end | 209 end |
| 198 | 210 |
| 209 end | 221 end |
| 210 | 222 |
| 211 if frame.filter == 'HARMFUL' then | 223 if frame.filter == 'HARMFUL' then |
| 212 | 224 |
| 213 veneer.border:Show() | 225 veneer.border:Show() |
| 226 else | |
| 227 veneer.border:Hide() | |
| 214 end | 228 end |
| 215 | 229 |
| 216 | 230 |
| 217 if expires and duration then | 231 if expires and duration then |
| 218 if duration ~= 0 then | 232 if duration ~= 0 then |
| 316 if BuffButton1 then | 330 if BuffButton1 then |
| 317 TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0) | 331 TempEnchant1:SetPoint('TOPRIGHT', BuffButton1, 'TOPRIGHT', BuffButton1:GetWidth()+4, 0) |
| 318 end | 332 end |
| 319 | 333 |
| 320 local lastBuff, topBuff | 334 local lastBuff, topBuff |
| 335 local numBuffs = 0 | |
| 321 for i = 1, BUFF_ACTUAL_DISPLAY do | 336 for i = 1, BUFF_ACTUAL_DISPLAY do |
| 322 local buff = _G['BuffButton'..i] | 337 local buff = _G['BuffButton'..i] |
| 323 if buff then | 338 if buff then |
| 324 if mod(i,12) == 1 then | 339 numBuffs = numBuffs + 1 |
| 325 if i == 1 then | 340 buff:ClearAllPoints() |
| 341 if mod(numBuffs,12) == 1 then | |
| 342 if numBuffs == 1 then | |
| 326 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) | 343 buff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) |
| 344 plugin.currentTop = buff:GetTop() | |
| 327 else | 345 else |
| 328 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) | 346 buff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 329 end | 347 end |
| 330 topBuff = buff | 348 topBuff = buff |
| 331 else | 349 else |
| 333 end | 351 end |
| 334 lastBuff = buff | 352 lastBuff = buff |
| 335 end | 353 end |
| 336 end | 354 end |
| 337 | 355 |
| 356 numBuffs = 0 | |
| 338 for i = 1, DEBUFF_ACTUAL_DISPLAY do | 357 for i = 1, DEBUFF_ACTUAL_DISPLAY do |
| 339 local debuff = _G['DebuffButton'..i] | 358 local debuff = _G['DebuffButton'..i] |
| 340 if debuff then | 359 if debuff then |
| 341 if i == 1 then | 360 numBuffs = numBuffs + 1 |
| 361 if numBuffs == 1 then | |
| 342 if topBuff then | 362 if topBuff then |
| 343 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) | 363 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 344 else | 364 else |
| 345 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) | 365 debuff:SetPoint('TOPRIGHT', UIParent, 'TOPRIGHT', -120, -6) |
| 346 end | 366 end |
| 347 topBuff = debuff | 367 topBuff = debuff |
| 348 elseif mod(i, 12) == 1 then | 368 elseif mod(numBuffs, 12) == 1 then |
| 349 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) | 369 debuff:SetPoint('TOPRIGHT', topBuff, 'BOTTOMRIGHT', 0, -BUFF_BUTTON_SPACING_V) |
| 350 topBuff = debuff | 370 topBuff = debuff |
| 351 else | 371 else |
| 352 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) | 372 debuff:SetPoint('TOPRIGHT', lastBuff, 'TOPLEFT', -BUFF_BUTTON_SPACING_H, 0) |
| 353 end | 373 end |
| 354 lastBuff = debuff | 374 lastBuff = debuff |
| 355 end | 375 end |
| 356 end | 376 end |
| 357 | 377 |
| 378 if lastBuff then | |
| 379 plugin.currentBottom = lastBuff:GetBottom() | |
| 380 end | |
| 358 end | 381 end |
| 359 | 382 |
| 360 local AuraButton_UpdateDuration = function(frame, timeLeft) | 383 local AuraButton_UpdateDuration = function(frame, timeLeft) |
| 361 local veneer = GetVeneer(frame) | 384 local veneer = GetVeneer(frame) |
| 362 local hours = floor(timeLeft/3600) | 385 local hours = floor(timeLeft/3600) |
| 369 timeString = format('%d:%02d', minutes, seconds) | 392 timeString = format('%d:%02d', minutes, seconds) |
| 370 else | 393 else |
| 371 timeString = format('%d', seconds) | 394 timeString = format('%d', seconds) |
| 372 end | 395 end |
| 373 | 396 |
| 397 if timeLeft < 10 then | |
| 398 if not veneer.duration.getHuge then | |
| 399 veneer.duration.getHuge = true | |
| 400 veneer.duration:SetFontObject(VeneerNumberFontLarge) | |
| 401 veneer.duration:SetTextColor(1,0,0,1) | |
| 402 end | |
| 403 else | |
| 404 if veneer.duration.getHuge then | |
| 405 veneer.duration.getHuge = nil | |
| 406 veneer.duration:SetFontObject(VeneerNumberFont) | |
| 407 veneer.duration:SetTextColor(1,1,1,1) | |
| 408 end | |
| 409 | |
| 410 end | |
| 411 | |
| 374 | 412 |
| 375 veneer.duration:SetText(timeString) | 413 veneer.duration:SetText(timeString) |
| 376 veneer.duration:SetVertexColor(1,1,1) | |
| 377 end | 414 end |
| 378 | 415 |
| 379 | 416 |
| 380 -- Obtains the first instance of Tenchant use | 417 -- Obtains the first instance of Tenchant use |
| 381 | 418 |
