Core/Vehicles: In CMSG_ATTACKSWING check if current vehicle seat flags permit attacking before updating standstate etc. Client also checks this.
Furthermore, removed incorrect vehicle_seat_flag_b definition and added an unknown vehicle_seat_flag that was found in the client.
This commit is contained in:
@@ -23,13 +23,15 @@
|
||||
#include "ObjectAccessor.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VehicleDefines.h"
|
||||
|
||||
void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
sLog->outStaticDebug("WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
|
||||
sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
|
||||
|
||||
Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid);
|
||||
|
||||
@@ -47,6 +49,20 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data)
|
||||
return;
|
||||
}
|
||||
|
||||
//! Client explicitly checks the following before sending CMSG_ATTACKSWING packet,
|
||||
//! so we'll place the same check here. Note that it might be possible to reuse this snippet
|
||||
//! in other places as well.
|
||||
if (Vehicle* vehicle = _player->GetVehicle())
|
||||
{
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(_player);
|
||||
ASSERT(seat);
|
||||
if (!(seat->m_flags & VEHICLE_SEAT_FLAG_CAN_ATTACK))
|
||||
{
|
||||
SendAttackStop(pEnemy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_player->Attack(pEnemy, true);
|
||||
}
|
||||
|
||||
@@ -55,7 +71,7 @@ void WorldSession::HandleAttackStopOpcode(WorldPacket & /*recv_data*/)
|
||||
GetPlayer()->AttackStop();
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetSheathedOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetSheathedOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 sheathed;
|
||||
recv_data >> sheathed;
|
||||
@@ -79,4 +95,3 @@ void WorldSession::SendAttackStop(Unit const* enemy)
|
||||
data << uint32(0); // unk, can be 1 also
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user