Exemple #1
0
        public static void SendWelcome(INetUser client)
        {
            using (var packet = new NetPacket())
            {
                packet.Write((uint)ISCPacketType.WELCOME);

                client.Send(packet);
            }
        }
        /// <summary>
        /// Sends a login error.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="error"></param>
        public static void SendLoginError(INetUser client, ErrorType error)
        {
            using (var packet = new FFPacket())
            {
                packet.WriteHeader(PacketType.ERROR);
                packet.Write((int)error);

                client.Send(packet);
            }
        }
        /// <summary>
        /// Send a pong response to the client.
        /// </summary>
        /// <param name="client">Client</param>
        /// <param name="time">Current time</param>
        public static void SendPong(INetUser client, int time)
        {
            using (var packet = new FFPacket())
            {
                packet.WriteHeader(PacketType.PING);
                packet.Write(time);

                client.Send(packet);
            }
        }
        /// <summary>
        /// Send a welcome packet to the client.
        /// </summary>
        /// <param name="client">Client</param>
        /// <param name="sessionId">Session id</param>
        public static void SendWelcome(INetUser client, uint sessionId)
        {
            using (var packet = new FFPacket())
            {
                packet.WriteHeader(PacketType.WELCOME);
                packet.Write(sessionId);

                client.Send(packet);
            }
        }
Exemple #5
0
        public static void SendAuthenticationResult(INetUser client, ISCPacketCode result)
        {
            using (var packet = new NetPacket())
            {
                packet.Write((uint)ISCPacketType.AUTHENT_RESULT);
                packet.Write((uint)result);

                client.Send(packet);
            }
        }
Exemple #6
0
        /// <summary>
        /// Send an authentication request to the ISCServer.
        /// </summary>
        /// <param name="client">client connection</param>
        /// <param name="id">Server Id</param>
        /// <param name="host">Server Host</param>
        /// <param name="name">Server name</param>
        public static void SendAuthentication(INetUser client, int id, string host, string name)
        {
            using (var packet = new NetPacket())
            {
                packet.Write((uint)ISCPacketType.AUTHENT);
                packet.Write(id);
                packet.Write(host);
                packet.Write(name);
                packet.Write((byte)ISCServerType.Cluster);

                client.Send(packet);
            }
        }
Exemple #7
0
        public static void SendUpdateWorldList(INetUser client, IEnumerable <WorldServerInfo> worldServers)
        {
            using (var packet = new NetPacket())
            {
                packet.Write((uint)ISCPacketType.UPDATE_CLUSTER_WORLDS_LIST);
                packet.Write(worldServers.Count());

                foreach (var world in worldServers)
                {
                    packet.Write(world.Id);
                    packet.Write(world.Host);
                    packet.Write(world.Name);
                    packet.Write(world.ParentClusterId);
                }

                client.Send(packet);
            }
        }
        /// <summary>
        /// Sends the available server list.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="username"></param>
        /// <param name="clusters"></param>
        public static void SendServerList(INetUser client, string username, IEnumerable <ClusterServerInfo> clusters)
        {
            using (var packet = new FFPacket())
            {
                packet.WriteHeader(PacketType.SRVR_LIST);
                packet.Write(0);
                packet.Write <byte>(1);
                packet.Write(username);
                packet.Write(clusters.Sum(x => x.WorldServers.Count) + clusters.Count());

                foreach (ClusterServerInfo cluster in clusters)
                {
                    packet.Write(-1);
                    packet.Write(cluster.Id);
                    packet.Write(cluster.Name);
                    packet.Write(cluster.Host);
                    packet.Write(0);
                    packet.Write(0);
                    packet.Write(1);
                    packet.Write(0);

                    foreach (WorldServerInfo world in cluster.WorldServers)
                    {
                        packet.Write(cluster.Id);
                        packet.Write(world.Id);
                        packet.Write(world.Name);
                        packet.Write(world.Host);
                        packet.Write(0);
                        packet.Write(0);
                        packet.Write(1);
                        packet.Write(100); // Capacity
                    }
                }

                client.Send(packet);
            }
        }