mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-01 03:19:59 +00:00
auras: uncap the self-debuff tooltip lookup
With selfdebuff on, the displayed debuff list is PLAYER-filtered while GameTooltip:SetUnitAura indexes the unfiltered HARMFUL list, so both handlers map one to the other by matching name + sourceGUID. That mapping scanned slots 1..16 only. The unfiltered harmful list is not capped at 16. Once a unit's 16 debuff slots are full the server parks further debuffs in buff slots, and C_UnitAuras classifies by the aura's polarity flag rather than its slot range, so it reports those as harmful too -- verified live at 18 harmful on a 20-aura target. Past the sixteenth the lookup found nothing and fell through to the raw filtered index, opening the wrong tooltip or none. Both now enumerate however many harmful auras the unit actually has, via ScanAuraSlots, which also drops the per-index rescan the by-index accessor was doing. Each handler gets its own slot buffer: OnEnter can fire while a refresh is showing/hiding frames under the cursor, so sharing the refresh buffer could clobber a scan mid-walk. The nameplate module still collects at most 16 debuffs per plate. That one is a display cap matching its 16 configured icon frames, not an aura-count assumption, so it is left alone.
This commit is contained in:
+16
-6
@@ -10,6 +10,11 @@ pfUI.uf.frames = {}
|
||||
-- Scans run back to back and consume the buffer before the next refill.
|
||||
local auraSlots = {}
|
||||
|
||||
-- Separate buffer for the tooltip handlers. They run from OnEnter, which can
|
||||
-- fire while RefreshUnit is showing/hiding icons under the cursor, so they must
|
||||
-- not share the refresh buffer.
|
||||
local tooltipSlots = {}
|
||||
|
||||
-- ============================================================================
|
||||
-- GUID-based Roster Tracking for Smart Updates
|
||||
-- Only updates frames where the unit actually changed, not ALL 40 frames
|
||||
@@ -94,16 +99,21 @@ local function DebuffOnEnter()
|
||||
local parent = this:GetParent()
|
||||
|
||||
-- selfdebuff filters the displayed list to player-cast harmful auras, but
|
||||
-- SetUnitAura's index has to be into the engine's full HARMFUL list. Look
|
||||
-- up the displayed aura via the PLAYER filter, then scan engine slots for
|
||||
-- one whose name + sourceGUID match.
|
||||
-- SetUnitAura's index has to be into the unfiltered HARMFUL list. Look up
|
||||
-- the displayed aura via the PLAYER filter, then find its position in the
|
||||
-- unfiltered list by name + sourceGUID.
|
||||
--
|
||||
-- The unfiltered list is NOT capped at 16: once a unit's 16 debuff slots
|
||||
-- are full the server parks further debuffs in buff slots, and C_UnitAuras
|
||||
-- reports those as harmful too. So enumerate however many the unit has.
|
||||
if parent.config and parent.config.selfdebuff == "1" then
|
||||
local ownAura = C_UnitAuras.GetAuraDataByIndex(unitstr, this.id, "HARMFUL|PLAYER")
|
||||
if ownAura then
|
||||
for gameSlot = 1, 16 do
|
||||
local check = C_UnitAuras.GetDebuffDataByIndex(unitstr, gameSlot)
|
||||
local n = ScanAuraSlots(unitstr, "HARMFUL", tooltipSlots)
|
||||
for i = 1, n do
|
||||
local check = C_UnitAuras.GetAuraDataBySlot(unitstr, tooltipSlots[i])
|
||||
if check and check.name == ownAura.name and check.sourceGUID == ownAura.sourceGUID then
|
||||
GameTooltip:SetUnitAura(unitstr, gameSlot, "HARMFUL")
|
||||
GameTooltip:SetUnitAura(unitstr, i, "HARMFUL")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
+15
-6
@@ -76,6 +76,10 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
-- reusable GetAuraSlots buffer, filled once per RefreshBuffBarFrame
|
||||
local auraSlots = {}
|
||||
|
||||
-- Separate buffer for the tooltip handler: OnEnter can fire while a refresh
|
||||
-- is showing/hiding bars under the cursor, so it must not share the above.
|
||||
local tooltipSlots = {}
|
||||
|
||||
-- Reads one aura by the slot id GetAuraSlots returned (nil slot -> nil).
|
||||
local function GetBuffData(unit, slot)
|
||||
local name, icon, count, dispelType, _, expirationTime = C_UnitAuras.UnitAuraBySlot(unit, slot)
|
||||
@@ -116,17 +120,22 @@ pfUI:RegisterModule("buffwatch", function ()
|
||||
GameTooltip:SetUnitAura("player", this.id, this.type)
|
||||
elseif this.type == "HARMFUL" then
|
||||
-- selfdebuff filters the displayed list to player-cast harmful auras, but
|
||||
-- SetUnitAura's index has to be into the engine's full HARMFUL list. Look
|
||||
-- up the displayed aura via the PLAYER filter, then scan engine slots for
|
||||
-- one whose name + sourceGUID match.
|
||||
-- SetUnitAura's index has to be into the unfiltered HARMFUL list. Look up
|
||||
-- the displayed aura via the PLAYER filter, then find its position in the
|
||||
-- unfiltered list by name + sourceGUID.
|
||||
--
|
||||
-- The unfiltered list is NOT capped at 16: once a unit's 16 debuff slots
|
||||
-- are full the server parks further debuffs in buff slots, and
|
||||
-- C_UnitAuras reports those as harmful too. So enumerate what it has.
|
||||
local config = this.parent and this.parent.config
|
||||
if config and config.selfdebuff == "1" then
|
||||
local ownAura = C_UnitAuras.GetAuraDataByIndex(this.unit, this.id, "HARMFUL|PLAYER")
|
||||
if ownAura then
|
||||
for gameSlot = 1, 16 do
|
||||
local check = C_UnitAuras.GetDebuffDataByIndex(this.unit, gameSlot)
|
||||
local n = ScanAuraSlots(this.unit, "HARMFUL", tooltipSlots)
|
||||
for i = 1, n do
|
||||
local check = C_UnitAuras.GetAuraDataBySlot(this.unit, tooltipSlots[i])
|
||||
if check and check.name == ownAura.name and check.sourceGUID == ownAura.sourceGUID then
|
||||
GameTooltip:SetUnitAura(this.unit, gameSlot, "HARMFUL")
|
||||
GameTooltip:SetUnitAura(this.unit, i, "HARMFUL")
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user