Core/Spells: Allow cancelling spell missiles without cancelling the entire spell

Port From (https://github.com/TrinityCore/TrinityCore/commit/ed98146d317f9b956e8ca23524631cdd2388492b)
This commit is contained in:
hondacrx
2023-09-14 06:59:49 -04:00
parent 25b27dcc72
commit b99f574f64
+12 -7
View File
@@ -1212,21 +1212,26 @@ namespace Game.Entities
SendMessageToSet(cancelSpellVisualKit, true);
}
public void CancelSpellMissiles(uint spellId, bool reverseMissile = false)
public void CancelSpellMissiles(uint spellId, bool reverseMissile = false, bool abortSpell = false)
{
bool hasMissile = false;
foreach (var pair in m_Events.GetEvents())
if (abortSpell)
{
Spell spell = Spell.ExtractSpellFromEvent(pair.Value);
if (spell != null)
foreach (var pair in m_Events.GetEvents())
{
if (spell.GetSpellInfo().Id == spellId)
Spell spell = Spell.ExtractSpellFromEvent(pair.Value);
if (spell != null)
{
pair.Value.ScheduleAbort();
hasMissile = true;
if (spell.GetSpellInfo().Id == spellId)
{
pair.Value.ScheduleAbort();
hasMissile = true;
}
}
}
}
else
hasMissile = true;
if (hasMissile)
{