public void Login(C.Login P) { if (Stage != GameStage.Login) { return; } MirDB.Login(P, this); }
public static void Login(C.Login P, MirConnection Con) { if (!Settings.AllowLogin) { Con.QueuePacket(new S.Login { Result = 1 }); return; } if (!AccountIDReg.IsMatch(P.AccountID)) { Con.QueuePacket(new S.Login { Result = 2 }); return; } if (!PasswordReg.IsMatch(P.Password)) { Con.QueuePacket(new S.Login { Result = 3 }); return; } AccountInfo TempAccount = GetAccount(P.AccountID); if (TempAccount == null) { Con.QueuePacket(new S.Login { Result = 4 }); return; } if (TempAccount.Banned) { if (TempAccount.ExpiryDate > DateTime.Now) { Con.QueuePacket(new S.LoginBanned { Reason = TempAccount.BanReason, ExpiryDate = TempAccount.ExpiryDate }); return; } else { TempAccount.Banned = false; TempAccount.BanReason = string.Empty; TempAccount.ExpiryDate = DateTime.MinValue; } } if (string.Compare(TempAccount.Password, P.Password, false) != 0) { Con.QueuePacket(new S.Login { Result = 5 }); return; } Network.Disconnect(TempAccount, 1); Con.QueuePacket(new S.LoginSuccess { CharacterList = TempAccount.GetSelectInfo() }); Con.Account = TempAccount; Con.Stage = GameStage.Select; }