예제 #1
0
        public void Handle(NetworkClient Client, Hypercube Core)
        {
            Client.CS.CPEExtensions.Add(ExtName, Version);

            if (Client.CS.CPEExtensions.Keys.Count == Client.CS.Extensions)
            {
                CPE.CPEPackets(Client);
            }
        }
예제 #2
0
        public void Handle(NetworkClient Client, Hypercube Core)
        {
            Client.CS.LoginName = Name;
            Client.CS.MPPass    = MOTD;

            if (ProtocolVersion != 7)
            {
                Core.Logger._Log("Info", "Handshake", "Disconnecting client '" + Name + "'. Unsupported protocol verison (" + ProtocolVersion.ToString() + ")");

                var DisconnectPack = new Disconnect();
                DisconnectPack.Reason = "Unsupported protocol version.";
                DisconnectPack.Write(Client);
            }

            if (!Core.ClassicubeHeartbeat.VerifyClientName(Client))
            {
                Core.Logger._Log("Info", "Handshake", "Disconnecting client '" + Name + "'. Failed to verify name.");

                var DisconnectPack = new Disconnect();
                DisconnectPack.Reason = "Name verification incorrect.";
                DisconnectPack.Write(Client);
            }

            if (Libraries.Text.StringMatches(Name))
            {
                Core.Logger._Log("Info", "Handshake", "Disconnecting Client '" + Name + "'. Invalid characters in name.");

                var DisconnectPack = new Disconnect();
                DisconnectPack.Reason = "Invalid characters in name.";
                DisconnectPack.Write(Client);
            }

            if (Name == "")
            {
                Core.Logger._Log("Info", "Handshake", "Disconnecting Client '" + Name + "'. Invalid characters in name.");

                var DisconnectPack = new Disconnect();
                DisconnectPack.Reason = "Invalid characters in name.";
                DisconnectPack.Write(Client);
            }

            if (Core.OnlinePlayers > Core.nh.MaxPlayers)
            {
                var DisconnectPack = new Disconnect();
                DisconnectPack.Reason = "Server is full.";
                DisconnectPack.Write(Client);
            }

            Client.CS.MPPass     = MOTD;
            Client.CS.LastActive = System.DateTime.UtcNow;

            if (Usertype == 66)
            {
                // -- CPE Client
                Core.Logger._Log("Info", "Handshake", "CPE Client Detected.");
                Client.CS.CPE = true;
                CPE.CPEHandshake(Client);
            }
            else
            {
                // -- Normal Client.
                Client.CS.CPE = false;
                Client.Login();
            }
        }