summaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/SpellHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 1ffdf10081..4b5bc5285f 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -15,6 +15,7 @@
#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
+#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
@@ -343,6 +344,8 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
uint8 castCount, castFlags;
recvPacket >> castCount >> spellId >> castFlags;
+ uint32 oldSpellId = spellId;
+
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got cast spell packet, castCount: %u, spellId: %u, castFlags: %u, data length = %u", castCount, spellId, castFlags, (uint32)recvPacket.size());
#endif
@@ -404,6 +407,11 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
}
}
+ sScriptMgr->ValidateSpellAtCastSpell(_player, oldSpellId, spellId, castCount, castFlags);
+
+ if (oldSpellId != spellId)
+ spellInfo = sSpellMgr->GetSpellInfo(spellId);
+
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
// Skip it to prevent "interrupt" message
if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
@@ -443,6 +451,9 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
}
Spell* spell = new Spell(mover, spellInfo, TRIGGERED_NONE, 0, false);
+
+ sScriptMgr->ValidateSpellAtCastSpellResult(_player, mover, spell, oldSpellId, spellId);
+
spell->m_cast_count = castCount; // set count of casts
spell->prepare(&targets);
}