@@ -184,7 +184,9 @@ local function UpdatePips(element, numStages)
184
184
pip :Show ()
185
185
186
186
if (isHoriz ) then
187
- pip :RotateTextures (0 )
187
+ if (pip .RotateTextures ) then
188
+ pip :RotateTextures (0 )
189
+ end
188
190
189
191
if (element :GetReverseFill ()) then
190
192
pip :SetPoint (' TOP' , element , ' TOPRIGHT' , - offset , 0 )
@@ -194,7 +196,9 @@ local function UpdatePips(element, numStages)
194
196
pip :SetPoint (' BOTTOM' , element , ' BOTTOMLEFT' , offset , 0 )
195
197
end
196
198
else
197
- pip :RotateTextures (1.5708 )
199
+ if (pip .RotateTextures ) then
200
+ pip :RotateTextures (1.5708 )
201
+ end
198
202
199
203
if (element :GetReverseFill ()) then
200
204
pip :SetPoint (' LEFT' , element , ' TOPLEFT' , 0 , - offset )
@@ -212,11 +216,25 @@ local function UpdatePips(element, numStages)
212
216
end
213
217
end
214
218
219
+ --[[ Override: Castbar:ShouldShow(unit)
220
+ Handles check for which unit the castbar should show for.
221
+ Defaults to the object unit.
222
+ * self - the Castbar widget
223
+ * unit - the unit for which the update has been triggered (string)
224
+ --]]
225
+ local function ShouldShow (element , unit )
226
+ return element .__owner .unit == unit
227
+ end
228
+
229
+
215
230
local function CastStart (self , real , unit , castGUID )
216
- if self .unit ~= unit then return end
217
231
if oUF .isRetail and real == ' UNIT_SPELLCAST_START' and not castGUID then return end
218
232
219
233
local element = self .Castbar
234
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
235
+ return
236
+ end
237
+
220
238
local name , text , texture , startTime , endTime , isTradeSkill , castID , notInterruptible , spellID = UnitCastingInfo (unit )
221
239
222
240
local numStages , _
@@ -328,9 +346,11 @@ local function CastStart(self, real, unit, castGUID)
328
346
end
329
347
330
348
local function CastUpdate (self , event , unit , castID , spellID )
331
- if (self .unit ~= unit ) then return end
332
-
333
349
local element = self .Castbar
350
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
351
+ return
352
+ end
353
+
334
354
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
335
355
return
336
356
end
@@ -385,9 +405,11 @@ local function CastUpdate(self, event, unit, castID, spellID)
385
405
end
386
406
387
407
local function CastStop (self , event , unit , castID , spellID )
388
- if (self .unit ~= unit ) then return end
389
-
390
408
local element = self .Castbar
409
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
410
+ return
411
+ end
412
+
391
413
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
392
414
return
393
415
end
@@ -415,9 +437,11 @@ local function CastStop(self, event, unit, castID, spellID)
415
437
end
416
438
417
439
local function CastFail (self , event , unit , castID , spellID )
418
- if (self .unit ~= unit ) then return end
419
-
420
440
local element = self .Castbar
441
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
442
+ return
443
+ end
444
+
421
445
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
422
446
return
423
447
end
@@ -453,9 +477,11 @@ local function CastFail(self, event, unit, castID, spellID)
453
477
end
454
478
455
479
local function CastInterruptible (self , event , unit )
456
- if (self .unit ~= unit ) then return end
457
-
458
480
local element = self .Castbar
481
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
482
+ return
483
+ end
484
+
459
485
if (not element :IsShown ()) then return end
460
486
461
487
element .notInterruptible = event == ' UNIT_SPELLCAST_NOT_INTERRUPTIBLE'
0 commit comments