Beispiel #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 MudObject, 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);
            });
        }
Beispiel #2
0
 public static void AtStartup(RuleEngine GlobalRules)
 {
     ProscriptionList = new ProscriptionList("proscriptions.txt");
     PropertyManifest.RegisterProperty("account", typeof(Account), null, new DefaultSerializer());
 }