local CASTBAR_ICON = true -- show ico and time of cast bar
local CASTBAR_X,CASTBAR_Y = 0,120 -- player castbar position by screen bottom
local CAST_SHOW = CASTBAR_ICON
if CAST_SHOW == true then
local cast_x,cast_y = CASTBAR_X,CASTBAR_Y
--player casting bar
CastingBarFrameIcon:Show()
CastingBarFrameIcon:SetHeight( 25 )
CastingBarFrameIcon:SetWidth( 25 )
CastingBarFrameIcon:ClearAllPoints()
CastingBarFrameIcon:SetPoint( "RIGHT", CastingBarFrame, "LEFT", -10, 2.5 )
--CastingBarFrameBorder:SetTexture(nil) --("Interface\\CastingBar\\UI-CastingBar-Border-Small")
--CastingBarFrameFlash:SetTexture("Interface\\CastingBar\\UI-CastingBar-Flash-Small")
CastingBarFrame:ClearAllPoints()
CastingBarFrame:SetPoint("TOP", MainMenuBar, cast_x, cast_y)
CastingBarFrame.SetPoint = function() end
-- Castbar timer from thek
CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil)
CastingBarFrame.timer:SetFont("Fonts\\ARIALN.ttf", 18, "THINOUTLINE")
CastingBarFrame.timer:SetPoint("LEFT", CastingBarFrame, "RIGHT", 10, 2.5)
CastingBarFrame.update = .1
TargetFrameSpellBar.timer = TargetFrameSpellBar:CreateFontString(nil)
TargetFrameSpellBar.timer:SetFont("Fonts\\ARIALN.ttf", 13, "THINOUTLINE")
TargetFrameSpellBar.timer:SetPoint("LEFT", TargetFrameSpellBar, "RIGHT", 5, 0)
TargetFrameSpellBar.update = .1
FocusFrameSpellBar.timer = FocusFrameSpellBar:CreateFontString(nil)
FocusFrameSpellBar.timer:SetFont("Fonts\\ARIALN.ttf", 13, "THINOUTLINE")
FocusFrameSpellBar.timer:SetPoint("LEFT", FocusFrameSpellBar, "RIGHT", 5, 0)
FocusFrameSpellBar.update = .1
hooksecurefunc("CastingBarFrame_OnUpdate", function(self, elapsed)
if not self.timer then return end
if self.update and self.update < elapsed then
if self.casting then
self.timer:SetText(format("%.1f", max(self.maxValue - self.value, 0)))
elseif self.channeling then
self.timer:SetText(format("%.1f", max(self.value, 0)))
else
self.timer:SetText("")
end
self.update = .1
else
self.update = self.update - elapsed
end
end)
end