mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 11:10:00 +00:00
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.
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user