示例#1
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            if (Actor.ConnectedClient == null)
            {
                return;
            }

            var builder = new StringBuilder();

            if (Actor.Inventory.Count == 0)
            {
                builder.Append("You have nothing.");
            }
            else
            {
                builder.Append("You are carrying..\r\n");
                foreach (var item in Actor.Inventory)
                {
                    builder.Append("  ");
                    builder.Append(item.Short);
                    builder.Append("\r\n");
                }
            }

            Mud.SendEventMessage(Actor, EventMessageScope.Single, builder.ToString());
        }
示例#2
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var target = Match.Arguments["TARGET"] as Thing;

            if (target == null)
            {
                if (Actor.ConnectedClient != null)
                {
                    Actor.ConnectedClient.Send("Drop what again?\r\n");
                }
            }
            else
            {
                if (!Object.ReferenceEquals(target.Location, Actor))
                {
                    Actor.ConnectedClient.Send("You aren't holding that.\r\n");
                    return;
                }

                var dropRules = target as IDropRules;
                if (dropRules != null && !dropRules.CanDrop(Actor))
                {
                    Actor.ConnectedClient.Send("You can't drop that.\r\n");
                    return;
                }

                Mud.SendEventMessage(Actor, EventMessageScope.Single, "You drop " + target.Short + "\r\n");
                Mud.SendEventMessage(Actor, EventMessageScope.External, Actor.Short + " drops " + target.Short + "\r\n");
                Thing.Move(target, Actor.Location);
            }
        }
示例#3
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var speechBuilder = new StringBuilder();

            speechBuilder.Append(Actor.Short);
            if (EmoteType == EmoteTypes.Speech)
            {
                speechBuilder.Append(": \"");
            }
            else
            {
                speechBuilder.Append(" ");
            }

            for (var node = Match.Arguments["SPEECH"] as LinkedListNode <String>; node != null; node = node.Next)
            {
                speechBuilder.Append(node.Value);
                speechBuilder.Append(" ");
            }

            speechBuilder.Remove(speechBuilder.Length - 1, 1);
            if (EmoteType == EmoteTypes.Speech)
            {
                speechBuilder.Append("\"\r\n");
            }
            else
            {
                speechBuilder.Append("\r\n");
            }

            Mud.SendEventMessage(Actor, EventMessageScope.Local, speechBuilder.ToString());
        }
示例#4
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var direction = Match.Arguments["DIRECTION"] as Direction?;
            var location  = Actor.Location as Room;
            var link      = location.Links.FirstOrDefault(l => l.Direction == direction.Value);

            if (link == null)
            {
                Mud.SendEventMessage(Actor, EventMessageScope.Single, "You can't go that way.\r\n");
            }
            else
            {
                if (link.Door != null)
                {
                    if (!link.Door.Open)
                    {
                        Mud.SendEventMessage(Actor, EventMessageScope.Single, "The door is closed.");
                        return;
                    }
                }

                Mud.SendEventMessage(Actor, EventMessageScope.Single, "You went " + direction.Value.ToString().ToLower() + ".\r\n");
                Mud.SendEventMessage(Actor, EventMessageScope.External, Actor.Short + " went " + direction.Value.ToString().ToLower() + "\r\n");
                var destination = Mud.GetObject(link.Destination) as Room;
                if (destination == null)
                {
                    throw new InvalidOperationException("Link does not lead to room.");
                }
                Thing.Move(Actor, destination);
                Mud.EnqueuClientCommand(Actor.ConnectedClient, "look");
            }
        }
示例#5
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var target = Match.Arguments["TARGET"] as Thing;

            if (target == null)
            {
                if (Actor.ConnectedClient != null)
                {
                    Actor.ConnectedClient.Send("Take what again?\r\n");
                }
            }
            else
            {
                var takeRules = target as ITakeRules;
                if (takeRules != null && !takeRules.CanTake(Actor))
                {
                    Actor.ConnectedClient.Send("You can't take that.\r\n");
                    return;
                }

                Mud.SendEventMessage(Actor, EventMessageScope.Single, "You take " + target.Short + "\r\n");
                Mud.SendEventMessage(Actor, EventMessageScope.External, Actor.Short + " takes " + target.Short + "\r\n");
                Thing.Move(target, Actor);
            }
        }
示例#6
0
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var location = Actor.Location as Room;

            if (location == null)
            {
                throw new InvalidOperationException("Error: Actor not in room.");
            }

            if (Actor.ConnectedClient != null)
            {
                var builder = new StringBuilder();

                builder.Append(location.Short);
                builder.Append("\r\n");
                builder.Append(location.Long.Expand(Actor, location));
                builder.Append("\r\n");

                //Display objects in room
                if (location.Contents.Count > 0)
                {
                    builder.Append("Also here: " + String.Join(",", location.Contents.Select(t => t.Short)));
                }
                else
                {
                    builder.Append("There is nothing here.");
                }
                builder.Append("\r\n");

                //Display exits from room
                if (location.Links.Count > 0)
                {
                    builder.Append("Obvious exits: ");

                    for (int i = 0; i < location.Links.Count; ++i)
                    {
                        var l = location.Links[i];

                        builder.Append(l.Direction.ToString().ToLower());

                        if (l.Door != null)
                        {
                            builder.Append(" [through ");
                            builder.Append(l.Door.Short);
                            builder.Append("]");
                        }

                        if (i != location.Links.Count - 1)
                        {
                            builder.Append(", ");
                        }
                    }

                    builder.AppendLine("\r\n");
                }

                Mud.SendEventMessage(Actor, EventMessageScope.Single, builder.ToString());
            }
        }
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            var target = Match.Arguments["TARGET"] as IDescribed;

            if (Actor.ConnectedClient != null)
            {
                if (target == null)
                {
                    Mud.SendEventMessage(Actor, EventMessageScope.Single, "That object is indescribeable.\r\n");
                }
                else
                {
                    Mud.SendEventMessage(Actor, EventMessageScope.Single, target.Long.Expand(Actor, target as MudObject) + "\r\n");
                }
            }
        }
        public void Perform(PossibleMatch Match, Actor Actor)
        {
            if (Actor.ConnectedClient != null)
            {
                var builder = new StringBuilder();
                foreach (var command in Mud.ParserCommandHandler.Parser.Commands)
                {
                    builder.Append(command.Matcher.Emit());
                    builder.Append(" -- ");
                    builder.Append(command.HelpText);
                    builder.Append("\r\n");
                }

                Mud.SendEventMessage(Actor, EventMessageScope.Single, builder.ToString());
            }
        }