Skip to content

Commit 57835e6

Browse files
committed
https://github.com/oUF-wow/oUF/pull/677
1 parent 6a9e514 commit 57835e6

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

Diff for: ElvUI_Libraries/Core/oUF/elements/castbar.lua

+31-9
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,25 @@ local function UpdatePips(element, numStages)
216216
end
217217
end
218218

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+
219230
local function CastStart(self, real, unit, castGUID)
220-
if self.unit ~= unit then return end
221231
if oUF.isRetail and real == 'UNIT_SPELLCAST_START' and not castGUID then return end
222232

223233
local element = self.Castbar
234+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
235+
return
236+
end
237+
224238
local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo(unit)
225239

226240
local numStages, _
@@ -332,9 +346,11 @@ local function CastStart(self, real, unit, castGUID)
332346
end
333347

334348
local function CastUpdate(self, event, unit, castID, spellID)
335-
if(self.unit ~= unit) then return end
336-
337349
local element = self.Castbar
350+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
351+
return
352+
end
353+
338354
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
339355
return
340356
end
@@ -389,9 +405,11 @@ local function CastUpdate(self, event, unit, castID, spellID)
389405
end
390406

391407
local function CastStop(self, event, unit, castID, spellID)
392-
if(self.unit ~= unit) then return end
393-
394408
local element = self.Castbar
409+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
410+
return
411+
end
412+
395413
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
396414
return
397415
end
@@ -419,9 +437,11 @@ local function CastStop(self, event, unit, castID, spellID)
419437
end
420438

421439
local function CastFail(self, event, unit, castID, spellID)
422-
if(self.unit ~= unit) then return end
423-
424440
local element = self.Castbar
441+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
442+
return
443+
end
444+
425445
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
426446
return
427447
end
@@ -457,9 +477,11 @@ local function CastFail(self, event, unit, castID, spellID)
457477
end
458478

459479
local function CastInterruptible(self, event, unit)
460-
if(self.unit ~= unit) then return end
461-
462480
local element = self.Castbar
481+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
482+
return
483+
end
484+
463485
if(not element:IsShown()) then return end
464486

465487
element.notInterruptible = event == 'UNIT_SPELLCAST_NOT_INTERRUPTIBLE'

0 commit comments

Comments
 (0)