lima-1.0b5/
lima-1.0b5/driver/
lima-1.0b5/driver/ChangeLog.old/
lima-1.0b5/driver/Win32/
lima-1.0b5/driver/compat/
lima-1.0b5/driver/include/
lima-1.0b5/driver/testsuite/
lima-1.0b5/driver/testsuite/clone/
lima-1.0b5/driver/testsuite/command/
lima-1.0b5/driver/testsuite/data/
lima-1.0b5/driver/testsuite/etc/
lima-1.0b5/driver/testsuite/include/
lima-1.0b5/driver/testsuite/inherit/
lima-1.0b5/driver/testsuite/inherit/master/
lima-1.0b5/driver/testsuite/log/
lima-1.0b5/driver/testsuite/single/
lima-1.0b5/driver/testsuite/single/tests/compiler/
lima-1.0b5/driver/testsuite/single/tests/efuns/
lima-1.0b5/driver/testsuite/single/tests/operators/
lima-1.0b5/driver/testsuite/u/
lima-1.0b5/driver/tmp/
lima-1.0b5/etc/
lima-1.0b5/lib/WWW/help/
lima-1.0b5/lib/cmds/
lima-1.0b5/lib/cmds/create/
lima-1.0b5/lib/cmds/player/attic/
lima-1.0b5/lib/contrib/bboard/
lima-1.0b5/lib/contrib/boards/
lima-1.0b5/lib/contrib/marriage/
lima-1.0b5/lib/contrib/roommaker/
lima-1.0b5/lib/contrib/transient_effect/
lima-1.0b5/lib/daemons/channel/
lima-1.0b5/lib/daemons/imud/
lima-1.0b5/lib/data/
lima-1.0b5/lib/data/config/
lima-1.0b5/lib/data/links/
lima-1.0b5/lib/data/news/
lima-1.0b5/lib/data/players/
lima-1.0b5/lib/data/secure/
lima-1.0b5/lib/domains/
lima-1.0b5/lib/domains/std/2.4.5/maze1/
lima-1.0b5/lib/domains/std/2.4.5/npc/
lima-1.0b5/lib/domains/std/2.4.5/post_dir/
lima-1.0b5/lib/domains/std/2.4.5/sub/
lima-1.0b5/lib/domains/std/camera/
lima-1.0b5/lib/domains/std/config/
lima-1.0b5/lib/domains/std/cult/
lima-1.0b5/lib/domains/std/effects/
lima-1.0b5/lib/domains/std/misc/
lima-1.0b5/lib/domains/std/monsters/
lima-1.0b5/lib/domains/std/recorder/
lima-1.0b5/lib/domains/std/rooms/
lima-1.0b5/lib/domains/std/rooms/beach/
lima-1.0b5/lib/domains/std/rooms/labyrinth/
lima-1.0b5/lib/domains/std/school/
lima-1.0b5/lib/domains/std/school/O/
lima-1.0b5/lib/domains/std/spells/
lima-1.0b5/lib/domains/std/spells/stock-mage/
lima-1.0b5/lib/domains/std/spells/stock-priest/
lima-1.0b5/lib/help/
lima-1.0b5/lib/help/admin/
lima-1.0b5/lib/help/hints/General_Questions/
lima-1.0b5/lib/help/hints/Pirate_Quest/
lima-1.0b5/lib/help/player/
lima-1.0b5/lib/help/player/bin/
lima-1.0b5/lib/help/player/quests/
lima-1.0b5/lib/help/wizard/
lima-1.0b5/lib/help/wizard/coding/guilds/
lima-1.0b5/lib/help/wizard/coding/rooms/
lima-1.0b5/lib/help/wizard/lib/daemons/
lima-1.0b5/lib/help/wizard/lib/lfun/
lima-1.0b5/lib/help/wizard/lib/std/
lima-1.0b5/lib/help/wizard/mudos_doc/
lima-1.0b5/lib/help/wizard/mudos_doc/applies/
lima-1.0b5/lib/help/wizard/mudos_doc/applies/interactive/
lima-1.0b5/lib/help/wizard/mudos_doc/applies/parsing/
lima-1.0b5/lib/help/wizard/mudos_doc/concepts/
lima-1.0b5/lib/help/wizard/mudos_doc/driver/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/arrays/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/buffers/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/compile/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/filesystem/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/floats/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/functions/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/general/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/mappings/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/mixed/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/numbers/
lima-1.0b5/lib/help/wizard/mudos_doc/efuns/parsing/
lima-1.0b5/lib/help/wizard/mudos_doc/lpc/constructs/
lima-1.0b5/lib/help/wizard/mudos_doc/lpc/types/
lima-1.0b5/lib/include/driver/
lima-1.0b5/lib/log/
lima-1.0b5/lib/obj/admtool/
lima-1.0b5/lib/obj/admtool/internal/
lima-1.0b5/lib/obj/admtool/mudinfo/
lima-1.0b5/lib/obj/admtool/secure/
lima-1.0b5/lib/obj/secure/
lima-1.0b5/lib/obj/secure/cmd/
lima-1.0b5/lib/obj/secure/mailers/
lima-1.0b5/lib/obj/secure/shell/
lima-1.0b5/lib/obj/secure/shell/classes/
lima-1.0b5/lib/obj/tasktool/
lima-1.0b5/lib/obj/tasktool/internal/
lima-1.0b5/lib/open/
lima-1.0b5/lib/secure/
lima-1.0b5/lib/secure/cgi/
lima-1.0b5/lib/secure/modules/
lima-1.0b5/lib/secure/simul_efun/
lima-1.0b5/lib/std/adversary/
lima-1.0b5/lib/std/adversary/advancement/
lima-1.0b5/lib/std/adversary/armor/
lima-1.0b5/lib/std/adversary/blows/
lima-1.0b5/lib/std/adversary/death/
lima-1.0b5/lib/std/adversary/formula/
lima-1.0b5/lib/std/adversary/health/
lima-1.0b5/lib/std/adversary/pulse/
lima-1.0b5/lib/std/adversary/wield/
lima-1.0b5/lib/std/classes/event_info/
lima-1.0b5/lib/std/container/
lima-1.0b5/lib/std/living/
lima-1.0b5/lib/std/modules/contrib/
lima-1.0b5/lib/std/patterns/
lima-1.0b5/lib/std/race/
lima-1.0b5/lib/std/race/restricted/
lima-1.0b5/lib/std/room/
lima-1.0b5/lib/tmp/
lima-1.0b5/lib/trans/
lima-1.0b5/lib/trans/admincmds/
lima-1.0b5/lib/trans/obj/
lima-1.0b5/lib/wiz/
/* Do not remove the headers from this file! see /USAGE for more info. */

#include <mudlib.h>
#include <setbit.h>

/* Our descriptions:
 * long:   should be a complete sentence or a closure.
 * in_room_desc: A longer string for rooms.  Titles for players.
 * plural_in_room_desc: Message for more than 1.
 */
/* if these are zero, sane defaults are used based on 'names'. */
private nosave mixed long;
private nosave mixed in_room_desc;
private nosave string plural_in_room_desc;
/* our description when we haven't been touched.  Really an
 * in_room_desc, not a long */
private string untouched_long;

/* these are somewhere else... */
int test_flag(int);
int is_visible();
int is_attached();
string the_short();
string short();
string plural_short();
string a_short();
varargs mixed call_hooks();


/* this one is here, but this is a forward declaration. */
string query_in_room_desc();

//:FUNCTION set_long
//Set the long description of an object
nomask void set_long(mixed str)
{
    long = str;
    if ( functionp(long) ) return;
    if ( long == "" || long[<1] != '\n' ) long += "\n";
}

//:FUNCTION get_base_long
// Get the variable long, not the full description...
string get_base_long()
{
    string res;

    if(!is_visible())
      return "Funny, you don't see anything at all.";

    res = evaluate(long);
    if (!res)
	return "You see nothing special about " + the_short() + ".\n";

    return res;
}

string get_extra_long()
{
//:HOOK extra_long
//The returned strings are added on to the end of the long description.
    return call_hooks("extra_long", (: $1 + $2 :), "") || "";
}

//:FUNCTION long
//Return the verbose description of an object that you see when you look
//at it.
string long()
{
  string ret = get_base_long() + get_extra_long();
  if(this_user() && wizardp(this_user()))
    if(sizeof(ANNOTATION_D->retrieve_annotations(base_name(this_object()))))
      ret += "%^YELLOW%^Attached to it is a yellow sticky note, "
          "bearing the word \"discuss\".\n%^RESET%^";
  return ret;
}

protected string array discarded_message, plural_discarded_message;

string untouched_long() {
    return untouched_long;
}

//:FUNCTION show_in_room
//Return a string appropriate for inclusing in a room long description.
//Note that duplicatep() objects return nothing.
string show_in_room()
{
    string str;
    int our_count;
    if(!is_visible()) return 0;
    /* If an object is attached, it is considered part of its
     * parent and it's the parent's responsibility to print an
     * appropriate description.  For example, wielded weapons are
     * attached and should be included in the monster's description.
     * c.f. Zork's:
     *    A nasty-looking troll, brandishing a bloody axe, blocks all
     *         passages out of the room.
     */
    if (is_attached()) return 0;
    our_count = count();
    if (our_count > 4) {
	if (plural_in_room_desc)
	    return sprintf( plural_in_room_desc, "many");

	str = short();
	if (!str) return 0;

	return "There are many "+plural_short()+" here.\n";
    }
    if (our_count > 1 )
    {
	if( plural_in_room_desc ) 
	    return sprintf( plural_in_room_desc, our_count+"");

	str = short();
	if( !str ) 
	    return 0;

	//	if( query_ob_flag( AUTO_IN_ROOM_DESC ) )

	if (!plural_discarded_message)
	    plural_discarded_message = MESSAGES_D->get_messages("discarded-plural");
	return capitalize(sprintf( choice(plural_discarded_message),
		       sprintf("%d %s", our_count, plural_short())));
    }

    if (!test_flag(TOUCHED) && (str = untouched_long()))
	return str;

    if( str = query_in_room_desc() )
	return str;

    str = a_short();

    if( !str )
	return 0;

    //    if( query_ob_flag( AUTO_IN_ROOM_DESC ) )

    if (!discarded_message)
	discarded_message = MESSAGES_D->get_messages("discarded");
    
    return capitalize(sprintf( choice(discarded_message), str ));
}

//:FUNCTION set_in_room_desc
//Set the description an object has when it is sitting in a room
protected void set_in_room_desc( string arg )
{
  in_room_desc = arg;
}

void set_plural_in_room_desc( string arg ){ plural_in_room_desc = arg; }

string query_possessive(){  return "its"; }

//:FUNCTION set_untouched_desc
//set the untouched description of the object.  This is the way the object
//is described originally, but not after is has been taken or moved.
void set_untouched_desc(string arg){
    if(stringp(arg)) untouched_long = arg;
}

string query_in_room_desc()
{
    if(!is_visible()) 
      return "";
    return (string)evaluate(in_room_desc);
}