mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-04-05 08:59:06 +03:00
Fix channel packet format.
This commit is contained in:
parent
7e801057ac
commit
b61f190df6
@ -128,6 +128,10 @@ namespace Syroot.Worms.OnlineWorms.Server
|
||||
|
||||
public void HandleChannelConnect(ChannelConnectQuery packet)
|
||||
{
|
||||
SendPacket(new RawPacket(PacketType.Channel, 0x11)
|
||||
{
|
||||
Data = new byte[] { 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }
|
||||
});
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
@ -140,8 +140,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net
|
||||
throw new IOException("Invalid channel packet start tag.");
|
||||
dataSize = _receiveStream.ReadUInt16();
|
||||
id = _receiveStream.Read1Byte();
|
||||
_receiveStream.ReadAll(_receiveBuffer, 0, dataSize - sizeof(byte));
|
||||
_ = _receiveStream.Read1Byte(); // ?
|
||||
_receiveStream.ReadAll(_receiveBuffer, 0, dataSize);
|
||||
ushort endTag = _receiveStream.ReadUInt16();
|
||||
if (endTag != _channelPacketEndTag)
|
||||
throw new IOException("Invalid channel packet end tag.");
|
||||
@ -183,8 +182,8 @@ namespace Syroot.Worms.OnlineWorms.Server.Net
|
||||
_receiveStream.WriteUInt16(_channelPacketStartTag);
|
||||
_receiveStream.WriteByte(1);
|
||||
_receiveStream.WriteUInt16(dataSize);
|
||||
_receiveStream.WriteByte((byte)attribute.PacketID);
|
||||
_receiveStream.Write(_sendDataBuffer, 0, dataSize);
|
||||
_receiveStream.WriteByte(0); // ?
|
||||
_receiveStream.Write(_channelPacketEndTag);
|
||||
break;
|
||||
case PacketType.Server:
|
||||
@ -193,7 +192,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net
|
||||
_receiveStream.Write(_sendDataBuffer, 0, dataSize);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException("Cannot send unknown packet type.");
|
||||
throw new IOException("Cannot send unknown packet type.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ namespace Syroot.Worms.OnlineWorms.Server.Net
|
||||
|
||||
public ushort UnknownA { get; set; } // Always 1?
|
||||
|
||||
public byte UnknownB { get; set; }
|
||||
|
||||
// ---- METHODS (INTERNAL) -------------------------------------------------------------------------------------
|
||||
|
||||
internal override void Deserialize(PacketStream stream)
|
||||
@ -46,6 +48,7 @@ namespace Syroot.Worms.OnlineWorms.Server.Net
|
||||
Password = stream.ReadString(12)
|
||||
});
|
||||
}
|
||||
UnknownB = stream.Read1Byte();
|
||||
}
|
||||
|
||||
internal override void Serialize(PacketStream stream) => throw new NotImplementedException();
|
||||
|
Loading…
x
Reference in New Issue
Block a user