Commit 823f9e73 authored by fgprodigal's avatar fgprodigal

Replace tooltip target name with _G.YOU if target is you.

parent 9f120596
...@@ -5,7 +5,7 @@ local TT = E.Tooltip ...@@ -5,7 +5,7 @@ local TT = E.Tooltip
--Cache global variables --Cache global variables
--Lua functions --Lua functions
--WoW API / Variables --WoW API / Variables
local _G, hooksecurefunc = _G, hooksecurefunc local _G, hooksecurefunc, string = _G, hooksecurefunc, string
local UnitIsPlayer = UnitIsPlayer local UnitIsPlayer = UnitIsPlayer
-- GLOBALS: -- GLOBALS:
...@@ -14,19 +14,33 @@ function RTT:SetUnitText(tt, unit, level, isShiftKeyDown) ...@@ -14,19 +14,33 @@ function RTT:SetUnitText(tt, unit, level, isShiftKeyDown)
if not UnitIsPlayer(unit) then if not UnitIsPlayer(unit) then
if tt:IsForbidden() then return end if tt:IsForbidden() then return end
for i=2, tt:NumLines() do for i=2, tt:NumLines() do
local tipLine = _G["GameTooltipTextLeft"..i] local leftLine = _G["GameTooltipTextLeft"..i]
local tipText = tipLine and tipLine.GetText and tipLine:GetText() local leftText = leftLine and leftLine.GetText and leftLine:GetText()
if tipText then if leftText then
tipLine:SetText(tipText:gsub("%|cff7f7f7f%?%?%|r", "|cffff1919??|r")) leftLine:SetText(leftText:gsub("%|cff7f7f7f%?%?%|r", "|cffff1919??|r"))
end end
end end
end end
end end
function RTT:GameTooltip_OnTooltipSetUnit(tt)
if tt:IsForbidden() then return end
for i=2, tt:NumLines() do
local leftLine = _G["GameTooltipTextLeft"..i]
local rightLine = _G["GameTooltipTextRight"..i]
local leftText = leftLine and leftLine.GetText and leftLine:GetText()
local rightText = rightLine and rightLine.GetText and rightLine:GetText()
if leftText and leftText:find(_G.TARGET) and rightText and rightText:find(E.myname) then
rightLine:SetText(string.format("|cffff0000>> %s <<|r", _G.YOU))
end
end
end
function RTT:Initialize() function RTT:Initialize()
if E.private.tooltip.enable ~= true then return end if E.private.tooltip.enable ~= true then return end
hooksecurefunc(TT, "SetUnitText", RTT.SetUnitText) hooksecurefunc(TT, "SetUnitText", RTT.SetUnitText)
hooksecurefunc(TT, "GameTooltip_OnTooltipSetUnit", RTT.GameTooltip_OnTooltipSetUnit)
end end
RayUI:RegisterModule(RTT:GetName()) RayUI:RegisterModule(RTT:GetName())
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment