Пример #1
0
        internal void OnChannelMessage(ChannelMessageEventArgs cme)
        {
            EventHandler<ChannelMessageEventArgs> handler = ChannelMessage;

            if (handler != null)
                handler(this, cme);
        }
Пример #2
0
        /// <summary>Sends a channel message to all clients.</summary>
        void Mob_ChannelMessage(object sender, ChannelMessageEventArgs cme)
        {
            this.MobListLock.EnterReadLock();
            try {
                foreach (ZonePlayer zp in this.Clients) {

                    // See if we need to set up a filter
                    MessageFilter filter = MessagingManager.GetChannelMessageFilter(cme.Channel);

                    if (cme.Channel != MessageChannel.Say || zp.Distance(cme.From) < MessagingManager.SAY_RANGE) { // Only SAY is limited in range

                        // TODO: Ensure the filters pass

                        if (cme.Channel == MessageChannel.GMSay && !zp.IsGM)
                            return; // Don't send /petition & /pr to non-GMs

                        zp.SendChannelMessage(cme.From.Name, string.Empty, cme.Channel, cme.Language, cme.LangSkill, cme.Message);
                    }
                }
            }
            catch (Exception ex) {
                _log.Error("Error while iterating mobs list to send channel message... ", ex);
            }
            finally {
                this.MobListLock.ExitReadLock();
            }
        }