Skip to content

Commit

Permalink
more UnitChannelInfo bug workarounds for classic era
Browse files Browse the repository at this point in the history
  • Loading branch information
wardz committed Jan 25, 2024
1 parent 9fa3b65 commit fb702c9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ClassicCastbars/ClassicCastbars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local GetNamePlateForUnit = _G.C_NamePlate.GetNamePlateForUnit
local UnitIsFriend = _G.UnitIsFriend
local UnitCastingInfo = _G.UnitCastingInfo
local UnitChannelInfo = _G.UnitChannelInfo
local CastingInfo = _G.CastingInfo
local UnitIsUnit = _G.UnitIsUnit
local gsub = _G.string.gsub
local strsplit = _G.string.split
Expand Down Expand Up @@ -119,7 +120,11 @@ function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled, chann
if not isChanneled then
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, castID, notInterruptible, spellID = UnitCastingInfo(unitID)
else
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo(unitID)
if CastingInfo and UnitIsUnit("player", unitID) then
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo("player") -- UnitChannelInfo is bugged for classic era, tmp fallback method
else
spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo(unitID)
end
if channelSpellID and not spellName then -- UnitChannelInfo is bugged for classic era, tmp fallback method
spellName, _, iconTexturePath = GetSpellInfo(channelSpellID)
local channelCastTime = spellName and channeledSpells[spellName]
Expand Down Expand Up @@ -273,6 +278,10 @@ function ClassicCastbars:PLAYER_TARGET_CHANGED() -- when you change your own tar
elseif UnitChannelInfo("target") then
self:UNIT_SPELLCAST_CHANNEL_START("target")
end

if UnitIsUnit("player", "target") and UnitChannelInfo("player") then -- UnitChannelInfo is bugged, tmp fallback method for when player is target
self:UNIT_SPELLCAST_CHANNEL_START("target")
end
end

function ClassicCastbars:PLAYER_FOCUS_CHANGED()
Expand Down

0 comments on commit fb702c9

Please sign in to comment.