@@ -6,6 +6,35 @@ local function GetNormalizedUnit(unit)
66 return normalizedUnit
77end
88
9+ local function FetchPowerBarColour (unit , powerType )
10+ local UUFDB = UUF .db .profile
11+ local GeneralDB = UUFDB .General
12+ local normalizedUnit = GetNormalizedUnit (unit )
13+ local PowerBarDB = UUFDB [normalizedUnit ].PowerBar
14+ if PowerBarDB then
15+ if PowerBarDB .ColourByType then
16+ local powerColour = GeneralDB .CustomColours .Power [powerType ]
17+ if powerColour then return GeneralDB .CustomColours .Power [powerType ][1 ], GeneralDB .CustomColours .Power [powerType ][2 ], GeneralDB .CustomColours .Power [powerType ][3 ], GeneralDB .CustomColours .Power [powerType ][4 ] or 1 end
18+ end
19+ return PowerBarDB .FGColour [1 ], PowerBarDB .FGColour [2 ], PowerBarDB .FGColour [3 ], PowerBarDB .FGColour [4 ]
20+ end
21+ end
22+
23+ local function FetchPowerBarBackgroundColour (unit , powerType )
24+ local UUFDB = UUF .db .profile
25+ local GeneralDB = UUFDB .General
26+ local normalizedUnit = GetNormalizedUnit (unit )
27+ local PowerBarDB = UUFDB [normalizedUnit ].PowerBar
28+ if PowerBarDB then
29+ if PowerBarDB .ColourBackgroundByType then
30+ local DarkenFactor = PowerBarDB .DarkenFactor
31+ local powerColour = GeneralDB .CustomColours .Power [powerType ]
32+ if powerColour then return (GeneralDB .CustomColours .Power [powerType ][1 ] * (1 - DarkenFactor )), (GeneralDB .CustomColours .Power [powerType ][2 ] * (1 - DarkenFactor )), (GeneralDB .CustomColours .Power [powerType ][3 ] * (1 - DarkenFactor )), GeneralDB .CustomColours .Power [powerType ][4 ] end
33+ end
34+ return PowerBarDB .BGColour [1 ], PowerBarDB .BGColour [2 ], PowerBarDB .BGColour [3 ], PowerBarDB .BGColour [4 ]
35+ end
36+ end
37+
938local Classes = {
1039 [1 ] = " WARRIOR" ,
1140 [2 ] = " PALADIN" ,
@@ -45,7 +74,6 @@ for i = 1, 10 do
4574 missingHealth = i * 600000 ,
4675 absorb = (i * 300000 ),
4776 percent = (8000000 - (i * 600000 )) / 8000000 * 100 ,
48- power = 100 - (i * 2 ),
4977 maxPower = 100 ,
5078 powerType = PowerTypes [i ],
5179 }
@@ -110,6 +138,13 @@ function UUF:ShowBossFrames()
110138 end
111139 end
112140
141+ if unitFrame .PowerBar then
142+ unitFrame .PowerBar :SetMinMaxValues (0 , 100 )
143+ unitFrame .PowerBar :SetValue (math.random (0 , 100 ))
144+ unitFrame .PowerBar :SetStatusBarColor (FetchPowerBarColour (unitFrame .unit , FakeBossData [i ].powerType ))
145+ unitFrame .PowerBarBG :SetStatusBarColor (FetchPowerBarBackgroundColour (unitFrame .unit , FakeBossData [i ].powerType ))
146+ end
147+
113148 -- Handle Fake Absorbs
114149 if unitFrame .AbsorbBar then
115150 unitFrame .AbsorbBar :SetMinMaxValues (0 , FakeBossData [i ].maxHealth )
@@ -143,6 +178,32 @@ function UUF:ShowBossFrames()
143178 unitFrame .Portrait .Texture :SetTexture (" Interface\\ ICONS\\ " .. PortraitOptions [i ])
144179 end
145180 end
181+
182+ -- Handle Fake Cast Bars
183+ if unitFrame .CastBar then
184+ unitFrame .CastBar :SetMinMaxValues (0 , 1000 )
185+ unitFrame .CastBar :SetValue (0 )
186+ unitFrame .CastBar .SpellName :SetText (" Boss " .. i .. " Cast" )
187+ unitFrame .CastBar .Time :SetText (" " )
188+ unitFrame .CastBar .Icon :SetTexture (" Interface\\ Icons\\ Spell_Holy_Heal" )
189+ if UUF .db .profile [GetNormalizedUnit (unitFrame .unit )].CastBar .Enabled then
190+ unitFrame .CastBar :Show ()
191+ unitFrame .CastBarContainer :Show ()
192+ unitFrame .CastBar :SetScript (" OnUpdate" , function ()
193+ local currentValue = unitFrame .CastBar :GetValue ()
194+ currentValue = currentValue + 1
195+ if currentValue >= 1000 then
196+ currentValue = 0
197+ end
198+ unitFrame .CastBar :SetValue (currentValue )
199+ unitFrame .CastBar .Time :SetText (string.format (" %.1f" , (currentValue / 1000 ) * 5 ))
200+ end )
201+ else
202+ unitFrame .CastBar :Hide ()
203+ unitFrame .CastBarContainer :Hide ()
204+ unitFrame .CastBar :SetScript (" OnUpdate" , nil )
205+ end
206+ end
146207 end
147208 end
148209
@@ -161,6 +222,7 @@ function UUF:HideBossFrames()
161222 unitFrame :Hide ()
162223 RegisterUnitWatch (unitFrame )
163224 UUF :UpdateUnitFrame (" boss" .. i )
225+ unitFrame .CastBar :SetScript (" OnUpdate" , nil )
164226 end
165227 end
166228
0 commit comments