예제 #1
0
        public override void Create(CommandParser Parser)
        {
            Parser.AddCommand(
                Sequence(
                    RequiredRank(500),
                    KeyWord("KICK"),
                    Or(
                        Object("PLAYER", new ConnectedPlayersObjectSource(), ObjectMatcherSettings.None),
                        SingleWord("MASK"))))
            .Manual("Makes bad people go away.")
            .ProceduralRule((match, actor) =>
            {
                if (match.ContainsKey("PLAYER"))
                {
                    KickPlayer(match["PLAYER"] as Actor, actor);
                }
                else
                {
                    var mask      = match["MASK"].ToString();
                    var maskRegex = new System.Text.RegularExpressions.Regex(ProscriptionList.ConvertGlobToRegex(mask), System.Text.RegularExpressions.RegexOptions.IgnoreCase);

                    //Iterate over local copy because kicking modifies ConnectedClients.
                    foreach (var client in new List <Client>(Clients.ConnectedClients))
                    {
                        var netClient = client as NetworkClient;
                        if (netClient != null && netClient.IsLoggedOn && maskRegex.Matches(netClient.IPString).Count > 0)
                        {
                            Core.MarkLocaleForUpdate(client.Player);
                            KickPlayer(client.Player, actor);
                        }
                    }
                }

                return(PerformResult.Continue);
            });
        }
예제 #2
0
파일: Clients.cs 프로젝트: SinaC/RMUD
 public static void AtStartup(RuleEngine GlobalRules)
 {
     ProscriptionList = new ProscriptionList("proscriptions.txt");
 }
예제 #3
0
파일: Clients.cs 프로젝트: Reddit-Mud/RMUD
 public static void AtStartup(RuleEngine GlobalRules)
 {
     ProscriptionList = new ProscriptionList("proscriptions.txt");
 }