mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-07 14:10:01 +00:00
fix for nameplates and castbars
Removed SuperWoW dependency from castbar and nameplate cast detection. Cast interrupts (sidestep, spell failed) now correctly stop the castbar by setting event = "FAIL" / event = "CAST" on the libdebuff cache entry instead of nil-ing it — preventing stale local references from keeping the castbar alive. UnitCastingInfo fallback is retained for non-Nampower environments but no longer overrides Nampower cast state.
This commit is contained in:
+15
-18
@@ -1,5 +1,4 @@
|
||||
pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
local superwow_active = HasSuperWoW()
|
||||
|
||||
local font = C.castbar.use_unitfonts == "1" and pfUI.font_unit or pfUI.font_default
|
||||
local font_size = C.castbar.use_unitfonts == "1" and C.global.font_unit_size or C.global.font_size
|
||||
@@ -108,43 +107,41 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
local focusGuid = nil
|
||||
if this.unitstr and string.find(this.unitstr, "^0x") then
|
||||
focusGuid = this.unitstr
|
||||
elseif this.unitstr and this.unitstr ~= "player" then
|
||||
local _, guid = UnitExists(this.unitstr)
|
||||
if guid then focusGuid = guid end
|
||||
end
|
||||
|
||||
-- Try libdebuff_casts first for GUID-based units (works with Turtle GUID + Nampower events)
|
||||
local cast, nameSubtext, text, texture, startTime, endTime
|
||||
local castBlocked = false
|
||||
if focusGuid and pfUI.libdebuff_casts and pfUI.libdebuff_casts[focusGuid] then
|
||||
local castData = pfUI.libdebuff_casts[focusGuid]
|
||||
if castData.event == "START" and castData.endTime and castData.endTime > GetTime() then
|
||||
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
|
||||
cast = castData.spellName
|
||||
texture = castData.icon
|
||||
startTime = castData.startTime * 1000 -- libdebuff uses seconds, castbar expects milliseconds
|
||||
startTime = castData.startTime * 1000
|
||||
endTime = castData.endTime * 1000
|
||||
nameSubtext = "" -- Rank info not available in libdebuff_casts
|
||||
nameSubtext = ""
|
||||
end
|
||||
end
|
||||
|
||||
-- Fallback: transform unitstrings to unit guids when SuperWoW is active
|
||||
-- SuperWoW stores cast data by GUID for all units INCLUDING player
|
||||
-- BUT: For player casts, we need to use libcast data because it handles pushback correctly
|
||||
local useLibcastForPlayer = this.unitstr == "player"
|
||||
|
||||
if not cast and superwow_active and this.unitstr and not useLibcastForPlayer then
|
||||
local _, guid = UnitExists(this.unitstr)
|
||||
query = guid or query
|
||||
end
|
||||
|
||||
|
||||
-- For player: use player name to query libcast.db directly
|
||||
if not cast and useLibcastForPlayer then
|
||||
query = UnitName("player")
|
||||
end
|
||||
|
||||
-- Fallback: Try UnitCastingInfo if we haven't found cast data yet
|
||||
if not cast and UnitCastingInfo then
|
||||
-- Fallback: UnitCastingInfo only when no focusGuid (Nampower not available for this unit)
|
||||
if not cast and not castBlocked and not focusGuid and UnitCastingInfo then
|
||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(query)
|
||||
end
|
||||
|
||||
if not cast and UnitChannelInfo then
|
||||
-- scan for channel spells if no cast was found
|
||||
|
||||
if not cast and not castBlocked and not focusGuid and UnitChannelInfo then
|
||||
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(this.unitstr or this.unitname)
|
||||
cast = channel
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user