Core/Spells: implement and enable SMSG_MISSILE_CANCEL and use it in Murozond encounter

This commit is contained in:
Ovahlord committed 2020-08-04 16:53:59 +02:00
1 parent d099e16acb
commit f42d242996
9 files changed
+93 -12

No files matched your search

+28
View File
@@ -68,6 +68,7 @@
#include "SpellHistory.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "SpellPackets.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "Transport.h"
@@ -12514,6 +12515,33 @@ void Unit::SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
SendMessageToSet(&data, true);
}
void Unit::CancelSpellMissiles(uint32 spellId, bool reverseMissile /*= false*/)
{
EventList& eventList = m_Events.GetEventList();
bool hasMissile = false;
for (auto itr : eventList)
{
if (Spell const* spell = Spell::ExtractSpellFromEvent(itr.second))
{
if (spell->GetSpellInfo()->Id == spellId)
{
itr.second->ScheduleAbort();
hasMissile = true;
}
}
}
if (hasMissile)
{
WorldPackets::Spells::MissileCancel packet;
packet.OwnerGUID = GetGUID();
packet.SpellID = spellId;
packet.Reverse = reverseMissile;
SendMessageToSet(packet.Write(), false);
}
}
void Unit::ApplyResilience(Unit const* victim, int32* damage) const
{
// player mounted on multi-passenger mount is also classified as vehicle