diff --git a/Modules/Tooltip/Tooltip.lua b/Modules/Tooltip/Tooltip.lua index a8ffa829f5c53ed35bd79f1df91cf10ac5a0302c..46783b684464109793acc43873a069fa91283454 100644 --- a/Modules/Tooltip/Tooltip.lua +++ b/Modules/Tooltip/Tooltip.lua @@ -5,7 +5,7 @@ local TT = E.Tooltip --Cache global variables --Lua functions --WoW API / Variables -local _G, hooksecurefunc = _G, hooksecurefunc +local _G, hooksecurefunc, string = _G, hooksecurefunc, string local UnitIsPlayer = UnitIsPlayer -- GLOBALS: @@ -14,19 +14,33 @@ function RTT:SetUnitText(tt, unit, level, isShiftKeyDown) if not UnitIsPlayer(unit) then if tt:IsForbidden() then return end for i=2, tt:NumLines() do - local tipLine = _G["GameTooltipTextLeft"..i] - local tipText = tipLine and tipLine.GetText and tipLine:GetText() - if tipText then - tipLine:SetText(tipText:gsub("%|cff7f7f7f%?%?%|r", "|cffff1919??|r")) + local leftLine = _G["GameTooltipTextLeft"..i] + local leftText = leftLine and leftLine.GetText and leftLine:GetText() + if leftText then + leftLine:SetText(leftText:gsub("%|cff7f7f7f%?%?%|r", "|cffff1919??|r")) 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() if E.private.tooltip.enable ~= true then return end hooksecurefunc(TT, "SetUnitText", RTT.SetUnitText) + hooksecurefunc(TT, "GameTooltip_OnTooltipSetUnit", RTT.GameTooltip_OnTooltipSetUnit) end RayUI:RegisterModule(RTT:GetName()) \ No newline at end of file