foundationI_fluffos_v1/
foundationI_fluffos_v1/bin/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/ChangeLog.old/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/Win32/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/compat/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/compat/simuls/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/include/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/clone/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/command/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/data/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/etc/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/include/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/inherit/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/inherit/master/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/log/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/compiler/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/efuns/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/operators/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/u/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/tmp/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/windows/
foundationI_fluffos_v1/lib/
foundationI_fluffos_v1/lib/cmds/ambassador/
foundationI_fluffos_v1/lib/cmds/database/
foundationI_fluffos_v1/lib/cmds/soul/
foundationI_fluffos_v1/lib/daemon/include/
foundationI_fluffos_v1/lib/daemon/save/
foundationI_fluffos_v1/lib/daemon/services/
foundationI_fluffos_v1/lib/daemon/soul/
foundationI_fluffos_v1/lib/doc/build/
foundationI_fluffos_v1/lib/doc/build/room/
foundationI_fluffos_v1/lib/doc/build/virtual/
foundationI_fluffos_v1/lib/doc/driver/
foundationI_fluffos_v1/lib/doc/efun/
foundationI_fluffos_v1/lib/doc/etc/
foundationI_fluffos_v1/lib/doc/help/creator/
foundationI_fluffos_v1/lib/doc/help/hm/
foundationI_fluffos_v1/lib/doc/help/user/
foundationI_fluffos_v1/lib/doc/lpc/basic/
foundationI_fluffos_v1/lib/doc/lpc/data_types/
foundationI_fluffos_v1/lib/doc/lpc/etc/
foundationI_fluffos_v1/lib/doc/lpc/intermediate/
foundationI_fluffos_v1/lib/doc/lpc/types/
foundationI_fluffos_v1/lib/doc/mudlib/
foundationI_fluffos_v1/lib/doc/mudlib/features/
foundationI_fluffos_v1/lib/domains/Examples/etc/
foundationI_fluffos_v1/lib/domains/Examples/room/
foundationI_fluffos_v1/lib/domains/Examples/virtual/
foundationI_fluffos_v1/lib/domains/Examples/virtual/exaA/
foundationI_fluffos_v1/lib/domains/Examples/virtual/exaB/
foundationI_fluffos_v1/lib/domains/Examples/weapon/
foundationI_fluffos_v1/lib/domains/Standard/
foundationI_fluffos_v1/lib/domains/Standard/pools/
foundationI_fluffos_v1/lib/domains/Standard/std/
foundationI_fluffos_v1/lib/domains/Standard/xtra/
foundationI_fluffos_v1/lib/include/
foundationI_fluffos_v1/lib/news/
foundationI_fluffos_v1/lib/secure/cfg/
foundationI_fluffos_v1/lib/secure/cmds/adm/
foundationI_fluffos_v1/lib/secure/cmds/ambassador/
foundationI_fluffos_v1/lib/secure/cmds/mortal/
foundationI_fluffos_v1/lib/secure/etc/
foundationI_fluffos_v1/lib/secure/etc/approval/
foundationI_fluffos_v1/lib/secure/etc/elections/
foundationI_fluffos_v1/lib/secure/etc/mudlib/
foundationI_fluffos_v1/lib/secure/etc/quests/
foundationI_fluffos_v1/lib/secure/save/daemon/
foundationI_fluffos_v1/lib/secure/save/postal/d/descartes/
foundationI_fluffos_v1/lib/secure/save/users/d/
foundationI_fluffos_v1/lib/secure/std/
foundationI_fluffos_v1/lib/std/obj/
foundationI_fluffos_v1/lib/std/room/
foundationI_fluffos_v1/lib/std/user/
foundationI_fluffos_v1/lib/std/virtual/
foundationI_fluffos_v1/old/
foundationI_fluffos_v1/win32/
//      /std/room/senses.c
//      from the Nightmare Mudlib
//      allows players to search, hide, smell, listen in every room
//      created by Descartes of Borg 18 june 1993
//      modified to save MAJOR memory by Descartes of Borg 930830

#include <config.h>
#include <rooms.h>

object __Search_Obj;
private mapping __Smells, __Listens, __Searches;

void set_search(string item, mixed desc);
void set_smell(string item, mixed desc);
void set_listen(string item, mixed desc);
void remove_search(string item);
void remove_smell(string item);
void remove_listen(string item);
mixed query_search(string item);
mixed query_smell(string item);
mixed query_listen(string item);

void create() {
    __Search_Obj = 0;
    __Smells = ([]);
    __Listens = ([]);
    __Searches = ([]);
}

void init() {
    add_action("hide_something", "hide");
    add_action("search_room", "search");
    add_action("smell_things", "smell");
    add_action("do_listen", "listen");
}

int hide_something(string str) {
    int tmp, tmp_wt;
    object ob;

    if(this_player()->query_paralyzed())
      return notify_fail("You cannot move.\n");
    if(!str) return notify_fail("Hide what?\n");
    if(!(ob = present(lower_case(str), this_player())))
      return notify_fail("You do not have that.\n");
    if(living(ob) || ob->query_property("no hide"))
      return notify_fail("You cannot hide that.\n");
    if(this_player()->query_disable()) return 1;
    this_player()->set_disable();
    tmp_wt = (int)ob->query_weight();
    tmp = 25*(tmp_wt/1000);
    this_player()->add_sp(-10);
    if(random(tmp) > random((int)this_player()->query_skill("stealth"))) {
        notify_fail("You are unable to hide "+str+".\n");
        return 0;
    }
    if(__Search_Obj) {
        message("my_action", sprintf("You are unable to hide %s.", str),
          this_player());
        return 1;
    }
    this_player()->add_skill_points("stealth", random(tmp_wt));
    message("my_action", "You hide it in the shadows.", this_player());
    if(random(101) > (int)this_player()->query_skill("stealth"))
        message("other_action", sprintf("%s hides something.",
          (string)this_player()->query_cap_name()), environment(this_player()),
          ({ this_player() }));
    __Search_Obj = ob;
    ob->move("/domains/Standard/xtra/cache");
    return 1;
}

int search_room(string str) {
    int i;

    if(this_player()->query_paralyzed())
      return notify_fail("You are unable to move.\n");
    if(__Search_Obj && str == "shadows") {
        message("my_action", sprintf("You find %s",
          (string)__Search_Obj->query_name()), this_player());
        message("other_action", sprintf("%s finds something in the shadows.",
          (string)this_player()->query_cap_name()), environment(this_player()),
          ({ this_player() }));
        __Search_Obj->move(this_object());
        __Search_Obj = 0;
        return 1;
    }
    if(!__Searches) return notify_fail("You find nothing of interest.\n");
    if(str == "default") return notify_fail("What is a default?\n");
    if(!str || str == "") str = "default";
    if(functionp(__Searches[str])) (*__Searches[str])(str);
    else if(stringp(__Searches[str])) {
        message("my_action", __Searches[str], this_player());
        message("other_action", (string)this_player()->query_cap_name() +
          " searches around.", this_object(), ({ this_player() }) );
    }
    else message("my_action", "You find nothing odd.", this_player());
    return 1;
}

status smell_things(string str) {
    if(!str || str == "") str = "default";
    if(!__Smells || !__Smells[str]) {
        if(!this_object()->id(str))
          return notify_fail("You do not notice that here.\n");
        else message("smell", "You smell no odd odors.", this_player());
        return 1;
    }
    if(functionp(__Smells[str]))
      message("smell", (string)((*__Smells[str])(str)), this_player());
    else if(stringp(__Smells[str])) {
        message("smell", __Smells[str], this_player());
        if(str == "default") message("other_action",
          (string)this_player()->query_cap_name()+" smells around.",
          this_object(), ({ this_player() }));
        else message("other_action", (string)this_player()->query_cap_name()+
          " smells the "+str+".", this_object(), ({this_player()}));
    }
    else message("smell","You notice no interesting odors.",this_player());
    return 1;
}

status do_listen(string str) {
    if(!str || str == "") str = "default";
    else if(sscanf(str, "to %s", str) != 1)
      return notify_fail("Listen to what?\n");
    if(!__Listens || !__Listens[str]) {
        if(!this_object()->id(str))
          return notify_fail("You do not notice that here.\n");
        else message("listen", "You hear nothing unusual.",this_player());
        return 1;
    }
    if(functionp(query_listen(str)))
      message("listen", (string)((*__Listens[str])(str)), this_player());
    else if(stringp(__Listens[str])) {
        message("listen", __Listens[str], this_player());
        if(str == "default") message("other_action",
          (string)this_player()->query_cap_name()+" listens intently.",
          this_object(), ({ this_player() }) );
        else message("other_action", (string)this_player()->query_cap_name()+
          " listens intently to "+str+".", this_object(),({this_player()}));
    }
    else message("listen", "You hear nothing unusual.", this_player());
    return 1;
}

void set_search(mixed item, mixed desc) {
    int i;

    if(!item) item = "default";
    else if(pointerp(item)) {
        i = sizeof(item);
        while(i--) set_search(item[i], desc);
        return;
    }
    else if(!stringp(item)) error("Bad argument 1 to set_searc().\n");
    if(functionp(desc) && (int)master()->valid_function(desc))
      __Searches[item] = copy(desc);
    else if(stringp(desc)) __Searches[item] = desc;
    else error("Bad argument 2 to set_search().\n");
}

void remove_search(string item) { map_delete(__Searches, item); }

void set_smell(mixed item, mixed desc) {
    int i;

    if(!item) item = "default";
    else if(pointerp(item)) {
        i = sizeof(item);
        while(i--) set_smell(item[i], desc);
        return;
    }
    else if(!stringp(item)) error("Bad argument 1 to set_smell().\n");
    if(functionp(desc) && (int)master()->valid_function(desc))
      __Smells[item] = copy(desc);
    else if(stringp(desc)) __Smells[item] = desc;
    else error("Bad argument 2 to set_smell().\n");
}

void remove_smell(string item) { map_delete(__Smells, item); }

void set_listen(mixed item, mixed desc) {
    int i;

    if(!item) item = "default";
    else if(pointerp(item)) {
        i = sizeof(item);
        while(i--) set_listen(item[i], desc);
        return;
    }
    else if(!stringp(item)) error("Bad argument 1 to set_listen().\n");
    if(functionp(desc) && (int)master()->valid_function(desc))
      __Listens[item] = copy(desc);
    else if(stringp(desc)) __Listens[item] = desc;
    else error("Bad argument 2 to set_listen().\n");
}

void remove_listen(string item) { map_delete(__Listens, item); }

mixed query_search(string item) { 
    if(functionp(__Searches[item])) return copy(__Searches[item]);
    else return __Searches[item];
}

mixed query_smell(string item) {
    if(functionp(__Smells[item])) return copy(__Smells[item]);
    else return __Smells[item];
}

mixed query_listen(string item) {
    if(functionp(__Listens[item])) return copy(__Listens[item]);
    else return __Listens[item];
}