fix castbar hiding

This commit is contained in:
Sumsebrum 2022-01-11 04:27:16 +01:00
parent c3a7c6cbc8
commit b5f67d066f

View File

@ -232,7 +232,7 @@ function Castbar.OnUpdate(castBar, elapsed)
castBar.fadeOut = nil; castBar.fadeOut = nil;
castBar.timeText:Show() castBar.timeText:Show()
castBar.spark:Show() castBar.spark:Show()
castBar:Hide(); castBar:SetAlpha(0)
end end
end end
end end
@ -241,7 +241,7 @@ Castbar.CastEventsFunc = {}
Castbar.CastEventsFunc["UNIT_SPELLCAST_START"] = function(castBar, event, ...) Castbar.CastEventsFunc["UNIT_SPELLCAST_START"] = function(castBar, event, ...)
local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit) local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
castBar:Hide() castBar:SetAlpha(0)
return return
end end
@ -272,7 +272,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_SUCCEEDED"] = function(castBar, event, ..
end end
Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"] = function(castBar, event, ...) Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"] = function(castBar, event, ...)
if ( not castBar:IsVisible() ) then if ( not castBar:IsVisible() ) then
castBar:Hide() castBar:SetAlpha(0)
end end
if ( (castBar.casting and event == "UNIT_SPELLCAST_STOP" and select(2, ...) == castBar.castID) or if ( (castBar.casting and event == "UNIT_SPELLCAST_STOP" and select(2, ...) == castBar.castID) or
(castBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") ) then (castBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") ) then
@ -320,7 +320,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_DELAYED"] = function(castBar, event, ...)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
-- if there is no name, there is no bar -- if there is no name, there is no bar
castBar:Hide() castBar:SetAlpha(0)
return return
end end
castBar.value = (GetTime() - (startTime / 1000)) castBar.value = (GetTime() - (startTime / 1000))
@ -338,7 +338,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_START"] = function(castBar, event
local name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo(castBar.unit) local name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo(castBar.unit)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
castBar:Hide() castBar:SetAlpha(0)
return return
end end
if ( castBar.spark ) then if ( castBar.spark ) then
@ -356,7 +356,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_UPDATE"] = function(castBar, even
if ( castBar:IsShown() ) then if ( castBar:IsShown() ) then
local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(castBar.unit) local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(castBar.unit)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
castBar:Hide() castBar:SetAlpha(0)
return return
end end
castBar.value = ((endTime / 1000) - GetTime()) castBar.value = ((endTime / 1000) - GetTime())