Example #1
0
        private object OnBetterChat(Dictionary <string, object> data)
        {
            String inMessage      = (String)data["Message"];
            String convertMessage = "";

            IPlayer player = (IPlayer)data["Player"];

            BasePlayer basePlayer = BasePlayer.FindByID(ulong.Parse(player.Id));

            convertMessage = "KR".Equals(InfoUtils.GetUserMode(basePlayer, User[basePlayer.UserIDString])) ? StringUtils.getConvertKor(inMessage) : inMessage;


            LogChatFile("ConvertKor_Chat", convertMessage, player.Id, player.Name);

            Chat.ChatChannel chatChannel = (Chat.ChatChannel)data["ChatChannel"];

            if (chatChannel == 0)
            {
                LogChatFile("ConvertKor_Chat", convertMessage, player.Id, player.Name);
            }
            else
            {
                TeamLogChatFile("ConvertKor_Team", convertMessage, player.Id, player.Name);
            }
            data["Message"] = this.getChangeForbiddenWord(convertMessage, basePlayer, chatChannel);

            return(data);
        }
        private static MBeanParameterInfo CreateMBeanParameterInfo(ParameterInfo info)
        {
            Descriptor descriptor = new Descriptor();
            OpenType   openType   = OpenType.CreateOpenType(info.ParameterType);

            descriptor.SetField(OpenTypeDescriptor.Field, openType);
            object[] tmp = info.GetCustomAttributes(typeof(OpenMBeanAttributeAttribute), false);
            if (tmp.Length > 0)
            {
                OpenMBeanAttributeAttribute attr = (OpenMBeanAttributeAttribute)tmp[0];
                if (attr.LegalValues != null && (attr.MinValue != null || attr.MaxValue != null))
                {
                    throw new OpenDataException("Cannot specify both min/max values and legal values.");
                }
                IComparable defaultValue = (IComparable)attr.DefaultValue;
                OpenInfoUtils.ValidateDefaultValue(openType, defaultValue);
                descriptor.SetField(DefaultValueDescriptor.Field, defaultValue);
                if (attr.LegalValues != null)
                {
                    OpenInfoUtils.ValidateLegalValues(openType, attr.LegalValues);
                    descriptor.SetField(LegalValuesDescriptor.Field, attr.LegalValues);
                }
                else
                {
                    OpenInfoUtils.ValidateMinMaxValue(openType, defaultValue, attr.MinValue, attr.MaxValue);
                    descriptor.SetField(MinValueDescriptor.Field, attr.MinValue);
                    descriptor.SetField(MaxValueDescriptor.Field, attr.MaxValue);
                }
            }
            return(new MBeanParameterInfo(info.Name,
                                          InfoUtils.GetDescrition(info.Member, info, "MBean operation parameter", info.Name),
                                          openType.Representation.AssemblyQualifiedName, descriptor));
        }
Example #3
0
        private void sendChatMessage(Chat.ChatChannel chatchannel, List <BasePlayer> basePlayers, String message, BasePlayer inputUser)
        {
            LogChatFile("", message, inputUser.UserIDString, inputUser.displayName);

            foreach (BasePlayer basePlayer in BasePlayer.activePlayerList)
            {
                basePlayer.SendConsoleCommand("chat.add2", new object[] {
                    chatchannel,
                    inputUser.UserIDString,
                    message,
                    inputUser.displayName,
                    "#" + InfoUtils.GetUserNameColor(),
                    1f
                });

                /*
                 * basePlayer.SendConsoleCommand("chat.add", new object[] {
                 *          chatchannel,
                 *          inputUser,
                 *          message,
                 *          inputUser.displayName,
                 *          "#" + InfoUtils.GetUserNameColor()
                 *          //"<color=#" + InfoUtils.GetUserNameColor() + ">" + playerName + ": </color>" +
                 *          //"<color=#" + InfoUtils.GetUserMessageColor() + ">" + convertMessage + "</color>"
                 *      });
                 */
            }
        }
 public MBeanOperationInfo CreateMBeanOperationInfo(MethodInfo info)
 {
     return(new MBeanOperationInfo(info.Name, InfoUtils.GetDescrition(info, info, "MBean operation"),
                                   info.ReturnType != null ? info.ReturnType.AssemblyQualifiedName : null,
                                   info.GetParameters().Select(x => CreateMBeanParameterInfo(x)),
                                   OperationImpact.Unknown));
 }
 public MBeanInfo CreateMBeanInfo(Type intfType, System.Collections.Generic.IEnumerable <MBeanAttributeInfo> attributes, System.Collections.Generic.IEnumerable <MBeanConstructorInfo> constructors, System.Collections.Generic.IEnumerable <MBeanOperationInfo> operations, System.Collections.Generic.IEnumerable <MBeanNotificationInfo> notifications)
 {
     return(new MBeanInfo(intfType.AssemblyQualifiedName,
                          InfoUtils.GetDescrition(intfType, intfType, "Open MBean"),
                          attributes,
                          constructors,
                          operations, notifications));
 }
        public MBeanNotificationInfo CreateMBeanNotificationInfo(EventInfo info, Type handlerType)
        {
            MBeanNotificationAttribute attribute =
                (MBeanNotificationAttribute)info.GetCustomAttributes(typeof(MBeanNotificationAttribute), true)[0];

            return(new MBeanNotificationInfo(new[] { attribute.NotifType },
                                             handlerType.GetGenericArguments()[0].AssemblyQualifiedName,
                                             InfoUtils.GetDescrition(info, info, "MBean notification")));
        }
Example #7
0
        object OnPlayerChat(ConsoleSystem.Arg arg, Chat.ChatChannel chatchannel)
        {
            BasePlayer inputChatBasePlayer = arg.Connection.player as BasePlayer;
            String     playerName          = arg.Connection.username;
            String     message             = arg.GetString(0);
            String     convertMessage      = "KR".Equals(InfoUtils.GetUserMode(inputChatBasePlayer, User[inputChatBasePlayer.UserIDString])) ? StringUtils.getConvertKor(message) : message;

            // 콘솔로그
            Puts(playerName + ": " + convertMessage);

            // 욕설 변환
            convertMessage = this.getChangeForbiddenWord(convertMessage, inputChatBasePlayer, chatchannel);

            if (!isUsePlugin("BetterChat"))
            {
                if (chatchannel == Chat.ChatChannel.Team)
                {
                    List <Connection> sendUserList      = new List <Connection>();
                    RelationshipManager.PlayerTeam team = inputChatBasePlayer.Team;
                    if (null == team || team.members.Count < 1)
                    {
                        return(true);
                    }
                    foreach (ulong teamUserId in team.members)
                    {
                        Connection inUser = BasePlayer.FindByID(teamUserId).Connection;
                        if (null != inUser)
                        {
                            sendUserList.Add(inUser);
                        }
                    }
                    // 메시지 전송
                    if (sendUserList.Count > 0)
                    {
                        ConsoleNetwork.SendClientCommand(sendUserList, "chat.add2", new object[] { chatchannel, inputChatBasePlayer.UserIDString, convertMessage, "[TEAM] " + inputChatBasePlayer.displayName, "#" + InfoUtils.GetUserNameColor() });
                    }
                }
                else
                {
                    List <Connection> sendUserList = new List <Connection>();
                    foreach (BasePlayer basePlayer in BasePlayer.activePlayerList)
                    {
                        sendUserList.Add(basePlayer.Connection);
                    }
                    // 메시지 전송
                    if (sendUserList.Count > 0)
                    {
                        ConsoleNetwork.SendClientCommand(sendUserList, "chat.add2", new object[] { chatchannel, inputChatBasePlayer.UserIDString, convertMessage, inputChatBasePlayer.displayName, "#" + InfoUtils.GetUserNameColor() });
                    }
                }

                return(false);
            }

            return(null);
        }
        public MBeanOperationInfo CreateMBeanOperationInfo(MethodInfo info)
        {
            Descriptor descriptor = new Descriptor();

            object[] attrTmp = info.GetCustomAttributes(typeof(OpenMBeanOperationAttribute), false);
            if (attrTmp.Length == 0)
            {
                throw new OpenDataException("Open MBean operation have to have its impact specified.");
            }
            OpenMBeanOperationAttribute attr = (OpenMBeanOperationAttribute)attrTmp[0];

            if (attr.Impact == OperationImpact.Unknown)
            {
                throw new OpenDataException("Open MBean operation have to have its impact specified.");
            }
            OpenType openType = info.ReturnType != null?OpenType.CreateOpenType(info.ReturnType) : SimpleType.Void;

            descriptor.SetField(OpenTypeDescriptor.Field, openType);
            return(new MBeanOperationInfo(info.Name, InfoUtils.GetDescrition(info, info, "MBean operation"),
                                          openType.Representation.AssemblyQualifiedName,
                                          info.GetParameters().Select(x => CreateMBeanParameterInfo(x)), attr.Impact,
                                          descriptor));
        }
Example #9
0
 /// <inheritdoc/>
 public override IEnumerable <InfoData> GetBuildInformation(Container container)
 {
     return(InfoUtils.GetFullInfoData(container));
 }
 public MBeanConstructorInfo CreateMBeanConstructorInfo(ConstructorInfo info)
 {
     return(new MBeanConstructorInfo(info.Name, InfoUtils.GetDescrition(info, info, "MBean constructor"),
                                     info.GetParameters().Select(x => CreateMBeanParameterInfo(x))));
 }
Example #11
0
 private static MBeanParameterInfo CreateMBeanParameterInfo(ParameterInfo info)
 {
     return(new MBeanParameterInfo(info.Name,
                                   InfoUtils.GetDescrition(info.Member, info, "MBean operation parameter", info.Name),
                                   info.ParameterType.AssemblyQualifiedName));
 }
Example #12
0
 public MBeanAttributeInfo CreateMBeanAttributeInfo(PropertyInfo info)
 {
     return(new MBeanAttributeInfo(info.Name, InfoUtils.GetDescrition(info, info, "MBean attribute"),
                                   info.PropertyType.AssemblyQualifiedName, info.CanRead, info.CanWrite));
 }