public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { ChatStreamEntry cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetAvatar(avatar); cm.SetMessage(m_vChatMessage); Alliance alliance = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(cm); PacketManager.ProcessOutgoingPacket(p); } } } } }
public void OnChatToAllianceStreamMessageReceived(ChatToAllianceStreamMessage message) { if (!this.CanSendGlobalChatMessage()) { return; } if (this.m_session.Alliance != null) { string chatMessage = message.RemoveMessage(); if (string.IsNullOrEmpty(chatMessage)) { return; } if (chatMessage.Length > 128) { chatMessage = chatMessage.Substring(0, 128); } AllianceMemberEntry memberEntry = this.m_session.Alliance.Members[this.m_session.AccountId]; ChatStreamEntry chatStreamEntry = new ChatStreamEntry(); AllianceStreamEntryUtil.SetSenderInfo(chatStreamEntry, memberEntry); chatStreamEntry.SetMessage(WordCensorUtil.FilterMessage(chatMessage)); StreamManager.Create(this.m_session.Alliance.Id, chatStreamEntry); this.m_session.Alliance.AddStreamEntry(chatStreamEntry); AllianceManager.Save(this.m_session.Alliance); } }
public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { if (m_vChatMessage.Length > 0) { if (m_vChatMessage[0] == '/') { var obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { var player = ""; if (level != null) { player += " (" + avatar.GetId() + ", " + avatar.GetAvatarName() + ")"; } Debugger.WriteLine("\t" + obj.GetType().Name + player); ((GameOpCommand)obj).Execute(level); } } else if (!m_vChatMessage.Contains("./")) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetAvatar(avatar); cm.SetMessage(FilterString(m_vChatMessage)); var alliance = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); var name = cm.GetSenderName(); if (onlinePlayer.isPermittedUser()) { cm.SetSenderName(name + " #" + cm.GetSenderId()); } p.SetStreamEntry(cm); PacketManager.ProcessOutgoingPacket(p); if (onlinePlayer.isPermittedUser()) { cm.SetSenderName(name); } } } } } } } }
public override async void Process(Level level) { try { if (m_vChatMessage.Length > 0) { if (m_vChatMessage.Length < 101) { if (m_vChatMessage[0] == '/') { Object obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { string player = ""; if (level != null) { player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")"; } ((GameOpCommand)obj).Execute(level); } } else { ClientAvatar avatar = level.GetPlayerAvatar(); long allianceId = avatar.GetAllianceId(); if (allianceId > 0) { ChatStreamEntry cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSender(avatar); cm.SetMessage(m_vChatMessage); Alliance alliance = await ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); foreach (var op in alliance.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(player.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } } } } } } catch (Exception) { } }
public override void Process(Level level) { if (m_vChatMessage.Length > 0) { if (m_vChatMessage[0] == '/') { var obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { var player = ""; if (level != null) { player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")"; } ((GameOpCommand)obj).Execute(level); } } else { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSender(avatar); cm.SetMessage(m_vChatMessage); var alliance = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); Parallel.ForEach((alliance.GetAllianceMembers()), op => { Level player = ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { var p = new AllianceStreamEntryMessage(player.GetClient()); p.SetStreamEntry(cm); p.Send(); } }); } } } } }
public override void Process(Level level) { //Clans Edit Manager var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSenderId(0); cm.SetHomeId(0); cm.SetSenderLeagueId(22); cm.SetSenderName("System Manager"); cm.SetSenderRole(2); cm.SetMessage("Clan settings updated!"); var alliance1 = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance1.AddChatMessage(cm); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(cm); PacketManager.ProcessOutgoingPacket(p); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); PacketManager.ProcessOutgoingPacket(new AllianceDataMessage(Client, alliance)); } } } } } }