diff --git a/modules/castbar.lua b/modules/castbar.lua index 7429eab3..f802ab8d 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -345,6 +345,12 @@ pfUI:RegisterModule("castbar", function () elseif unitstr == "focus" then cb:RegisterEvent("PLAYER_FOCUS_CHANGED") end + -- The shield can flip mid-cast (the caster gains or loses an aura that + -- blocks interrupts). These only fire for target and focus. + if unitstr == "target" or unitstr == "focus" then + cb:RegisterUnitEvent("UNIT_SPELLCAST_INTERRUPTIBLE", unitstr) + cb:RegisterUnitEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", unitstr) + end cb:SetScript("OnEvent", function() local unit = this.unitstr @@ -400,6 +406,10 @@ pfUI:RegisterModule("castbar", function () if not this.tradeskillTotal then ClearBar(this) end elseif event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_INTERRUPTED" then ClearBar(this, true) + elseif event == "UNIT_SPELLCAST_INTERRUPTIBLE" or event == "UNIT_SPELLCAST_NOT_INTERRUPTIBLE" then + if this.endTime then + SetCastbarShield(this.bar, this.icon, event == "UNIT_SPELLCAST_NOT_INTERRUPTIBLE", this.isChannel) + end elseif event == "UNIT_SPELLCAST_DELAYED" or event == "UNIT_SPELLCAST_CHANNEL_UPDATE" then -- Pushback: a cast delayed later or a channel shortened. Following -- Quartz, re-poll just the times and accumulate the shift into a running diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 9a2be61d..f7144f0a 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -519,6 +519,10 @@ nameplates:RegisterEvent("UPDATE_MOUSEOVER_UNIT") -- plate's own frame, against its own token -- see OnCreate and -- NAME_PLATE_UNIT_ADDED. nameplates:RegisterEvent("PLAYER_GUILD_UPDATE") +-- The interruptible flips only fire for target and focus, not nameplate +-- tokens. castState is keyed by GUID, so they still reach those units' plates. +nameplates:RegisterUnitEvent("UNIT_SPELLCAST_INTERRUPTIBLE", "target", "focus") +nameplates:RegisterUnitEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "target", "focus") nameplates:SetScript("OnEvent", function() -- Stop event handling during logout to prevent crash 132 @@ -680,6 +684,17 @@ nameplates:RegisterEvent("PLAYER_GUILD_UPDATE") -- Also propagate to all plates for alpha/strata updates this.eventcache = true + elseif event == "UNIT_SPELLCAST_INTERRUPTIBLE" or event == "UNIT_SPELLCAST_NOT_INTERRUPTIBLE" then + local guid = UnitGUID(arg1) + local info = guid and castState[guid] + local plate = info and plateByGuid[guid] + if plate and plate.castbar then + info.noInterrupt = event == "UNIT_SPELLCAST_NOT_INTERRUPTIBLE" + -- UpdateCastbar only restyles on a new cast; force it + plate.castbar.lastEndTime = nil + plate.castUpdate = true + end + elseif event == "PLAYER_COMBO_POINTS" or event == "UNIT_COMBO_POINTS" then -- Only flag the target's plate for combo point update local plate = C_NamePlate.GetNamePlateForUnit("target")