mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-17 10:10:50 +00:00
Revert "this should fix no-target mobs casting with the same name"
This reverts commit 35ec17d9a0.
This commit is contained in:
+42
-20
@@ -1513,20 +1513,25 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
-- Use multiple checks for target detection (target variable, istarget flag, or zoomed state)
|
-- Use multiple checks for target detection (target variable, istarget flag, or zoomed state)
|
||||||
local isTargetPlate = target or nameplate.istarget or (nameplate.health and nameplate.health.zoomed)
|
local isTargetPlate = target or nameplate.istarget or (nameplate.health and nameplate.health.zoomed)
|
||||||
if cfg.showcastbar and ( not cfg.targetcastbar or isTargetPlate ) then
|
if cfg.showcastbar and ( not cfg.targetcastbar or isTargetPlate ) then
|
||||||
-- Always use GUID for cast lookup to prevent duplicate castbars on same-name mobs
|
local unitstr = nil
|
||||||
local plateGUID = nil
|
local targetGUID = nil
|
||||||
|
|
||||||
|
-- Get GUID for CastEvents lookup - use cached GUID when available
|
||||||
if isTargetPlate then
|
if isTargetPlate then
|
||||||
plateGUID = state and state.targetGuid
|
targetGUID = state and state.targetGuid
|
||||||
if not plateGUID then
|
if not targetGUID then
|
||||||
plateGUID = GetUnitGUID("target")
|
local guid = GetUnitGUID("target")
|
||||||
|
targetGUID = guid
|
||||||
end
|
end
|
||||||
else
|
|
||||||
plateGUID = nameplate.cachedGuid
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check event-based cast cache by GUID
|
-- Use cached GUID for non-target plates
|
||||||
local castInfo = plateGUID and GetCastInfo(plateGUID)
|
if not isTargetPlate then
|
||||||
|
unitstr = nameplate.cachedGuid
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check event-based cast cache first (use GUID)
|
||||||
|
local castInfo = GetCastInfo(targetGUID) or (unitstr and GetCastInfo(unitstr))
|
||||||
|
|
||||||
if castInfo and castInfo.spellID then
|
if castInfo and castInfo.spellID then
|
||||||
-- Check if cast is still valid
|
-- Check if cast is still valid
|
||||||
@@ -1570,21 +1575,38 @@ nameplates:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
|||||||
nameplate.castbar:Show()
|
nameplate.castbar:Show()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- No cast in libdebuff_casts for this GUID
|
-- Fallback to API calls only when no GUID available (Nampower not tracking this unit)
|
||||||
-- For target plate: try API fallback (channels may not be in cast cache)
|
|
||||||
-- For non-target: no GUID = no castbar (prevents duplicate castbars on same-name mobs)
|
|
||||||
local channel, cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
local channel, cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||||
|
|
||||||
if isTargetPlate and UnitExists("target") then
|
if targetGUID then
|
||||||
if UnitCastingInfo then
|
-- 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")
|
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo("target")
|
||||||
|
if not cast then
|
||||||
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not cast and UnitChannelInfo then
|
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
|
||||||
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo("target")
|
||||||
end
|
end
|
||||||
elseif plateGUID then
|
elseif unitstr then
|
||||||
-- Non-target with GUID but no cast data = no cast
|
local guid = GetUnitGUID(unitstr)
|
||||||
nameplate.castbar:Hide()
|
local q = guid or unitstr
|
||||||
|
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(q)
|
||||||
|
if not cast then
|
||||||
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(q)
|
||||||
|
end
|
||||||
|
elseif name then
|
||||||
|
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
||||||
|
if not cast then
|
||||||
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not cast and not channel then
|
if not cast and not channel then
|
||||||
|
|||||||
Reference in New Issue
Block a user