Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/game/Object.cpp b/src/game/Object.cpp
- index 49c96f2..d48fef8 100644
- --- a/src/game/Object.cpp
- +++ b/src/game/Object.cpp
- @@ -600,8 +600,15 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2)
- // 0x80
- if(flags & UPDATEFLAG_VEHICLE) // unused for now
- {
- - *data << uint32(((Vehicle*)this)->GetVehicleId()); // vehicle id
- - *data << float(0); // facing adjustment
- + if(((Unit*)this)->GetVehicleGUID())
- + {
- + *data << uint32(((Vehicle*)this)->GetVehicleId()); // vehicle id
- + *data << float(0); // facing adjustment
- + }else
- + {
- + *data << uint32(0); // vehicle id
- + *data << float(0);
- + }
- }
- // 0x200
- diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
- index 1d9ce9a..2c7c452 100644
- --- a/src/game/Opcodes.cpp
- +++ b/src/game/Opcodes.cpp
- @@ -1214,12 +1214,12 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
- /*0x4A1*/ { "SMSG_SERVER_INFO_RESPONSE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4A2*/ { "CMSG_CHECK_LOGIN_CRITERIA", STATUS_NEVER, &WorldSession::Handle_NULL },
- /*0x4A3*/ { "SMSG_SERVER_BUCK_DATA_START", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- - /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS", STATUS_NEVER, &WorldSession::Handle_NULL },
- + /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },
- /*0x4A5*/ { "UMSG_UNKNOWN_1189", STATUS_NEVER, &WorldSession::Handle_NULL },
- /*0x4A6*/ { "SMSG_UNKNOWN_1190", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- - /*0x4A7*/ { "SMSG_UNKNOWN_1191", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- + /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4A8*/ { "CMSG_UNKNOWN_1192", STATUS_NEVER, &WorldSession::Handle_NULL },
- - /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_NEVER, &WorldSession::Handle_NULL },
- + /*0x4A9*/ { "CMSG_EJECT_PASSENGER", STATUS_LOGGEDIN, &WorldSession::HandleEjectPasenger },
- /*0x4AA*/ { "SMSG_PET_GUIDS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4AB*/ { "SMSG_CLIENTCACHE_VERSION", STATUS_NEVER, &WorldSession::Handle_ServerSide },
- /*0x4AC*/ { "UMSG_UNKNOWN_1196", STATUS_NEVER, &WorldSession::Handle_NULL },
- diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h
- index 537fea1..11c910a 100644
- --- a/src/game/Opcodes.h
- +++ b/src/game/Opcodes.h
- @@ -1225,7 +1225,7 @@ enum Opcodes
- CMSG_QUERY_VEHICLE_STATUS = 0x4A4, // not found
- UMSG_UNKNOWN_1189 = 0x4A5, // not found, old SMSG_PET_GUIDS
- SMSG_UNKNOWN_1190 = 0x4A6, // smsg unk, "You can't do that yet"
- - SMSG_UNKNOWN_1191 = 0x4A7, // smsg guid+uint32 (vehicle)
- + SMSG_PLAYER_VEHICLE_DATA = 0x4A7, // smsg guid+uint32 (vehicle)
- CMSG_UNKNOWN_1192 = 0x4A8, // cmsg uint64
- CMSG_EJECT_PASSENGER = 0x4A9, // cmsg uint64
- SMSG_PET_GUIDS = 0x4AA, // shifted+5
- diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp
- index e876e34..db857bc 100644
- --- a/src/game/Transports.cpp
- +++ b/src/game/Transports.cpp
- @@ -472,6 +472,10 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
- bool Transport::AddPassenger(Player* passenger)
- {
- + if(passenger->IsMounted())
- + passenger->Unmount();
- +
- +
- if (m_passengers.find(passenger) == m_passengers.end())
- {
- sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
- diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
- index dc763cf..4b83a7b 100644
- --- a/src/game/Unit.cpp
- +++ b/src/game/Unit.cpp
- @@ -9913,6 +9913,28 @@ void Unit::Mount(uint32 mount, uint32 spellId)
- }
- }
- }
- +
- + if(GetTypeId() == TYPEID_PLAYER && spellId != 0 )
- + {
- + if(VehicleEntry const *ve = sVehicleStore.LookupEntry(spellId))
- + {
- + CreateVehicleKit(spellId);
- + GetVehicleKit()->Reset();
- +
- + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size() +4);
- + data.appendPackGUID(GetGUID());
- + data << uint32(spellId);
- +
- + data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 0);
- + ((Player*)this)->GetSession()->SendPacket( &data );
- +
- +
- +
- + }
- +
- +
- + }
- +
- }
- void Unit::Unmount()
- @@ -9935,6 +9957,21 @@ void Unit::Unmount()
- else
- ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
- }
- +
- + if(GetTypeId() == TYPEID_PLAYER && isVehicle())
- + {
- + RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
- + GetVehicleKit()->Dismiss();
- + CreateVehicleKit(0);
- + RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
- + WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
- + data.appendPackGUID(GetGUID());
- +
- + data << uint32(0);
- + ((Player*) this)->SendMessageToSet( &data, true );
- +
- + }
- +
- }
- void Unit::SetInCombatWith(Unit* enemy)
- @@ -12982,7 +13019,18 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seat_id, bool force)
- pet->Remove(PET_SAVE_AS_CURRENT);
- if(GetTypeId() == TYPEID_PLAYER)
- - ((Player*)this)->SendEnterVehicle(v);
- + {
- + ((Player*)this)->SendEnterVehicle(v);
- +
- + WorldPacket data2 (SMSG_PLAYER_VEHICLE_DATA, vehicle->GetPackGUID().size() +4);
- + data2.append(vehicle->GetPackGUID());
- + data2 << uint32(vehicle->GetVehicleId());
- +
- + ((Player *)this)->GetSession()->SendPacket(&data2);
- +
- +
- + }
- +
- WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, 60);
- data.append(GetPackGUID());
- diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
- index dfe595f..db5d21e 100644
- --- a/src/game/WorldSession.h
- +++ b/src/game/WorldSession.h
- @@ -733,6 +733,8 @@ class MANGOS_DLL_SPEC WorldSession
- void HandleEquipmentSetDelete(WorldPacket& recv_data);
- void HandleEquipmentSetUse(WorldPacket& recv_data);
- void HandleWorldStateUITimerUpdate(WorldPacket& recv_data);
- + void HandleEjectPasenger(WorldPacket &data);
- +
- private:
- // private trade methods
- void moveItems(Item* myItems[], Item* hisItems[]);
- diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp
- index 837ba5c..e2774e2 100644
- --- a/src/game/WorldSocket.cpp
- +++ b/src/game/WorldSocket.cpp
- @@ -42,6 +42,7 @@
- #include "WorldSession.h"
- #include "WorldSocketMgr.h"
- #include "Log.h"
- +#include "Vehicle.h"
- #if defined( __GNUC__ )
- #pragma pack(1)
- @@ -1018,3 +1019,17 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
- packet << ping;
- return SendPacket (packet);
- }
- +
- +void WorldSession::HandleEjectPasenger(WorldPacket &data)
- +{
- + if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
- + {
- + if(Vehicle* Vv= _player->GetVehicleKit())
- + {
- + uint64 guid;
- + data >> guid;
- + if(Player* Pl=ObjectAccessor::FindPlayer(guid))
- + Pl->ExitVehicle();
- + }
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement