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; } }
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; } }
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(); } }