Thread Tools Display Modes
03-21-10, 07:24 AM   #1
Lordyfrb
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 71
Threat Based Colored Panels

Hi guys, just wondering if anyone could help me.

I'm trying to create a panel that starts black, and then changes color when in combat to show my threat level.

I've found the API used for this: API GetThreatStatusColor()

I so far have this:
Code:
{	name="Stuf.Player.Frame.BG",
	parent="Stuf.units.player",
	anchor_to="center", anchor_to="center",
	width=256, height=32,
	bg_color="0 0 0", bg_alpha=1,
	OnUpdate = function(self)
		local r, g, b = GetThreatStatusColor(status)
		self.bg:SetTexture(r, g, b, 1)
	end,
},
Thanks for any help.
Lordy.
  Reply With Quote
03-21-10, 12:39 PM   #2
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Lordyfrb View Post
I so far have this:
Code:
{    name="Stuf.Player.Frame.BG",
    parent="Stuf.units.player",
    anchor_to="center", anchor_to="center",
    width=256, height=32,
    bg_color="0 0 0", bg_alpha=1,
    OnUpdate = function(self)
        local status = UnitThreatSituation("player", "target")
        local r, g, b = GetThreatStatusColor(status)
        self.bg:SetTexture(r, g, b, 1)
    end,
},
Thanks for any help.
Lordy.
That should do it.
  Reply With Quote
03-21-10, 04:48 PM   #3
Dudeface
A Kobold Labourer
Join Date: Mar 2010
Posts: 1
Greetings everyone,

I'm interested in creating a small panel parented to my oUF target frame that shows how many people are targeting my target. I'm not sure on the API function for showing how many people are targeting my own target. I've had a look through wowwiki but haven't come up with anything yet.

Cheers.

Last edited by Dudeface : 03-23-10 at 02:31 AM.
  Reply With Quote
04-13-10, 09:26 AM   #4
Katae
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 208
Originally Posted by Dudeface View Post
Greetings everyone,

I'm interested in creating a small panel parented to my oUF target frame that shows how many people are targeting my target. I'm not sure on the API function for showing how many people are targeting my own target. I've had a look through wowwiki but haven't come up with anything yet.

Cheers.
Didn't see this till now, but I'll answer anyway since it would be a cool script to make. I also cannot test this in-game, so if someone could verify, that would be great.

Code:
{   parent = UIParent, anchor_to = "TOP",
    x_off = 0, y_off = -10, height = 100, width = 200,
    border = true, text = "",
    
    OnLoad = function(self)
        self:RegisterEvent("UNIT_TARGET")
    end,

    OnEvent = function(self)
        local unitsWithSameTarget, colors, colorTag = ""
        for i=1, MAX_PARTY_MEMBERS do
            if GetNumRaidMembers() > 0 then
                unitId = "raid"..i
            else
                unitId = "party"..i
            end

            -- Check if unit has same target as you.
            if UnitExists(unitId) and UnitGUID(unitId.."target") == UnitGUID("target") then
                -- Check if the unit is not dead and not yourself.
                if not UnitIsDead(unitId) and UnitGUID(unitId) ~= UnitGUID("player") then
                    -- Class coloring.
                    _, unitClass = UnitClass(unitId)
                    colors = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[unitClass]
                    colorTag = format("|cff%02x%02x%02x", colors.r*255, colors.g*255, colors.b*255)
        
                    -- Append class name to unitsWithSameTarget.
                    unitsWithSameTarget = (unitsWithSameTarget == "") and "" or unitsWithSameTarget..", "
                    unitsWithSameTarget = format("%s%s%s|r", unitsWithSameTarget, colorTag, UnitName(unitId))
                end
            end
        end

        if unitsWithSameTarget ~= "" then
            self.text:SetText(unitsWithSameTarget)
            self:SetAlpha(1)
        else
            self.text:SetText("")
            self:SetAlpha(0)
        end
    end
}

Last edited by Katae : 04-13-10 at 09:35 AM.
  Reply With Quote
05-08-10, 07:39 AM   #5
zynix
A Cliff Giant
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 70
Awesome addon you have constructed!
im making my own UI, but i have some difficulties making a panel for my actionbars.
This is what it looks like at the moment:


the panel around the two actionbars in the middle only shows the left and right side of the border. But i cant figure out a way to show the last two borders.
here is my code for the panel:
Code:
{name = "actionbar",
        anchor_to = "bottom", width = 400, height = 70, y_off = 5,
	bg_color = "0 0 0", bg_alpha = 1, level = 3,
	border = "SOLID", border_color = "CLASS", border_alpha = 1,},
the level tag is to get it above the panel at the bottom.

hope you can help me


EDIT: found a temporary fix for it:
two panels parented to the actionbar panel, works awesome

Last edited by zynix : 05-08-10 at 08:53 AM. Reason: found a fix
  Reply With Quote
05-08-10, 02:36 PM   #6
Zephon
A Kobold Labourer
Join Date: May 2010
Posts: 1
Hey!

Wanted to just start off by thanking you for the awesome addon :3

And since im not to pro at lua, I just wanted to ask a few fairly simple questions.

When I make a box of some sort, anywhere, how to I create borders on the right and left sides of the box?
And also, how do I make one of the boxes sit on top of another boxes border, without the other border showing in one of the boxes?

LPanels = {
["Default"] = {

{ name = "BottomBar",
anchor_to = "BOTTOM",
y_off = 0,
width = "100%",
height = 35,
bg_color = {0,0,0},
bg_alpha = 1,
},


{ name = "BorderLineTop",
parent = "BottomBar",
anchor_to = "TOP",
x_off = 0,
width = 2000,
height = 2,
bg_color = "CLASS",
bg_alpha = 1,
},

{ name = "ActionBars",
anchor_to = "BOTTOM",
y_off = 20,
width = 815,
height= 35,
bg_color = {0,0,0},
bg_alpha = 1,
},

{ name = "ActionBarBorderLineBottom",
parent = "ActionBars",
anchor_to = "BOTTOM",
x_off = 0,
width = "100%",
height = 2,
bg_color = "CLASS",
bg_alpha = 1,
},
That's the current code im using

/Thanks alot!
  Reply With Quote
05-08-10, 03:38 PM   #7
zynix
A Cliff Giant
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 70
Originally Posted by Zephon View Post
Hey!
how to I create borders on the right and left sides of the box?
I would create two panels for the box you want, anchor one to left side, and one to the right side

and at the other one, give the border panel a line that says level = "something low"
and then the box to place over the border, a higher level.
hope it helps
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » LitePanels - An art framework


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