mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-24 21:10:49 +00:00
GUID replacements
* Replace all `local _, guid = UnitExists(unit)` with `GetUnitGUID(unit)` (Nampower 3.0.0+) * Bump minimum required Nampower version to 3.0.0
This commit is contained in:
+4
-4
@@ -247,7 +247,7 @@ end)
|
|||||||
-- GetUnitStats - Nampower Integration for Health + Power
|
-- GetUnitStats - Nampower Integration for Health + Power
|
||||||
-- Returns: hp, maxHp, power, maxPower, powerType
|
-- Returns: hp, maxHp, power, maxPower, powerType
|
||||||
-- IMPORTANT: Uses _G.UnitExists directly to avoid conflicts with Nampower's
|
-- IMPORTANT: Uses _G.UnitExists directly to avoid conflicts with Nampower's
|
||||||
-- extended UnitExists that returns (exists, guid)
|
-- use GetUnitGUID(unit) for GUID lookup (Nampower 3.0.0+)
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
-- Cache für Stats-Tracking (nur Änderungen zählen)
|
-- Cache für Stats-Tracking (nur Änderungen zählen)
|
||||||
@@ -1168,7 +1168,7 @@ function pfUI.uf.OnEvent()
|
|||||||
-- Smart update: check if THIS frame's unit actually changed
|
-- Smart update: check if THIS frame's unit actually changed
|
||||||
if pfUI.uf.guidTracker and this.id then
|
if pfUI.uf.guidTracker and this.id then
|
||||||
local unit = this.label == "player" and "player" or (this.label .. this.id)
|
local unit = this.label == "player" and "player" or (this.label .. this.id)
|
||||||
local _, newGuid = UnitExists(unit)
|
local newGuid = GetUnitGUID(unit)
|
||||||
local oldGuid = pfUI.uf.guidTracker.frameToGuid[this]
|
local oldGuid = pfUI.uf.guidTracker.frameToGuid[this]
|
||||||
if newGuid ~= oldGuid then
|
if newGuid ~= oldGuid then
|
||||||
pfUI.uf.guidTracker.frameToGuid[this] = newGuid
|
pfUI.uf.guidTracker.frameToGuid[this] = newGuid
|
||||||
@@ -1455,7 +1455,7 @@ function pfUI.uf.OnUpdate()
|
|||||||
-- O(1) Nampower lookup via GUID (same pattern as nameplates.lua)
|
-- O(1) Nampower lookup via GUID (same pattern as nameplates.lua)
|
||||||
local health, maxHealth
|
local health, maxHealth
|
||||||
if GetUnitField then
|
if GetUnitField then
|
||||||
local _, guid = UnitExists(unit)
|
local guid = GetUnitGUID(unit)
|
||||||
if guid then
|
if guid then
|
||||||
health = GetUnitField(guid, "health")
|
health = GetUnitField(guid, "health")
|
||||||
maxHealth = GetUnitField(guid, "maxHealth")
|
maxHealth = GetUnitField(guid, "maxHealth")
|
||||||
@@ -3288,7 +3288,7 @@ function pfUI.uf.GetColor(self, preset)
|
|||||||
-- O(1) Nampower lookup for health gradient color
|
-- O(1) Nampower lookup for health gradient color
|
||||||
local hp, hpmax
|
local hp, hpmax
|
||||||
if GetUnitField then
|
if GetUnitField then
|
||||||
local _, guid = UnitExists(unitstr)
|
local guid = GetUnitGUID(unitstr)
|
||||||
if guid then
|
if guid then
|
||||||
hp = GetUnitField(guid, "health")
|
hp = GetUnitField(guid, "health")
|
||||||
hpmax = GetUnitField(guid, "maxHealth")
|
hpmax = GetUnitField(guid, "maxHealth")
|
||||||
|
|||||||
+2
-2
@@ -68,7 +68,7 @@ UnitChannelInfo = function(unit)
|
|||||||
guid = unit -- unit IS the GUID
|
guid = unit -- unit IS the GUID
|
||||||
elseif pfValidUnits[unit] and UnitExists then
|
elseif pfValidUnits[unit] and UnitExists then
|
||||||
-- unit is a token like "target" - get GUID from it
|
-- unit is a token like "target" - get GUID from it
|
||||||
local _, unitGuid = UnitExists(unit)
|
local unitGuid = GetUnitGUID(unit)
|
||||||
guid = unitGuid
|
guid = unitGuid
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ UnitCastingInfo = function(unit)
|
|||||||
guid = unit -- unit IS the GUID
|
guid = unit -- unit IS the GUID
|
||||||
elseif pfValidUnits[unit] and UnitExists then
|
elseif pfValidUnits[unit] and UnitExists then
|
||||||
-- unit is a token like "target" - get GUID from it
|
-- unit is a token like "target" - get GUID from it
|
||||||
local _, unitGuid = UnitExists(unit)
|
local unitGuid = GetUnitGUID(unit)
|
||||||
guid = unitGuid
|
guid = unitGuid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
+23
-23
@@ -38,7 +38,7 @@ local hasNampower = false
|
|||||||
if GetNampowerVersion then
|
if GetNampowerVersion then
|
||||||
local major, minor, patch = GetNampowerVersion()
|
local major, minor, patch = GetNampowerVersion()
|
||||||
patch = patch or 0
|
patch = patch or 0
|
||||||
-- Minimum required version: 2.41.0 (CastSpellByName unitStr support, SetMouseoverUnit)
|
-- Minimum required version: 3.0.0 (GetUnitGUID support)
|
||||||
if major > 2 or (major == 2 and minor > 41) or (major == 2 and minor == 41 and patch >= 0) then
|
if major > 2 or (major == 2 and minor > 41) or (major == 2 and minor == 41 and patch >= 0) then
|
||||||
hasNampower = true
|
hasNampower = true
|
||||||
end
|
end
|
||||||
@@ -101,7 +101,7 @@ nampowerCheckFrame:SetScript("OnEvent", function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[libdebuff] Debuff tracking disabled! Please update Nampower to v2.41.0 or higher.|r")
|
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[libdebuff] Debuff tracking disabled! Please update Nampower to v3.0.0 or higher.|r")
|
||||||
StaticPopup_Show("LIBDEBUFF_NAMPOWER_UPDATE", versionString)
|
StaticPopup_Show("LIBDEBUFF_NAMPOWER_UPDATE", versionString)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -217,7 +217,7 @@ pfUI.libpredict_pending_cast = pfUI.libpredict_pending_cast or {}
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
StaticPopupDialogs["LIBDEBUFF_NAMPOWER_UPDATE"] = {
|
StaticPopupDialogs["LIBDEBUFF_NAMPOWER_UPDATE"] = {
|
||||||
text = "|cffff0000!!!WARNING!!!|r\n\nNampower Update Required!\n\nYour current version: %s\nRequired version: 2.41.0+\n\nPlease update Nampower to continue using pfUI!",
|
text = "|cffff0000!!!WARNING!!!|r\n\nNampower Update Required!\n\nYour current version: %s\nRequired version: 3.0.0+\n\nPlease update Nampower to continue using pfUI!",
|
||||||
button1 = "Show Download",
|
button1 = "Show Download",
|
||||||
button2 = "Dismiss",
|
button2 = "Dismiss",
|
||||||
timeout = 0,
|
timeout = 0,
|
||||||
@@ -225,12 +225,12 @@ StaticPopupDialogs["LIBDEBUFF_NAMPOWER_UPDATE"] = {
|
|||||||
hideOnEscape = 0,
|
hideOnEscape = 0,
|
||||||
preferredIndex = 3,
|
preferredIndex = 3,
|
||||||
OnAccept = function()
|
OnAccept = function()
|
||||||
pfUI.chat.urlcopy.CopyText("https://gitea.com/avitasia/nampower/releases/tag/v2.41.0")
|
pfUI.chat.urlcopy.CopyText("https://gitea.com/avitasia/nampower/releases/tag/v3.0.0")
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticPopupDialogs["LIBDEBUFF_NAMPOWER_MISSING"] = {
|
StaticPopupDialogs["LIBDEBUFF_NAMPOWER_MISSING"] = {
|
||||||
text = "|cffff0000!!!WARNING!!!|r\n\nNampower Not Found!\n\nNampower 2.41.0+ is required for pfUI to function correctly.\n\nPlease install Nampower!",
|
text = "|cffff0000!!!WARNING!!!|r\n\nNampower Not Found!\n\nNampower 3.0.0+ is required for pfUI to function correctly.\n\nPlease install Nampower!",
|
||||||
button1 = "Show Download",
|
button1 = "Show Download",
|
||||||
button2 = "Dismiss",
|
button2 = "Dismiss",
|
||||||
timeout = 0,
|
timeout = 0,
|
||||||
@@ -315,8 +315,8 @@ end
|
|||||||
-- Player GUID Cache
|
-- Player GUID Cache
|
||||||
local playerGUID = nil
|
local playerGUID = nil
|
||||||
local function GetPlayerGUID()
|
local function GetPlayerGUID()
|
||||||
if not playerGUID and UnitExists then
|
if not playerGUID and GetUnitGUID then
|
||||||
local _, guid = UnitExists("player")
|
local guid = GetUnitGUID("player")
|
||||||
playerGUID = guid
|
playerGUID = guid
|
||||||
end
|
end
|
||||||
return playerGUID
|
return playerGUID
|
||||||
@@ -344,8 +344,8 @@ end
|
|||||||
|
|
||||||
local function IsCurrentTarget(guid)
|
local function IsCurrentTarget(guid)
|
||||||
if debugStats.trackAllUnits then return true end
|
if debugStats.trackAllUnits then return true end
|
||||||
if not guid or not UnitExists then return false end
|
if not guid or not GetUnitGUID then return false end
|
||||||
local _, targetGuid = UnitExists("target")
|
local targetGuid = GetUnitGUID("target")
|
||||||
return targetGuid == guid
|
return targetGuid == guid
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -834,8 +834,8 @@ function libdebuff:UnitDebuff(unit, displaySlot)
|
|||||||
local dtype = nil
|
local dtype = nil
|
||||||
|
|
||||||
-- Nampower: Use GetUnitField for ALL debuff data (no Blizzard UnitDebuff needed)
|
-- Nampower: Use GetUnitField for ALL debuff data (no Blizzard UnitDebuff needed)
|
||||||
if hasNampower and UnitExists then
|
if hasNampower and GetUnitGUID then
|
||||||
local _, guid = UnitExists(unit)
|
local guid = GetUnitGUID(unit)
|
||||||
if not guid then
|
if not guid then
|
||||||
-- Safety fallback: no GUID available (should not happen with Nampower)
|
-- Safety fallback: no GUID available (should not happen with Nampower)
|
||||||
local bTexture, bStacks, bDtype = UnitDebuff(unit, displaySlot)
|
local bTexture, bStacks, bDtype = UnitDebuff(unit, displaySlot)
|
||||||
@@ -957,8 +957,8 @@ local _ownDebuffSortFunc = function(a, b)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function libdebuff:UnitOwnDebuff(unit, id)
|
function libdebuff:UnitOwnDebuff(unit, id)
|
||||||
if hasNampower and UnitExists then
|
if hasNampower and GetUnitGUID then
|
||||||
local _, guid = UnitExists(unit)
|
local guid = GetUnitGUID(unit)
|
||||||
if guid and ownDebuffs[guid] then
|
if guid and ownDebuffs[guid] then
|
||||||
-- Build sorted list of our active debuffs
|
-- Build sorted list of our active debuffs
|
||||||
local sortedDebuffs = {}
|
local sortedDebuffs = {}
|
||||||
@@ -1143,8 +1143,8 @@ if hasNampower then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Trigger UI updates
|
-- Trigger UI updates
|
||||||
if pfTarget and UnitExists("target") then
|
if pfTarget and GetUnitGUID("target") then
|
||||||
local _, currentTargetGuid = UnitExists("target")
|
local currentTargetGuid = GetUnitGUID("target")
|
||||||
if currentTargetGuid == guid then
|
if currentTargetGuid == guid then
|
||||||
pfTarget.update_aura = true
|
pfTarget.update_aura = true
|
||||||
end
|
end
|
||||||
@@ -1586,16 +1586,16 @@ if hasNampower then
|
|||||||
|
|
||||||
-- Notify unitframes of debuff updates (UNIT_AURA doesn't fire on refreshes!)
|
-- Notify unitframes of debuff updates (UNIT_AURA doesn't fire on refreshes!)
|
||||||
-- Check player
|
-- Check player
|
||||||
if UnitExists("player") then
|
if GetUnitGUID("player") then
|
||||||
local _, playerGuid = UnitExists("player")
|
local playerGuid = GetUnitGUID("player")
|
||||||
if playerGuid == targetGuid and pfPlayer then
|
if playerGuid == targetGuid and pfPlayer then
|
||||||
pfPlayer.update_aura = true
|
pfPlayer.update_aura = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check target
|
-- Check target
|
||||||
if UnitExists("target") then
|
if GetUnitGUID("target") then
|
||||||
local _, targetUnitGuid = UnitExists("target")
|
local targetUnitGuid = GetUnitGUID("target")
|
||||||
if targetUnitGuid == targetGuid and pfTarget then
|
if targetUnitGuid == targetGuid and pfTarget then
|
||||||
pfTarget.update_aura = true
|
pfTarget.update_aura = true
|
||||||
end
|
end
|
||||||
@@ -1899,8 +1899,8 @@ if hasNampower then
|
|||||||
end
|
end
|
||||||
|
|
||||||
elseif event == "PLAYER_TARGET_CHANGED" then
|
elseif event == "PLAYER_TARGET_CHANGED" then
|
||||||
if not UnitExists then return end
|
if not GetUnitGUID then return end
|
||||||
local _, targetGuid = UnitExists("target")
|
local targetGuid = GetUnitGUID("target")
|
||||||
|
|
||||||
if targetGuid and targetGuid ~= "" then
|
if targetGuid and targetGuid ~= "" then
|
||||||
-- Invalidate slot map cache on retarget
|
-- Invalidate slot map cache on retarget
|
||||||
@@ -1963,12 +1963,12 @@ _G.SlashCmdList["LIBDEBUGSTATS"] = function(msg)
|
|||||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00No manual slot shifting needed!|r")
|
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00No manual slot shifting needed!|r")
|
||||||
|
|
||||||
elseif msg == "target" then
|
elseif msg == "target" then
|
||||||
if not UnitExists("target") then
|
if not GetUnitGUID("target") then
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[libdebuff]|r No target!")
|
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[libdebuff]|r No target!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local _, guid = UnitExists("target")
|
local guid = GetUnitGUID("target")
|
||||||
DEFAULT_CHAT_FRAME:AddMessage("|cff00ffff=== TARGET DEBUFF STATE ===|r")
|
DEFAULT_CHAT_FRAME:AddMessage("|cff00ffff=== TARGET DEBUFF STATE ===|r")
|
||||||
DEFAULT_CHAT_FRAME:AddMessage(string.format("GUID: %s", tostring(guid)))
|
DEFAULT_CHAT_FRAME:AddMessage(string.format("GUID: %s", tostring(guid)))
|
||||||
|
|
||||||
|
|||||||
+15
-23
@@ -140,39 +140,33 @@ libpredict:SetScript("OnEvent", function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- GUID->Name cache for dead players (UnitExists returns nil for corpses)
|
-- GUID->Name cache for dead players (UnitExists/GetUnitGUID return nil for corpses)
|
||||||
local guidNameCache = {} -- [guid] = name
|
local guidNameCache = {} -- [guid] = name
|
||||||
|
|
||||||
local function resolveNameFromGuid(guid)
|
local function resolveNameFromGuid(guid)
|
||||||
if not guid then return nil end
|
if not guid then return nil end
|
||||||
if guidNameCache[guid] then return guidNameCache[guid] end
|
if guidNameCache[guid] then return guidNameCache[guid] end
|
||||||
local unit = UnitExists(guid)
|
-- UnitExists(guid) reverse lookup not reliable; cache is primary source
|
||||||
local name = unit and type(unit) == "string" and UnitName(unit) or nil
|
return nil
|
||||||
if name then guidNameCache[guid] = name end
|
|
||||||
return name
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Register with libdebuff hooks
|
-- Register with libdebuff hooks
|
||||||
local function cacheRaidNames()
|
local function cacheRaidNames()
|
||||||
-- Alle Raid/Party Mitglieder cachen solange sie noch auffindbar sind
|
-- Cache all raid/party members while they are still reachable
|
||||||
for i = 1, GetNumRaidMembers() do
|
for i = 1, GetNumRaidMembers() do
|
||||||
local unit = "raid" .. i
|
local unit = "raid" .. i
|
||||||
if UnitExists(unit) then
|
local guid = GetUnitGUID(unit)
|
||||||
local _, guid = UnitExists(unit)
|
local name = UnitName(unit)
|
||||||
local name = UnitName(unit)
|
if guid and name then guidNameCache[guid] = name end
|
||||||
if guid and name then guidNameCache[guid] = name end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
for i = 1, GetNumPartyMembers() do
|
for i = 1, GetNumPartyMembers() do
|
||||||
local unit = "party" .. i
|
local unit = "party" .. i
|
||||||
if UnitExists(unit) then
|
local guid = GetUnitGUID(unit)
|
||||||
local _, guid = UnitExists(unit)
|
local name = UnitName(unit)
|
||||||
local name = UnitName(unit)
|
if guid and name then guidNameCache[guid] = name end
|
||||||
if guid and name then guidNameCache[guid] = name end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- Spieler selbst
|
-- player self
|
||||||
local _, pguid = UnitExists("player")
|
local pguid = GetUnitGUID("player")
|
||||||
if pguid then guidNameCache[pguid] = UnitName("player") end
|
if pguid then guidNameCache[pguid] = UnitName("player") end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -478,8 +472,7 @@ function libpredict:ParseChatMessage(sender, msg, comm)
|
|||||||
for i = 1, GetNumRaidMembers() do
|
for i = 1, GetNumRaidMembers() do
|
||||||
local unit = "raid" .. i
|
local unit = "raid" .. i
|
||||||
if UnitName(unit) == sender then
|
if UnitName(unit) == sender then
|
||||||
local _, guid = UnitExists(unit)
|
senderGuid = GetUnitGUID(unit)
|
||||||
senderGuid = guid
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -487,8 +480,7 @@ function libpredict:ParseChatMessage(sender, msg, comm)
|
|||||||
for i = 1, GetNumPartyMembers() do
|
for i = 1, GetNumPartyMembers() do
|
||||||
local unit = "party" .. i
|
local unit = "party" .. i
|
||||||
if UnitName(unit) == sender then
|
if UnitName(unit) == sender then
|
||||||
local _, guid = UnitExists(unit)
|
senderGuid = GetUnitGUID(unit)
|
||||||
senderGuid = guid
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1173,7 +1165,7 @@ function libpredict:GetHotDuration(unit, spell)
|
|||||||
|
|
||||||
-- NEW: Try libdebuff first (Nampower AURA_CAST events)
|
-- NEW: Try libdebuff first (Nampower AURA_CAST events)
|
||||||
if pfUI.api.libdebuff and pfUI.api.libdebuff.GetBestAuraCast then
|
if pfUI.api.libdebuff and pfUI.api.libdebuff.GetBestAuraCast then
|
||||||
local _, guid = UnitExists(unit) -- FIX: Get GUID, not exists boolean!
|
local guid = GetUnitGUID(unit)
|
||||||
if guid then
|
if guid then
|
||||||
-- Get the best (highest rank) aura cast for this spell
|
-- Get the best (highest rank) aura cast for this spell
|
||||||
local spellName = spell
|
local spellName = spell
|
||||||
|
|||||||
@@ -1007,7 +1007,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
|||||||
-- Prowl Spell IDs: 5215 (Rank 1), 6783 (Rank 2), 9913 (Rank 3)
|
-- Prowl Spell IDs: 5215 (Rank 1), 6783 (Rank 2), 9913 (Rank 3)
|
||||||
if event == "UNIT_CASTEVENT" then
|
if event == "UNIT_CASTEVENT" then
|
||||||
local guid, target, cEvent, spellId = arg1, arg2, arg3, arg4
|
local guid, target, cEvent, spellId = arg1, arg2, arg3, arg4
|
||||||
local _, playerGuid = UnitExists("player")
|
local playerGuid = GetUnitGUID("player")
|
||||||
if guid == playerGuid and cEvent == "CAST" then
|
if guid == playerGuid and cEvent == "CAST" then
|
||||||
if spellId == 5215 or spellId == 6783 or spellId == 9913 then
|
if spellId == 5215 or spellId == 6783 or spellId == 9913 then
|
||||||
-- Prowl cast detected
|
-- Prowl cast detected
|
||||||
|
|||||||
+4
-4
@@ -8,8 +8,8 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
|||||||
-- Helper function for castbar timer formatting
|
-- Helper function for castbar timer formatting
|
||||||
local function FormatCastbarTime(value)
|
local function FormatCastbarTime(value)
|
||||||
if C.unitframes.castbardecimals == "1" then
|
if C.unitframes.castbardecimals == "1" then
|
||||||
-- 1 decimal, always floor
|
-- 1 decimal, round half up (matches Blizzard spellbook display)
|
||||||
return string.format("%.1f", floor(value * 10) / 10)
|
return string.format("%.1f", floor(value * 10 + 0.5) / 10)
|
||||||
else
|
else
|
||||||
-- 2 decimals (default)
|
-- 2 decimals (default)
|
||||||
return string.format("%.2f", value)
|
return string.format("%.2f", value)
|
||||||
@@ -108,7 +108,7 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
|||||||
if this.unitstr and string.find(this.unitstr, "^0x") then
|
if this.unitstr and string.find(this.unitstr, "^0x") then
|
||||||
focusGuid = this.unitstr
|
focusGuid = this.unitstr
|
||||||
elseif this.unitstr and this.unitstr ~= "player" then
|
elseif this.unitstr and this.unitstr ~= "player" then
|
||||||
local _, guid = UnitExists(this.unitstr)
|
local guid = GetUnitGUID(this.unitstr)
|
||||||
if guid then focusGuid = guid end
|
if guid then focusGuid = guid end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
|||||||
if pfUI.libdebuff_casts or pfUI.libdebuff_item_icons then
|
if pfUI.libdebuff_casts or pfUI.libdebuff_item_icons then
|
||||||
local castGuid = nil
|
local castGuid = nil
|
||||||
if this.unitstr and UnitExists then
|
if this.unitstr and UnitExists then
|
||||||
local _, guid = UnitExists(this.unitstr)
|
local guid = GetUnitGUID(this.unitstr)
|
||||||
castGuid = guid
|
castGuid = guid
|
||||||
end
|
end
|
||||||
if castGuid then
|
if castGuid then
|
||||||
|
|||||||
+5
-5
@@ -51,7 +51,7 @@ function SlashCmdList.PFFOCUS(msg)
|
|||||||
if msg ~= "" then
|
if msg ~= "" then
|
||||||
-- Try to resolve GUID via short target swap
|
-- Try to resolve GUID via short target swap
|
||||||
if UnitExists then
|
if UnitExists then
|
||||||
local _, prevGUID = UnitExists("target")
|
local prevGUID = GetUnitGUID("target")
|
||||||
local prevPlayer = UnitIsUnit("target", "player")
|
local prevPlayer = UnitIsUnit("target", "player")
|
||||||
|
|
||||||
-- Suppress "Unknown unit" errors during targeting attempts (fired async)
|
-- Suppress "Unknown unit" errors during targeting attempts (fired async)
|
||||||
@@ -59,7 +59,7 @@ function SlashCmdList.PFFOCUS(msg)
|
|||||||
|
|
||||||
-- Try exact match first, then prefix match via /tar
|
-- Try exact match first, then prefix match via /tar
|
||||||
TargetByName(msg, true)
|
TargetByName(msg, true)
|
||||||
local _, guid = UnitExists("target")
|
local guid = GetUnitGUID("target")
|
||||||
|
|
||||||
if not guid or guid == "0x0000000000000000" then
|
if not guid or guid == "0x0000000000000000" then
|
||||||
-- Fallback: prefix match (like /tar storm -> Stormwind Guard)
|
-- Fallback: prefix match (like /tar storm -> Stormwind Guard)
|
||||||
@@ -94,7 +94,7 @@ function SlashCmdList.PFFOCUS(msg)
|
|||||||
else
|
else
|
||||||
-- No msg: use current target
|
-- No msg: use current target
|
||||||
if UnitExists then
|
if UnitExists then
|
||||||
local _, guid = UnitExists("target")
|
local guid = GetUnitGUID("target")
|
||||||
if guid and guid ~= "0x0000000000000000" then
|
if guid and guid ~= "0x0000000000000000" then
|
||||||
SetFocusByGUID(guid)
|
SetFocusByGUID(guid)
|
||||||
return
|
return
|
||||||
@@ -143,11 +143,11 @@ function SlashCmdList.PFCASTFOCUS(msg)
|
|||||||
|
|
||||||
-- For lua functions with GUID: short target swap via GUID
|
-- For lua functions with GUID: short target swap via GUID
|
||||||
if hasGUID and func then
|
if hasGUID and func then
|
||||||
local _, currentGUID = UnitExists("target")
|
local currentGUID = GetUnitGUID("target")
|
||||||
local isPlayer = UnitIsUnit("target", "player")
|
local isPlayer = UnitIsUnit("target", "player")
|
||||||
|
|
||||||
TargetUnit(focusGUID)
|
TargetUnit(focusGUID)
|
||||||
local _, newGUID = UnitExists("target")
|
local newGUID = GetUnitGUID("target")
|
||||||
|
|
||||||
if newGUID ~= focusGUID then
|
if newGUID ~= focusGUID then
|
||||||
-- Could not target focus, restore and fail
|
-- Could not target focus, restore and fail
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
|
|||||||
local wipe = wipe or function(t) for k in pairs(t) do t[k] = nil end end
|
local wipe = wipe or function(t) for k in pairs(t) do t[k] = nil end end
|
||||||
|
|
||||||
-- Player GUID for filtering
|
-- Player GUID for filtering
|
||||||
local _, PlayerGUID = UnitExists("player")
|
local PlayerGUID = GetUnitGUID("player")
|
||||||
|
|
||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
-- OPTIMIZATION: Config caching
|
-- OPTIMIZATION: Config caching
|
||||||
@@ -549,7 +549,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
|
|
||||||
elseif event == "PLAYER_TARGET_CHANGED" then
|
elseif event == "PLAYER_TARGET_CHANGED" then
|
||||||
-- Flag target plate for update via GUID registry
|
-- Flag target plate for update via GUID registry
|
||||||
local _, targetGuid = UnitExists("target")
|
local targetGuid = GetUnitGUID("target")
|
||||||
if targetGuid then
|
if targetGuid then
|
||||||
local plate = guidRegistry[targetGuid]
|
local plate = guidRegistry[targetGuid]
|
||||||
if plate and plate.nameplate then
|
if plate and plate.nameplate then
|
||||||
@@ -561,7 +561,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
|
|
||||||
elseif event == "PLAYER_COMBO_POINTS" or event == "UNIT_COMBO_POINTS" then
|
elseif event == "PLAYER_COMBO_POINTS" or event == "UNIT_COMBO_POINTS" then
|
||||||
-- Only flag the target plate for combo point update
|
-- Only flag the target plate for combo point update
|
||||||
local _, targetGuid = UnitExists("target")
|
local targetGuid = GetUnitGUID("target")
|
||||||
if targetGuid then
|
if targetGuid then
|
||||||
local plate = guidRegistry[targetGuid]
|
local plate = guidRegistry[targetGuid]
|
||||||
if plate and plate.nameplate then
|
if plate and plate.nameplate then
|
||||||
@@ -1504,7 +1504,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
if isTargetPlate then
|
if isTargetPlate then
|
||||||
targetGUID = state and state.targetGuid
|
targetGUID = state and state.targetGuid
|
||||||
if not targetGUID then
|
if not targetGUID then
|
||||||
local _, guid = UnitExists("target")
|
local guid = GetUnitGUID("target")
|
||||||
targetGUID = guid
|
targetGUID = guid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1571,7 +1571,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
||||||
end
|
end
|
||||||
elseif unitstr then
|
elseif unitstr then
|
||||||
local _, guid = UnitExists(unitstr)
|
local guid = GetUnitGUID(unitstr)
|
||||||
local q = guid or unitstr
|
local q = guid or unitstr
|
||||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(q)
|
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(q)
|
||||||
if not cast then
|
if not cast then
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ pfUI:RegisterModule("nampower", "vanilla", function ()
|
|||||||
|
|
||||||
-- Get base mana using Nampower's GetUnitField
|
-- Get base mana using Nampower's GetUnitField
|
||||||
local baseMana, baseMaxMana
|
local baseMana, baseMaxMana
|
||||||
local _, guid = UnitExists(unit)
|
local guid = GetUnitGUID(unit)
|
||||||
|
|
||||||
if guid then
|
if guid then
|
||||||
baseMana = GetUnitField(guid, "power1")
|
baseMana = GetUnitField(guid, "power1")
|
||||||
|
|||||||
+1
-1
@@ -121,7 +121,7 @@ pfUI:RegisterModule("raid", "vanilla:tbc", function ()
|
|||||||
local frame = pfUI.uf.raid[i]
|
local frame = pfUI.uf.raid[i]
|
||||||
if frame and frame.id and frame.id > 0 then
|
if frame and frame.id and frame.id > 0 then
|
||||||
local unit = "raid" .. frame.id
|
local unit = "raid" .. frame.id
|
||||||
local _, newGuid = UnitExists(unit)
|
local newGuid = GetUnitGUID(unit)
|
||||||
local oldGuid = tracker.frameToGuid[frame]
|
local oldGuid = tracker.frameToGuid[frame]
|
||||||
|
|
||||||
if newGuid ~= oldGuid then
|
if newGuid ~= oldGuid then
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ pfUI:RegisterModule("superwow", "vanilla", function ()
|
|||||||
if event == "PLAYER_ENTERING_WORLD" then
|
if event == "PLAYER_ENTERING_WORLD" then
|
||||||
-- Cache player GUID
|
-- Cache player GUID
|
||||||
if UnitExists then
|
if UnitExists then
|
||||||
local _, guid = UnitExists("player")
|
local guid = GetUnitGUID("player")
|
||||||
playerGuid = guid
|
playerGuid = guid
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||||
local _, class = UnitClass("player")
|
local _, class = UnitClass("player")
|
||||||
isWarrior = (class == "WARRIOR")
|
isWarrior = (class == "WARRIOR")
|
||||||
local _, guid = UnitExists("player")
|
local guid = GetUnitGUID("player")
|
||||||
playerGUID = guid
|
playerGUID = guid
|
||||||
UpdateWeaponSpeeds()
|
UpdateWeaponSpeeds()
|
||||||
RebuildQueueSlotCache()
|
RebuildQueueSlotCache()
|
||||||
|
|||||||
Reference in New Issue
Block a user