示例#1
0
 public void CheckAccount(byte platform, string account, string pwd, string param)
 {
     m_LoginMsg           = new CS_Login();
     m_LoginMsg.m_account = account;
     m_LoginMsg.m_pwd     = pwd;
     CGameProcedure.SetProcedureStatus((int)LoginStatus.Login);
 }
    public void OnLogin()
    {
        string   name = LoginCtrl.instance.inputName;
        CS_Login msg  = new CS_Login();

        msg.name = name;
        SessionManager.instance.Send(msg);
    }
示例#3
0
    public void Login(string id, string name)
    {
        var cs = new CS_Login()
        {
            Id   = id,
            Name = name
        };

        Send("Login", cs);
    }
示例#4
0
        private async Task Handle_CS_Login(SocketEx clientSocket, CS_Login packet)
        {
            clients.Add(new UserSocketData(packet.UserName, clientSocket));

            await clientSocket.SendMessageAsync(new SC_LoginAllow
            {
                Allow = true,
            });

            await clients.Where(x => x.Socket.Connected)
            .ForEachParallelAsync(async x =>
            {
                await x.Socket.SendMessageAsync(new SC_System
                {
                    Data = $"{packet.UserName}님이 로그인했습니다.",
                });
            });
        }
示例#5
0
        /// <summary>
        /// Handles the servers's state packet
        /// </summary>
        static public void Handle_SC_State(SC_State pkt, Client client)
        {       //Consider the connection started now, time to send our login info..
            InfClient c = ((client as Client <InfClient>)._obj);

            c._syncStart.Set();

            CS_Login login = new CS_Login();

            //Lets put some bogus stuff together...
            login.bCreateAlias = false;
            login.UID1         = 99999;
            login.UID2         = 99999;
            login.UID3         = 99999;
            login.NICInfo      = 4;
            login.SysopPass    = "";
            login.Username     = "******";
            login.Version      = (ushort)154;
            login.TicketID     = "3bd5c3e9-8bea-43b8-946e-40263f8a039a";

            //Send it!
            client.send(login);
        }
示例#6
0
        /// <summary>
        /// Handles the servers's state packet
        /// </summary>
        static public void Handle_SC_State(SC_State pkt, Client client)
        {       //Consider the connection started now, time to send our login info..
            GameClient c = ((client as Client <GameClient>)._obj);

            c._syncStart.Set();

            CS_Login login = new CS_Login();

            //Lets put some bogus stuff together...
            login.bCreateAlias = false;
            login.UID1         = 99999;
            login.UID2         = 99999;
            login.UID3         = 99999;
            login.NICInfo      = 4;
            login.SysopPass    = "";
            login.Username     = c._player._alias;
            login.Version      = (ushort)154;
            login.TicketID     = c._player._ticketid;

            //Send it!
            client.send(login);
        }
示例#7
0
        /// <summary>
        /// Handles the login request packet sent by the client
        /// </summary>
        static public void Handle_CS_Login(CS_Login pkt, Client <Player> client)
        {               //Let's escalate our client's status to player!
            ZoneServer server = (client._handler as ZoneServer);

            // check for excessive joins to zone from same IP
            if (pkt.bCreateAlias != true && server._connections.ContainsKey(client._ipe.Address))
            {
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Please wait 10 seconds before logging in again.");
                Log.write(TLog.Warning, "Possible throttler removed: {0}", client._ipe.ToString());
                return;
            }
            else if (!server._connections.ContainsKey(client._ipe.Address))
            {
                server._connections.Add(client._ipe.Address, DateTime.Now.AddSeconds(10));
            }

            //Check their client version and UIDs
            //TODO: find out what the UIDs are and what an invalid UID might look like, and reject spoofed ones
            if (pkt.Version != Helpers._serverVersion ||
                pkt.UID1 <= 10000 ||
                pkt.UID2 <= 10000 ||
                pkt.UID3 <= 10000)
            {
                Log.write(TLog.Warning, "Suspicious login packet from {0} : Version ({1}) UID1({2}) UID2({3}) UID3({4})",
                          pkt.Username,
                          pkt.Version,
                          pkt.UID1,
                          pkt.UID2,
                          pkt.UID3);
            }

            String alias = pkt.Username;

            //Check alias for illegal characters
            if (String.IsNullOrWhiteSpace(alias))
            {
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Alias cannot be blank.");
                return;
            }
            try
            { //Temporary till we find the login bug
                if (!char.IsLetterOrDigit(alias, 0) ||
                    char.IsWhiteSpace(alias, 0) ||
                    char.IsWhiteSpace(alias, alias.Length - 1) ||
                    alias != Logic_Text.RemoveIllegalCharacters(alias))
                {   //Boot him..
                    Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Alias contains illegal characters, must start with a letter or number and cannot end with a space.");
                    return;
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                Log.write(TLog.Warning, "Player login name is {0}", alias);
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Alias contains illegal characters, must start with a letter or number and cannot end with a space.");
                return;
            }

            if (alias.Length > 64)
            {
                //Change this if alias.name in the db is changed.. currently at varchar(64)
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Alias length is too long.");
                return;
            }

            //Are we in permission mode?
            if (server._config["server/permitMode"].boolValue && !Logic_Permit.checkPermit(alias))
            {
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Zone is in permission only mode.");
                return;
            }

            Player newPlayer = server.newPlayer(client, alias);

            //If it failed for some reason, present a failure message
            if (newPlayer == null)
            {
                Helpers.Login_Response(client, SC_Login.Login_Result.Failed, "Login Failure, Zone is full.");
                Log.write(TLog.Error, "New player is null possibly due to zone being full.");
                return;
            }

            newPlayer._UID1 = pkt.UID1;
            newPlayer._UID2 = pkt.UID2;
            newPlayer._UID3 = pkt.UID3;


            //Are we in standalone mode?
            if (server.IsStandalone)
            {                   //Always first time setup in standalone mode
                newPlayer.assignFirstTimeStats(false);

                //Success! Let him in.
                Helpers.Login_Response(client, SC_Login.Login_Result.Success, "This server is currently in stand-alone mode. Your character's scores and stats will not be saved.");
            }
            else
            {                   //Defer the request to the database server
                CS_PlayerLogin <Data.Database> plogin = new CS_PlayerLogin <Data.Database>();

                plogin.bCreateAlias = pkt.bCreateAlias;

                plogin.player    = newPlayer.toInstance();
                plogin.alias     = alias;
                plogin.ticketid  = pkt.TicketID;
                plogin.UID1      = pkt.UID1;
                plogin.UID2      = pkt.UID2;
                plogin.UID3      = pkt.UID3;
                plogin.NICInfo   = pkt.NICInfo;
                plogin.ipaddress = pkt._client._ipe.Address.ToString().Trim();

                server._db.send(plogin);
            }
        }
示例#8
0
 public void Login(CS_Login cs)
 {
     _mainService.Login(Context.ConnectionId, cs.Id, cs.Name);
 }
示例#9
0
 public async Task Handle_CS_Login(CS_Login packet)
 {
     _user = new User(packet.UserName, _clientSocket);
     await _lobby.EnterUserAsync(_user);
 }