Thread Tools Display Modes
09-16-10, 09:09 PM   #1
Stusteh
A Murloc Raider
Join Date: Jan 2009
Posts: 8
Total castbar time

Click image for larger version

Name:	WoWScrnShot_091610_220627.jpg
Views:	286
Size:	1.82 MB
ID:	4834

I was wondering if there was a quick and simple way to add the total cast time in there.
  Reply With Quote
09-17-10, 03:27 AM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
In your layout add in a new routine like this:
Code:
local function CustomTimeText(element, duration)
	element.Time:SetFormattedText('%.1f / %.1f', element.channeling and duration or (element.max - duration), element.max)
end
and then in your style function add in the following line:
Code:
castbar.CustomTimeText = CustomTimeText
This will change the castbar time to show the current cast time as well as the total cast time.
  Reply With Quote
09-17-10, 02:58 PM   #3
Stusteh
A Murloc Raider
Join Date: Jan 2009
Posts: 8
Code:
        if unit == "player" then
        self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', 0, -110)
            self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, "BORDER")
            self.Castbar.SafeZone:SetTexture(config.statusbar)
            self.Castbar.SafeZone:SetVertexColor(1, 0.5, 0, 0.75)

            self.Castbar.Time = ns.CreateFontString(self.Castbar, 12, "RIGHT")
            self.Castbar.Time:SetPoint("RIGHT", self.Castbar, "RIGHT", -4, 0)

            self.Castbar.CustomDelayText = ns.CustomDelayText
            self.Castbar.CustomTimeText = ns.CustomTimeText
        elseif (ns.uconfig[unit].width or 1) > 0.75 then
            self.Castbar.Text = ns.CreateFontString(self.Castbar, 12, "LEFT")
            self.Castbar.Text:SetPoint("LEFT", self.Castbar, "LEFT", 4, 0)
        end

        self.Castbar.PostCastStart = ns.PostCastStart
        self.Castbar.PostChannelStart = ns.PostChannelStart

        ns.CreateBorder(self.Castbar)
        

        local d = floor(config.borderSize / 2 + 0.5) - 2
        self.Castbar.BorderTextures[1]:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -d, d)
        self.Castbar.BorderTextures[4]:SetPoint("BOTTOMLEFT", self.Castbar, "BOTTOMLEFT", -d, -d)

        local o = self.Castbar.SetBorderSize
        self.Castbar.SetBorderSize = function(self, size, offset)
            o(self, size, offset)
            local d = floor(size / 2 + 0.5) - 2
            self.BorderTextures[1]:SetPoint("TOPLEFT", self.Icon, "TOPLEFT", -d, d)
            self.BorderTextures[4]:SetPoint("BOTTOMLEFT", self.Icon, "BOTTOMLEFT", -d, -d)
        end
    end
Can you throw it in there for me... I tried in a few different locations but wasn't successful.
  Reply With Quote
09-17-10, 03:15 PM   #4
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Code:
        if unit == "player" then
        self.Castbar:SetPoint('CENTER', UIParent, 'CENTER', 0, -110)
            self.Castbar.SafeZone = self.Castbar:CreateTexture(nil, "BORDER")
            self.Castbar.SafeZone:SetTexture(config.statusbar)
            self.Castbar.SafeZone:SetVertexColor(1, 0.5, 0, 0.75)

            self.Castbar.Time = ns.CreateFontString(self.Castbar, 12, "RIGHT")
            self.Castbar.Time:SetPoint("RIGHT", self.Castbar, "RIGHT", -4, 0)

            self.Castbar.CustomDelayText = ns.CustomDelayText
            self.Castbar.CustomTimeText = ns.CustomTimeText
        elseif (ns.uconfig[unit].width or 1) > 0.75 then
            self.Castbar.Text = ns.CreateFontString(self.Castbar, 12, "LEFT")
            self.Castbar.Text:SetPoint("LEFT", self.Castbar, "LEFT", 4, 0)
        end

        self.Castbar.PostCastStart = ns.PostCastStart
        self.Castbar.PostChannelStart = ns.PostChannelStart

        ns.CreateBorder(self.Castbar)
        

        local d = floor(config.borderSize / 2 + 0.5) - 2
        self.Castbar.BorderTextures[1]:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -d, d)
        self.Castbar.BorderTextures[4]:SetPoint("BOTTOMLEFT", self.Castbar, "BOTTOMLEFT", -d, -d)

        local o = self.Castbar.SetBorderSize
        self.Castbar.SetBorderSize = function(self, size, offset)
            o(self, size, offset)
            local d = floor(size / 2 + 0.5) - 2
            self.BorderTextures[1]:SetPoint("TOPLEFT", self.Icon, "TOPLEFT", -d, d)
            self.BorderTextures[4]:SetPoint("BOTTOMLEFT", self.Icon, "BOTTOMLEFT", -d, -d)
        end

        self.Castbar.CustomTimeText = function(self, duration)
            self.Time:SetFormattedText('%.1f / %.1f', self.channeling and duration or (self.max - duration), self.max)
        end
    end
This is dry-coded, but it should work.
  Reply With Quote
09-17-10, 03:43 PM   #5
Stusteh
A Murloc Raider
Join Date: Jan 2009
Posts: 8
Awesome bro, thanks a lot
  Reply With Quote
09-18-10, 05:59 PM   #6
Stusteh
A Murloc Raider
Join Date: Jan 2009
Posts: 8
Click image for larger version

Name:	zzzz.jpg
Views:	211
Size:	1.01 MB
ID:	4840

I'm now working on the combo points and would like to switch the texture to smoothv2...

Code:
        combo.bg = combo:CreateTexture(nil, "BACKGROUND")
        combo.bg:ClearAllPoints()
        combo.bg:SetAllPoints(combo)
        combo.bg:SetTexture(statusbar)
        combo.bg:SetVertexColor(comboColor.r, comboColor.g, comboColor.b)
        combo.bg:SetAlpha(comboColor.a)
It's not exactly oUF but I was getting pretty quick advice before, so I thought I would try it here first.

I think i have to change the (statusbar) part but i don't know how to do it.
  Reply With Quote
09-18-10, 06:42 PM   #7
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
you have to change "statusbar" into the folder where you put the texture.

Like "Interface\\Addons\\youraddon\\yourtexture.tga". Or just search for statusbar in your lua and either replace it there OR copy the code, name it ... statusbar2 or whatever, change the texture used over there, go back to your combo point code and replace statusbar with statusbar2.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
09-18-10, 06:46 PM   #8
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
Originally Posted by Stusteh View Post
I think i have to change the (statusbar) part but i don't know how to do it.
You have the right part, you just need to change the texture it is pointing to.

The value of the variable statusbar will be a string, so if you find where that is defined you will find something like:

Code:
local statusbar = "Interface\AddOns\myaddon\texture"
If you want to change the texture for everything that uses that old texture, then change the string value to point to your new texture.
If you want to change the texture of just the combo points, then create a new variable the holds the path to your new texture. When calling SetTexture for the combo point element then pass the new variable as the parameter.
  Reply With Quote
09-18-10, 08:07 PM   #9
Stusteh
A Murloc Raider
Join Date: Jan 2009
Posts: 8
Click image for larger version

Name:	1111111.jpg
Views:	235
Size:	1.41 MB
ID:	4843

That helped out a ton. I have been wondering how to do that with a lot of different addons.

thanks for the help
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Total castbar time


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