Streamer: fix nil spellID when casting spells

This commit is contained in:
andrew6180
2024-05-26 14:21:02 -07:00
parent 04ae34d25c
commit 9558de8750
+13 -11
View File
@@ -1069,7 +1069,6 @@ function StreamOverlay:CastFinished (castid)
local target = CastsTable [castid].Target
local caststart = CastsTable [castid].CastStart
local hascasttime = CastsTable [castid].HasCastTime
if (ignoredSpells [spellid]) or not spellid then
return
end
@@ -1366,19 +1365,19 @@ eventFrame:SetScript ("OnEvent", function (self, event, ...)
end
elseif (event == "UNIT_SPELLCAST_START") then
local unitID, spellName, spellRank, castGUID = ...
local spellID = GetSpellID(spellName, spellRank)
if (unitID == "player" and lastspellID == spellID) then
local unitID, _, _, castGUID = ...
if unitID == "player" then
local name, rank, displayName, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo("player")
if (lastspellID == spellID) then
CastsTable [castGUID] = {Target = lastTarget or "", Id = castGUID, SpellId = spellID, CastStart = lastCastSentTime, HasCastTime = true}
lastChannelSpell = castGUID
lastspell = spell
lastcastid = castGUID
local name, rank, displayName, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellId = UnitCastingInfo("player")
CastsTable [castGUID].CastTimeStart = startTime / 1000
CastsTable [castGUID].CastTimeEnd = endTime / 1000
StreamOverlay:CastStart(castGUID)
end
end
elseif (event == "UNIT_SPELLCAST_INTERRUPTED") then
local unitID, spellName, spellRank, castGUID = ...
@@ -1411,10 +1410,13 @@ eventFrame:SetScript ("OnEvent", function (self, event, ...)
local unitID, spellName, spellRank = ...
local spellID = GetSpellID(spellName, spellRank)
if (unitID == "player" and (CastsTable [castGUID] or spellID == lastspellID)) then
if (not castGUID) then
castGUID = lastcastid
if (unitID == "player") then
local name, rank, displayName, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitChannelInfo("player")
if spellID == lastspellID then
if not castID then
return
end
local castGUID = castID
if (ischanneling) then
--> channel updated
@@ -1432,7 +1434,6 @@ eventFrame:SetScript ("OnEvent", function (self, event, ...)
lastchannelid = castGUID
ischanneling = true
local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellId = UnitChannelInfo("player")
CastsTable [castGUID].CastTimeStart = startTime / 1000
CastsTable [castGUID].CastTimeEnd = endTime / 1000
@@ -1441,12 +1442,13 @@ eventFrame:SetScript ("OnEvent", function (self, event, ...)
StreamOverlay:CastStart(castGUID)
end
end
elseif (event == "UNIT_SPELLCAST_SUCCEEDED") then
--local unitID, spell, rank, id, spellID = ...
local unitID, spellName, spellRank, castGUID = ...
local spellID = GetSpellID(spellName, spellRank)
if (unitID == "player" and lastspellID == spellID and not channelspells [spellName]) then
if (unitID == "player" and spellID and lastspellID == spellID and not channelspells [spellName]) then
if (CastsTable[castGUID]) then
if (CastsTable[castGUID].HasCastTime and not CastsTable[castGUID].IsChanneled) then
--> a cast (non channeled) just successful finished