mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 12:10:48 +00:00
buff: use class colors on unbuffed units
This commit is contained in:
+15
@@ -51,6 +51,21 @@ function pfUI.api.UnitHasBuff(unit, buff)
|
|||||||
return hasbuff
|
return hasbuff
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- [[ GetUnitColor ]]
|
||||||
|
-- Returns an escape string for the unit aswell as the RGB values
|
||||||
|
-- unit [string] the unitstring
|
||||||
|
-- return: [table] string, r, g, b
|
||||||
|
function pfUI.api.GetUnitColor(unitstr)
|
||||||
|
local _, class = UnitClass(unitstr)
|
||||||
|
|
||||||
|
local r, g, b = .8, .8, .8
|
||||||
|
if RAID_CLASS_COLORS[class] then
|
||||||
|
r, g, b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
|
||||||
|
end
|
||||||
|
|
||||||
|
return string.format("|cff%02x%02x%02x", r * 255, g * 255, b * 255), r, g, b
|
||||||
|
end
|
||||||
|
|
||||||
-- [ strvertical ]
|
-- [ strvertical ]
|
||||||
-- Creates vertical text using linebreaks. Multibyte char friendly.
|
-- Creates vertical text using linebreaks. Multibyte char friendly.
|
||||||
-- 'str' [string] String to columnize.
|
-- 'str' [string] String to columnize.
|
||||||
|
|||||||
+3
-3
@@ -402,20 +402,20 @@ function pfUI.uf:UpdateConfig()
|
|||||||
for i=1,40 do
|
for i=1,40 do
|
||||||
local unitstr = "raid" .. i
|
local unitstr = "raid" .. i
|
||||||
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName(unitstr)
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName(unitstr) .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not UnitHasBuff("player", texture) then
|
if not UnitHasBuff("player", texture) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName("player")
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName("player") .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local unitstr = "party" .. i
|
local unitstr = "party" .. i
|
||||||
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName(unitstr)
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName(unitstr) .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+3
-3
@@ -120,20 +120,20 @@ pfUI:RegisterModule("buff", function ()
|
|||||||
for i=1,40 do
|
for i=1,40 do
|
||||||
local unitstr = "raid" .. i
|
local unitstr = "raid" .. i
|
||||||
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName(unitstr)
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName(unitstr) .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if not UnitHasBuff("player", texture) then
|
if not UnitHasBuff("player", texture) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName("player")
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName("player") .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
for i=1,4 do
|
for i=1,4 do
|
||||||
local unitstr = "party" .. i
|
local unitstr = "party" .. i
|
||||||
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
if not UnitHasBuff(unitstr, texture) and UnitName(unitstr) then
|
||||||
playerlist = playerlist .. ( not first and ", " or "") .. UnitName(unitstr)
|
playerlist = playerlist .. ( not first and ", " or "") .. GetUnitColor(unitstr) .. UnitName(unitstr) .. "|r"
|
||||||
first = nil
|
first = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user