diff --git a/ClassicCastbars/ClassicCastbars.lua b/ClassicCastbars/ClassicCastbars.lua index 8d4c877..582c24b 100644 --- a/ClassicCastbars/ClassicCastbars.lua +++ b/ClassicCastbars/ClassicCastbars.lua @@ -3,6 +3,7 @@ local PoolManager = namespace.PoolManager local uninterruptibleList = namespace.uninterruptibleList local playerSilences = namespace.playerSilences local castImmunityBuffs = namespace.castImmunityBuffs +local channeledSpells = namespace.channeledSpells local activeFrames = {} local activeGUIDs = {} @@ -111,12 +112,20 @@ function ClassicCastbars:ADDON_LOADED(addonName) end end -function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled) +function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled, channelSpellID) local spellName, iconTexturePath, startTimeMS, endTimeMS, castID, notInterruptible, spellID, _ if not isChanneled then spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, castID, notInterruptible, spellID = UnitCastingInfo(unitID) else spellName, _, iconTexturePath, startTimeMS, endTimeMS, _, notInterruptible, spellID = UnitChannelInfo(unitID) + 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] + if not channelCastTime then return end + spellID = channelSpellID + endTimeMS = (GetTime() * 1000) + channelCastTime + startTimeMS = GetTime() * 1000 + end end if not spellName then return end @@ -177,7 +186,8 @@ function ClassicCastbars:CheckCastModifiers(unitID, ranFromUnitAuraEvent) if ranFromUnitAuraEvent then if cast.isChanneled then - return self:UNIT_SPELLCAST_CHANNEL_START(unitID) -- Exit & restart cast to update border shield + return -- TODO: readd once UnitChannelInfo is fixed by blizz + --return self:UNIT_SPELLCAST_CHANNEL_START(unitID) -- Exit & restart cast to update border shield else return self:UNIT_SPELLCAST_START(unitID) -- Exit & restart cast to update border shield end @@ -201,7 +211,8 @@ function ClassicCastbars:CheckCastModifiers(unitID, ranFromUnitAuraEvent) if ranFromUnitAuraEvent then if cast.isChanneled then - return self:UNIT_SPELLCAST_CHANNEL_START(unitID) -- Exit & restart cast to update border shield + return -- TODO: readd once UnitChannelInfo is fixed by blizz + --return self:UNIT_SPELLCAST_CHANNEL_START(unitID) -- Exit & restart cast to update border shield else return self:UNIT_SPELLCAST_START(unitID) -- Exit & restart cast to update border shield end @@ -304,11 +315,11 @@ function ClassicCastbars:UNIT_SPELLCAST_START(unitID) self:DisplayCastbar(castbar, unitID) end -function ClassicCastbars:UNIT_SPELLCAST_CHANNEL_START(unitID) +function ClassicCastbars:UNIT_SPELLCAST_CHANNEL_START(unitID, _, spellID) local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end - self:BindCurrentCastData(castbar, unitID, true) + self:BindCurrentCastData(castbar, unitID, true, spellID) self:DisplayCastbar(castbar, unitID) end @@ -376,11 +387,11 @@ function ClassicCastbars:UNIT_SPELLCAST_DELAYED(unitID, castID) self:BindCurrentCastData(castbar, unitID, false) end -function ClassicCastbars:UNIT_SPELLCAST_CHANNEL_UPDATE(unitID) +function ClassicCastbars:UNIT_SPELLCAST_CHANNEL_UPDATE(unitID, _, spellID) local castbar = self:GetCastbarFrameIfEnabled(unitID) if not castbar then return end - self:BindCurrentCastData(castbar, unitID, true) + self:BindCurrentCastData(castbar, unitID, true, spellID) end function ClassicCastbars:UNIT_SPELLCAST_FAILED(unitID, castID) @@ -391,6 +402,7 @@ function ClassicCastbars:UNIT_SPELLCAST_FAILED(unitID, castID) local cast = castbar._data if cast then if not cast.isChanneled and cast.castID ~= castID then return end -- required for player + if cast.isChanneled and castID ~= nil then return end if not castbar._data.isInterrupted then castbar._data.isFailed = true end diff --git a/ClassicCastbars/core/ClassicSpellData.lua b/ClassicCastbars/core/ClassicSpellData.lua index 5e88eeb..a096125 100644 --- a/ClassicCastbars/core/ClassicSpellData.lua +++ b/ClassicCastbars/core/ClassicSpellData.lua @@ -169,3 +169,59 @@ elseif CLIENT_IS_TBC then namespace.uninterruptibleList[GetSpellInfo(29121)] = true -- Shoot Bow namespace.uninterruptibleList[GetSpellInfo(33808)] = true -- Shoot Gun end + +if CLIENT_IS_CLASSIC_ERA then + -- UnitChannelInfo() currently doesn't work in Classic Era 1.15.0 due to a Blizzard bug(?) + -- We use this data to retrieve spell cast time + namespace.channeledSpells = { + -- MISC + [GetSpellInfo(746)] = 8000, -- First Aid + [GetSpellInfo(13278)] = 4000, -- Gnomish Death Ray + [GetSpellInfo(20577)] = 10000, -- Cannibalize + [GetSpellInfo(10797)] = 6000, -- Starshards + [GetSpellInfo(16430)] = 12000, -- Soul Tap + [GetSpellInfo(24323)] = 8000, -- Blood Siphon + [GetSpellInfo(27640)] = 3000, -- Baron Rivendare's Soul Drain + [GetSpellInfo(7290)] = 10000, -- Soul Siphon + [GetSpellInfo(24322)] = 8000, -- Blood Siphon + [GetSpellInfo(27177)] = 10000, -- Defile + [GetSpellInfo(27286)] = 1000, -- Shadow Wrath (see issue #59) + [GetSpellInfo(433797)] = 7000, -- Bladestorm + + -- DRUID + [GetSpellInfo(17401)] = 10000, -- Hurricane + [GetSpellInfo(740)] = 10000, -- Tranquility + [GetSpellInfo(20687)] = 10000, -- Starfall + + -- HUNTER + [GetSpellInfo(6197)] = 60000, -- Eagle Eye + [GetSpellInfo(1002)] = 60000, -- Eyes of the Beast + [GetSpellInfo(1510)] = 6000, -- Volley + [GetSpellInfo(136)] = 5000, -- Mend Pet + + -- MAGE + [GetSpellInfo(5143)] = 5000, -- Arcane Missiles + [GetSpellInfo(7268)] = 3000, -- Arcane Missile + [GetSpellInfo(10)] = 8000, -- Blizzard + [GetSpellInfo(12051)] = 8000, -- Evocation + [GetSpellInfo(401417)] = 3000, -- Regeneration + [GetSpellInfo(412510)] = 3000, -- Mass Regeneration + + -- PRIEST + [GetSpellInfo(15407)] = 3000, -- Mind Flay + [GetSpellInfo(2096)] = 60000, -- Mind Vision + [GetSpellInfo(605)] = 3000, -- Mind Control + [GetSpellInfo(402174)] = 2000, -- Penance + + -- WARLOCK + [GetSpellInfo(126)] = 45000, -- Eye of Kilrogg + [GetSpellInfo(689)] = 5000, -- Drain Life + [GetSpellInfo(5138)] = 5000, -- Drain Mana + [GetSpellInfo(1120)] = 15000, -- Drain Soul + [GetSpellInfo(5740)] = 8000, -- Rain of Fire + [GetSpellInfo(1949)] = 15000, -- Hellfire + [GetSpellInfo(755)] = 10000, -- Health Funnel + [GetSpellInfo(17854)] = 10000, -- Consume Shadows + [GetSpellInfo(6358)] = 15000, -- Seduction Channel + } +end