Core/Handlers: fix bogus check that skipped CMSG_CAST_SPELL packet under certain conditions, missing a target change

Closes #21390
This commit is contained in:
ariel-
2018-02-14 23:11:38 -03:00
parent 93cbe815cb
commit a145a14166

View File

@@ -376,15 +376,6 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
return;
}
// Client is resending autoshot cast opcode when other spell is cast during shoot rotation
// Skip it to prevent "interrupt" message
if (spellInfo->IsAutoRepeatRangedSpell() && caster->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
&& caster->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
{
recvPacket.rfinish();
return;
}
// can't use our own spells when we're in possession of another unit,
if (_player->isPossessing())
{
@@ -397,6 +388,21 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
targets.Read(recvPacket, caster);
HandleClientCastFlags(recvPacket, castFlags, targets);
// Client is resending autoshot cast opcode when other spell is cast during shoot rotation
// Skip it to prevent "interrupt" message
// Also check targets! target may have changed and we need to interrupt current spell
if (spellInfo->IsAutoRepeatRangedSpell())
{
if (Spell* spell = caster->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL))
{
if (spell->m_spellInfo == spellInfo && spell->m_targets.GetUnitTargetGUID() == targets.GetUnitTargetGUID())
{
recvPacket.rfinish();
return;
}
}
}
// auto-selection buff level base at target level (in spellInfo)
if (targets.GetUnitTarget())
{