aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Protocol
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-12-11 14:40:01 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2011-12-11 14:44:58 +0100
commitc7cdd786fef1491af670117fcc668ea0f153d353 (patch)
tree5d599ac9ade490833c302ae32da2634fa3a52621 /src/server/game/Server/Protocol
parent1e60e9ee8f191cc18184607aa81f882973caca7b (diff)
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.
Diffstat (limited to 'src/server/game/Server/Protocol')
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CombatHandler.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp b/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp
index 31a09e830ff..df375c80482 100755
--- a/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp
@@ -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);
}
-