mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-04 12:40:02 +00:00
Several changes
Fix stale debuff icons/tooltips on target frame after target swap Fix debuffs not showing on nameplates for timer-less spells (e.g. Hurricane) Fix buffwatch timer visually speeding up when another debuff fades Remove 50ms aura cache (slotMapCache/auraFC) - caused stale debuff data Remove "Show Only Own Debuffs" from unitframes and nameplates GUI Force selfdebuff=0 for unitframes/nameplates on login to reset old SavedVariables
This commit is contained in:
+36
-27
@@ -327,28 +327,39 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
|
||||
|
||||
local function PlateCacheDebuffs(self, unitstr, verify)
|
||||
if not self.debuffcache then self.debuffcache = {} end
|
||||
if not libdebuff then return end -- Safety check
|
||||
if not libdebuff then return end
|
||||
|
||||
local now = GetTime()
|
||||
|
||||
-- Clear existing cache slots
|
||||
for id = 1, 16 do
|
||||
local effect, _, texture, stacks, _, duration, timeleft
|
||||
|
||||
if unitstr and C.nameplates.selfdebuff == "1" then
|
||||
effect, _, texture, stacks, _, duration, timeleft = libdebuff:UnitOwnDebuff(unitstr, id)
|
||||
else
|
||||
effect, _, texture, stacks, _, duration, timeleft = libdebuff:UnitDebuff(unitstr, id)
|
||||
if self.debuffcache[id] then
|
||||
self.debuffcache[id].empty = true
|
||||
end
|
||||
end
|
||||
|
||||
if effect and timeleft and timeleft > 0 then
|
||||
local start = GetTime() - ( (duration or 0) - ( timeleft or 0) )
|
||||
local stop = GetTime() + ( timeleft or 0 )
|
||||
self.debuffcache[id] = self.debuffcache[id] or {}
|
||||
self.debuffcache[id].effect = effect
|
||||
self.debuffcache[id].texture = texture
|
||||
self.debuffcache[id].stacks = stacks
|
||||
self.debuffcache[id].duration = duration or 0
|
||||
self.debuffcache[id].start = start
|
||||
self.debuffcache[id].stop = stop
|
||||
self.debuffcache[id].empty = nil
|
||||
-- Get GUID - unitstr may already be a GUID from plate.parent:GetName(1)
|
||||
local guid = unitstr
|
||||
if unitstr and not string.find(unitstr, "^0x") and GetUnitGUID then
|
||||
guid = GetUnitGUID(unitstr) or unitstr
|
||||
end
|
||||
|
||||
if guid then
|
||||
for id = 1, 16 do
|
||||
local effect, _, texture, stacks, dtype, duration, timeleft
|
||||
effect, _, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff(guid, id)
|
||||
if effect and texture then
|
||||
local stop = (timeleft and timeleft > 0) and (now + timeleft) or nil
|
||||
local start = stop and (stop - (duration or 0)) or now
|
||||
self.debuffcache[id] = self.debuffcache[id] or {}
|
||||
self.debuffcache[id].effect = effect
|
||||
self.debuffcache[id].texture = texture
|
||||
self.debuffcache[id].stacks = stacks
|
||||
self.debuffcache[id].duration = duration or 0
|
||||
self.debuffcache[id].start = start
|
||||
self.debuffcache[id].stop = stop
|
||||
self.debuffcache[id].empty = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -359,15 +370,15 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
|
||||
-- break on unknown data
|
||||
if not self.debuffcache then return end
|
||||
if not self.debuffcache[id] then return end
|
||||
if not self.debuffcache[id].stop then return end
|
||||
|
||||
-- break on timeout debuffs
|
||||
if self.debuffcache[id].empty then return end
|
||||
if self.debuffcache[id].stop < GetTime() then return end
|
||||
if self.debuffcache[id].stop and self.debuffcache[id].stop < GetTime() then return end
|
||||
|
||||
-- return cached debuff
|
||||
local c = self.debuffcache[id]
|
||||
return c.effect, c.rank, c.texture, c.stacks, c.dtype, c.duration, (c.stop - GetTime())
|
||||
local timeleft = c.stop and (c.stop - GetTime()) or -1
|
||||
return c.effect, c.rank, c.texture, c.stacks, c.dtype, c.duration, timeleft
|
||||
end
|
||||
|
||||
local function CreateDebuffIcon(plate, index)
|
||||
@@ -994,8 +1005,8 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
-- yet updated. So while being inside this event, we cannot trust the unitstr.
|
||||
if event == "PLAYER_TARGET_CHANGED" then unitstr = nil end
|
||||
|
||||
-- remove unitstr on unit name mismatch
|
||||
if unitstr and UnitName(unitstr) ~= name then unitstr = nil end
|
||||
-- remove unitstr on unit name mismatch (skip for GUIDs - they're always valid)
|
||||
if unitstr and not string.find(unitstr, "^0x") and UnitName(unitstr) ~= name then unitstr = nil end
|
||||
|
||||
-- use mobhealth values if addon is running
|
||||
if (MobHealth3 or MobHealthFrame) and target and name == UnitName('target') and MobHealth_GetTargetCurHP() then
|
||||
@@ -1193,13 +1204,11 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
plate:CacheDebuffs(unitstr, verify)
|
||||
end
|
||||
|
||||
-- update all debuff icons
|
||||
-- update all debuff icons - use direct UnitDebuff when unitstr available
|
||||
for i = 1, 16 do
|
||||
local effect, rank, texture, stacks, dtype, duration, timeleft
|
||||
|
||||
if unitstr and C.nameplates.selfdebuff == "1" and libdebuff then
|
||||
effect, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitOwnDebuff(unitstr, i)
|
||||
elseif unitstr and libdebuff then
|
||||
if unitstr and libdebuff then
|
||||
effect, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff(unitstr, i)
|
||||
elseif plate.verify == verify then
|
||||
effect, rank, texture, stacks, dtype, duration, timeleft = plate:UnitDebuff(i)
|
||||
|
||||
Reference in New Issue
Block a user