diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index c0515dfa..acb4273a 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -312,16 +312,6 @@ local function GetComboPointData(spellName) return nil, nil end --- Player GUID Cache -local playerGUID = nil -local function GetPlayerGUID() - if not playerGUID and UnitGUID then - local guid = UnitGUID("player") - playerGUID = guid - end - return playerGUID -end - -- Debug Stats pfUI.libdebuff_debugstats = pfUI.libdebuff_debugstats or { enabled = false, @@ -461,7 +451,7 @@ local function GetSlotCaster(guid, auraSlot, spellName) end -- Fallback: Check ownDebuffs - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() if ownDebuffs[guid] and ownDebuffs[guid][spellName] then return myGuid, true end @@ -798,7 +788,7 @@ function libdebuff:GetBestAuraCast(guid, spellName) local data = ownDebuffs[guid][spellName] local timeleft = (data.startTime + data.duration) - GetTime() if timeleft > 0 then - return data.startTime, data.duration, timeleft, data.rank, GetPlayerGUID() + return data.startTime, data.duration, timeleft, data.rank, GetPlayerGuid() end end @@ -834,7 +824,7 @@ function libdebuff:GetEnhancedDebuffs(targetGUID) local result = {} if ownDebuffs[targetGUID] then - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() for spellName, data in pairs(ownDebuffs[targetGUID]) do local timeleft = (data.startTime + data.duration) - GetTime() if timeleft > 0 then @@ -883,7 +873,7 @@ if hasNampower then -- Carnage triggered! Refresh Rip & Rake local guid = carnageState.targetGuid local refreshTime = GetTime() - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() -- Refresh in ownDebuffs - only if timer still active if ownDebuffs[guid] then @@ -976,14 +966,8 @@ if hasNampower then end end end - - elseif event == "PLAYER_ENTERING_WORLD" then - GetPlayerGUID() + elseif event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_TALENT_UPDATE" then UpdateCarnageRank() - - elseif event == "PLAYER_TALENT_UPDATE" then - UpdateCarnageRank() - elseif event == "UNIT_HEALTH" then local guid = arg1 if guid and UnitIsDead and UnitIsDead(guid) then @@ -1078,7 +1062,7 @@ if hasNampower then local selfdebuffMode = pfUI_config and pfUI_config.buffbar and pfUI_config.buffbar.tdebuff and pfUI_config.buffbar.tdebuff.selfdebuff == "1" if selfdebuffMode then - local myGuid2 = GetPlayerGUID() + local myGuid2 = GetPlayerGuid() if casterGuid == myGuid2 then local duration = libdebuff:GetDuration(spellName, castRank) or 0 if duration > 0 then @@ -1108,7 +1092,7 @@ if hasNampower then end -- Store rank for our casts - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() if casterGuid == myGuid then lastCastRanks[spellName] = { rank = castRank, @@ -1233,7 +1217,7 @@ if hasNampower then local duration = durationMs and (durationMs / 1000) or 0 local startTime = GetTime() - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() local isOurs = (myGuid and casterGuid == myGuid) if debugStats.enabled and isOurs then @@ -1365,15 +1349,12 @@ if hasNampower then -- Notify unitframes of debuff updates (UNIT_AURA doesn't fire on refreshes!) -- Check player - if UnitGUID("player") then - local playerGuid = UnitGUID("player") - if playerGuid == targetGuid and pfPlayer then - pfPlayer.update_aura = true - end + if IsPlayerGuid(targetGuid) and pfPlayer then + pfPlayer.update_aura = true end -- Check target - if UnitGUID("target") then + if UnitExists("target") then local tarUnitGUID = UnitGUID("target") if tarUnitGUID == targetGuid and pfTarget then pfTarget.update_aura = true @@ -1520,7 +1501,7 @@ if hasNampower then end end - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() local isOurs = (myGuid and casterGuid == myGuid) -- Fallback: Check ownDebuffs timing @@ -1555,7 +1536,7 @@ if hasNampower then -- CRITICAL FIX: Update ownDebuffs here too for refresh timing! -- This prevents the gap between DEBUFF_REMOVED and AURA_CAST where buffwatch shows nothing if isOurs and casterGuid then - local myGuid = GetPlayerGUID() + local myGuid = GetPlayerGuid() if myGuid and casterGuid == myGuid then -- Check if we have timer data from allAuraCasts if allAuraCasts[guid] and allAuraCasts[guid][spellName] and allAuraCasts[guid][spellName][casterGuid] then diff --git a/modules/innervatecall.lua b/modules/innervatecall.lua index 4ae3ebd0..e9163ce7 100644 --- a/modules/innervatecall.lua +++ b/modules/innervatecall.lua @@ -13,15 +13,6 @@ pfUI:RegisterModule("innervatecall", function () local INNERVATE_SPELLID = 29166 - -- Cache player GUID - local playerGuid = nil - local function GetPlayerGuid() - if not playerGuid and UnitGUID then - playerGuid = UnitGUID("player") - end - return playerGuid - end - -- GUID → name resolution for the target. UnitTokenFromGUID walks the -- engine's known unit tokens (player, party, raid, target, ...) and -- returns the first one currently bound to the GUID, so we don't have @@ -75,7 +66,7 @@ pfUI:RegisterModule("innervatecall", function () if spellId ~= INNERVATE_SPELLID then return end -- Only announce our own casts - if casterGuid ~= GetPlayerGuid() then return end + if not IsPlayerGuid(casterGuid) then return end -- Resolve target name from GUID local targetName = ResolveTargetName(targetGuid) or "Unknown" diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 98f28aea..5b697702 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -100,12 +100,6 @@ pfUI:RegisterModule("nameplates", function () -- PERF: visiblePlateCount maintained event-driven (NAME_PLATE_UNIT_ADDED/_REMOVED) local visiblePlateCount = 0 - -- wipe polyfill - local wipe = wipe or function(t) for k in pairs(t) do t[k] = nil end end - - -- Player GUID for filtering - local PlayerGUID = UnitGUID("player") - -- ============================================================================ -- OPTIMIZATION: Config caching -- ============================================================================ @@ -492,7 +486,6 @@ end elseif event == "PLAYER_ENTERING_WORLD" or event == "ZONE_CHANGED_NEW_AREA" then if event == "PLAYER_ENTERING_WORLD" then - _, PlayerGUID = UnitExists("player") CacheConfig() this:SetGameVariables() RebuildRaidGuidCache() diff --git a/modules/swingtimer.lua b/modules/swingtimer.lua index f27eb8e2..23c016dd 100644 --- a/modules/swingtimer.lua +++ b/modules/swingtimer.lua @@ -32,7 +32,6 @@ pfUI:RegisterModule("swingtimer", function () isDruid = false, cachedHSSlots = {}, cachedCleaveSlots = {}, useSpellQueueEvent = false, - playerGUID = nil, swingThrottle = 0, onSwingCache = {}, } @@ -832,8 +831,7 @@ pfUI:RegisterModule("swingtimer", function () elseif event == "AUTO_ATTACK_OTHER" then -- Parry haste: enemy attacked the player and player parried local targetGuid = arg2 - if not targetGuid or not S.playerGUID then return end - if targetGuid ~= S.playerGUID then return end + if not targetGuid or not IsPlayerGuid(targetGuid) then return end local victimState = arg5 or 0 -- VICTIMSTATE_PARRY = 3 -- Vanilla: parry reduces the NEXT swing timer by 40% of weapon speed, @@ -880,7 +878,6 @@ pfUI:RegisterModule("swingtimer", function () local _, class = UnitClass("player") S.isWarrior = (class == "WARRIOR") S.isDruid = (class == "DRUID") - S.playerGUID = UnitGUID("player") UpdateWeaponSpeeds() RebuildQueueSlotCache() @@ -910,7 +907,7 @@ pfUI:RegisterModule("swingtimer", function () S.maulQueued = false elseif event == "UNIT_DIED" then - if arg1 and arg1 == S.playerGUID then + if IsPlayerGuid(arg1) then ResetAll() end end