Ejemplo n.º 1
0
        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) { }
        }
Ejemplo n.º 2
0
        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();
                }
            }
        }
Ejemplo n.º 3
0
        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();
                }
            }
        }
        internal override async void Process()
        {
            try
            {
                if (Message.Length > 0 && Message.Length < 100)
                {
                    ClientAvatar player = this.Device.Player.Avatar;
                    Alliance     all    = ObjectManager.GetAlliance(ID);

                    InvitationStreamEntry cm = new InvitationStreamEntry {
                        ID = all.m_vChatMessages.Count + 1
                    };
                    cm.SetSender(player);
                    cm.SetMessage(Message);
                    cm.SetState(1);
                    all.AddChatMessage(cm);

                    foreach (AllianceMemberEntry op in all.GetAllianceMembers())
                    {
                        Level playera = await ResourcesManager.GetPlayer(op.AvatarId);

                        if (playera.Client != null)
                        {
                            new AllianceStreamEntryMessage(playera.Client)
                            {
                                StreamEntry = cm
                            }.Send();
                        }
                    }
                }
                else
                {
                    ResourcesManager.DisconnectClient(this.Device);
                }
            } catch (Exception) { }
        }