Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using DragonMose.LoginService.Config;
- using DragonMose.LoginService.Data.Version;
- using DragonMose.LoginService.Game.Account;
- using DragonMose.LoginService.Game.Version;
- using DragonMose.LoginService.GameNetwork.Handlers.Server;
- using DragonMose.LoginService.GameNetwork.Protocol.Client;
- using DragonMose.Networking.GameHandlerTypes;
- using System;
- namespace DragonMose.LoginService.GameNetwork.Handlers.Client
- {
- [GameHandlerClass(GameHandler03Type._Header)]
- public class CH03Handler
- {
- [GameHandler(typeof(CMSG_USER_CLIENT_VERSION_CHECK_REQ_GER))]
- public static void CMSG_USER_CLIENT_VERSION_CHECK_REQ_GER(LoginSession Session, CMSG_USER_CLIENT_VERSION_CHECK_REQ_GER PACKET)
- {
- if (LoginConfiguration.Instance.Info.AllowNewVersion &&
- !VersionDataProvider.GetVersionByHash(PACKET.Version, out VersionData Version) &&
- VersionManager.AddVersion(PACKET.Version, DateTime.Now))
- {
- return;
- }
- }
- [GameHandler(typeof(CMSG_USER_GER_LOGIN_REQ))]
- public static void CMSG_USER_GER_LOGIN_REQ(LoginSession Session, CMSG_USER_GER_LOGIN_REQ GER_LOGIN_PACKET)
- {
- if (!AccountManager.Instance.GetAccountByName(GER_LOGIN_PACKET.UserName, out LoginAccount Account))
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.INVALID_ID_OR_PW);
- return;
- }
- if (!Account.Password.Equals(GER_LOGIN_PACKET.Password))
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.INVALID_ID_OR_PW);
- return;
- }
- if (Account.IsOnline) //Detecting Dublicate...
- {
- if (AccountManager.Instance.GetSession(Account, out LoginSession Dub_Session))
- {
- SH03Handler.SMSG_USER_CONNECTION_CUT_CMD(Dub_Session);
- return;
- }
- else
- {
- InternalNetwork.Handlers.Server.SH03Handler.SMSG_ACCOUNT_LOGIN_DUBLICATE(Account);
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.LOGIN_FAILED);
- return;
- }
- }
- if (Session.Region != ClientRegion.DE)
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.WRONG_REGION);
- return;
- }
- if (!Account.IsActivated)
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.AGREEMENT_MISSING);
- return;
- }
- if (Account.IsBanned || Account.BanTime >= 0)
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.BLOCKED);
- return;
- }
- Session.Account = Account;
- if (!AccountManager.Instance.AddSession(Session))
- {
- InternalNetwork.Handlers.Server.SH03Handler.SMSG_ACCOUNT_LOGIN_DUBLICATE(Account);
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.LOGIN_FAILED);
- return;
- }
- if (!AccountManager.Instance.UpdateAccount(Account))
- {
- SH03Handler.SMSG_USER_LOGINFAIL_ACK(Session, AUTH_CODE.DATABASE_ERROR);
- return;
- }
- //All OK We Can Logget in...
- SH03Handler.SMSG_USER_LOGIN_ACK(Session);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement