mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 19:19:59 +00:00
refresh buff durations on player
This commit is contained in:
@@ -97,7 +97,7 @@ Fixed import failures for configs containing double quotes (e.g. clickcast macro
|
||||
* `UnitCastingInfo`/`UnitChannelInfo` SuperWoW fallbacks removed from libcast
|
||||
* `SpellInfo()` (SuperWoW) replaced with `GetSpellRecField()` (Nampower) throughout
|
||||
* `SPELL_HEAL_BY_SELF` CVar (`NP_EnableSpellHealEvents`) now auto-enabled by libdebuff
|
||||
* **`GetUnitGUID()` migration** — replaced all `local _, guid = UnitExists(unit)` with `GetUnitGUID(unit)` across 11 files (Nampower 3.0.0 API)
|
||||
* **`UnitGUID()` migration** — replaced all `local _, guid = UnitExists(unit)` with `UnitGUID(unit)` across 11 files (Nampower 3.0.0 API)
|
||||
* **Player castbar icon fix** — icons for custom Turtle WoW spells (e.g. Swift Travel Form) now correctly resolved via `GetSpellRecField`/`GetSpellIconTexture` instead of falling back to the previous spell's icon
|
||||
* **Castbar timer rounding** — 1-decimal mode now rounds correctly to match the Blizzard spellbook display (e.g. 2798ms → 2.8s instead of 2.7s)
|
||||
* **Nampower warning popup** — updated to be more prominent (`!!!WARNING!!!` in red, non-dismissable via Escape, uses pfUI URL copy frame for download link)
|
||||
|
||||
@@ -977,6 +977,7 @@ function pfUI.api.SkinDropDown(frame, cr, cg, cb, useSmall)
|
||||
end
|
||||
|
||||
function pfUI.api.SkinTab(frame, fixed)
|
||||
if not frame then return end
|
||||
frame:SetHeight(20)
|
||||
StripTextures(frame)
|
||||
CreateBackdrop(frame)
|
||||
|
||||
+54
-10
@@ -215,7 +215,7 @@ end)
|
||||
-- GetUnitStats - Nampower Integration for Health + Power
|
||||
-- Returns: hp, maxHp, power, maxPower, powerType
|
||||
-- IMPORTANT: Uses _G.UnitExists directly to avoid conflicts with Nampower's
|
||||
-- use GetUnitGUID(unit) for GUID lookup (Nampower 3.0.0+)
|
||||
-- use UnitGUID(unit) for GUID lookup (Nampower 3.0.0+)
|
||||
-- ============================================================================
|
||||
|
||||
-- Cache für Stats-Tracking (nur Änderungen zählen)
|
||||
@@ -924,9 +924,7 @@ function pfUI.uf:UpdateConfig()
|
||||
|
||||
CreateBackdrop(f.buffs[i], default_border)
|
||||
|
||||
if f:GetName() == "pfPlayer" then
|
||||
f.buffs[i]:SetScript("OnUpdate", BuffOnUpdate)
|
||||
elseif f:GetName() == "pfTarget" and pfUI.expansion == "tbc" then
|
||||
if f:GetName() == "pfTarget" and pfUI.expansion == "tbc" then
|
||||
f.buffs[i]:SetScript("OnUpdate", TargetBuffOnUpdate)
|
||||
end
|
||||
|
||||
@@ -1034,6 +1032,32 @@ function pfUI.uf.OnShow()
|
||||
pfUI.uf:RefreshUnit(this, "base")
|
||||
end
|
||||
|
||||
-- GUID-keyed aura start-time tracker, fed by Nampower's BUFF_ADDED_OTHER /
|
||||
-- BUFF_REMOVED_OTHER. Non-player units have aura.expirationTime == 0 (server
|
||||
-- doesn't broadcast time), so we reconstruct the swirl from "when we saw it
|
||||
-- applied" + aura.duration (Spell.dbc base). Only auras we actually witnessed
|
||||
-- being cast get tracked — pre-existing auras (already on a unit when you
|
||||
-- target them) intentionally show no timer rather than a fabricated one.
|
||||
pfUI.uf.aura_starts = {} -- {[guid] = {[spellId] = startTime}}
|
||||
|
||||
local auraTracker = CreateFrame("Frame", "pfUF_AuraTracker", UIParent)
|
||||
auraTracker:RegisterEvent("BUFF_ADDED_OTHER")
|
||||
auraTracker:RegisterEvent("BUFF_REMOVED_OTHER")
|
||||
auraTracker:SetScript("OnEvent", function()
|
||||
-- Nampower arg layout: arg1=guid, arg3=spellId. State code 0=added, 1=removed,
|
||||
-- 2=modified; we treat any added/modified as "reset start = now" and let the
|
||||
-- REMOVED event clear the entry.
|
||||
if not arg1 or not arg3 or arg3 == 0 then return end
|
||||
if event == "BUFF_REMOVED_OTHER" then
|
||||
if pfUI.uf.aura_starts[arg1] then
|
||||
pfUI.uf.aura_starts[arg1][arg3] = nil
|
||||
end
|
||||
else
|
||||
pfUI.uf.aura_starts[arg1] = pfUI.uf.aura_starts[arg1] or {}
|
||||
pfUI.uf.aura_starts[arg1][arg3] = GetTime()
|
||||
end
|
||||
end)
|
||||
|
||||
function pfUI.uf.OnEvent()
|
||||
-- Handle shutdown to prevent crash 132
|
||||
if event == "PLAYER_LOGOUT" then
|
||||
@@ -1078,7 +1102,7 @@ function pfUI.uf.OnEvent()
|
||||
-- Smart update: check if THIS frame's unit actually changed
|
||||
if pfUI.uf.guidTracker and this.id then
|
||||
local unit = this.label == "player" and "player" or (this.label .. this.id)
|
||||
local newGuid = GetUnitGUID(unit)
|
||||
local newGuid = UnitGUID(unit)
|
||||
local oldGuid = pfUI.uf.guidTracker.frameToGuid[this]
|
||||
if newGuid ~= oldGuid then
|
||||
pfUI.uf.guidTracker.frameToGuid[this] = newGuid
|
||||
@@ -1107,7 +1131,7 @@ function pfUI.uf.OnEvent()
|
||||
elseif this.label == "pet" and event == "UNIT_HAPPINESS" then
|
||||
this.update_full = true
|
||||
-- UNIT_XXX Events
|
||||
elseif arg1 and (arg1 == this.label .. this.id or (GetUnitGUID and arg1 == GetUnitGUID(this.label .. this.id))) then
|
||||
elseif arg1 and (arg1 == this.label .. this.id or (UnitGUID and arg1 == UnitGUID(this.label .. this.id))) then
|
||||
this.lastEventUpdate = GetTime()
|
||||
|
||||
if event == "UNIT_PORTRAIT_UPDATE" or event == "UNIT_MODEL_CHANGED" then
|
||||
@@ -1365,7 +1389,7 @@ function pfUI.uf.OnUpdate()
|
||||
-- O(1) Nampower lookup via GUID (same pattern as nameplates.lua)
|
||||
local health, maxHealth
|
||||
if GetUnitField then
|
||||
local guid = GetUnitGUID(unit)
|
||||
local guid = UnitGUID(unit)
|
||||
if guid then
|
||||
health = GetUnitField(guid, "health")
|
||||
maxHealth = GetUnitField(guid, "maxHealth")
|
||||
@@ -2037,8 +2061,28 @@ function pfUI.uf:RefreshUnit(unit, component)
|
||||
unit.buffs[i].stacks:SetText("")
|
||||
end
|
||||
|
||||
if aura.expirationTime > 0 and aura.duration > 0 then
|
||||
CooldownFrame_SetTimer(unit.buffs[i].cd, aura.expirationTime - aura.duration, aura.duration, 1)
|
||||
if aura.expirationTime > 0 then
|
||||
-- pfUI's cooldown text falls into a 2^32 wraparound branch when start > GetTime(),
|
||||
-- which happens for talent-extended buffs where the real duration exceeds aura.duration
|
||||
-- (the Spell.dbc base). Anchor start to now in that case to keep the remaining math sane.
|
||||
local now = GetTime()
|
||||
local start = aura.expirationTime - aura.duration
|
||||
local duration = aura.duration
|
||||
if start > now or duration <= 0 then
|
||||
start, duration = now, aura.expirationTime - now
|
||||
end
|
||||
if duration > 0 then
|
||||
CooldownFrame_SetTimer(unit.buffs[i].cd, start, duration, 1)
|
||||
end
|
||||
elseif aura.duration > 0 then
|
||||
local guid = UnitGUID(unitstr)
|
||||
local guidStarts = guid and pfUI.uf.aura_starts[guid]
|
||||
local start = guidStarts and guidStarts[aura.spellId]
|
||||
if start then
|
||||
CooldownFrame_SetTimer(unit.buffs[i].cd, start, aura.duration, 1)
|
||||
else
|
||||
CooldownFrame_SetTimer(unit.buffs[i].cd, 0, 0, 0)
|
||||
end
|
||||
end
|
||||
else
|
||||
unit.buffs[i]:Hide()
|
||||
@@ -3197,7 +3241,7 @@ function pfUI.uf.GetColor(self, preset)
|
||||
-- O(1) Nampower lookup for health gradient color
|
||||
local hp, hpmax
|
||||
if GetUnitField then
|
||||
local guid = GetUnitGUID(unitstr)
|
||||
local guid = UnitGUID(unitstr)
|
||||
if guid then
|
||||
hp = GetUnitField(guid, "health")
|
||||
hpmax = GetUnitField(guid, "maxHealth")
|
||||
|
||||
+2
-2
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
+10
-6
@@ -33,13 +33,17 @@ pfUI:RegisterSkin("Turtle LFT", "vanilla", function ()
|
||||
end
|
||||
|
||||
-- tabs
|
||||
SkinTab(LFTFrameTab1)
|
||||
LFTFrameTab1:ClearAllPoints()
|
||||
LFTFrameTab1:SetPoint("TOPLEFT", LFTFrame.backdrop, "BOTTOMLEFT", bpad, -(border + (border == 1 and 1 or 2)))
|
||||
if LFTFrameTab1 then
|
||||
SkinTab(LFTFrameTab1)
|
||||
LFTFrameTab1:ClearAllPoints()
|
||||
LFTFrameTab1:SetPoint("TOPLEFT", LFTFrame.backdrop, "BOTTOMLEFT", bpad, -(border + (border == 1 and 1 or 2)))
|
||||
end
|
||||
|
||||
SkinTab(LFTFrameTab2)
|
||||
LFTFrameTab2:ClearAllPoints()
|
||||
LFTFrameTab2:SetPoint("LEFT", LFTFrameTab1, "RIGHT", border * 2 + 1, 0)
|
||||
if LFTFrameTab2 then
|
||||
SkinTab(LFTFrameTab2)
|
||||
LFTFrameTab2:ClearAllPoints()
|
||||
LFTFrameTab2:SetPoint("LEFT", LFTFrameTab1, "RIGHT", border * 2 + 1, 0)
|
||||
end
|
||||
|
||||
-- scrollframe
|
||||
StripTextures(LFTFrameScrollFrame)
|
||||
|
||||
Reference in New Issue
Block a user