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 <std.h>

inherit OBJECT;

static private string __Short, __Long, __File;
static private mapping __Actions, __Items, __Smells, __Listens, __Objects;
static private void main_menu();
static void primary_prompt();
static private string describe_long();

void create() {
    Object::create();
    set_name("roomcreator");
    set_id( ({ "roomcreator" }) );
    set_adjectives( ({ "silly" }) );
    set_short("a room creator");
    set_long("A room creator");
    set_prevent_get( (: "remove" :) );
    set_prevent_put( (: "remove" :) );
    set_prevent_drop( (: "remove" :) );
    set_invis(1);
    set_mass(0);
    set_value(0);
    __Actions = ([]);
    __Items = ([]);
    __Smells = ([]);
    __Listens = ([]);
    __Objects = ([]);
}
    
void create_room(string str) {
    string file;

    file = absolute_path((string)this_player()->get_path(), str);
    if(!((int)master()->valid_write(file, this_player()))) {
        this_object()->remove();
        return;
      }
    __File = file;
    main_menu();
    primary_prompt();
    input_to("main_cmd");
  }

static void primary_prompt() { message("prompt","\nCommand: ",this_player()); }

static private void main_menu() {
    message("info", "\n%^INITTERM%^The Nightmare Mudlib Room Creator "
      "\t\tDescartes of Borg 1993", this_player());
    message("info", sprintf("\n%s", center(sprintf("File name: %s", __File))),
      this_player());
    if(__Short) message("info", sprintf("\n\n%%^BOLD%%^Short:%%^RESET%%^ "
      "%s", __Short), this_player());
    else message("info","\n\n%^BOLD%^No short description set.",this_player());
    if(__Long) message("info", sprintf("\n\nLong:\n%s", 
      describe_long()), this_player());
    else message("info", "\n\n%^BOLD%^No long description set.",this_player());
    message("info", "\n\n\t\tedit: L)ong description, S)hort description",
      this_player());
    message("info", "\tcreate/remove: a)ctions, i)tems, l)istens, o)bjects, "
      "s)mells", this_player());
}

static private string describe_long() {
    string *items;
    string ret;
    int i, j, x;

    i = sizeof(items = keys(__Items));
    ret = __Long;
    while(i--) {
        if(stringp(items[i]) && (x = strsrch(__Long, items[i])) != -1)
          ret = replace_string(ret, items[i], sprintf("%%^BOLD%%^GREEN%%^%s"
            "%%^RESET%%^", items[i]));
        else if(pointerp(items[i])) {
            j = sizeof(items[i]);
            while(j--) 
              if((x = strsrch(__Long, items[i][j])) != -1)
                ret = replace_string(ret, items[i][j],
                  sprintf("%%^BOLD%%^GREEN%%^%s%%^RESET%%^", items[i][j]));
	  }
    }
    return ret;
}

static void main_cmd(string str) {
    string *tmp;
    string args;

    if(str == "" || !str) {
        message("info", "\n%^RED%^Invalid room creator command.", 
          this_player());
        primary_prompt();
        input_to("main_cmd");
        return;
    }
    str = (tmp = explode(str, " "))[0][0..0];
    if(sizeof(tmp) > 1) args = implode(tmp, " ");
    else args = "";
    switch(str) {
        case "a": this_object()->actions(args); return;
        case "h": this_object()->help(args); return;
        case "i": this_object()->items(args); return;
        case "l": this_object()->listens(args); return;
        case "L": this_object()->edit_long(); return;
        case "o": this_object()->Objects(args); return;
        case "s": this_object()->smells(args); return;
        case "S": this_object()->short(args); return;
    }
}

static private void edit_long() {
    if(__Long) write_file("/tmp/"+(string)this_player()->query_name()+
      ".RoomCreator", wrap(__Long, 75));
    message("info", "\n%^INITTERM%^Long description for: "+__File,
      this_player());
    this_player()->edit("/tmp/"+(string)this_player()->query_name()+
      ".RoomCreator", "change_long", this_object());
}

void change_long() {
    string str;

    if(str = read_file("/tmp/"+(string)this_player()->query_name()+
      ".RoomCreator")) __Long = replace_string(str, "\n", " ");
    main_menu();
    primary_prompt();
    input_to("main_cmd");
}