mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-05 21:20:00 +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:
@@ -1007,7 +1007,7 @@ pfUI:RegisterModule("actionbar", "vanilla", function ()
|
||||
-- Prowl Spell IDs: 5215 (Rank 1), 6783 (Rank 2), 9913 (Rank 3)
|
||||
if event == "UNIT_CASTEVENT" then
|
||||
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 spellId == 5215 or spellId == 6783 or spellId == 9913 then
|
||||
-- Prowl cast detected
|
||||
|
||||
+4
-4
@@ -8,8 +8,8 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
-- Helper function for castbar timer formatting
|
||||
local function FormatCastbarTime(value)
|
||||
if C.unitframes.castbardecimals == "1" then
|
||||
-- 1 decimal, always floor
|
||||
return string.format("%.1f", floor(value * 10) / 10)
|
||||
-- 1 decimal, round half up (matches Blizzard spellbook display)
|
||||
return string.format("%.1f", floor(value * 10 + 0.5) / 10)
|
||||
else
|
||||
-- 2 decimals (default)
|
||||
return string.format("%.2f", value)
|
||||
@@ -108,7 +108,7 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
if this.unitstr and string.find(this.unitstr, "^0x") then
|
||||
focusGuid = this.unitstr
|
||||
elseif this.unitstr and this.unitstr ~= "player" then
|
||||
local _, guid = UnitExists(this.unitstr)
|
||||
local guid = GetUnitGUID(this.unitstr)
|
||||
if guid then focusGuid = guid end
|
||||
end
|
||||
|
||||
@@ -176,7 +176,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 = UnitExists(this.unitstr)
|
||||
local guid = GetUnitGUID(this.unitstr)
|
||||
castGuid = guid
|
||||
end
|
||||
if castGuid then
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@ function SlashCmdList.PFFOCUS(msg)
|
||||
if msg ~= "" then
|
||||
-- Try to resolve GUID via short target swap
|
||||
if UnitExists then
|
||||
local _, prevGUID = UnitExists("target")
|
||||
local prevGUID = GetUnitGUID("target")
|
||||
local prevPlayer = UnitIsUnit("target", "player")
|
||||
|
||||
-- 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
|
||||
TargetByName(msg, true)
|
||||
local _, guid = UnitExists("target")
|
||||
local guid = GetUnitGUID("target")
|
||||
|
||||
if not guid or guid == "0x0000000000000000" then
|
||||
-- Fallback: prefix match (like /tar storm -> Stormwind Guard)
|
||||
@@ -94,7 +94,7 @@ function SlashCmdList.PFFOCUS(msg)
|
||||
else
|
||||
-- No msg: use current target
|
||||
if UnitExists then
|
||||
local _, guid = UnitExists("target")
|
||||
local guid = GetUnitGUID("target")
|
||||
if guid and guid ~= "0x0000000000000000" then
|
||||
SetFocusByGUID(guid)
|
||||
return
|
||||
@@ -143,11 +143,11 @@ function SlashCmdList.PFCASTFOCUS(msg)
|
||||
|
||||
-- For lua functions with GUID: short target swap via GUID
|
||||
if hasGUID and func then
|
||||
local _, currentGUID = UnitExists("target")
|
||||
local currentGUID = GetUnitGUID("target")
|
||||
local isPlayer = UnitIsUnit("target", "player")
|
||||
|
||||
TargetUnit(focusGUID)
|
||||
local _, newGUID = UnitExists("target")
|
||||
local newGUID = GetUnitGUID("target")
|
||||
|
||||
if newGUID ~= focusGUID then
|
||||
-- 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
|
||||
|
||||
-- Player GUID for filtering
|
||||
local _, PlayerGUID = UnitExists("player")
|
||||
local PlayerGUID = GetUnitGUID("player")
|
||||
|
||||
-- ============================================================================
|
||||
-- OPTIMIZATION: Config caching
|
||||
@@ -549,7 +549,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
|
||||
elseif event == "PLAYER_TARGET_CHANGED" then
|
||||
-- Flag target plate for update via GUID registry
|
||||
local _, targetGuid = UnitExists("target")
|
||||
local targetGuid = GetUnitGUID("target")
|
||||
if targetGuid then
|
||||
local plate = guidRegistry[targetGuid]
|
||||
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
|
||||
-- Only flag the target plate for combo point update
|
||||
local _, targetGuid = UnitExists("target")
|
||||
local targetGuid = GetUnitGUID("target")
|
||||
if targetGuid then
|
||||
local plate = guidRegistry[targetGuid]
|
||||
if plate and plate.nameplate then
|
||||
@@ -1504,7 +1504,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
if isTargetPlate then
|
||||
targetGUID = state and state.targetGuid
|
||||
if not targetGUID then
|
||||
local _, guid = UnitExists("target")
|
||||
local guid = GetUnitGUID("target")
|
||||
targetGUID = guid
|
||||
end
|
||||
end
|
||||
@@ -1571,7 +1571,7 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
||||
end
|
||||
elseif unitstr then
|
||||
local _, guid = UnitExists(unitstr)
|
||||
local guid = GetUnitGUID(unitstr)
|
||||
local q = guid or unitstr
|
||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(q)
|
||||
if not cast then
|
||||
|
||||
@@ -591,7 +591,7 @@ pfUI:RegisterModule("nampower", "vanilla", function ()
|
||||
|
||||
-- Get base mana using Nampower's GetUnitField
|
||||
local baseMana, baseMaxMana
|
||||
local _, guid = UnitExists(unit)
|
||||
local guid = GetUnitGUID(unit)
|
||||
|
||||
if guid then
|
||||
baseMana = GetUnitField(guid, "power1")
|
||||
|
||||
+1
-1
@@ -121,7 +121,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 = UnitExists(unit)
|
||||
local newGuid = GetUnitGUID(unit)
|
||||
local oldGuid = tracker.frameToGuid[frame]
|
||||
|
||||
if newGuid ~= oldGuid then
|
||||
|
||||
@@ -266,7 +266,7 @@ pfUI:RegisterModule("superwow", "vanilla", function ()
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
-- Cache player GUID
|
||||
if UnitExists then
|
||||
local _, guid = UnitExists("player")
|
||||
local guid = GetUnitGUID("player")
|
||||
playerGuid = guid
|
||||
end
|
||||
return
|
||||
|
||||
@@ -575,7 +575,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||
local _, class = UnitClass("player")
|
||||
isWarrior = (class == "WARRIOR")
|
||||
local _, guid = UnitExists("player")
|
||||
local guid = GetUnitGUID("player")
|
||||
playerGUID = guid
|
||||
UpdateWeaponSpeeds()
|
||||
RebuildQueueSlotCache()
|
||||
|
||||
Reference in New Issue
Block a user