Skip to content

Commit 4617cb2

Browse files
committed
Merge branch 'main' into ptr
2 parents a1f842d + 57835e6 commit 4617cb2

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

ElvUI_Libraries/Core/oUF/elements/castbar.lua

+37-11
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ local function UpdatePips(element, numStages)
184184
pip:Show()
185185

186186
if(isHoriz) then
187-
pip:RotateTextures(0)
187+
if(pip.RotateTextures) then
188+
pip:RotateTextures(0)
189+
end
188190

189191
if(element:GetReverseFill()) then
190192
pip:SetPoint('TOP', element, 'TOPRIGHT', -offset, 0)
@@ -194,7 +196,9 @@ local function UpdatePips(element, numStages)
194196
pip:SetPoint('BOTTOM', element, 'BOTTOMLEFT', offset, 0)
195197
end
196198
else
197-
pip:RotateTextures(1.5708)
199+
if(pip.RotateTextures) then
200+
pip:RotateTextures(1.5708)
201+
end
198202

199203
if(element:GetReverseFill()) then
200204
pip:SetPoint('LEFT', element, 'TOPLEFT', 0, -offset)
@@ -212,11 +216,25 @@ local function UpdatePips(element, numStages)
212216
end
213217
end
214218

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

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

222240
local numStages, _
@@ -328,9 +346,11 @@ local function CastStart(self, real, unit, castGUID)
328346
end
329347

330348
local function CastUpdate(self, event, unit, castID, spellID)
331-
if(self.unit ~= unit) then return end
332-
333349
local element = self.Castbar
350+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
351+
return
352+
end
353+
334354
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
335355
return
336356
end
@@ -385,9 +405,11 @@ local function CastUpdate(self, event, unit, castID, spellID)
385405
end
386406

387407
local function CastStop(self, event, unit, castID, spellID)
388-
if(self.unit ~= unit) then return end
389-
390408
local element = self.Castbar
409+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
410+
return
411+
end
412+
391413
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
392414
return
393415
end
@@ -415,9 +437,11 @@ local function CastStop(self, event, unit, castID, spellID)
415437
end
416438

417439
local function CastFail(self, event, unit, castID, spellID)
418-
if(self.unit ~= unit) then return end
419-
420440
local element = self.Castbar
441+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
442+
return
443+
end
444+
421445
if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
422446
return
423447
end
@@ -453,9 +477,11 @@ local function CastFail(self, event, unit, castID, spellID)
453477
end
454478

455479
local function CastInterruptible(self, event, unit)
456-
if(self.unit ~= unit) then return end
457-
458480
local element = self.Castbar
481+
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
482+
return
483+
end
484+
459485
if(not element:IsShown()) then return end
460486

461487
element.notInterruptible = event == 'UNIT_SPELLCAST_NOT_INTERRUPTIBLE'

ElvUI_Libraries/Core/oUF/elements/tags.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ local tagStrings = {
448448
end]],
449449

450450
['threatcolor'] = [[function(u)
451-
return Hex(GetThreatStatusColor(UnitThreatSituation(u)))
451+
return Hex(GetThreatStatusColor(UnitThreatSituation(u) or 0))
452452
end]],
453453
}
454454

0 commit comments

Comments
 (0)