WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Could you fix my castbar? (https://www.wowinterface.com/forums/showthread.php?t=54029)

Rufio 07-26-16 09:35 AM

Could you fix my castbar?
 
Hello, since Legion Pre-Patch my castbars won't work...
I'm not into lua, so maybe you can help me out! :D

Thanks in advance

Code:

--[[ Player castbar ]]
    CastingBarFrame:SetSize(180,10)
    CastingBarFrame:SetScale("1.4")
    CastingBarFrame:ClearAllPoints()
    CastingBarFrame:SetPoint("TOP", WorldFrame, "BOTTOM", 0, 130) --0, 100
    CastingBarFrame.SetPoint = function() end
   
    CastingBarFrameBorder:SetSize(240,40)
    CastingBarFrameBorder:SetPoint("TOP", CastingBarFrame, 0, 15)
    CastingBarFrameBorder:SetTexture("Interface\\CastingBar\\UI-CastingBar-Border-Small")
   
    CastingBarFrameFlash:SetSize(240,40)
    CastingBarFrameFlash:SetPoint("TOP", CastingBarFrame, 0, 15)
    CastingBarFrameFlash:SetTexture("Interface\\CastingBar\\UI-CastingBar-Flash-Small")
   
    CastingBarFrameText:SetPoint("TOP", CastingBarFrame, 0, 4)
   
    CastingBarFrameIcon:Show()
    CastingBarFrameIcon:SetHeight(22)
    CastingBarFrameIcon:SetWidth(22)
   
    --[[ Castbar timer from thek ]]
    CastingBarFrame.timer = CastingBarFrame:CreateFontString(nil)
    CastingBarFrame.timer:SetFont("Fonts\\ARIALN.ttf", 13, "THINOUTLINE")
    CastingBarFrame.timer:SetPoint("RIGHT", CastingBarFrame, "RIGHT", 24, 0)
    CastingBarFrame.update = 0.1
   
    TargetFrameSpellBar.timer = TargetFrameSpellBar:CreateFontString(nil)
    TargetFrameSpellBar.timer:SetFont("Fonts\\ARIALN.ttf", 13, "THINOUTLINE")
    TargetFrameSpellBar.timer:SetPoint("RIGHT", TargetFrameSpellBar, "RIGHT", 24, 0)
    TargetFrameSpellBar.update = 0.1
   
    FocusFrameSpellBar.timer = FocusFrameSpellBar:CreateFontString(nil)
    FocusFrameSpellBar.timer:SetFont("Fonts\\ARIALN.ttf", 13, "THINOUTLINE")
    FocusFrameSpellBar.timer:SetPoint("RIGHT", FocusFrameSpellBar, "RIGHT", 24, 0)
    FocusFrameSpellBar.update = 0.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 = 0.1
        else
            self.update = self.update - elapsed
        end
    end)


sticklord 07-27-16 02:29 PM

Hey, I haven't tested this or anything but its just a gut feeling. Swap the bottom part with this:

Lua Code:
  1. CastingBarFrame:HookScript('OnUpdate', function(self, elapsed)
  2.     if not self.timer then return end
  3.     if self.update and self.update < elapsed then
  4.         if self.casting then
  5.             self.timer:SetText(format("%.1f", max(self.maxValue - self.value, 0)))
  6.         elseif self.channeling then
  7.             self.timer:SetText(format("%.1f", max(self.value, 0)))
  8.         else
  9.             self.timer:SetText("")
  10.         end
  11.         self.update = 0.1
  12.     else
  13.         self.update = self.update - elapsed
  14.     end
  15. end)

Kkthnx 07-27-16 02:33 PM

Check out my code for my UI. Basically the names were changed.

https://github.com/Kkthnx/KkthnxUI_L...s/CastBars.lua

So instead of

Code:

CastingBarFrameBorder:SetTexture("Interface\\CastingBar\\UI-CastingBar-Border-Small")
its now

Code:

CastingBarFrame.Border:SetTexture("Interface\\CastingBar\\UI-CastingBar-Border-Small")

Rufio 07-28-16 08:44 AM

Thanks a lot! You saved me :)


All times are GMT -6. The time now is 11:05 AM.

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