mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-25 21:40:49 +00:00
nameplates: add support for channel spell cast bars
This commit is contained in:
+18
-6
@@ -1018,22 +1018,34 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
-- castbar update
|
-- castbar update
|
||||||
if C.nameplates["showcastbar"] == "1" and ( C.nameplates["targetcastbar"] == "0" or target ) then
|
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
|
-- read enemy casts from SuperWoW if enabled
|
||||||
if superwow_active then
|
if superwow_active then
|
||||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(nameplate.parent:GetName(1))
|
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
|
end
|
||||||
|
|
||||||
if not cast then
|
if not cast and not channel then
|
||||||
nameplate.castbar:Hide()
|
nameplate.castbar:Hide()
|
||||||
elseif cast then
|
elseif cast or channel then
|
||||||
|
local effect = cast or channel
|
||||||
local duration = endTime - startTime
|
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:SetMinMaxValues(0, duration/1000)
|
||||||
nameplate.castbar:SetValue(GetTime() - startTime/1000)
|
nameplate.castbar:SetValue(cur)
|
||||||
nameplate.castbar.text:SetText(round(startTime/1000 + duration/1000 - GetTime(),1))
|
nameplate.castbar.text:SetText(round(cur,1))
|
||||||
if C.nameplates.spellname == "1" then
|
if C.nameplates.spellname == "1" then
|
||||||
nameplate.castbar.spell:SetText(cast)
|
nameplate.castbar.spell:SetText(effect)
|
||||||
else
|
else
|
||||||
nameplate.castbar.spell:SetText("")
|
nameplate.castbar.spell:SetText("")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user