public override void Process(Level level) { ClientAvatar player = level.GetPlayerAvatar(); Alliance all = ObjectManager.GetAlliance(ID); InvitationStreamEntry cm = new InvitationStreamEntry(); cm.SetId(all.GetChatMessages().Count + 1); cm.SetSenderId(player.GetId()); cm.SetHomeId(player.GetId()); cm.SetSenderLeagueId(player.GetLeagueId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderRole(player.GetAllianceRole()); cm.SetMessage(Message); cm.SetState(1); all.AddChatMessage(cm); // New function for send a message foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level playera = ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { var p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(cm); p.Send(); } } }
public override async void Process(Level level) { try { ClientAvatar player = level.GetPlayerAvatar(); Alliance all = await ObjectManager.GetAlliance(ID); InvitationStreamEntry cm = new InvitationStreamEntry(); cm.SetId(all.GetChatMessages().Count + 1); cm.SetSenderId(player.GetId()); cm.SetHomeId(player.GetId()); cm.SetSenderLeagueId(player.GetLeagueId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderRole(await player.GetAllianceRole()); cm.SetMessage(Message); cm.SetState(1); all.AddChatMessage(cm); foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } catch (Exception) { } }
public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(Id); var streamEntry = new InvitationStreamEntry(); streamEntry.SetId(alliance.GetChatMessages().Count + 1); streamEntry.SetSenderId(avatar.GetId()); streamEntry.SetHomeId(avatar.GetId()); streamEntry.SetSenderLeagueId(avatar.GetLeagueId()); streamEntry.SetSenderName(avatar.GetAvatarName()); streamEntry.SetSenderRole(avatar.GetAllianceRole()); streamEntry.SetMessage(Message); streamEntry.SetState(1); alliance.AddChatMessage(streamEntry); var members = alliance.GetAllianceMembers(); foreach (var member in members) { var memberLevel = ResourcesManager.GetPlayer(member.GetAvatarId(), false); var memberClient = memberLevel.GetClient(); if (memberClient != null) { var message = new AllianceStreamEntryMessage(memberClient); message.SetStreamEntry(streamEntry); message.Send(); } } }