WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Class colored player frames (pics included) (https://www.wowinterface.com/forums/showthread.php?t=49838)

Xxplosiv3xX 09-04-14 09:36 AM

Class colored player frames (pics included)
 
Hey guys,

I was curious to know if anyone knows the addon to change player target/focus frames to be class colored.

Thanks.




Nynaeve 09-04-14 03:28 PM

For clarification's sake, you only want the background of the name frame colored, you don't want anything else present in the screenshots? (For example the class icon instead of character portrait on that target frame in the second SS?)
There are plenty of addons that include the name background coloring, but also have a ton of other tweaks and features (though IDK if they're still working, I don't care for the default UF's myself and use SUF on live).

If all you want is the name background colored for certain units, I can upload that right now, as I had done that for beta.

If you wanted a ton of other options, you could try something like UnitFramesImproved or Sennetta's Custom Script UI or one of the other addons that include that.

As for the particular addon that the screenshot is likely of, I think it's a modified version of Santa UI(specifically Santa UI Textures ), that's why the outlines of the unit frames are darker, in case you were wondering.

Edit:

File uploaded and likely approved at any moment. Fabulous mods are fabulous.

Here it is if you want it.

Xxplosiv3xX 09-04-14 09:04 PM

awesome! just what I was looking for!

Thanks! :)

Xxplosiv3xX 09-05-14 03:09 PM

Hey, so I pretty much have my frames the way I wanted with your awesome addon script and santaUI textures, but there seems to be an issue with my health/mana/energy bar. I dont know what is causing this but the class color appears to also be the backdrop of my resource/health bars. I'll link a pic to show you what I mean.


ObbleYeah 09-05-14 03:46 PM

I did this the other day too, you actually have to create a new texture correctly sized and parented to PlayerFrameBackground rather than modifying the frame itself - else, as you've noticed, the entire unit background is recoloured.



Lua Code:
  1. --
  2.     if PlayerFrame:IsShown() and not bg then
  3.         local _, class = UnitClass("player")
  4.         local colour = RAID_CLASS_COLORS[class]
  5.         local bg = PlayerFrame:CreateTexture(nil, "ARTWORK")
  6.            
  7.         bg:SetPoint("TOPLEFT", PlayerFrameBackground)
  8.         bg:SetPoint("BOTTOMRIGHT", PlayerFrameBackground, 0, 22)
  9.         bg:SetVertexColor(colour.r, colour.g, colour.b, .95)
  10.         bg:SetTexture("texturepath")
  11.     end

Xxplosiv3xX 09-05-14 04:52 PM

Sorry im pretty new to coding with .lua. How would I go about turning this into an addon?

Duugu 09-05-14 05:40 PM

Quote:

Originally Posted by Xxplosiv3xX (Post 296325)
Sorry im pretty new to coding with .lua. How would I go about turning this into an addon?

You could use http://addon.bool.no :)

Xxplosiv3xX 09-06-14 12:11 PM

Sorry guys, I still can't seem to fix it... Does anyone have a working solution?

Rilgamon 09-06-14 02:03 PM

1 Attachment(s)
Collecting the posted snippets I'd try it this way :)
Download: Attachment 8203

Lua Code:
  1. local ClassColorUnits = {
  2.     ["target"] = {
  3.         ["name"] = "TargetFrame",
  4.         ["back"] = "TargetFrame",
  5.         ["x-offset"] = -104,
  6.         ["y-offset"] = 60,
  7.         ["x-offset2"] = 6,
  8.         ["y-offset2"] = -22,
  9.     },
  10.     ["player"] = {
  11.         ["name"] = "PlayerFrame",
  12.         ["back"] = "PlayerFrameBackground",
  13.         ["x-offset"] = 0,
  14.         ["y-offset"] = 22,
  15.         ["x-offset2"] = 0,
  16.         ["y-offset2"] = 0,
  17.     },
  18.     ["focus"] = {
  19.         ["name"] = "FocusFrame",
  20.         ["back"] = "FocusFrame",
  21.         ["x-offset"] = -104,
  22.         ["y-offset"] = 60,
  23.         ["x-offset2"] = 6,
  24.         ["y-offset2"] = -22,
  25.     },
  26. }
  27. local function updateClassColor(unit)
  28.     if(unit and UnitExists(unit)) then
  29.         local _,class = UnitClass(unit)
  30.         if(class and RAID_CLASS_COLORS[class]) then
  31.             if(ClassColorUnits[unit]) then
  32.                 local uf = _G[ClassColorUnits[unit]['name']]
  33.                 local bg = _G[ClassColorUnits[unit]['back']]
  34.                 if(not uf['unitClassColorBack']) then
  35.                     uf['unitClassColorBack'] = uf:CreateTexture(nil, "ARTWORK")
  36.                     uf['unitClassColorBack']:SetPoint("TOPLEFT", bg, ClassColorUnits[unit]['x-offset2'], ClassColorUnits[unit]['y-offset2'])
  37.                     uf['unitClassColorBack']:SetPoint("BOTTOMRIGHT", bg, ClassColorUnits[unit]['x-offset'], ClassColorUnits[unit]['y-offset'])
  38.                     uf['unitClassColorBack']:SetTexture("Interface\\TargetingFrame\\UI-StatusBar")
  39.                 end
  40.                 local col = RAID_CLASS_COLORS[class]
  41.                 uf['unitClassColorBack']:SetVertexColor(col['r'], col['g'], col['b'])
  42.             end
  43.         end
  44.     end
  45. end
  46.  
  47. local frame = CreateFrame("Frame")
  48. frame:RegisterEvent("PLAYER_FOCUS_CHANGED")
  49. frame:RegisterEvent("PLAYER_TARGET_CHANGED")
  50. frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  51. frame:SetScript("OnEvent", function(self, event)
  52.     if(event=="PLAYER_FOCUS_CHANGED") then
  53.         updateClassColor('focus')
  54.     elseif(event=="PLAYER_TARGET_CHANGED") then
  55.         updateClassColor('target')
  56.     elseif(event=="PLAYER_ENTERING_WORLD") then
  57.         updateClassColor('player')
  58.         self:UnregisterEvent(event)
  59.     end
  60. end)

Xxplosiv3xX 09-06-14 03:39 PM

WOOT :banana::banana:

thanks!

Rilgamon 09-06-14 03:48 PM

Quote:

Originally Posted by Xxplosiv3xX (Post 296355)
WOOT :banana::banana:

thanks!

Wait a few hours ... normally I get some corrections to my code ;)

Xxplosiv3xX 09-06-14 04:06 PM

Is there a way to edit the lua to make friendly NPCs green and enemy NPCs red?

Right now their class colored and it looks akward (banker is brown(warrior)) lol

Rilgamon 09-07-14 01:35 AM

For a quick solution you can remove the target part and it will just color player and focus.
Lua Code:
  1. ["target"] = {
  2.         ["name"] = "TargetFrame",
  3.         ["back"] = "TargetFrame",
  4.         ["x-offset"] = -104,
  5.         ["y-offset"] = 60,
  6.         ["x-offset2"] = 6,
  7.         ["y-offset2"] = -22,
  8.     },
For a longer solution replace the 'SetVertexColor' line with
Lua Code:
  1. if(not UnitIsPlayer(unit)) then
  2.                     uf['unitClassColorBack']:SetVertexColor(0, 0, 0, 0)
  3.                 else
  4.                     uf['unitClassColorBack']:SetVertexColor(col['r'], col['g'], col['b'],1)
  5.                 end
NPC are mostly warriors or mages. Thats a generic value for them :)


All times are GMT -6. The time now is 08:17 AM.

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