mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-20 03:20:49 +00:00
castbar: prefer unitstrings over names
This commit is contained in:
@@ -51,6 +51,9 @@ local libcast = CreateFrame("Frame", "pfEnemyCast")
|
|||||||
local player = UnitName("player")
|
local player = UnitName("player")
|
||||||
|
|
||||||
UnitChannelInfo = _G.UnitChannelInfo or function(unit)
|
UnitChannelInfo = _G.UnitChannelInfo or function(unit)
|
||||||
|
-- convert to name if unitstring was given
|
||||||
|
unit = pfValidUnits[unit] and UnitName(unit) or unit
|
||||||
|
|
||||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||||
local db = libcast.db[unit]
|
local db = libcast.db[unit]
|
||||||
|
|
||||||
@@ -77,6 +80,9 @@ UnitChannelInfo = _G.UnitChannelInfo or function(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
UnitCastingInfo = _G.UnitCastingInfo or function(unit)
|
UnitCastingInfo = _G.UnitCastingInfo or function(unit)
|
||||||
|
-- convert to name if unitstring was given
|
||||||
|
unit = pfValidUnits[unit] and UnitName(unit) or unit
|
||||||
|
|
||||||
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill
|
||||||
local db = libcast.db[unit]
|
local db = libcast.db[unit]
|
||||||
|
|
||||||
|
|||||||
+4
-6
@@ -92,10 +92,10 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
|
|||||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
local name = this.unitstr and UnitName(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(name)
|
local cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(this.unitstr or this.unitname)
|
||||||
if not cast then
|
if not cast then
|
||||||
-- scan for channel spells if no cast was found
|
-- scan for channel spells if no cast was found
|
||||||
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(name)
|
cast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(this.unitstr or this.unitname)
|
||||||
end
|
end
|
||||||
|
|
||||||
if cast then
|
if cast then
|
||||||
@@ -167,13 +167,11 @@ pfUI:RegisterModule("castbar", "vanilla:tbc", function ()
|
|||||||
if this.unitstr and not UnitIsUnit(this.unitstr, "player") then return end
|
if this.unitstr and not UnitIsUnit(this.unitstr, "player") then return end
|
||||||
|
|
||||||
if event == CASTBAR_EVENT_CAST_DELAY then
|
if event == CASTBAR_EVENT_CAST_DELAY then
|
||||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
local isCast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(this.unitstr or this.unitname)
|
||||||
local isCast, nameSubtext, text, texture, startTime, endTime, isTradeSkill = UnitCastingInfo(name)
|
|
||||||
if not isCast then return end
|
if not isCast then return end
|
||||||
this.delay = this.delay + (endTime - this.endTime) / 1000
|
this.delay = this.delay + (endTime - this.endTime) / 1000
|
||||||
elseif event == CASTBAR_EVENT_CHANNEL_DELAY then
|
elseif event == CASTBAR_EVENT_CHANNEL_DELAY then
|
||||||
local name = this.unitstr and UnitName(this.unitstr) or this.unitname
|
local isChannel, _, _, _, startTime, endTime = UnitChannelInfo(this.unitstr or this.unitname)
|
||||||
local isChannel, _, _, _, startTime, endTime = UnitChannelInfo(name)
|
|
||||||
if not isChannel then return end
|
if not isChannel then return end
|
||||||
this.delay = ( this.delay or 0 ) + this.bar:GetValue() - (endTime/1000 - GetTime())
|
this.delay = ( this.delay or 0 ) + this.bar:GetValue() - (endTime/1000 - GetTime())
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user