WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Cladhaire's Mods (https://www.wowinterface.com/forums/forumdisplay.php?f=75)
-   -   HOWTO: Change PerfectRaid's Visual Layout (https://www.wowinterface.com/forums/showthread.php?t=11460)

Cladhaire 07-28-07 06:15 AM

HOWTO: Change PerfectRaid's Visual Layout
 
Since I've gotten this question a bunch of times, but have not had the opportunity to get everything I'd like done with PerfectRaid, I wanted to post a quick tutorial on how the visual style of PerfectRaid is coded, and give you all an idea of how you can alter it to customize the visual style.

The layout is all done in module functions called UpdateButtonLayout, with the initial layout being done in PerfectRaid.lua. This function is called with the unit frame, which contains a number of member frames:

* button - the unit frame
* button.leftbox - A bounding box on the left-hand side of the frame. This is by default 70 pixels wide
* button.rightbox - A bounding box on the right-hand side of the frame. This is by default 70 pixels wide
* button.healthbar - The health bar, anchored in between the two bounding boxes.. so this will be the frame size - 140.
* button.manabar - The mana bar, anchored to the bottom of the health bar
* button.status - The "DEAD, GHOST and HPMISSING" text.. this is always anchored to the right of the health bar.
* button.name - The unit's name. This is anchored to one of the bounding boxes, depending on the "ALIGN RIGHT" option.
* button.aura - Defined in PerfectRaid_Buffs.lua, this is the "buffs" text that appears by default next to the right-hand side of the health bar.

That's all the stuff in PerfectRaid.lua, everythign else is provided by a module. Here's how you would change some common things:

How do I make the overall frame larger
This unfortunately is done by the secure templates, and needs to be changed outside the LayoutButton function. On PerfectRaid.lua:625 and PerfectRaid.lua:626 you will see lines:

Code:

button:SetAttribute("initial-width", 225)
button:SetAttribute("initial-height", 14)

These two attributes dictate how large the frame is width and height-wise. To make it larger, you simply change these numbers.

How do I put the name inside the health bar?
This one is pretty easy, actually but will take some tweaking to get it to look just right. First off, remember that the frame looks like this by default:

[leftbox][healthbar][rightbox]

and in default mode, the rightbox contains the buff text, and the leftbox contains the name. What you can do to experiment is, change the leftbox to 1 pixel width, and then anchor the name. Do this:

PerfectRaid.lua:697 - Change to button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)

PerfectRaid.lua:729/730 - Change these two lines to:
Code:

button.name:SetPoint("LEFT", button.healthbar, "LEFT", 0, 0)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)

This should make the left bound box smaller, and anchor the name to the left hand side of the healthbar. If the name is too long, it will run into the status text, but you could fix this with anchoring.

How do I alter the code to allow dragging the frame off-screen
In PerfectRaid.lua, lines 340 and 670, the ClampedToScreen setting is set on both the button, and the header (if you don't understand these, it doesn't matter all that much). Simply comment those lines out by adding a -- at the start of them, and you should be able to drag PerfectRaid without having it dock to the screen. I will likely add an option for this relatively soon, when I have a spare moment.

Buff text
The buff text is layed out in PerfectRaid_Buffs.lua (in the Buffs:UpdateButtonLayout() function). In addition to handling the buff text, this also handles the setting and resetting of the highlight backdrops. This is done here, since those highlights are triggered from this module (also note, there is no PerfectRaid_Highlight.lua file, that options pane is defined in this file.

That's really it. What I could do, is provide a separate file that can be used to code layouts in Lua by providing a new master UpdateButtonLayout() function. This way, people could share their customizations on the PerfectRaid visual style. Would that be interesting to anyone?

Twonky 08-19-07 05:13 AM

Quote:

Originally Posted by Cladhaire
How do I put the name inside the health bar?
This one is pretty easy, actually but will take some tweaking to get it to look just right. First off, remember that the frame looks like this by default:

[leftbox][healthbar][rightbox]

and in default mode, the rightbox contains the buff text, and the leftbox contains the name. What you can do to experiment is, change the leftbox to 1 pixel width, and then anchor the name. Do this:

PerfectRaid.lua:697 - Change to button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)

It should be line 696.

Quote:

Originally Posted by Cladhaire
PerfectRaid.lua:729/730 - Change these two lines to:
Code:

button.name:SetPoint("LEFT", button.healthbar, "LEFT", 0, 0)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)

This should make the left bound box smaller, and anchor the name to the left hand side of the healthbar. If the name is too long, it will run into the status text, but you could fix this with anchoring.

You also have to change the next line (731) to
Code:

button.name:SetJustifyH("LEFT")
otherwise the names will be anchored right.

With this change Manabar is on top of the name, so the bigger the manabar the less you see of the name. Is there a possibilty to change this behaviour?

Vranx 08-19-08 01:59 PM

Using the latest version of PRaid I have managed to get the name over the bar with the following changes:
Code:

Line 557
from -        button:SetAttribute("initial-width", 225)
to -        button:SetAttribute("initial-width", 170)

Line 632
from - button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 70, 0)
to -  button.leftbox:SetPoint("BOTTOMRIGHT", button, "BOTTOMLEFT", 1, 0)

Lines 665-667
from -
button.name:SetPoint("RIGHT", button.leftbox, "RIGHT", -2, 0)
button.name:SetPoint("LEFT", button.leftbox, "LEFT", 0, 0)
button.name:SetJustifyH("RIGHT")
to -
button.name:SetPoint("LEFT", button.healthbar, "LEFT", 2, 1)
button.name:SetPoint("RIGHT", button.healthbar, "RIGHT", 0, 0)
button.name:SetJustifyH("LEFT")

Now I have class colored names over a class colored bar. How can I change the name color to white?

Cladhaire 08-20-08 01:32 AM

Isn't there an option for that? Disable the checkbox that colors names by class.

Vranx 08-20-08 07:28 PM

Im either blind (a good possibility) or the only option for class color is the bar.

Cladhaire 08-21-08 01:27 AM

You are probably correct. There's a function called PerfectRaid:GetColoredName(). Simply change that to have it return a white name instead of the class colored name.

Lunarion 04-23-09 03:43 PM

I know absolutely nothing about lua code.

That said I did get this to work.

I just don't know what to change about the PerfectRaid:GetColoredName() in order to get the names to show up white.

XD

Cladhaire 04-23-09 03:49 PM

Change

return string.format("%s|cFF%02x%02x%02x%s|r", group, color.r*255, color.g*255, color.b*255, UnitName(unit) or "Unknown")

to

return string.format("%s|cFFFFFF%s|r", group, UnitName(unit) or "Unknown")

Vranx 05-07-09 08:50 PM

Quote:

Originally Posted by Cladhaire (Post 130505)
return string.format("%s|cFFFFFF%s|r", group, UnitName(unit) or "Unknown")

I just tried this and it changed the name to white but it has the |cFFFFFF on the frame in front of the name.

Cladhaire 05-08-09 02:25 AM

i think it needs another set of FF's

|cFFFFFFFF

Vranx 05-09-09 08:14 AM

That fixed it, thanks.

Exinferis 05-16-09 01:50 PM

Sorry, I'm kind of new to editing LUA and want to change the names to be over the health bars. What program do you use to edit the lua files? I tried notepad/wordpad but they dont list the lines. I than downloaded WoW UI Designer but the lines dont seem to match up with the directions you provided.

Thanks in advance

Cladhaire 05-16-09 02:51 PM

I used to use Scite on windows. The line numbers will not match precisely, they have changed.

Jooze 12-12-09 02:49 PM

Just thought I'd share this here, it took ages for me to get this part :)
I wanted to change the colors of the bars (when it's not class colored), to white, shifting to red when the HP decreases.

I did this by changing the Dongle.Utils.GerSeverity(perc,class) function in
PerfectRaid_Utils.lua (around line 64).

It now looks like this:

Code:

function DongleUtils.GetHPSeverity(perc, class)
        --[[if not class then return DongleUtils.ColorGradient(perc, 1,0,0, 1,1,0, 0,1,0)
        else
                local c = RAID_CLASS_COLORS[class]
                return DongleUtils.ColorGradient(perc, 1,0,0, 1,1,0, c.r,c.g,c.b)
        end
        --]]
        return DongleUtils.ColorGradient(perc, 1, 1, 1, 1, 1, 1, 1, 1, 1)
end

The color now shifts from white (max hp) over yellow to red :)

Cladhaire 12-12-09 06:22 PM

Great, thanks =)

monya 01-24-10 09:14 AM

Me and my sexy undead priest love praid for years it seems and the only 2 things i came across, which irritate me:
- slightly more accurate (large) backdrop frame, cause first/last healthbars are not covered fully and beginnning of long names either...
- disabled mouseover or mouseclick activity between healthbars, cause sometimes i get tooltips when i hover between healthbars, if there is some raidmember there ^^. I got all tooltips disabled in combat due to that disadvantage, but even seconds before pull, when im still out of combat it irritates (tooltip i mean). What to say about sudden targeting of random guy...
Thanks in advance for implementing such options/fixes or for the way how to edit code to get it working.

P.S.: Ur addon is best ever! <3

Tag of Fire 03-11-10 09:04 AM

Is there a way to prevent player names from being shortened with a triple dot?
I looked into the .lua files but I can't seem to find it... :confused:

Cladhaire 03-11-10 09:09 AM

Not trivially, no.


All times are GMT -6. The time now is 06:36 AM.

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