mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-02 11:40:01 +00:00
Use positional C_UnitAuras accessors in hot aura scans
Swap the per-frame aura-refresh loops from table-allocating GetAuraDataByIndex/GetBuffDataByIndex/GetDebuffDataByIndex/GetUnitAuras to the zero-allocation positional C_UnitAuras.UnitAura/UnitBuff/UnitDebuff. unitframes: buff/debuff icon loops, the dispellable-indicator 16-slot scan, the two GetUnitAuras indicator passes, and the custom-debuff scan. nameplates: the per-plate debuff scan now writes positional results straight into the reusable display buffer, dropping the per-aura tables and the result array. Filters change from HARMFUL|PLAYER/HARMFUL to PLAYER/nil since UnitBuff/ UnitDebuff lock the range and still honor the PLAYER predicate. Cold single-lookups (hover/click, tooltip, totem icon, libdebuff) keep the readable table API.
This commit is contained in:
+13
-10
@@ -1313,19 +1313,22 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE")
|
||||
for i = 1, 16 do debuffDisplayBuf[i].effect = nil end
|
||||
if unitstr then
|
||||
local filter = cfg.owndebuffs and "HARMFUL|PLAYER" or "HARMFUL"
|
||||
local auras = C_UnitAuras.GetUnitAuras(unitstr, filter)
|
||||
local now = GetTime()
|
||||
for _, aura in ipairs(auras) do
|
||||
if debuffCount >= 16 then break end
|
||||
-- positional UnitAura writes straight into the reusable buffer, so the
|
||||
-- per-plate scan allocates nothing (no per-aura table, no result array)
|
||||
local i = 1
|
||||
while debuffCount < 16 do
|
||||
local aname, icon, count, dispelType, duration, expirationTime = C_UnitAuras.UnitAura(unitstr, i, filter)
|
||||
if not aname then break end
|
||||
debuffCount = debuffCount + 1
|
||||
local timeleft = (aura.expirationTime and aura.expirationTime > 0) and (aura.expirationTime - now) or nil
|
||||
local b = debuffDisplayBuf[debuffCount]
|
||||
b.effect = aura.name
|
||||
b.texture = aura.icon
|
||||
b.stacks = aura.applications
|
||||
b.dtype = aura.dispelName
|
||||
b.duration = aura.duration
|
||||
b.timeleft = timeleft
|
||||
b.effect = aname
|
||||
b.texture = icon
|
||||
b.stacks = count
|
||||
b.dtype = dispelType
|
||||
b.duration = duration
|
||||
b.timeleft = (expirationTime and expirationTime > 0) and (expirationTime - now) or nil
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
for i = 1, 16 do
|
||||
|
||||
Reference in New Issue
Block a user