inherit "room/room";

reset(arg) {
  
  /* Make dwarf if there isn't one here. */
  if (!present("dwarf", this_object())) make_dwarf();

  if (arg) return; /* Set up once is enough. When the room is
		      created, reset() is called with argument 0.
		      Thereafter the argument is non-zero. */
  set_light(1);
  no_castle_flag = 1;
  the_realm = "NT";
  short_desc = "A small example room";
  long_desc =
    "This is an example room by Brom. It has a few exits,\n"+
    "and some of them are blocked for mortals and one even\n"+
    "for normal wizards. Guess which?\n"+
    "  Also, one is blocked by a dwarf.\n";
  dest_dir = ({"room_shop", "north",
	       "room/adv_inner", "south",
	       "room/sea", "out",
	       "room/sea_bottom", "down",
	       "room/inner3", "arches"
	     });
  blocked_exits = ({ 0, "check_wiz", "dwarf_here", 0, "check_arch"});
  /* Blocked_exits has one item for every exit until the last
     that need a check. */
}

check_wiz() {
  if ((this_player()->query_level())<20) {
    write("Only immortals can do that.\n");
    return 1; /* Blocked */
  }
  write("You go south.\n");
  /* No return is equal to return 0 in which case
     its NOT blocked. */
}

dwarf_here() {
  if (present("dwarf", this_object())) {
    write("The dwarfs says: I won't let YOU pass.\n"+
	  "You might drown out there, you know.\n");
    return 1;
  }
  write("You go down.\n");
}

check_arch() {
  if ((this_player()->query_level())<23) {
    write("Only the 23++ can do that.\n");
    return 1; /* Blocked */
  }
  write("You go the arches way.\n");
}

make_dwarf() {
  object dwarf;

  dwarf = clone_object("obj/monster");
  dwarf -> set_name("dwarf");
  dwarf -> set_level(1);
  dwarf -> set_short("A small dwarf");
  dwarf -> set_long("An old and shrunken dwarf.\n");
  move_object(dwarf, this_object());
}
