if AftermathhUI.config.castbars == true then
if(unit == 'player' or unit == 'focus' or unit == 'target' or unit == 'pet') then
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetStatusBarTexture(AftermathhUI.media.texture)
self.Castbar:SetScale(1.139)
self.Castbar:SetStatusBarColor(.25, .25, .25)
CreateBorder(self.Castbar, 12, 1, 1, 1, 3)
self.Castbar.Bg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
self.Castbar.Bg:SetAllPoints(self.Castbar)
self.Castbar.Bg:SetTexture(AftermathhUI.media.texture)
self.Castbar.Bg:SetVertexColor(0, 0, 0, 0.7)
if(unit == 'player') then -- Player CastBar
self.Castbar:SetPoint('BOTTOM', UIParent, -2, 80) -- here we move the player castbar.
self.Castbar:SetSize(309, 25)
self.Castbar:SetParent(self)
if AftermathhUI.config.castbarclasscolor == true then
self.Castbar:SetStatusBarColor(playerColor.r, playerColor.g, playerColor.b)
self.Castbar.Bg:SetVertexColor(playerColor.r*0.3, playerColor.g*0.3, playerColor.b*0.3, 0.8)
end
if AftermathhUI.config.showsafezone == true then
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, 'BORDER')
self.Castbar.SafeZone:SetTexture(AftermathhUI.media.blank)
self.Castbar.SafeZone:SetVertexColor(1, 0.5, 0, 1)
end
if AftermathhUI.config.showlatency == true then
self.Castbar.Latency = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Latency:SetFont(AftermathhUI.media.font, AftermathhUI.config.latencyfontsize, AftermathhUI.media.fontflag)
self.Castbar.Latency:SetParent(self.Castbar)
self.Castbar.Latency:SetDrawLayer('OVERLAY')
self.Castbar.Latency:SetVertexColor(0.6, 0.6, 0.6)
self.Castbar.Latency:SetAlpha(1)
end
end
if(unit == 'target') then
self.Castbar:SetSize(200, 26)
self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', 143, 94) -- here we move the target castbar
if AftermathhUI.config.targetcastbaricon == true then
self.Castbar.Icon = self.Castbar:CreateTexture(nil, 'ARTWORK')
self.Castbar.Icon:SetSize(39, 39)
self.Castbar.Icon:SetPoint('RIGHT', 47, 4)
self.IconOverlay = self.Castbar:CreateTexture(nil, 'OVERLAY')
self.IconOverlay:SetPoint('TOPLEFT', self.Castbar.Icon, 'TOPLEFT')
self.IconOverlay:SetPoint('BOTTOMRIGHT', self.Castbar.Icon, 'BOTTOMRIGHT')
self.IconOverlay:SetTexture(AftermathhUI.media.border)
self.IconOverlay:SetVertexColor(1, 1, 1, 1)
self.Castbar.IconBg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
self.Castbar.IconBg:SetPoint('TOPLEFT',self.Castbar.Icon,'TOPLEFT',-5,5)
self.Castbar.IconBg:SetPoint('BOTTOMRIGHT',self.Castbar.Icon,'BOTTOMRIGHT',5,-5)
self.Castbar.IconBg:SetTexture(AftermathhUI.media.shadow)
self.Castbar.IconBg:SetVertexColor(0, 0, 0, 0.9)
end
end
if(unit == 'focus') then -- Focus Castbar
self.Castbar:SetSize(260, 25)
self.Castbar:SetScale(1.210)
self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', -10, -10) -- here we move focus castbar
if AftermathhUI.config.focuscastbaricon == true then
self.Castbar.Icon = self.Castbar:CreateTexture(nil, 'ARTWORK')
self.Castbar.Icon:SetSize(39, 39)
self.Castbar.Icon:SetPoint('LEFT', -48, 3)
self.IconOverlay = self.Castbar:CreateTexture(nil, 'OVERLAY')
self.IconOverlay:SetPoint('TOPLEFT', self.Castbar.Icon, 'TOPLEFT')
self.IconOverlay:SetPoint('BOTTOMRIGHT', self.Castbar.Icon, 'BOTTOMRIGHT')
self.IconOverlay:SetTexture(AftermathhUI.media.border)
self.IconOverlay:SetVertexColor(1, 1, 1, 1)
self.Castbar.IconBg = self.Castbar:CreateTexture(nil, 'BACKGROUND')
self.Castbar.IconBg:SetPoint('TOPLEFT',self.Castbar.Icon,'TOPLEFT',-5,5)
self.Castbar.IconBg:SetPoint('BOTTOMRIGHT',self.Castbar.Icon,'BOTTOMRIGHT',5,-5)
self.Castbar.IconBg:SetTexture(AftermathhUI.media.shadow)
self.Castbar.IconBg:SetVertexColor(0, 0, 0, 0.9)
end
end
if(unit == 'pet') then -- Pet Castbar
self.Castbar:SetSize(200, 22)
self.Castbar:SetPoint('TOPRIGHT', self, 'BOTTOMRIGHT', -12, 56) -- here we move the pet castbar
end
self.Castbar.PostCastStart = function(Castbar, unit, spell, spellrank)
if (unit == 'player') then
if (Castbar.Latency) then
local down, up, lagHome, lagWorld = GetNetStats();
local avgLag = (lagHome + lagWorld) / 2
Castbar.Latency:ClearAllPoints()
Castbar.Latency:SetPoint('RIGHT', Castbar, 'BOTTOMRIGHT', -1, -1)
Castbar.Latency:SetText(string.format('%.0f', avgLag)..'ms')
end
end
end
self.Castbar.PostChannelStart = function(Castbar, unit, spell, spellrank)
if (unit == 'player') then
if (Castbar.Latency) then
local down, up, lagHome, lagWorld = GetNetStats();
local avgLag = (lagHome + lagWorld) / 2
Castbar.Latency:ClearAllPoints()
Castbar.Latency:SetPoint('LEFT', self.Castbar, 'BOTTOMLEFT', 1, 1)
Castbar.Latency:SetText(string.format('%.0f', avgLag)..'ms')
end
end
end
self.Castbar.CustomDelayText = function(self, duration)
self.Time:SetFormattedText('(|cffff0000-%.1f|r) %.1f | %.1f', self.delay, duration, self.max)
end
self.Castbar.CustomTimeText = function(self, duration)
self.Time:SetFormattedText('%.1f | %.1f', duration, self.max)
end
self.Castbar.Time = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Time:SetFont(AftermathhUI.media.font, AftermathhUI.config.cbtimefontsize, AftermathhUI.media.fontflag)
self.Castbar.Time:SetPoint('RIGHT', self.Castbar, 'RIGHT', -7, 0)
self.Castbar.Time:SetHeight(25)
self.Castbar.Time:SetParent(self.Castbar)
self.Castbar.Time:SetJustifyH('RIGHT')
self.Castbar.Text = self:CreateFontString(nil, 'ARTWORK')
self.Castbar.Text:SetFont(AftermathhUI.media.font, AftermathhUI.config.cbtextfontsize, AftermathhUI.media.fontflag)
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 4, 0)
self.Castbar.Text:SetPoint('RIGHT', self.Castbar.Time, 'LEFT', -7, 0)
self.Castbar.Text:SetHeight(25)
self.Castbar.Text:SetParent(self.Castbar)
self.Castbar.Text:SetJustifyH('LEFT')
.....