I’ve created an addon - Guild Tooltip - which changes how player tooltips work in Classic, by adding people’s guilds and using class colours to make it easier at a glance what class the person you’re mousing over is.
There have been numerous requests from users of the addon to extend this fucntionality to both the TargetFrame and party/raid frames; right now I’m working on the former, but it seems to be quite tempermental in that the updated tooltip doesn’t always appear.
The code I’m using at the moment is this:
TargetFrame:HookScript("OnEnter", function(self)
if UnitIsPlayer("mouseover") and not UnitIsUnit("mouseover", "player") then
GameTooltip:ClearLines()
local name = UnitPVPName("mouseover")
local guildName, guildRankName, guildRankIndex = GetGuildInfo("mouseover");
local playerlevel = UnitLevel("mouseover")
local race = UnitRace("mouseover")
local localizedClass, englishClass, classIndex = UnitClass("mouseover")
local theirPvP = UnitIsPVP("mouseover")
if playerlevel == -1 then playerlevel = "??" end
if GTConfig.Colour == "ENABLED" then
self:AddLine("|c" .. RAID_CLASS_COLORS[englishClass].colorStr .. name .. '|r', 1, 1, 1, true)
if guildName ~= nil then
self:AddLine('|cFF40FB40' .. guildName .. '|r', 1, 1, 1, true)
end
self:AddLine(LEVEL .. " " .. playerlevel .. " " .. race .. " |c" .. RAID_CLASS_COLORS[englishClass].colorStr .. localizedClass .. '|r', 1, 1, 1, true)
elseif GTConfig.Colour == "DISABLED" then
self:AddLine(name, 1, 1, 1, true)
if guildName ~= nil then
self:AddLine(guildName, 1, 1, 1, true)
end
self:AddLine(LEVEL .. " " .. playerlevel .. " " .. race .. " " .. localizedClass, 1, 1, 1, true)
end
if theirPvP == true then
self:AddLine(PVP, 1, 1, 1, true)
end
GameTooltipStatusBar:Show()
end
end)
However, this sometimes leads to a Lua error when the mouse pointer leaves the target frame:
Interface\AddOns\GuildTooltip\GuildTooltip.lua:82: attempt to call method ‘AddLine’ (a nil value)
For the record, line 82 is:
self:AddLine("|c" .. RAID_CLASS_COLORS[englishClass].colorStr .. name .. '|r', 1, 1, 1, true)
I want to add this functionality, as I agree it is useful, but obviously it needs to work first! Plus there’s getting it to work with party/raid frames, which I haven’t even begun to attempt; right now, hovering over one party/raid members frame will often give you the details of someone else.
Any and all help with this is greatly appreciated, and will be credited when the new update goes live (provided we can get it working, that is).
If you need more information, please let me know.
Thanks! ![]()