Skip to content

Commit fb702c9

Browse files
committed
more UnitChannelInfo bug workarounds for classic era
1 parent 9fa3b65 commit fb702c9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ClassicCastbars/ClassicCastbars.lua

+10-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ local GetNamePlateForUnit = _G.C_NamePlate.GetNamePlateForUnit
2525
local UnitIsFriend = _G.UnitIsFriend
2626
local UnitCastingInfo = _G.UnitCastingInfo
2727
local UnitChannelInfo = _G.UnitChannelInfo
28+
local CastingInfo = _G.CastingInfo
2829
local UnitIsUnit = _G.UnitIsUnit
2930
local gsub = _G.string.gsub
3031
local strsplit = _G.string.split
@@ -119,7 +120,11 @@ function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled, chann
119120
if not isChanneled then
120121
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, castID, notInterruptible, spellID = UnitCastingInfo(unitID)
121122
else
122-
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo(unitID)
123+
if CastingInfo and UnitIsUnit("player", unitID) then
124+
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo("player") -- UnitChannelInfo is bugged for classic era, tmp fallback method
125+
else
126+
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo(unitID)
127+
end
123128
if channelSpellID and not spellName then -- UnitChannelInfo is bugged for classic era, tmp fallback method
124129
spellName, _, iconTexturePath = GetSpellInfo(channelSpellID)
125130
local channelCastTime = spellName and channeledSpells[spellName]
@@ -273,6 +278,10 @@ function ClassicCastbars:PLAYER_TARGET_CHANGED() -- when you change your own tar
273278
elseif UnitChannelInfo("target") then
274279
self:UNIT_SPELLCAST_CHANNEL_START("target")
275280
end
281+
282+
if UnitIsUnit("player", "target") and UnitChannelInfo("player") then -- UnitChannelInfo is bugged, tmp fallback method for when player is target
283+
self:UNIT_SPELLCAST_CHANNEL_START("target")
284+
end
276285
end
277286

278287
function ClassicCastbars:PLAYER_FOCUS_CHANGED()

0 commit comments

Comments
 (0)