Ejemplo n.º 1
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            ConversationModule.Settings.ListDiscussedTopics = false;
            ConversationModule.Settings.AllowRepeats = false;

            RMUD.Core.OverrideMessage("empty handed", "");
            RMUD.Core.OverrideMessage("convo topic prompt", "You could ask <l0>.");

            GlobalRules.Perform<Player>("list topics")
                .When(player => SuppressTopics)
                .Do(player => RMUD.PerformResult.Stop);

            GlobalRules.Perform<Player>("singleplayer game started")
                .First
                .Do((actor) =>
                {
                    //BlockingConversation = true;

                    //RMUD.MudObject.SendMessage(actor, "Sal? Sal? Can you hear me?");
                    //actor.SetProperty("interlocutor", RMUD.MudObject.GetObject("DanConversation0"));
                    //RMUD.Core.EnqueuActorCommand(actor, "topics");

                    SwitchPlayerCharacter(RMUD.MudObject.GetObject("Areas.Prologue.Player") as RMUD.Player);
                    RMUD.MudObject.Move(Player, RMUD.MudObject.GetObject("Areas.Lighthouse.Base"));
                    RMUD.Core.EnqueuActorCommand(Player, "look");

                    //Player.SetProperty("interlocutor", RMUD.MudObject.GetObject("Areas.Prologue.Henrico"));
                    //RMUD.Core.EnqueuActorCommand(Player, "topics");
                    //BlockingConversation = true;

                    return RMUD.PerformResult.Stop;
                });
        }
Ejemplo n.º 2
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            GlobalRules.Perform<RMUD.PossibleMatch, RMUD.Actor>("before command")
                .When((m, a) => BlockingConversation == true)
                .Do((match, actor) =>
                {
                    var command = match["COMMAND"] as RMUD.CommandEntry;
                    if (command.IsNamed("ASK") || command.IsNamed("HELP") || command.IsNamed("TOPICS"))
                        return RMUD.PerformResult.Continue;
                    RMUD.MudObject.SendMessage(actor, "Sal, I really need to talk about this.");
                    RMUD.Core.EnqueuActorCommand(actor, "TOPICS");
                    return RMUD.PerformResult.Stop;
                })
                .Name("Can only converse during a blocking conversation rule.");

            GlobalRules.Perform<Player, RMUD.MudObject, ConversationModule.Topic>("discuss topic")
                .Do((actor, npc, topic) =>
                {
                    topic.SetProperty("discussed", true);
                    return RMUD.PerformResult.Continue;
                })
                .Name("Mark topic discussed rule.");

            GlobalRules.Perform<Player>("list topics")
                .When(player => SuppressTopics)
                .Do(player => RMUD.PerformResult.Stop);

            GlobalRules.Perform<Player>("list topics")
                .Do(player =>
                {
                    var npc = player.GetProperty<RMUD.NPC>("interlocutor");
                    var availableTopics = npc.GetPropertyOrDefault<List<RMUD.MudObject>>("conversation-topics", new List<RMUD.MudObject>()).Where(topic => GlobalRules.ConsiderValueRule<bool>("topic available?", player, npc, topic));

                    if (availableTopics.Count() == 0)
                        BlockingConversation = false;

                    return RMUD.PerformResult.Continue;
                })
                .Name("Unblock game if no available topics rule.");

            GlobalRules.Perform<Player>("singleplayer game started")
                .First
                .Do((actor) =>
                {
                    //BlockingConversation = true;

                    //RMUD.MudObject.SendMessage(actor, "Sal? Sal? Can you hear me?");
                    //actor.SetProperty("interlocutor", RMUD.MudObject.GetObject("DanConversation0"));
                    //RMUD.Core.EnqueuActorCommand(actor, "topics");

                    RMUD.MudObject.Move(actor, RMUD.MudObject.GetObject("Start"));
                    RMUD.Core.EnqueuActorCommand(actor, "look");
                    return RMUD.PerformResult.Stop;
                });
        }
Ejemplo n.º 3
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            Core.StandardMessage("not useable", "I don't know what I would do with that.");

            GlobalRules.DeclareCheckRuleBook<MudObject, MudObject>("can use?", "[Actor, Item] : Can the actor use the item?", "actor", "item");

            GlobalRules.DeclarePerformRuleBook<MudObject, MudObject>("used", "[Actor, Item] : Handle the actor using the item.", "actor", "item");

            GlobalRules.Check<MudObject, MudObject>("can use?")
                .When((actor, item) => !item.GetBooleanProperty("useable?"))
                .Do((a, b) =>
                {
                    MudObject.SendMessage(a, "@not useable");
                    return SharpRuleEngine.CheckResult.Disallow;
                })
                .Name("Can't use the unuseable rule.");

            GlobalRules.Check<MudObject, MudObject>("can use?")
                .Do((a, b) => SharpRuleEngine.CheckResult.Allow)
                .Name("Default go ahead and use it rule.");

            GlobalRules.Perform<MudObject, MudObject>("used").Do((actor, target) =>
            {
                MudObject.SendMessage(actor, "It doesn't do anything.");
                return SharpRuleEngine.PerformResult.Continue;
            }).Name("Default report using rule.");

            GlobalRules.Check<MudObject, MudObject>("can use?").First.Do((actor, item) => MudObject.CheckIsVisibleTo(actor, item)).Name("Item must be visible rule.");
        }
Ejemplo n.º 4
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            GlobalRules.Perform<MudObject>("enumerate-stats")
                .Do((actor) =>
                {
                    MudObject.SendMessage(actor, "CLIENTS");
                    return PerformResult.Continue;
                });

            GlobalRules.Perform<MudObject, String>("stats")
                .When((actor, type) => type == "CLIENTS")
                .Do((actor, type) =>
                {
                    MudObject.SendMessage(actor, "~~ CLIENTS ~~");
                    foreach (var client in Clients.ConnectedClients)
                        if (client is NetworkClient)
                            MudObject.SendMessage(actor, (client as NetworkClient).ConnectionDescription + (client.Player == null ? "" : (" - " + client.Player.Short)));
                        else
                            MudObject.SendMessage(actor, "local " + (client.Player == null ? "" : (" - " + client.Player.Short)));
                    return PerformResult.Stop;
                });
        }
Ejemplo n.º 5
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            GlobalRules.Perform<RMUD.MudObject, Room>("describe")
                .Do((viewer, item) =>
                {
                    var auto = RMUD.Core.ExecutingCommand.ValueOrDefault("AUTO", false);

                    if (item.TimesViewed > 0 && auto)
                        RMUD.MudObject.SendMessage(viewer, item.BriefDescription);
                    else
                        RMUD.MudObject.SendMessage(viewer, item.Long);

                    item.TimesViewed += 1;
                    return SharpRuleEngine.PerformResult.Stop;
                }).Name("Choose brief or long description rule.");
        }
Ejemplo n.º 6
0
        public static void AtStartup(RMUD.RuleEngine GlobalRules)
        {
            OverrideMessages();

            GlobalRules.Perform<Player>("singleplayer game started")
                .First
                .Do((actor) =>
                {
                    // Don't list the things an actor is holding. This gets rid of all the spurious 'is empty handed' messages.
                    GlobalRules.DeleteRule("describe", "list-actor-held-items-rule");

                    Scenes.Opening.OpeningScene.Start();

                    return SharpRuleEngine.PerformResult.Stop;
                });
        }