added Spellcast_channel_stop to libdebuff

This commit is contained in:
Meow
2026-03-29 21:24:58 +02:00
parent f5cc0dabf2
commit 5be9b00623
+27 -6
View File
@@ -1158,6 +1158,7 @@ if hasNampower then
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("PLAYER_TALENT_UPDATE")
frame:RegisterEvent("PLAYER_LOGOUT")
frame:RegisterEvent("SPELLCAST_CHANNEL_STOP")
frame:RegisterEvent("SPELL_START_SELF")
frame:RegisterEvent("SPELL_START_OTHER")
frame:RegisterEvent("SPELL_GO_SELF")
@@ -1178,6 +1179,26 @@ if hasNampower then
this:SetScript("OnEvent", nil)
return
elseif event == "SPELLCAST_CHANNEL_STOP" then
-- Channel interrupted by player - clear ownDebuffs for the channeled spell immediately.
-- DEBUFF_REMOVED fires later (0.5-1s server lag), causing phantom debuff display.
-- We look up the active channel cast and pre-clear ownDebuffs for its target.
local myGuid = GetPlayerGUID()
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")
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)
local remaining = (data.startTime + data.duration) - GetTime()
if remaining > 0 then
ownDebuffs[targetGuid][spellName] = nil
end
end
pfUI.libdebuff_casts[myGuid] = nil
end
elseif event == "PLAYER_ENTERING_WORLD" then
GetPlayerGUID()
UpdateCarnageRank()
@@ -1576,6 +1597,7 @@ if hasNampower then
DEFAULT_CHAT_FRAME:AddMessage(string.format("%s |cff00ffff[AURA_CAST]|r %s target=%s caster=%s isOurs=%s dur=%.1fs",
GetDebugTimestamp(), spellName, DebugGuid(targetGuid), DebugGuid(casterGuid), tostring(isOurs), duration))
end
end
-- Notify nameplates
@@ -1608,13 +1630,12 @@ if hasNampower then
-- Get texture
local texture = libdebuff:GetSpellIcon(spellId)
-- Store in ownDebuffs
-- Store in ownDebuffs only if entry already exists (confirmed hit via DEBUFF_ADDED).
-- AURA_CAST fires on both hit AND miss - creating a new entry here would show
-- phantom debuffs when the cast misses or is interrupted before hitting.
if not ownDebuffs[targetGuid] or not ownDebuffs[targetGuid][spellName] then return end
ownDebuffs[targetGuid] = ownDebuffs[targetGuid] or {}
if not ownDebuffs[targetGuid][spellName] then
ownDebuffs[targetGuid][spellName] = {}
end
local data = ownDebuffs[targetGuid][spellName]
if not data then return end -- race condition: cleared by DEBUFF_REMOVED between init and use