act.informative.c

Argila2.0/pp/src/act.informative.c · 233.5 KB

From the archive Argila2.zip

Download the archive   « Back to the archive contents

/** 
*	\file act.informative.c
*	Informational Module provides status and informative prompts 
*
*	The purpose of this module is provide information about the player and the
*	world, using text, various types of writings or prompts.
*
*	Copyright 2005, Mary C. Huston, All rights reserved.
*	Copyright (C) 2004, Shadows of Isildur: Traithe	
*
*	The program(s) may be used and/or copied only with written
*	permission or in accordance with the terms and conditions
*	stipulated in the license from DIKU GAMMA (0.0) and SOI.
*
*	\author Mary Huston
*	\author Email:  auroness@gmail.com
*
******************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/stat.h>

#include "structs.h"
#include "utils.h"
#include "protos.h"
#include "decl.h"


#define skill_lev(val) val >= 70 ? " Master " : val >= 50 ? " Adroit " : val >= 30 ? "Familiar" : " Novice "

char	*frame_built [] = {
    "fragily-built",
    "scantly-built",
    "lightly-built",
    "typically-built",
    "heavily-built",
    "massively-built",
    "gigantically-built",
    "\n"
};


char	*verbal_intox[] = { 
	"sober", 
	"tipsy", 
	"slightly drunk", 
	"drunk", 
	"intoxicated",
	"plastered",
	"\n"};

char	*verbal_hunger[] = { 
	"starving", 
	"hungry", 
	"feeling slightly hungry", 
	"feeling peckish", 
	"quite full",
	"absolutely stuffed",
	"\n"};

char	*verbal_thirst[] = { 
	"dying of thirst", 
	"quite parched", 
	"feeling thirsty", 
	"feeling slightly thirsty",
	"nicely quenched",
	"completely sated",
	"\n"};

void do_credits (CHAR_DATA *ch, char *argument, int cmd)
{
	do_help (ch, "diku_license", 0);
	return;
}

void target_sighted (CHAR_DATA *ch, CHAR_DATA *targ)
{
	VIEWED_DATA		*sighted = NULL;

	if ( !ch || !targ )
		return;

	if ( !ch->sighted ) {
		CREATE (ch->sighted, VIEWED_DATA, 1);
		ch->sighted->target = targ;
		return;
	}
	for ( sighted = ch->sighted; sighted; sighted = sighted->next ) {
		if ( sighted->target == targ )
			return;
		if ( !sighted->next ) {
			CREATE (sighted->next, VIEWED_DATA, 1);
			sighted->next->target = targ;
			return;
		}
	}
}

char *tactical_status (CHAR_DATA *ch)
{
	CHAR_DATA	*tch;
	AFFECTED_TYPE	*af;
	static char 	status [MAX_STRING_LENGTH];
	int		i = 0;

	*status = '\0';

	if ( get_affect (ch, MAGIC_GUARD) || get_affect (ch, AFFECT_GUARD_DIR) )
		snprintf (status + strlen(status), MAX_STRING_LENGTH, " #6(guarding)#0");

	for ( tch = ch->room->people; tch; tch = tch->next_in_room ) {
		if ( (af = get_affect (tch, MAGIC_GUARD)) && ((CHAR_DATA *)af->a.spell.t) == ch )
			i++;
	}

	if ( i > 0 ) {
		if ( i == 1 )
			snprintf (status + strlen(status), MAX_STRING_LENGTH, " #2(guarded)#0");
		else if ( i > 1 )
			snprintf (status + strlen(status), MAX_STRING_LENGTH, " #2(guarded x %d)#0", i);
	}

	i = 0;

	if ( ch->fighting )
		i++;

	for ( tch = ch->room->people; tch; tch = tch->next_in_room ) {
		if ( tch == ch->fighting )
			continue;
		if ( tch->fighting == ch )
			i++;
	}

	if ( i > 0 ) {
		if ( i == 1 )
			snprintf (status + strlen(status), MAX_STRING_LENGTH, " #1(engaged)#0");
		else if ( i > 1 )
			snprintf (status + strlen(status), MAX_STRING_LENGTH, " #1(engaged x %d)#0", i);
	}

	return status;
}

void do_group (CHAR_DATA *ch, char *argument, int cmd)
{
	CHAR_DATA	*tch = NULL;
	CHAR_DATA	*top_leader = NULL;
	char		status [MAX_STRING_LENGTH] = {'\0'};
	char		buf [MAX_STRING_LENGTH] = {'\0'};
	bool		found = FALSE;
	char		*temp_arg1 = NULL;
	char		*temp_arg2 = NULL;
	char		*temp_arg3 = NULL;
	
	argument = one_argument (argument, buf);

	if ( *buf && !strcasecmp (buf, "open") ) {
		if ( !IS_SET (ch->plr_flags, GROUP_CLOSED) ) {
			send_to_char ("Your group is already open!\n", ch);
			return;
		}
		REMOVE_BIT (ch->plr_flags, GROUP_CLOSED);
		send_to_char ("You will now allow people to follow you.\n", ch);
		return;
	}
	else if ( *buf && !strcasecmp (buf, "close") ) {
		if ( IS_SET (ch->plr_flags, GROUP_CLOSED) ) {
			send_to_char ("Your group is already closed!\n", ch);
			return;
		}
		SET_BIT (ch->plr_flags, GROUP_CLOSED);
		send_to_char ("You will no longer allow people to follow you.\n", ch);
		return;
	}

	if ( !(top_leader = ch->following) )
		top_leader = ch;

	if ( !top_leader ) {
		send_to_char ("You aren't in a group.\n", ch);
		return;
	}

	*status = '\0';
	
	temp_arg1 = char_short (top_leader);
	temp_arg2 = wound_total (top_leader);
	temp_arg3 = tactical_status (top_leader);
	snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 [%s]%s, leading:\n\n", temp_arg1, temp_arg2, temp_arg3);
	buf [2] = toupper(buf[2]);

	for ( tch = top_leader->room->people; tch; tch = tch->next_in_room ) {
		if ( tch->following != top_leader )
			continue;
		if ( !CAN_SEE (ch, tch) )
			continue;
		if ( found != FALSE )
			snprintf (buf + strlen(buf), MAX_STRING_LENGTH,  ",\n");
		*status = '\0';
		
		temp_arg1 = char_short (tch);
		temp_arg2 = wound_total(tch);
		temp_arg3 = tactical_status (tch);
		snprintf (buf + strlen(buf), MAX_STRING_LENGTH,  "   #5%s#0 [%s]%s", temp_arg1, temp_arg2, temp_arg3);
		found = TRUE;
	}

	strcat (buf, ".\n");

	if ( !found ) {
		send_to_char ("You aren't in a group.\n", ch);
		return;
	}

	send_to_char (buf, ch);
}

void do_point (CHAR_DATA *ch, char *argument, int cmd)
{
	char		buf [MAX_STRING_LENGTH] = { '\0' };
	char		arg1 [MAX_STRING_LENGTH] = { '\0' };
	char		arg2 [MAX_STRING_LENGTH] = { '\0' };
	char		distance [MAX_STRING_LENGTH] = { '\0' };
	char		buffer [MAX_STRING_LENGTH] = { '\0' };
    CHAR_DATA	*target = NULL;
    CHAR_DATA	*tch = NULL;
    ROOM_DIRECTION_DATA     *exit = NULL;
	ROOM_DATA	*room = NULL;
	int			dir = 0;
	int			range = 1;
	char		*temp_arg1 = NULL;
	char		*temp_arg2 = NULL;

	if ( !*argument ) {
		send_to_char ("Usage: point <direction> <target>\n", ch);
		return;
	}
		
		arg_splitter (2, argument, arg1, arg2);
        
        if ( !cmp_strn ("north", arg1, strlen(arg1)) )
        	dir = 0;
        else if ( !cmp_strn ("east", arg1, strlen(arg1)) )
                dir = 1;
        else if ( !cmp_strn ("south", arg1, strlen(arg1)) )
                dir = 2;
        else if ( !cmp_strn("west", arg1, strlen(arg1)) )
                dir = 3;
        else if ( !cmp_strn ("up", arg1, strlen(arg1)) )
                dir = 4;
        else if ( !cmp_strn ("down", arg1, strlen(arg1)) )
                dir = 5;
	else {
		send_to_char ("Usage: point <direction> <target>\n", ch);
		return;
	}

        if ( !PASSAGE(ch, dir)) {
        	send_to_char ("There isn't an exit in that direction.\n", ch);
            return;
        }

        room = vtor(PASSAGE(ch,dir)->to_room);        
        exit = PASSAGE(ch, dir);

       	if ( exit && IS_SET (exit->exit_info, PASSAGE_CLOSED) ) {
        	send_to_char ("Your view is blocked.\n", ch);
                return;
        }

        if ( !(target = get_char_room_vis2 (ch, room->virtual, arg2)) || !has_been_sighted (ch, target) ) {
        	exit = room->dir_option[dir];
                if ( !exit ) {
	                send_to_char ("You don't see them within range.\n", ch);
                        return;
                }
                if ( exit && IS_SET (exit->exit_info, PASSAGE_CLOSED) ) {
        	        send_to_char ("Your view is blocked.\n", ch);
                        return;
                }
                if ( room->dir_option[dir] )
	                room = vtor(room->dir_option[dir]->to_room);
                else room = NULL;
		
                if ( !(target = get_char_room_vis2 (ch, room->virtual, arg2)) || !has_been_sighted (ch, target) ) {
             		exit = room->dir_option[dir];
                        if ( !exit ) {
             	        	send_to_char ("You don't see them within range.\n", ch);
                           	return;
                        }
                        if ( exit && IS_SET (exit->exit_info, PASSAGE_CLOSED) ) {
                                send_to_char ("Your view is blocked.\n", ch);
                                return;
                        }
                        if ( room->dir_option[dir] )
                        	room = vtor(room->dir_option[dir]->to_room);
                        else room = NULL;
                        if ( !(target = get_char_room_vis2 (ch, room->virtual, arg2)) || !has_been_sighted (ch, target) ) {
                                exit = room->dir_option[dir];
                                if ( !exit ) {
                	                send_to_char ("You don't see them within range.\n", ch);
                                        return;
                                }
                    if ( IS_SET (exit->exit_info, PASSAGE_CLOSED) ) {
               	    	send_to_char ("Your view is blocked.\n", ch);
       	                return;
                    }
            	                send_to_char ("You don't see them within range.\n", ch);
                                return;
                        }
				else range = 3;
           	}
			else range = 2;
		}
		else range = 1;

        if ( !target || !CAN_SEE (ch, target) || !has_been_sighted (ch, target) ) {  
        	send_to_char ("You don't see them within range.\n", ch);
            return;
        }

	if ( range == 2 )
		snprintf (distance, MAX_STRING_LENGTH, "far ");
	else if ( range == 3 )
		snprintf (distance, MAX_STRING_LENGTH, "very far ");
	else *distance = '\0';

	snprintf (distance + strlen(distance), MAX_STRING_LENGTH, "to the %s", dirs[dir]);

	temp_arg1 = char_short (target);
	snprintf (buf, MAX_STRING_LENGTH,  "You point at #5%s#0, %s.", temp_arg1, distance);
	act (buf, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);

	temp_arg1 = char_short (ch);
	temp_arg2 = char_short(target);
	snprintf (buf, MAX_STRING_LENGTH,  "%s#0 points at #5%s#0, %s.", temp_arg1, temp_arg2, distance);
	*buf = toupper (*buf);

	snprintf (buffer, MAX_STRING_LENGTH,  "#5%s", buf);
	snprintf (buf, MAX_STRING_LENGTH,  "%s", buffer);
	act (buf, FALSE, ch, 0, 0, TO_ROOM | TO_ACT_FORMAT);

	for ( tch = ch->room->people; tch; tch = tch->next_in_room ) {
		if ( !CAN_SEE (tch, ch) )
			continue;
		target_sighted (tch, target);
	}
}

void do_title (CHAR_DATA *ch, char *argument, int cmd)
{
	char			buf [MAX_STRING_LENGTH] = { '\0' };
	char			echo [MAX_STRING_LENGTH] = { '\0' };
	char			titlebuf [MAX_STRING_LENGTH] = { '\0' };
	char			bookbuf [MAX_STRING_LENGTH] = { '\0' };
	OBJ_DATA		*obj = NULL;
	double			skill = 0;

	if ( !*argument ) {
		send_to_char ("What did you wish to title?\n", ch);
		return;
	}

	if ( !strstr (argument, "\"") && !strstr (argument, "\'") ) {
		send_to_char ("You must enclose the book's desired title in quotation marks.\n", ch);
		return;
	}

	if ( !ch->writes ) {
		send_to_char ("In which script would you like to write? (See the SCRIBE command.)\n", ch);
		return;
	}

	arg_splitter (2, argument, bookbuf, titlebuf);
	

	if ( !(obj = get_obj_in_list_vis (ch, bookbuf, ch->right_hand)) &&
		!(obj = get_obj_in_list_vis (ch, bookbuf, ch->left_hand)) ) {
		send_to_char ("You need to be holding the book you wish to title.\n", ch);
		return;
	}

	if ( obj->book_title && IS_MORTAL (ch) ) {
		send_to_char ("This work has already been titled.\n", ch);
		return;
	}

	if ( GET_ITEM_TYPE (obj) != ITEM_BOOK ) {
		send_to_char ("This command only works with books.\n", ch);
		return;
	}

	skill = (ch->skills[ch->writes]*0.50) + (ch->skills[ch->speaks]*0.30) + (ch->skills[SKILL_LITERACY]*0.20);
	skill = (double)((int)(skill));
	skill = (double)MIN(95, (int)skill);


	if ( !*titlebuf ) {
		send_to_char ("What did you wish to title this work?\n", ch);
		return;
	}

	if ( strlen(buf) > 55 ) {
		send_to_char ("There is a 55-character limit on book titles.\n", ch);
		return;
	}

	obj->book_title = add_hash(buf);
	obj->title_skill = (int)(skill);
	obj->title_script = ch->writes;
	obj->title_language = ch->speaks;

	snprintf (echo, MAX_STRING_LENGTH, "You have entitled #2%s#0 '%s'.", obj->short_description, titlebuf);
	act (echo, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
	
}


void do_timeconvert (CHAR_DATA *ch, char *argument, int cmd)
{
	char		buf [MAX_STRING_LENGTH] = { '\0' };
	int		hour = 0, day = 0, month = 0, year = 0;
	long double	ic_hours = 0, curr_hours = 0, hour_difference = 0;
	long double	second_difference = 0;
	time_t		projected_time = 0;

	if ( !ch->desc || !ch->desc->account ) {
		send_to_char ("Only PCs can use this command.\n", ch);
		return;
	}

	argument = one_argument (argument, buf);
	hour = strtol (buf, NULL, 10);

	if ( hour > 23 || hour < 1 ) {
		send_to_char ("You must specify an hour between 1 and 23.\n", ch);
		return;
	}

	argument = one_argument (argument, buf);
	day = strtol (buf, NULL, 10);

	if ( day > 30 || day < 1 ) {
		send_to_char ("You must specify a day between 1 and 30.\n", ch);
		return;
	}

	argument = one_argument (argument, buf);
	month = strtol (buf, NULL, 10);

	if ( month > 12 || month < 1 ) {
		send_to_char ("You must specify a month between 1 and 12.\n", ch);
		return;
	}

	argument = one_argument (argument, buf);
	year = strtol (buf, NULL, 10);

	if ( year > 2600 || year < 2460 ) {
		send_to_char ("You must specify a year between 2460 and 2600.\n", ch);
		return;
	}
	
	ic_hours += hour;
	ic_hours += day * 24;
	ic_hours += month * 30 * 24;
	ic_hours += year * 12 * 30 * 24;

	curr_hours += (time_info.hour+1);
	curr_hours += (time_info.day+1) * 24;
	curr_hours += (time_info.month+1) * 30 * 24;	
	curr_hours += time_info.year * 12 * 30 * 24;

	hour_difference = ic_hours - curr_hours;

	if ( hour_difference < 0 ) {
		send_to_char ("You cannot convert a time that has already passed.\n", ch);
		return;
	}

	second_difference = hour_difference * 60 * 60;
	second_difference /= 4;

	second_difference += 5 * 60 * 60;			/* Adjusting server's EST clock to GMT. */
	second_difference += ch->desc->account->timezone * 60 * 60;

	projected_time = time(0);
	projected_time += second_difference;

	(void)strftime(buf, 255, "In your timezone, the specified in-game time will fall at or near %I:%M %P, %A %B %e %Y.", localtime(&projected_time));

	act (buf, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);

}


void post_message (DESCRIPTOR_DATA *d);

int armor_total (CHAR_DATA *ch)
{
	OBJ_DATA	*armor = NULL;
	int		total = 0;

	for ( armor = ch->equip; armor; armor = armor->next_content )
		if ( GET_ITEM_TYPE(armor) == ITEM_ARMOR )
			total += armor->o.od.value[0];
	
	return total;
}

char *tilde_eliminator (char *string)
{
	char		*p = NULL;

	while ( (p = strchr (string, '~')) )
		*p = '-';

	return str_dup (string);
}

char *carry_desc (OBJ_DATA *obj)
{
	static char	buf [10] = { '\0' };

	if ( obj->location == WEAR_PRIM || obj->location == WEAR_SEC ||
	     obj->location == WEAR_BOTH )
	     snprintf(buf, 10, "wielding");
		
	else if ( obj->location == WEAR_SHIELD )
		snprintf(buf, 10, "gripping");

	else 
		snprintf(buf, 10, "carrying");
	
	return buf;
}

char *mana_bar (CHAR_DATA *ch)
{
	static 	char buf [25] = { '\0' };
	float	calc = 0;
	float	move = 0;

	if ( ch->mana >= ch->max_mana )
		snprintf (buf, 20,  "#C******#0");

	if ( (move = (float)ch->mana) >= (calc = ch->max_mana * .6667)
	    && ch->mana < ch->max_mana)
		snprintf (buf, 20,  "#C*****#0 ");

	if ( (move = (float)ch->mana) >= (calc = ch->max_mana * .5)
	    && (move = (float)ch->mana) < (calc = ch->max_mana * .6667))
		snprintf (buf, 20,  "#C****#0  ");

	if ( (move = (float)ch->mana) >= (calc = ch->max_mana * .3333)
	    && (move = (float)ch->mana) < (calc = ch->max_mana * .5))
		snprintf (buf, 20,  "#C***#0   ");

	if ( (move = (float)ch->mana) >= (calc = ch->max_mana * .1667)
	    && (move = (float)ch->mana) < (calc = ch->max_mana * .3333))
		snprintf (buf, 20,  "#C**#0    ");

	if ( (move = (float)ch->mana) >= (calc = ch->max_mana * .0001)
	    && (move = (float)ch->mana) < (calc = ch->max_mana * .1667))
		snprintf (buf, 20,  "#C*#0     ");

	if ( ch->mana == 0)
		snprintf (buf, 20,  "       ");

	return buf;
}

char *fatigue_bar (CHAR_DATA *ch)
{
	static 	char buf [25] = { '\0' };
	float	calc = 0;
	float	move = 0;

	if ( ch->move >= ch->max_move )
		snprintf (buf, 20,  "#1||#3||#2||#0");

	if ( (move = (float)ch->move) >= (calc = ch->max_move * .6667)
	    && ch->move < ch->max_move)
		snprintf (buf, 20,  "#1||#3||#2|#0 ");

	if ( (move = (float)ch->move) >= (calc = ch->max_move * .5)
	    && (move = (float)ch->move) < (calc = ch->max_move * .6667))
		snprintf (buf, 20,  "#1||#3||#0  ");

	if ( (move = (float)ch->move) >= (calc = ch->max_move * .3333)
	    && (move = (float)ch->move) < (calc = ch->max_move * .5))
		snprintf (buf, 20,  "#1||#3|#0   ");

	if ( (move = (float)ch->move) >= (calc = ch->max_move * .1667)
	    && (move = (float)ch->move) < (calc = ch->max_move * .3333))
		snprintf (buf, 20,  "#1||#0    ");

	if ( (move = (float)ch->move) >= (calc = ch->max_move * .0001)
	    && (move = (float)ch->move) < (calc = ch->max_move * .1667))
		snprintf (buf, 20,  "#1|#0     ");

	if ( ch->move == 0)
		snprintf (buf, 20,  "       ");


	return buf;
}

char *breath_bar (CHAR_DATA *ch)
{
	AFFECTED_TYPE	*af;
	static 		char buf [25] = { '\0' };
	int		current = 0, max = 0;
	float		calc = 0;
	float		move = 0;

	if ( !(af = get_affect (ch, AFFECT_HOLDING_BREATH)) )
		return NULL;

	current = af->a.spell.duration;
	max = af->a.spell.sn;

	if ( current >= max )
		snprintf (buf, 20,  "#6******#0");

	else if ( (move = (float)current) >= (calc = max * .6667)
	    && current < max)
		snprintf (buf, 20,  "#6*****#0 ");

	else if ( (move = (float)current) >= (calc = max * .5)
	    && (move = (float)current) < (calc = max * .6667))
		snprintf (buf, 20,  "#6****#0  ");

	else if ( (move = (float)current) >= (calc = max * .3333)
	    && (move = (float)current) < (calc = max * .5))
		snprintf (buf, 20,  "#6***#0   ");

	else if ( (move = (float)current) >= (calc = max * .1667)
	    && (move = (float)current) < (calc = max * .3333))
		snprintf (buf, 20,  "#6**#0    ");

	else if ( (move = (float)current) >= (calc = max * .0001)
	    && (move = (float)current) < (calc = max * .1667))
		snprintf (buf, 20,  "#6*#0     ");

	else
		snprintf (buf, 20,  "      ");


	return buf;
}

/* Procedures related to 'look' */

char *find_ex_description (char *word, XTRA_DESCR_DATA *list)
{
	XTRA_DESCR_DATA	*i = NULL;

	for ( i = list; i; i = i->next )
		if ( name_is (word, i->keyword) )
			return (i->description);

	return NULL;
}

void do_compare (CHAR_DATA *ch, char *argument, int cmd)
{
	CHAR_DATA	*tch = NULL, *tch2 = NULL;
	char		buf[250] = { '\0' };
	char		arg1[MAX_STRING_LENGTH] = { '\0' };
	char		target2[MAX_STRING_LENGTH] = { '\0' };
	char		*temp_arg1 = NULL;
	char		*temp_arg2 = NULL;

	*target2 = '\0';
	*arg1 = '\0';
	*buf = '\0';

	argument = one_argument (argument, arg1);

      

    if (!(tch = get_char_room_vis (ch, arg1))) {
		send_to_char ("Compare who?\n", ch);
		return;
	}

	(void)one_argument (argument, target2);

	if ( *target2 ) {
		if ( !(tch2 = get_char_room_vis (ch, target2)) ){
			send_to_char ("I don't see the second target.\n", ch);
			return;
		}
	}

	if ( tch2 == ch ) {
		send_to_char ("Compare yourself to yourself? Eh?\n", ch);
		return;
	}

	if ( !tch2 && tch == ch ) {
		send_to_char ("Compare yourself to yourself? Eh?\n", ch);
		return;
	}

	if ( tch == tch2 ) {
		send_to_char ("Comparing something to itself? Brilliant!\n", ch);
		return;
	}

	if ( !tch2 ) {
		if ( tch->height >= ch->height ) {
			if ( (float)tch->height/(float)ch->height > 2.4 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is nearly three times your height!", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)tch->height/(float)ch->height > 1.7 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is nearly twice your height!", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)tch->height/(float)ch->height > 1.4 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and towers above you.", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)tch->height/(float)ch->height > 1.15 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is considerably taller than you.", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)tch->height/(float)ch->height > 1.06 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is taller than you.", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)tch->height/(float)ch->height > 1.03 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is a bit taller than you.", temp_arg1, frame_built[tch->frame]);
			}
			
			else{
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and roughly the same height as you.", temp_arg1, frame_built[tch->frame]);
			}
		}
		else if ( tch->height < ch->height ) {
			if ( (float)ch->height/(float)tch->height > 2.4 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is about a third of your height.", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)ch->height/(float)tch->height > 1.7 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is roughly half your height.", temp_arg1, frame_built[tch->frame]);
			}
			
			else if ( (float)ch->height/(float)tch->height > 1.4 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and you tower over #5%s#0.", temp_arg1, frame_built[tch->frame], !is_hooded(tch) ? HMHR(tch) : 
"it");
			}
			
			else if ( (float)ch->height/(float)tch->height > 1.15 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and you are considerably taller than #5%s#0.", temp_arg1, frame_built[tch->frame], !is_hooded(tch) ? HMHR(tch) : 
"it");
			}
			
			else if ( (float)ch->height/(float)tch->height > 1.06 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and you are taller than #5%s#0.", temp_arg1, frame_built[tch->frame], !is_hooded(tch) ? HMHR(tch) : 
"it");
			}
			
			else if ( (float)ch->height/(float)tch->height > 1.03 ){
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and you are a bit taller than #5%s#0.", temp_arg1, frame_built[tch->frame], !is_hooded(tch) ? HMHR(tch) : 
"it");
			}
			
			else{
				temp_arg1 = char_short(tch);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and roughly the same height as you.", temp_arg1, frame_built[tch->frame]);
			}
		}
	}

	else {
		if ( tch->height >= tch2->height ) {
			if ( (float)tch->height/(float)tch2->height > 2.4 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is nearly three times #5%s#0's height!", temp_arg1, frame_built[tch->frame], temp_arg2);
			}

			else if ( (float)tch->height/(float)tch2->height > 1.7 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is nearly twice #5%s#0's height!", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else if ( (float)tch->height/(float)tch2->height > 1.4 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and towers above #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else if ( (float)tch->height/(float)tch2->height > 1.15 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is considerably taller than #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else if ( (float)tch->height/(float)tch2->height > 1.06 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is taller than #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}	
			
			else if ( (float)tch->height/(float)tch2->height > 1.03 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is a bit taller than #5%s#0.\n", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else{
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and roughly the same height as #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
		}
		if ( tch->height < tch2->height ) {
			if ( (float)tch2->height/(float)tch->height > 2.4 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is about a third of #5%s#0's height.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else if ( (float)tch2->height/(float)tch->height > 1.7 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and is roughly half #5%s#0's height.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
			
			else if ( (float)tch2->height/(float)tch->height > 1.4 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and #5%s#0 towers over #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2,
					!is_hooded(tch) ? HMHR(tch) : "it");
			}
			
			else if ( (float)tch2->height/(float)tch->height > 1.15 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and #5%s#0 is considerably taller than #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2, !is_hooded(tch) ? HMHR(tch) : "it");
			}
			
			else if ( (float)tch2->height/(float)tch->height > 1.06 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and #5%s#0 is taller than #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2,
					!is_hooded(tch) ? HMHR(tch) : "it");
			}
			
			else if ( (float)tch2->height/(float)tch->height > 1.03 ){
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and #5%s#0 is a bit taller than #5%s#0.",temp_arg1, frame_built[tch->frame], temp_arg2,
					!is_hooded(tch) ? HMHR(tch) : "it");
			}
			else{
				temp_arg1 = char_short(tch);
				temp_arg2 = char_short(tch2);
				snprintf (buf, MAX_STRING_LENGTH,  "#5%s#0 is %s, and roughly the same height as #5%s#0.", temp_arg1, frame_built[tch->frame], temp_arg2);
			}
		}
	}

	act(buf,FALSE,ch,0,0,TO_CHAR | TO_ACT_FORMAT);

}

char *writing_adj (int skill)
{
	if ( skill <= 10 )
		return "crudely";
	if ( skill <= 20 )
		return "poorly";
	if ( skill <= 30 )
		return "functionally";
	if ( skill <= 40 )
		return "with skill";
	if ( skill <= 50 )
		return "with great skill";
	if ( skill <= 60 )
		return "artfully";
	if ( skill <= 70 )
		return "beautifully";
	return "flawlessly";
}

int decipher_script (CHAR_DATA *ch, int script, int language, int skill)
{
	double		check = 0;
	

	if ( !real_skill (ch, script) || !real_skill (ch, language) )
		return 0;

        if ( skill > 0 && skill <= 15 )
                check = 70;
        else if ( skill > 15 && skill < 30 )
                check = 50;
        else if ( skill >= 30 && skill < 50 )
                check = 30;
        else if ( skill >= 50 && skill < 70 )
                check = 20;
        else if ( skill >= 70 )
                check = 10;
        
	skill_use (ch, script, 0);
	skill_use (ch, language, 0);
	skill_use (ch, SKILL_LITERACY, 0);

        if ( ((ch->skills [script]*.50) + (ch->skills[language]*.30) + (ch->skills[SKILL_LITERACY]*.20)) >= check )
                return 1;
        else return 0;
}

void reading_check (CHAR_DATA *ch, OBJ_DATA *obj, WRITING_DATA *writing, int page)
{
	static char		output [MAX_STRING_LENGTH] = { '\0' };
	char	*temp_arg = NULL;
	
	if ( !writing || !writing->message ) {
		send_to_char ("There seems to be a problem with this object. Please report it to a staff member.\n", ch);
		return;
	}

	if ( !ch->skills[writing->script] && str_cmp (writing->author, ch->tname) ) {
		snprintf (output, MAX_STRING_LENGTH,  "This document is written in a script entirely unfamiliar to you.");
		act (output, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		return;
	}

	if ( !ch->skills[writing->language] && real_skill (ch, writing->script) && str_cmp (writing->author, ch->tname) ) {
		snprintf (output, MAX_STRING_LENGTH,  "Although you recognise the script as %s, the language in which this document is written is unknown to you.", skill_data[writing->script].skill_name);
		act (output, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		return;
	}

	if ( !decipher_script(ch, writing->script, writing->language, writing->skill) && (str_cmp (writing->author, ch->tname) || !real_skill (ch, writing->script)) ) {
		snprintf (output, MAX_STRING_LENGTH,  "You find that you can make neither heads nor tails of this document.");
		act (output, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		return;
	}

	if ( !page ) {
		temp_arg = writing_adj(writing->skill);
		snprintf (output, MAX_STRING_LENGTH,  "#2On %s#0, %s sigils, scribed %s in %s, bear a message in the %s tongue:",
		obj->short_description, skill_data[writing->script].skill_name, temp_arg,
		writing->ink, skill_data[writing->language].skill_name);
	}
	else {
		temp_arg = writing_adj(writing->skill);
		snprintf (output, MAX_STRING_LENGTH,  "On #2page %d#0, %s sigils, scribed %s in %s, bear a message in the %s tongue:", 
		page-1, skill_data[writing->script].skill_name, temp_arg,
		writing->ink, skill_data[writing->language].skill_name);
	}

	act (output, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
	send_to_char ("\n", ch);

	if ( str_cmp (writing->author, ch->tname) ) {
		skill_use (ch, writing->script, 0);
		if ( !number(0,1) )
			skill_use (ch, writing->language, 0);
		if ( !number(0,2) )
			skill_use (ch, SKILL_LITERACY, 0);
	}

	snprintf (output, MAX_STRING_LENGTH,  "%s", writing->message);
	page_string (ch->desc, output);
}

char *article (char *string)
{
	if ( !str_cmp (string, "something") )
		return "";

	if ( *string == 'a' || *string == 'e' || *string == 'i' ||
		*string == 'o' || *string == 'u' )
		return "an ";
	else return "a ";
}

void show_obj_to_char (OBJ_DATA *obj, CHAR_DATA *ch, int mode)
{
	int			found = 0;
	int			crafts_found = 0;
	int			first_seen, i = 0;
	WRITING_DATA	*writing = NULL;
	CHAR_DATA		*tch = NULL;
	OBJ_DATA		*obj2 = NULL;
	OBJ_DATA		*tobj = NULL;
	WOUND_DATA		*wound = NULL;
	LODGED_OBJECT_INFO	*lodged = NULL;
	AFFECTED_TYPE		*af = NULL;
	char		*p = NULL;
	char		output [MAX_STRING_LENGTH] = { '\0' };
	char		buffer [MAX_STRING_LENGTH] = { '\0' };
	char		buf [MAX_STRING_LENGTH] = { '\0' };
	char		buf2 [MAX_STRING_LENGTH] = { '\0' };
	char		*temp_arg = NULL;
	char		*temp_arg1 = NULL;
	char		*temp_arg2 = NULL;
	
	*buffer = '\0';

/** mode 0 is for omote strings
	mode 1 lanter sdesc with details
	mode 2 is unused
	mode 3 is for invisible things
	mode 4 is unused
	mode 5 needs some skill to see things
	mode 6 is in the dark
	mode 7 is ldesc
**/

	if ((mode == 0) && obj->description) { /** omote string **/

		if ( IS_TABLE (obj) )
			return;

		strcat (buffer, "#2");
		
		if(obj->omote_str) {
		    snprintf (buf, MAX_STRING_LENGTH,  "%s %s", obj->short_description,
			   obj->omote_str);
		    *buf = toupper(*buf);
		    reformat_string (buf, &p);
		    strcat(buffer, p);
		    mem_free (p);
		} 
		else{
			temp_arg = obj_desc (obj);
		    strcat (buffer, temp_arg);
	    }

		if ( get_obj_affect (obj, MAGIC_HIDDEN) )
			strcat (buffer, " (hidden from view)");

		if ( IS_SET (obj->obj_flags.extra_flags, ITEM_VNPC) )
			strcat (buffer, " #6(vNPC)#0");

		if ( GET_ITEM_TYPE (obj) == ITEM_LIGHT &&
			 obj->o.light.hours &&
			 obj->o.light.on )
			strcat (buffer, " #1(lit)#0");

		strcat (buffer, "#0");
		reformat_string (buffer, &p);
		snprintf (buffer, MAX_STRING_LENGTH,  "%s", p);
		mem_free (p);
		buffer [strlen(buffer)-1] = '\0';
	} /** omote string **/

	if ( mode == 7 && obj->description ) { /** Ldesc **/
		strcpy (buffer, "#2");
		temp_arg = obj_desc (obj);
		strcat (buffer, temp_arg);
		strcat (buffer, "#0");
		reformat_string (buffer, &p);
		snprintf (buffer, MAX_STRING_LENGTH,  "%s", p);
		buffer [strlen(buffer)-1] = '\0';
	}


	else if (obj->short_description && ((mode == 1) ||
	      (mode == 2) || (mode==3) || (mode == 4))) { /** short desc **/

		strcpy (buffer, "#2");
		temp_arg = obj_short_desc (obj);
		strcat (buffer, temp_arg);
		strcat (buffer, "#0");

		if ( IS_SET (obj->obj_flags.extra_flags, ITEM_DESTROYED) )
			strcat (buffer, " #1(destroyed)#0");

		if ( GET_TRUST (ch) &&
			 (GET_ITEM_TYPE(obj) == ITEM_MONEY) )
			snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " (%d)", obj->count);
	}

	else if ( mode == 5 ) { /** need some kind of skill **/

		if ( obj->obj_flags.type_flag == ITEM_PARCHMENT ) {
			if ( !obj->writing_loaded )
				load_writing (obj);
				
			if ( obj->writing && obj->writing->message ) {
				if ( !IS_MORTAL (ch) ) {
					snprintf (buf, MAX_STRING_LENGTH,  "#2[Penned by %s on %s.]#0\n\n", obj->writing->author, obj->writing->date);
					send_to_char (buf, ch);
				}
				
				if ( obj->carried_by && obj->carried_by != ch && IS_MORTAL(ch)) {
					send_to_char ("You aren't quite close enough to make out the words.\n", ch);
					return;	
				}
				
				reading_check(ch, obj, obj->writing, 0);
				return;
			} 
			else {
				snprintf (buf, MAX_STRING_LENGTH,  "%s#0 seems to be blank.", obj->short_description);
				snprintf (buffer, MAX_STRING_LENGTH,  "#2%s\n", CAP(buf));
				return;
			}
		} /*if ( obj->obj_flags.type_flag == ITEM_PARCHMENT ) */

		else if ( obj->obj_flags.type_flag == ITEM_BOOK ) {
			if ( !obj->writing_loaded )
				load_writing (obj);
			
			if ( !obj->open ) {
				if ( obj->full_description && *obj->full_description )
					strcat (buffer, obj->full_description);
				else{
					if (CAN_SEE_OBJ((ch), (obj)))
						temp_arg = obj_short_desc (obj);
					else
						temp_arg = "somethng";
					snprintf (buffer, MAX_STRING_LENGTH,  "   It is #2%s#0.\n", temp_arg);
				}
				
				snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6This book seems to have %d pages remaining.#0\n", obj->o.od.value[0]);
				
				if ( obj->book_title ) {
					if ( decipher_script (ch, obj->title_script, obj->title_language, obj->title_skill) )
						snprintf (buf, MAX_STRING_LENGTH,  "   #6The book has been entitled '%s.'#0\n", obj->book_title);
					else 
						snprintf (buf, MAX_STRING_LENGTH,  "   #6You cannot quite decipher what seems to be this book's title.#0\n");
					
					reformat_string (buf, &p);
					strcat (buffer, "\n");
					strcat (buffer, p);
					mem_free (p);
				}
				page_string (ch->desc, buffer);
				return;
			}
			
			if ( obj->carried_by && obj->carried_by != ch && IS_MORTAL(ch)) {
				send_to_char ("You aren't quite close enough to make out the words.\n", ch);
				return;	
			}		

			if ( !obj->writing || !obj->o.od.value[0] ) {
				send_to_char ("All its pages have been torn out.\n", ch);
				return;
			}

			for ( i = 2, writing = obj->writing; i <= obj->open; i++ ) {
				if ( !writing->next_page )
					break;
				writing = writing->next_page;
			}
			
			if ( writing && writing->message ) {
				if ( str_cmp (writing->message, "blank") ) {
					if ( !IS_MORTAL (ch) ) {
						snprintf (buf, MAX_STRING_LENGTH,  "#2[Penned by %s on %s.]#0\n\n", writing->author, writing->date);
						send_to_char (buf, ch);
					}
					reading_check(ch, NULL, writing, i);
					return;
				} 
				else {
					snprintf (buf, MAX_STRING_LENGTH,  "This page seems to be blank.");
					snprintf (buffer, MAX_STRING_LENGTH,  "%s\n", CAP(buf));
					send_to_char (buffer, ch);	
					return;
				}
			} 
			else {
				snprintf (buf, MAX_STRING_LENGTH,  "This page seems to be blank.");
				snprintf (buffer, MAX_STRING_LENGTH,  "%s\n", CAP(buf));
				send_to_char (buffer, ch);	
				return;
			}
		} /*else if ( obj->obj_flags.type_flag == ITEM_BOOK ) */

		else {
			if ( obj->full_description && *obj->full_description )
				strcpy (buffer, obj->full_description);
			else {
				if (CAN_SEE_OBJ((ch), (obj)))
						temp_arg = obj_short_desc (obj);
					else
						temp_arg = "somethng";
				snprintf (buffer, MAX_STRING_LENGTH,  "   It is #2%s#0.\n", temp_arg);
			}
	
			temp_arg1 = show_damage (obj);
			snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "%s", temp_arg1);
			
			if ( IS_WEARABLE (obj) && obj->size ) {
	                        snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  "\n   #6This garment would fit individuals wearing size %s.#0", sizes_named [obj->size]);
			}

			if ( GET_ITEM_TYPE (obj) == ITEM_WEAPON ) {
				snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6You'd guess it to be a %s weapon.#0\n", skill_data[obj->o.weapon.use_skill].skill_name);

				if ( IS_SET (obj->obj_flags.extra_flags, ITEM_THROWING) )
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6This weapon appears ideally suited for throwing.#0\n");
			}
			else if ( GET_ITEM_TYPE (obj) == ITEM_TENT ) {
				snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6You'd guess this tent could shelter %d individual%s.#0\n", obj->o.od.value[1], obj->o.od.value[1] != 1 ? "s" : "");
			}
			else if ( GET_ITEM_TYPE (obj) == ITEM_HEALER_KIT ) {
				if ( ch->skills [SKILL_HEALING] && ch->skills [SKILL_HEALING] >= obj->o.od.value[2] ) {
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Used to Treat:#0 ");
					if ( IS_SET (obj->o.od.value[5], TREAT_ALL) || !obj->o.od.value[5] )
						snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Any");
					else {
						if ( IS_SET (obj->o.od.value[5], TREAT_SLASH) )
							snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Slashes");
						if ( IS_SET (obj->o.od.value[5], TREAT_PUNCTURE) )
							snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Punctures");
						if ( IS_SET (obj->o.od.value[5], TREAT_BLUNT) )
							snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Contusions");
						if ( IS_SET (obj->o.od.value[5], TREAT_BURN) )
							snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Burns");
						if ( IS_SET (obj->o.od.value[5], TREAT_FROST) )
							snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " Frostbite");
					}
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Uses Remaining:#0 %d\n", obj->o.od.value[0]);
				}
				else {
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Your training is not yet sufficient for this remedy.#0\n");
				}
			}
			else if ( GET_ITEM_TYPE (obj) == ITEM_REPAIR_KIT ) {
				if ( obj->o.od.value[3] < 0 || obj->o.od.value[5] < 0) { 
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1Error, No item type or skill associated with repair kit!#0");
				}
				else if ( obj->o.od.value[3] && (!ch->skills [(obj->o.od.value[3])] || ch->skills [(obj->o.od.value[3])] < obj->o.od.value[2] )) {
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Your training is not yet sufficient to use these materials.#0\n");
				}
				else {
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Used to Repair:#0 ");
					if ( obj->o.od.value[5] == 0 ) {
						snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #6Any item#0 made with ");
					}
					else {
						snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #6%s items#0 made with ", item_types[(obj->o.od.value[5])]) ;
					}
					if ( obj->o.od.value[3] == 0 ) {
						snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "#6Any skill#0.");
					}
					else {
						snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "the #6%s skill#0.", skill_data[(obj->o.od.value[3])].skill_name) ;
					}
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   #6Uses Remaining:#0  %d\n", obj->o.od.value[0]);
				}
			}

			*buf = '\0';

			for ( i = CRAFT_FIRST; i <= CRAFT_LAST; i++ ) {
				if ( !(af = get_affect (ch, i)) )
					continue;
				if ( !af->a.craft || !af->a.craft->subcraft )
					continue;
				if ( !craft_uses (af->a.craft->subcraft, obj->virtual) )
					continue;
				if ( crafts_found )
					snprintf (buf + strlen(buf), MAX_STRING_LENGTH,  ", ");
				snprintf (buf + strlen(buf), MAX_STRING_LENGTH,  "'%s %s'", af->a.craft->subcraft->command, af->a.craft->subcraft->subcraft_name);
				crafts_found += 1;
			}

			if ( crafts_found ) {
				snprintf (output, MAX_STRING_LENGTH,  "   You realize that you could make use of this item in the following craft%s: %s.", crafts_found != 1 ? "s" : "", buf); 
				reformat_string (output, &p);
				snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n%s", p);
				mem_free (p);
				p = NULL;
			}

			if ( obj->wounds ) {
				snprintf (buf, MAX_STRING_LENGTH,  "   It has ");
				for ( wound = obj->wounds; wound; wound = wound->next ) {
					if ( !wound->next && wound != obj->wounds ){
						temp_arg1 = expand_wound_loc(wound->location);
						snprintf (buf2, MAX_STRING_LENGTH,  "and a %s %s on the %s", wound->severity, wound->name, temp_arg1);
					}
					else{
						temp_arg1 = expand_wound_loc(wound->location);
						snprintf (buf2, MAX_STRING_LENGTH,  "a %s %s on the %s", wound->severity, wound->name, temp_arg1);
					}
					strcat (buf, buf2);
					if ( !wound->next )
						strcat (buf, ".");
					else
						strcat (buf, ", ");
				}
				reformat_string (buf, &p);
				strcat (buffer, "\n");
				strcat (buffer, p);
				mem_free (p);
				p = NULL;
			}

			if ( obj->lodged ) {
				snprintf (buf, MAX_STRING_LENGTH,  "   It has ");
				for ( lodged = obj->lodged; lodged; lodged = lodged->next ) {
					tobj = load_object (lodged->vnum);
					if ( !tobj )
						continue;	
					if ( !lodged->next && lodged != obj->lodged ){
						temp_arg1 = expand_wound_loc(lodged->location);
						snprintf (buf2, MAX_STRING_LENGTH,  "and #2%s#0 lodged in the %s", tobj->short_description, temp_arg1);
					}
					else{
						temp_arg1 = expand_wound_loc(lodged->location);
						snprintf (buf2, MAX_STRING_LENGTH,  "#2%s#0 lodged in the %s", tobj->short_description, temp_arg1 );
					}
					strcat (buf, buf2);
					if ( !lodged->next )
						strcat (buf, ".");
					else
						strcat (buf, ", ");
					extract_obj (tobj);
				}
				reformat_string (buf, &p);
				if ( obj->wounds )
					strcat (buffer, "\n");
				strcat (buffer, p);
				mem_free (p);
				p = NULL;
			}

			first_seen = 1;

			if ( IS_SET (obj->obj_flags.extra_flags, ITEM_TABLE) ) {
				for ( obj2 = obj->contains;
					  obj2;
					  obj2 = obj2->next_content ) {

					if ( CAN_SEE_OBJ (ch, obj2) ) { /* items on table */

						if ( first_seen ){ /* see the table? */
							if (CAN_SEE_OBJ((ch), (obj)))
								temp_arg = obj_short_desc (obj);
							else
								temp_arg = "somethng";
							snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  "\nOn #2%s#0 you see:\n", temp_arg);
						}

						first_seen = 0;
						
						if (CAN_SEE_OBJ((ch), (obj2))) /* things on the table */
							temp_arg = obj_short_desc (obj2);
						else
							temp_arg = "somethng";
						
						snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  "   %s\n", temp_arg);
					}
				}

				for ( tch = ch->room->people; tch; tch = tch->next_in_room ) {
				}
			}
			if ( obj->virtual != VNUM_CORPSE ) {
/*
				if ( obj->item_wear == 100 )
					snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  "\n   It appears to be in flawless condition.\n");
*/
			}
		}
	}

	else if ( mode == 6 ) { /** in the dark **/

		strcpy (buffer, "   ");

		if ( CAN_SEE_OBJ (ch, obj) && IS_OBJ_STAT (obj, ITEM_INVISIBLE) )
			strcat (buffer, "(invis) ");
		
		temp_arg1 = obj_short_desc (obj);
		snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  "#2%s#0", temp_arg1);

		if ( GET_TRUST (ch) &&
			 (GET_ITEM_TYPE(obj) == ITEM_MONEY) )
			snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " (%d)", obj->count);
	}

	if (mode != 3) {
		found = FALSE;
		if (IS_OBJ_STAT(obj,ITEM_INVISIBLE)) {
			 strcat(buffer,"(invisible)");
			 found = TRUE;
		}
	}

	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_LIGHT ) {
		if ( obj->o.light.hours && obj->o.light.on )
			snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " #1(lit)#0");
		else if ( obj->o.light.hours && !obj->o.light.on )
			snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " #1(unlit)#0");
		else
			snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " #1(spent)#0");
	}

	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_BOOK && obj->book_title && decipher_script (ch, obj->title_script, obj->title_language, obj->title_skill) )
		snprintf (buffer, MAX_STRING_LENGTH,  "#2\"%s\"#0", obj->book_title);
	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_BOOK && obj->open )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(open)#0");
	else if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_BOOK && !obj->open )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(closed)#0");

	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_WEAPON && (obj->contains || obj->loaded) )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #6(loaded)#0");

	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_SHEATH &&
	     obj->contains ){
		temp_arg1 = see_object_in (ch, obj->contains);
		temp_arg2 = article (temp_arg1);
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " bearing %s#2%s#0", temp_arg2, temp_arg1);

	}
	
	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_QUIVER && obj->contains ){
		temp_arg1 = see_object_in (ch, obj->contains);
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " bearing #2%ss#0", temp_arg1);
	}
	
	if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_INK &&
	     obj->o.od.value[0] == obj->o.od.value[1] )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(full)#0");
	else if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_INK &&
	     obj->o.od.value[0] > obj->o.od.value[1]/2 )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(mostly full)#0");
	else if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_INK &&
	     obj->o.od.value[0] == obj->o.od.value[1]/2 )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(half full)#0");
	else if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_INK &&
	     obj->o.od.value[0] < obj->o.od.value[1]/2 && obj->o.od.value[0] > 0 )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(mostly empty)#0");
	else if ( mode == 1 && GET_ITEM_TYPE (obj) == ITEM_INK &&
	     obj->o.od.value[0] <= 0 )
		snprintf (buffer + strlen(buffer), MAX_STRING_LENGTH,  " #1(empty)#0");

	if ( buffer[strlen(buffer)-1] != '\n' )
		strcat (buffer, "\n");

	page_string(ch->desc, buffer);

}

void list_obj_to_char (OBJ_DATA *list, CHAR_DATA *ch, int mode, int show)
{
	OBJ_DATA	*i = NULL;
	int		found = 0, j = 0;
	int		looked_for_tables = 0;
	OBJ_DATA	*obj = NULL;
	bool		clump = FALSE;

	found = FALSE;

	if ( !list || (weather_info[ch->room->zone].state == HEAVY_SNOW && IS_MORTAL(ch) && !IS_SET (ch->room->room_flags, INDOORS)) ) {
		if ( show )
			send_to_char ("Nothing.\n", ch);
		return;
	}

	for ( i = list; i; i = i->next_content ) {
		j++;
	}

	if ( j >= 25 && show != 4 && !list->in_obj )
		clump = TRUE;

	for ( i = list ; i; i = i->next_content ) { 
		if ( CAN_SEE_OBJ (ch, i) ) {

			if ( !mode && !looked_for_tables && IS_TABLE (i) ) {

				for ( obj = i; obj; obj = obj->next_content )
					if ( IS_TABLE (obj) )
						looked_for_tables++;

				if ( looked_for_tables == 1 )
					show_obj_to_char (i, ch, 7);
				else if ( looked_for_tables == 2 )
					send_to_char ("#6There are a couple of furnishings here.#0\n",
								  ch);
				else
					send_to_char ("#6There are several furnishings here.#0\n", ch);
			}

			if ( clump )
				continue;

			show_obj_to_char (i, ch, mode);

			found = TRUE;
		}    
	}  

	if ( clump ) {
		if ( j >= 25 && j < 35 )
			send_to_char ("#2The area is strewn with a number of objects.#0\n", ch);
		else if ( j >= 35 && j < 45 )
			send_to_char ("#2The area is strewn with a sizeable number of objects.#0\n", ch);
		else if ( j >= 45 && j < 55 )
			send_to_char ("#2The area is strewn with a large number of objects.#0\n", ch);
		else if ( j >= 55 && j < 65 )
			send_to_char ("#2The area is strewn with a great number of objects.#0\n", ch);
		else
			send_to_char ("#2The area is strewn with a staggering number of objects.#0\n", ch);
	}
	else if ( !found && show && show != 4 )
		send_to_char("Nothing.\n", ch);
}

void list_char_to_char (CHAR_DATA *list, CHAR_DATA *ch, int mode)
{
	CHAR_DATA	*i = NULL;
	char		buf [MAX_STRING_LENGTH] = { '\0' };
	int			count = 0;
	int			j = 0; 

	if ( IS_MORTAL(ch) &&
		weather_info[ch->room->zone].state == HEAVY_SNOW &&
		!IS_SET (ch->room->room_flags, INDOORS) )
		return;

	for ( i = list; i; i = i->next_in_room ) {
		if ( i == ch )
			continue;
		j++;
	}

	if ( j < 25 || mode == 4 || ch->room->virtual == AMPITHEATRE ) {
		for ( i = list; i; i = i->next_in_room ) {
			if ( ch != i && ch->vehicle != i ) {
				if ( ch->room->virtual == AMPITHEATRE && IS_MORTAL(i) ) {
					count++;
					continue;
				}
				show_char_to_char (i, ch, mode);
			}
		}
	}
	else {
		if ( j >= 25 && j < 35 )
			send_to_char ("#5The area is filled by a crowd of individuals.\n#0", ch);
		if ( j >= 35 && j < 45 )
			send_to_char ("#5The area is filled by a decently-sized crowd of individuals.\n#0", ch);
		else if ( j >= 45 && j < 55 )
			send_to_char ("#5The area is filled by a sizeable crowd of individuals.\n#0", ch);
		else if ( j >= 55 && j < 65 )
			send_to_char ("#5The area is filled by a large crowd of individuals.\n#0", ch);
		else if ( j > 65 )
			send_to_char ("#5The area is filled by an immense crowd of individuals.\n#0", ch);
	}

	if ( count ) {
		snprintf (buf, MAX_STRING_LENGTH,  "#5There %s %d other %s assembled here for the meeting.#0\n", count != 1 ? "are" : "is", count, count != 1 ? "people" : "person");
		send_to_char (buf, ch);
	}
}

void show_contents (CHAR_DATA *ch, int cmd)
{
	if ( cmd == 1 ) {
		if ( !ch->room->contents ) {
			send_to_char ("\n   None.\n", ch);
			return;
		}

		if ( ch->room->contents ) {
			send_to_char ("\n", ch);
			list_obj_to_char (ch->room->contents, ch, 0, 4);	
		}
		return;
	}
	else if ( cmd == 2 ) {
		if ( (!ch->room->people || !ch->room->people->next_in_room) ) {
			send_to_char ("\n   None.\n", ch);
			return;
		}

		if ( ch->room->people && (ch->room->people->next_in_room || ch->room->people != ch) ) {
			send_to_char ("\n", ch);
			list_char_to_char (ch->room->people, ch, 4);
		}
		return;
	}
}

void do_contents (CHAR_DATA *ch, char *argument, int cmd)
{
	if ( !ch->room->contents && (!ch->room->people || !ch->room->people->next_in_room) ) {
		send_to_char ("   None.\n", ch);
		return;
	}

	if ( ch->room->contents ) {
		send_to_char ("\n", ch);
		list_obj_to_char (ch->room->contents, ch, 0, 4);	
	}

	if ( ch->room->people && (ch->room->people->next_in_room || ch->room->people != ch) ) {
		send_to_char ("\n", ch);
		list_char_to_char (ch->room->people, ch, 4);
	}
}

int enter_exit_msg (CHAR_DATA *ch, char *buffer)
{
	QE_DATA		*qe = NULL;
	char		*addon = NULL;
	bool        isLeaving = FALSE;
	char		*temp_arg = NULL;
	char		*e_dirs [] = {
							"to the north",
							"to the east",
							"to the south",
							"to the west",
							"up",
							"down" };
	char		*a_dirs [] = {
							"the south",
							"the west",
							"the north",
							"the east",
							"below",
							"above" };
		
	

	for ( qe = quarter_event_list; qe; qe = qe->next )
		if ( qe->ch == ch )
			break;

	if ( !qe )
		return 0;

	addon = buffer + strlen (buffer);

	if ( GET_FLAG (ch, FLAG_LEAVING) ) {
	  isLeaving = TRUE;
	}
	else if ( GET_FLAG (ch, FLAG_ENTERING) ) {
	  isLeaving = FALSE;
	}
	else return 0;
	temp_arg = char_short(ch);
	snprintf (addon, MAX_STRING_LENGTH, "#3%s is %s %s%s%s.#0", 
		 CAP(temp_arg), 
		 (isLeaving ? "leaving" : "arriving from"),
		 (isLeaving ? e_dirs [qe->dir] : a_dirs [qe->dir]),
		 ( (qe->travel_str == NULL && ch->travel_str) ? ", " : "" ),
		 ( (qe->travel_str ? qe->travel_str : (ch->travel_str ? ch->travel_str : "" ) ) )
		 );
	addon[2] = toupper (addon[2]);

	return 1;
}

char *char_short (CHAR_DATA *ch)
{      
 	OBJ_DATA	*obj = NULL;
	static char	buf [MAX_STRING_LENGTH] = { '\0' };
    char 		phrase [MAX_STRING_LENGTH] = { '\0' };

	if ( !ch )
		return NULL;
	
    snprintf (phrase, 20, "gigantic");
    if (ch->height < 108)
        snprintf (phrase, 20, "towering");
    if (ch->height < 84)
        snprintf (phrase, 20, "very tall");
    if (ch->height < 77)
        snprintf (phrase, 20, "tall");
    if (ch->height < 71)
        snprintf (phrase, MAX_STRING_LENGTH,  "%s", frame_built [ch->frame]);
    if (ch->height < 66)
        snprintf (phrase, 20, "short");
    if (ch->height < 61)
        snprintf (phrase, 20, "very short");
    if (ch->height < 54)
        snprintf (phrase, 20, "extremely short");
    if (ch->height < 36)
        snprintf (phrase, 20, "tiny");

	if ( ( obj = get_equip(ch, WEAR_ABOUT) ) &&
		IS_SET(obj->obj_flags.extra_flags, ITEM_MASK) &&
		IS_SET(ch->affected_by, AFF_HOODED) ) {
		if ( ch->height >= 54 || ch->height < 36 )
			snprintf (buf, MAX_STRING_LENGTH, "a %s, %s person",phrase,obj->desc_keys);
		else
			snprintf (buf, MAX_STRING_LENGTH, "an %s, %s person",phrase,obj->desc_keys);
		return buf;
	}

	if ( ((obj = get_equip(ch, WEAR_HEAD)) || (obj = get_equip(ch, WEAR_FACE)))
		&& IS_SET(obj->obj_flags.extra_flags, ITEM_MASK)) {
			
		if ( obj->obj_flags.type_flag == ITEM_WORN ) 
		    snprintf (buf, MAX_STRING_LENGTH, "the %s, %s person",phrase,
			    obj->desc_keys);
		else
		    snprintf (buf, MAX_STRING_LENGTH, "the %s, %s person",phrase,
			    obj->desc_keys);
		return buf;
       		
	}

	if ( ( obj = get_equip(ch, WEAR_FACE) )
		&& IS_SET(obj->obj_flags.extra_flags, ITEM_MASK)) {
			
		if ( obj->obj_flags.type_flag == ITEM_WORN ) 
		    snprintf (buf, MAX_STRING_LENGTH, "the %s, %s person",phrase,
			    obj->desc_keys);
		else
		    snprintf (buf, MAX_STRING_LENGTH, "the %s, %s person",phrase,
			    obj->desc_keys);
		return buf;
       		
	}
	return ch->short_descr;
}	

char *char_long (CHAR_DATA *ch, int show_tname)
{      
	OBJ_DATA	*obj = NULL;
	static char	buf [MAX_STRING_LENGTH] = { '\0' };
    	char 		phrase [20] = { '\0' };
	char		tname [MAX_STRING_LENGTH] = { '\0' };
	
    snprintf (phrase, MAX_STRING_LENGTH, "gigantic");
    if (ch->height < 108)
        snprintf (phrase, MAX_STRING_LENGTH, "towering");
    if (ch->height < 84)
        snprintf (phrase, MAX_STRING_LENGTH, "very tall");
    if (ch->height < 77)
        snprintf (phrase, MAX_STRING_LENGTH, "tall");
    if (ch->height < 71)
        snprintf (phrase, MAX_STRING_LENGTH, "%s",frame_built[ch->frame]);
    if (ch->height < 66)
        snprintf (phrase, MAX_STRING_LENGTH, "short");
    if (ch->height < 61)
        snprintf (phrase, MAX_STRING_LENGTH, "very short");
    if (ch->height < 54)
        snprintf (phrase, MAX_STRING_LENGTH, "extremely short");
    if (ch->height < 36)
        snprintf (phrase, MAX_STRING_LENGTH, "tiny");
	
	if ( show_tname && is_hooded (ch) )
		snprintf (tname, MAX_STRING_LENGTH, "(%s) ", ch->tname);
	else
		*tname = '\0';

	if ( ( obj = get_equip(ch, WEAR_ABOUT) ) &&
		IS_SET(obj->obj_flags.extra_flags, ITEM_MASK) &&
		IS_SET(ch->affected_by, AFF_HOODED) ) {
		    if(ch->pmote_str) {
			if(*(ch->pmote_str) == '\''){
			    snprintf (buf, MAX_STRING_LENGTH, "A %s, %s person%s %s",phrase,
				obj->desc_keys, 
				tname, ch->pmote_str);
				return buf;
			} else {
			    snprintf (buf, MAX_STRING_LENGTH, "A %s, %s person%s %s",phrase,
                                obj->desc_keys, 
                                tname, ch->pmote_str);
                                return buf;
			}
		    } else {
			snprintf (buf, MAX_STRING_LENGTH, "A %s, %s person %sis here.",phrase,
				obj->desc_keys, tname);
				return buf;
		   }
	}
		
	if ( ((obj = get_equip(ch, WEAR_HEAD)) || (obj = get_equip(ch, WEAR_FACE)))
		&& IS_SET(obj->obj_flags.extra_flags, ITEM_MASK)) {
			
		if ( obj->obj_flags.type_flag == ITEM_WORN )
		    if(ch->pmote_str) {
			if(*(ch->pmote_str) == '\'')
			    snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson%s",phrase,
				    obj->desc_keys, 
				    tname, ch->pmote_str);
			else
                            snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson %s",phrase,
                                    obj->desc_keys,
                                    tname, ch->pmote_str);
			} else
		            snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson is here.",phrase,
			        obj->desc_keys, tname);
		else {
		    if(ch->pmote_str) {
			if(*(ch->pmote_str) == '\'')
			    snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson%s",phrase,
			            obj->desc_keys, 
				    tname, ch->pmote_str);       		
			else
                            snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson %s",phrase,
                                    obj->desc_keys,
                                    tname, ch->pmote_str);
		    } else
		        snprintf (buf, MAX_STRING_LENGTH, "A %s, %s %sperson is here.",phrase,
			    obj->desc_keys, tname);       		
		}	
	        return buf;
	}

	if(ch->pmote_str) {
	    if(*(ch->pmote_str) == '\'')
		snprintf (buf, MAX_STRING_LENGTH,  "%s%s", ch->short_descr, ch->pmote_str);
	    else
		snprintf (buf, MAX_STRING_LENGTH,  "%s %s", ch->short_descr, ch->pmote_str);
	    
	    buf[0] = (('a' <= buf[0]) && (buf[0] <= 'z')) 
			? (char)(buf[0] - 32) : buf[0];
	    CAP (buf);
	    return buf;
	} 

	    return ch->long_descr;
}	

void stink_to_room_description (int type, char *buf)
{
	strcpy (buf, "#D");
	buf += 2;

	switch ( type ) {
		case MAGIC_AKLASH_ODOR:
			strcpy (buf, "An overwhelming stench of rotten food, decaying "
						 "animals and dead things\npervades the area.");
			break;

		case MAGIC_ROSE_SCENT:
			strcpy (buf, "The pleasant fragrance of roses fills the air.");
			break;

		case MAGIC_JASMINE_SCENT:
			strcpy (buf, "A subtle, alluring aroma of jasmine lingers upon the "
						 "air.");
			break;

		case MAGIC_SEWER_STENCH:
			strcpy (buf, "The stench of raw sewage permeates this area, and "
						 "everything in it.");
			break;

		case MAGIC_SOAP_AROMA:
			strcpy (buf, "The pleasant and comforting scent of soap fills the "
						 "area.");
			break;

		case MAGIC_CINNAMON_SCENT:
			strcpy (buf, "An unmistakable and pleasant fragrance of cinnamon "
						 "floats upon the air.");
			break;

		case MAGIC_LEORTEVALD_STENCH:
			strcpy (buf, "A strong, pungent odor of decaying corpses hangs "
						 "heavily in the air.");
			break;

		case MAGIC_YULPRIS_ODOR:
			strcpy (buf, "The unpleasant, almost sickening stench of rotting "
						 "food makes breathing difficult.");
			break;

		case MAGIC_FRESH_BREAD:
			strcpy (buf, "A fine aroma of freshly baked bread fills the area, "
						 "making the mouth water.");
			break;

		case MAGIC_MOWN_HAY:
			strcpy (buf, "The rich fragrance of new-mown hay pervades the "
						 "area.");
			break;

		case MAGIC_FRESH_LINEN:
			strcpy (buf, "This area bears the comforting scent of freshly "
						 "laundered linen.");
			break;

		case MAGIC_INCENSE_SMOKE:
			strcpy (buf, "The smoke of incense fills the air with its heady scent.");
			break;

		case MAGIC_WOOD_SMOKE:
			strcpy (buf, "The smell of seasoned wood being burned fills the air.");
			break;

		default:
			strcpy (buf, "There is an unrecognizable odor here.");
			break;
	}

	strcat (buf, "#0");
}

void stink_to_description (int type, char *buf)
{
	switch ( type ) {
		case MAGIC_AKLASH_ODOR:
			strcpy (buf, "$n #5smells of rotten food, decaying animals and "
						 "dead things.");
			break;

		case MAGIC_ROSE_SCENT:
			strcpy (buf, "$n #Dsmells pleasantly and faintly of roses.");
			break;

		case MAGIC_JASMINE_SCENT:
			strcpy (buf, "$n #Dhas a subtle scent of jasmine about $mself.");
			break;

		case MAGIC_SEWER_STENCH:
			strcpy (buf, "$n #Dsmells as if $e had been wallowing in raw "
						 "sewage.");
			break;

		case MAGIC_SOAP_AROMA:
			strcpy (buf, "$n #Dsmells fresly bathed.");
			break;

		case MAGIC_CINNAMON_SCENT:
			strcpy (buf, "$n #Dhas about $mself the faint odor of cinnamon.");
			break;

		case MAGIC_LEORTEVALD_STENCH:
			strcpy (buf, "$n #Dsmells of decaying corpses.");
			break;

		case MAGIC_YULPRIS_ODOR:
			strcpy (buf, "$n #Dbears a foul odor, reminiscent of rotting food.");
			break;

		case MAGIC_FRESH_BREAD:
			strcpy (buf, "$n #Dsmells pleasantly of fresh-baked bread.");
			break;

		case MAGIC_MOWN_HAY:
			strcpy (buf, "$n #Dhas about $mself the fresh fragrance of new-mown "
						 "hay.");
			break;

		case MAGIC_FRESH_LINEN:
			strcpy (buf, "$n #Dis enveloped in the comforting scent of freshly "
						 "laundered linen.");
			break;

		case MAGIC_INCENSE_SMOKE:
			strcpy (buf, "$n #Dis surrounded by the pleasant scent of incense.");
			break;

		case MAGIC_WOOD_SMOKE:
			strcpy (buf, "$n #Dhas the unmistakable aroma of burning firewood.");
			break;

		default:
			strcpy (buf, "$n #Dhas an unrecognizable odor.");
			break;
	}

	strcat (buf, "#0");
}

int get_stink_message (CHAR_DATA *ch, ROOM_DATA *room, char *stink_buf,
					   CHAR_DATA *smeller)
{
	int				smeller_is_admin = 0;
	AFFECTED_TYPE	*smell_af = NULL;
	AFFECTED_TYPE	*af = NULL;
	AFFECTED_TYPE	*affect_list = NULL;

	if ( ch )
		affect_list = ch->hour_affects;
	else
		affect_list = room->affects;

	if ( smeller && GET_TRUST (smeller) )
		smeller_is_admin = 1;

	for ( af = affect_list; af; af = af->next ) {

		if ( af->type < MAGIC_SMELL_FIRST ||
			 af->type > MAGIC_SMELL_LAST )
			continue;

		if ( !smeller_is_admin && af->a.smell.aroma_strength < 500 )
			continue;

		if ( !smell_af ) {
			smell_af = af;
			continue;
		}

		if ( af->a.smell.aroma_strength > smell_af->a.smell.aroma_strength )
			smell_af = af;
	}

	if ( !smell_af )
		return 0;

	*stink_buf = '\0';

	if ( smeller && GET_TRUST (smeller) )
		snprintf (stink_buf, MAX_STRING_LENGTH, "(%d %d) ",
						smell_af->a.smell.duration,
						smell_af->a.smell.aroma_strength);

	if ( smeller_is_admin && smell_af->a.smell.aroma_strength < 500 )
		snprintf (stink_buf + strlen (stink_buf), MAX_STRING_LENGTH, "(weak) ");

	if ( ch )
		stink_to_description (smell_af->type, stink_buf + strlen (stink_buf));
	else
		stink_to_room_description (smell_af->type, stink_buf + strlen (stink_buf));

	return 1;
}



void show_char_to_char (CHAR_DATA *i, CHAR_DATA *ch, int mode)
{
	int		       	percent = 0;
	double			curdamage = 0;
	int				location = 0;
	OBJ_DATA		*eq = NULL;
	OBJ_DATA		*blindfold = NULL;
	OBJ_DATA		*tobj = NULL;
	AFFECTED_TYPE	*af = NULL;
	ROOM_DATA		*troom = NULL;
	WOUND_DATA		*wound = NULL;
	CHARM_DATA		*charm = NULL;
	char			*p = NULL;
	char			stink_buf [MAX_STRING_LENGTH] = { '\0' };
	char			buf [MAX_STRING_LENGTH] = { '\0' };
	char			buffer [MAX_STRING_LENGTH] = { '\0' };
	char			*dir_names [] = {
						"to the north",	"to the east", "to the south",
						"to the west", "above", "below" };
	char			buf2[MAX_STRING_LENGTH] = { '\0' };
	char			buf3[MAX_STRING_LENGTH] = { '\0' };
	char			*temp_arg = NULL;
	char			*temp_arg1 = NULL;
	char			*temp_arg2 = NULL;
	char			*temp_arg3 = NULL;
	bool			found = FALSE;

	if ( mode == 4 )
		mode = 0;

	if ( !mode ) {

        if ( IS_SUBDUEE (i) ) {
            if ( i->subdue == ch )
                act("You have #5$N#0 in tow.", FALSE, ch, 0, i, TO_CHAR);
            return;
        }

		if ( !CAN_SEE (ch, i) ) {
			if ( !GET_FLAG (i, FLAG_WIZINVIS) &&
				 get_affect (ch, MAGIC_AFFECT_SENSE_LIFE) )
				send_to_char ("\nYou sense a hidden life form in the room.\n\n",
							  ch);
			return;
		}
		blindfold = get_equip (i, WEAR_BLINDFOLD);
		temp_arg = char_long(i, 0);
		if ( (blindfold) ||
			 !(temp_arg) ||
			 GET_POS (i) != i->default_pos ||
			 IS_SWIMMING (i) ) {
			 
			if ( char_short(i) ) {
				strcpy ( buffer, "#5" );
				temp_arg = char_short(i);
				strcat ( buffer, temp_arg );
				strcat ( buffer, "#0" );
				buffer [2] = UPPER (buffer [2]);

			} else
				strcpy(buffer,"#5A nameless one#0");

			if ( IS_SWIMMING (i) )
				strcat(buffer," is here, swimming.");
				
			else switch(GET_POS(i)) {
			
				case POSITION_STUNNED  :
					if ( blindfold )
						strcat(buffer," is here, stunned and blindfolded.");
					else
						strcat(buffer," is here, stunned.");
					break;
				
				case POSITION_UNCONSCIOUS    :
					if ( blindfold )
						strcat(buffer," is lying here, unconscious and blindfolded.");
					else
						strcat(buffer," is lying here, unconscious.");
					break;
				
				case POSITION_MORTALLYW:
					if ( blindfold )
						strcat(buffer," is lying here, mortally wounded and blindfolded.");
					else
						strcat(buffer," is lying here, mortally wounded.");
					break;
				
				case POSITION_DEAD     :
					strcat(buffer," is lying here, dead.");
					break;
				
				case POSITION_STANDING :
					if ( blindfold )
						strcat (buffer," is standing here, blindfolded.");
					else
						strcat (buffer," is standing here.");
					break;
				
				case POSITION_SITTING  :
					if ( blindfold )
						strcat(buffer," is sitting here, blindfolded");
					if (i->pmote_str) {
						snprintf (buffer, MAX_STRING_LENGTH,  "#5");
						temp_arg = char_long(i, GET_TRUST (ch));
						strcat (buffer, temp_arg);
						strcat (buffer, "#0");
						break;
					}
					else
						strcat(buffer," is sitting here");

					if ( (af = get_affect (i, MAGIC_SIT_TABLE)) &&
						 is_obj_in_list (af->a.table.obj, i->room->contents) ) {
						tobj = af->a.table.obj;
						
						if (CAN_SEE_OBJ((i), (tobj))) /* item on your table */
							temp_arg = obj_short_desc (tobj);
						else
							temp_arg = "somethng";
							
						snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " at #2%s#0.", temp_arg);
					} else
						strcat (buffer, ".");
					break;
					
				case POSITION_RESTING  :
					if ( blindfold )
						strcat(buffer," is resting here, blindfolded");
					else {
						if (i->pmote_str) {
							snprintf (buffer, MAX_STRING_LENGTH,  "#5");
							temp_arg = char_long(i, GET_TRUST (ch));
							strcat (buffer, temp_arg);
							strcat (buffer, "#0");
							break;
						}
						else
							strcat(buffer," is resting here");
					}				
					if ( (af = get_affect (i, MAGIC_SIT_TABLE)) &&
						 is_obj_in_list (af->a.table.obj, i->room->contents) ) {
						tobj = af->a.table.obj;
						
						if (CAN_SEE_OBJ((i), (tobj))) /* item on your table */
							temp_arg = obj_short_desc (tobj);
						else
							temp_arg = "somethng";
							
						snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " at #2%s#0.", temp_arg);
					} else
						strcat (buffer, ".");
					break;
					
				case POSITION_SLEEPING :
					if ( blindfold )
						strcat(buffer," is sleeping here, blindfolded");
					else
						strcat(buffer," is sleeping here");

					if ( (af = get_affect (i, MAGIC_SIT_TABLE)) &&
						 is_obj_in_list ((OBJ_DATA *) af->a.spell.t, i->room->contents) ) {
						tobj = (OBJ_DATA *) af->a.spell.t;
						
						if (CAN_SEE_OBJ((i), (tobj))) /* item at his table */
							temp_arg = obj_short_desc (tobj);
						else
							temp_arg = "somethng";
							
						snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH,  " at #2%s#0.", temp_arg);
					} else
						strcat (buffer, ".");

					break;
				
				case POSITION_FIGHTING :
					if (i->fighting) {

						if ( IS_SET (i->flags, FLAG_SUBDUING) ) {
							if ( blindfold )
								strcat (buffer, " is here, #1wrestling blindfolded#0 against ");
							else
								strcat (buffer, " is here, #1wrestling#0 ");
						} else {
							if ( blindfold )
								strcat(buffer," is here, #1fighting blindfolded#0 against ");
							else
								strcat(buffer," is here, #1fighting#0 ");
						}

						if (i->fighting == ch)
							strcat(buffer," you!");
						else {
							if ( i->in_room == i->fighting->in_room ) {
								temp_arg = char_short(i->fighting);
								strcat(buffer, temp_arg);
								strcat(buffer, ".");
                            }
							else
								strcat(buffer, "someone who has already left.");
						}
					} else /* NIL fighting pointer */
							strcat(buffer," is here struggling with thin air.");
					break;
				
				default : strcat (buffer," is floating here."); 
					break;
			}
			if ( i->desc && i->desc->idle )
				strcat (buffer, " #1(idle)#0");

			if ( (GET_TRUST(i) || get_affect(ch,MAGIC_AFFECT_SENSE_LIFE)) && get_affect (i, MAGIC_HIDDEN) )
				strcat (buffer, " #1(hidden)#0");

			if ( GET_FLAG (i, FLAG_WIZINVIS) )
				strcat (buffer, " #C(wizinvis)#0");

			if ( get_affect (i, MAGIC_AFFECT_INVISIBILITY) )
				strcat (buffer, " #1(invisible)#0");

			if ( get_affect (i, MAGIC_AFFECT_CONCEALMENT) &&
				 (i == ch || GET_TRUST (i) ||
                  get_affect (ch, MAGIC_AFFECT_SENSE_LIFE)) )
				strcat (buffer, " #1(blend)#0");

			if ( IS_SET (i->act, PLR_QUIET) && !IS_NPC (i) )
				strcat(buffer," #1(editing)#0");

			if ( !IS_NPC(i) && !i->desc && !i->pc->admin_loaded )
				strcat(buffer, " #1(link dead)#0");

			if ( !IS_MORTAL (ch) && i->pc && !i->desc && i->pc->admin_loaded )
				strcat(buffer, " #3(loaded)#0");

			if ( !IS_NPC (i) && IS_SET (i->plr_flags, NEW_PLAYER_TAG) )
				strcat (buffer, " #2(new player)#0");

			if ( i->desc && i->desc->original && !IS_MORTAL (ch))
				strcat(buffer, " #2(animated)#0");
			strcat(buffer,"#0\n");
			reformat_string (buffer, &p);
			send_to_char(p, ch);
			mem_free (p);
		}

		else { /* npc with long */
			if ( IS_SUBDUER (i) ) {
				if ( IS_RIDER(i) ){
					temp_arg1 = char_short(i);
                	temp_arg2 = char_short(i->mount);
                	temp_arg3 = char_short(i->subdue);
                	snprintf (buffer, MAX_STRING_LENGTH, "#5%s#0, mounted on #5%s#0, has #5%s#0 in tow.\n", temp_arg1, temp_arg3, i->subdue == ch ? "you" : temp_arg3);
                }
                else{
                temp_arg1 = char_short(i);
                temp_arg2 = char_short(i->subdue); 
                snprintf (buffer, MAX_STRING_LENGTH, "#5%s#0 has #5%s#0 in tow.\n", temp_arg1, i->subdue == ch ? "you" : temp_arg2);
                }
                
                buffer [2] = UPPER (buffer [2]);
				send_to_char(buffer,ch);
            }

			else if ( IS_RIDER (i) && !IS_SUBDUER(i) ) {
				temp_arg1 = char_short (i);
				temp_arg2 = char_short (i->mount);
				snprintf (buffer, MAX_STRING_LENGTH,  "%s#0 %s %s#5%s#0.",
						 temp_arg1, AWAKE (i) ?
						   "sits atop" : "is asleep upon", AWAKE (i->mount) ?
						   "" : "a sleeping mount, ", temp_arg2);

				*buffer = toupper (*buffer);
				snprintf (buf2, MAX_STRING_LENGTH,  "#5%s", buffer);
				snprintf (buffer, MAX_STRING_LENGTH,  "%s", buf2);
				act (buffer, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
			}

			else if ( IS_RIDEE (i) ) {

				if ( ch == i->mount ) {
					temp_arg = char_short (i);
					snprintf (buffer, MAX_STRING_LENGTH,  "You sit upon %s#5%s#0.\n", AWAKE (i) ? "" : "a sleeping mount, ", temp_arg);

					send_to_char (buffer, ch);
				}
			}

			else if ( IS_HITCHEE (i) ) {

				if ( i == ch ){
					temp_arg = char_short (i);
					snprintf (buffer, MAX_STRING_LENGTH,  "#5You#0 ride upon #5%s#0.\n", temp_arg);
				}
				else{
					temp_arg1 = char_short (i);
					temp_arg2 = char_short (i->hitcher);
					snprintf (buffer, MAX_STRING_LENGTH,  "#5%s#0 is here, hitched to #5%s#0.\n", temp_arg1, i->hitcher == ch ? "you" : temp_arg2);
				}
				
				buffer [2] = toupper (buffer [2]);
				send_to_char (buffer, ch);
			}

			else {
				*buffer = '\0';


				if ( (GET_FLAG (i, FLAG_ENTERING) ||
					  GET_FLAG (i, FLAG_LEAVING)) &&
					  enter_exit_msg (i, buffer) ) {
					if ( i->desc && !IS_NPC (i) && i->desc->idle )
						strcat (buffer, "#1(idle)#0 ");

					if ( GET_FLAG (i, FLAG_WIZINVIS) )
						strcat (buffer, " #C(wizinvis)#0");

					if ( get_affect (i, MAGIC_HIDDEN) )
						strcat (buffer, " #1(hidden)#0");

					if ( get_affect (i, MAGIC_AFFECT_INVISIBILITY) )
					   strcat(buffer," #1(invisible)#0");

					if ( get_affect (i, MAGIC_AFFECT_CONCEALMENT) )
						strcat (buffer, " #1(blend)#0");

					if ( IS_SET (i->act, PLR_QUIET) && !IS_NPC (i) )
						strcat (buffer," #1(editing)#0");

					if ( i->desc && i->desc->original && !IS_MORTAL (ch))
						strcat(buffer, " #2(animated)#0");

					if ( !IS_NPC(i) && !i->desc && !i->pc->admin_loaded )
						strcat(buffer, " #1(link dead)#0");

					if ( !IS_MORTAL(ch) && !IS_NPC(i) && !i->desc && i->pc->admin_loaded )
						strcat(buffer, " #3(loaded)#0");

					if ( !IS_NPC(i) && IS_SET (i->plr_flags, NEW_PLAYER_TAG) )
						strcat (buffer, " #2(new player)#0");

					strcat (buffer, "#0\n");
					reformat_string (buffer, &p);
					send_to_char (p, ch);
					mem_free (p);
				
				} else if ( (af = get_affect (i, AFFECT_SHADOW)) &&
						  af->a.shadow.edge != -1 ) {
					temp_arg = 	char_short(i);  
					snprintf (buf, MAX_STRING_LENGTH,  "%s", temp_arg);
					*buf = toupper (*buf);
					snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH, 
						"#5%s is here, #0standing %s.", buf, dir_names [af->a.shadow.edge]);
					act (buffer, FALSE, ch, 0, i, TO_CHAR | TO_ACT_FORMAT);
				
				} else if ( (af = get_affect (i, AFFECT_GUARD_DIR)) &&
						  af->a.shadow.edge != -1 ) {
					temp_arg = char_short(i);
					snprintf (buf, MAX_STRING_LENGTH,  "%s", temp_arg);
					*buf = toupper(*buf);
					snprintf (buffer + strlen (buffer), MAX_STRING_LENGTH, 
						"#5%s#0 is here, guarding the %s exit.", buf, dirs [af->a.shadow.edge]);
					act (buffer, FALSE, ch, 0, i, TO_CHAR | TO_ACT_FORMAT);
				
				} else {
					snprintf (buffer, MAX_STRING_LENGTH,  "#5");
					temp_arg = char_long(i, GET_TRUST (ch));
					strcat (buffer, temp_arg);
					if ( get_affect (i, MAGIC_HIDDEN) )
						strcat (buffer, " #1(hidden)#0");

					if ( i->desc && i->desc->idle )
						strcat (buffer, " #1(idle)#0");

					if ( GET_FLAG (i, FLAG_WIZINVIS) )
						strcat (buffer, " #C(wizinvis)#0");

					if ( get_affect (i, MAGIC_AFFECT_INVISIBILITY) )
					   strcat(buffer," #1(invisible)#0");

					if ( get_affect (i, MAGIC_AFFECT_CONCEALMENT) )
						strcat (buffer, " #1(blend)#0");

					if ( IS_SET (i->act, PLR_QUIET) && !IS_NPC (i) )
						strcat (buffer," #1(editing)#0");

					if ( i->desc && i->desc->original && !IS_MORTAL (ch))
						strcat(buffer, " #2(animated)#0");

					if ( !IS_NPC(i) && !i->desc && !i->pc->admin_loaded )
						strcat(buffer, " #1(link dead)#0");

					if ( !IS_MORTAL(ch) && !IS_NPC(i) && !i->desc && i->pc->admin_loaded )
						strcat(buffer, " #3(loaded)#0");

					if ( !IS_NPC(i) && IS_SET (i->plr_flags, NEW_PLAYER_TAG) )
						strcat (buffer, " #2(new player)#0");

					strcat (buffer, "#0\n");
					reformat_string (buffer, &p);
					send_to_char (p, ch);
					mem_free (p);
				}
			}
		}

		if ( get_stink_message (i, NULL, stink_buf, ch) ) {
			act (stink_buf, FALSE, i, 0, ch, TO_VICT);
		}

		if ( (af = get_affect (i, MAGIC_TOLL)) &&
			 af->a.toll.room_num == i->in_room ) {
			snprintf (buffer, MAX_STRING_LENGTH,  "$n #Dis collecting tolls from people leaving "
							 "%s.#0", dirs [af->a.toll.dir]);
			act (buffer, TRUE, i, 0, ch, TO_VICT);
		}

	} 
	else if (mode == 1) {

		if (i->description) {

			if  ( ( ((eq = get_equip(i, WEAR_HEAD)) || (eq = get_equip(i, WEAR_FACE))) &&
			    (IS_SET(eq->obj_flags.extra_flags, ITEM_MASK))) ||
			    ((eq = get_equip(i, WEAR_ABOUT)) &&
			    (IS_SET(eq->obj_flags.extra_flags, ITEM_MASK)) &&
			    (IS_SET(i->affected_by,AFF_HOODED)))) {
			    send_to_char("This person's features are not visible.\n",ch);
			} else
			    send_to_char(i->description, ch);
		} else
			act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);

		/* Show a character to another */

		if (GET_MAX_HIT(i) > 0)
			percent = (100*GET_HIT(i))/GET_MAX_HIT(i);
		else
			percent = -1; /* How could MAX_HIT be < 1?? */

		temp_arg = char_short(i);
		strcpy (buffer, temp_arg);
		*buffer = toupper (*buffer);

		if ( IS_SET (i->act, ACT_VEHICLE) ) {
			if ( percent >= 100 )
				strcat (buffer, " is in pristine condition.\n");
			else if ( percent >= 90 )
				strcat (buffer, " is slightly damaged.\n");
			else if ( percent >= 70 )
				strcat (buffer, " is damaged, but still functional.\n");
			else if ( percent >= 50 )
				strcat (buffer, " is badly damaged.\n");
			else if ( percent >= 25 )
				strcat (buffer, " is barely functional.\n");
			else if ( percent >= 10 )
				strcat (buffer, " has sustained a great deal of damage!\n");
			else if ( percent >= 0 )
				strcat (buffer, " is about ready to collapse inward!\n");
			send_to_char ("\n", ch);
			send_to_char (buffer, ch);
		}

		*buf2 = '\0';
		*buf3 = '\0';

		if ( i->damage && !IS_SET (i->act, ACT_VEHICLE) && !is_hooded(i) ) {
			for ( wound = i->wounds; wound; wound = wound->next )
				curdamage += wound->damage;
			curdamage += i->damage;
			if ( curdamage > 0 && curdamage <= i->max_hit*.25 ){
				temp_arg = char_short(i);
				snprintf (buffer, MAX_STRING_LENGTH,  "%s's face looks slightly pale.\n", temp_arg);
			}	
			else if ( curdamage > i->max_hit*.25 && curdamage < i->max_hit*.80 ){
				temp_arg = char_short(i);
				snprintf (buffer, MAX_STRING_LENGTH,  "%s's face looks rather pallid.\n", temp_arg);
			}
			
			else if ( curdamage > i->max_hit*.80 && curdamage < i->max_hit*.95 ){
				temp_arg = char_short(i);			
				snprintf (buffer, MAX_STRING_LENGTH,  "%s's face looks quite ashen.\n", temp_arg);
			}
			
			else if ( curdamage > i->max_hit*.95 ){
				temp_arg = char_short(i);			
				snprintf (buffer, MAX_STRING_LENGTH,  "%s's face looks deathly pale.\n", temp_arg);
			}
			
			*buffer = toupper(*buffer);
			send_to_char("\n", ch);
			send_to_char(buffer, ch);
		}

		if ( !IS_SET (i->act, ACT_VEHICLE) && (i->wounds || i->lodged) ) {
			temp_arg = show_wounds(i,0);
			snprintf (buf2, MAX_STRING_LENGTH,  "%s", temp_arg);
			send_to_char("\n", ch);
			strcat (buf3, buf2);
		}

		act (buf3, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		*buf3 = '\0';

		if ( (!i->damage || is_hooded(i)) &&
				!IS_SET (i->act, ACT_VEHICLE) &&
				!i->wounds &&
				!i->lodged ) {
			
			send_to_char("\n", ch);
			temp_arg = char_short(i);
			snprintf (buf2, MAX_STRING_LENGTH,  "%s appears to be in excellent condition.", temp_arg);
			*buf2 = toupper(*buf2);
			reformat_string (buf2, &p);
			send_to_char (p, ch);
			mem_free (p);
			p = NULL;
		}

		if ( i != ch && display_clan_ranks (i, ch) ) {
			temp_arg = display_clan_ranks (i, ch);
			send_to_char ("\n", ch);
			snprintf (buf2, MAX_STRING_LENGTH,  "%s", temp_arg);
			*buf2 = toupper(*buf2);
			reformat_string (buf2, &p);
			send_to_char (p, ch);
			mem_free (p);
			p = NULL;
		}

		if ( i->mob &&
			 i->mob->vehicle_type == VEHICLE_HITCH &&
			 (troom = vtor (i->mob->virtual)) &&
			 (troom->people || troom->contents) &&
			 i->room != troom ) {
			snprintf (buf, MAX_STRING_LENGTH,  "\nOn board, you see:\n");
			send_to_char (buf, ch);
			if ( troom->people )
				list_char_to_char (troom->people, ch, 0);
			if ( troom->contents )
				list_obj_to_char (troom->contents, ch, 0, TRUE);
		}

		for ( charm = i->charms; charm; charm = charm->next ) {
			if ( *show_charm(charm) ){
				temp_arg = show_charm(charm);			
				snprintf (buf3 + strlen(buf3), MAX_STRING_LENGTH, "%s", temp_arg);
			}
		}

		if ( *buf3 ) {
			act (buf3, FALSE, ch, 0, 0, TO_CHAR);
		}

		*buf3 = '\0';
		if ( i == ch ) {
			send_to_char ("\n", i);
			do_equipment (i, "", 0);
		}
		else {
			if ( i->equip || i->right_hand || i->left_hand )
				send_to_char ("\n", ch);
		        if ( i->right_hand ) {
				if ( !IS_SET (i->act, ACT_MOUNT) ) {
                			if ( i->right_hand->location == WEAR_PRIM || i->right_hand->location == WEAR_SEC )
                        			snprintf (buf, MAX_STRING_LENGTH,   "<wielded in right hand>  ");
                			else if ( i->right_hand->location == WEAR_BOTH )
                        			snprintf (buf, MAX_STRING_LENGTH,   "<wielded in both hands>  ");
                			else if ( i->right_hand->location == WEAR_SHIELD )
                        			snprintf (buf, MAX_STRING_LENGTH,   "<gripped in right hand>  ");
               				else snprintf (buf, MAX_STRING_LENGTH,      "<carried in right hand>  ");
				}
				else snprintf (buf, MAX_STRING_LENGTH,      "<carried on back>        ");
                		send_to_char (buf, ch);
				show_obj_to_char (i->right_hand, ch, 1);
        		}
		        if ( i->left_hand ) {
				if ( !IS_SET (i->act, ACT_MOUNT) ) {
                			if ( i->left_hand->location == WEAR_PRIM || i->left_hand->location == WEAR_SEC )
                       	 		snprintf (buf, MAX_STRING_LENGTH,   "<wielded in left hand>   ");
                			else if ( i->left_hand->location == WEAR_BOTH )
                       	 		snprintf (buf, MAX_STRING_LENGTH,   "<wielded in both hands>  ");
                			else if ( i->left_hand->location == WEAR_SHIELD )
                       	 		snprintf (buf, MAX_STRING_LENGTH,   "<gripped in left hand>   ");
               				else snprintf (buf, MAX_STRING_LENGTH,      "<carried in left hand>   ");
				}
				else snprintf (buf, MAX_STRING_LENGTH,      "<carried on back>        ");

                		send_to_char (buf, ch);
				show_obj_to_char (i->left_hand, ch, 1);
        		}

		        if ( i->equip && (i->left_hand || i->right_hand) )
                		send_to_char ("\n", ch);
                		
				for ( location = 0; location < MAX_WEAR; location++ ) {

					eq = get_equip (i, location);
	
					if ( !(eq) )
						continue;

					if ( eq == i->right_hand || eq == i->left_hand )
						continue;

			/* only layer 1 i hidden */
					if ((location == WEAR_BODY_1) &&
						(get_equip (i, WEAR_BODY_2) ||
						get_equip (i, WEAR_BODY_3) ||
						get_equip (i, WEAR_BODY_4) ||
						get_equip (i, WEAR_BODY_5)))
						continue;
						
			/* all lower layers hidden */
					if ((location == WEAR_LEGS_1) &&
						(get_equip (i, WEAR_LEGS_2) ||
						get_equip (i, WEAR_LEGS_3)))
						continue;

					if ((location == WEAR_LEGS_2) &&
						(get_equip (i, WEAR_LEGS_3)))
						continue;
					
					send_to_char (where [location], ch);
					
					if ( location == WEAR_BLINDFOLD || IS_OBJ_VIS (ch, eq) )
						show_obj_to_char (eq, ch, 1);
					else
						send_to_char ("#2something#0\n", ch);
	
					found = TRUE;
				}
			}
	}

	else if ( mode == 3 ) {
		if ( CAN_SEE (ch, i) ) {
			send_to_char ("   ", ch);
			act ("$N", FALSE, ch, 0, i, TO_CHAR);
		}
	}
}

void do_search (CHAR_DATA *ch, char *argument, int cmd)
{
	int		dir = 0;
	char		buf [MAX_STRING_LENGTH] = { '\0' };

	if ( !real_skill (ch, SKILL_SEARCH) ) {
		send_to_char ("You'll need to learn some search skills first.\n", ch);
		return;
	}

	argument = one_argument (argument, buf);

	if ( !*buf )
		dir = -1;
	else {
		switch ( *buf ) {
			case 'n': dir = 0; break;
			case 'e': dir = 1; break;
			case 's': dir = 2; break;
			case 'w': dir = 3; break;
			case 'u': dir = 4; break;
			case 'd': dir = 5; break;
			default:
				send_to_char ("That's not a valid direction.\n", ch);
				return;
		}
	}

	act ("$n carefully searches the area.", TRUE, ch, 0, 0, TO_ROOM);
	act ("You search carefully...", FALSE, ch, 0, 0, TO_CHAR);

    ch->delay_type  = DEL_SEARCH;
    ch->delay       = 3 + number (0, 2);
	ch->delay_info1 = dir;
}

void delayed_search (CHAR_DATA *ch)
{
	int			dir = 0;
	int			skill_tried = 0;
	int			somebody_found = 0;
	int			search_quality = 0;
	CHAR_DATA		*tch = NULL;
	OBJ_DATA		*obj = NULL;
	AFFECTED_TYPE		*af = NULL;
	char			buf [MAX_STRING_LENGTH] = { '\0' };

	dir = ch->delay_info1;

	if ( dir == -1 ) {

		for ( tch = ch->room->people; tch; tch = tch->next_in_room ) {
			
			if ( tch == ch )
				continue;

			if ( !get_affect (tch, MAGIC_HIDDEN) )
				continue;

			if ( GET_FLAG (tch, FLAG_WIZINVIS) )
				continue;

			if ( !IS_LIGHT (ch->room) && !get_affect (ch, MAGIC_AFFECT_INFRAVISION) && !IS_SET (ch->affected_by, AFF_INFRAVIS))
				continue;

			if ( (ch->room->sector_type == SECT_WOODS ||
				  ch->room->sector_type == SECT_FOREST ||
				  ch->room->sector_type == SECT_HILLS) &&
				 get_affect (tch, MAGIC_AFFECT_CONCEALMENT) )
				continue;

			if ( get_affect (tch, MAGIC_AFFECT_INVISIBILITY) &&
				 !get_affect (ch, MAGIC_AFFECT_SEE_INVISIBLE) )
				continue;

			if ( !skill_tried ) {
				skill_use (ch, SKILL_SEARCH, 0);
				skill_tried = 1;
			}

			search_quality = ch->skills [SKILL_SEARCH] -
								tch->skills [SKILL_HIDE] / 5;

			if ( search_quality <= 0 )
				continue;

			if ( search_quality < number (0, 100) ) {
				if ( !number (0, 10) )
					act ("$n looks right at you, but still doesn't see you.",
							TRUE, ch, 0, tch, TO_VICT);
				continue;
			}

			act ("You are exposed by $N!", FALSE, tch, 0, ch, TO_CHAR);
			act ("You expose $N!", FALSE, ch, 0, tch, TO_CHAR);
			act ("$n exposes $N.", FALSE, ch, 0, tch, TO_NOTVICT);

			if ( enter_exit_msg (ch, buf) )
				act (buf, FALSE, tch, 0, 0, TO_ROOM);

			remove_affect_type (tch, MAGIC_HIDDEN);

			somebody_found = 1;
		}

		if ( !somebody_found ) {
			send_to_char ("You didn't find anybody hiding.\n", ch);
			act ("$n finishes searching.", TRUE, ch, 0, 0, TO_ROOM);
		}

		for ( obj = ch->room->contents; obj; obj = obj->next_content ) {

			if ( !(af = get_obj_affect (obj, MAGIC_HIDDEN)) )
				continue;

			if ( !IS_LIGHT (ch->room) && !get_affect (ch, MAGIC_AFFECT_INFRAVISION) && !IS_SET (ch->affected_by, AFF_INFRAVIS))
				continue;

			if ( af->a.hidden.coldload_id == ch->coldload_id )
				continue;

			if ( !skill_tried ) {
				skill_use (ch, SKILL_SEARCH, 0);
				skill_tried = 1;
			}

			if ( ch->skills [SKILL_SEARCH] <= number (1, 100) )
				continue;

			if ( af->a.hidden.hidden_value && number (1, ch->skills [SKILL_SEARCH]) < number (1, af->a.hidden.hidden_value) )
				continue;

			remove_obj_affect (obj, MAGIC_HIDDEN);

			act ("You reveal $p.", FALSE, ch, obj, 0, TO_CHAR);
			act ("$n reveals $p.", FALSE, ch, obj, 0, TO_ROOM);
		}

		return;
	}

	if ( !ch->room->secrets [dir] ||
	 	 ch->skills [SKILL_SEARCH] < ch->room->secrets [dir]->diff ||
		 !skill_use (ch, SKILL_SEARCH, 5 * ch->room->secrets [dir]->diff) ) {
		send_to_char ("You didn't find anything.\n", ch);
		return;
	}

	send_to_char (ch->room->secrets [dir]->stext, ch);
}

char *get_room_description (CHAR_DATA *ch, ROOM_DATA *room)
{
	if ( IS_MORTAL(ch) && weather_info[room->zone].state == HEAVY_SNOW && !IS_SET (room->room_flags, INDOORS) )
		return "   A howling blanket of white completely obscures your vision.\n";

	else if ( !room->extra || desc_weather[room->zone] == WR_NORMAL ||
			  !room->extra->weather_desc [desc_weather[room->zone]] ) {

		if ( room->extra &&
			 room->extra->weather_desc [WR_NIGHT] && !sun_light )
            return (room->extra->weather_desc [WR_NIGHT]);
		else
            return room->description;

	} else
        return room->extra->weather_desc [desc_weather[room->zone]];
}

void do_look (CHAR_DATA *ch, char *argument, int cmd)
{
	int				temp = 0;
	int				i = 0;
	int				dir = 0;
	int				count = 0;
	char			*ptr = NULL;
	OBJ_DATA		*obj = NULL;
	OBJ_DATA		*obj1 = NULL;
	OBJ_DATA		*obj2 = NULL;
	OBJ_DATA		*obj3 = NULL;
	OBJ_DATA		*tobj = NULL;
	CHAR_DATA		*tch = NULL;
	ROOM_DATA		*troom = NULL;
	ROOM_DIRECTION_DATA		*exit_room = NULL;
	AFFECTED_TYPE	*af = NULL;
	bool			contents = FALSE;
	char			bitbuf [MAX_STRING_LENGTH] = { '\0' };
	char			arg1 [MAX_STRING_LENGTH] = { '\0' };
	char			buf [MAX_STRING_LENGTH] = { '\0' };
	char			*temp_arg = NULL;
	int				temp_int = 0;
	int				rnum = 0;
	int				original_loc = 0;
	bool			change = FALSE;
	bool			again = TRUE;
	bool			abrt = FALSE;
	char			*e_dirs [] = { "the north", "the east", "the south", "the west", "above", "below" };


/*** CHECK FOR POSTIONS AND CONDITONS FIRST ***/

	if ( GET_POS (ch) < POSITION_SLEEPING ) {
		send_to_char ("You are unconscious!\n", ch);
		return;
	}

	if ( GET_POS (ch) == POSITION_SLEEPING ) {
		send_to_char ("You are asleep.\n", ch);
		return;
	}
 
 	temp_int = is_blind (ch);
	if (temp_int) {
		send_to_char ("You are blind!\n", ch);
		return;
	}
	

/**** NOW THAT YOU CAN SEE THINGS, WHAT DO YOU SEE? ****/

	if ( !ch->room )
		ch->room = vtor (ch->in_room);

	argument = one_argument (argument, arg1);


/**** LOOKING OUT THE WINDOW IN THE OOC LOUNGE ****/

	if ( !str_cmp (arg1, "window") && ch->in_room == OOC_LOUNGE ) {
		count = 1;
		for ( troom = full_room_list; troom; troom = troom->lnext )
			count++;

		while ( again ) {
			abrt = FALSE;
			rnum = number (1,count);
			for ( troom = full_room_list, i = 1; troom; troom = troom->lnext, i++ ) {
			if ( i != rnum )
					continue;
			
			/** can't see PC's **/		
			for ( tch = troom->people; tch; tch = tch->next_in_room ) 
					if ( !IS_NPC (tch) )
						abrt = TRUE;
			
			/** Storage rooms, or unfinished rooms **/
			if ( IS_SET (troom->room_flags, STORAGE) )
					abrt = TRUE;
			if ( !strncmp (troom->description, "No Description Set", 17) )
					abrt = TRUE;
			if ( !strncmp (troom->description, "   No Description Set", 20) )
					abrt = TRUE;
					
			/** It's Dark **/		
			if ( is_dark (ch->room) && IS_MORTAL (ch) &&
		 			!get_affect (ch, MAGIC_AFFECT_INFRAVISION) &&
		 			!IS_SET (ch->affected_by, AFF_INFRAVIS) )
					abrt = TRUE;
					
			/** Can't see rooms QQ000, or anything in Zone 0 **/		
			if ( troom->virtual % 1000 == 0 )
					abrt = TRUE;
			if ( troom->zone == 0 )
					abrt = TRUE;
					
			/** If we found a room then use the rnum **/		
			if ( !abrt ) {
					again = FALSE;
					rnum = troom->virtual;
				}
			}
		}
		original_loc = ch->in_room;
		act ("$n presses $s face to the window, gazing down at thee world below.", TRUE, ch, 0, 0, TO_ROOM | TO_ACT_FORMAT);
		act ("You press your face to the window, gazing down at the world below.", FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		char_from_room(ch);
		char_to_room (ch, rnum);
		send_to_char ("\n", ch);
		if ( !ch->room->light ) {
			ch->room->light = 1;
			change = TRUE;
		}
		do_look (ch, "", 0);
		if ( change )
			ch->room->light = 0;
		char_from_room(ch);
		char_to_room (ch, original_loc);
		if ( IS_MORTAL(ch) )
			ch->roundtime = 15;
		return;
	}

/***** LOOK IN A CERTAIN DIRECTION *****/

	if ( *arg1 && (dir = index_lookup (dirs, arg1)) != -1 ) {

		if ( !(exit_room = PASSAGE (ch, dir)) ) {
			send_to_char ("There is no exit that way.\n", ch);
			return;
		}

		if ( exit_room->general_description &&
			 *exit_room->general_description )
			send_to_char (exit_room->general_description, ch);

		if ( (af = get_affect (ch, AFFECT_SHADOW)) && af->a.shadow.edge == dir &&
			IS_SET (exit_room->exit_info, PASSAGE_CLOSED) ) {
			send_to_char ("Your field of view through that exit is obstructed.\n", ch);
		}

		else if ( (af = get_affect (ch, AFFECT_SHADOW)) &&
			 af->a.shadow.edge == dir ) {
			send_to_char ("You are close enough to see what is in the next "
						  "room:\n\n", ch);

			temp = ch->in_room;

			char_from_room (ch);
			char_to_room (ch, exit_room->to_room);

			list_obj_to_char (ch->room->contents, ch, 0, FALSE);
			list_char_to_char (ch->room->people, ch, 0);

			for ( tch = ch->room->people; tch; tch = tch->next_in_room )
				if ( CAN_SEE (ch, tch) )
					target_sighted (ch, tch);

			char_from_room (ch);
			char_to_room (ch, temp);
		}

		else {

			if ( !(troom = vtor (exit_room->to_room)) ) {
				send_to_char ("The way in that direction is blocked.\n", ch);
				return;
			}

			temp = 0;

			for ( tch = troom->people; tch; tch = tch->next_in_room )
				if ( (af = get_affect (tch, AFFECT_SHADOW)) &&
					 af->a.shadow.edge == rev_dir [dir] &&
					could_see (ch, tch) ) {
					act ("You see $N.", FALSE, ch, 0, tch, TO_CHAR);
					temp = 1;
				}
		}
		return;
	}
		
	if ( is_dark (ch->room) && IS_MORTAL (ch) &&
		 !get_affect (ch, MAGIC_AFFECT_INFRAVISION) &&
		 !IS_SET (ch->affected_by, AFF_INFRAVIS) ) {
		send_to_char ("It is pitch black.\n", ch);
		return;
	}

/**** LOOK INSIDE ANOTHER OBJECT ****/

	if ( !str_cmp (arg1, "in") ) {

		argument = one_argument (argument, arg1);

		if ( !*arg1 ) {
			send_to_char ("Look in what?\n", ch);
			return;
		}

		if ( !(obj = get_obj_in_dark (ch, arg1, ch->right_hand)) &&
			 !(obj = get_obj_in_dark (ch, arg1, ch->left_hand)) &&
			 !(obj = get_obj_in_dark (ch, arg1, ch->equip)) &&
			 !(obj = get_obj_in_list_vis (ch, arg1, ch->room->contents)) ) {
			send_to_char ("You don't see that here.\n", ch);
			return;
		}

/**** LOOK INSIDE A DRINK CONTATINER ***/

		if ( GET_ITEM_TYPE (obj) == ITEM_DRINKCON ) {

			if ( obj->o.drinkcon.volume <= 0 )
				act ("$o is empty.", FALSE, ch, obj, 0, TO_CHAR);

			else {
				if ( obj->o.drinkcon.capacity )
					temp = obj->o.drinkcon.volume * 3 / obj->o.drinkcon.capacity;
				else
					temp = 1;
				temp_arg = vnum_to_liquid_name (obj->o.drinkcon.liquid);
				snprintf (buf, MAX_STRING_LENGTH,  "$o is %sfull of %s.\n",
							  fullness [temp], temp_arg );
				act (buf, FALSE, ch, obj, 0, TO_CHAR);
			}

			return;
		}

/**** LOOK INSIDE A NON-DRINK CONTAINER ***/

		else if ( GET_ITEM_TYPE (obj) == ITEM_CONTAINER ||
		          GET_ITEM_TYPE (obj) == ITEM_QUIVER ||
			  GET_ITEM_TYPE (obj) == ITEM_SHEATH ||
			  (GET_ITEM_TYPE (obj) == ITEM_WEAPON &&
			   obj->o.weapon.use_skill == SKILL_SLING) ||
			  GET_ITEM_TYPE (obj) == ITEM_KEYRING ) {

			if ( IS_SET (obj->o.container.flags, CONT_CLOSED) ) {
				send_to_char ("It is closed.\n", ch);
					return;
				}
			
			temp_arg = fname (obj->name);
			send_to_char (temp_arg, ch);
			
			if ( obj->in_room != NOWHERE )
				send_to_char (" (here) : \n", ch);
			else if ( obj->carried_by )
				send_to_char (" (carried) : \n", ch);
			else
				send_to_char (" (used) : \n", ch);

			list_obj_to_char (obj->contains, ch, 1, TRUE);
		}

		else
			send_to_char("That is not a container.\n", ch);
	}

/**** LOOK OUT OF A TRANSPORT ****/

	else if ( !str_cmp (arg1, "overboard") || !str_cmp (arg1, "over") ) {

		if ( !ch->vehicle ) {
			send_to_char ("You're not on a boat?\n", ch);
			return;
		}

		if ( !OUTSIDE (ch) ) {
			send_to_char ("You can do that on deck, but not from here.\n", ch);
			return;
		}

		if ( is_dark (ch->room) && IS_MORTAL (ch) )
			send_to_char ("It is dark overboard.\n", ch);
		else {
			snprintf (buf, MAX_STRING_LENGTH,  "#6%s#0\n", ch->vehicle->room->name);
			send_to_char (buf, ch);
			temp_arg = get_room_description (ch, ch->vehicle->room);
			send_to_char (temp_arg, ch);
		}

		if ( ch->vehicle && OUTSIDE (ch) ) {
			troom = ch->vehicle->room;
			if ( troom->contents || troom->people->next_in_room ) {
				if ( troom->contents )
					list_obj_to_char (troom->contents, ch, 0, FALSE);
				if ( troom->people->next_in_room )
					list_char_to_char (troom->people, ch, 0);
			}
		}
	}

/**** LOOK AT ITEMS ****/

	else if ( *arg1 ) {

		if ( !str_cmp (arg1, "at") )
			argument = one_argument (argument, arg1);

		if ( !*arg1 ) {
			send_to_char ("Look at what?\n", ch);
			return;
		}

		tch = get_char_room_vis (ch, arg1);
		if (tch) {

			argument = one_argument (argument, arg1);
			
			obj1 = get_obj_in_list_vis (tch, arg1, tch->right_hand);
			obj2 = get_obj_in_list_vis (tch, arg1, tch->left_hand);
			if ( *arg1 && ((obj1) || (obj2))) {
				act ("$N is carrying $p.", FALSE, ch, obj, tch, TO_CHAR);
				send_to_char ("\n", ch);
				if (obj1)
					show_obj_to_char (obj1, ch, 5);
				else
					show_obj_to_char (obj2, ch, 5);
				return;
			}
			obj = get_obj_in_list_vis (tch, arg1, tch->equip);
			if ( *arg1 && (obj)){
				act ("$N is wearing $p.", FALSE, ch, obj, tch, TO_CHAR);
				send_to_char ("\n", ch);
				show_obj_to_char (obj, ch, 5);
				return;
			}

			if ( *arg1 ) {
				act ("$N doesn't have that.", FALSE, ch, 0, tch, TO_CHAR);
				return;
			}

			show_char_to_char (tch, ch, 1);

			return;
		}

/**** READ A MESSAGE BOARD ****/
		
		obj1 = get_obj_in_dark (ch, arg1, ch->right_hand); 
		obj2 = get_obj_in_dark (ch, arg1, ch->left_hand);
		obj3 = get_obj_in_dark (ch, arg1, ch->equip);
				
		if (obj1)
			obj = obj1;
			
		else if	(obj2)
			obj = obj2;
		
		else if (obj3)
			obj = obj3;
			
		else 
			obj = get_obj_in_list_vis (ch, arg1, ch->room->contents);
		
		if (obj && obj->obj_flags.type_flag == ITEM_BOARD){			
			(void)one_argument (obj->name, buf);			
			retrieve_mysql_board_listing (ch, buf);
			return;
		}

/*** EXTRA ROOM DESCRIPTION ***/

		if ( (ptr = find_ex_description (arg1, ch->room->ex_description)) &&
			 *ptr ) {
			page_string (ch->desc, ptr);
			return;
		}

		if ( obj ) {
			show_obj_to_char (obj, ch, 5);
			return;
		}
		
		if ( *arg1 && (!cmp_strn (arg1, "furnishings", strlen(arg1)) || !cmp_strn (arg1, "furniture", strlen(arg1)) || !cmp_strn (arg1, "tables", strlen(arg1))) ) {
			do_tables (ch, "", 0);
			return;
		}

		if ( *arg1 && !cmp_strn (arg1, "objects", strlen(arg1)) ) {
			show_contents (ch, 1);

			return;
		}

		if ( *arg1 && (!cmp_strn (arg1, "crowd", strlen(arg1)) || !cmp_strn (arg1, "individuals", strlen(arg1))) ) {
			show_contents (ch, 2);

			return;
		}

		send_to_char ("You do not see that here.\n", ch);
		
		return;
	}

	else {			
	
/**** GENERAL LOOK - GIVES ROOM DESCRIPTION ****/

		if ( IS_MORTAL (ch) ) {

			snprintf (buf, MAX_STRING_LENGTH,  "#6%s#0", ch->room->name);
			send_to_char (buf, ch);
		} else {
			sprintbit (ch->room->room_flags, room_bits, bitbuf);
			snprintf (buf, MAX_STRING_LENGTH,  "#6%s#0 #2[%d: %s#6%s#2]#0",
							ch->room->name,
							ch->room->virtual,
							bitbuf,
							sector_types [ch->room->sector_type]);

			send_to_char (buf, ch);

			if ( ch->room->prg )
				send_to_char (" [Prog]", ch);

			if ( ch->room->deity && ch->room->sector_type != SECT_LEANTO ) {
				/* Lean-tos use the deity int to record the number of people camping there. */
				snprintf (buf, MAX_STRING_LENGTH,  " Temple of %s\n",
							deity_name [ch->room->deity]);
				send_to_char (buf, ch);
			}

			if (ch->room->sector_type == SECT_LEANTO) {
				snprintf (buf, MAX_STRING_LENGTH,  "\nNumber of Occupants: %d.", (ch->room->deity - 15));
				if (!IS_MORTAL(ch)) send_to_char(buf, ch);
			}
		}

/*** DISPLAY PATH VEHICLE CAN TAKE ***/

		if ( ch->vehicle &&
			 is_he_somewhere (ch->vehicle) &&
			 ch->vehicle->mob->helm_room == ch->in_room ) {

			strcpy (buf, " May sail: [#4");

			for ( dir = 0; dir < 6; dir++ ) {

				if ( !PASSAGE (ch->vehicle, dir) ||
					 !(troom = vtor (PASSAGE (ch->vehicle, dir)->to_room)) )
					continue;

				if ( troom->sector_type == SECT_DOCK ||
					 troom->sector_type == SECT_REEF ||
					 troom->sector_type == SECT_OCEAN ||
					 is_room_affected (troom->affects, MAGIC_ROOM_FLOOD) )
					add_char (buf, toupper (*dirs [dir]));
				}

			strcat (buf, "#0]");
			send_to_char (buf, ch);
		}
				
/*** WEATHER EFFECTS IN ROOM ***/
				
		if ( (weather_info[ch->room->zone].state != HEAVY_SNOW || IS_SET (ch->room->room_flags, INDOORS)) || !IS_MORTAL(ch) ) {
			snprintf (buf, MAX_STRING_LENGTH,  "#6Exits:#0 ");

			for ( dir = 0; dir < 6; dir++ ) {
				if ( !PASSAGE (ch, dir) )
					continue;
				
				if ( ch->room->secrets [dir] &&
					 IS_SET (PASSAGE (ch, dir)->exit_info, PASSAGE_CLOSED) && IS_MORTAL(ch) )
					continue;
				
				if ( PASSAGE(ch, dir)->to_room && (troom = vtor(PASSAGE(ch, dir)->to_room)) && IS_SET (troom->room_flags, FALL) )
					snprintf (ADDBUF, MAX_STRING_LENGTH,  "#1%s#0 ", dirs[dir]);
				
				else if ( PASSAGE(ch, dir)->to_room && (troom = vtor(PASSAGE(ch, dir)->to_room)) && (troom->sector_type == SECT_RIVER ||
					troom->sector_type == SECT_LAKE || troom->sector_type == SECT_OCEAN || troom->sector_type == SECT_REEF ||
					troom->sector_type == SECT_UNDERWATER) )
					snprintf (ADDBUF, MAX_STRING_LENGTH,  "#4%s#0 ", dirs[dir]);
				
				else
					snprintf (ADDBUF, MAX_STRING_LENGTH,  "#2%s#0 ", dirs[dir]);
				
				if ( !PASSAGE(ch, dir)->exit_info )
					continue;
				
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "(%s %s) ", IS_SET (PASSAGE(ch, dir)->exit_info, PASSAGE_CLOSED) ? "closed" : "open", PASSAGE(ch, dir)->keyword);
			}

			if ( ch->room->virtual > 100000 ) {
				if ( (tobj = find_dwelling_obj (ch->room->virtual)) && IS_SET (tobj->o.od.value[2], CONT_CLOSED) )
					snprintf (ADDBUF, MAX_STRING_LENGTH,  "#2outside#0 (closed entryway)");
				else snprintf (ADDBUF, MAX_STRING_LENGTH,  "#2outside#0 (entryway)");
			}

			send_to_char ("\n", ch);
			act (buf, FALSE, ch, 0, 0, TO_CHAR | TO_ACT_FORMAT);
		}
		else send_to_char ("\n", ch);

		send_to_char ("\n", ch);
		temp_arg = get_room_description(ch, ch->room);
		send_to_char (temp_arg, ch);

		for ( obj = ch->room->contents; obj; obj = obj->next_content )
			if ( CAN_SEE_OBJ (ch, obj) )
				contents = TRUE;

		for ( tch = ch->room->people; tch; tch = tch->next_in_room )
			if ( CAN_SEE (ch, tch) && ch != tch )
				contents = TRUE;

		if ( contents )
			send_to_char ("\n", ch);

		if ( get_stink_message (NULL, ch->room, arg1, ch) )
			act (arg1, FALSE, ch, 0, 0, TO_CHAR);

		if ( !IS_SET (ch->room->room_flags, INDOORS) && ch->room->sector_type != SECT_UNDERWATER ) {
			*buf = '\0';
			if ( !contents )
				snprintf (buf, MAX_STRING_LENGTH,  "\n");
			
			if ( IS_SET (ch->room->room_flags, STIFLING_FOG) )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6A stifling fog blankets the area, minimizing visibility.#0\n");
			else if ( weather_info[ch->room->zone].state == LIGHT_RAIN )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6A light, cool rain is falling here.#0\n");
			else if ( weather_info[ch->room->zone].state == STEADY_RAIN )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6A copious amount of rain is falling steadily here.#0\n");
			else if ( weather_info[ch->room->zone].state == HEAVY_RAIN )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6Rain falls in heavy sheets, inundating the area with water.#0\n");
			else if ( weather_info[ch->room->zone].state == LIGHT_SNOW )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6A light dusting of snow is falling in the area.#0\n");
			else if ( weather_info[ch->room->zone].state == STEADY_SNOW )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6Snow is falling steadily here, beginning to blanket the area.#0\n");
			else if ( weather_info[ch->room->zone].fog == THIN_FOG )
				snprintf (ADDBUF, MAX_STRING_LENGTH,  "#6Thin, silvery tendrils 

Showing the first 100 KB of 233.5 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571