void LogUser() { ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(avatar.GetUserToken()); loginOk.SetServerMajorVersion(MajorVersion); loginOk.SetServerBuild(MinorVersion); loginOk.SetContentVersion(ContentVersion); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(0); loginOk.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString(CultureInfo.InvariantCulture)); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode(avatar.GetUserRegion().ToUpper()); PacketManager.ProcessOutgoingPacket(loginOk); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); if (alliance == null) { level.GetPlayerAvatar().SetAllianceId(0); } else { PacketManager.ProcessOutgoingPacket(new AllianceFullEntryMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance)); } PacketManager.ProcessOutgoingPacket(new BookmarkMessage(Client)); PacketManager.ProcessOutgoingPacket(new LeaguePlayersMessage(Client)); }
async void LogUser() { try { ResourcesManager.LogPlayerIn(level, Client); level.Tick(); level.SetIPAddress(Client.CIPAddress); LoginOkMessage l = new LoginOkMessage(Client); ClientAvatar avatar = level.GetPlayerAvatar(); l.SetAccountId(avatar.GetId()); l.SetPassToken(avatar.GetUserToken()); l.SetServerMajorVersion(MajorVersion); l.SetServerBuild(MinorVersion); l.SetContentVersion(ContentVersion); l.SetServerEnvironment("prod"); l.SetDaysSinceStartedPlaying(0); l.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString(CultureInfo.InvariantCulture)); l.SetAccountCreatedDate(avatar.GetAccountCreationDate().ToString()); l.SetStartupCooldownSeconds(0); l.SetCountryCode(avatar.GetUserRegion().ToUpper()); PacketProcessor.Send(l); Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); 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); /*FOR FHX*/ //mail.SetSenderName("Clash Of Heroes Team"); mail.SetSenderName("Server Manager"); mail.SetIsNew(2); mail.SetAllianceId(0); mail.SetSenderLeagueId(22); mail.SetAllianceBadgeData(1526735450); /*FOR FHX*/ //mail.SetAllianceName("COH-TEAM"); mail.SetAllianceName("Server Admin"); mail.SetMessage(ConfigurationManager.AppSettings["AdminMessage"]); mail.SetSenderLevel(500); AvatarStreamEntryMessage p = new AvatarStreamEntryMessage(level.GetClient()); p.SetAvatarStreamEntry(mail); PacketProcessor.Send(p); } if (alliance != null) { PacketProcessor.Send(new AllianceFullEntryMessage(Client, alliance)); PacketProcessor.Send(new AllianceStreamMessage(Client, alliance)); PacketProcessor.Send(new AllianceWarHistoryMessage(Client, alliance)); } PacketProcessor.Send(new AvatarStreamMessage(Client)); PacketProcessor.Send(new OwnHomeDataMessage(Client, level)); PacketProcessor.Send(new BookmarkMessage(Client)); } catch (Exception) { } }
private void LogUser() { ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(avatar.GetUserToken()); loginOk.SetServerMajorVersion(MajorVersion); loginOk.SetServerBuild(MinorVersion); loginOk.SetContentVersion(ContentVersion); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(0); loginOk.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString(CultureInfo.InvariantCulture)); loginOk.SetAccountCreatedDate(avatar.GetAccountCreationDate().ToString()); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode(avatar.GetUserRegion() ?? "EN"); loginOk.Send(); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); 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("Clash of Magic Admin"); mail.SetIsNew(2); mail.SetAllianceId(0); mail.SetSenderLeagueId(22); mail.SetAllianceBadgeData(1526735450); mail.SetAllianceName("Clash of Magic Admin"); mail.SetMessage(ConfigurationManager.AppSettings["AdminMessage"]); mail.SetSenderLevel(500); var p = new AvatarStreamEntryMessage(level.GetClient()); p.SetAvatarStreamEntry(mail); p.Send(); } new OwnHomeDataMessage(Client, level).Send(); // THIS MESSAGE MUST BE SENT FIRST !!! new AvatarStreamMessage(Client).Send(); if (alliance != null) { new AllianceFullEntryMessage(Client, alliance).Send(); new AllianceStreamMessage(Client, alliance).Send(); new AllianceWarHistoryMessage(Client, alliance).Send(); //PacketManager.ProcessOutgoingPacket (new AllianceWarMapDataMessage(Client)); //Don't activate it (not done!) } new BookmarkMessage(Client).Send(); }
void LogUser() { ResourcesManager.LogPlayerIn(level, Client); level.Tick(); var loginOk = new LoginOkMessage(Client); var avatar = level.GetPlayerAvatar(); loginOk.SetAccountId(avatar.GetId()); loginOk.SetPassToken(avatar.GetUserToken()); loginOk.SetServerMajorVersion(MajorVersion); loginOk.SetServerBuild(MinorVersion); loginOk.SetContentVersion(ContentVersion); loginOk.SetServerEnvironment("prod"); loginOk.SetDaysSinceStartedPlaying(0); loginOk.SetServerTime(Math.Round(level.GetTime().Subtract(new DateTime(1970, 1, 1)).TotalSeconds * 1000).ToString(CultureInfo.InvariantCulture)); loginOk.SetAccountCreatedDate("1414003838000"); loginOk.SetStartupCooldownSeconds(0); loginOk.SetCountryCode(avatar.GetUserRegion().ToUpper()); PacketManager.ProcessOutgoingPacket(loginOk); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); 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("Server Manager"); mail.SetIsNew(0); mail.SetAllianceId(0); mail.SetSenderLeagueId(22); mail.SetAllianceBadgeData(1728059989); mail.SetAllianceName("Server Admin"); mail.SetMessage(ConfigurationManager.AppSettings["AdminMessage"]); mail.SetSenderLevel(500); var p = new AvatarStreamEntryMessage(level.GetClient()); p.SetAvatarStreamEntry(mail); PacketManager.ProcessOutgoingPacket(p); } if (alliance != null) { PacketManager.ProcessOutgoingPacket(new AllianceFullEntryMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new AllianceWarHistoryMessage(Client)); } PacketManager.ProcessOutgoingPacket(new BookmarkMessage(Client)); }