Skip to content

Commit

Permalink
return early for performance reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
wardz committed Jan 26, 2022
1 parent 7178352 commit 2c50e56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions ClassicCastbars/ClassicCastbars_TBC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function addon:BindCurrentCastData(castbar, unitID, isChanneled)

local GetCastingInfo = isChanneled and UnitChannelInfo or UnitCastingInfo
local spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, _, _, spellID = GetCastingInfo(unitID)
if not spellName then return end
cast.maxValue = (endTimeMS - startTimeMS) / 1000
cast.endTime = endTimeMS / 1000
cast.spellName = spellName
Expand Down
8 changes: 6 additions & 2 deletions ClassicCastbars/core/Frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,13 @@ function addon:SetCastbarStatusColorsOnDisplay(castbar, cast, db)
end

function addon:DisplayCastbar(castbar, unitID)
local cast = castbar._data
if not cast then return end

local parentFrame = AnchorManager:GetAnchor(unitID)
if not parentFrame then return end

local db = self.db[self:GetUnitType(unitID)]
local cast = castbar._data

castbar.animationGroup = castbar.animationGroup or self:CreateFadeAnimationGroup(castbar)
if castbar.animationGroup:IsPlaying() then
Expand Down Expand Up @@ -332,6 +334,8 @@ function addon:HideCastbar(castbar, unitID, skipFadeOut)
return
end

if castbar:GetAlpha() <= 0 then return end

local cast = castbar._data
if cast then
if cast.isInterrupted or cast.isFailed then
Expand Down Expand Up @@ -371,7 +375,7 @@ function addon:HideCastbar(castbar, unitID, skipFadeOut)
end
end

if --[[castbar:GetAlpha() > 0 and]] castbar.fade then
if castbar.fade then
if not castbar.fade:IsPlaying() then
castbar.fade:SetStartDelay(0) -- reset
if cast then
Expand Down

0 comments on commit 2c50e56

Please sign in to comment.