Fix channel packet format.

This commit is contained in:
Ray Koopa 2019-01-04 03:38:46 +01:00
parent 7e801057ac
commit b61f190df6
3 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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();