refresh buff durations on player

This commit is contained in:
Brues
2026-05-21 02:35:46 -05:00
parent b7a0912e07
commit b18e6ffa67
16 changed files with 128 additions and 76 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ pfGetChannelInfo = function(unit)
guid = unit -- unit IS the GUID
elseif pfValidUnits[unit] and UnitExists then
-- unit is a token like "target" - get GUID from it
local unitGuid = GetUnitGUID(unit)
local unitGuid = UnitGUID(unit)
guid = unitGuid
end
@@ -158,7 +158,7 @@ pfGetCastInfo = function(unit)
guid = unit -- unit IS the GUID
elseif pfValidUnits[unit] and UnitExists then
-- unit is a token like "target" - get GUID from it
local unitGuid = GetUnitGUID(unit)
local unitGuid = UnitGUID(unit)
guid = unitGuid
end
+21 -21
View File
@@ -37,7 +37,7 @@ local hasNampower = false
if GetNampowerVersion then
local major, minor, patch = GetNampowerVersion()
patch = patch or 0
-- Minimum required version: 3.0.0 (GetUnitGUID support)
-- Minimum required version: 3.0.0 (UnitGUID support)
if major > 3 or (major == 3 and minor > 0) or (major == 3 and minor == 0 and patch >= 0) then
hasNampower = true
end
@@ -319,8 +319,8 @@ end
-- Player GUID Cache
local playerGUID = nil
local function GetPlayerGUID()
if not playerGUID and GetUnitGUID then
local guid = GetUnitGUID("player")
if not playerGUID and UnitGUID then
local guid = UnitGUID("player")
playerGUID = guid
end
return playerGUID
@@ -348,8 +348,8 @@ end
local function IsCurrentTarget(guid)
if debugStats.trackAllUnits then return true end
if not guid or not GetUnitGUID then return false end
local targetGuid = GetUnitGUID("target")
if not guid or not UnitGUID then return false end
local targetGuid = UnitGUID("target")
return targetGuid == guid
end
@@ -824,8 +824,8 @@ function libdebuff:UnitDebuff(unit, displaySlot)
local dtype = nil
-- Nampower: Use GetUnitField for ALL debuff data (no Blizzard UnitDebuff needed)
if hasNampower and GetUnitGUID then
local guid = GetUnitGUID(unit)
if hasNampower and UnitGUID then
local guid = UnitGUID(unit)
if not guid then
-- Safety fallback: no GUID available (should not happen with Nampower)
local aura = C_UnitAuras.GetDebuffDataByIndex(unit, displaySlot)
@@ -945,8 +945,8 @@ local _ownDebuffSortFunc = function(a, b)
end
function libdebuff:UnitOwnDebuff(unit, id)
if hasNampower and GetUnitGUID then
local guid = GetUnitGUID(unit)
if hasNampower and UnitGUID then
local guid = UnitGUID(unit)
if guid and ownDebuffs[guid] then
-- Build sorted list of our active debuffs
local sortedDebuffs = {}
@@ -1157,8 +1157,8 @@ if hasNampower then
end
-- Trigger UI updates
if pfTarget and GetUnitGUID("target") then
local currentTargetGuid = GetUnitGUID("target")
if pfTarget and UnitGUID("target") then
local currentTargetGuid = UnitGUID("target")
if currentTargetGuid == guid then
pfTarget.update_aura = true
end
@@ -1206,7 +1206,7 @@ if hasNampower then
local castData = myGuid and pfUI.libdebuff_casts[myGuid]
if castData and castData.event == "CHANNEL" and castData.spellName then
local spellName = castData.spellName
local targetGuid = GetUnitGUID and GetUnitGUID("target")
local targetGuid = UnitGUID and UnitGUID("target")
if targetGuid and ownDebuffs[targetGuid] and ownDebuffs[targetGuid][spellName] then
local data = ownDebuffs[targetGuid][spellName]
-- Only clear if the timer is still active (not already expired naturally)
@@ -1685,17 +1685,17 @@ if hasNampower then
-- Notify unitframes of debuff updates (UNIT_AURA doesn't fire on refreshes!)
-- Check player
if GetUnitGUID("player") then
local playerGuid = GetUnitGUID("player")
if UnitGUID("player") then
local playerGuid = UnitGUID("player")
if playerGuid == targetGuid and pfPlayer then
pfPlayer.update_aura = true
end
end
-- Check target
if GetUnitGUID("target") then
local targetUnitGuid = GetUnitGUID("target")
if targetUnitGuid == targetGuid and pfTarget then
if UnitGUID("target") then
local tarUnitGUID = UnitGUID("target")
if tarUnitGUID == targetGuid and pfTarget then
pfTarget.update_aura = true
end
end
@@ -2005,8 +2005,8 @@ if hasNampower then
end
elseif event == "PLAYER_TARGET_CHANGED" then
if not GetUnitGUID then return end
local targetGuid = GetUnitGUID("target")
if not UnitGUID then return end
local targetGuid = UnitGUID("target")
if targetGuid and targetGuid ~= "" then
-- Invalidate slot map cache on retarget
@@ -2068,12 +2068,12 @@ _G.SlashCmdList["LIBDEBUGSTATS"] = function(msg)
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00No manual slot shifting needed!|r")
elseif msg == "target" then
if not GetUnitGUID("target") then
if not UnitGUID("target") then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[libdebuff]|r No target!")
return
end
local guid = GetUnitGUID("target")
local guid = UnitGUID("target")
DEFAULT_CHAT_FRAME:AddMessage("|cff00ffff=== TARGET DEBUFF STATE ===|r")
DEFAULT_CHAT_FRAME:AddMessage(string.format("GUID: %s", tostring(guid)))
+8 -8
View File
@@ -141,7 +141,7 @@ libpredict:SetScript("OnEvent", function()
end
end)
-- GUID->Name cache for dead players (UnitExists/GetUnitGUID return nil for corpses)
-- GUID->Name cache for dead players (UnitExists/UnitGUID return nil for corpses)
local guidNameCache = {} -- [guid] = name
local function resolveNameFromGuid(guid)
@@ -156,18 +156,18 @@ local function cacheRaidNames()
-- Cache all raid/party members while they are still reachable
for i = 1, GetNumRaidMembers() do
local unit = "raid" .. i
local guid = GetUnitGUID(unit)
local guid = UnitGUID(unit)
local name = UnitName(unit)
if guid and name then guidNameCache[guid] = name end
end
for i = 1, GetNumPartyMembers() do
local unit = "party" .. i
local guid = GetUnitGUID(unit)
local guid = UnitGUID(unit)
local name = UnitName(unit)
if guid and name then guidNameCache[guid] = name end
end
-- player self
local pguid = GetUnitGUID("player")
local pguid = UnitGUID("player")
if pguid then guidNameCache[pguid] = UnitName("player") end
end
@@ -302,7 +302,7 @@ pfUI.libdebuff_spell_start_self_hooks["libpredict"] = function(spellId, casterGu
-- Use resolvedTargetGuid (prefers pendingTargetGuid from mouseover/click-to-cast) so we
-- don't wrongly fall back to player when healing a friend via mouseover with a foe in target.
local healTarget = target
local unitTargetGuid = GetUnitGUID and GetUnitGUID("target")
local unitTargetGuid = UnitGUID and UnitGUID("target")
local healTargetIsHostile = resolvedTargetGuid and unitTargetGuid
and resolvedTargetGuid == unitTargetGuid
and UnitExists("target")
@@ -618,7 +618,7 @@ function libpredict:ParseChatMessage(sender, msg, comm)
for i = 1, GetNumRaidMembers() do
local unit = "raid" .. i
if UnitName(unit) == sender then
senderGuid = GetUnitGUID(unit)
senderGuid = UnitGUID(unit)
break
end
end
@@ -626,7 +626,7 @@ function libpredict:ParseChatMessage(sender, msg, comm)
for i = 1, GetNumPartyMembers() do
local unit = "party" .. i
if UnitName(unit) == sender then
senderGuid = GetUnitGUID(unit)
senderGuid = UnitGUID(unit)
break
end
end
@@ -1283,7 +1283,7 @@ function libpredict:GetHotDuration(unit, spell)
-- NEW: Try libdebuff first (Nampower AURA_CAST events)
if pfUI.api.libdebuff and pfUI.api.libdebuff.GetBestAuraCast then
local guid = GetUnitGUID(unit)
local guid = UnitGUID(unit)
if guid then
-- Get the best (highest rank) aura cast for this spell
local spellName = spell