castbar shield uniterruptable

This commit is contained in:
Sumsebrum 2022-07-31 21:46:38 +02:00
parent 8cec363d5e
commit 32d4ae6a5c
2 changed files with 27 additions and 6 deletions

BIN
Images/castbar-shield.blp Normal file

Binary file not shown.

View File

@ -108,6 +108,12 @@ function Castbar:CreateFrame(unit)
castBar.icon.texture.overlay:SetAllPoints(castBar.icon.texture)
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
castBar.shield = castBar.icon:CreateTexture(nil, "OVERLAY")
castBar.shield:SetTexture("Interface\\AddOns\\Gladdy\\Images\\castbar-shield")
castBar.shield:SetHeight(80)
castBar.shield:SetWidth(80)
castBar.shield:SetPoint("CENTER", castBar.icon, "CENTER", 0, -1.5)
castBar.icon:ClearAllPoints()
if (Gladdy.db.castBarIconPos == "LEFT") then
castBar.icon:SetPoint("RIGHT", castBar, "LEFT", -3, 0) -- Icon of castbar
@ -121,7 +127,7 @@ function Castbar:CreateFrame(unit)
castBar.spellText:SetShadowOffset(1, -1)
castBar.spellText:SetShadowColor(0, 0, 0, 1)
castBar.spellText:SetJustifyH("CENTER")
castBar.spellText:SetPoint("LEFT", 7, 0) -- Text of the spell
castBar.spellText:SetPoint("LEFT", 10, 0) -- Text of the spell
castBar.timeText = castBar:CreateFontString(nil, "LOW")
castBar.timeText:SetFont(Gladdy:SMFetch("font", "auraFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
@ -192,6 +198,9 @@ function Castbar:UpdateFrame(unit)
castBar.icon:Hide()
end
castBar.shield:SetWidth(Gladdy.db.castBarIconSize * 3.2)
castBar.shield:SetHeight(Gladdy.db.castBarIconSize * 3.2)
local rightMargin = 0
local leftMargin = 0
if (Gladdy.db.castBarIconPos == "LEFT") then
@ -280,7 +289,7 @@ end
Castbar.CastEventsFunc = {}
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, notInterruptible, spellId = UnitCastingInfo(castBar.unit)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
castBar:SetAlpha(0)
return
@ -376,7 +385,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_DELAYED"] = function(castBar, event, ...)
end
end
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, notInterruptible, spellId = UnitChannelInfo(castBar.unit)
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
castBar:SetAlpha(0)
@ -414,7 +423,7 @@ function Castbar.OnEvent(self, event, ...)
Castbar.CastEventsFunc[event](self, event, ...)
end
function Castbar:CAST_START(unit, spell, icon, value, maxValue, test)
function Castbar:CAST_START(unit, spell, icon, value, maxValue, notInterruptible, test)
local castBar = self.frames[unit]
if (not castBar) then
return
@ -426,7 +435,12 @@ function Castbar:CAST_START(unit, spell, icon, value, maxValue, test)
castBar.channeling = test == "channel"
end
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
if notInterruptible then
castBar.bar:SetStatusBarColor(.8,.8,.8,1)
else
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
end
castBar.value = value
castBar.maxValue = maxValue
castBar.bar:SetMinMaxValues(0, maxValue)
@ -440,6 +454,11 @@ function Castbar:CAST_START(unit, spell, icon, value, maxValue, test)
if Gladdy.db.castBarSparkEnabled then
castBar.spark:Show()
end
if notInterruptible then
castBar.shield:Show()
else
castBar.shield:Hide()
end
castBar:SetAlpha(1)
if Gladdy.db.castBarIconEnabled then
castBar.icon:Show()
@ -467,6 +486,7 @@ function Castbar:CAST_STOP(unit, ...)
castBar.backdrop:Hide()
castBar.spark:Hide()
castBar.icon:Hide()
castBar.shield:Hide()
else
castBar.bar:SetStatusBarColor(...)
end
@ -541,7 +561,8 @@ function Castbar:Test(unit)
end
if (spell) then
self:CAST_START(unit, spell, icon, value, maxValue, event)
local nonInterruptable = unit == "arena1" and Gladdy.expansion == "Wrath"
self:CAST_START(unit, spell, icon, value, maxValue, nonInterruptable, event)
end
else
self:CAST_STOP(unit)