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
+3
View File
@@ -171,7 +171,10 @@ pfUI:RegisterModule("buff", "vanilla:tbc", function ()
pfUI.buff:RegisterEvent("PLAYER_AURAS_CHANGED")
pfUI.buff:RegisterEvent("UNIT_INVENTORY_CHANGED")
pfUI.buff:RegisterEvent("UNIT_MODEL_CHANGED")
pfUI.buff:RegisterEvent("BUFF_UPDATE_DURATION_SELF")
pfUI.buff:RegisterEvent("DEBUFF_UPDATE_DURATION_SELF")
pfUI.buff:SetScript("OnEvent", function()
if C.buffs.weapons == "1" then
local mh, mhtime, mhcharge, oh, ohtime, ohcharge = GetWeaponEnchantInfo()
pfUI.buff.wepbuffs.count = (mh and 1 or 0) + (oh and 1 or 0)
+4 -4
View File
@@ -107,10 +107,10 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
local focusGuid = nil
if this.unitstr and string.find(this.unitstr, "^0x") then
focusGuid = this.unitstr
elseif this.unitstr and this.unitstr == "player" and GetUnitGUID then
focusGuid = GetUnitGUID("player")
elseif this.unitstr and this.unitstr == "player" and UnitGUID then
focusGuid = UnitGUID("player")
elseif this.unitstr and this.unitstr ~= "player" then
local guid = GetUnitGUID(this.unitstr)
local guid = UnitGUID(this.unitstr)
if guid then focusGuid = guid end
end
this.focusGuid = focusGuid
@@ -188,7 +188,7 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
if pfUI.libdebuff_casts or pfUI.libdebuff_item_icons then
local castGuid = nil
if this.unitstr and UnitExists then
local guid = GetUnitGUID(this.unitstr)
local guid = UnitGUID(this.unitstr)
castGuid = guid
end
if castGuid then
+5 -5
View File
@@ -55,7 +55,7 @@ function SlashCmdList.PFFOCUS(msg)
if msg ~= "" then
-- Try to resolve GUID via short target swap
if UnitExists then
local prevGUID = GetUnitGUID("target")
local prevGUID = UnitGUID("target")
local prevPlayer = UnitIsUnit("target", "player")
-- Suppress "Unknown unit" errors during targeting attempts (fired async)
@@ -63,7 +63,7 @@ function SlashCmdList.PFFOCUS(msg)
-- Try exact match first, then prefix match via /tar
TargetByName(msg, true)
local guid = GetUnitGUID("target")
local guid = UnitGUID("target")
if not guid or guid == "0x0000000000000000" then
-- Fallback: prefix match (like /tar storm -> Stormwind Guard)
@@ -98,7 +98,7 @@ function SlashCmdList.PFFOCUS(msg)
else
-- No msg: use current target
if UnitExists then
local guid = GetUnitGUID("target")
local guid = UnitGUID("target")
if guid and guid ~= "0x0000000000000000" then
SetFocusByGUID(guid)
return
@@ -149,11 +149,11 @@ function SlashCmdList.PFCASTFOCUS(msg)
-- For lua functions with GUID: short target swap via GUID
if hasGUID and func then
local currentGUID = GetUnitGUID("target")
local currentGUID = UnitGUID("target")
local isPlayer = UnitIsUnit("target", "player")
TargetUnit(focusGUID)
local newGUID = GetUnitGUID("target")
local newGUID = UnitGUID("target")
if newGUID ~= focusGUID then
-- Could not target focus, restore and fail
+6 -6
View File
@@ -16,15 +16,15 @@ pfUI:RegisterModule("innervatecall", "vanilla", function ()
-- Cache player GUID
local playerGuid = nil
local function GetPlayerGuid()
if not playerGuid and GetUnitGUID then
playerGuid = GetUnitGUID("player")
if not playerGuid and UnitGUID then
playerGuid = UnitGUID("player")
end
return playerGuid
end
-- GUID → name resolution for the target
local function ResolveTargetName(targetGuid)
if not targetGuid or not GetUnitGUID then return nil end
if not targetGuid or not UnitGUID then return nil end
-- Check player self-cast
if GetPlayerGuid() == targetGuid then
@@ -32,7 +32,7 @@ pfUI:RegisterModule("innervatecall", "vanilla", function ()
end
-- Check current target (most common case for other-cast)
local curGuid = GetUnitGUID("target")
local curGuid = UnitGUID("target")
if curGuid == targetGuid then
return UnitName("target")
end
@@ -40,13 +40,13 @@ pfUI:RegisterModule("innervatecall", "vanilla", function ()
-- Scan raid/party for GUID match
for i = 1, GetNumRaidMembers() do
local unit = "raid" .. i
if GetUnitGUID(unit) == targetGuid then
if UnitGUID(unit) == targetGuid then
return UnitName(unit)
end
end
for i = 1, GetNumPartyMembers() do
local unit = "party" .. i
if GetUnitGUID(unit) == targetGuid then
if UnitGUID(unit) == targetGuid then
return UnitName(unit)
end
end
+9 -9
View File
@@ -105,7 +105,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
local wipe = wipe or function(t) for k in pairs(t) do t[k] = nil end end
-- Player GUID for filtering
local PlayerGUID = GetUnitGUID("player")
local PlayerGUID = UnitGUID("player")
-- ============================================================================
-- OPTIMIZATION: Config caching
@@ -184,14 +184,14 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
local function RebuildRaidGuidCache()
for k in pairs(raidGuidCache) do raidGuidCache[k] = nil end
for i = 1, GetNumRaidMembers() do
local g = GetUnitGUID("raid"..i)
local g = UnitGUID("raid"..i)
if g then raidGuidCache[g] = UnitName("raid"..i) end
end
for i = 1, GetNumPartyMembers() do
local g = GetUnitGUID("party"..i)
local g = UnitGUID("party"..i)
if g then raidGuidCache[g] = UnitName("party"..i) end
end
local pg = GetUnitGUID("player")
local pg = UnitGUID("player")
if pg then raidGuidCache[pg] = UnitName("player") end
end
@@ -409,7 +409,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
end
-- Use IterDebuffs if Nampower available, else fall back to slot loop
if unitstr and libdebuff.IterDebuffs and GetUnitGUID then
if unitstr and libdebuff.IterDebuffs and UnitGUID then
local id = 0
libdebuff:IterDebuffs(unitstr, function(auraSlot, spellId, effect, texture, stacks, dtype, duration, timeleft)
if not effect or not texture then return end
@@ -661,7 +661,7 @@ end
elseif event == "PLAYER_TARGET_CHANGED" then
-- Flag target plate for update via GUID registry
local targetGuid = GetUnitGUID("target")
local targetGuid = UnitGUID("target")
if targetGuid then
local plate = guidRegistry[targetGuid]
if plate and plate.nameplate then
@@ -673,7 +673,7 @@ end
elseif event == "PLAYER_COMBO_POINTS" or event == "UNIT_COMBO_POINTS" then
-- Only flag the target plate for combo point update
local targetGuid = GetUnitGUID("target")
local targetGuid = UnitGUID("target")
if targetGuid then
local plate = guidRegistry[targetGuid]
if plate and plate.nameplate then
@@ -1328,7 +1328,7 @@ end
-- debuffDisplayBuf is a module-level reusable buffer (no GC churn)
local debuffCount = 0
for i = 1, 16 do debuffDisplayBuf[i].effect = nil end -- clear previous
if unitstr and libdebuff and libdebuff.IterDebuffs and GetUnitGUID then
if unitstr and libdebuff and libdebuff.IterDebuffs and UnitGUID then
_iterDebuffCount = 0
libdebuff:IterDebuffs(unitstr, iterDebuffCallback)
@@ -1845,7 +1845,7 @@ end
if (this.tick or 0) > now then return end
this.tick = now + throttle
local targetGuid = UnitExists("target") and GetUnitGUID("target")
local targetGuid = UnitExists("target") and UnitGUID("target")
if not targetGuid then return end
local frame = guidRegistry[targetGuid]
+1 -1
View File
@@ -594,7 +594,7 @@ pfUI:RegisterModule("nampower", "vanilla", function ()
-- Get base mana using Nampower's GetUnitField
local baseMana, baseMaxMana
local guid = GetUnitGUID(unit)
local guid = UnitGUID(unit)
if guid then
baseMana = GetUnitField(guid, "power1")
+1 -1
View File
@@ -135,7 +135,7 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
local frame = pfUI.uf.raid[i]
if frame and frame.id and frame.id > 0 then
local unit = "raid" .. frame.id
local newGuid = GetUnitGUID(unit)
local newGuid = UnitGUID(unit)
local oldGuid = tracker.frameToGuid[frame]
if newGuid ~= oldGuid then
+1 -1
View File
@@ -256,7 +256,7 @@ pfUI:RegisterModule("superwow", "vanilla", function ()
if event == "PLAYER_ENTERING_WORLD" then
-- Cache player GUID
if UnitExists then
local guid = GetUnitGUID("player")
local guid = UnitGUID("player")
playerGuid = guid
end
return
+1 -1
View File
@@ -870,7 +870,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
local _, class = UnitClass("player")
S.isWarrior = (class == "WARRIOR")
S.isDruid = (class == "DRUID")
S.playerGUID = GetUnitGUID("player")
S.playerGUID = UnitGUID("player")
UpdateWeaponSpeeds()
RebuildQueueSlotCache()