Merge pull request #66 from ccatgirl/master

Encode IP in OPEN_CONNECTION_REPLY_2 for RakNet compatibility
This commit is contained in:
enirboreHemaG 2025-07-13 19:26:54 +03:00 • committed by GitHub
commit 948340b399
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,12 @@
<?php
class RakNetCodec{
private static function encodeIPAddress(RakNetPacket $packet) {
$packet->buffer .= chr(4);
$packet->buffer .= Utils::writeInt($packet->ip);
$packet->buffer .= Utils::writeShort($packet->port);
}
public static function encode(RakNetPacket $packet){
if($packet->buffer != null && strlen($packet->buffer) > 0){
return;
@ -17,7 +23,7 @@ class RakNetCodec{
case RakNetInfo::OPEN_CONNECTION_REPLY_2:
$packet->buffer .= RakNetInfo::MAGIC;
$packet->buffer .= Utils::writeLong($packet->serverID);
$packet->buffer .= Utils::writeShort($packet->port);
static::encodeIPAddress($packet);
$packet->buffer .= Utils::writeShort($packet->mtuSize);
$packet->buffer .= chr(0); //Server security
break;