From 68ff49be24ff195cf5c6cd6bf9e8ce547a4bda58 Mon Sep 17 00:00:00 2001 From: Meow <30401521+me0wg4ming@users.noreply.github.com> Date: Sun, 22 Mar 2026 10:38:53 +0100 Subject: [PATCH] fixed castbar for channeling units --- libs/libdebuff.lua | 9 ++++++--- modules/castbar.lua | 5 ++++- modules/nameplates.lua | 13 +++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index a469ba72..bcf8b26c 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -1200,7 +1200,9 @@ if hasNampower then local itemId = arg1 local spellId = arg2 local casterGuid = arg3 - local castTime = arg6 + local spellType = arg8 or 0 -- 0=Normal, 1=Channel, 2=Autorepeating + local isChannel = spellType == 1 + local castTime = isChannel and arg7 or arg6 -- arg6=castTime (normal), arg7=duration (channel) if not casterGuid or not spellId then return end @@ -1244,7 +1246,7 @@ if hasNampower then startTime = GetTime(), duration = castTime and castTime / 1000 or 0, endTime = castTime and (GetTime() + castTime / 1000) or nil, - event = "START" + event = isChannel and "CHANNEL" or "START" } if event == "SPELL_START_SELF" and pfUI.libdebuff_spell_start_self_hooks then @@ -1267,8 +1269,9 @@ if hasNampower then -- Clear cast bar only if SPELL_GO matches the active cast -- (Reactive procs like Frost Armor trigger SPELL_GO but shouldn't clear the castbar) + -- Don't clear channels on SPELL_GO - channels persist until duration expires or SPELL_FAILED if casterGuid and pfUI.libdebuff_casts[casterGuid] then - if pfUI.libdebuff_casts[casterGuid].spellID == spellId then + if pfUI.libdebuff_casts[casterGuid].spellID == spellId and pfUI.libdebuff_casts[casterGuid].event ~= "CHANNEL" then pfUI.libdebuff_casts[casterGuid] = nil end end diff --git a/modules/castbar.lua b/modules/castbar.lua index f8bdd99d..7d22376d 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -120,12 +120,15 @@ pfUI:RegisterModule("castbar", "vanilla", function () if castData.event == "CAST" or castData.event == "FAIL" then castBlocked = true pfUI.libdebuff_casts[focusGuid] = nil - elseif castData.event == "START" and castData.endTime and castData.endTime > GetTime() then + elseif (castData.event == "START" or castData.event == "CHANNEL") and castData.endTime and castData.endTime > GetTime() then cast = castData.spellName texture = castData.icon startTime = castData.startTime * 1000 endTime = castData.endTime * 1000 nameSubtext = "" + if castData.event == "CHANNEL" then + channel = cast + end end end diff --git a/modules/nameplates.lua b/modules/nameplates.lua index c9d80ab5..b134ad56 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1579,8 +1579,17 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA") local channel, cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill if targetGUID then - -- We have a GUID = Nampower is authority, no cast means no cast - nameplate.castbar:Hide() + -- We have a GUID but Nampower has no cast info. + -- Fall back to API for the target plate (channels may not be in cast cache) + 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") + end + end + if not cast and not channel then + nameplate.castbar:Hide() + end elseif isTargetPlate and UnitExists("target") then cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo("target") if not cast then