コード例 #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");
 }