@@ -216,11 +216,25 @@ local function UpdatePips(element, numStages)
216
216
end
217
217
end
218
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
+
219
230
local function CastStart (self , real , unit , castGUID )
220
- if self .unit ~= unit then return end
221
231
if oUF .isRetail and real == ' UNIT_SPELLCAST_START' and not castGUID then return end
222
232
223
233
local element = self .Castbar
234
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
235
+ return
236
+ end
237
+
224
238
local name , text , texture , startTime , endTime , isTradeSkill , castID , notInterruptible , spellID = UnitCastingInfo (unit )
225
239
226
240
local numStages , _
@@ -332,9 +346,11 @@ local function CastStart(self, real, unit, castGUID)
332
346
end
333
347
334
348
local function CastUpdate (self , event , unit , castID , spellID )
335
- if (self .unit ~= unit ) then return end
336
-
337
349
local element = self .Castbar
350
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
351
+ return
352
+ end
353
+
338
354
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
339
355
return
340
356
end
@@ -389,9 +405,11 @@ local function CastUpdate(self, event, unit, castID, spellID)
389
405
end
390
406
391
407
local function CastStop (self , event , unit , castID , spellID )
392
- if (self .unit ~= unit ) then return end
393
-
394
408
local element = self .Castbar
409
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
410
+ return
411
+ end
412
+
395
413
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
396
414
return
397
415
end
@@ -419,9 +437,11 @@ local function CastStop(self, event, unit, castID, spellID)
419
437
end
420
438
421
439
local function CastFail (self , event , unit , castID , spellID )
422
- if (self .unit ~= unit ) then return end
423
-
424
440
local element = self .Castbar
441
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
442
+ return
443
+ end
444
+
425
445
if (not element :IsShown () or ((unit == ' player' or oUF .isRetail ) and (element .castID ~= castID )) or (oUF .isRetail and (element .spellID ~= spellID ))) then
426
446
return
427
447
end
@@ -457,9 +477,11 @@ local function CastFail(self, event, unit, castID, spellID)
457
477
end
458
478
459
479
local function CastInterruptible (self , event , unit )
460
- if (self .unit ~= unit ) then return end
461
-
462
480
local element = self .Castbar
481
+ if (not (element .ShouldShow or ShouldShow ) (element , unit )) then
482
+ return
483
+ end
484
+
463
485
if (not element :IsShown ()) then return end
464
486
465
487
element .notInterruptible = event == ' UNIT_SPELLCAST_NOT_INTERRUPTIBLE'
0 commit comments