Fix for bug report #6

- Fixes castbar not showing up properly when "ZOOM factor" in nameplates is activated.
- Possible fix for nampower error appearing.
This commit is contained in:
Meow
2026-01-09 18:38:43 +01:00
parent c775bdb648
commit 56d4e95868
2 changed files with 24 additions and 10 deletions
+20 -9
View File
@@ -237,6 +237,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
local function PlateCacheDebuffs(self, unitstr, verify)
if not self.debuffcache then self.debuffcache = {} end
if not libdebuff then return end -- Safety check
for id = 1, 16 do
local effect, _, texture, stacks, _, duration, timeleft
@@ -923,9 +924,9 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
for i = 1, 16 do
local effect, rank, texture, stacks, dtype, duration, timeleft
if unitstr and C.nameplates.selfdebuff == "1" then
if unitstr and C.nameplates.selfdebuff == "1" and libdebuff then
effect, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitOwnDebuff(unitstr, i)
elseif unitstr then
elseif unitstr and libdebuff then
effect, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff(unitstr, i)
elseif plate.verify == verify then
effect, rank, texture, stacks, dtype, duration, timeleft = plate:UnitDebuff(i)
@@ -1141,16 +1142,26 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
end
-- OPTIMIZED: UNIT_CASTEVENT implementation
if C.nameplates["showcastbar"] == "1" and ( C.nameplates["targetcastbar"] == "0" or target ) then
local unitstr = target and "target" or nil
-- Use multiple checks for target detection (target variable, istarget flag, or zoomed state)
local isTargetPlate = target or nameplate.istarget or (nameplate.health and nameplate.health.zoomed)
if C.nameplates["showcastbar"] == "1" and ( C.nameplates["targetcastbar"] == "0" or isTargetPlate ) then
local unitstr = nil
local targetGUID = nil
-- Use SuperWoW GUID if available
if superwow_active and not unitstr then
-- Get GUID for CastEvents lookup
if isTargetPlate and superwow_active then
-- Get target's GUID for event cache lookup
local _, guid = UnitExists("target")
targetGUID = guid
end
-- Use SuperWoW GUID for non-target plates
if superwow_active and not isTargetPlate then
unitstr = nameplate.parent:GetName(1)
end
-- Check event-based cast cache first
local castInfo = unitstr and CastEvents[unitstr]
-- Check event-based cast cache first (use GUID)
local castInfo = (targetGUID and CastEvents[targetGUID]) or (unitstr and CastEvents[unitstr])
if castInfo and castInfo.spellID then
-- Check if cast is still valid
@@ -1191,7 +1202,7 @@ pfUI:RegisterModule("nameplates", "vanilla", function ()
-- Fallback to API calls if no event data (for non-SuperWoW or target)
local channel, cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
if target then
if isTargetPlate and UnitExists("target") then
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo("target")
if not cast then
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
+4 -1
View File
@@ -112,7 +112,10 @@ pfUI:RegisterModule("nampower", "vanilla", function ()
spellName, spellRank, texture = SpellInfo(spellId)
end
if not spellName and GetSpellNameAndRankForId then
spellName, spellRank = GetSpellNameAndRankForId(spellId)
local success, name, rank = pcall(GetSpellNameAndRankForId, spellId)
if success then
spellName, spellRank = name, rank
end
end
if spellName then