WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Empowering castbar (https://www.wowinterface.com/forums/showthread.php?t=59356)

GreyFox777 11-18-22 11:41 AM

Empowering castbar
 
Hello guys, can some one explain please, how to correctly add an empowering castbar?

My code:

Code:

        -- Castbar
do
                local s = CreateFrame("StatusBar", "oUF_MyCastbar"..self.unitType, self)
                s:SetPoint("TOPLEFT",MainTexturePlayer, "TOPLEFT", 123,-92)
                s:SetScale(0.64)
                s:SetHeight(16)
                s:SetWidth(189)
                s:SetStatusBarTexture(m.textures.status_texture)
                s:SetFrameStrata("BACKGROUND")
                s:SetFrameLevel(13)
--                s.CompleteColor = {0.0, 0, 0,0}
                s.FailColor = {1.0, 0.00, 0.00}
        -- Helper
                local h = CreateFrame("Frame", nil, s)
                h:SetFrameLevel(0)
                h:SetPoint("TOPLEFT", -4, 4)
                h:SetPoint("BOTTOMRIGHT", 4, -4)
        -- Backdrop
                local b = s:CreateTexture(nil, "BORDER")
                b:SetTexture(m.textures.status_texture)
                b:SetAllPoints(s)
        -- Spark
                local sp = s:CreateTexture(nil, "ARTWORK", nil, 1)
                sp:SetBlendMode("ADD")
                sp:SetAlpha(0.5)
                sp:SetHeight(s:GetHeight()*2.5)
        -- Spell text
                local txt = core.createFontString(s, font, cfg.fontsize, "THINOUTLINE", 8, 27, "LEFT", 150)
                txt:SetPoint("LEFT", 13, -1)
                txt:SetJustifyH("LEFT")
                txt:SetPoint("RIGHT", self, "LEFT", 275, 0)
        -- Time
                t = core.createFontString(s, font, cfg.fontsize, "THINOUTLINE", 0, 0, "LEFT", 150)
                t:SetPoint("CENTER", -107, 0)
        -- Icon
                i = s:CreateTexture(nil, "ARTWORK")
                i:SetPoint("RIGHT",s,"LEFT",-30,0)
                i:SetSize(s:GetHeight(),s:GetHeight())
                i:SetTexCoord(0.1, 0.9, 0.1, 0.9)

        -- Helper2 for icon
                h2 = CreateFrame("Frame", nil, s)
                h2:SetFrameStrata("BACKGROUND")
                h2:SetFrameLevel(15)
                h2:SetPoint("TOPLEFT", i, "TOPLEFT", -4, 4)
                h2:SetPoint("BOTTOMRIGHT", i,"BOTTOMRIGHT", 4, -4)

                s:SetScript("OnUpdate", function(self, event)
                s:RegisterEvent("UNIT_SPELLCAST_START")
                s:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
                s:RegisterEvent("UNIT_SPELLCAST_EMPOWER_START")


end)

                s.OnUpdate = cast.OnCastbarUpdate
                s.PostCastStart = cast.PostCastStart
                s.PostChannelStart = cast.PostCastStart
                s.PostCastStop = cast.PostCastStop
                s.PostChannelStop = cast.PostChannelStop
                s.PostCastFailed = cast.PostCastFailed
                s.PostCastInterrupted = cast.PostCastFailed

                self.Castbar = s
                self.Castbar.bg = b
                self.Castbar.Text = txt
                self.Castbar.Time = t
                self.Castbar.Icon = i
                self.Castbar.Spark = sp
                self.Castbar.frequentUpdates = true
end



All times are GMT -6. The time now is 12:24 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI