[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

@ -234,7 +234,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
} }
if (!MaNGOS::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o)) if (!MaNGOS::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return; return;
}
/* handle special cases */ /* handle special cases */
if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) if (movementInfo.HasMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
@ -242,11 +245,17 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
// transports size limited // transports size limited
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped) // (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
if( movementInfo.t_x > 50 || movementInfo.t_y > 50 || movementInfo.t_z > 50 ) if( movementInfo.t_x > 50 || movementInfo.t_y > 50 || movementInfo.t_z > 50 )
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return; return;
}
if( !MaNGOS::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y + movementInfo.t_y, if( !MaNGOS::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y + movementInfo.t_y,
movementInfo.z + movementInfo.t_z, movementInfo.o + movementInfo.t_o) ) movementInfo.z + movementInfo.t_z, movementInfo.o + movementInfo.t_o) )
{
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
return; return;
}
// if we boarded a transport, add us to it // if we boarded a transport, add us to it
if (plMover && !plMover->m_transport) if (plMover && !plMover->m_transport)

View file

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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8402" #define REVISION_NR "8403"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__