mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 20:10:50 +00:00
castbar: rework channel and superwow logic
This commit is contained in:
+11
-9
@@ -81,26 +81,28 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
|
|||||||
this:SetAlpha(this:GetAlpha()-0.05)
|
this:SetAlpha(this:GetAlpha()-0.05)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local channel = nil
|
||||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
||||||
|
local query = this.unitstr or this.unitname
|
||||||
if not name then return end
|
if not name then return end
|
||||||
|
|
||||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(this.unitstr or this.unitname)
|
-- try to read cast and guid from SuperWoW (except for self casts)
|
||||||
if not cast then
|
|
||||||
-- scan for channel spells if no cast was found
|
|
||||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(this.unitstr or this.unitname)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- read enemy casts from SuperWoW if enabled
|
|
||||||
if superwow_active and this.unitstr and not UnitIsUnit(this.unitstr, 'player') then
|
if superwow_active and this.unitstr and not UnitIsUnit(this.unitstr, 'player') then
|
||||||
local _, guid = UnitExists(this.unitstr)
|
local _, guid = UnitExists(this.unitstr)
|
||||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(guid)
|
query = guid or query
|
||||||
|
end
|
||||||
|
|
||||||
|
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(query)
|
||||||
|
if not cast then
|
||||||
|
-- scan for channel spells if no cast was found
|
||||||
|
channel, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(query)
|
||||||
|
cast = channel
|
||||||
end
|
end
|
||||||
|
|
||||||
if cast then
|
if cast then
|
||||||
local duration = endTime - startTime
|
local duration = endTime - startTime
|
||||||
local max = duration / 1000
|
local max = duration / 1000
|
||||||
local cur = GetTime() - startTime / 1000
|
local cur = GetTime() - startTime / 1000
|
||||||
local channel = UnitChannelInfo(name)
|
|
||||||
|
|
||||||
this:SetAlpha(1)
|
this:SetAlpha(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user