예제 #1
0
        /// <summary>
        /// Client has entered their secondary password.
        /// </summary>
        /// <param name="packet"></param>
        void OnSecondaryLogin(PacketReader packet)
        {
            string accountName = packet.ReadUTF16();
            string password    = packet.ReadUTF16Safe();

            if (Account.SecondaryPassword != null && Account.SecondaryPassword != password)
            {
                //if ( FailedLoginAttemps == 3 )
                //{
                //    PacketGenerator.SecondaryPasswordResult( 3 );
                //}

                Send(PacketGenerator.SecondaryPassword(true, 0, false));
            }
            else
            {
                Send(PacketGenerator.SecondaryPasswordResult(0));
            }
        }
예제 #2
0
        /// <summary>
        /// Client attempts to login.
        /// </summary>
        /// <param name="packet"></param>
        void OnLogin(PacketReader packet)
        {
            string accountName = packet.ReadUTF16Safe();
            string password    = packet.ReadUTF8();

            Console.WriteLine(password);

            // Check if this account is already logged in.
            if (Server.Database.IsAccountOnline(accountName))
            {
                Send(PacketGenerator.Login(5, ""));     // Tell client account is already connected to lobby.

                return;
            }

            // Load the account.
            Account = Server.Database.GetAccount(accountName);
            if (Account == null)
            {
                Send(PacketGenerator.Login(1, ""));     // Tell client there is no account with the given name.

                return;
            }
            Server.Database.AssignAccountToSession(Key, Account.Name);

            // Get the keybindings associated with this account.
            string keybindings = Server.Database.GetKeybindings(accountName);

            // Send all the required data to the client to complete the login.
            Send(PacketGenerator.Login(0, accountName));
            if (keybindings != null)
            {
                Send(PacketGenerator.Keybindings(keybindings));
            }
            Send(PacketGenerator.CharacterLicenses(Account.MaxCharacters, Account.CharacterLicenses));
            Send(PacketGenerator.CharacterList(Account.Characters));
            Send(PacketGenerator.SecondaryPassword(Account.SecondaryPassword != null, 0, false));
        }