From 7efc3334aef5822cad36019060d215eeeb3fab0a Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Thu, 6 Aug 2026 02:50:37 -0500 Subject: [PATCH] Add an aura caster line to tooltips Hook GameTooltip:SetUnitAura to append the caster's name; every pfUI aura tooltip (player buffs, buffwatch, unitframes) routes through it, so one hook covers them all. Resolve the name from the live sourceUnit token, falling back to the sourceGUID name cache (players only) when the token is gone. Gated behind a new tooltip.aurasource option (off by default) with a matching "Show Aura Caster" checkbox. The toggle reloads the UI, so the hook is installed conditionally at load rather than re-checking the flag per tooltip. --- api/config.lua | 1 + modules/gui.lua | 1 + modules/tooltip.lua | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/api/config.lua b/api/config.lua index 78957742..08ac65ff 100644 --- a/api/config.lua +++ b/api/config.lua @@ -785,6 +785,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("tooltip", nil, "extguild", "1") pfUI:UpdateConfig("tooltip", nil, "itemid", "0") pfUI:UpdateConfig("tooltip", nil, "movespeed", "0") + pfUI:UpdateConfig("tooltip", nil, "aurasource", "0") pfUI:UpdateConfig("tooltip", nil, "alpha", "0.8") pfUI:UpdateConfig("tooltip", nil, "alwaysperc", "0") pfUI:UpdateConfig("tooltip", "compare", "basestats", "1") diff --git a/modules/gui.lua b/modules/gui.lua index 6a65b3da..0db3bb94 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2772,6 +2772,7 @@ pfUI:RegisterModule("gui", function () CreateConfig(nil, T["Always Show Health In Percent"], C.tooltip, "alwaysperc", "checkbox") CreateConfig(nil, T["Show Item IDs"], C.tooltip, "itemid", "checkbox") CreateConfig(nil, T["Show Movement Speed"], C.tooltip, "movespeed", "checkbox") + CreateConfig(nil, T["Show Aura Caster"], C.tooltip, "aurasource", "checkbox") CreateConfig(nil, T["Custom Transparency"], C.tooltip, "alpha") CreateConfig(nil, T["Status Bar Texture"], C.tooltip.statusbar, "texture", "dropdown", pfUI.gui.dropdowns.uf_bartexture) CreateConfig(nil, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox") diff --git a/modules/tooltip.lua b/modules/tooltip.lua index bbcb833c..a739a499 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -266,4 +266,18 @@ pfUI:RegisterModule("tooltip", function () end GameTooltip:Show() end + + if C.tooltip.aurasource == "1" then + hooksecurefunc(GameTooltip, "SetUnitAura", function(self, ...) + local aura = C_UnitAuras.GetAuraDataByIndex(unpack(arg)) + if not aura then return end + local caster = aura.sourceUnit and UnitName(aura.sourceUnit) + if not caster and aura.sourceGUID then + caster = UnitNameFromGUID(aura.sourceGUID) + end + if not caster or caster == "" then return end + self:AddLine(T["Cast by"] .. ": " .. caster, .7, .7, 1) + self:Show() + end) + end end)