/
lib/banish/
lib/d/coronos/
lib/d/coronos/w/alena/
lib/d/coronos/w/angel/
lib/d/coronos/w/angel/caves/
lib/d/coronos/w/angel/caves/monst/
lib/d/coronos/w/angel/city/chambers/
lib/d/coronos/w/angel/city/monst/
lib/d/coronos/w/angel/city/obj/
lib/d/coronos/w/angel/city/streets/
lib/d/coronos/w/angel/farms/plains/
lib/d/coronos/w/angel/monst/
lib/d/tempus/
lib/d/tempus/w/angel/
lib/d/tempus/w/kingbill/
lib/d/tempus/w/mirak/
lib/d/tempus/w/mirak/monst/
lib/d/tempus/w/mirak/obj/
lib/d/tempus/w/relgar/planes/baat/
lib/d/tempus/w/sarak/
lib/d/tempus/w/serepion/mon/
lib/d/tempus/w/valrejn/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/include/fn_specs/
lib/info/
lib/inherit/base/
lib/log/
lib/log/mailbox/
lib/log/main/
lib/news/
lib/obj/party/
lib/objects/componen/
lib/open/
lib/open/party/
lib/open/paste/
lib/open/spells/
lib/open/valrejn/
lib/players/
lib/players/alena/
lib/players/alena/obj/
lib/players/alena/open/
lib/players/alena/private/
lib/players/angel/
lib/players/angel/obj/
lib/players/ash/
lib/players/biggs/
lib/players/biggs/food/
lib/players/biggs/gobkeep/
lib/players/biggs/mnstr/
lib/players/biggs/town/caves/
lib/players/biggs/town/tower/
lib/players/biggs/wpns/
lib/players/calris/
lib/players/deathurg/
lib/players/deathurg/open/
lib/players/deathurg/private/thief/
lib/players/dogberry/
lib/players/dogberry/library/
lib/players/dogberry/open/
lib/players/epsilon/
lib/players/epsilon/private/
lib/players/farewell/
lib/players/hippo/
lib/players/hippo/open/
lib/players/hippo/tools/
lib/players/jimpa/
lib/players/josh/
lib/players/josh/room/
lib/players/josh/room/mage/dungeon/
lib/players/josh/room/mage/dungeon/obj/
lib/players/josh/wep/
lib/players/kingbill/
lib/players/metatron/
lib/players/miette/
lib/players/mirak/
lib/players/mirak/open/
lib/players/parsilan/
lib/players/relgar/
lib/players/relgar/private/
lib/players/sarak/
lib/players/sarak/bugs/
lib/players/sarak/feelings/
lib/players/sarak/magical/
lib/players/sarak/minotaur/island/
lib/players/sarak/open/
lib/players/sarak/private/
lib/players/serepion/
lib/players/serepion/open/
lib/players/serepion/private/
lib/players/spike/
lib/players/spike/open/
lib/players/spike/private/
lib/players/spike/seaworld/
lib/players/valrejn/
lib/players/valrejn/open/
lib/players/valrejn/private/
lib/players/virus/
lib/players/wrath/
lib/players/wrath/arm/
lib/players/wrath/mon/
lib/players/wrath/room/
lib/players/wrath/room/entry/
lib/players/wrath/room/zolgath/
lib/players/wrath/weap/
lib/players/zil/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/library/
lib/room/city/library/open/books/
lib/room/city/shop/
lib/room/death/
lib/room/death/open/
lib/room/island/
lib/room/keeps/
lib/room/registry/
lib/room/ships/crew/
lib/room/ships/open/
lib/room/ships/open/types/bounty/
lib/room/ships/open/types/nebula/
lib/room/ships/open/types/phoenix/
lib/secure/udp_cmd_/
lib/skills/
lib/skills/fighter/
lib/skills/psionici/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/no_banis/
lib/usr/players/
/* A Well
#include <mudlib.h>
inherit ROOM;

void reset(status arg) {
  if(arg) return;
  set_short("Knowledge Street");
  set_long(
	"\tKnowledge Street.\n"+
	"The cobblestones beneath your feet are more wet here, moistened \n"+
	"by the humid sea air that blows in from the wharves to the east.\n);

  set_items(({
	"cobblestone#cobblestones",
		"Fine street pathing stones. They appear a little moistened",
	"wharf#wharves",
		"Great sea ships berth at the wharves to the east",
	"ship#ships#great ships",
		"They're moured at the wharf",
  }));
  set_weather(2, 1, 0);
  set_smell("You can smell the sea air.\n");
  set_listen("The waves crash in from the east.\n");
}

 * The well is a simple place where the players can drink and get a
 * free heal every reset or so. Only MAX_WATER drinks can be taken
 * from the well, with WATER hp being healed each time
 * (c) Angel, Jan 1994
 */

#define NAME        (string)this_player()->query_name()
#define MAX_WATER   3
#define WATER       (random(5) + 5)

#include <mudlib.h>

int water;                    /* the amount of water in the well  */
int water_counter;
status bucket;                /* is there a bucket handy?         */
status rope;                  /* is there any rope?               */
status tied_to_bucket;        /* is the rope tied to the bucket   */
status tied_to_well;          /* is the rope tied to the well?    */
status up;                    /* is the bucket up or down?        */
status dry;                   /* is the well dry?                 */

inherit ROOM;
void reset(status arg) {

  up             = 1;
  dry            = 0;
  water          = 0;
  bucket         = 1;
  rope           = 1;
  tied_to_bucket = 1;
  tied_to_well   = 1;

  if(arg) return;

  set_weather(2, 4, 0);
  set_short("Knowledge Street");
  set_long("\tKnowledge Street.\n"+
     "To the west the great Tempus city library stands, while to the \n"+
     "east you can clearly see the ocean. In the center of the street \n"+
     "is a small well.\n");

  set_exits(({
     "room/city/knowl1",  "west",
     "room/city/jetty",  "east",
  }));

  set_items(({
     "library",
     "The library was made five centuries ago by the elves to the north.\n"+
     "It serves as a great center for learning for all its citizens",
  }));
}

void init() {
  ::init();
  add_action("get_item", "get");
  add_action("turn_handle", "turn");
  add_action("untie_stuff", "untie");
  add_action("tie_stuff",  "tie");
  add_action("drink",   "drink");
}

status drink(string str) {
  if(!up) {
    notify_fail("The bucket must be at the top of the well "+
     "to drink from the well.\n");
    return 0;
  }
  if(!bucket) {
    notify_fail("But there is no bucket to drink from.\n");
    return 0;
  }
  if(!water) {
    notify_fail("There is no water left in the bucket.\n");
    return 0;
  }
  if(dry) {
    notify_fail("The well is dry.\n");
    return 0;
  }

  if(!this_player()->drink_soft(WATER)) {
    write("You can't possibly drink any more!\n");
    return 1;
  }
  write("You drink the water from the well.\n");
  say(NAME+" drinks water from the well.\n");
  water = 0;
  return 1;
}


status turn_handle(string str) {
  if(str != "handle") {
    notify_fail("Turn what?\n");
    return 0;
  }
  if(!up) {
    write("You turn the handle and the bucket comes up the well.\n");
    say(NAME+" turns the handle on the well and the bucket comes up.\n",
     this_player());
    up = 1;
    return 1;
  }
  if(up) {
    write("You turn the handle and the bucket goes down the well.\n");
    say(NAME+" turns the handle on the well and the bucket goes down.\n",
        this_player());
    up = 0;
    water = 1;
    water_counter += 1;
    if(water_counter > MAX_WATER) dry = 1;
    if(!dry)
      tell_room(this_object(), 
          "You hear a splash as the bucket hits the water.\n");
    else
      tell_room(this_object(),
          "You hear the bucket hit the dry bottom of the well.\n");
    return 1;
  }
  return 0;
}

status tie_stuff(string str) {
  string tmp1, tmp2;
  object ob;

  if(!str) return 0;
  if(!rope && !present("rope", this_player())) {
    notify_fail("There is no rope here.\n");
    return 0;
  }
  if(!up) {
    notify_fail("You can't. The bucket is at the bottom of the well.\n");
    return 0;
  }
  if(sscanf(str, "rope%sbucket%s", tmp1, tmp2) ||
     sscanf(str, "bucket%srope%s", tmp1, tmp2)) {
    if(tied_to_bucket) {
      notify_fail("The rope is already tied to the bucket.\n");
      return 0;
    }
    write("You tie the rope to the bucket.\n");
    say(NAME+" ties the rope to the bucket.\n", this_player());
    tied_to_bucket = 1;
    if(!rope && present("rope", this_player())) 
      destruct(present("rope", this_player()));
    return 1;
  }

  if(sscanf(str, "rope%swell%s", tmp1, tmp2) ||
     sscanf(str, "well%srope%s", tmp1, tmp2)) {
    if(tied_to_well) {
      notify_fail("The rope is already tied to the well.\n");
      return 0;
    }
    write("You tie the rope to the well.\n");
    say(NAME+" unties the rope from the well.\n", this_player());
    tied_to_well = 1;
    if(!rope && present("rope", this_player())) 
      destruct(present("rope", this_player()));
    return 1;
  }

  write("Untie what from where?\n");
  return 1;
}

status untie_stuff(string str) {
  string tmp1, tmp2;

  if(!str) return 0;
  if(!rope) {
    notify_fail("There is no rope here.\n");
    return 0;
  }
  if(!up) {
    notify_fail("You can't. The bucket is at the bottom of the well.\n");
    return 0;
  }
  if(sscanf(str, "rope%sbucket%s", tmp1, tmp2) ||
     sscanf(str, "bucket%srope%s", tmp1, tmp2)) {
    if(!tied_to_bucket) {
      notify_fail("The rope is already untied from the bucket.\n");
      return 0;
    }
    write("You untie the rope from the bucket.\n");
    say(NAME+" unties the rope from the bucket.\n", this_player());
    tied_to_bucket = 0;
    return 1;
  }

  if(sscanf(str, "rope%swell%s", tmp1, tmp2) ||
     sscanf(str, "well%srope%s", tmp1, tmp2)) {
    if(!tied_to_well) {
      notify_fail("The rope is already untied from the well.\n");
      return 0;
    }
    write("You untie the rope from the well.\n");
    say(NAME+" unties the rope from the well.\n", this_player());
    tied_to_well = 0;
    return 1;
  }
  write("Untie what from where?\n");
  return 1;
}



status look_at(string str) {
  if(str == "well") {
    write("There is a handle attached to the well.\n"+
          "Perhaps you could drink from it?\n");
    if(up && bucket && rope)
      write("The rope and bucket is at the top of the well.\n");
    if(!up && bucket && rope)
      write("The rope and bucket are at the bottom of the well.\n");
    if(!water)
      write("The well appears dry.\n");
    else
      write("The well appears to have some water in it.\n");

    if(!bucket) 
      write("There used to be a bucket attached to the wall.\n");

    if(tied_to_well)
      write("There is a rope tied to the well.\n");

    if(tied_to_bucket)
      write("There is a rope tied to the bucket.\n");
    return 1;
  }

  if(str == "bucket") {
    if(!bucket) {
      notify_fail("There is no bucket here.\n");
      return 0;
    }
    write("A small wooden bucket.\n");
    if(tied_to_bucket)
      write("The bucket is tied to a rope.\n");
    return 1;
  }

  if(str == "rope") {
    if(!rope) {
      notify_fail("There is no rope here.\n");
      return 0;
    }
    if(tied_to_well) 
      write("The rope is tied to the well.\n");
    if(tied_to_bucket)
      write("The rope is tied to a bucket.\n");
    return 1;
  }
  return::look_at(str);
}


status get_item(string str) {
  object ob;


  if(str == "bucket") {
    if(!bucket) {
      notify_fail("There is no bucket attached to the well.\n");
      return 0;
    }
    if(tied_to_bucket) {
      notify_fail("You can't. The bucket is tied to the well.\n");
      return 0;
    }
    ob = clone_object(CONTAINER);
    ob -> set_short("A bucket");
    ob -> set_long("A small wooden bucket.\n");
    ob -> set_weight(2);
    ob -> set_sell_destruct(1);
    ob -> set_value(10);
    if(!this_player()->add_weight(2)) {
      write("The bucket is too heavy. \n"+
            "You drop a bucket.\n");
      say(NAME+" drops a bucket.\n", this_player());
      move_object(ob, this_object());
    }
    else {
      write("You take the bucket.\n");
      say(NAME+" takes a bucket.\n", this_player());
      move_object(ob, this_player());
    }
    bucket = 0;
    return 1;
  }

  if(str == "rope") {
    if(!rope) {
      notify_fail("There is no rope here.\n");
      return 0;
    }
    if(tied_to_bucket) {
      notify_fail("You can't. The rope is tied to the bucket.\n");
      return 0;
    }
    if(tied_to_well) {
      notify_fail("You can't. The rope is tied to the well.\n");
      return 0;
    }
    write("You take the rope.\n");
    move_object(clone_object("objects/rope"),this_player());
    say(NAME+" takes a rope.\n", this_player());
    return 1;
    rope = 0;
  }
  return ::get_extra_object(str);
}