Ejemplo n.º 1
0
        public static AccountModel Load(int accountId)
        {
            lock (SQLManager.Locker)
            {
                AccountModel account = null;
                MySqlDataReader reader = SQLManager.ExecuteQuery("SELECT * FROM {0} WHERE id='{1}'", AccountModel.TABLE, accountId);

                if (reader.Read())
                {
                    account = new AccountModel(reader);
                }
                reader.Close();
                return account;
            }
        }
Ejemplo n.º 2
0
        public static AccountModel Load(string username)
        {
            lock (SQLManager.Locker)
            {
                AccountModel account = null;
                MySqlDataReader reader = SQLManager.ExecuteQuery("SELECT * FROM {0} WHERE username='******'", AccountModel.TABLE, username);

                if (reader.Read())
                {
                    account = new AccountModel(reader);
                }
                reader.Close();

                if (account != null)
                {
                    account.Characters = CharactersTable.LoadFromAccount(account.Id);
                }
                return account;
            }
        }
Ejemplo n.º 3
0
        private void ValidAccount(AccountModel account, bool autoconnect)
        {
            client.Account = account;
            IdentificationSuccessMessage succesMessage = new IdentificationSuccessMessage
                {
                    HasRights = true,
                    WasAlreadyConnected = false,
                    Login = account.Username,
                    Nickname = account.Nickname,
                    AccountId = account.Id,
                    CommunityId = 1,
                    SecretQuestion = account.SecretQuestion,
                    AccountCreation = 0,
                    SubscriptionEndDate = 1
                };
            client.Send(succesMessage);

            if (!(autoconnect && servers.SelectServer(client.Account.LastServer)))
            {
                client.State = AuthClientStateEnum.SERVER_LIST;
                servers.SendServerList();
            }
        }