Mercurial > wow > buffalo2
comparison BuffFrame/BuffButton.lua @ 50:d7655c4e6e06 v1.0-release
disambiguate local module names
author | Nenue |
---|---|
date | Fri, 29 Apr 2016 10:52:43 -0400 |
parents | 9837069e366a |
children | 07ef62fe201f |
comparison
equal
deleted
inserted
replaced
49:16465f3fd919 | 50:d7655c4e6e06 |
---|---|
12 local floor, wipe, max = _G.math.floor, _G.table.wipe, _G.math.max | 12 local floor, wipe, max = _G.math.floor, _G.table.wipe, _G.math.max |
13 local CreateFrame, IsInGroup, GetCVarBool = _G.CreateFrame, _G.IsInGroup, _G.GetCVarBool | 13 local CreateFrame, IsInGroup, GetCVarBool = _G.CreateFrame, _G.IsInGroup, _G.GetCVarBool |
14 local BuffFrame, ConsolidatedBuffs = _G.BuffFrame, _G.ConsolidatedBuffs | 14 local BuffFrame, ConsolidatedBuffs = _G.BuffFrame, _G.ConsolidatedBuffs |
15 local UnitAura, UnitName, RegisterStateDriver = _G.UnitAura, _G.UnitName, _G.RegisterStateDriver | 15 local UnitAura, UnitName, RegisterStateDriver = _G.UnitAura, _G.UnitName, _G.RegisterStateDriver |
16 | 16 |
17 local M = B:RegisterModule(MODULE) | 17 local Aura = B:RegisterModule(MODULE) |
18 local displays = M.displays | 18 local displays = Aura.displays |
19 local print, gprint, aprint, fprint = B.print('Buff'), B.print('SetGuides'), B.print('SetAnchors'), B.fprint | 19 local print, gprint, aprint, fprint = B.print('Buff'), B.print('SetGuides'), B.print('SetAnchors'), B.fprint |
20 | 20 |
21 M.GetBuffZoom = function(buffName) | 21 Aura.GetBuffZoom = function(buffName) |
22 local zoom = tonumber(M.displays[buffName].conf['Zoom']) / 100 / 2 | 22 local zoom = tonumber(Aura.displays[buffName].conf['Zoom']) / 100 / 2 |
23 local zoomL, zoomU, zoomR, zoomD = zoom, zoom, 1-zoom, 1-zoom | 23 local zoomL, zoomU, zoomR, zoomD = zoom, zoom, 1-zoom, 1-zoom |
24 print(buffName, zoom) | 24 print(buffName, zoom) |
25 return function(self, ...) | 25 return function(self, ...) |
26 if select('#',...) == 4 then | 26 if select('#',...) == 4 then |
27 zoomL, zoomR, zoomU, zoomD = ... | 27 zoomL, zoomR, zoomU, zoomD = ... |
31 end | 31 end |
32 end | 32 end |
33 | 33 |
34 | 34 |
35 | 35 |
36 M.UpdateButtonAlpha = function(self) | 36 Aura.UpdateButtonAlpha = function(self) |
37 if not self.parent.timeLeft or not self:IsVisible() then | 37 if not self.parent.timeLeft or not self:IsVisible() then |
38 self:SetScript('OnUpdate', nil) | 38 self:SetScript('OnUpdate', nil) |
39 return | 39 return |
40 end | 40 end |
41 | 41 |
46 end | 46 end |
47 end | 47 end |
48 | 48 |
49 --- Called infrequently to align stencil frames | 49 --- Called infrequently to align stencil frames |
50 local refreshCount = 0 | 50 local refreshCount = 0 |
51 M.UpdateGuideFrames = function(buffName) | 51 Aura.UpdateGuideFrames = function(buffName) |
52 refreshCount = refreshCount + 1 | 52 refreshCount = refreshCount + 1 |
53 local print = fprint() | 53 local print = fprint() |
54 print(buffName) | 54 print(buffName) |
55 local displays, anchors = M.displays, M.anchors | 55 local displays, anchors = Aura.displays, Aura.anchors |
56 local guides, decors = M.guides, M.decors | 56 local guides, decors = Aura.guides, Aura.decors |
57 | 57 |
58 local anchor = anchors[buffName] | 58 local anchor = anchors[buffName] |
59 local c, g, d = displays[buffName].conf, guides[buffName], decors[buffName] | 59 local c, g, d = displays[buffName].conf, guides[buffName], decors[buffName] |
60 local perRow = c['PerRow'] | 60 local perRow = c['PerRow'] |
61 local buffSpacing, buffSize, buffBorder, buffDurationSize, buffCountSize, relativeX, relativeY = c['Spacing'], c['Size'], c['Border'], c['DurationSize'], c['CountSize'], c['RelativeX'], c['RelativeY'] | 61 local buffSpacing, buffSize, buffBorder, buffDurationSize, buffCountSize, relativeX, relativeY = c['Spacing'], c['Size'], c['Border'], c['DurationSize'], c['CountSize'], c['RelativeX'], c['RelativeY'] |
65 | 65 |
66 print('|cFF00FF00Setting Guides ('..refreshCount..'):|r', buffName, 'user max:',c['Max'], 'hard max:', displays[buffName].maxIcons) | 66 print('|cFF00FF00Setting Guides ('..refreshCount..'):|r', buffName, 'user max:',c['Max'], 'hard max:', displays[buffName].maxIcons) |
67 | 67 |
68 local buffMax = min(c['Max'], displays[buffName].maxIcons) | 68 local buffMax = min(c['Max'], displays[buffName].maxIcons) |
69 local anchorFrom, anchorTo = c.Point[1], c.Point[2] | 69 local anchorFrom, anchorTo = c.Point[1], c.Point[2] |
70 anchor.Zoom = M.GetBuffZoom(buffName) | 70 anchor.Zoom = Aura.GetBuffZoom(buffName) |
71 | 71 |
72 | 72 |
73 | 73 |
74 if consolidated then | 74 if consolidated then |
75 buffMax = buffMax + 1 | 75 buffMax = buffMax + 1 |
193 anchor.up = up | 193 anchor.up = up |
194 | 194 |
195 print(anchor:GetName(), anchor:GetSize()) | 195 print(anchor:GetName(), anchor:GetSize()) |
196 end | 196 end |
197 | 197 |
198 M.UpdateButtonPositions = function(buffName, auraType) | 198 Aura.UpdateButtonPositions = function(buffName, auraType) |
199 local print = fprint() | 199 local print = fprint() |
200 local c = auraType.conf | 200 local c = auraType.conf |
201 local numBuffs = 0 | 201 local numBuffs = 0 |
202 local actualIcons = auraType.actualIcons() | 202 local actualIcons = auraType.actualIcons() |
203 local maxIcons = auraType.maxIcons | 203 local maxIcons = auraType.maxIcons |
204 local guides, decors, anchors, drawn = M.guides, M.decors, M.anchors, M.drawn | 204 local guides, decors, anchors, drawn = Aura.guides, Aura.decors, Aura.anchors, Aura.drawn |
205 | 205 |
206 local anchor = anchors[buffName] | 206 local anchor = anchors[buffName] |
207 local buffMax = c['Max'] | 207 local buffMax = c['Max'] |
208 local consolidated = (anchor.contains and IsInGroup()) | 208 local consolidated = (anchor.contains and IsInGroup()) |
209 local consolidatedPosition = (consolidated and anchor.containPosition or 0) | 209 local consolidatedPosition = (consolidated and anchor.containPosition or 0) |
294 local from, to = unpack(c.DurationPoint) | 294 local from, to = unpack(c.DurationPoint) |
295 buffDuration:SetPoint(from, guide.duration, to) | 295 buffDuration:SetPoint(from, guide.duration, to) |
296 buffDuration:SetText('WHAT') | 296 buffDuration:SetText('WHAT') |
297 | 297 |
298 if buff.timeLeft and c.WarningFade then | 298 if buff.timeLeft and c.WarningFade then |
299 deco:SetScript('OnUpdate', M.UpdateButtonAlpha) | 299 deco:SetScript('OnUpdate', Aura.UpdateButtonAlpha) |
300 else | 300 else |
301 deco:SetScript('OnUpdate', nil) | 301 deco:SetScript('OnUpdate', nil) |
302 deco:SetAlpha(1.0) | 302 deco:SetAlpha(1.0) |
303 end | 303 end |
304 | 304 |
367 anchor.outer_X = 0 | 367 anchor.outer_X = 0 |
368 anchor.outer_Y = 0 | 368 anchor.outer_Y = 0 |
369 end | 369 end |
370 | 370 |
371 if anchor.attached then | 371 if anchor.attached then |
372 M.UpdateAnchorChild(anchor, anchor.attached, anchor.attachmentConf) | 372 Aura.UpdateAnchorChild(anchor, anchor.attached, anchor.attachmentConf) |
373 end | 373 end |
374 | 374 |
375 end | 375 end |
376 | 376 |
377 M.PostBuffAnchors = function() | 377 Aura.PostBuffAnchors = function() |
378 local print = fprint() | 378 local print = fprint() |
379 local anchors = M.anchors | 379 local anchors = Aura.anchors |
380 if M.ShowConsolidatedBuffs then | 380 if Aura.ShowConsolidatedBuffs then |
381 M.UpdateRaidBuffs() | 381 Aura.UpdateRaidBuffs() |
382 end | 382 end |
383 for buttonName, auraType in pairs(displays) do | 383 for buttonName, auraType in pairs(displays) do |
384 print('sending', buttonName, auraType) | 384 print('sending', buttonName, auraType) |
385 -- if waiting for anchors | 385 -- if waiting for anchors |
386 if not anchors[buttonName] then | 386 if not anchors[buttonName] then |
387 return | 387 return |
388 end | 388 end |
389 | 389 |
390 --if positioned[buttonName] == 0 then | 390 --if positioned[buttonName] == 0 then |
391 print('possibly reloaded UI, check positions') | 391 print('possibly reloaded UI, check positions') |
392 M.UpdateGuideFrames(buttonName) | 392 Aura.UpdateGuideFrames(buttonName) |
393 --end | 393 --end |
394 | 394 |
395 M.UpdateButtonPositions(buttonName, auraType) | 395 Aura.UpdateButtonPositions(buttonName, auraType) |
396 end | 396 end |
397 end | 397 end |
398 | 398 |
399 M.UpdateBuffs = function(buttonName, forced) | 399 Aura.UpdateBuffs = function(buttonName, forced) |
400 local displays, drawn = M.displays, M.drawn | 400 local displays, drawn = Aura.displays, Aura.drawn |
401 local print = B.fprint(buttonName) | 401 local print = B.fprint(buttonName) |
402 local c = displays[buttonName].conf | 402 local c = displays[buttonName].conf |
403 if drawn[buttonName] then | 403 if drawn[buttonName] then |
404 wipe(drawn[buttonName]) | 404 wipe(drawn[buttonName]) |
405 else | 405 else |
406 drawn[buttonName] = {} | 406 drawn[buttonName] = {} |
407 end | 407 end |
408 | 408 |
409 M.UpdateAnchorFrames(buttonName) | 409 Aura.UpdateAnchorFrames(buttonName) |
410 M.UpdateGuideFrames(buttonName) | 410 Aura.UpdateGuideFrames(buttonName) |
411 M.UpdateButtonPositions(buttonName, displays[buttonName]) | 411 Aura.UpdateButtonPositions(buttonName, displays[buttonName]) |
412 end | 412 end |
413 | 413 |
414 --- should only be called from user input | 414 --- should only be called from user input |
415 print('init def') | 415 print('init def') |