Пример #1
0
        /// <summary>
        /// Sends a message to this channel.
        /// </summary>
        /// <param name="sender">the chatter saying the message</param>
        public void SendMessage(IChatter sender, string message)
        {
            ChannelMember mi;

            if (!Members.TryGetValue(sender.EntityId.Low, out mi))
            {
                ChannelHandler.SendNotOnChannelReply(sender, m_name);
                return;
            }

            if (mi.IsMuted)
            {
                ChannelHandler.SendMutedReply(sender, m_name);
                return;
            }

            bool isMod = mi.IsModerator;

            if (IsModerated && !isMod)
            {
                ChannelHandler.SendNotOnChannelReply(sender, m_name);
                return;
            }

            if (sender is IUser)
            {
                if (RealmCommandHandler.HandleCommand((IUser)sender, message, this))
                {
                    return;
                }
            }

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT))
            {
                packet.Write((byte)ChatMsgType.Channel);
                packet.Write((uint)sender.SpokenLanguage);
                packet.Write(sender.EntityId);
                packet.Write(0);                                        // unknown
                packet.WriteCString(Name);
                packet.Write(sender.EntityId);
                packet.WriteUIntPascalString(message);
                packet.Write((byte)sender.ChatTag);                 // chat tag

                if (isMod)
                {
                    ChannelHandler.SendPacketToChannel(this, packet);
                }
                else
                {
                    ChannelHandler.SendPacketToChannel(this, packet, sender.EntityId);
                }

                ChatMgr.ChatNotify(sender, message, sender.SpokenLanguage, ChatMsgType.Channel, this);
            }
        }
Пример #2
0
        public void SendMessage(string message)
        {
            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT))
            {
                packet.Write((byte)17);
                packet.Write(7U);
                packet.Write((ulong)EntityId.Zero);
                packet.WriteCString("");
                packet.Write((ulong)EntityId.Zero);
                packet.WriteUIntPascalString(message);
                packet.Write((byte)0);
                ChannelHandler.SendPacketToChannel(this, packet);
            }

            ChatMgr.ChatNotify((IChatter)null, message, ChatLanguage.Common, ChatMsgType.Channel,
                               (IGenericChatTarget)this);
        }
Пример #3
0
        public void SendMessage(string message)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT))
            {
                packet.Write((byte)ChatMsgType.Channel);
                packet.Write((uint)ChatLanguage.Common);
                packet.Write(EntityId.Zero);
                packet.WriteCString("");
                packet.Write(EntityId.Zero);
                packet.WriteUIntPascalString(message);
                packet.Write((byte)ChatTag.None);                 // chat tag

                ChannelHandler.SendPacketToChannel(this, packet);
            }

            ChatMgr.ChatNotify(null, message, ChatLanguage.Common, ChatMsgType.Channel, this);
        }