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/
#include <flags.h>
#include <daemons.h>
#include <objects.h>
#include <cfg.h>

object __Admin;
string __Name, __CapName, __Password;

static void logon() {
    receive("Welcome to the "+mudlib()+" "+mudlib_version()+" installation "
      "process.\n");
    receive("You will be asked a series of questions aimed at customizing "
      "your MUD.\n");
    receive("These questions are designed for the mudlib only.  You should "
      "have already \nrun the installation script at the host level which "
      "comes with the mudlib.\n");
    receive("\nWhat is the name of one person with full superuser access? ");
    input_to("input_name");
}

static void input_name(string str) {
    if(!((int)BANISH_D->valid_name(__Name=convert_name(__CapName=str)))) {
        receive("That is not a valid name.  Enter another: ");
        input_to("input_name");
        return;
    }
    __Admin = (object)master()->player_object(__Name);
    __Admin->set_name(__Name);
    __Admin->set_position("head arch");
    mkdir(DIR_USERS+"/"+__Name[0..0]);
    receive("\nPassword: ");
    input_to("input_password", I_NOECHO | I_NOESC);
}

static void input_password(string str) {
    if(strlen(str) < 5) {
        receive("An admin password of less than 5 letters?  Get real!\n");
        receive("Password: ");
        input_to("input_password", I_NOECHO | I_NOESC);
        return;
    }
    __Password = str;
    receive("\nConfirm password: ");
    input_to("confirm_password", I_NOECHO | I_NOESC);
}

static void confirm_password(string str) {
    if(str != __Password) {
        receive("\nPasswords do not match.  Password: ");
        input_to("input_password", I_NOECHO | I_NOESC);
        return;
    }
    __Admin->set_password(crypt(__Password, 0));
    __CapName = capitalize(__CapName);
    receive("\nEnter in your capitalized name ("+__CapName+" is default): ");
    input_to("input_cap_name");
}

static void input_cap_name(string str) {
    if(str == "" || !str) str = __CapName;
    else if(convert_name(str = capitalize(str)) != __Name) {
        receive("\nYou can't do that! Capitalized name: ");
        input_to("input_cap_name");
        return;
    }
    __Admin->set_cap_name(__CapName);
    receive("\nWhat is your gender? ");
    input_to("input_gender");
}

static void input_gender(string str) {
    __Admin->set_gender(str);
    receive("\nWhat is "+possessive_noun(__CapName)+" real name? ");
    input_to("input_rname");
}

static void input_rname(string str) {
    if(str == "" || !str) str = "Unknown";
    __Admin->set_rname(str);
    receive("\nWhat is the email address? ");
    input_to("input_email");
}

static void input_email(string str) {
    object ob;
    string tmp;

    if(str == "" || !str) str = "Unknown";
    __Admin->set_email(str);
    __Admin->save_player(__Name);
    tmp = read_file(CFG_GROUPS);
    rm(CFG_GROUPS);
    mkdir(REALMS_DIRS+"/"+__Name);
    cp(DIR_STANDARD_DOMAIN+"/xtra/workroom.c", REALMS_DIRS+"/"+__Name+
      "/workroom.c");
    tmp = replace_string(tmp, "ADMIN", __Name);
    write_file(CFG_GROUPS, tmp);
    destruct(master());
    if(ob = find_object(OB_LOGIN)) destruct(ob);
    rename("/secure/std/login.real", "/secure/std/login.c");
    destruct(__Admin);
    receive("You will be disconnected.  Login as your admin character.\n");
    destruct(master());
    destruct(this_object());
}

string query_name() { return __Name; }