bool HandleSpawnMe(GameClient client, Direction direction, RawPacket packet) { // Automatically join a chat channel when logging in. _log.Info("Making client {0} join chat channel {1} with password {2}", client.EndPoint, ChatChannelName, ChatChannelPassword); using (var writer = new TeraBinaryWriter()) { writer.WriteUInt16((ushort)(PacketHeader.HeaderSize + sizeof(ushort) * 2)); writer.WriteUInt16(ChatChannelPassword); writer.WriteString(ChatChannelName); client.SendToServer(new RawPacket("C_JOIN_PRIVATE_CHANNEL") { Payload = writer.ToArray() }); } // Let's request an absurdly low visibility range. _log.Info("Setting visibility range for client {0} to {1}", client.EndPoint, VisibilityRange); client.SendToServer(new CSetVisibleRangePacket { Range = VisibilityRange }); return(true); }
public byte[] Serialize(Packet packet) { if (packet == null) { throw new ArgumentNullException(nameof(packet)); } packet.OnSerialize(this); using var writer = new TeraBinaryWriter(); OnSerialize(writer, packet); return(writer.ToArray()); }