예제 #1
0
파일: Chat.cs 프로젝트: sircapted/UOT2A.COM
        public static void ChatAction(NetState state, PacketReader pvSrc)
        {
            if (!m_Enabled)
            {
                return;
            }

            try
            {
                Mobile   from = state.Mobile;
                ChatUser user = ChatUser.GetChatUser(from);

                if (user == null)
                {
                    return;
                }

                string lang     = pvSrc.ReadStringSafe(4);
                int    actionID = pvSrc.ReadInt16();
                string param    = pvSrc.ReadUnicodeString();

                ChatActionHandler handler = ChatActionHandlers.GetHandler(actionID);

                if (handler != null)
                {
                    Channel channel = user.CurrentChannel;

                    if (handler.RequireConference && channel == null)
                    {
                        user.SendMessage(31);                           /* You must be in a conference to do this.
                                                                         * To join a conference, select one from the Conference menu.
                                                                         */
                    }
                    else if (handler.RequireModerator && !user.IsModerator)
                    {
                        user.SendMessage(29);                           // You must have operator status to do this.
                    }
                    else
                    {
                        handler.Callback(user, channel, param);
                    }
                }
                else
                {
                    Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
        public static void ChatAction(NetState state, PacketReader pvSrc)
        {
            if (!Enabled)
            {
                return;
            }

            try
            {
                Mobile   from = state.Mobile;
                ChatUser user = ChatUser.GetChatUser(from);

                if (user == null)
                {
                    return;
                }

                string lang     = pvSrc.ReadStringSafe(4);
                short  actionId = pvSrc.ReadInt16();
                string param    = pvSrc.ReadUnicodeString();

                ChatActionHandler handler = ChatActionHandlers.GetHandler(actionId);

                if (handler != null)
                {
                    Channel channel = user.CurrentChannel;

                    if (handler.RequireConference && channel == null)
                    {
                        /* You must be in a conference to do this.
                         * To join a conference, select one from the Conference menu.
                         */
                        user.SendMessage(31);
                    }
                    else
                    {
                        handler.Callback(user, channel, param);
                    }
                }
                else
                {
                    Console.WriteLine("Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionId, param);
                }
            }
            catch (Exception e)
            {
                Diagnostics.ExceptionLogging.LogException(e);
            }
        }