Advertisement
Guest User

luffydu22

a guest
Jan 3rd, 2010
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.58 KB | None | 0 0
  1. diff --git a/src/game/Object.cpp b/src/game/Object.cpp
  2. index 49c96f2..d48fef8 100644
  3. --- a/src/game/Object.cpp
  4. +++ b/src/game/Object.cpp
  5. @@ -600,8 +600,15 @@ void Object::BuildMovementUpdate(ByteBuffer * data, uint16 flags, uint32 flags2)
  6.      // 0x80
  7.      if(flags & UPDATEFLAG_VEHICLE)                          // unused for now
  8.      {
  9. -        *data << uint32(((Vehicle*)this)->GetVehicleId());  // vehicle id
  10. -        *data << float(0);                                  // facing adjustment
  11. +       if(((Unit*)this)->GetVehicleGUID())
  12. +       {
  13. +           *data << uint32(((Vehicle*)this)->GetVehicleId());  // vehicle id
  14. +           *data << float(0);                                  // facing adjustment
  15. +       }else
  16. +       {
  17. +           *data << uint32(0); // vehicle id
  18. +           *data << float(0);
  19. +       }
  20.      }
  21.  
  22.      // 0x200
  23. diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
  24. index 1d9ce9a..2c7c452 100644
  25. --- a/src/game/Opcodes.cpp
  26. +++ b/src/game/Opcodes.cpp
  27. @@ -1214,12 +1214,12 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
  28.      /*0x4A1*/ { "SMSG_SERVER_INFO_RESPONSE",                    STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  29.      /*0x4A2*/ { "CMSG_CHECK_LOGIN_CRITERIA",                    STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  30.      /*0x4A3*/ { "SMSG_SERVER_BUCK_DATA_START",                  STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  31. -    /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS",                    STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  32. +    /*0x4A4*/ { "CMSG_QUERY_VEHICLE_STATUS",                    STATUS_LOGGEDIN, &WorldSession::Handle_NULL                     },
  33.      /*0x4A5*/ { "UMSG_UNKNOWN_1189",                            STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  34.      /*0x4A6*/ { "SMSG_UNKNOWN_1190",                            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  35. -    /*0x4A7*/ { "SMSG_UNKNOWN_1191",                            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  36. +    /*0x4A7*/ { "SMSG_PLAYER_VEHICLE_DATA",                     STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  37.      /*0x4A8*/ { "CMSG_UNKNOWN_1192",                            STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  38. -    /*0x4A9*/ { "CMSG_EJECT_PASSENGER",                         STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  39. +    /*0x4A9*/ { "CMSG_EJECT_PASSENGER",                         STATUS_LOGGEDIN, &WorldSession::HandleEjectPasenger             },
  40.      /*0x4AA*/ { "SMSG_PET_GUIDS",                               STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  41.      /*0x4AB*/ { "SMSG_CLIENTCACHE_VERSION",                     STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
  42.      /*0x4AC*/ { "UMSG_UNKNOWN_1196",                            STATUS_NEVER,    &WorldSession::Handle_NULL                     },
  43. diff --git a/src/game/Opcodes.h b/src/game/Opcodes.h
  44. index 537fea1..11c910a 100644
  45. --- a/src/game/Opcodes.h
  46. +++ b/src/game/Opcodes.h
  47. @@ -1225,7 +1225,7 @@ enum Opcodes
  48.      CMSG_QUERY_VEHICLE_STATUS                       = 0x4A4, // not found
  49.      UMSG_UNKNOWN_1189                               = 0x4A5, // not found, old SMSG_PET_GUIDS
  50.      SMSG_UNKNOWN_1190                               = 0x4A6, // smsg unk, "You can't do that yet"
  51. -    SMSG_UNKNOWN_1191                               = 0x4A7, // smsg guid+uint32 (vehicle)
  52. +    SMSG_PLAYER_VEHICLE_DATA                        = 0x4A7, // smsg guid+uint32 (vehicle)
  53.      CMSG_UNKNOWN_1192                               = 0x4A8, // cmsg uint64
  54.      CMSG_EJECT_PASSENGER                            = 0x4A9, // cmsg uint64
  55.      SMSG_PET_GUIDS                                  = 0x4AA, // shifted+5
  56. diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp
  57. index e876e34..db857bc 100644
  58. --- a/src/game/Transports.cpp
  59. +++ b/src/game/Transports.cpp
  60. @@ -472,6 +472,10 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
  61.  
  62.  bool Transport::AddPassenger(Player* passenger)
  63.  {
  64. +   if(passenger->IsMounted())
  65. +       passenger->Unmount();
  66. +
  67. +
  68.      if (m_passengers.find(passenger) == m_passengers.end())
  69.      {
  70.          sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
  71. diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
  72. index dc763cf..4b83a7b 100644
  73. --- a/src/game/Unit.cpp
  74. +++ b/src/game/Unit.cpp
  75. @@ -9913,6 +9913,28 @@ void Unit::Mount(uint32 mount, uint32 spellId)
  76.              }
  77.          }
  78.      }
  79. +
  80. +   if(GetTypeId() == TYPEID_PLAYER && spellId != 0 )
  81. +   {
  82. +       if(VehicleEntry const *ve  = sVehicleStore.LookupEntry(spellId))
  83. +       {
  84. +           CreateVehicleKit(spellId);
  85. +           GetVehicleKit()->Reset();
  86. +
  87. +           WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size() +4);
  88. +           data.appendPackGUID(GetGUID());
  89. +           data << uint32(spellId);
  90. +
  91. +           data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 0);
  92. +           ((Player*)this)->GetSession()->SendPacket( &data );
  93. +
  94. +
  95. +
  96. +       }
  97. +
  98. +
  99. +   }
  100. +
  101.  }
  102.  
  103.  void Unit::Unmount()
  104. @@ -9935,6 +9957,21 @@ void Unit::Unmount()
  105.          else
  106.              ((Player*)this)->ResummonPetTemporaryUnSummonedIfAny();
  107.      }
  108. +
  109. +   if(GetTypeId() == TYPEID_PLAYER && isVehicle())
  110. +   {
  111. +       RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE);
  112. +       GetVehicleKit()->Dismiss();
  113. +       CreateVehicleKit(0);
  114. +       RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
  115. +       WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, 8+4);
  116. +       data.appendPackGUID(GetGUID());
  117. +
  118. +       data << uint32(0);
  119. +       ((Player*) this)->SendMessageToSet( &data, true );
  120. +
  121. +   }
  122. +
  123.  }
  124.  
  125.  void Unit::SetInCombatWith(Unit* enemy)
  126. @@ -12982,7 +13019,18 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seat_id, bool force)
  127.          pet->Remove(PET_SAVE_AS_CURRENT);
  128.  
  129.      if(GetTypeId() == TYPEID_PLAYER)
  130. -        ((Player*)this)->SendEnterVehicle(v);
  131. +   {
  132. +       ((Player*)this)->SendEnterVehicle(v);
  133. +
  134. +       WorldPacket data2 (SMSG_PLAYER_VEHICLE_DATA, vehicle->GetPackGUID().size() +4);
  135. +       data2.append(vehicle->GetPackGUID());
  136. +       data2 << uint32(vehicle->GetVehicleId());
  137. +
  138. +       ((Player *)this)->GetSession()->SendPacket(&data2);
  139. +
  140. +
  141. +   }
  142. +  
  143.  
  144.      WorldPacket data(SMSG_MONSTER_MOVE_TRANSPORT, 60);
  145.      data.append(GetPackGUID());
  146. diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
  147. index dfe595f..db5d21e 100644
  148. --- a/src/game/WorldSession.h
  149. +++ b/src/game/WorldSession.h
  150. @@ -733,6 +733,8 @@ class MANGOS_DLL_SPEC WorldSession
  151.          void HandleEquipmentSetDelete(WorldPacket& recv_data);
  152.          void HandleEquipmentSetUse(WorldPacket& recv_data);
  153.          void HandleWorldStateUITimerUpdate(WorldPacket& recv_data);
  154. +       void HandleEjectPasenger(WorldPacket &data);
  155. +
  156.      private:
  157.          // private trade methods
  158.          void moveItems(Item* myItems[], Item* hisItems[]);
  159. diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp
  160. index 837ba5c..e2774e2 100644
  161. --- a/src/game/WorldSocket.cpp
  162. +++ b/src/game/WorldSocket.cpp
  163. @@ -42,6 +42,7 @@
  164.  #include "WorldSession.h"
  165.  #include "WorldSocketMgr.h"
  166.  #include "Log.h"
  167. +#include "Vehicle.h"
  168.  
  169.  #if defined( __GNUC__ )
  170.  #pragma pack(1)
  171. @@ -1018,3 +1019,17 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
  172.      packet << ping;
  173.      return SendPacket (packet);
  174.  }
  175. +
  176. +void WorldSession::HandleEjectPasenger(WorldPacket &data)
  177. +{
  178. +   if(data.GetOpcode()==CMSG_EJECT_PASSENGER)
  179. +   {
  180. +       if(Vehicle* Vv= _player->GetVehicleKit())
  181. +       {
  182. +           uint64 guid;
  183. +           data >> guid;
  184. +           if(Player* Pl=ObjectAccessor::FindPlayer(guid))
  185. +               Pl->ExitVehicle();
  186. +       }
  187. +   }
  188. +}
  189. \ No newline at end of file
  190.  
  191.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement