Exemplo n.º 1
0
        public override void doCommand(Player p, CommandParser cp)
        {
            string direction = cp.getArgument();

            if(direction == "")
            {
                p.OutBuffer.Append("Close a door in which direction?\n\r");
            }
            else
            {
                int dir = Directions.NamesToDir[Mud.mudSuroden.CommandList.findCommand(direction).CommandVerb];

                if(p.CurrentRoom.Exits[dir] != null)
                {
                    if(p.CurrentRoom.DoorStates[dir] == DoorState.Open)
                    {
                        p.CurrentRoom.DoorStates[dir] = DoorState.Closed;
                        p.CurrentRoom.WriteAll(p, p.Name + " closes the " + Directions.DIR_NAMES[dir] + " door.\n\r", "You close the door.\n\r");

                        //close other side
                        p.CurrentRoom.Exits[dir].DoorStates[Directions.DIR_REVERSE[dir]] = DoorState.Closed;
                        p.CurrentRoom.Exits[dir].WriteAll(p, "The " + Directions.DIR_NAMES[Directions.DIR_REVERSE[dir]] + " door closes\n\r", "");

                    }
                    else if(p.CurrentRoom.DoorStates[dir] == DoorState.Closed
                        || p.CurrentRoom.DoorStates[dir] == DoorState.Locked)
                    {
                        p.OutBuffer.Append("The door is already closed.\n\r");
                    }
                    else
                    {
                        p.OutBuffer.Append("There isn't a door in that direction.\n\r");
                    }
                }
            }
        }
Exemplo n.º 2
0
        ///<summary>
        ///set the short description
        ///</summary>
        ///<param name="p">The player who invoked the command.</param>
        ///<param name="cp">The options the player sent along.</param>
        public override void doCommand(Player p, CommandParser cp)
        {
            string target = cp.getArgument();
            Player targetPlayer = null;
            foreach(Player player in Mud.mudSuroden.PlayerList)
            {
                if(target.ToLower() == player.Name.ToLower().Substring(0, target.Length))
                {
                    targetPlayer = player;
                }
            }

            if(targetPlayer == null)
            {
                p.OutBuffer.Append(target);
                p.OutBuffer.Append(" doesn't exist.\n\r");
            }
            else if(targetPlayer == p)
            {
                p.OutBuffer.Append("{o{bTalking to ourself again?{x\n\r");
            }
            else
            {
                p.OutBuffer.Append("{o{bYou say to ");
                p.OutBuffer.Append(targetPlayer.Name);
                p.OutBuffer.Append(" '{x{o{y");
                p.OutBuffer.Append(cp.RemainingArguments);
                p.OutBuffer.Append("{x{o{b'{x\n\r");

                targetPlayer.OutBuffer.Append("\n\r{o{b");
                targetPlayer.OutBuffer.Append(p.Name);
                targetPlayer.OutBuffer.Append(" says '{x{o{y");
                targetPlayer.OutBuffer.Append(cp.RemainingArguments);
                targetPlayer.OutBuffer.Append("{x{o{b'{x\n\r");
            }
        }
Exemplo n.º 3
0
        public override void doCommand(Player p, CommandParser cp)
        {
            string what = cp.getArgument();
            string whom = cp.getArgument();

            if(what == "" || whom == "")
            {
                p.OutBuffer.Append("Give what to whom? Syntax: give <inv object> <player>\n\r");
            }

            Object found = null;
            foreach(Object o in p.Inv)
            {
                if(o.Name.ToLower() == what.ToLower())
                {
                    found = o;
                    break;
                }
            }

            if(found == null)
            {
                p.OutBuffer.Append("You don't seem to have that object.\n\r");
                return;
            }

            foreach(Thing t in p.CurrentRoom.ContainedList)
            {
                if(t.Name.ToLower() == whom.ToLower())
                {
                    p.Inv.Remove(found);
                    t.Inv.Add(found);

                    p.CurrentRoom.WriteAll(p, p.Name + " gives " + t.Name + " " + found.Name + "\n\r", "You give " + t.Name + " " + found.Name + "\n\r");
                }
            }
        }
Exemplo n.º 4
0
        public override void doCommand(Player p, CommandParser cp)
        {
            string name = cp.getArgument();

            if(name == "")
            {
                p.OutBuffer.Append("Get what?\n\r");
            }

            Object o = p.CurrentRoom.FindObject(p, name);

            if(o == null)
            {
                p.OutBuffer.Append("You can't seem to find that.\n\r");
            }
            else
            {
                p.CurrentRoom.WriteAll(p, p.Name + " picks up " + o.ShortDesc + "\n\r", "You pick up " + o.ShortDesc + "\n\r");

                p.CurrentRoom.ContainedList.Remove(o);

                p.Inv.Add(o);
            }
        }
Exemplo n.º 5
0
        ///<summary>
        ///This loops through all the exits for the room the player is currently
        ///in and prints them.
        ///</summary>
        ///<param name="p">The player who invoked the command.</param>
        ///<param name="cp">The options the player sent along.</param>
        public override void doCommand(Player p, CommandParser cp)
        {
            bool auto = false;
            if(cp.getArgument() == "auto")
            {
                auto = true;
            }

            if(auto)
            {
                p.OutBuffer.Append("{o{y[Exits");
            }
            else
            {
                p.OutBuffer.Append("{o{yExits from here are:{x\n\r");
            }
            for(int i = 0; i < Directions.MAX_DIR; ++i)
            {
                if(p.CurrentRoom.Exits[i] != null)
                {
                    if(auto)
                    {
                        p.OutBuffer.AppendFormat(" {0}", Directions.DIR_NAMES[i]);
                    }
                    else
                    {
                        p.OutBuffer.AppendFormat("{{o{{w{0}:{{x {{o{{r{1}{{x\n\r", Directions.DIR_NAMES[i], p.CurrentRoom.Exits[i].Title);
                    }
                }
            }

            if(auto)
            {
                p.OutBuffer.Append("]{x\n\r");
            }
        }
Exemplo n.º 6
0
        public override void doCommand(Player p, CommandParser cp)
        {
            string name = cp.getArgument();

            if(name == "")
            {
                p.OutBuffer.Append("Drop what?\n\r");
            }

            foreach(Object o in p.Inv)
            {
                if(o.Name.ToLower() == name.ToLower())
                {
                    p.CurrentRoom.WriteAll(p, p.Name + " drops " + o.ShortDesc + "\n\r", "You drop " + o.ShortDesc + "\n\r");
                    p.Inv.Remove(o);
                    p.CurrentRoom.ContainedList.Add(o);
                    return;
                }
            }

            p.OutBuffer.Append("You don't seem to have that.\n\r");
        }