Beispiel #1
0
        /// <summary>
        /// Finds an exit based on a keyword.  Use FindDoor if you are looking for a door.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Exit.Direction FindExit(CharData ch, string arg)
        {
            Exit exit;

            Exit.Direction door = Exit.DoorLookup(arg);
            if (door == Exit.Direction.invalid)
            {
                for (int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++)
                {
                    if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door) &&
                        !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0 &&
                          (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked))) &&
                        exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                                                     MUDString.NameContainedIn(arg, exit.Keyword)))
                    {
                        return((Exit.Direction)doornum);
                    }
                }
                SocketConnection.Act("I see no $T here.", ch, null, arg, SocketConnection.MessageTarget.character);
                return(Exit.Direction.invalid);
            }

            if (!(exit = ch.InRoom.ExitData[(int)door]))
            {
                SocketConnection.Act("I see no door $T here.", ch, null, arg, SocketConnection.MessageTarget.character);
                return(Exit.Direction.invalid);
            }

            return(door);
        }
Beispiel #2
0
        /// <summary>
        /// Finds a door based on a keyword or direction.  Use FindExit if you only need to get an exit,
        /// no door required.  This should _not_ tell the character anything; it is an internal function.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="arg"></param>
        /// <returns></returns>
        public static Exit.Direction FindDoor(CharData ch, string arg)
        {
            Exit exit;

            Exit.Direction door = Exit.DoorLookup(arg);
            if (door == Exit.Direction.invalid)
            {
                for (int doornum = 0; doornum < Limits.MAX_DIRECTION; doornum++)
                {
                    if ((exit = ch.InRoom.ExitData[doornum]) && exit.HasFlag(Exit.ExitFlag.is_door) &&
                        !(ch.Level < Limits.LEVEL_AVATAR && exit.ExitFlags != 0 &&
                          (exit.HasFlag(Exit.ExitFlag.secret) || exit.HasFlag(Exit.ExitFlag.blocked))) &&
                        exit.Keyword.Length != 0 && ("door".Equals(arg, StringComparison.CurrentCultureIgnoreCase) ||
                                                     MUDString.NameContainedIn(arg, exit.Keyword)))
                    {
                        return((Exit.Direction)doornum);
                    }
                }
                return(Exit.Direction.invalid);
            }

            exit = ch.InRoom.GetExit(door);
            if (!exit)
            {
                return(Exit.Direction.invalid);
            }

            if (!exit.HasFlag(Exit.ExitFlag.is_door))
            {
                return(Exit.Direction.invalid);
            }

            return(door);
        }
Beispiel #3
0
 public Exit.Direction GetDirection()
 {
     return(Exit.DoorLookup(comboBox1.Text));
 }