Skip to content

Commit

Permalink
Merge branch 'main' into ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Merathilis committed Apr 21, 2024
2 parents a1f842d + 57835e6 commit 4617cb2
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 12 deletions.
48 changes: 37 additions & 11 deletions ElvUI_Libraries/Core/oUF/elements/castbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ local function UpdatePips(element, numStages)
pip:Show()

if(isHoriz) then
pip:RotateTextures(0)
if(pip.RotateTextures) then
pip:RotateTextures(0)
end

if(element:GetReverseFill()) then
pip:SetPoint('TOP', element, 'TOPRIGHT', -offset, 0)
Expand All @@ -194,7 +196,9 @@ local function UpdatePips(element, numStages)
pip:SetPoint('BOTTOM', element, 'BOTTOMLEFT', offset, 0)
end
else
pip:RotateTextures(1.5708)
if(pip.RotateTextures) then
pip:RotateTextures(1.5708)
end

if(element:GetReverseFill()) then
pip:SetPoint('LEFT', element, 'TOPLEFT', 0, -offset)
Expand All @@ -212,11 +216,25 @@ local function UpdatePips(element, numStages)
end
end

--[[ Override: Castbar:ShouldShow(unit)
Handles check for which unit the castbar should show for.
Defaults to the object unit.
* self - the Castbar widget
* unit - the unit for which the update has been triggered (string)
--]]
local function ShouldShow(element, unit)
return element.__owner.unit == unit
end


local function CastStart(self, real, unit, castGUID)
if self.unit ~= unit then return end
if oUF.isRetail and real == 'UNIT_SPELLCAST_START' and not castGUID then return end

local element = self.Castbar
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
return
end

local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo(unit)

local numStages, _
Expand Down Expand Up @@ -328,9 +346,11 @@ local function CastStart(self, real, unit, castGUID)
end

local function CastUpdate(self, event, unit, castID, spellID)
if(self.unit ~= unit) then return end

local element = self.Castbar
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
return
end

if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
return
end
Expand Down Expand Up @@ -385,9 +405,11 @@ local function CastUpdate(self, event, unit, castID, spellID)
end

local function CastStop(self, event, unit, castID, spellID)
if(self.unit ~= unit) then return end

local element = self.Castbar
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
return
end

if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
return
end
Expand Down Expand Up @@ -415,9 +437,11 @@ local function CastStop(self, event, unit, castID, spellID)
end

local function CastFail(self, event, unit, castID, spellID)
if(self.unit ~= unit) then return end

local element = self.Castbar
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
return
end

if(not element:IsShown() or ((unit == 'player' or oUF.isRetail) and (element.castID ~= castID)) or (oUF.isRetail and (element.spellID ~= spellID))) then
return
end
Expand Down Expand Up @@ -453,9 +477,11 @@ local function CastFail(self, event, unit, castID, spellID)
end

local function CastInterruptible(self, event, unit)
if(self.unit ~= unit) then return end

local element = self.Castbar
if(not (element.ShouldShow or ShouldShow) (element, unit)) then
return
end

if(not element:IsShown()) then return end

element.notInterruptible = event == 'UNIT_SPELLCAST_NOT_INTERRUPTIBLE'
Expand Down
2 changes: 1 addition & 1 deletion ElvUI_Libraries/Core/oUF/elements/tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ local tagStrings = {
end]],

['threatcolor'] = [[function(u)
return Hex(GetThreatStatusColor(UnitThreatSituation(u)))
return Hex(GetThreatStatusColor(UnitThreatSituation(u) or 0))
end]],
}

Expand Down

0 comments on commit 4617cb2

Please sign in to comment.