mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 03:06:01 +00:00
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:
+7
-7
@@ -139,13 +139,13 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
query = UnitName("player")
|
||||
end
|
||||
|
||||
-- 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)
|
||||
-- Fallback: pfGetCastInfo only when no focusGuid (Nampower not available for this unit)
|
||||
if not cast and not castBlocked and not focusGuid and pfGetCastInfo then
|
||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = pfGetCastInfo(query)
|
||||
end
|
||||
|
||||
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)
|
||||
if not cast and not castBlocked and not focusGuid and pfGetChannelInfo then
|
||||
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = pfGetChannelInfo(this.unitstr or this.unitname)
|
||||
cast = channel
|
||||
end
|
||||
|
||||
@@ -254,12 +254,12 @@ pfUI:RegisterModule("castbar", "vanilla", function ()
|
||||
playerarg = pfUI.client <= 11200 or arg1 == "player" and true or nil
|
||||
|
||||
if event == CASTBAR_EVENT_CAST_DELAY and playerarg then
|
||||
local isCast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(this.unitstr or this.unitname)
|
||||
local isCast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = pfGetCastInfo(this.unitstr or this.unitname)
|
||||
if not isCast then return end
|
||||
if not this.endTime then return end
|
||||
this.delay = this.delay + (endTime - this.endTime) / 1000
|
||||
elseif event == CASTBAR_EVENT_CHANNEL_DELAY and playerarg then
|
||||
local isChannel, _, _, _, startTime, endTime = UnitChannelInfo(this.unitstr or this.unitname)
|
||||
local isChannel, _, _, _, startTime, endTime = pfGetChannelInfo(this.unitstr or this.unitname)
|
||||
if not isChannel then return end
|
||||
this.delay = ( this.delay or 0 ) + this.bar:GetValue() - (endTime/1000 - GetTime())
|
||||
elseif playerarg then
|
||||
|
||||
Reference in New Issue
Block a user