Merge branch 'main' into better-bitstream-tools

This commit is contained in:
Aaron Kimbre
2023-08-04 21:35:48 -05:00
38 changed files with 2379 additions and 703 deletions

View File

@@ -85,9 +85,13 @@ void AuthPackets::HandleHandshake(dServer* server, Packet* packet) {
void AuthPackets::SendHandshake(dServer* server, const SystemAddress& sysAddr, const std::string& nextServerIP, uint16_t nextServerPort, const ServerType serverType) {
RakNet::BitStream handshakeResponse;
BitstreamUtils::WriteHeader(handshakeResponse, eConnectionType::SERVER, eServerMessageType::VERSION_CONFIRM);
handshakeResponse.Write<uint32_t>(NET_VERSION);
uint32_t netVersion;
if (!GeneralUtils::TryParse(Game::config->GetValue("client_net_version"), netVersion)) {
Game::logger->Log("AuthPackets", "Failed to parse client_net_version. Cannot authenticate to %s:%i", nextServerIP.c_str(), nextServerPort);
return;
}
handshakeResponse.Write<uint32_t>(netVersion);
handshakeResponse.Write<uint32_t>(0); // Unused/Unknown/Padding
if (serverType == ServerType::Auth) handshakeResponse.Write(ServiceId::Auth);
else if (serverType == ServerType::World) handshakeResponse.Write(ServiceId::World);
else handshakeResponse.Write(ServiceId::General);