public override void Process(Level level) { if (!Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]) || Client.CState == 0) { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); PacketManager.ProcessOutgoingPacket(p); return; } /* var versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); if (versionData.Length >= 2) { var cv = ClientVersion.Split('.'); if (cv[0] != versionData[0] || cv[1] != versionData[1]) { var p = new LoginFailedMessage(Client); p.SetErrorCode(8); p.SetUpdateURL(Convert.ToString(ConfigurationManager.AppSettings["UpdateUrl"])); PacketManager.ProcessOutgoingPacket(p); return; } } else { Debugger.WriteLine("[UCR][10101] Connection failed. UCR config key clientVersion is not properly set."); } */ level = ResourcesManager.GetPlayer(UserID); if (level != null) { if (level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } else { level = ObjectManager.CreateAvatar(UserID); var tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); using (SHA1 sha = new SHA1CryptoServiceProvider()) UserToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-", string.Empty); } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) if (MasterHash != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL("http://www.ultrapowa.com/client"); PacketManager.ProcessOutgoingPacket(p); return; } Client.ClientSeed = Unknown; ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(UserToken); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(10); loginOk.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode(Language); PacketManager.ProcessOutgoingPacket(loginOk); /* var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance == null) level.GetPlayerAvatar().SetAllianceId(0); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); */ }
public override void Process(Level level) { try { if (m_vMaintance) { Console.WriteLine("Hi"); } if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceProMode"])) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["adminSpecialMode"])) { level = ResourcesManager.GetPlayer(m_vAccountId); if (level != null && level.GetAccountPrivileges() > 3) { } else { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); p.RemainingTime(0); p.SetReason(ConfigurationManager.AppSettings["maintenanceProMessage"]); PacketManager.ProcessOutgoingPacket(p); return; } } else { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); p.RemainingTime(0); p.SetReason(ConfigurationManager.AppSettings["maintenanceProMessage"]); PacketManager.ProcessOutgoingPacket(p); return; } } if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"])) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["adminSpecialMode"])) { level = ResourcesManager.GetPlayer(m_vAccountId); if (level != null && level.GetAccountPrivileges() > 3) { } else { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); p.RemainingTime(Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeLeft"])); PacketManager.ProcessOutgoingPacket(p); return; } } else { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); p.RemainingTime(Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeLeft"])); PacketManager.ProcessOutgoingPacket(p); return; } } var versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); if (versionData.Length >= 2) { if (m_vClientMajorVersion != Convert.ToInt32(versionData[0]) || m_vClientBuild != Convert.ToInt32(versionData[1])) { var p = new LoginFailedMessage(Client); p.SetErrorCode(8); p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]); PacketManager.ProcessOutgoingPacket(p); return; } } else { Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set."); } level = ResourcesManager.GetPlayer(m_vAccountId); if (level != null) { if (level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { if (m_vResourceSha != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]); PacketManager.ProcessOutgoingPacket(p); return; } } Client.ClientSeed = m_vClientSeed; PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(Client)); Debugger.WriteLine("[M] Retrieve Player Data for player " + m_vAccountId, null, 5); //New player if (level == null) { level = ObjectManager.CreateAvatar(m_vAccountId); var tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); SHA1 sha = new SHA1CryptoServiceProvider(); m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-", ""); } if (level.GetAccountPrivileges() == 1) { level.GetPlayerAvatar().SetLeagueId(12); } if (level.GetAccountPrivileges() == 2) { level.GetPlayerAvatar().SetLeagueId(15); } if (level.GetAccountPrivileges() == 3) { level.GetPlayerAvatar().SetLeagueId(18); } if (level.GetAccountPrivileges() == 4) { level.GetPlayerAvatar().SetLeagueId(21); } if (level.GetAccountPrivileges() == 5) { level.GetPlayerAvatar().SetLeagueId(22); } ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(m_vPassToken); loginOk.SetServerMajorVersion(m_vClientMajorVersion); loginOk.SetServerBuild(m_vClientBuild); loginOk.SetContentVersion(m_vClientContentVersion); loginOk.SetServerEnvironment("dev"); loginOk.SetDaysSinceStartedPlaying(21222); loginOk.SetPlayTimeSeconds(62072000); //loginOk.SetFacebookId("100001230452744"); //loginOk.SetGamecenterId(""); loginOk.SetServerTime( Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds *1000) .ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode("US"); PacketManager.ProcessOutgoingPacket(loginOk); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance == null) { level.GetPlayerAvatar().SetAllianceId(0); } PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); if (alliance != null) { PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance)); } if (ResourcesManager.IsPlayerOnline(level)) { var mail = new AllianceMailStreamEntry(); mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); mail.SetSenderId(0); mail.SetSenderAvatarId(0); mail.SetSenderName("System Manager"); mail.SetIsNew(0); mail.SetAllianceId(0); mail.SetSenderLeagueId(22); mail.SetAllianceBadgeData(1728059989); mail.SetAllianceName("System Bot"); mail.SetMessage(ConfigurationManager.AppSettings["welcomeMessage"]); mail.SetSenderLevel(500); var p = new AvatarStreamEntryMessage(level.GetClient()); p.SetAvatarStreamEntry(mail); PacketManager.ProcessOutgoingPacket(p); } } catch { var p = new LoginFailedMessage(Client); p.SetErrorCode(9); p.SetRedirectDomain(ConfigurationManager.AppSettings["failSafe"]); PacketManager.ProcessOutgoingPacket(p); } }
public override void Process(Level level) { if (!Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]) || Client.CState == 0) { var p = new LoginFailedMessage(Client); p.SetErrorCode(10); PacketManager.ProcessOutgoingPacket(p); return; } /* * var versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); * if (versionData.Length >= 2) * { * var cv = ClientVersion.Split('.'); * if (cv[0] != versionData[0] || cv[1] != versionData[1]) * { * var p = new LoginFailedMessage(Client); * p.SetErrorCode(8); * p.SetUpdateURL(Convert.ToString(ConfigurationManager.AppSettings["UpdateUrl"])); * PacketManager.ProcessOutgoingPacket(p); * return; * } * } * else * { * Debugger.WriteLine("[UCR][10101] Connection failed. UCR config key clientVersion is not properly set."); * } */ level = ResourcesManager.GetPlayer(UserID); if (level != null) { if (level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } else { level = ObjectManager.CreateAvatar(UserID); var tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); using (SHA1 sha = new SHA1CryptoServiceProvider()) UserToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-", string.Empty); } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { if (MasterHash != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL("http://www.ultrapowa.com/client"); PacketManager.ProcessOutgoingPacket(p); return; } } Client.ClientSeed = Unknown; ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(UserToken); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(10); loginOk.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode(Language); PacketManager.ProcessOutgoingPacket(loginOk); /* * var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); * if (alliance == null) * level.GetPlayerAvatar().SetAllianceId(0); * * PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); */ }
public override void Process(Level level) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(10); PacketManager.ProcessOutgoingPacket(p); return; } string[] versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); if(versionData.Length >= 2) { if(m_vClientMajorVersion != Convert.ToInt32(versionData[0]) || m_vClientBuild != Convert.ToInt32(versionData[1])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(8); p.SetUpdateURL("http://www.ultrapowa.com/"); PacketManager.ProcessOutgoingPacket(p); return; } } else { Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set."); } level = ResourcesManager.GetPlayer(m_vAccountId); if(level != null) { if(level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } if(Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { if (m_vResourceSha != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL("http://www.ultrapowa.com/"); PacketManager.ProcessOutgoingPacket(p); return; } } this.Client.ClientSeed = m_vClientSeed; PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(this.Client)); Debugger.WriteLine("[D] Retrieve Player Data for player " + m_vAccountId); Console.ResetColor(); //New player if (level == null) { level = ObjectManager.CreateAvatar(m_vAccountId); byte[] tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); SHA1 sha = new SHA1CryptoServiceProvider(); m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-",""); } if (level.GetAccountPrivileges() > 0) level.GetPlayerAvatar().SetLeagueId(21); if (level.GetAccountPrivileges() > 4) level.GetPlayerAvatar().SetLeagueId(22); ResourcesManager.LogPlayerIn(level, this.Client); level.Tick(); var loginOk = new LoginOkMessage(this.Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(m_vPassToken); loginOk.SetServerMajorVersion(m_vClientMajorVersion); loginOk.SetServerBuild(m_vClientBuild); loginOk.SetContentVersion(m_vClientContentVersion); loginOk.SetDaysSinceStartedPlaying(10); loginOk.SetServerTime(Math.Round((level.GetTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds * 1000).ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode("US"); PacketManager.ProcessOutgoingPacket(loginOk); Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance == null) level.GetPlayerAvatar().SetAllianceId(0); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(this.Client, level)); if (alliance != null) PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(this.Client, alliance)); }
public override void Process(Level level) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(10); PacketManager.ProcessOutgoingPacket(p); return; } string[] versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); if(versionData.Length >= 2) { if(m_vClientMajorVersion != Convert.ToInt32(versionData[0]) || m_vClientBuild != Convert.ToInt32(versionData[1])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(8); p.SetUpdateURL("market://details?id=com.supercell.clashofclans"); PacketManager.ProcessOutgoingPacket(p); return; } } else { Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set."); } level = ResourcesManager.GetPlayer(m_vAccountId); if(level != null) { if(level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } if(Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { if (m_vResourceSha != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL("market://details?id=com.supercell.clashofclans"); PacketManager.ProcessOutgoingPacket(p); return; } } this.Client.ClientSeed = m_vClientSeed; PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(this.Client)); //Console.WriteLine("Debug: Retrieve Player Data for player " + auth.PlayerId.ToString()); //New player if (level == null) { level = ObjectManager.CreateAvatar(m_vAccountId); byte[] tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); SHA1 sha = new SHA1CryptoServiceProvider(); m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-",""); } //if (level.GetAccountPrivileges() > 0) // level.GetPlayerAvatar().SetLeagueId(21); //if (level.GetAccountPrivileges() > 4) // level.GetPlayerAvatar().SetLeagueId(22); if (level.GetPlayerAvatar().GetScore() >= 400 && level.GetPlayerAvatar().GetScore() <= 800) { level.GetPlayerAvatar().SetLeagueId(3); } else if (level.GetPlayerAvatar().GetScore() >= 801 && level.GetPlayerAvatar().GetScore() <= 1400) { level.GetPlayerAvatar().SetLeagueId(6); } else if (level.GetPlayerAvatar().GetScore() >= 1401 && level.GetPlayerAvatar().GetScore() <= 2000) { level.GetPlayerAvatar().SetLeagueId(9); } else if (level.GetPlayerAvatar().GetScore() >= 2001 && level.GetPlayerAvatar().GetScore() <= 2600) { level.GetPlayerAvatar().SetLeagueId(12); } else if (level.GetPlayerAvatar().GetScore() >= 2601 && level.GetPlayerAvatar().GetScore() <= 3200) { level.GetPlayerAvatar().SetLeagueId(15); } else if (level.GetPlayerAvatar().GetScore() >= 3201 && level.GetPlayerAvatar().GetScore() <= 4099) { level.GetPlayerAvatar().SetLeagueId(18); } else if (level.GetPlayerAvatar().GetScore() >= 4100) { level.GetPlayerAvatar().SetLeagueId(21); } ResourcesManager.LogPlayerIn(level, this.Client); level.Tick(); var loginOk = new LoginOkMessage(this.Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(m_vPassToken); loginOk.SetServerMajorVersion(m_vClientMajorVersion); loginOk.SetServerBuild(m_vClientBuild); loginOk.SetContentVersion(m_vClientContentVersion); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(10); loginOk.SetServerTime(Math.Round((level.GetTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds * 1000).ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode("FR"); PacketManager.ProcessOutgoingPacket(loginOk); if (ResourcesManager.IsPlayerOnline(level)) { AllianceMailStreamEntry mail = new AllianceMailStreamEntry(); mail.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); mail.SetSenderId(0); mail.SetSenderAvatarId(0); mail.SetSenderName("EuroClash.Net"); mail.SetIsNew(0); mail.SetAllianceId(0); mail.SetAllianceBadgeData(0); mail.SetAllianceName("Automatic Information"); mail.SetMessage("Welcome to EuroClash ! \nTo see available commands type /help \n\nSaveGame is fully automatic, you don't have to type anything, commands like /savegame or ./savegame doesn't exist, all commands are available on /help\n\nTrophies are randomly given on first login, this will be fixed soon.\n\nNow Clans calculate trophies of players, 50% of their trophies will be added to clan trophies, still kinda bugged, we're testing with simple math. Clan Owner's trophies are not added (bug).\n\nServer is currently in Alpha, to see bugfixes please visit http://euroclash.net ChangeLog Section!"); mail.SetSenderLeagueId(22); var abe = new AvatarStreamEntryMessage(level.GetClient()); abe.SetAvatarStreamEntry(mail); PacketManager.ProcessOutgoingPacket(abe); } //level.GetPlayerAvatar().SetResourceCount(ObjectManager.DataTables.GetResourceByName("Diamonds"), Convert.ToInt32(1000000)); Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance == null) level.GetPlayerAvatar().SetAllianceId(0); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(this.Client, level)); if (alliance != null) PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(this.Client, alliance)); }
public override void Process(Level level) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"]) || base.Client.CState == 0) { LoginFailedMessage expr_2E = new LoginFailedMessage(base.Client); expr_2E.SetErrorCode(10); PacketManager.ProcessOutgoingPacket(expr_2E); return; } level = ResourcesManager.GetPlayer(this.UserID, false); if (level != null) { if (level.GetAccountStatus() == 99) { LoginFailedMessage expr_62 = new LoginFailedMessage(base.Client); expr_62.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(expr_62); return; } } else { level = ObjectManager.CreateAvatar(this.UserID); byte[] buffer = new byte[20]; new Random().NextBytes(buffer); using (SHA1 sHA = new SHA1CryptoServiceProvider()) { this.UserToken = BitConverter.ToString(sHA.ComputeHash(buffer)).Replace("-", string.Empty); } } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]) && this.MasterHash != ObjectManager.FingerPrint.sha) { LoginFailedMessage expr_FB = new LoginFailedMessage(base.Client); expr_FB.SetErrorCode(7); expr_FB.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); expr_FB.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); expr_FB.SetUpdateURL("http://www.ultrapowa.com/client"); PacketManager.ProcessOutgoingPacket(expr_FB); return; } base.Client.ClientSeed = this.Unknown; ResourcesManager.LogPlayerIn(level, base.Client); level.Tick(); LoginOkMessage arg_16D_0 = new LoginOkMessage(base.Client); ClientAvatar playerAvatar = level.GetPlayerAvatar(); arg_16D_0.SetAccountId(playerAvatar.GetId()); arg_16D_0.SetPassToken(this.UserToken); arg_16D_0.SetServerEnvironment("prod"); arg_16D_0.SetDaysSinceStartedPlaying(10); arg_16D_0.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000.0).ToString()); arg_16D_0.SetAccountCreatedDate("1414003838000"); arg_16D_0.SetStartupCooldownSeconds(0); arg_16D_0.SetCountryCode(this.Language); PacketManager.ProcessOutgoingPacket(arg_16D_0); if (ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()) == null) { level.GetPlayerAvatar().SetAllianceId(0L); } PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(base.Client, level)); }
public override void Process(Level level) { if (Convert.ToBoolean(ConfigurationManager.AppSettings["maintenanceMode"])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(10); p.RemainingTime(Convert.ToInt32(ConfigurationManager.AppSettings["maintenanceTimeLeft"])); PacketManager.ProcessOutgoingPacket(p); return; } string[] versionData = ConfigurationManager.AppSettings["clientVersion"].Split('.'); if (versionData.Length >= 2) { if (m_vClientMajorVersion != Convert.ToInt32(versionData[0]) || m_vClientBuild != Convert.ToInt32(versionData[1])) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(8); p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]); PacketManager.ProcessOutgoingPacket(p); return; } } else { Debugger.WriteLine("Connection failed. UCS config key clientVersion is not properly set."); } level = ResourcesManager.GetPlayer(m_vAccountId); if (level != null) { if (level.GetAccountStatus() == 99) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(11); PacketManager.ProcessOutgoingPacket(p); return; } } if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"])) { if (m_vResourceSha != ObjectManager.FingerPrint.sha) { var p = new LoginFailedMessage(this.Client); p.SetErrorCode(7); p.SetResourceFingerprintData(ObjectManager.FingerPrint.SaveToJson()); p.SetContentURL(ConfigurationManager.AppSettings["patchingServer"]); p.SetUpdateURL(ConfigurationManager.AppSettings["oldClientVersion"]); PacketManager.ProcessOutgoingPacket(p); return; } } this.Client.ClientSeed = m_vClientSeed; PacketManager.ProcessOutgoingPacket(new SessionKeyMessage(this.Client)); Console.WriteLine("[D] Retrieve Player Data for player " + m_vAccountId); //New player if (level == null) { level = ObjectManager.CreateAvatar(m_vAccountId); byte[] tokenSeed = new byte[20]; new Random().NextBytes(tokenSeed); SHA1 sha = new SHA1CryptoServiceProvider(); m_vPassToken = BitConverter.ToString(sha.ComputeHash(tokenSeed)).Replace("-", ""); } if (level.GetAccountPrivileges() > 0) { level.GetPlayerAvatar().SetLeagueId(21); } if (level.GetAccountPrivileges() > 4) { level.GetPlayerAvatar().SetLeagueId(22); } ResourcesManager.LogPlayerIn(level, this.Client); level.Tick(); var loginOk = new LoginOkMessage(this.Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(m_vPassToken); loginOk.SetServerMajorVersion(m_vClientMajorVersion); loginOk.SetServerBuild(m_vClientBuild); loginOk.SetContentVersion(m_vClientContentVersion); loginOk.SetServerEnvironment("state"); loginOk.SetDaysSinceStartedPlaying(10); loginOk.SetServerTime(Math.Round((level.GetTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds * 1000).ToString()); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode("US"); PacketManager.ProcessOutgoingPacket(loginOk); Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance == null) { level.GetPlayerAvatar().SetAllianceId(0); } PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(this.Client, level)); if (alliance != null) { PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(this.Client, alliance)); } }