Core/Units: Fixed crash happening when despawning summoned units whose owner is no longer in world

Port From (https://github.com/TrinityCore/TrinityCore/commit/5889ab893e8252ef46ea00527f5e91bf97371182)
This commit is contained in:
hondacrx
2022-02-25 14:19:54 -05:00
parent 6f0b8760e2
commit 63be1f8dd5
+3 -3
View File
@@ -182,7 +182,7 @@ namespace Game.Entities
minion.SetSpeedRate(i, m_speed_rate[(int)i]);
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, Difficulty.None);
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
GetSpellHistory().StartCooldown(spellInfo, 0, null, true);
}
@@ -210,7 +210,7 @@ namespace Game.Entities
else if (minion.IsTotem())
{
// All summoned by totem minions must disappear when it is removed.
SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell(), GetMap().GetDifficultyID());
SpellInfo spInfo = Global.SpellMgr.GetSpellInfo(minion.ToTotem().GetSpell(), Difficulty.None);
if (spInfo != null)
{
foreach (var spellEffectInfo in spInfo.GetEffects())
@@ -223,7 +223,7 @@ namespace Game.Entities
}
}
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, GetMap().GetDifficultyID());
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.m_unitData.CreatedBySpell, Difficulty.None);
// Remove infinity cooldown
if (spellInfo != null && spellInfo.IsCooldownStartedOnEvent())
GetSpellHistory().SendCooldownEvent(spellInfo);