From 703d7770cada99f042f3db3500b05cdf91ec32a3 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Fri, 3 Jul 2026 19:28:19 -0500 Subject: [PATCH] nameplates: hide castbar on remote interrupt / caster death (#11) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ClassicAPI's remote-cast cache is stamped from SMSG_SPELL_START and only expires by computed end time — 1.12 keeps no per-unit interrupt record, so an interrupted cast kept animating on the plate until its would-be finish (BG flag caps being the loudest repro). Nampower does surface the missing signal in Lua: SPELL_FAILED_OTHER (casterGuid, spellId; fired from the SMSG_SPELL_FAILED_OTHER handler) and UNIT_DIED (guid). Stamp a guid-keyed suppression time on either event and have GetCastInfo drop any cast that started before the stamp; a newer cast clears its unit's entry. Both castbar paths (dedicated target frame + central loop) already funnel through GetCastInfo, so one check covers them. The handler only stamps when the unit actually has a tracked cast, and flags the plate via castUpdate for a same-tick hide. --- modules/nameplates.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 98f28aea..18825576 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -63,6 +63,14 @@ pfUI:RegisterModule("nameplates", function () local raidGuidCache = {} -- guid -> name (rebuilt on RAID_ROSTER_UPDATE/PARTY_MEMBERS_CHANGED) + -- ClassicAPI's remote-cast cache has no interrupt signal — an interrupted + -- cast keeps being reported until its computed end time (issue #11). When + -- nampower tells us a remote cast failed (SPELL_FAILED_OTHER) or the caster + -- died (UNIT_DIED), we stamp the event time here (engine-ms domain, same as + -- startMs) and GetCastInfo drops any cast that started before the stamp. A + -- newer cast clears its unit's entry. + local castSuppressed = {} -- guid -> suppression time (GetTime()*1000) + -- Resolve a plate GUID to its cast/channel info via C_Spell. Returns a -- compact struct (spellName / icon / startTime / endTime / duration / -- isChannel) or nil when the unit isn't casting / the GUID can't map to a @@ -78,6 +86,11 @@ pfUI:RegisterModule("nameplates", function () isChannel = true end if not name or not startMs or not endMs then return nil end + local supp = castSuppressed[guid] + if supp then + if startMs <= supp then return nil end + castSuppressed[guid] = nil + end return { spellName = name, spellID = spellID, @@ -474,6 +487,9 @@ nameplates:RegisterEvent("PARTY_MEMBERS_CHANGED") nameplates:RegisterEvent("NAME_PLATE_CREATED") nameplates:RegisterEvent("NAME_PLATE_UNIT_ADDED") nameplates:RegisterEvent("NAME_PLATE_UNIT_REMOVED") +-- nampower: remote cast interrupted / caster died — see castSuppressed +nameplates:RegisterEvent("SPELL_FAILED_OTHER") +nameplates:RegisterEvent("UNIT_DIED") if GetUnitField then nameplates:RegisterEvent("UNIT_FLAGS_GUID") nameplates:RegisterEvent("UNIT_AURA_GUID") @@ -594,6 +610,19 @@ end plate.nameplate.auraUpdate = true end + elseif event == "SPELL_FAILED_OTHER" or event == "UNIT_DIED" then + -- Nampower: arg1 = guid. Only stamp when the unit actually has a + -- tracked cast — keeps the table from accumulating an entry for every + -- combat-log death. Flag the plate so the castbar hides this tick + -- instead of waiting out the throttle. + if arg1 and GetCastInfo(arg1) then + castSuppressed[arg1] = GetTime() * 1000 + local plate = C_NamePlate.GetNamePlateForGUID(arg1) + if plate and plate.nameplate then + plate.nameplate.castUpdate = true + end + end + elseif event == "PLAYER_TARGET_CHANGED" then -- Flag target plate for update via GUID registry local targetGuid = UnitGUID("target")