Originally Posted by Tim
Code:
local function getPlayerColors(unit)
if not UnitExists(unit) then return end
local color
local class = select(2, UnitClass(unit))
if UnitIsPlayer(unit) then
color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
else
color = FACTION_BAR_COLORS[UnitReaction(unit, "player")]
end
return color.r, color.g, color.b
end
local UpdateColor = CreateFrame("Frame")
UpdateColor:RegisterEvent("PLAYER_ENTERING_WORLD")
UpdateColor:RegisterEvent("PLAYER_TARGET_CHANGED")
UpdateColor:RegisterEvent("PLAYER_FOCUS_CHANGED")
UpdateColor:RegisterEvent("UNIT_FACTION")
UpdateColor:SetScript("OnEvent", function(_, event)
_G["PlayerName"]:SetTextColor(getPlayerColors("player"))
_G["TargetFrameTextureFrameName"]:SetTextColor(getPlayerColors("target"))
_G["FocusFrameTextureFrameName"]:SetTextColor(getPlayerColors("focus"))
end)
|
This code working very well, ty
Tim very much for help!!!
And about PlayerHitIndicator, you are right. I use other fonts, that's why PlayerHitIndicator is so big. And since they can not be reduced, I decided to hide them. If someone need a code:
Code:
PlayerHitIndicator:SetText(nil)
PlayerHitIndicator.SetText = function() end