aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/DataStores/DBCEnums.h4
-rwxr-xr-xsrc/server/game/Server/Protocol/Handlers/CombatHandler.cpp23
2 files changed, 21 insertions, 6 deletions
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index dcdc2b2ea0a..a13761d121f 100755
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -417,7 +417,7 @@ enum SummonPropFlags
enum VehicleSeatFlags
{
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
- VEHICLE_SEAT_FLAG_UNK11 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
+ VEHICLE_SEAT_FLAG_UNK1 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL = 0x00001000, // Can cast spells with SPELL_AURA_MOUNTED from seat (possibly 4.x only, 0 seats on 3.3.5a)
VEHICLE_SEAT_FLAG_UNCONTROLLED = 0x00002000, // can override !& VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT
@@ -425,6 +425,7 @@ enum VehicleSeatFlags
VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT = 0x02000000, // Lua_CanExitVehicle - can enter and exit at free will
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
+ VEHICLE_SEAT_FLAG_UNK2 = 0x40000000, // checked in conjunction with 0x800 in CastSpell2
};
enum VehicleSeatFlagsB
@@ -435,7 +436,6 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_EJECTABLE = 0x00000020, // ejectable
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
- VEHICLE_SEAT_FLAG_B_CANSWITCH = 0x04000000, // can switch seats
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
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);
}
-