[8403] Fixed cast spell opcode parsing for some cases with additional data.

This commit is contained in:
VladimirMangos 2009-08-22 04:44:51 +04:00
parent 38fa6b241c
commit 6ced2e979d
3 changed files with 30 additions and 1 deletions

View file

@ -289,7 +289,10 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// ignore for remote control state (for player case)
Unit* mover = _player->m_mover;
if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)
{
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",
spellId, cast_count, unk_flags, (uint32)recvPacket.size());
@ -299,6 +302,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if(!spellInfo)
{
sLog.outError("WORLD: unknown spell id %u", spellId);
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
@ -308,6 +312,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )
{
//cheater? kick? ban?
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
}
@ -317,6 +322,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) )
{
//cheater? kick? ban?
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
}
@ -324,7 +330,21 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// client provided targets
SpellCastTargets targets;
if(!targets.read(&recvPacket,mover))
{
recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet
return;
}
// some spell cast packet including more data (for projectiles?)
if (unk_flags & 0x02)
{
recvPacket.read_skip<float>(); // unk1, coords?
recvPacket.read_skip<float>(); // unk1, coords?
recvPacket.read_skip<uint8>(); // >> 1
recvPacket.read_skip<uint32>(); // >> MSG_MOVE_STOP
MovementInfo movementInfo;
ReadMovementInfo(recvPacket, &movementInfo);
}
// auto-selection buff level base at target level (in spellInfo)
if(targets.getUnitTarget())