Refactor nameplate cast tracking to be fully GUID-based

Problem:
Since a recent Turtle-WoW update, nameplates would show the same castbar on all mobs sharing a name (e.g. multiple "Defias Rogue Wizard"). Additionally, a targeted mob that was not casting would incorrectly display the castbar of a nearby mob with the same name.

Changes:
**`modules/nameplates.lua`**
- Removed `hasNampower` version-sniffing entirely. Nampower is a hard requirement for pfUI; all related guards have been removed and the code runs unconditionally.
- Castbar lookup now always uses `nameplate.cachedGuid` directly — never `GetUnitGUID("target")` or a unit name string.
- Removed dead fallback block using `UnitCastingInfo("target")`.
- Restored fallback via `pfGetCastInfo(cachedGuid)` / `pfGetChannelInfo(cachedGuid)` (see libcast changes below) for casts not tracked by libdebuff (e.g. already-in-progress casts on login).

**`libs/libcast.lua`**
- Renamed `UnitCastingInfo` → `pfGetCastInfo` and `UnitChannelInfo` → `pfGetChannelInfo` to avoid confusion with the Blizzard API of the same name, which does not exist in Vanilla.
- Name-based fallback lookup (`libcast.db[unitName]`) is now skipped when a GUID is available. This prevents cast bleed between mobs that share a name.

**`libs/libpredict.lua`, `modules/castbar.lua`, `modules/afkcam.lua`**
- Updated all call sites to use the renamed `pfGetCastInfo` / `pfGetChannelInfo`.
This commit is contained in:
Meow
2026-03-23 10:47:42 +01:00
parent cd4a3343cb
commit 2ef9c5ee1e
5 changed files with 84 additions and 135 deletions
+5 -5
View File
@@ -446,7 +446,7 @@ function libpredict:ParseComm(sender, msg)
rank = tonumber(rankStr)
end
end
elseif select and UnitCastingInfo then
elseif select and pfGetCastInfo then
-- latest healcomm
msgtype = tonumber(string.sub(msg, 1, 3))
if not msgtype then return end
@@ -456,8 +456,8 @@ function libpredict:ParseComm(sender, msg)
heal = tonumber(string.sub(msg, 4, 8))
target = string.sub(msg,9, -1)
local starttime = select(5, UnitCastingInfo(sender))
local endtime = select(6, UnitCastingInfo(sender))
local starttime = select(5, pfGetCastInfo(sender))
local endtime = select(6, pfGetCastInfo(sender))
if not starttime or not endtime then return end
time = endtime - starttime
elseif msgtype == 1 then
@@ -466,8 +466,8 @@ function libpredict:ParseComm(sender, msg)
msgtype = "Heal"
heal = tonumber(string.sub(msg,4, 8))
target = {strsplit(":", string.sub(msg,9, -1))}
local starttime = select(5, UnitCastingInfo(sender))
local endtime = select(6, UnitCastingInfo(sender))
local starttime = select(5, pfGetCastInfo(sender))
local endtime = select(6, pfGetCastInfo(sender))
if not starttime or not endtime then return end
time = endtime - starttime
end