Thread Tools Display Modes
07-26-16, 09:35 AM   #1
Rufio
A Murloc Raider
 
Rufio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 9
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!

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)
  Reply With Quote
07-27-16, 02:29 PM   #2
sticklord
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 57
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)
  Reply With Quote
07-27-16, 02:33 PM   #3
Kkthnx
A Cobalt Mageweaver
 
Kkthnx's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2011
Posts: 247
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")
__________________
Success isn't what you've done compared to others. Success is what you've done compared to what you were made to do.
  Reply With Quote
07-28-16, 08:44 AM   #4
Rufio
A Murloc Raider
 
Rufio's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 9
Thanks a lot! You saved me
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Could you fix my castbar?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off