From 5fd3ff5817a40f9d1b9f3b230cfa4c3c028a5de3 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 1 Jun 2025 10:10:22 +0200 Subject: [PATCH] nameplates: add support for channel spell cast bars --- modules/nameplates.lua | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index 85665b49..59785b17 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1018,22 +1018,34 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () -- castbar update if C.nameplates["showcastbar"] == "1" and ( C.nameplates["targetcastbar"] == "0" or target ) then - local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(target and "target" or name) + local channel, cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill + + -- detect cast or channel bars + cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(target and "target" or name) + if not cast then channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(target and "target" or name) end -- read enemy casts from SuperWoW if enabled if superwow_active then cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(nameplate.parent:GetName(1)) + if not cast then channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(nameplate.parent:GetName(1)) end end - if not cast then + if not cast and not channel then nameplate.castbar:Hide() - elseif cast then + elseif cast or channel then + local effect = cast or channel local duration = endTime - startTime + local max = duration / 1000 + local cur = GetTime() - startTime / 1000 + + -- invert castbar values while channeling + if channel then cur = max + startTime/1000 - GetTime() end + nameplate.castbar:SetMinMaxValues(0, duration/1000) - nameplate.castbar:SetValue(GetTime() - startTime/1000) - nameplate.castbar.text:SetText(round(startTime/1000 + duration/1000 - GetTime(),1)) + nameplate.castbar:SetValue(cur) + nameplate.castbar.text:SetText(round(cur,1)) if C.nameplates.spellname == "1" then - nameplate.castbar.spell:SetText(cast) + nameplate.castbar.spell:SetText(effect) else nameplate.castbar.spell:SetText("") end