Thread Tools Display Modes
08-21-17, 06:05 AM   #1
missycnr
A Kobold Labourer
Join Date: Aug 2017
Posts: 1
Adding HP text to default Tooltip??

Hello everyone,
I have a simple little addon thing that adds class colors to the default tooltip and I was wondering if I could get some help adding HP text also?

Here is what I have so far:

GameTooltip:HookScript("OnTooltipSetUnit", function(GameTooltip)
--print("OnTooltipSetUnit")
local _, unit = GameTooltip:GetUnit()
--print(unit)
if UnitIsPlayer(unit) then
--print("UnitIsPlayer")
local _, class = UnitClass(unit)
--print(class)
local color = class and (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
if color then
local text = GameTooltipTextLeft1:GetText()
--print(text)
GameTooltipTextLeft1:SetFormattedText("|cff%02x%02x%02x%s|r", color.r * 255, color.g * 255, color.b * 255, text:match("|cff\x\x\x\x\x\x(.+)|r") or text)
end
end
end)


EDIT****
Also wondering if it is possible to add rare tag?

Last edited by missycnr : 08-21-17 at 07:50 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Adding HP text to default Tooltip??


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off