/trunk
end |
function ColoredTooltips_SetBackground() |
local __, unit = GameTooltip:GetUnit(); |
local _, unit = GameTooltip:GetUnit(); |
if(UnitExists(unit) and ColoredTooltips_Config["ENABLE"] == 1) then |
local r, g, b = GameTooltip_UnitColor(unit); |
if (ColoredTooltips_Config["GUILDLABEL"] == 1) then |
local guild = GetGuildInfo(unit); |
if (guild) then |
local _, realm = UnitName(unit); |
if (guild and realm) then |
if (GameTooltipTextLeft2:GetText() == guild.."-"..realm and GameTooltipTextLeft2:IsVisible()) then |
GameTooltipTextLeft2:Hide(); |
GameTooltip:AddLine(string.format("<%s>", guild)); |
end |
elseif (guild) then |
if (GameTooltipTextLeft2:GetText() == guild and GameTooltipTextLeft2:IsVisible()) then |
GameTooltipTextLeft2:Hide(); |
GameTooltip:AddLine(string.format("<%s>", guild)); |
end |
if (ColoredTooltips_Config["PVPLABEL"] == 1) then |
local _, faction = UnitFactionGroup(unit); |
for i = 3, 5 do |
local tooltipTextLeft = _G["GameTooltipTextLeft"..i]; |
local originalText = tooltipTextLeft:GetText(); |
end |
end |
end |
if (originalText and faction) then |
local newText = string.gsub(originalText, faction, ""); |
if (newText == "") then |
tooltipTextLeft:SetText(nil); |
tooltipTextLeft:Hide(); |
-- removes the right line too, which should provide alignment. |
local tooltipTextRight = _G["GameTooltipTextRight"..i]; |
if ( tooltipTextRight ) then |
tooltipTextRight:SetText(nil); |
tooltipTextRight:Hide(); |
end |
end |
end |
end |
end |
## Interface: 50400 |
## Title: Colored Tooltips |
## Notes: Sets tooltip background colors based on targeted unit |
## Version: 1.2.7 |
## Version: 1.2.8 |
## Author: Kharthus |
## SavedVariables: ColoredTooltips_Config |
ColoredTooltips.xml |