-
Notifications
You must be signed in to change notification settings - Fork 1
/
timer_bars.lua
79 lines (63 loc) · 2.47 KB
/
timer_bars.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
-- Original TimerTracker work by Elv, modified for caelUI by Jankly
-- Dummy Bar: /run TimerTracker_OnLoad(TimerTracker); TimerTracker_OnEvent(TimerTracker, "START_TIMER", 1, 30, 30)
local TimerBars = CreateModule("TimerBars")
-- Redefin the MirrorTimerColors
MirrorTimerColors = {
["EXHAUSTION"] = {r = 1, g = 0.9, b = 0},
["BREATH"] = {r = 0.31, g = 0.43, b = 0.7},
["DEATH"] = {r = 1, g = 0.7, b = 0},
["FEIGNDEATH"] = {r = 1, g = 0.7, b = 0},
}
local SkinBar
do
local media = TimerBars:GetMedia()
local PixelScale = TimerBars.PixelScale
function SkinBar(bar)
local name = bar:GetName()
local barType = name:find("MirrorTimer%d") and "mirror" or "timer"
-- Increase the size of the bars just ever so slightly.
bar:SetHeight(PixelScale(22))
bar:SetWidth(PixelScale(220))
for index = 1, bar:GetNumRegions() do
local region = select(index, bar:GetRegions())
if region:GetObjectType() == "Texture" then
region:SetTexture(nil)
elseif region:GetObjectType() == "FontString" then
region:SetFont(media.fonts.normal, 11, "THICKOUTLINE")
region:SetShadowColor(0, 0, 0, 0)
region:SetTextColor(1, 1, 1)
-- Recenter the text into the middle of the bar.
region:ClearAllPoints()
region:SetAllPoints(bar)
end
end
if barType == "timer" then
bar:SetStatusBarTexture(media.files.statusbar_e)
bar:SetStatusBarColor(bar:GetStatusBarColor())
elseif barType == "mirror" then
local statusbar = _G[name .. "StatusBar"]
statusbar:SetStatusBarTexture(media.files.statusbar_e)
statusbar:SetAllPoints(bar)
end
TimerBars.CreateBackdrop(bar)
bar.skinned = true
end
end
-- The two below blocks will make the entire skinning happen.
TimerBars:RegisterEvent("START_TIMER", function()
for _, timer in next, TimerTracker.timerList do
local bar = timer["bar"]
if bar and not bar.skinned then
SkinBar(bar, "timer")
end
end
end)
-- {EXHAUSTION, BREATH, DEATH, FEIGNDEATH}
TimerBars:RegisterEvent("MIRROR_TIMER_START", function()
for index = 1, MIRRORTIMER_NUMTIMERS do
local bar = _G["MirrorTimer" .. index]
if not bar.skinned then
SkinBar(bar, "mirror")
end
end
end)