nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/win32/
/*    /std/obj/deed.c
 *    from Nightmare IV
 *    a deed to a new estate
 *    created by Descartes of Borg 940515
 */

#include <std.h>
#include <dirs.h>
#include <daemons.h>
#include <security.h>

inherit OBJECT;

static private string __File, __Short, __Long, __Smell, __Listen;
static private int __Indoors;

void create() {
    Object::create();
    set_name("estate deed");
    set_id( ({ "deed", "estate deed" }) );
    set_adjectives( ({ "estate", "an", "a" }) );
    set_short("an estate deed");
    set_long("A script of paper indicating that the bearer may claim "
      "land in places which allow such claiming for the building of "
      "an estate.  The owner, a high mortal, should take the deed to "
      "the place where the estate is to be built and type <build estate>."
    );
    set_mass(0);
    set_value(10);
    set_destroy();
}

void init() {
    Object::init();
    add_action("cmd_build", "build");
}

static int cmd_build(string str) {
    if(str != "estate") return 0;
    message("system", "You will now be asked to give some information "
      "about the estate you plan to build.  In the room you now stand, "
      "the description \"The estate of "+
      capitalize((string)this_player()->query_name())+" stands here.\"  "
      "will appear.  Players will type <enter estate> to get into "
      "the entrance room of your estate.  The information you are "
      "being asked is dedicated to configuring the entrance area to your "
      "estate.  Make sure that your entrance area makes sense with respect "
      "to the area surrounding it, or approval will move it.", this_player());
    message("prompt", "\nFirst, is this entrance indoors or outdoors? ",
      this_player());
    input_to("get_indoors");
  }

static void get_indoors(string str) {
    if(!str) str = "";
    if(str == "indoors") __Indoors = 1;
    else if(str == "outdoors") __Indoors = 0;
    else {
      message("prompt", "Answer \"indoors\" or \"outdoors\": ", this_player());
        input_to("get_indoors");
        return;
    }
    message("system", "Now you will asked to give a one line description "
      "of the entrance area.  For example, \"the entrance to "+
      possessive_noun(this_player())+" estate\" is a good short. "
      "Make sure the words are lower case unless referring to a proper "
      "noun.", this_player());
    message("prompt", "Enter a short description: ", this_player());
    input_to("get_short");
  }

static void get_short(string str) {
    if(str == "" || !str) {
        message("prompt", "Enter a valid short: ", this_player());
        input_to("get_short");
        return;
      }
    __Short = str;
    message("system", "Now create a verbose description for the room.  "
      "This is what people will see when they type \"look\".",this_player());
    message("system", "You will enter an editor like when you mail to "
      "enter this long description.",this_player());
    if(file_exists("/tmp/"+geteuid(this_player())+".build"))
      rm("/tmp/"+geteuid(this_player())+".build");
    this_player()->edit("/tmp/"+geteuid(this_player())+".build",
      "get_long", this_object());
}

static void get_long(){
    string str;

    if(!(str = read_file("/tmp/"+this_player()->query_name()+".build"))) {
        __Indoors = 0;
        __Short = 0;
        message("system", "Build aborted.", this_player());
        return;
    }
    __Long = capitalize(replace_string(str, "\n", " "));
    message("system", "If you want to have a general smell to the room, "
      "enter it here.  Just hit <return> if there is no general scent.",
      this_player());
    message("prompt", "Enter smell: ", this_player());
    input_to("get_smell");
}

static void get_smell(string str) {
    if(str == "" || !str) __Smell = 0;
    else __Smell = capitalize(str);
    message("prompt", "Now any general sounds? ", this_player());
    input_to("get_listen");
}

static void get_listen(string str) {
    if(str == "" || !str) __Listen = 0;
    else __Listen = capitalize(str);
    __File = sprintf("%s/%s/%d.dat", ESTATES_DIRS, geteuid(this_player()),
      time());
    seteuid(UID_ESTATES);
    if(file_size(sprintf("%s/%s", ESTATES_DIRS, geteuid(this_player()))) !=-2)
      mkdir(sprintf("%s/%s", ESTATES_DIRS, geteuid(this_player())));
    write_file(__File, sprintf("set_property: $indoors;#%d\n", __Indoors));
    write_file(__File, sprintf("set_short: $%s\n", __Short));
    write_file(__File, sprintf("set_long: $%s\n", __Long));
    write_file(__File, sprintf("add_exit: $%s;$out\n", 
      file_name(environment(this_player()))));
    if(__Smell) write_file(__File,sprintf("set_smell: $default;$%s",__Smell));
    if(__Listen)
      write_file(__File, sprintf("set_listen: $default;$%s", __Listen));
    ESTATES_D->create_estate(environment(this_player()), __File,
      geteuid(this_player()));
    message("system", "Estate begun.", this_player());
}