atd/area/
atd/build/
atd/clans/
atd/log/
atd/player/store/
atd/site/
atd/src/bin/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
 /***************************************************************************
 *  God Wars Mud originally written by KaVir aka Richard Woolcock.         *
 *  Changes done to the code done by Sage aka Walter Howard, this mud is   *
 *  for the public, however if you run this code it means you agree        *
 *  to the license.low, license.gw, and license.merc have fun. :)          *
***************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "leader.h"
#include "commands.h"
#include "build.h"


/*
 * Locals
 */

/*
 * %s will be replaced by his or her
 */
const struct where_type  where_name [MAX_WEAR] =
{
    { "{r[ {nMastery{r     ]{x ", WEAR_MASTERY,  "as %s mastery"      },
    { "{r[ {nLight{r       ]{x ", WEAR_LIGHT,    "as %s a light"      },
    { "{r[ {nFinger{r      ]{x ", WEAR_FINGER_L, "on %s left finger"  },
    { "{r[ {nFinger{r      ]{x ", WEAR_FINGER_R, "on %s right finger" },
    { "{r[ {nNeck{r        ]{x ", WEAR_NECK_1,   "around %s neck"     },
    { "{r[ {nNeck{r        ]{x ", WEAR_NECK_2,   "around %s neck"     },
    { "{r[ {nBody{r        ]{x ", WEAR_BODY,     "covering %s body"   },
    { "{r[ {nHead{r        ]{x ", WEAR_HEAD,     "on %s head"         },
    { "{r[ {nFace       {r ]{x ", WEAR_FACE,     "covering %s face"   },
    { "{r[ {nNose{r        ]{x ", WEAR_NOSE,     "pierced through %s nose" },
    { "{r[ {nEar{r         ]{x ", WEAR_EAR_R,    "on %s right ear"    },
    { "{r[ {nEar{r         ]{x ", WEAR_EAR_L,    "on %s left ear"     },
    { "{r[ {nLegs{r        ]{x ", WEAR_LEGS,     "covering %s legs"   },
    { "{r[ {nAnkle{r       ]{x ", WEAR_ANKLE_L,  "straped around %s left ankle" },
    { "{r[ {nAnkle{r       ]{x ", WEAR_ANKLE_R,  "straped around %s right anklet" },
    { "{r[ {nFeet{r        ]{x ", WEAR_FEET,     "as %s boots"        },
    { "{r[ {nHands{r       ]{x ", WEAR_HANDS,    "covering %s fingers"},
    { "{r[ {nArms{r        ]{x ", WEAR_ARMS,     "straped around %s arms" },
    { "{r[ {nOff Hand{r    ]{x ", WEAR_SHIELD,   "straped to %s off-hand" },
    { "{r[ {nAbout{r       ]{x ", WEAR_ABOUT,    "draped about %s body"   },
    { "{r[ {nWaist{r       ]{x ", WEAR_WAIST,    "tied around %s waiste"  },
    { "{r[ {nWrist{r       ]{x ", WEAR_WRIST_L,  "straped on %s left forarm" },
    { "{r[ {nWrist{r       ]{x ", WEAR_WRIST_R,  "straped on %s right forarm" },
    { "{r[ {nRight Hand{r  ]{x ", WEAR_WIELD,    "held in %s right hand"  },
    { "{r[ {nLeft Hand{r   ]{x ", WEAR_HOLD,     "held in %s left hand"   },
    { "{r[ {nThird Hand{r  ]{x ", WEAR_THIRD,    "held in %s third hand" },
    { "{r[ {nFourth Hand{r ]{x ", WEAR_FOURTH,   "held in %s fourth hand"  },
    { "{r[ {nL Scabbard {r ]{x ", WEAR_SCABBARD_L, "sheathed on the left side of %s belt" },
    { "{r[ {nR Scabbard {r ]{x ", WEAR_SCABBARD_R, "sheathed on the right side of %s belt" }
};


const char *const sector_string[SECT_MAX] = {
    "{w[inside]", "{D[{wcity{D]", "{y[{gfield{y]", "{g[forest]",
    "{Y[{ghills{Y]", "{D[{ymountain{D]", "{b[{cwater{b]", "{b[water]",
    "{b[underwater]", "{c[air]", "{y[{Ydesert{y]"
};

char * from_room [] =
{
    "$n looks north.", "$n looks east.", "$n looks south.",
    "$n looks west.",  "$n looks up.",   "$n looks down."
};

char * to_room [] =
{
    "Someone peeks in from the south.", "Someone peeks in from the west.",
    "Someone peeks in from the north.", "Someone peeks in from the east.",
    "Someone peeks in from below.",     "Someone peeks in from above."
};

/*
 * Externals
 */
char *  class_name              args( ( int class ) );
void    text_bar                args( ( CHAR_DATA *ch, char *argument, bool pager ) );
char *  all_capitalize          args( ( char *argument ) );

/*
 * Local functions.
 */
char *	format_obj_to_char	args( ( OBJ_DATA *obj, CHAR_DATA *ch,
				    bool fShort ) );
void	show_char_to_char_0	args( ( CHAR_DATA *victim, CHAR_DATA *ch ) );
void	show_char_to_char_1	args( ( CHAR_DATA *victim, CHAR_DATA *ch ) );
void	show_char_to_char	args( ( CHAR_DATA *list, CHAR_DATA *ch ) );
bool	check_blind		args( ( CHAR_DATA *ch ) );
void	evil_eye		args( ( CHAR_DATA *victim, CHAR_DATA *ch ) );
void 	check_left_arm		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void 	check_right_arm		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void 	check_left_leg		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void 	check_right_leg		args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );
void	obj_score		args( ( CHAR_DATA *ch, OBJ_DATA *obj ) );
void    show_equipment          args( (CHAR_DATA *victim, CHAR_DATA *ch) );
sh_int  str_similar             args( ( const char *astr, const char *bstr ) );
sh_int  str_prefix_level        args( ( const char *astr, const char *bstr ) );
void    similar_help_files      args( (CHAR_DATA *ch, char *argument ) );


char *num_punct(char * xbuf, int foo)
{
    int index, index_new, rest;
    char buf[16];

    sprintf(buf,"%d",foo);
    rest = strlen(buf)%3;
    *xbuf = '\0'; 
    for (index=index_new=0;index<strlen(buf);index++,index_new++)
    {
	if (index!=0 && (index-rest)%3==0 )
	{
	    xbuf[index_new]=',';
	    index_new++;
	    xbuf[index_new]=buf[index];
        }
        else
	    xbuf[index_new] = buf[index];
    }
    xbuf[index_new]='\0';
    return xbuf;
}

/*
 * Ranks the number of Match's in Characters between 2
 * full strings
 */
sh_int str_similar( const char *astr, const char *bstr )
{
   sh_int matches=0;

    if (!astr || !bstr)
       return matches;

    for ( ; *astr; astr++)
    {
        if ( LOWER(*astr) == LOWER(*bstr) )
           matches++;
        
        if (++bstr == '\0')
           return matches;                
    }
    
    return matches;
}

/*
 * Ranks the number of matchs there are until there is 
 * a non-matching character
 */
sh_int str_prefix_level( const char *astr, const char *bstr )
{
   sh_int matches=0;

    if (!astr || !bstr)
       return matches;

    for ( ; *astr; astr++)
    {
        if ( LOWER(*astr) == LOWER(*bstr) )
           matches++;
        else
           return matches;

        if (++bstr == '\0')
        return matches;
    }

    return matches;
}

char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort )
{
    static char buf[MAX_STRING_LENGTH];

    buf[0] = '\0';
    if ( IS_SET(obj->quest, QUEST_ARTIFACT))
        strcat(buf, "{W({DArtifact{W){x " );
    else if ( IS_OBJ_STAT(obj,ITEM_SATANIC ) )
	strcat(buf, "{R(Satanic){x " );
    else if ( IS_SET(obj->quest, QUEST_RELIC))
        strcat(buf, "{W({gR{Ge{wL{Gi{gC{W){x " );
    else if ( IS_SET(obj->quest,ITEM_EQUEST))
        strcat(buf,"{W({cPriceless{W){x " );
    else if( obj->points > 0 )
    {
	if( obj->points >= 8000 )
	     strcat(buf, "{M(Immortal){x " );
	else if ( obj->points >= 4000 )
	     strcat(buf, "{C(Mythical){x " );
	else if ( obj->points >= 2000 )
	     strcat(buf, "{Y(Legendary){x " );
    }
    if (IS_OBJ_STAT(obj, ITEM_INVIS)     )
             strcat( buf, "{W({DInvis{W){x " );
    if ( IS_AFFECTED(ch, AFF_DETECT_EVIL)
         && !IS_OBJ_STAT(obj, ITEM_ANTI_GOOD)
         && IS_OBJ_STAT(obj, ITEM_ANTI_EVIL)   )
        strcat( buf, "{W({bBlue Aura{W){n "  );
    else if ( IS_AFFECTED(ch, AFF_DETECT_EVIL)
         && IS_OBJ_STAT(obj, ITEM_ANTI_GOOD)
              && !IS_OBJ_STAT(obj, ITEM_ANTI_EVIL)   )
        strcat( buf, "{W({rRed Aura{W){n "  );
    else if ( IS_AFFECTED(ch, AFF_DETECT_EVIL)
         && IS_OBJ_STAT(obj, ITEM_ANTI_GOOD)
         && !IS_OBJ_STAT(obj, ITEM_ANTI_NEUTRAL)
              && IS_OBJ_STAT(obj, ITEM_ANTI_EVIL)   )
        strcat( buf, "{W({yYellow Aura{W){w "  );
    if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC)
         && IS_OBJ_STAT(obj, ITEM_MAGIC)  )   
		strcat( buf, "{W({bMag{W){x "   );
    if ( IS_VAMPIRE(ch) && IS_OBJ_STAT(obj, ITEM_CLOAKED) )
		strcat( buf, "{D(Cl){x " );
    if ( IS_OBJ_STAT(obj, ITEM_GLOW)      )   
		strcat( buf, "{W({YGlow{W){x "   );
    if ( IS_OBJ_STAT(obj, ITEM_HUM)       )   
		strcat( buf, "{W({bHum{W){x "   );
    if ( IS_OBJ_STAT(obj, ITEM_VANISH ) )
		strcat( buf, "{D(Illusion){x " );
    if ( IS_OBJ_STAT(obj, ITEM_SHADOWPLANE) &&
	 obj->in_room != NULL &&
	!IS_AFFECTED(ch,AFF_SHADOWPLANE) ) 
		   strcat( buf, "{W({DShadow{W){x " );
    if (!IS_OBJ_STAT(obj, ITEM_SHADOWPLANE) &&
	 obj->in_room != NULL &&
	 IS_AFFECTED(ch,AFF_SHADOWPLANE) )
		    strcat( buf, "{D({WNormal{D){x " );

    if ( fShort )
    {
	if ( obj->short_descr != NULL )
	{
	    strcat( buf, "{x" );	
	    strcat( buf, obj->short_descr );
	    if ( obj->condition < 20 )
                strcat(buf, " {r(Terrible)");
            else if( obj->condition < 40 )
                strcat(buf, " {r(Very bad)");
            else if( obj->condition < 60 )
                strcat(buf, " {r(Bad)" );
	    else if( obj->condition < 100 )
		strcat( buf, " {r(Notched)" );
	    strcat( buf, "{x" );
        }
    }
    else
    {
	if ( obj->description != NULL )
	    strcat( buf, obj->description );
    }

    return buf;
}

int char_hitroll( CHAR_DATA *ch )
{
    int hr = GET_HITROLL(ch);
    int hours;

    hr = ch->hitroll;
    hr += get_curr_str(ch)/2;
    hours = get_hours_played(ch);

    if( IS_NPC(ch) )
    {
	hr += ch->level * 3;
    }

    if (!IS_NPC(ch) && hours <= 4)
    {
        hr += 25;
    }

    if (!IS_NPC(ch) && hours >= 5)
    {
        hr += hours /2;

        if (IS_CLASS(ch,CLASS_VAMPIRE) && ch->pcdata->stats[UNI_RAGE] > 0)
            hr += ch->pcdata->stats[UNI_RAGE];
        {
            if (IS_CLASS(ch,CLASS_NINJA) && ch->pcdata->stats[UNI_RAGE] > 0)
                hr += ch->pcdata->stats[UNI_RAGE];
        }

	if( IS_CLASS(ch,CLASS_DEMON) && IS_POLYAFF(ch,POLY_ZULO) )
	{
	        if (ch->wpn[0] > 100)
	           hr *= (ch->wpn[0]);
		   hr /= 100;
        }
        else if (IS_POLYAFF(ch, POLY_ZULO))
            hr += 200;

        if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 6
            && ch->pcdata->powers[HARA_KIRI] > 0)
            hr += 100;
        {
            if (IS_SET(ch->special,SPC_WOLFMAN) && ch->pcdata->stats[UNI_RAGE] > 0)
                hr += ch->pcdata->stats[UNI_RAGE];
        }
        if (IS_CLASS( ch, CLASS_DEMON)) 
	{
		if( ch->pcdata->stats[DEMON_POWER] > 0)
	            hr += ((ch->pcdata->stats[DEMON_POWER]) 
			    * ch->pcdata->stats[DEMON_POWER]);
            if (IS_SET(ch->special,SPC_CHAMPION) 
		    && ch->pcdata->stats[DEMON_POWER] > 0)
                hr += ((ch->pcdata->stats[DEMON_POWER]) * ch->pcdata->stats[DEMON_POWER]);
        }

	if( IS_CLASS(ch,CLASS_DROW ) && IS_POLYAFF(ch,POLY_SPIDERFORM) )
	     hr += 750;
	if( IS_EXTRA(ch,EXTRA_DRAGON) && IS_VAMPIRE(ch))
	     hr *= 1.6;
	if( IS_ANGEL(ch) )
	{
	     if( IS_POLYAFF(ch, POLY_ANGELFORM) )
		hr += 500;

	     if( IS_POLYAFF(ch, POLY_ZULO) )
		hr *= 1.25;
	}
	if( IS_MONK(ch) && ch->wpn[0] > 300 )
		hr *= (ch->wpn[0] / 300) > 2 ? 2 : ch->wpn[0] / 300;
	if( IS_SET(ch->newbits, NEW_POWER ) )
		hr += 250;
    }
    return hr;
}

int char_damroll( CHAR_DATA *ch )
{
    int dr = GET_DAMROLL(ch);
    int hours;

    dr = ch->damroll;
    dr += get_curr_str(ch)/2;

    hours = get_hours_played(ch);

    if( IS_NPC(ch) )
	dr += ch->level * 3;
    if (!IS_NPC(ch) && hours <= 4)
    {
        dr += 25;
    }

    if (!IS_NPC(ch) && hours >= 5)
    {
        dr += hours / 2;

        if (IS_CLASS(ch,CLASS_VAMPIRE) && ch->pcdata->stats[UNI_RAGE] > 0)
            dr += ch->pcdata->stats[UNI_RAGE];
        else if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->stats[UNI_RAGE] > 0)
            dr += ch->pcdata->stats[UNI_RAGE];
        else if (IS_CLASS(ch, CLASS_PALADIN))
        {
            dr += 25;
        }
        else if (IS_SET(ch->special,SPC_WOLFMAN) && ch->pcdata->stats[UNI_RAGE] > 0)
            dr += ch->pcdata->stats[UNI_RAGE];
        else if (IS_CLASS( ch,CLASS_DEMON ) && ch->pcdata->stats[DEMON_POWER] > 0)
            dr += ((ch->pcdata->stats[DEMON_POWER]) *
                   ch->pcdata->stats[DEMON_POWER]);
        if (IS_SET(ch->special,SPC_CHAMPION) && ch->pcdata->stats[DEMON_POWER] > 0)
            dr += ((ch->pcdata->stats[DEMON_POWER]) * ch->pcdata->stats[DEMON_POWER]);

        if (!IS_NPC(ch))
            if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 6
                && ch->pcdata->powers[HARA_KIRI] > 0)
                dr += 50;
	if( IS_CLASS(ch,CLASS_DROW ) && IS_POLYAFF(ch,POLY_SPIDERFORM) )
	     dr += 750;

	if( IS_EXTRA(ch,EXTRA_DRAGON) && IS_VAMPIRE(ch))
	     dr *= 1.6;
	if( IS_ANGEL(ch) )
	{
	     if( IS_POLYAFF(ch, POLY_ANGELFORM) )
		dr += 500;

	     if( IS_POLYAFF(ch, POLY_ZULO) )
		dr *= 1.25;
	}
	else if (IS_POLYAFF(ch, POLY_ZULO))
        {
             if( IS_CLASS(ch,CLASS_DEMON) )
	     {
		if( ch->wpn[0] > 100 )
		{
		    dr *= ch->wpn[0];
		    dr /= 100;
		}
	     }
	     else
	        dr += 200;
	}
        if( IS_MONK(ch) && ch->wpn[0] > 300 )
                dr *= (ch->wpn[0] / 300) > 2 ? 2 : ch->wpn[0] / 300;	
	if( IS_SET(ch->newbits, NEW_POWER ) )
		dr += 250;

    }
    return dr;
}

int char_ac( CHAR_DATA *ch )
{
    int a_c = GET_AC(ch);

    a_c = ch->armor;

    if( IS_AWAKE(ch) )
	if( get_curr_dex(ch) < 25 )
		a_c += dex_app[get_curr_dex(ch)].defensive;
	else
		a_c -= (get_curr_dex(ch)*2.5);
   
    if (!IS_NPC(ch))
    {
	    if (IS_WEREWOLF(ch) && ch->gifts[CHILDRENOFGAIA] >= 1)
	    {
	        a_c +=  -100;
	    }
            if (IS_SET(ch->pcdata->powers[1], DPOWER_TOUGHSKIN))
		a_c +=  -400;
	    if( IS_CLASS(ch,CLASS_DEMON) && IS_POLYAFF(ch,POLY_ZULO) )
	    {
		if( ch->wpn[0] > 100 )
		  a_c -= ch->wpn[0] * 2;		
	    }
            if( IS_MONK(ch) && ch->wpn[0] > 300 )
                a_c -= (ch->wpn[0] / 300) > 2 ? 2 : ch->wpn[0] / 300;
    }
    return a_c;
}


char * format_char_to_char( CHAR_DATA *ch, CHAR_DATA *victim )
{
    static char buf[MAX_STRING_LENGTH];

    buf[0] = '\0';
    if (!IS_NPC(victim) && victim->desc==NULL )
        strcat( buf,"{y(LD)");
    if ( IS_AFFECTED(victim, AFF_INVISIBLE)   )
        strcat( buf, "{D(In)"   );
    if ( IS_AFFECTED(victim, AFF_HIDE)        )
        strcat( buf, "{D(Hi)"    );
    if ( IS_AFFECTED(victim, AFF_CHARM)       )
        strcat( buf, "{M(Cha)" );
    if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) strcat( buf, "{M(Fa)" );
    if ( IS_EVIL(victim)
         &&   IS_AFFECTED(ch, AFF_DETECT_EVIL)     ) strcat( buf, "{R(Ev)");
    if ( IS_AFFECTED(victim, AFF_SANCTUARY)   ) strcat( buf, "{W(Sa)");
    if ( IS_AFFECTED(victim, AFF_STEELSHIELD) ) strcat( buf, "{c(St)");
    strcat(buf, " {n" );

    if ( IS_AFFECTED(ch, AFF_SHADOWPLANE) && !IS_AFFECTED(victim, AFF_SHADOWPLANE))
	strcat( buf, "{W({xNP{W){x "     );
    else if ( !IS_AFFECTED(ch, AFF_SHADOWPLANE) && IS_AFFECTED(victim, AFF_SHADOWPLANE))
	strcat( buf, "{W({DSP{W){x "     );


    if( !IS_NPC( victim) && !IS_NPC(ch)
        && ch->level > 2 )
    {
        char buf2[ 256 ];
        int  cl = class_lookup(victim->class );
	if( cl > 0 )
        {
	sprintf( buf2, "%s[%c%s] {x",
                 class_table[cl].col,
                 ( victim->race == 0 ) ? ' ' :
                 ( victim->race <= ch->race ) ? '*' : '+',
                 class_table[cl].class_name );
        strcat( buf, buf2 );
	}
    }

     return buf;
}

char * format_char( char * buf, CHAR_DATA *victim, CHAR_DATA *ch )
{
    char buf2[MAX_STRING_LENGTH];
    char buf3[MAX_STRING_LENGTH];
    char buf4[MAX_STRING_LENGTH];
    char mount2[MAX_STRING_LENGTH];
    CHAR_DATA *mount;

    buf[0] = '\0';
    buf2[0] = '\0';
    buf3[0] = '\0';

    if (!IS_NPC(victim) && victim->pcdata->chobj != NULL )
	return buf;

    if ((mount = victim->mount) != NULL && IS_SET(victim->mounted, IS_MOUNT))
	return buf;

    if ( IS_HEAD(victim, LOST_HEAD) && IS_AFFECTED(victim, AFF_POLYMORPH))
        strcat( buf, "     " );
    else {
        strcat( buf, format_char_to_char( ch, victim ) );
    }

    if ( !IS_NPC(ch) && IS_VAMPAFF(ch,VAM_AUSPEX) && 
         !IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE) &&
	  IS_VAMPAFF(victim, VAM_DISGUISED) )
    {
	strcat( buf, "(");
	strcat( buf, victim->name);
	strcat( buf, ") ");
    }

    if ( IS_AFFECTED(victim, AFF_FLAMING) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->morph );
	else
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->name );
    }

    if ( !IS_NPC(victim)
         && IS_HEAD(victim, LOST_HEAD)
         && IS_AFFECTED(victim, AFF_POLYMORPH))
    {
	if (IS_EXTRA(victim,GAGGED) && IS_EXTRA(victim,BLINDFOLDED))
            sprintf( buf3, "{c...%s is gagged and blindfolded!", victim->morph );
	else if (IS_EXTRA(victim,GAGGED))
            sprintf( buf3, "{g...%s is gagged!", victim->morph );
	else if (IS_EXTRA(victim,BLINDFOLDED))
            sprintf( buf3, "{G...%s is blindfolded!", victim->morph );
    }

    if ( IS_HEAD(victim, LOST_HEAD) && IS_AFFECTED(victim, AFF_POLYMORPH))
    {
	strcat( buf, victim->morph );
	strcat( buf, " is lying here." );
        strcat( buf, buf2 );
        strcat( buf, buf3 );
        strcat( buf, "\n\r" );
	return buf;
    }

    
    if ( IS_EXTRA(victim, TIED_UP) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf3, "\n\r{C...%s is tied up", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf3, "\n\r{C...%s is tied up", victim->morph );
	else
            sprintf( buf3, "\n\r{C...%s is tied up", victim->name );
	if (IS_EXTRA(victim,GAGGED) && IS_EXTRA(victim,BLINDFOLDED))
	    strcat( buf3, ", gagged and blindfolded!" );
	else if (IS_EXTRA(victim,GAGGED))
	    strcat( buf3, " and gagged!" );
	else if (IS_EXTRA(victim,BLINDFOLDED))
	    strcat( buf3, " and blindfolded!" );
	else
	    strcat( buf3, "!" );
    }

    if ( IS_AFFECTED(victim, AFF_WEBBED) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->morph );
	else
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->name );
	strcat( buf3, buf4 );
    }

    if ( IS_SET(victim->mflags, MAGE_EMBRACED2)
	|| IS_SET(victim->mflags, MAGE_EMBRACED1) )
    {
        if ( IS_NPC(victim))
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->short_descr);
	else if ( !IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->morph);
	else
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->name);
        strcat( buf3, buf4 );
    }


    if ( victim->position == POS_STANDING
         && victim->long_descr[0] != '\0'
         && strlen( victim->long_descr ) > 3
         && !(mount = victim->mount)
         && victim->stance[0] < 1 )
    {
	strcpy( buf4, victim->long_descr);
	buf4[strlen(buf4)-2] = '\0';
        strcat( buf, buf4 ); 
        strcat( buf, buf2 );
        strcat( buf, buf3 );
	strcat( buf, "\n\r" );

        if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF) )
            return buf;

        buf2[0] = '\0';
        buf3[0] = '\0';
        buf4[0] = '\0';
        
        if ( IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF) )
        {
            if ( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD)
                 || IS_ITEMAFF(victim, ITEMA_FIRESHIELD)
                 || IS_ITEMAFF(victim, ITEMA_ICESHIELD)
                 || IS_ITEMAFF(victim, ITEMA_ACIDSHIELD)
                 || IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
            {
                sprintf( buf3, "{n....%s is surrounded by ",
                       PERS( victim, ch ) );
                if ( IS_ITEMAFF(victim, ITEMA_FIRESHIELD) )
                    strcat( buf3, "{r(fire)");
                if ( IS_ITEMAFF(victim, ITEMA_ICESHIELD) )
                    strcat( buf3, "{C(ice)");
                if ( IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) )
                    strcat( buf3,"{g(acid)" );
                if( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) )
                    strcat( buf3, "{W(lightning)" );
                if ( IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
                    strcat( buf3, "{m(chaos)" );
                if ( IS_ITEMAFF(victim, ITEMA_REFLECT) )
                    strcat( buf3, "{D(dark){x" );
                if( IS_ITEMAFF(victim, ITEMA_SUNSHIELD ) )
                    strcat( buf3, "{Y(sun){x" );
                strcat( buf3, "{n.\n\r" );
                strcat( buf, buf3 );
            }
            if ( IS_ITEMAFF(victim, ITEMA_ANGHALO) )
            {
                sprintf( buf3, "{n....%s has a halo surrounding %s head.",
                         PERS( victim, ch ), HIS_HER( victim ) );
                strcat( buf, buf3 );
            }
	}
	return buf;
    }
    else if ( !IS_NPC(victim) && IS_AFFECTED(victim, AFF_POLYMORPH) )
	strcat( buf, victim->morph );
    else
    	strcat( buf, PERS( victim, ch ) );

    if ((mount = victim->mount) != NULL && victim->mounted == IS_RIDING)
    {
	if (IS_NPC(mount))
	    sprintf( mount2, " is here riding %s", mount->short_descr );
	else
	    sprintf( mount2, " is here riding %s", mount->name );
	strcat( buf, mount2 );
	if (victim->position == POS_FIGHTING)
	{
	    strcat( buf, ", fighting " );
	    if ( victim->fighting == NULL )
	        strcat( buf, "thin air??" );
	    else if ( victim->fighting == ch )
	    strcat( buf, "YOU!" );
	    else if ( victim->in_room == victim->fighting->in_room )
	    {
	        strcat( buf, PERS( victim->fighting, ch ) );
	        strcat( buf, "." );
	    }
	    else
	        strcat( buf, "somone who left??" );
	}
	else strcat( buf, "." );
    }
    else if ( victim->position == POS_STANDING && IS_AFFECTED(victim, AFF_FLYING) )
	strcat( buf, " is hovering here" );
    else if ( victim->position == POS_STANDING && (!IS_NPC(victim) && (IS_VAMPAFF(victim, VAM_FLYING))) )
	strcat( buf, " is hovering here" );
    else if (victim->position == POS_STANDING
             && (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW)
                 && IS_SET(victim->pcdata->powers[1], DPOWER_LEVITATION)))
        strcat(buf, " is hovering here" );
    else
    {
        switch ( victim->position )
        {
        case POS_DEAD:     strcat( buf, " is DEAD!!" );              break;
        case POS_MORTAL:
	    if (IS_VAMPIRE(victim))
		strcat( buf, " is lying here torpored." );
	    else
		strcat( buf, " is lying here mortally wounded." );
            break;
        case POS_INCAP:    strcat( buf, " is lying here incapacitated." );      break;
    	case POS_STUNNED:  strcat( buf, " is lying here stunned." ); break;
        case POS_SLEEPING: strcat( buf, " is sleeping here." );      break;
        case POS_RESTING:  strcat( buf, " is resting here." );       break;
        case POS_MEDITATING: strcat( buf, " is meditating here." );  break;
        case POS_SITTING:  strcat( buf, " is sitting here." );       break;
        case POS_STANDING:
            if      (!IS_NPC(victim) && victim->stance[0] == STANCE_NORMAL)
                strcat( buf, " is here, crouched in a fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_VIPER)
                strcat( buf, " is here, crouched in a viper fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_CRANE)
                strcat( buf, " is here, crouched in a crane fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_CRAB)
                strcat( buf, " is here, crouched in a crab fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MONGOOSE)
                strcat( buf, " is here, crouched in a mongoose fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_BULL)
                strcat( buf, " is here, crouched in a bull fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MANTIS)
                strcat( buf, " is here, crouched in a mantis fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_DRAGON)
                strcat( buf, " is here, crouched in a dragon fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_TIGER)
                strcat( buf, " is here, crouched in a tiger fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MONKEY)
                strcat( buf, " is here, crouched in a monkey fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_SWALLOW)
                strcat( buf, " is here, crouched in a swallow fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_RABBIT	)
                strcat( buf, " is here, crouched in a rabbit fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_COBRA	)
                strcat( buf, " is here, crouched in a cobra fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_BEAR	)
                strcat( buf, " is here, crouched in a bear fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_COUGAR	)
                strcat( buf, " is here, crouched in a cougar fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_EAGLE	)
                strcat( buf, " is here, crouched in a eagle fighting stance."	);
            else
                strcat( buf, " is here." );
            break;
        case POS_FIGHTING:
            strcat( buf, " is here, fighting " );
            if ( victim->fighting == NULL )
	        strcat( buf, "thin air??" );
	    else if ( victim->fighting == ch )
	    strcat( buf, "YOU!" );
	    else if ( victim->in_room == victim->fighting->in_room )
	    {
	        strcat( buf, PERS( victim->fighting, ch ) );
	        strcat( buf, "." );
	    }
	    else
	        strcat( buf, "somone who left??" );
	    break;
	}
    }

    if (buf2[0] != '\0')
        strcat( buf, "\n\r" );
    strcat( buf, buf2 );
    strcat( buf, buf3 );
    strcat( buf, "{x\n\r" );

    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF) ) return buf;

    if ( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD)
         || IS_ITEMAFF(victim, ITEMA_FIRESHIELD)
         || IS_ITEMAFF(victim, ITEMA_ICESHIELD)
         || IS_ITEMAFF(victim, ITEMA_ACIDSHIELD)
         || IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
    {
        sprintf( buf3, "{n....%s is surrounded by ",
                 PERS( victim, ch ) );
        if ( IS_ITEMAFF(victim, ITEMA_FIRESHIELD) )
            strcat( buf3, "{r(fire)");
        if ( IS_ITEMAFF(victim, ITEMA_ICESHIELD) )
            strcat( buf3, "{C(ice)");
        if ( IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) )
            strcat( buf3,"{g(acid)" );
        if( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) )
            strcat( buf3, "{W(lightning)" );
        if ( IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
            strcat( buf3, "{m(chaos)" );
        if ( IS_ITEMAFF(victim, ITEMA_REFLECT) )
            strcat( buf3, "{D(dark)" );
        if( IS_ITEMAFF(victim, ITEMA_SUNSHIELD ) )
            strcat( buf3, "{Y(sun)" );
        strcat( buf3, "{n.\n\r" );
        strcat( buf, buf3 );
    }
    if ( IS_ITEMAFF(victim, ITEMA_ANGHALO) )
    {
        sprintf( buf3, "{W....%s has a halo surrounding %s head.",
                 PERS( victim, ch ), HIS_HER( victim ) );
        strcat( buf, buf3 );
    }
    
    return buf;
}

/*
 * Show amob list to a character - Hack of show_list_to_char
 */
void show_mlist_to_char( CHAR_DATA *list, CHAR_DATA *ch )
{
    CHAR_DATA *vch;
    char * pStr;
    char buf [ MAX_STRING_LENGTH ];
    bool fCombine;
    int  count;
    int  nShow,iShow;
    char **prgpstrShow;
    int *prgnShow;


    if( ch->desc == NULL )
        return;

    fCombine = TRUE;
    count = 0;

    if( !list )
	return;
    /*
     * Alloc space for output lines.
     */
    for ( vch = list; vch; vch = vch->next_in_room )
        if( IS_NPC(vch) )
            count++;

    prgpstrShow	= alloc_mem( count * sizeof(char *) );
    prgnShow    = alloc_mem( count * sizeof(int)    );
    nShow = 0;

    /*
     * Format the list of mobs
     */
    for ( vch = list; vch; vch = vch->next_in_room )
    {
        if( !IS_NPC(vch ) )
            continue;

        if( !IS_IMMORTAL(ch) && !can_see( ch,vch ) )
            continue;
        
        if( STR(vch,long_descr) && (pStr = format_char( buf, vch, ch)) )
        {
            fCombine = FALSE;

            if( IS_NPC(ch ) || IS_SET(ch->act, PLR_COMBINE) )
            {
		/*
		 * Look for duplicates, case sensitive.
		 */
		for ( iShow = nShow - 1; iShow >= 0; iShow-- )
                {
                    if( !str_cmp( prgpstrShow[iShow], pStr ) )
                    {
		        prgnShow[iShow]++;
                        fCombine = TRUE;
                    }
                }
            }

	    /*
	     * Couldn't combine, or didn't want to.
	     */
	    if ( !fCombine )
	    {
		prgpstrShow [nShow] = str_dup( pStr );
		prgnShow    [nShow] = 1;
 		nShow++;
            }
        }
    }

    /*
     * Output the formatted list.
     */
    for ( iShow = 0; iShow < nShow; iShow++ )
    {
	if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
        {
	    if ( prgnShow[iShow] != 1 )
            {
                ch_printf( ch, "(%2d) ", prgnShow[iShow]);
	    }
	    else
            {
                send_to_char( "    ", ch );
            }
	}
	else
                send_to_char( "    ", ch );
        ch_printf( ch, "%s", 
		prgpstrShow[iShow]);

        free_string( prgpstrShow[iShow] );
    }

    /*
     * Gotta free it
     */
    free_mem( prgpstrShow, count * sizeof(char *) );
    free_mem( prgnShow,    count * sizeof(int)    );
    return;
}

/*
 * Show a list to a character.
 * Can coalesce duplicated items.
 */
void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, bool fShort, bool fShowNothing )
{
    char buf[MAX_STRING_LENGTH];
    char **prgpstrShow;
    int *prgnShow;
    char *pstrShow;
    OBJ_DATA *obj;
    int nShow;
    int iShow;
    int count;
    bool fCombine;

    if ( ch->desc == NULL )
	return;

    /*
     * if theres no list... then don't do all this crap! -Dreimas
     */
    if( !list )
    {
    	if ( fShowNothing )
    	{
	   if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
	      send_to_char( "     ", ch );
	   send_to_char( "Nothing.\n\r", ch );
	}
	return;
    }

    /*
     * Alloc space for output lines.
     */
    count = 0;
    for ( obj = list; obj != NULL; obj = obj->next_content )
	count++;
    prgpstrShow	= alloc_mem( count * sizeof(char *) );
    prgnShow    = alloc_mem( count * sizeof(int)    );
    nShow	= 0;

    /*
     * Format the list of objects.
     */
    for ( obj = list; obj != NULL; obj = obj->next_content )
    { 
	if (!IS_NPC(ch) 
	  && ch->pcdata->chobj != NULL 
          && obj->chobj != NULL 
          && obj->chobj == ch )
	    continue;
	if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
	{
	    pstrShow = format_obj_to_char( obj, ch, fShort );
	    fCombine = FALSE;

	    if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
	    {
		/*
		 * Look for duplicates, case sensitive.
		 * Matches tend to be near end so run loop backwords.
		 */
		for ( iShow = nShow - 1; iShow >= 0; iShow-- )
		{
		    if ( !strcmp( prgpstrShow[iShow], pstrShow ) )
		    {
			prgnShow[iShow]++;
			fCombine = TRUE;
			break;
		    }
		}
	    }

	    /*
	     * Couldn't combine, or didn't want to.
	     */
	    if ( !fCombine )
	    {
		prgpstrShow [nShow] = str_dup( pstrShow );
		prgnShow    [nShow] = 1;
		nShow++;
	    }
	}
    }

    /*
     * Output the formatted list.
     */
    for ( iShow = 0; iShow < nShow; iShow++ )
    {
	if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
	{
	    if ( prgnShow[iShow] != 1 
		&& prgpstrShow[ iShow ][ 0 ] != '\0' )
	    {
                sprintf( buf, "(%2d) ", prgnShow[iShow] );
		send_to_char( buf, ch );
	    }
	    else
	    {
	        if( prgpstrShow[ iShow ][ 0 ] != '\0' )
			send_to_char( "     ", ch );
	    }
	}
	send_to_char( prgpstrShow[iShow], ch );
        /*
         * The if only adds a line feed if the object->description
         * is actually there.. now hit hides stuff so people have
         * to figure things out.
         */
        if( prgpstrShow[ iShow ][ 0 ] != '\0' )
		send_to_char( "\n\r", ch );
	free_string( prgpstrShow[iShow] );
    }

    if ( fShowNothing && nShow == 0 )
    {
	if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
	    send_to_char( "     ", ch );
	send_to_char( "Nothing.\n\r", ch );
    }

    /*
     * Clean up.
     */
    free_mem( prgpstrShow, count * sizeof(char *) );
    free_mem( prgnShow,    count * sizeof(int)    );

    return;
}

    
void  show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch )
{
    static char buf[MAX_STRING_LENGTH];
    char buf2[MAX_STRING_LENGTH];
    char buf3[MAX_STRING_LENGTH];
    char buf4[MAX_STRING_LENGTH];
    char mount2[MAX_STRING_LENGTH];
    CHAR_DATA *mount;

    buf[0] = '\0';
    buf2[0] = '\0';
    buf3[0] = '\0';

    if (!IS_NPC(victim) && victim->pcdata->chobj != NULL )
	return;

    if( ch == victim )
	return;

    if ((mount = victim->mount) != NULL && IS_SET(victim->mounted, IS_MOUNT))
	return;

    if ( IS_HEAD(victim, LOST_HEAD) && IS_AFFECTED(victim, AFF_POLYMORPH))
	    strcat( buf, "     " );
    else
	strcat( buf, format_char_to_char( ch, victim ) );

    if ( !IS_NPC(ch) && IS_VAMPAFF(ch,VAM_AUSPEX) && 
         !IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE) &&
	  IS_VAMPAFF(victim, VAM_DISGUISED) )
    {
	strcat( buf, "(");
	strcat( buf, PERS(victim,ch));
	strcat( buf, ") ");
    }

    if ( IS_AFFECTED(victim, AFF_FLAMING) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->morph );
	else
            sprintf( buf2, "\n\r{R...%s is engulfed in blazing flames!", victim->name );
    }

    if ( !IS_NPC(victim)
         && IS_HEAD(victim, LOST_HEAD)
         && IS_AFFECTED(victim, AFF_POLYMORPH))
    {
	if (IS_EXTRA(victim,GAGGED) && IS_EXTRA(victim,BLINDFOLDED))
            sprintf( buf3, "{c...%s is gagged and blindfolded!", victim->morph );
	else if (IS_EXTRA(victim,GAGGED))
            sprintf( buf3, "{g...%s is gagged!", victim->morph );
	else if (IS_EXTRA(victim,BLINDFOLDED))
            sprintf( buf3, "{G...%s is blindfolded!", victim->morph );
    }

    if ( IS_HEAD(victim, LOST_HEAD) && IS_AFFECTED(victim, AFF_POLYMORPH))
    {
	strcat( buf, victim->morph );
	strcat( buf, " is lying here." );
        strcat( buf, buf2 );
        strcat( buf, buf3 );
        strcat( buf, "\n\r" );
    	send_to_char( buf, ch );
	return;
    }

    
    if ( IS_EXTRA(victim, TIED_UP) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf3, "\n\r{C...%s is tied up", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf3, "\n\r{C...%s is tied up", victim->morph );
	else
            sprintf( buf3, "\n\r{C...%s is tied up", victim->name );
	if (IS_EXTRA(victim,GAGGED) && IS_EXTRA(victim,BLINDFOLDED))
	    strcat( buf3, ", gagged and blindfolded!" );
	else if (IS_EXTRA(victim,GAGGED))
	    strcat( buf3, " and gagged!" );
	else if (IS_EXTRA(victim,BLINDFOLDED))
	    strcat( buf3, " and blindfolded!" );
	else
	    strcat( buf3, "!" );
    }

    if ( IS_AFFECTED(victim, AFF_WEBBED) ) 
    {
	if (IS_NPC(victim))
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->short_descr );
	else if (!IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->morph );
	else
            sprintf( buf4, "\n\r{y...%s is coated in a sticky web.", victim->name );
	strcat( buf3, buf4 );
    }

    if ( IS_SET(victim->mflags, MAGE_EMBRACED2)
	|| IS_SET(victim->mflags, MAGE_EMBRACED1) )
    {
        if ( IS_NPC(victim))
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->short_descr);
	else if ( !IS_NPC(victim) && IS_AFFECTED(victim,AFF_POLYMORPH))
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->morph);
	else
            sprintf( buf4, "\n\r{y...%s is surrounded by earth.",victim->name);
        strcat( buf3, buf4 );
    }


    if ( victim->position == POS_STANDING
         && victim->long_descr[0] != '\0'
         && strlen( victim->long_descr ) > 3
         && !(mount = victim->mount)
         && victim->stance[0] < 1 )
    {
	strcpy( buf4, victim->long_descr);
	buf4[strlen(buf4)-2] = '\0';
        strcat( buf, buf4 );
        strcat( buf, buf2 );
        strcat( buf, buf3 );
	strcat( buf, "\n\r" );
	stc( buf, ch );

        if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF) )
		return;

        buf2[0] = '\0';
        buf3[0] = '\0';
        buf4[0] = '\0';
        
        if ( IS_NPC(ch) || !IS_SET(ch->act, PLR_BRIEF) )
        {
            if ( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD)
                 || IS_ITEMAFF(victim, ITEMA_FIRESHIELD)
                 || IS_ITEMAFF(victim, ITEMA_ICESHIELD)
                 || IS_ITEMAFF(victim, ITEMA_ACIDSHIELD)
                 || IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
            {
                sprintf( buf3, "{n....%s is surrounded by ",
                       PERS( victim, ch ) );
                if ( IS_ITEMAFF(victim, ITEMA_FIRESHIELD) )
                    strcat( buf3, "{r(fire)");
                if ( IS_ITEMAFF(victim, ITEMA_ICESHIELD) )
                    strcat( buf3, "{C(ice)");
                if ( IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) )
                    strcat( buf3,"{g(acid)" );
                if( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) )
                    strcat( buf3, "{W(lightning)" );
                if ( IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
                    strcat( buf3, "{m(chaos)" );
                if ( IS_ITEMAFF(victim, ITEMA_REFLECT) )
                    strcat( buf3, "{D(dark){x" );
                if( IS_ITEMAFF(victim, ITEMA_SUNSHIELD ) )
                    strcat( buf3, "{Y(sun){x" );
                strcat( buf3, "{n.\n\r" );
                strcat( buf, buf3 );
            }
            if ( IS_ITEMAFF(victim, ITEMA_ANGHALO) )
            {
                sprintf( buf3, "{n....%s has a halo surrounding %s head.",
                         PERS( victim, ch ), HIS_HER( victim ) );
                strcat( buf, buf3 );
            }
	    stc( buf, ch );
	}
	return;
    }
    else if ( !IS_NPC(victim) && IS_AFFECTED(victim, AFF_POLYMORPH) )
	strcat( buf, victim->morph );
    else
    	strcat( buf, PERS( victim, ch ) );

    if ((mount = victim->mount) != NULL && victim->mounted == IS_RIDING)
    {
	if (IS_NPC(mount))
	    sprintf( mount2, " is here riding %s", mount->short_descr );
	else
	    sprintf( mount2, " is here riding %s", mount->name );
	strcat( buf, mount2 );
	if (victim->position == POS_FIGHTING)
	{
	    strcat( buf, ", fighting " );
	    if ( victim->fighting == NULL )
	        strcat( buf, "thin air??" );
	    else if ( victim->fighting == ch )
	    strcat( buf, "YOU!" );
	    else if ( victim->in_room == victim->fighting->in_room )
	    {
	        strcat( buf, PERS( victim->fighting, ch ) );
	        strcat( buf, "." );
	    }
	    else
	        strcat( buf, "somone who left??" );
	}
	else strcat( buf, "." );
    }
    else if ( victim->position == POS_STANDING && IS_AFFECTED(victim, AFF_FLYING) )
	strcat( buf, " is hovering here" );
    else if ( victim->position == POS_STANDING && (!IS_NPC(victim) && (IS_VAMPAFF(victim, VAM_FLYING))) )
	strcat( buf, " is hovering here" );
    else if (victim->position == POS_STANDING
             && (!IS_NPC(victim) && IS_CLASS(victim, CLASS_DROW)
                 && IS_SET(victim->pcdata->powers[1], DPOWER_LEVITATION)))
        strcat(buf, " is hovering here" );
    else
    {
        switch ( victim->position )
        {
        case POS_DEAD:     strcat( buf, " is DEAD!!" );              break;
        case POS_MORTAL:
	    if (IS_VAMPIRE(victim))
		strcat( buf, " is lying here torpored." );
	    else
		strcat( buf, " is lying here mortally wounded." );
            break;
        case POS_INCAP:    strcat( buf, " is lying here incapacitated." );      break;
    	case POS_STUNNED:  strcat( buf, " is lying here stunned." ); break;
        case POS_SLEEPING: strcat( buf, " is sleeping here." );      break;
        case POS_RESTING:  strcat( buf, " is resting here." );       break;
        case POS_MEDITATING: strcat( buf, " is meditating here." );  break;
        case POS_SITTING:  strcat( buf, " is sitting here." );       break;
        case POS_STANDING:
            if      (!IS_NPC(victim) && victim->stance[0] == STANCE_NORMAL)
                strcat( buf, " is here, crouched in a fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_VIPER)
                strcat( buf, " is here, crouched in a viper fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_CRANE)
                strcat( buf, " is here, crouched in a crane fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_CRAB)
                strcat( buf, " is here, crouched in a crab fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MONGOOSE)
                strcat( buf, " is here, crouched in a mongoose fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_BULL)
                strcat( buf, " is here, crouched in a bull fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MANTIS)
                strcat( buf, " is here, crouched in a mantis fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_DRAGON)
                strcat( buf, " is here, crouched in a dragon fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_TIGER)
                strcat( buf, " is here, crouched in a tiger fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_MONKEY)
                strcat( buf, " is here, crouched in a monkey fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_SWALLOW)
                strcat( buf, " is here, crouched in a swallow fighting stance." );
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_RABBIT	)
                strcat( buf, " is here, crouched in a rabbit fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_COBRA	)
                strcat( buf, " is here, crouched in a cobra fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_BEAR	)
                strcat( buf, " is here, crouched in a bear fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_COUGAR	)
                strcat( buf, " is here, crouched in a cougar fighting stance."	);
            else if (!IS_NPC(victim) && victim->stance[0] == STANCE_EAGLE	)
                strcat( buf, " is here, crouched in a eagle fighting stance."	);
            else
                strcat( buf, " is here." );
            break;
        case POS_FIGHTING:
            strcat( buf, " is here, fighting " );
            if ( victim->fighting == NULL )
	        strcat( buf, "thin air??" );
	    else if ( victim->fighting == ch )
	    strcat( buf, "YOU!" );
	    else if ( victim->in_room == victim->fighting->in_room )
	    {
	        strcat( buf, PERS( victim->fighting, ch ) );
	        strcat( buf, "." );
	    }
	    else
	        strcat( buf, "somone who left??" );
	    break;
	}
    }

    if (buf2[0] != '\0')
        strcat( buf, "\n\r" );
    strcat( buf, buf2 );
    strcat( buf, buf3 );
    strcat( buf, "{x\n\r" );

    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_BRIEF) ) 
    {
        stc( buf, ch );
	return;
    }

    if ( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD)
         || IS_ITEMAFF(victim, ITEMA_FIRESHIELD)
         || IS_ITEMAFF(victim, ITEMA_ICESHIELD)
         || IS_ITEMAFF(victim, ITEMA_ACIDSHIELD)
         || IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
    {
        sprintf( buf3, "{n....%s is surrounded by ",
                 PERS( victim, ch ) );
        if ( IS_ITEMAFF(victim, ITEMA_FIRESHIELD) )
            strcat( buf3, "{r(fire)");
        if ( IS_ITEMAFF(victim, ITEMA_ICESHIELD) )
            strcat( buf3, "{C(ice)");
        if ( IS_ITEMAFF(victim, ITEMA_ACIDSHIELD) )
            strcat( buf3,"{g(acid)" );
        if( IS_ITEMAFF(victim, ITEMA_SHOCKSHIELD) )
            strcat( buf3, "{W(lightning)" );
        if ( IS_ITEMAFF(victim, ITEMA_CHAOSSHIELD) )
            strcat( buf3, "{m(chaos)" );
        if ( IS_ITEMAFF(victim, ITEMA_REFLECT) )
            strcat( buf3, "{D(dark)" );
        if( IS_ITEMAFF(victim, ITEMA_SUNSHIELD ) )
            strcat( buf3, "{Y(sun)" );
        strcat( buf3, "{n.\n\r" );
        strcat( buf, buf3 );
    }
    if ( IS_ITEMAFF(victim, ITEMA_ANGHALO) )
    {
        sprintf( buf3, "{W....%s has a halo surrounding %s head.",
                 PERS( victim, ch ), HIS_HER( victim ) );
        strcat( buf, buf3 );
    }
    stc( buf, ch);
    return;
}



void evil_eye( CHAR_DATA *victim, CHAR_DATA *ch )
{
    char buf [MAX_STRING_LENGTH];
    int tabletype;
 
    return;

    if (IS_NPC(victim)) return;
    if (victim == ch) return;
    if (ch->level != 3 || victim->level != 3) return;
    if (!IS_VAMPAFF(victim, VAM_DOMINATE)) return;
    if (victim->powertype != NULL && strlen(victim->powertype) > 1)
    {
	sprintf(buf,"\n\r%s\n\r",victim->powertype);
	send_to_char(buf,ch);
    }
    if (IS_SET(victim->spectype,EYE_SELFACTION) && victim->poweraction != NULL)
	interpret(victim,victim->poweraction);
    if (IS_SET(victim->spectype,EYE_ACTION) && victim->poweraction != NULL)
	interpret(ch,victim->poweraction);
    if (IS_SET(victim->spectype,EYE_SPELL) && victim->specpower > 0)
    {
	tabletype = skill_table[victim->specpower].target;
	(*skill_table[victim->specpower].spell_fun) (victim->specpower,victim->spl[tabletype],victim,ch);
    }
    return;
}


void show_equipment(CHAR_DATA *victim, CHAR_DATA *ch)
{
    OBJ_DATA *obj;
    bool found;
    int cnt;
    
    found = FALSE;
    for ( cnt = 0; cnt < MAX_WEAR; cnt++ )
    {
	if ( ( obj = get_eq_char( victim, where_name[cnt].place ) )
	&&   can_see_obj( ch, obj ) )
	{
	    if( ch != victim 
	     && IS_OBJ_STAT(obj, ITEM_CLOAKED)
	     && !IS_VAMPIRE(ch) 
	     && !IS_IMMORTAL(ch))
		continue;

	    if ( !found )
	    {
		send_to_char( "\n\r", ch );
		act( "$N is using:", ch, NULL, victim, TO_CHAR );
		found = TRUE;
	    }
	    send_to_char( where_name[cnt].name, ch );
	    if ( IS_NPC(ch) 
		|| ch->pcdata->chobj == NULL 
                || ch->pcdata->chobj != obj)
	    {
	    	send_to_char( format_obj_to_char( obj, ch, TRUE ), ch );
	    	send_to_char( "\n\r", ch );
	    }
	    else
		send_to_char( "you\n\r", ch);
	}
    }
    return;
}    

void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    char final[MAX_STRING_LENGTH];

    if ( IS_ITEMAFF(ch,ITEMA_VISION) || can_see( victim, ch ) )
    {
	act( "$n looks at you.", ch, NULL, victim, TO_VICT    );
        if( ch != victim )
            act( "$n looks at $N.",  ch, NULL, victim, TO_NOTVICT );
        else
            act( "$n looks $mself over.", ch, NULL, victim, TO_NOTVICT);
    }

    if (!IS_NPC(ch) && IS_HEAD(victim,LOST_HEAD))
    {
	act( "$N is lying here.", ch, NULL, victim, TO_CHAR );
	return;
    }

    if( victim->description[0] != '\0' )
    {
        send_to_char( "{n    ", ch );
        send_to_char( victim->description, ch );
    }

    final[0] = '\0';

    if (!IS_NPC( victim ))
    {
        sprintf(buf,"%s, is a ",capitalize(victim->name) );
        if( get_curr_con(victim) >= 100 ) strcat(buf,"collassal");
        else if( get_curr_con(victim) >= 80) strcat(buf,"mountainous");
        else if( get_curr_con(victim) >= 70) strcat(buf,"sizeable");
        else if( get_curr_con(victim) >= 60) strcat(buf,"massive");
        else if( get_curr_con(victim) >= 50) strcat(buf,"large");
        else if( get_curr_con(victim) >= 30) strcat(buf,"average sized");
        else if( get_curr_con(victim) >= 20) strcat(buf,"petite");
        else strcat(buf,"infinitesimal");
        strcat(buf,", ");

        if( get_curr_str(victim) >= 100 ) strcat(buf,"hardy");
        else if( get_curr_str(victim) >= 80 ) strcat(buf,"stalwart");
        else if( get_curr_str(victim) >= 70 ) strcat(buf,"stout");
        else if( get_curr_str(victim) >= 60 ) strcat(buf,"sturdy");
        else if( get_curr_str(victim) >= 50 ) strcat(buf,"tough");
        else if( get_curr_str(victim) >= 30 ) strcat(buf,"solid");
        else if( get_curr_str(victim) >= 20 ) strcat(buf,"scrawny");
        else strcat(buf,"pathetic");
        strcat(final,buf);

        sprintf( buf, " %s.", MAL_FEM(victim) );
        strcat( final, buf );

        sprintf(buf,"%s moves with ", HE_SHE(victim));
        if( get_curr_dex(victim) >= 100 ) strcat(buf,"prowness");
        else if( get_curr_dex(victim) >= 80 ) strcat(buf,"cleverness");
        else if( get_curr_dex(victim) >= 70 ) strcat(buf,"deftness");
        else if( get_curr_dex(victim) >= 60 ) strcat(buf,"nimbleness");
        else if( get_curr_dex(victim) >= 50 ) strcat(buf,"readiness");
        else if( get_curr_dex(victim) >= 30 ) strcat(buf,"catlike qualities");
        else if( get_curr_dex(victim) >= 20 ) strcat(buf,"slowness");
        else strcat(buf,"sluggish");

        strcat(final,buf);
        sprintf(buf," and appears to be ");
        if( get_curr_int(victim) >= 100 ) strcat(buf,"brilliant");
        else if( get_curr_int(victim) >= 80 ) strcat(buf,"intellectual");
        else if( get_curr_int(victim) >= 70 ) strcat(buf,"all knowing");
        else if( get_curr_int(victim) >= 60 ) strcat(buf,"knowledgeable");
        else if( get_curr_int(victim) >= 50 ) strcat(buf,"logical");
        else if( get_curr_int(victim) >= 30 ) strcat(buf,"compitent");
        else if( get_curr_int(victim) >= 20 ) strcat(buf,"dull");
        else strcat(buf,"utterly moronic");

        strcat(buf, " and ");
        if( get_curr_wis(victim) >= 100 ) strcat(buf,"discerning");
        else if( get_curr_wis(victim) >= 80 ) strcat(buf,"sagacious");
        else if( get_curr_wis(victim) >= 70 ) strcat(buf,"impudent");
        else if( get_curr_wis(victim) >= 60 ) strcat(buf,"shrewd");
        else if( get_curr_wis(victim) >= 50 ) strcat(buf,"insightful");
        else if( get_curr_wis(victim) >= 30 ) strcat(buf,"thoughtless");
        else if( get_curr_wis(victim) >= 20 ) strcat(buf,"inattentive");
        else strcat(buf,"thick-skinned");

        strcat( buf, ".");
        strcat( final, buf );

        {
            int age = PERCENTAGE(get_hours_played(victim), 500 );
            sprintf( buf, "%s is a%s %s.\n\r",
                     capitalize(victim->name),
                     age < 30 ? " young" :
                     age < 40 ? " matured" :
                     age < 60 ? " middle-aged" :
                     age < 80 ? "n aging" :
                     age < 90 ? "n elderly" : "n ancient",
                     class_name( victim->class) );
            strcat(final,buf);
        }

        if( final[0] != '\0' && final[0] != '.' )
        {
            char *p;
            p = format_string( str_dup(final) );
            send_to_char( "    ", ch );
            send_to_char( p , ch);
            free_string(p);
        }

        final[0] = '\0';
        if (IS_SET(victim->newbits, NEW_OBEAH))
        {
            sprintf( buf, " %s has a%s eye in the centre of %s forehead.",
                     PERS(victim,ch),
                     (victim->obeah_timer == 0) ? "" : "n brigthly glowing",
                     HIS_HER(ch) );
            strcat( final, buf );
        }

        if (IS_VAMPAFF(victim, VAM_NIGHTSIGHT))
        {
            if (IS_AFFECTED(victim, AFF_SHADOWSIGHT))
            {
                if (IS_CLASS(victim, CLASS_WEREWOLF))
                    sprintf( buf,
                             " %s eyes are glowing a lambent green and are surrounded in shadow.",
                             HIS_HER(victim) );
                else
                    sprintf( buf,
                             " %s eyes are glowing bright red and are surrounded in shadow.",
                             HIS_HER(victim) );
            }
            else if ( IS_CLASS(victim, CLASS_WEREWOLF) )
                sprintf( buf, " %s eyes are glowing a lambent green.",
                       HIS_HER(victim) );
            else
                sprintf( buf, " %s eyes are glowing bright red.",
                       HIS_HER(victim) );
            strcat( final, buf );
        }

        if (IS_VAMPAFF(victim, VAM_FANGS))
        {
            sprintf( buf, " %s has a pair of long, pointed fangs.",
                     PERS(victim,ch));
            strcat( final, buf );
        }

        if (IS_VAMPAFF(victim, VAM_CLAWS))
        {
            if (IS_CLASS(victim, CLASS_VAMPIRE))
            {
                if (IS_POLYAFF(victim, POLY_ZULO))
                    sprintf( buf, " %s has long black talons extending from %s fingers.",
                             HE_SHE(victim), HIS_HER(victim) );
                else if (IS_POLYAFF(victim, POLY_WOLF))
                    sprintf( buf, " %s has razor sharp talons extending from %s paws.",
                             HE_SHE(victim), HIS_HER(victim) );
                else if (IS_POLYAFF(victim, POLY_BAT))
                    sprintf( buf, " %s has tiny, razor sharp claws extending from %s wing tips.",
                             HE_SHE(victim), HIS_HER(victim) );
                else
                    sprintf( buf, " %s has razor sharp claws protruding from under %s finger nails.",
                             HE_SHE(victim), HIS_HER(victim) );
                strcat( final , buf );
            }
            if (IS_CLASS(victim, CLASS_WEREWOLF) )
            {
                if(IS_GAR1(victim, WOLF_VISCERAL))
                {
                    if( IS_GAR1(victim, WOLF_RAZORCLAWS) )
                        sprintf( buf, " Venom-dripping razor sharp %s talons extending from %s fingers.",
                                 (victim->gifts[SILVERFANGS] >= 2) ? "silver" : "",
                                 HIS_HER(victim) );
                }
                else if(IS_GAR1(victim, WOLF_RAZORCLAWS) )
                {
                    if(victim->gifts[SILVERFANGS] >=2)
                        sprintf( buf, " Razor sharp silver talons are extending from %s fingers.",
                                 HIS_HER(victim));
                    else
                        sprintf( buf, " Razor sharp talons are extending from %s fingers.",
                                 HIS_HER(victim));
                }
                else if(victim->gifts[SILVERFANGS] >=2)
                    sprintf( buf, " %s has silver talons extending from %s fingers.",
                             PERS(victim,ch), HIS_HER(victim));
                else
                    sprintf( buf, " %s talons extending from %s fingers.",
                             PERS(victim,ch), HIS_HER(victim));
                strcat( final, buf );
            }
            if (IS_CLASS(victim, CLASS_NINJA))
            {
                sprintf( buf, " Attached to %s wrists are iron claws.",
                         HIS_HER(victim));
                strcat(final, buf);
            }
            if (IS_CLASS(victim, CLASS_DEMON))
            {
                sprintf( buf, " Protruding from %s fingers are black talons.",
                         HIS_HER(victim));
                strcat(final, buf);
            }
        }
        if (IS_SET(victim->newbits, NEW_MONKFLAME))
        {
            if (IS_CLASS(victim, CLASS_VAMPIRE))
            {
                if (IS_POLYAFF(victim, POLY_WOLF))
                    sprintf( buf, " %s paws are engulfed in blazing flames.",
                             PERS(victim,ch));
                else if (IS_POLYAFF(victim, POLY_BAT))
                    sprintf( buf, " %s wing tips are engulfed in blazing flames.",
                             PERS(victim,ch));
                else
                    sprintf( buf, " %s hands are engulfed in blazing flames.",
                             PERS(victim,ch));
                strcat(final, buf);
            }
            if( IS_CLASS(victim,CLASS_MONK))
            {
                sprintf( buf, " %s hands are engulfed in blazing flames.",
                         PERS(victim,ch));
                strcat(final,buf);
            }
        }
        if (IS_SET(victim->newbits, NEW_MONKADAM))
        {
            sprintf( buf, " %s palms are as hard as adamantium.",
                     HIS_HER(victim));
            strcat(final, buf);
        }
        if (IS_SET(victim->special, SPC_WOLFMAN))
        {
            if (IS_SET(victim->newbits, NEW_QUILLS))
                sprintf( buf, " Thick fur and quill-like spines cover %s body.",
                         HIS_HER(victim));
            else
                sprintf( buf, " Thick fur covers %s body.",
                         HIS_HER(victim));
            strcat(final, buf);
        }
        if (IS_CLASS(victim, CLASS_DROW) )
        {
            if( IS_POLYAFF(victim, POLY_SPIDERFORM)
                && IS_SET(victim->pcdata->powers[1], DPOWER_ARMS) )
            {
                sprintf( buf, " Eight spidery arms hanging from %s sides!",
                         HIS_HER(victim));
                strcat(final, buf);
            }
            if( IS_SET(victim->pcdata->powers[1], DPOWER_LEVITATION))
            {
                sprintf( buf, " %s is levitating in the air.",
                         PERS(victim,ch));
                strcat(final,buf);
            }
        }
    

        if (IS_AFFECTED(victim, AFF_FLYING))
        {
            sprintf( buf, " %s is hovering in the air.",
                     HE_SHE(victim));
            strcat(final,buf);
        }
        if( IS_CLASS(victim, CLASS_DEMON)
            || IS_SET(victim->special, SPC_CHAMPION))
        {
            if (IS_DEMAFF(victim, DEM_HORNS))
            {
                sprintf(buf, " A pair of pointed horns extending from %s head.",
                        HIS_HER(victim));
                strcat(final,buf);
            }
            if (IS_DEMAFF(victim, DEM_HOOVES))
            {
                sprintf(buf, " A huge pair of hooves %s has in place of %s feet.",
                        PERS(victim,ch), HIS_HER(victim));
                strcat(final,buf);
            }
            if (IS_DEMAFF(victim, DEM_TAIL))
            {
                sprintf(buf, " A huge tail is extended from %s back side.",
                        HIS_HER(victim));
                strcat(final,buf);
            }
            if (IS_DEMAFF(victim, DEM_WINGS))
            {
                if (IS_DEMAFF(victim, DEM_UNFOLDED))
                    sprintf(buf, " A pair of batlike wings spread out from behind %s back.",
                            HIS_HER(victim));
                else
                    sprintf(buf, " A pair of batlike wings folded behind %s back.",
                            HIS_HER(victim));
                strcat(final,buf);
            }
        }

        if( final[0] != '\0' && final[0] != '.' )
        {
            char *p;
            p = format_string( str_dup(final) );
            send_to_char( "    ", ch );
            send_to_char( p , ch);
            free_string(p);
            final[0] = '\0';
        }
    }

    sprintf( buf, "     %s looks %s.\n\r",
             capitalize(PERS( victim, ch )), STRING_HITS(victim) );
    strcat( final, buf );

    switch ( victim->position )
    {
    case POS_DEAD:
          sprintf( buf, "%s is dead. ", capitalize(PERS(victim,ch)) );
          strcat( final, buf );
          break;
    case POS_MORTAL:
        sprintf( buf, "%s has wounds that may bring death. ",
                 capitalize(PERS(victim,ch)) );
        strcat( final, buf );
        break;
    case POS_INCAP:
        sprintf( buf, "%s has been rendered incapacitated. ",
                 capitalize(PERS(victim,ch)) );
        strcat( final, buf );
        break;
    case POS_STUNNED:
        sprintf( buf, "%s is stunned. ",
                 capitalize(PERS(victim,ch)) );
        strcat( final, buf );
        break;
    case POS_SLEEPING:
        sprintf( buf, "%s is fast asleep. ",
                 capitalize(HE_SHE(victim)) );
        strcat( final, buf );
        break;
    case POS_MEDITATING:
        sprintf( buf, "%s is mediating. ",
                 capitalize(HE_SHE(victim)) );
        strcat( final, buf );
        break;
    case POS_SITTING:
        sprintf( buf, "%s is sitting. ",
                 capitalize(HE_SHE(victim)) );
        strcat( final, buf );
        break;
    case POS_RESTING:
        sprintf( buf, "%s is resting. ",
                 capitalize(HE_SHE(victim)) );
        strcat( final, buf );
        break;
    case POS_FIGHTING:
        if ( victim->fighting != NULL )
        {
            sprintf( buf, "     %s is fighting with %s.\n\r",
                     PERS( victim, ch ),  PERS( victim->fighting, ch ) );
            strcat( final, buf );
        }
        break;
    default:  break;
    }

    

    if ( victim->mount )
    {
        if( victim->mounted == IS_RIDING )
            sprintf( buf, "     %s rides atop %s.\n\r",
                     HE_SHE(victim), NAME(victim->mount) );
        else
            sprintf( buf, "     %s is being ridden by %s.\n\r",
                     HE_SHE(victim), NAME(victim->mount) );
        strcat( final, buf );
    }

    if ( GET_PC(victim,condition[COND_DRUNK],0) > 50 )
    {
        sprintf( buf, " %s looks a bit tipsy and smells of drink.\n\r",
                 HE_SHE(victim) );
        strcat( final, buf );
    }


    {
        char *p;
        p = format_string( str_dup(final) );
        send_to_char( "   ", ch );
        send_to_char( p, ch );
        free_string( p );
    }

    show_equipment( victim, ch );
    send_to_char( "\n\r{n", ch );
    
    if ( victim != ch
    &&   !IS_NPC(ch)
    &&   !IS_HEAD(victim, LOST_HEAD)
    &&   number_percent( ) < ch->pcdata->learned[gsn_peek] )
    {
	send_to_char( "\n\rYou peek at the inventory:\n\r", ch );
	show_list_to_char( victim->carrying, ch, TRUE, TRUE );
    }

    send_to_char( "\n\r", ch );
    return;
};


void show_char_to_char( CHAR_DATA *list, CHAR_DATA *ch )
{
    CHAR_DATA *rch;

    for ( rch = list; rch != NULL; rch = rch->next_in_room )
    {
	if ( IS_NPC(rch) )
		continue;
	if ( rch == ch )
	    continue;
	if ( IS_IMMORTAL(ch) || IS_IMMORTAL(rch) )
	{
	    if ( !IS_NPC(rch)
	    &&   IS_SET(rch->act, PLR_WIZINVIS)
	    &&   get_trust( ch ) < rch->pcdata->wizinvis)
		continue;
	}
	else
	{
	    if ( !IS_NPC(rch)
	    && ( IS_SET(rch->act, PLR_WIZINVIS)
	         || IS_ITEMAFF(rch, ITEMA_VANISH) )
	    &&   !IS_SET(ch->act, PLR_HOLYLIGHT)
	    &&   !IS_ITEMAFF(ch, ITEMA_VISION) )
		continue;
	}

	if ( !IS_NPC(rch) && IS_HEAD(rch,LOST_HEAD))
	    continue;

	if ( !IS_NPC(rch) && IS_EXTRA(rch,EXTRA_OSWITCH))
	    continue;

	if ( IS_ITEMAFF(ch,ITEMA_VISION) || can_see( ch, rch ) )
	    show_char_to_char_0( rch, ch );
	else if ( room_is_dark( ch->in_room )
	&&      ( IS_AFFECTED(rch, AFF_INFRARED)||(!IS_NPC(rch)&&IS_VAMPAFF(rch, VAM_NIGHTSIGHT))))
	{
	    send_to_char( "{RYou see glowing red eyes watching YOU!{x\n\r", ch );
	}
    }
    if( !room_is_dark( ch->in_room )
	|| IS_AFFECTED( ch, AFF_INFRARED)
	|| ( !IS_NPC(ch) && IS_VAMPAFF( ch, VAM_NIGHTSIGHT) ) 
	|| IS_DROW(ch) )
	show_mlist_to_char( list, ch );
    return;
} 



bool check_blind( CHAR_DATA *ch )
{
    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_HOLYLIGHT) && !IS_AFFECTED(ch, AFF_TOTALBLIND))
	return TRUE;

    if ( IS_ITEMAFF(ch, ITEMA_VISION) && !IS_AFFECTED(ch, AFF_TOTALBLIND))
	return TRUE;

    if ( IS_HEAD(ch, LOST_EYE_L) && IS_HEAD(ch, LOST_EYE_R) )
    {
	send_to_char( "You have no eyes to see with!\n\r", ch );
	return FALSE;
    }

    if ( IS_EXTRA(ch, BLINDFOLDED) )
    {
	send_to_char( "You can't see a thing through the blindfold!\n\r", ch );
	return FALSE;
    }

    if ( IS_AFFECTED(ch, AFF_BLIND) && !IS_AFFECTED(ch, AFF_SHADOWSIGHT))
    {
	send_to_char( "You can't see a thing!\n\r", ch );
	return FALSE;
    }

    if ( IS_AFFECTED(ch, AFF_TOTALBLIND) && !IS_IMMORTAL(ch) )
    {
	send_to_char( "You can't see through this shroud of darkness!\n\r", ch );
	return FALSE;
    }
    return TRUE;
}


void do_look( CHAR_DATA *ch, char *argument )
{
    char buf  [MAX_STRING_LENGTH];
    char arg1 [MAX_INPUT_LENGTH];
    char arg2 [MAX_INPUT_LENGTH];
    EXIT_DATA *pexit;
    CHAR_DATA *victim;
    CHAR_DATA *vch;
    CHAR_DATA *vch_next;
    CHAR_DATA *wizard;
    OBJ_DATA *obj;
    OBJ_DATA *portal;
    OBJ_DATA *portal_next;
    ROOM_INDEX_DATA *pRoomIndex;
    ROOM_INDEX_DATA *location;
    char *pdesc;
    char *kwd;
    int door;
    bool found;
    bool twastes = FALSE;


    if ( !ch->desc && !(wizard = ch->wizard))
        return;

    if (!ch->in_room)
        return;

    if ( ch->position < POS_SLEEPING )
    {
	send_to_char( "You can't see anything but stars!\n\r", ch );
	return;
    }

    if ( ch->position == POS_SLEEPING )
    {
        send_to_char( "You can't see anything, you're sleeping!   {bZZzzz{x\n\r", ch );
	return;
    }

    if ( !check_blind( ch ) )
	return;

    if ( !IS_NPC(ch)
         && IS_SET(ch->in_room->affected_by, ROOM_TOTAL_DARKNESS)
         && !IS_ITEMAFF(ch, ITEMA_VISION)
         && !IS_IMMORTAL(ch) 
         && !IS_DROW(ch))
    {
	send_to_char( "It is pitch black ... \n\r", ch );
	return;
    }

    if(IS_SET(ch->in_room->area->bits,WASTE))
        twastes=TRUE;

    if ( !IS_NPC(ch)
         && !IS_SET(ch->act, PLR_HOLYLIGHT)
         && !IS_ITEMAFF(ch, ITEMA_VISION)
         && !IS_VAMPAFF(ch, VAM_NIGHTSIGHT)
         && !IS_AFFECTED(ch, AFF_SHADOWPLANE)
         && !(ch->in_room
              && ch->in_room->vnum == ROOM_VNUM_IN_OBJECT
              && !IS_NPC(ch)
              && ch->pcdata->chobj
              &&   ch->pcdata->chobj->in_obj )
         &&   room_is_dark( ch->in_room ) )
    {
        send_to_char( "It is pitch black ... \n\r", ch );
	show_char_to_char( ch->in_room->people, ch );
        return;
    }
  
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
    {
        if ( ch->in_room
             && ch->in_room->vnum == ROOM_VNUM_IN_OBJECT
             && !IS_NPC(ch)
             && ch->pcdata->chobj
             && ch->pcdata->chobj->in_obj )
            act( "$p",ch,ch->pcdata->chobj->in_obj,NULL,TO_CHAR);
        else if ( IS_AFFECTED(ch, AFF_SHADOWPLANE) )
	    send_to_char( "The shadow plane\n\r", ch );
	else
        {
            if ( !IS_NPC(ch) && PLR_FLAGS(ch,PLR_AUTOMAPPER))
            {
                do_mapper( ch, "7" );
                send_to_char("{x",ch);
            }
            else
            {
                char sec [ MSL ];

                if( ch->in_room->sector_type < 0
                 || ch->in_room->sector_type > SECT_MAX )
                    strcpy(sec, "BAD SECTOR" );
                else
                    strcpy(sec, sector_string[ch->in_room->sector_type] );

                if(twastes)
                    ch_printf(ch,"{yTrackless Wastes{x\n\r");
                else if (IS_IMMORTAL(ch) )
                    ch_printf( ch, "{C%s {b[{y%d{b]{W  %s{n  {c%s{x\n\r",
                               ch->in_room->name,
			       ch->in_room->vnum,
                               sec,
                               flag_string( room_flags, ch->in_room->room_flags) );
                else
                    ch_printf(ch, "{C%s  %s{x\n\r",
                              ch->in_room->name,
                              sec );
             }
	}
	
        if ( !IS_NPC(ch) && !PLR_FLAGS(ch,PLR_AUTOMAPPER))
        {
            if ( ch->in_room
                 && ch->in_room->vnum == ROOM_VNUM_IN_OBJECT
                 && !IS_NPC(ch)
                 && ch->pcdata->chobj
                 && ch->pcdata->chobj->in_obj )
            {
                act( "You are inside $p.",ch,ch->pcdata->chobj->in_obj,NULL,TO_CHAR);
                show_list_to_char( ch->pcdata->chobj->in_obj->contains, ch, FALSE, FALSE );
            }
            else if ( (arg1[0] == '\0' || !str_cmp( arg1, "auto" ) )
                      && IS_AFFECTED(ch, AFF_SHADOWPLANE) )
                send_to_char( "You are standing in complete darkness.\n\r", ch );
            else if ( !IS_NPC(ch) && !IS_SET(ch->act, PLR_BRIEF)
                      &&( arg1[0] == '\0' || !str_cmp( arg1, "auto" ) ) )
            {
                if(twastes)
                    stc("The land surrounding you is devoid of any landmarks.\n\r",ch);
                else
                {
                    send_to_char( "{n", ch );
                    if( ch->in_room->description[0] == '.' )
                        send_to_char( ch->in_room->description + 1, ch );
                    else
                        send_to_char( ch->in_room->description, ch );
                }
                if ( ch->in_room->sector_type != SECT_INSIDE
                  && IS_OUTSIDE(ch))
                {
                    if (number_range(0,10) < 5 )
                    {
                        if (weather_info.sky == SKY_RAINING)
                            send_to_char("{cA cool wind howls and brings a light rain.{x\n\r",ch);
                        else if (weather_info.sky == SKY_CLOUDY)
                            send_to_char("{cA cold wind is blowing.{x\n\r",ch);
                    }
                }
            }
            if (ch->in_room->blood == 1000)
                sprintf(buf,"You notice that the room is completely drenched in blood.\n\r");
            else if (ch->in_room->blood > 750)
                sprintf(buf,"You notice that there is a very large amount of blood around the room.\n\r");
            else if (ch->in_room->blood > 500)
                sprintf(buf,"You notice that there is a large quantity of blood around the room.\n\r");
            else if (ch->in_room->blood > 250)
                sprintf(buf,"You notice a fair amount of blood on the floor.\n\r");
            else if (ch->in_room->blood > 100)
		sprintf(buf,"You notice several blood stains on the floor.\n\r");
	    else if (ch->in_room->blood > 50)
		sprintf(buf,"You notice a few blood stains on the floor.\n\r");
	    else if (ch->in_room->blood > 25)
		sprintf(buf,"You notice a couple of blood stains on the floor.\n\r");
	    else if (ch->in_room->blood > 0)
		sprintf(buf,"You notice a few drops of blood on the floor.\n\r");
            else
                sprintf(buf,"You notice nothing special in the room.\n\r");
	    ADD_COLOUR(ch, buf, L_RED);
            if (ch->in_room->blood > 0)
                send_to_char(buf,ch);
	}
        if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT) )
            do_exits( ch, "auto" );

        show_list_to_char( ch->in_room->contents, ch, FALSE, FALSE );
	show_char_to_char( ch->in_room->people,   ch );
	return;
    }

    if ( !str_cmp( arg1, "i" ) || !str_cmp( arg1, "in" ) )
    {
	/* 'look in' */
	if ( arg2[0] == '\0' )
	{
	    send_to_char( "Look in what?\n\r", ch );
            //ch->level = MAX_LEVEL;
            return;
	}

	if ( ( obj = get_obj_here( ch, arg2 ) ) == NULL )
	{
	    send_to_char( "You do not see that here.\n\r", ch );
	    return;
	}

	switch ( obj->item_type )
	{
	default:
	    send_to_char( "That is not a container.\n\r", ch );
	    break;

	case ITEM_PORTAL:
        case ITEM_WGATE:
	    pRoomIndex = get_room_index(obj->value[0]);
	    location = ch->in_room;
	    if ( pRoomIndex == NULL )
	    {
		send_to_char( "It doesn't seem to lead anywhere.\n\r", ch );
		return;
	    }
	    if ((obj->value[2] == 1 || obj->value[2] == 3) 
			&& obj->item_type == ITEM_PORTAL)
	    {
		send_to_char( "It seems to be closed.\n\r", ch );
		return;
	    }

	    if ( obj->item_type == ITEM_WGATE && !IS_CLASS(ch, CLASS_MAGE) )
	    {
               stc("You gaze into the rift, but can see nothing.\n\r",ch);
	       return;
            }

	    char_from_room(ch);
	    char_to_room(ch,pRoomIndex);

	    found = FALSE;
	    for ( portal = ch->in_room->contents; portal != NULL; portal = portal_next )
	    {
		portal_next = portal->next_content;
		if ( ( obj->value[0] == portal->value[3]  )
		    && (obj->value[3] == portal->value[0]) )
		{
		    found = TRUE;
		    if ( obj->item_type == ITEM_WGATE )
                    {
		        stc("You peer through the magical rift...\n\r",ch);
	            }

		    if (IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
			!IS_SET(portal->extra_flags, ITEM_SHADOWPLANE) )
		    {
			REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
	    		do_look(ch,"auto");
			SET_BIT(ch->affected_by, AFF_SHADOWPLANE);
			break;
		    }
		    else if (!IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
			IS_SET(portal->extra_flags, ITEM_SHADOWPLANE) )
		    {
			SET_BIT(ch->affected_by, AFF_SHADOWPLANE);
	    		do_look(ch,"auto");
			REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
			break;
		    }
		    else
		    {
	    		do_look(ch,"auto");
			break;
		    }
	    	}
	    }
	    char_from_room(ch);
	    char_to_room(ch,location);
	    break;

	case ITEM_DRINK_CON:
	    if ( obj->value[1] <= 0 )
	    {
		send_to_char( "It is empty.\n\r", ch );
		break;
	    }

	    if (obj->value[1] < obj->value[0] / 5)
	    	sprintf( buf, "There is a little %s liquid left in it.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 4)
	    	sprintf( buf, "It contains a small about of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 3)
	    	sprintf( buf, "It's about a third full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 2)
	    	sprintf( buf, "It's about half full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0])
	    	sprintf( buf, "It is almost full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] == obj->value[0])
	    	sprintf( buf, "It's completely full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else
	    	sprintf( buf, "Somehow it is MORE than full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    send_to_char( buf, ch );
	    break;

	case ITEM_CONTAINER:
	case ITEM_CORPSE_NPC:
	case ITEM_CORPSE_PC:
	    if ( IS_SET(obj->value[1], CONT_CLOSED) )
	    {
		send_to_char( "It is closed.\n\r", ch );
		break;
	    }

	    act( "$p contains:", ch, obj, NULL, TO_CHAR );
	    show_list_to_char( obj->contains, ch, TRUE, TRUE );
	    break;
	}
	return;
    }


    if ( ( victim = get_char_room( ch, arg1 ) ) != NULL )
    {
	show_char_to_char_1( victim, ch );
	if ( IS_CLASS(victim, CLASS_DEMON) && IS_SET(victim->warp, WARP_TERROR) )
	{
	    send_to_char("You scream in terror and run in a panic from what you just saw!\n\r", ch );
	    if ( ch->position == POS_FIGHTING ) do_flee(ch, "");
	}
	else evil_eye(victim,ch);
	return;
    }
    for ( vch = char_list; vch != NULL; vch = vch_next )
    {
	vch_next	= vch->next;
	if ( vch->in_room == NULL )
	    continue;
	if ( vch->in_room == ch->in_room )
	{
	    if (!IS_NPC(vch) && !str_cmp(arg1,vch->morph))
	    {
		show_char_to_char_1( vch, ch );
		evil_eye(vch,ch);
		return;
	    }
	    continue;
	}
    }

    if (!IS_NPC(ch) && ch->pcdata->chobj != NULL && ch->pcdata->chobj->in_obj != NULL)
    {
	obj = get_obj_in_obj(ch,arg1);
	if (obj != NULL)
	{
	    send_to_char( obj->description, ch );
	    send_to_char( "\n\r", ch );
	    return;
	}
    }
    for ( obj = ch->carrying; obj != NULL; obj = obj->next_content )
    {
	if (!IS_NPC(ch) && ch->pcdata->chobj != NULL && obj->chobj != NULL && obj->chobj == ch)
	    continue;
	kwd = is_hiscore_obj( obj );
	if( kwd )
	{
		show_hiscore( kwd, ch );
		return;
	}

	if ( IS_ITEMAFF(ch,ITEMA_VISION) || can_see_obj( ch, obj ) )
	{
	    pdesc = get_extra_descr( arg1, obj->extra_descr );
	    if ( pdesc != NULL )
	    {
		send_to_char( pdesc, ch );
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->extra_descr );
	    if ( pdesc != NULL )
	    {
		send_to_char( pdesc, ch );
		return;
	    }
	}

	if ( is_name( arg1, obj->name ) )
	{
	    send_to_char( obj->description, ch );
	    send_to_char( "\n\r", ch );
	    return;
	}
    }

    for ( obj = ch->in_room->contents; obj != NULL; obj = obj->next_content )
    {
	if (!IS_NPC(ch) && ch->pcdata->chobj != NULL && obj->chobj != NULL && obj->chobj == ch)
	    continue;
	if ( can_see_obj( ch, obj ) )
	{
	    pdesc = get_extra_descr( arg1, obj->extra_descr );
	    if ( pdesc != NULL )
	    {
		send_to_char( pdesc, ch );
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->extra_descr );
	    if ( pdesc != NULL )
	    {
		send_to_char( pdesc, ch );
		return;
	    }
	}

	if ( is_name( arg1, obj->name ) )
	{
	    send_to_char( obj->description, ch );
	    send_to_char( "\n\r", ch );
	    return;
	}
    }

    pdesc = get_extra_descr( arg1, ch->in_room->extra_descr );
    if ( pdesc != NULL )
    {
	send_to_char( pdesc, ch );
	return;
    }

         if ( !str_cmp( arg1, "n" ) || !str_cmp( arg1, "north" ) ) door = 0;
    else if ( !str_cmp( arg1, "e" ) || !str_cmp( arg1, "east"  ) ) door = 1;
    else if ( !str_cmp( arg1, "s" ) || !str_cmp( arg1, "south" ) ) door = 2;
    else if ( !str_cmp( arg1, "w" ) || !str_cmp( arg1, "west"  ) ) door = 3;
    else if ( !str_cmp( arg1, "u" ) || !str_cmp( arg1, "up"    ) ) door = 4;
    else if ( !str_cmp( arg1, "d" ) || !str_cmp( arg1, "down"  ) ) door = 5;
    else
    {
	send_to_char( "You do not see that here.\n\r", ch );
	return;
    }

    /* 'look direction' */
    if ( ( pexit = ch->in_room->exit[door] ) == NULL )
    {
	send_to_char( "Nothing special there.\n\r", ch );
	return;
    }

    if ( IS_SET(pexit->exit_info, EX_CLOSED) )
    {
        if( pexit->keyword[0] != '\0' && pexit->keyword[0] != '.' )
            act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR );
        else
            stc( "The door is closed.\n\r", ch );
    }
    else 
    {
        if ((pexit = ch->in_room->exit[door]) == NULL) return;
        if ((pRoomIndex = pexit->to_room) == NULL) return;
        location = ch->in_room;

        act(from_room[door],ch,NULL,NULL,TO_ROOM);

        char_from_room(ch);
        char_to_room(ch,pRoomIndex);

        act(to_room[door],ch,NULL,NULL,TO_ROOM);
        do_look(ch,"auto");
        char_from_room(ch);
        char_to_room(ch,location);
    }
    
    return;
}



void do_examine( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    OBJ_DATA *obj;

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
    {
	send_to_char( "Examine what?\n\r", ch );
	return;
    }

    do_look( ch, arg );

    if ( ( obj = get_obj_here( ch, arg ) ) != NULL )
    {
	     if (obj->condition >= 100) 
	    sprintf( buf, "You notice that %s is in perfect condition.\n\r",obj->short_descr );
	else if (obj->condition >= 75 )
	    sprintf( buf, "You notice that %s is in good condition.\n\r",obj->short_descr );
	else if (obj->condition >= 50 )
	    sprintf( buf, "You notice that %s is in average condition.\n\r",obj->short_descr );
	else if (obj->condition >= 25 )
	    sprintf( buf, "You notice that %s is in poor condition.\n\r",obj->short_descr );
	else
	    sprintf( buf, "You notice that %s is in awful condition.\n\r",obj->short_descr );
	send_to_char(buf,ch);
	switch ( obj->item_type )
	{
	default:
	    break;

	case ITEM_DRINK_CON:
	case ITEM_CONTAINER:
	case ITEM_CORPSE_NPC:
	case ITEM_CORPSE_PC:
	    send_to_char( "When you look inside, you see:\n\r", ch );
	    sprintf( buf, "in %s", arg );
	    do_look( ch, buf );
	}
    }

    return;
}



/*
 * Thanks to Zrin for auto-exit part.
 */
void do_exits( CHAR_DATA *ch, char *argument )
{
    extern char * const dir_name[];
    char buf[MAX_STRING_LENGTH];
    EXIT_DATA *pexit;
    bool found;
    bool fAuto;
    int door;
    char * dir2_name[] = { "north", "east", "south", "west", "up", "down" };
    buf[0] = '\0';
    fAuto  = !str_cmp( argument, "auto" );

    if ( !check_blind( ch ) )
	return;

    strcpy( buf, "{yObvious exits:" );
    if( !fAuto )
	strcat( buf, "\n\r" );

    found = FALSE;
    for ( door = 0; door <= 5; door++ )
    {
	if ( ( pexit = ch->in_room->exit[door] ) != NULL
	&&   pexit->to_room != NULL
	&&   !IS_SET(pexit->exit_info, EX_CLOSED) )
	{
	    found = TRUE;
	    if ( fAuto )
	    {
		strcat( buf, " " );
		strcat( buf, dir2_name[door] );
	    }
	    else
	    {
		if (IS_SET(sysdata.world, WORLD_FOG))
	        {
        	    sprintf(buf + strlen(buf), "%-5s - Too foggy to tell.\n\r",
	            capitalize(dir2_name[door]));
	        }
		sprintf( buf + strlen(buf), "%-5s - %s\n\r",
		    capitalize( dir2_name[door] ),
		    room_is_dark( pexit->to_room )
			?  "Too dark to tell"
			: pexit->to_room->name
		    );
	    }
	}
    }

    if ( !found )
	strcat( buf, fAuto ? " NONE!!" : "{bN{Bone{x.\n\r" );

    if ( fAuto )
	strcat( buf, "{x\n\r" );
    send_to_char( buf, ch );
    return;
}

/*
 * Misc functions used for score
 * -- Dreimas
 */
char * num_thing ( int num )
{
    log_buf[0] = '\0';
    if( num == 0 )
	sprintf( log_buf, "none" );
    else
	sprintf( log_buf, "%d", num );
    return log_buf;
}

char * score_stat( int race )
{
    if( race > 29 ) return "Legend";
    if( race > 23 ) return "Master";
    if( race > 19 ) return "Elder";
    if( race > 14 ) return "Grand";
    if( race > 9 )  return "Greater";
    if( race > 4 )  return "DemiGod";
    if( race > 1 )  return "LesserGod";
    return "Avatar";
}

/*
 * Took trackers current do_show and modified it
 * -- Dreimas
 */
void do_score( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char rep[MAX_STRING_LENGTH];
    int a_c = char_ac(ch);

    if( IS_NPC(ch) )
	return;

    if( !IS_NPC(ch) && (IS_EXTRA(ch,EXTRA_OSWITCH)
	             || IS_HEAD(ch,LOST_HEAD ) ))
    {
        obj_score(ch,ch->pcdata->chobj);
        return;
    }

    send_to_char( LINE_SEPERATOR, ch );
    ch_printf( ch,"   {n%s...{x\n\r",ch->name);
    send_to_char( LINE_SEPERATOR, ch );
    ch_printf( ch,"{n   Hps {D[{R %7ld{D/{R%7ld {D]{n Hitroll {D[{R %5d {D]{n Str {D[{R %3d {D]{n    Exp {D[{R %10d {D]{x\n\r",
            ch->hit,
            ch->max_hit,
            char_hitroll(ch),
            get_curr_str(ch),
            ch->exp);
    ch_printf( ch, "{n  Mana {D[{R %7ld{D/{R%7ld {D]{n Damroll {D[{R %5d {D]{n Int {D[{R %3d {D]{n Qp/TQst{D[{R %5d/%4d {D]{x\n\r",
               ch->mana,
               ch->max_mana,
               char_damroll(ch),
               get_curr_int(ch),
               ch->pcdata->quest,
               PC(ch,score[SCORE_NUM_QUEST]) );
    ch_printf( ch,"{n  Move {D[{R %7ld{D/{R%7ld {D]{n  Damcap {D[{R %5d {D]{n Wis {D[{R %3d {D]{n Primal {D[{R %10d {D]{x\n\r",
               ch->move,
               ch->max_move,
               ch->damcap[0],
               get_curr_wis(ch),
               ch->practice);
    ch_printf( ch,"{n Items {D[{R   %5d{D/{R%5d   {D]{n      AC {D[{R %5d {D]{n Dex {D[{R %3d {D]{n  Hours {D[{R %10d {D]{x\n\r",
               ch->carry_number, can_carry_n(ch),
               a_c,
               get_curr_dex(ch),
               (get_age(ch) - 17) * 2);
    ch_printf( ch,"{nWeight {D[{R%8d{D/{R%-8d{D]{n  Vs. Sp {D[{R %5d {D]{n Con {D[{R %3d {D]{n  Align {D[{R %10d {D]{x\n\r",
               ch->carry_weight,
               can_carry_w(ch),
               ch->saving_throw,
               get_curr_con(ch),
               ch->alignment);
    send_to_char( LINE_SEPERATOR, ch );
    send_to_char( LINE_SEPERATOR, ch );
    if ( !IS_NPC(ch) && IS_EXTRA(ch, EXTRA_DONE) )
	strcat(buf,"  You are no longer a virgin.\n\r");
    else
        strcat(buf,"\n\r");
    strcat( buf, "\n\r\n\r" );

    if ( PC(ch,stage[0]) >= 100 )
        send_to_char( "You are feeling extremely horny.\n\r",  ch );
    else if ( PC(ch,stage[0]) >= 50 )
	send_to_char( "You are feeling pretty randy.\n\r",  ch );
    else if ( PC(ch,stage[0]) >= 1 )
        send_to_char( "You are feeling rather kinky.\n\r",  ch );


    if ( PC(ch,stage[1]) && ch->position == POS_STANDING )
    {
        send_to_char( "You are having sexual intercourse.\n\r",  ch );
	if ( PC(ch,stage[2]) + 25 >= ch->pcdata->stage[1] )
            send_to_char( "You are on the verge of having an orgasm.\n\r",  ch );
    }
    birth_date( ch, TRUE );
    if( PC(ch,conception) )
        birth_date( ch, FALSE );

    send_to_char( LINE_SEPERATOR, ch );
    {
	char buf2 [ MIL ];
	buf2[ 0]='\0';	
	sprintf( buf, "{nStatus {D[{r %-9s {D]{n",
		score_stat(ch->race) );
	strcat( buf2, buf );

    	sprintf( buf, " Pkills {D[{r %-6s {D]{n",
		num_thing(ch->pkill) );
	strcat( buf2, buf );

	sprintf( buf, " Pdeaths {D[{r %-6s {D]{n",
		num_thing(ch->pdeath) );
	strcat( buf2, buf );
	sprintf( buf, " Timers Cps %s\n\r",
		IS_SET(ch->act, PLR_WIZINVIS) ? "Vanished" : "" );
	strcat( buf2, buf );
	stc( buf2, ch );
    }
    
    if( ch->fight_timer == 0 )
        sprintf( rep, "{Mc{n-" );
    else
    {
        sprintf( buf, "%2d", ch->fight_timer );
        sprintf( rep, "%s", buf );
    }
    
    strcat( rep, "{D/" );
    if( ch->arena_timer == 0 )
        strcat( rep, "{Ca{n-" );
    else
    {
        sprintf( buf, "{C%2d", ch->arena_timer );
        strcat( rep, buf );
    }
    {
	char buf2 [ MIL ];
	buf2[0] = '\0';
	sprintf( buf, "{nStatus {D[{r %-9s {D]",
		num_thing(ch->race) );
	strcat( buf2, buf );
        sprintf( buf, "{n Mkills {D[{r %-6s {D]",
		num_thing(ch->mkill) );
	strcat( buf2, buf );

	sprintf( buf, "{n Mdeaths {D[{r %-6s {D]",
		num_thing( ch->mdeath) );
	strcat( buf2, buf );
	
	sprintf( buf, "{n [%s{D]  {r%-8d\n\r",
               rep, PC(ch,stats[DEMON_CURRENT]) );
	strcat( buf2, buf );
	stc( buf2, ch );
    }

    send_to_char( LINE_SEPERATOR, ch );
    send_to_char( LINE_SEPERATOR, ch );
    if ( IS_CLASS(ch, CLASS_MAGE) || IS_CLASS(ch,CLASS_DROW) )
        ch_printf( ch,"{WYou have{M %d {Wpoints of magic resistance.\n\r",
                   PC(ch,stats[DROW_MAGIC]) );

    if ( IS_CLASS(ch, CLASS_MONK) )
    {
        ch_printf( ch, "{WYou are currently focusing {n%d{W out of {n%d{W chi.\n\r",
                   ch->chi[CURRENT], ch->chi[MAXIMUM] );
        ch_printf( ch, "{WYour focus points are {n%d{W out of {n%d{W foci.\n\r",
                   ch->focus[CURRENT], ch->focus[MAXIMUM] );
    }

    if ( IS_CLASS(ch,CLASS_VAMPIRE) )
    {
        ch_printf( ch, "{WBlood:{r %d{n     {WBeast:{y %d{n.\n\r",
                   ch->pcdata->condition[COND_THIRST],ch->beast );
        if(PC(ch,stats[UNI_RAGE]) > 0 )
            ch_printf( ch, "{WBeast affects {rHitroll{W and {rDamroll{W by {y%d.\n\r",
                       PC(ch,stats[UNI_RAGE]) );
    }
    if ( IS_CLASS(ch, CLASS_WEREWOLF) )
    {
        ch_printf( ch, "{WYou have {y%d{n/{y%d {WGnosis Points\n\r",
                   ch->gnosis[GCURRENT],
                   ch->gnosis[GMAXIMUM] );
        if( PC(ch,powers[WPOWER_SILVER]) > 0 )
            ch_printf( ch,"{WYou have attained{n %d {Wpoints of silver tolerance.\n\r",
                       ch->pcdata->powers[WPOWER_SILVER]);
        if( IS_SET(ch->special,SPC_WOLFMAN)
         && PC(ch,stats[UNI_RAGE]) > 0 )
            ch_printf( ch, "{WRage: Affects {rHitroll{W and {rDamroll{W by {y%d.\n\r",
                       PC(ch,stats[UNI_RAGE]) );
    }

    if ( IS_CLASS(ch, CLASS_NINJA) )
    {
        ch_printf( ch,"{WYou currently have{n %d{W out of {n500{W Ki store.\n\r",
                ch->pcdata->powers[NINJAKI] );

        if(PC(ch,stats[UNI_RAGE]) > 0 )
            ch_printf(ch,"{WMichi:  Affects Hitroll and Damroll by {y%d{n.\n\r",
                      PC(ch,stats[UNI_RAGE]) );

        if ( PC(ch,powers[NPOWER_CHIKYU]) >= 6
             && PC(ch,powers[HARA_KIRI]) > 0)
            ch_printf(ch,"{WYou receive the power of HaraKiri for{m %d {Wmore ticks.\n\r",
                      PC(ch,powers[HARA_KIRI]) );
    }
    
    if ( IS_CLASS( ch, CLASS_DEMON) && ch->pcdata->stats[DEMON_POWER] > 0)
        ch_printf(ch,"{WDemonic armor affects {RHitroll{W and {RDamroll{W by {r%d{W.\n\r",
                  ((ch->pcdata->stats[DEMON_POWER]) *
                   ch->pcdata->stats[DEMON_POWER]));
    return;
}

char *	const	day_name	[] =
{
    "the Moon", "the Bull", "Deception", "Thunder", "Freedom",
    "the Great Gods", "the Sun"
};

char *	const	month_name	[] =
{
    "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces",
    "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon",
    "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows",
    "the Long Shadows", "the Ancient Darkness", "the Great Evil"
};

void do_time( CHAR_DATA *ch, char *argument )
{
    extern char str_boot_time[];
    extern time_t boot_time;
    extern time_t current_time;
    char buf[MAX_STRING_LENGTH];
    char descr [ MAX_INPUT_LENGTH ];
    char arg [ MAX_INPUT_LENGTH ];
    char * suf;
    int    day;
    int    hours;
    int    minutes;
    int    seconds;

    argument = one_argument( argument, arg );
    day     = time_info.day + 1;

         if ( day > 4 && day <  20 ) suf = "th";
    else if ( day % 10 ==  1       ) suf = "st";
    else if ( day % 10 ==  2       ) suf = "nd";
    else if ( day % 10 ==  3       ) suf = "rd";
    else                             suf = "th";


    switch ( time_info.hour )
    {
        case  1:
        case  2: sprintf( descr, "late night"       ); break;
        case  3:
        case  4: sprintf( descr, "early morning"    ); break;
        case  5: sprintf( descr, "just before dawn" ); break;
        case  6: sprintf( descr, "dawn"             ); break;
        case  7: 
        case  8: sprintf( descr, "early morning"    ); break;
        case  9:
        case 10:
        case 11: sprintf( descr, "morning"          ); break;
        case 12: sprintf( descr, "midday"           ); break;
        case 13:
        case 15: sprintf( descr, "afternoon"        ); break;
        case 14: sprintf( descr, "mid-afternoon"    ); break;
        case 16:
        case 17: sprintf( descr, "evening"          ); break;
        case 18: sprintf( descr, "twilight"         ); break;
        case 19: sprintf( descr, "dusk"             ); break;
        case 20:
        case 21:
        case 22: sprintf( descr, "night"            ); break;
        case 23: sprintf( descr, "late at night"    ); break;
        case  0: sprintf( descr, "midnight"         ); break;
    }

    sprintf( buf, "{YIt is %s (%d o'clock %s) on the day of %s.  The %d%s of the month of %s, in the year %s.",
             descr,
  	     (time_info.hour % 12 == 0) ? 12 : time_info.hour % 12,
	     time_info.hour >= 12 ? "pm" : "am",
             day_name[day % 7],
	     day, suf,
             month_name[time_info.month],
             numberize( time_info.year ) );

    if( !IS_OUTSIDE(ch) )
    {
	strcat( buf, "You cannot tell what the weather is like from here." );
    }
    else
    {
	static char * const sky_look[4] =
        {
		"cloudless",
		"cloudy",
		"rainy",
		"lit by flashes of lightning"
        };

	descr[0] = '\0';

        if (IS_SET(sysdata.world, WORLD_ECLIPSE))
	    strcat(buf, "The sun is eclipsed by the moon.  ");
        if (IS_SET(sysdata.world, WORLD_FOG))
    	    strcat(buf, "A thick blanket of fog covers the ground.  ");

        if (IS_SET(sysdata.world, WORLD_RAIN))
        {
	    sprintf(descr, "The sky is pouring with a heavy rain and %s.  ",
	    weather_info.change >= 0
		    ? "a warm southerly breeze blows"
		    : "a cold northern gust blows" );
	}
	else
	{
	    sprintf(descr,  "The sky is %s and %s.\n\r",
		    sky_look[weather_info.sky],
		    weather_info.change >= 0
		    ? "a warm southerly breeze blows"
		    : "a cold northern gust blows" );
	    strcat( buf, descr );
	}
    }
 
    /*
     * Wolves can see moon anytime..
     * otherwise, outside and from midnight to 4
     */
    if ( IS_CLASS(ch,  CLASS_WEREWOLF) 
      || (IS_OUTSIDE(ch) && time_info.hour < 4) )
    {
        if ( weather_info.sky != SKY_CLOUDLESS
          && weather_info.moonphase != MOON_NEW 
	  && !IS_CLASS(ch, CLASS_WEREWOLF) )
        strcat( buf, "The moon is behind a cloud." );
        else
        switch ( weather_info.moonphase )
        {
        case MOON_NEW:
            strcat( buf, "No moon graces the heavens tonight." ); break;
        case MOON_HALF:
            strcat( buf, "The waxing half-moon can be seen on this night." ); break;
        case MOON_FULL:
            strcat( buf, "The moon is full." ); break;
        case MOON_GIBBOUS:
            strcat( buf, "Tonight, the moon is near full, a waxing gibbous of celestial harmony." ); break;
        case MOON_WANING:
            strcat( buf, "The moon is in the phase of a waning gibbous." ); break;
        case MOON_CRESCENT:
            strcat( buf, "Only a sliver of moon remains in the heavens." ); break;
          default:
            if ( IS_IMMORTAL(ch) )
            strcat( buf, "{cSomething is drastically wrong with the moon! E-gads!" );
           break;
        }
    }	

    {
        char *p;
        p = format_string( str_dup( buf ) );
        send_to_char( p, ch );
        free_string( p );
    }


    ch_printf(ch, "{Y\n\rBooted at:   %s\n\rSystem time: %s\n\r",
                str_boot_time, (char *) ctime( &current_time )  );
    seconds = (int) (current_time - boot_time);
    hours   = seconds / 3600;
    minutes = (seconds - hours*3600) / 60;
    ch_printf(ch, "{YAscension to Darkness has been up: %d hr%s and %d mn%s.\n\r\n\r", 
		hours,
		hours == 1 ? "": "s", 
		minutes,
		minutes > 1 ? "s" : "" );
    
    if ( IS_IMMORTAL( ch ) && !str_cmp( arg, "full" ) )
    {
        extern int pulse_area;
        extern int pulse_mobile;
        extern int pulse_violence;
        extern int pulse_save;
	extern int pulse_rooms;
        sprintf( buf, "\n\r{YBooted at:   %s\rSystem time: %s\r",
         	str_boot_time, (char *) ctime( &current_time )  );
        send_to_char( buf, ch );

        sprintf( buf,
	       "Time\n\r"
	       "Hour:  %4d  Day:  %4d  Month: %4d  Year:  %4d\n\r"
	       "Weather\n\r"
	       "Mmhg:  %4d  Sky:  %4d  Sun:   %4d  Chnge: %4d\n\r"
	       "Pulse\n\r"
	       "Area:  %4d  Mob:  %4d  Fight: %4d  Save:  %4d\n\r"
	       "Room:  %4d\n\r",
	       time_info.hour,             day,
	       time_info.month,            time_info.year,
	       weather_info.mmhg,          weather_info.sky,           
               weather_info.moonphase,     weather_info.change,
               pulse_area,                 pulse_mobile,
               pulse_violence,             pulse_save,
	       pulse_rooms );
        send_to_char( buf, ch );
    }
    return;
}



void do_phase(CHAR_DATA *ch, char *argument)
{  
    if (!IS_OUTSIDE(ch))
    {
    send_to_char("You can't see the moon indoors.\n\r", ch);
    return;
    }
/*
 * Werewolves can sence the moonphases anytime
 */
    if (weather_info.moonlight == MOON_DOWN && IS_CLASS(ch, CLASS_WEREWOLF))
    {
    send_to_char("The moon is not up.\n\r", ch);
        return;
    }

    if (weather_info.moonphase == MOON_NEW)
    {
    send_to_char("The moon is new.\n\r", ch);
    return;
    }

    if (weather_info.moonphase == MOON_CRESCENT)
    {
    send_to_char("The moon is crescent.\n\r", ch);
    return;
    }

    if (weather_info.moonphase == MOON_HALF)
    {
    send_to_char("The moon is half tonight.\n\r", ch);
    return;
    }
 
    if (weather_info.moonphase == MOON_GIBBOUS)
    {
    send_to_char("The moon is in its gibbous phase.\n\r", ch);
    return;
    }

    if (weather_info.moonphase == MOON_FULL)
    {
    send_to_char("The moon is full tonight.\n\r", ch);
    return;
    }

    if (weather_info.moonphase == MOON_WANING)
    {
    send_to_char("The moon is waning.\n\r", ch);
    return;
    } 

    else
    {
    send_to_char("bug, please inform an implementor.\n\r", ch);
    return;
    }

}

    
void do_weather(CHAR_DATA *ch, char *argument)
{
    char buf[MAX_STRING_LENGTH];

    static char * const sky_look[4] =
    {
    "cloudless",
    "cloudy",
    "rainy",
    "lit by flashes of lightning"
    };

    if (!IS_OUTSIDE(ch))
    {
    send_to_char("You can't see the weather indoors.\n\r", ch);
    return;
    }

    if (IS_SET(sysdata.world, WORLD_ECLIPSE))
    send_to_char("The sun is eclipsed by the moon.\n\r", ch);

    if (IS_SET(sysdata.world, WORLD_FOG))
    send_to_char("A thick blanket of fog covers the ground.\n\r", ch);

    if (IS_SET(sysdata.world, WORLD_RAIN))
    {
    sprintf(buf, "The sky is pouring with a heavy rain and %s.\n\r",
    weather_info.change >= 0
    ? "a warm southerly breeze blows"
    : "a cold northern gust blows"
);
    send_to_char(buf, ch);
    return;
    }

    sprintf(buf, "The sky is %s and %s.\n\r",
    sky_look[weather_info.sky],
    weather_info.change >= 0
    ? "a warm southerly breeze blows"
    : "a cold northern gust blows"
);
    send_to_char(buf, ch);
    return;
}


void tracker_to_char(char *txt, CHAR_DATA *ch)
{
    char buf[MAX_STRING_LENGTH];
    int loop,wdth,ln;
    ln = strlen(txt);
    if (ln > 16)
    {
        sprintf(buf,"{D--------------------------------------------------------------------------------{n");
        wdth = (31 - ln) / 2 + 20;
    }
    else
    {

        sprintf(buf,"{D--------------------------------------------------------------------------------{n");
        wdth = (16 - ln) / 2 + 32;
    }
    for (loop = 0; loop < ln; loop++)
        buf[loop + wdth + 22] = txt[loop];
    cent_to_char(buf,ch);
}

/*
 * Main function of Similar Helpfiles. It loops through
 * all of the helpfiles, using the string matching function defined to
 * find the closest matching helpfiles to the argument. It then checks
 * for singles. Then, if matching helpfiles are found at all, it loops
 * through and prints out the closest matching helpfiles. If its a
 * single(there's only one), it opens the helpfile.
 */
void similar_help_files(CHAR_DATA *ch, char *argument)
{
   HELP_DATA *pHelp=NULL;
   char buf[MAX_STRING_LENGTH];
   char *extension;
   sh_int lvl=0;
   bool single=FALSE;

   page_to_char( "{CSimilar Help Files:\n\r", ch);

   for ( pHelp = help_first; pHelp; pHelp=pHelp->next)
   {
        buf[0]='\0';      
	extension = pHelp->keyword;
        
        if (pHelp->level > get_trust(ch))
           continue;

        while ( extension[0] != '\0' )
        {
              extension= one_argument(extension, buf);
              
              if ( str_similar(argument, buf) > lvl)
              {
                 lvl=str_similar(argument, buf);
                 single=TRUE;
              }        
              else if ( str_similar(argument, buf) == lvl && lvl > 0)
              {
                 single=FALSE;
              }
        }
    }
    if (lvl==0)
    {
       page_to_char( "{CNo similar help files.\n\r", ch);   
       return;
    }

    for ( pHelp = help_first; pHelp; pHelp=pHelp->next)
    {
        buf[0]='\0';      
	extension = pHelp->keyword;
        while ( extension[0] != '\0' )
        {
              extension=one_argument(extension, buf);

              if ( str_similar(argument, buf) >= lvl
                   && pHelp->level <= get_trust(ch))
              {
                 if (single)
                 {
                    page_to_char( "{COpening only similar helpfile.{x\n\r", ch);
                    do_help( ch, buf);
                    return;
                 }
		
                 pager_printf(ch, "'help %s'\n\r", pHelp->keyword);
                 break;

              }

        }
    }
    return;
}

void do_help( CHAR_DATA *ch, char *argument )
{
    char argall[MAX_INPUT_LENGTH];
    char argone[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    char origarg[MIL];
    HELP_DATA *pHelp;
    bool found;

    if ( argument[0] == '\0' )
	argument = "summary";
    sprintf(origarg,argument);

    /*
     * Tricky argument handling so 'help a b' doesn't match a.
     */
    argall[0] = '\0';
    while ( argument[0] != '\0' )
    {
	argument = one_argument( argument, argone );
	if ( argall[0] != '\0' )
	    strcat( argall, " " );
	strcat( argall, argone );
    }
    found = FALSE;

    for ( pHelp = help_first; pHelp != NULL; pHelp = pHelp->next )
    {
	if ( pHelp->level > get_trust( ch ) )
	{
	    found = TRUE;
	    continue;
        }
        if ( is_name( argall, pHelp->keyword ) )
        {
            if ( pHelp->level >= 0 && str_cmp( argall, "motd" ) )
               page_to_char( "\n\r", ch );
/*
	    if( str_cmp( argall, "wizlist" ) && str_cmp( argall, "motd") )
		text_bar( ch, all_capitalize(pHelp->keyword), TRUE );
*/
	    if( str_cmp( argall, "wizlist" ) && str_cmp( argall, "motd") )
	    {
		page_to_char( pHelp->keyword, ch );
		page_to_char("\n\r--------------------------------------------------------------------------------\n\r",ch );
	    }
//            if ( pHelp->level >= 0 && str_cmp( argall, "motd" ) )
//               page_to_char( "\n\r", ch );

            if ( pHelp->text[0] == '.' )
                page_to_char( pHelp->text+1, ch );
            else
                page_to_char( pHelp->text  , ch );
	    return;
	}
    }

    pager_printf( ch, "{CNo help on '%s' found.\n\r", origarg );
    similar_help_files(ch, origarg);
    
    if( !found )
    {
	sprintf(buf,"%s: %s",ch->name,origarg);
        ltf(buf,"../data/helps.dat",TRUE);
    }
    return;
}

int col_str_len(char *txt)
{
    int pos, len;

    len = 0;

    for (pos = 0; txt[pos] != '\0'; pos++)
    {
	if (txt[pos] == '{' || txt[pos] == '#')
	    pos ++;
        else
            len++;

	continue;
    }

    return len;
}

void cent_to_char(char *txt, CHAR_DATA *ch)
{
    int len,pos;
    char buf[MAX_STRING_LENGTH];

    len = (80 - col_str_len(txt)) / 2;
    for (pos = 0; pos < len; pos++)
    {
	buf[pos] = ' ';
    }
    buf[pos]= '\0';
    send_to_char(buf, ch);
    send_to_char(txt, ch);
    send_to_char("\n\r",ch);
}

void divide_to_char(CHAR_DATA *ch)
{
send_to_char("{b-------------------------------------------------------------------------------{x\r\n",
ch); }

void divide2_to_char(CHAR_DATA *ch)
{
send_to_char("{b-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-{x\r\n",
ch); }

void divide3_to_char(CHAR_DATA *ch)
{
send_to_char("===============================================================================\r\n",ch);
}

void divide4_to_char(CHAR_DATA *ch)
{
send_to_char("-=[**]=-=[**]=-=[**]=-=[**]=-=[**]=-=[***]=-=[**]=-=[**]=-=[**]=-=[**]=-=[**]=-\r\n",ch);
}

void divide5_to_char(CHAR_DATA *ch)
{
cent_to_char("-=[***********]=-------------=[***********]=-",ch);
}

void divide6_to_char(CHAR_DATA *ch)
{
cent_to_char("-    -   -  - - -- ---====*====--- -- - -  -   -    -",ch);
}

void banner_to_char(char *txt, CHAR_DATA *ch)
{
char buf[MAX_STRING_LENGTH];
int loop,wdth,ln;
ln = strlen(txt);
if (ln > 16)
{
	sprintf(buf, "-=[**]=-=[**]=-=[**]=-=[                               ]=-=[**]=-=[**]=-=[**]=-"); 
	wdth = (31 - ln) / 2 + 20;
}
else
{
	sprintf(buf,
"-=[**]=-=[**]=-=[**]=-=[**]=-=[                ]=-=[**]=-=[**]=-=[**]=-=[**]=-");
	wdth = (16 - ln) / 2 + 32;
}
for (loop = 0; loop < ln; loop++)
    buf[loop + wdth + 22] = txt[loop];
cent_to_char(buf,ch);
}

void banner2_to_char(char *txt, CHAR_DATA *ch)
{
char buf[MAX_STRING_LENGTH];
int loop,wdth,ln;
ln = strlen(txt);
if (ln > 16)
{
	sprintf(buf, "    -   -  - - -- ---===                               ===--- -- - -  -   -\r\n"); 
	wdth = (31 - ln) / 2 + 24;
}
else
{
	sprintf(buf, "     -    -   -  - - -- ---====                ====--- -- - -  -   -    -\r\n");
	wdth = (16 - ln) / 2 + 32;
}
for (loop = 0; loop < ln; loop++)
    buf[loop + wdth + 6] = txt[loop];
send_to_char(buf,ch);
}
/*
void do_bountylist(CHAR_DATA *ch, char *argument)
{
  char buf[MAX_STRING_LENGTH];
  DESCRIPTOR_DATA *d;
    
  stc("{c+{C={n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{W      BOUNTY LIST    {Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{C={c+{x\n\r",ch);
  stc("{c| {WName               Bounty     Status     Generation\n\r{x",ch);
  for ( d = descriptor_list; d != NULL; d = d->next )
  {
    if ( d->character != NULL )
    {
       if ( d->connected != CON_PLAYING) continue;
       if (CH(d)->level < 2) 
		continue;
       if (!can_see(ch, d->character)) 
		continue;
     
       sprintf(buf, "%-15s    %5d        %2d           %d",
	 CH(d)->name, PC(CH(d),bounty),
         CH(d)->race,GET_GEN(CH(d)));

       ch_printf( ch,"{c|{n %-48.48s {c|\n\r",buf);
    }
  }

  stc("{c+{C={n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{Do{n-{C={c+#n\n\r",ch);
  return;
}
*/


/*
 * One big nasty function
 */
char * status_level( char * buf, int status, int class )
{
   buf[0] = '\0';
   switch( class )
   {
   case CLASS_DEMON:
	     if( status >= 30 ) sprintf( buf, "{r Demon Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{r Master Demon{x" );
	else if( status >= 20 ) sprintf( buf, "{r  Elder Demon{x" );
	else if( status >= 15 ) sprintf( buf, "{r  Grand Demon{x" );
	else if( status >= 10 ) sprintf( buf, "{rGreater Demon{x" );
	else if( status >= 5 )  sprintf( buf, "{r        Demon{x" );
	else if( status >= 1 )  sprintf( buf, "{r Lesser Demon{x" );
	else 		        sprintf( buf, "{r Avatar Demon{x" );
	break;
   case CLASS_MAGE:
	     if( status >= 30 ) sprintf( buf, "{C  Mage Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{C  Master Mage{x" );
	else if( status >= 20 ) sprintf( buf, "{C   Elder Mage{x" );
	else if( status >= 15 ) sprintf( buf, "{C   Grand Mage{x" );
	else if( status >= 10 ) sprintf( buf, "{C Greater Mage{x" );
	else if( status >= 5 )  sprintf( buf, "{C         Mage{x" );
	else if( status >= 1 )  sprintf( buf, "{C  Lesser Mage{x" );
	else 		        sprintf( buf, "{C  Avatar Mage{x" );
	break;
   case CLASS_WEREWOLF:
	     if( status >= 30 ) sprintf( buf, "{G Garou Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{G Master Garou{x" );
	else if( status >= 20 ) sprintf( buf, "{G  Elder Garou{x" );
	else if( status >= 15 ) sprintf( buf, "{G  Grand Garou{x" );
	else if( status >= 10 ) sprintf( buf, "{GGreater Garou{x" );
	else if( status >= 5 )  sprintf( buf, "{G        Garou{x" );
	else if( status >= 1 )  sprintf( buf, "{G Lesser Garou{x" );
	else 		        sprintf( buf, "{G Avatar Garou{x" );
	break;
   case CLASS_VAMPIRE:
	     if( status >= 30 ) sprintf( buf, "{RVampireLegend{x" );
	else if( status >= 25 ) sprintf( buf, "{R  Master Vamp{x" );
	else if( status >= 20 ) sprintf( buf, "{RElder Vampire{x" );
	else if( status >= 15 ) sprintf( buf, "{RGrand Vampire{x" );
	else if( status >= 10 ) sprintf( buf, "{R Greater Vamp{x" );
	else if( status >= 5 )  sprintf( buf, "{R      Vampire{x" );
	else if( status >= 1 )  sprintf( buf, "{R  Lesser Vamp{x" );
	else 		        sprintf( buf, "{R  Avatar Vamp{x" );
	break;
   case CLASS_DROW:
	     if( status >= 30 ) sprintf( buf, "{M  Drow Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{M  Master Drow{x" );
	else if( status >= 20 ) sprintf( buf, "{M   Elder Drow{x" );
	else if( status >= 15 ) sprintf( buf, "{M   Grand Drow{x" );
	else if( status >= 10 ) sprintf( buf, "{M Greater Drow{x" );
	else if( status >= 5 )  sprintf( buf, "{M         Drow{x" );
	else if( status >= 1 )  sprintf( buf, "{M  Lesser Drow{x" );
	else 		        sprintf( buf, "{M  Avatar Drow{x" );
	break;
   case CLASS_NINJA:
	     if( status >= 30 ) sprintf( buf, "{m Ninja Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{m Master Ninja{x" );
	else if( status >= 20 ) sprintf( buf, "{m  Elder Ninja{x" );
	else if( status >= 15 ) sprintf( buf, "{m  Grand Ninja{x" );
	else if( status >= 10 ) sprintf( buf, "{mGreater Ninja{x" );
	else if( status >= 5 )  sprintf( buf, "{m        Ninja{x" );
	else if( status >= 1 )  sprintf( buf, "{m Lesser Ninja{x" );
	else 		        sprintf( buf, "{m Avatar Ninja{x" );
	break;
   case CLASS_MONK:
	     if( status >= 30 ) sprintf( buf, "{c  Monk Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{c  Master Monk{x" );
	else if( status >= 20 ) sprintf( buf, "{c   Elder Monk{x" );
	else if( status >= 15 ) sprintf( buf, "{c   Grand Monk{x" );
	else if( status >= 10 ) sprintf( buf, "{c Greater Monk{x" );
	else if( status >= 5 )  sprintf( buf, "{c         Monk{x" );
	else if( status >= 1 )  sprintf( buf, "{c  Lesser Monk{x" );
	else 		        sprintf( buf, "{c  Avatar Monk{x" );
	break;
   case CLASS_ANGEL:
	     if( status >= 30 ) sprintf( buf, "{W Angel Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{W Master Angel{x" );
	else if( status >= 20 ) sprintf( buf, "{W  Elder Angel{x" );
	else if( status >= 15 ) sprintf( buf, "{W  Grand Angel{x" );
	else if( status >= 10 ) sprintf( buf, "{WGreater Angel{x" );
	else if( status >= 5 )  sprintf( buf, "{W        Angel{x" );
	else if( status >= 1 )  sprintf( buf, "{W Lesser Angel{x" );
	else 		        sprintf( buf, "{W Avatar Angel{x" );
	break;
   case CLASS_PRIEST:
	     if( status >= 30 ) sprintf( buf, "{BPriest Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{BMaster Priest{x" );
	else if( status >= 20 ) sprintf( buf, "{B Elder Priest{x" );
	else if( status >= 15 ) sprintf( buf, "{B Grand Priest{x" );
	else if( status >= 10 ) sprintf( buf, "{BGreaterPriest{x" );
	else if( status >= 5 )  sprintf( buf, "{B       Priest{x" );
	else if( status >= 1 )  sprintf( buf, "{BLesser Priest{x" );
	else 		        sprintf( buf, "{BAvatar Priest{x" );
	break;
   default:
	     if( status >= 30 ) sprintf( buf, "{YImmort Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{YMaster Immort{x" );
	else if( status >= 20 ) sprintf( buf, "{YElderImmortal{x" );
	else if( status >= 15 ) sprintf( buf, "{YGrandImmortal{x" );
	else if( status >= 10 ) sprintf( buf, "{Y  Greater God{x" );
	else if( status >= 5  ) sprintf( buf, "{Y      DemiGod{x" );
	else if( status >= 1  ) sprintf( buf, "{Y   Lesser God{x" );
	else 		        sprintf( buf, "{Y       Avatar{x" );
	break;

   }
  
   return buf;
}

/*
 * Left alignment of the top function
 */
char * status_level2( char * buf, int status, int class )
{
   buf[0] = '\0';
   switch( class )
   {
   case CLASS_DEMON:
	     if( status >= 30 ) sprintf( buf, "{rDemon Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{rMaster Demon{x" );
	else if( status >= 20 ) sprintf( buf, "{rElder Demon{x" );
	else if( status >= 15 ) sprintf( buf, "{rGrand Demon{x" );
	else if( status >= 10 ) sprintf( buf, "{rGreater Demon{x" );
	else if( status >= 5 )  sprintf( buf, "{rDemon{x" );
	else if( status >= 1 )  sprintf( buf, "{rLesser Demon{x" );
	else 		        sprintf( buf, "{rAvatar Demon{x" );
	break;
   case CLASS_MAGE:
	     if( status >= 30 ) sprintf( buf, "{CMage Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{CMaster Mage{x" );
	else if( status >= 20 ) sprintf( buf, "{CElder Mage{x" );
	else if( status >= 15 ) sprintf( buf, "{CGrand Mage{x" );
	else if( status >= 10 ) sprintf( buf, "{CGreater Mage{x" );
	else if( status >= 5 )  sprintf( buf, "{CMage{x" );
	else if( status >= 1 )  sprintf( buf, "{CLesser Mage{x" );
	else 		        sprintf( buf, "{CAvatar Mage{x" );
	break;
   case CLASS_WEREWOLF:
	     if( status >= 30 ) sprintf( buf, "{GGarou Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{GMaster Garou{x" );
	else if( status >= 20 ) sprintf( buf, "{GElder Garou{x" );
	else if( status >= 15 ) sprintf( buf, "{GGrand Garou{x" );
	else if( status >= 10 ) sprintf( buf, "{GGreater Garou{x" );
	else if( status >= 5 )  sprintf( buf, "{GGarou{x" );
	else if( status >= 1 )  sprintf( buf, "{GLesser Garou{x" );
	else 		        sprintf( buf, "{GAvatar Garou{x" );
	break;
   case CLASS_VAMPIRE:
	     if( status >= 30 ) sprintf( buf, "{RVampire Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{RMaster Vampire{x" );
	else if( status >= 20 ) sprintf( buf, "{RElder Vampire{x" );
	else if( status >= 15 ) sprintf( buf, "{RGrand Vampire{x" );
	else if( status >= 10 ) sprintf( buf, "{RGreater Vampire{x" );
	else if( status >= 5 )  sprintf( buf, "{RVampire{x" );
	else if( status >= 1 )  sprintf( buf, "{RLesser Vampire{x" );
	else 		        sprintf( buf, "{RAvatar Vampire{x" );
	break;
   case CLASS_DROW:
	     if( status >= 30 ) sprintf( buf, "{MDrow Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{MMaster Drow{x" );
	else if( status >= 20 ) sprintf( buf, "{MElder Drow{x" );
	else if( status >= 15 ) sprintf( buf, "{MGrand Drow{x" );
	else if( status >= 10 ) sprintf( buf, "{MGreater Drow{x" );
	else if( status >= 5 )  sprintf( buf, "{MDrow{x" );
	else if( status >= 1 )  sprintf( buf, "{MLesser Drow{x" );
	else 		        sprintf( buf, "{MAvatar Drow{x" );
	break;
   case CLASS_NINJA:
	     if( status >= 30 ) sprintf( buf, "{mNinja Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{mMaster Ninja{x" );
	else if( status >= 20 ) sprintf( buf, "{mElder Ninja{x" );
	else if( status >= 15 ) sprintf( buf, "{mGrand Ninja{x" );
	else if( status >= 10 ) sprintf( buf, "{mGreater Ninja{x" );
	else if( status >= 5 )  sprintf( buf, "{mNinja{x" );
	else if( status >= 1 )  sprintf( buf, "{mLesser Ninja{x" );
	else 		        sprintf( buf, "{mAvatar Ninja{x" );
	break;
   case CLASS_MONK:
	     if( status >= 30 ) sprintf( buf, "{cMonk Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{cMaster Monk{x" );
	else if( status >= 20 ) sprintf( buf, "{cElder Monk{x" );
	else if( status >= 15 ) sprintf( buf, "{cGrand Monk{x" );
	else if( status >= 10 ) sprintf( buf, "{cGreater Monk{x" );
	else if( status >= 5 )  sprintf( buf, "{cMonk{x" );
	else if( status >= 1 )  sprintf( buf, "{cLesser Monk{x" );
	else 		        sprintf( buf, "{cAvatar Monk{x" );
	break;
   case CLASS_ANGEL:
	     if( status >= 30 ) sprintf( buf, "{WAngel Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{WMaster Angel{x" );
	else if( status >= 20 ) sprintf( buf, "{WElder Angel{x" );
	else if( status >= 15 ) sprintf( buf, "{WGrand Angel{x" );
	else if( status >= 10 ) sprintf( buf, "{WGreater Angel{x" );
	else if( status >= 5 )  sprintf( buf, "{WAngel{x" );
	else if( status >= 1 )  sprintf( buf, "{WLesser Angel{x" );
	else 		        sprintf( buf, "{WAvatar Angel{x" );
	break;
   case CLASS_PRIEST:
	     if( status >= 30 ) sprintf( buf, "{BPriest Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{BMaster Priest{x" );
	else if( status >= 20 ) sprintf( buf, "{BElder Priest{x" );
	else if( status >= 15 ) sprintf( buf, "{BGrand Priest{x" );
	else if( status >= 10 ) sprintf( buf, "{BGreater Priest{x" );
	else if( status >= 5 )  sprintf( buf, "{BPriest{x" );
	else if( status >= 1 )  sprintf( buf, "{BLesser Priest{x" );
	else 		        sprintf( buf, "{BAvatar Priest{x" );
	break;
   default:
	     if( status >= 30 ) sprintf( buf, "{YImmortal Legend{x" );
	else if( status >= 25 ) sprintf( buf, "{YMaster Immortal{x" );
	else if( status >= 20 ) sprintf( buf, "{YElder Immortal{x" );
	else if( status >= 15 ) sprintf( buf, "{YGrand Immortal{x" );
	else if( status >= 10 ) sprintf( buf, "{YGreater God{x" );
	else if( status >= 5  ) sprintf( buf, "{YDemiGod{x" );
	else if( status >= 1  ) sprintf( buf, "{YLesser God{x" );
	else 		        sprintf( buf, "{YAvatar{x" );
	break;

   }
  
   return buf;
}

/* Feh */
char * status_level3( char * buf, int status, int class )
{
   buf[0] = '\0';
   switch( class )
   {
   case CLASS_DEMON:
             if( status >= 30 ) sprintf( buf, "{mDemon Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Demon" );
        else if( status >= 20 ) sprintf( buf, "{mElder Demon" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Demon" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Demon" );
        else if( status >= 5 )  sprintf( buf, "{mDemon" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Demon" );
        else                    sprintf( buf, "{mAvatar Demon" );
        break;
   case CLASS_MAGE:
             if( status >= 30 ) sprintf( buf, "{mMage Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Mage" );
        else if( status >= 20 ) sprintf( buf, "{mElder Mage" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Mage" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Mage" );
        else if( status >= 5 )  sprintf( buf, "{mMage" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Mage" );
        else                    sprintf( buf, "{mAvatar Mage" );
        break;    
   case CLASS_WEREWOLF:
             if( status >= 30 ) sprintf( buf, "{mGarou Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Garou" );
        else if( status >= 20 ) sprintf( buf, "{mElder Garou" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Garou" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Garou" );
        else if( status >= 5 )  sprintf( buf, "{mGarou" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Garou" );
        else                    sprintf( buf, "{mAvatar Garou" );
        break;
   case CLASS_VAMPIRE:
             if( status >= 30 ) sprintf( buf, "{mVampire Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Vamp" );
        else if( status >= 20 ) sprintf( buf, "{mElder Vampire" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Vampire" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Vamp" );
        else if( status >= 5 )  sprintf( buf, "{mVampire" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Vamp" );
        else                    sprintf( buf, "{mAvatar Vamp" );
        break;
   case CLASS_DROW:
             if( status >= 30 ) sprintf( buf, "{mDrow Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Drow" );
        else if( status >= 20 ) sprintf( buf, "{mElder Drow" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Drow" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Drow" );
        else if( status >= 5 )  sprintf( buf, "{mDrow" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Drow" );
        else                    sprintf( buf, "{mAvatar Drow" );
        break;
   case CLASS_NINJA:
             if( status >= 30 ) sprintf( buf, "{mNinja Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Ninja" );
        else if( status >= 20 ) sprintf( buf, "{mElder Ninja" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Ninja" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Ninja" );
        else if( status >= 5 )  sprintf( buf, "{mNinja" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Ninja" );
        else                    sprintf( buf, "{mAvatar Ninja" );
        break;
   case CLASS_MONK:
             if( status >= 30 ) sprintf( buf, "{mMonk Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Monk" );
        else if( status >= 20 ) sprintf( buf, "{mElder Monk" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Monk" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Monk" );
        else if( status >= 5 )  sprintf( buf, "{mMonk" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Monk" );
        else                    sprintf( buf, "{mAvatar Monk" );
        break;
   case CLASS_ANGEL:
             if( status >= 30 ) sprintf( buf, "{mAngel Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Angel" );
        else if( status >= 20 ) sprintf( buf, "{mElder Angel" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Angel" );
        else if( status >= 10 ) sprintf( buf, "{mGreater Angel" );
        else if( status >= 5 )  sprintf( buf, "{mAngel" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Angel" );
        else                    sprintf( buf, "{mAvatar Angel" );
        break;
   case CLASS_PRIEST:
             if( status >= 30 ) sprintf( buf, "{mPriest Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Priest" );
        else if( status >= 20 ) sprintf( buf, "{mElder Priest" );
        else if( status >= 15 ) sprintf( buf, "{mGrand Priest" );
        else if( status >= 10 ) sprintf( buf, "{mGreaterPriest" );
        else if( status >= 5 )  sprintf( buf, "{mPriest" );
        else if( status >= 1 )  sprintf( buf, "{mLesser Priest" );
        else                    sprintf( buf, "{mAvatar Priest" );
        break;
   default:
             if( status >= 30 ) sprintf( buf, "{mImmort Legend" );
        else if( status >= 25 ) sprintf( buf, "{mMaster Immort" );
        else if( status >= 20 ) sprintf( buf, "{mElderImmortal" );
        else if( status >= 15 ) sprintf( buf, "{mGrandImmortal" );
        else if( status >= 10 ) sprintf( buf, "{mGreater God" );
        else if( status >= 5  ) sprintf( buf, "{mDemiGod" );
        else if( status >= 1  ) sprintf( buf, "{mLesser God" );
        else                    sprintf( buf, "{mAvatar" );
        break;
        
   }
   
   return buf;
}

/*
 * New 'who' command originally by Alander of Rivers of Mud.
 * Rewrite by Tracker with help from Dreimas
 */
void do_who( CHAR_DATA *ch, char *argument )
{
     if( IS_NPC(ch) )
	return;

  if (ch->pcdata->stats[WHOTYPE] == 1)
  { do_testwho(ch,"");}
  else if (ch->pcdata->stats[WHOTYPE] == 2)
  { do_bountylist(ch,""); }
  else if (ch->pcdata->stats[WHOTYPE] == 3)
  { do_newwho(ch,""); }
  else
  { do_testwho(ch,"");}
  return;
}


void do_inventory( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_INPUT_LENGTH];
    OBJ_DATA *obj;
    OBJ_DATA *portal;
    OBJ_DATA *portal_next;
    ROOM_INDEX_DATA *pRoomIndex;
    ROOM_INDEX_DATA *location;
    bool found;

    if (!IS_NPC(ch) && IS_HEAD(ch,LOST_HEAD))
        {send_to_char( "You are not a container.\n\r", ch ); return;}
    else if (!IS_NPC(ch) && IS_EXTRA(ch,EXTRA_OSWITCH))
    {
        if ( !IS_NPC(ch) && (obj = ch->pcdata->chobj) == NULL)
	    {send_to_char( "You are not a container.\n\r", ch ); return;}
	switch ( obj->item_type )
	{
	default:
	    send_to_char( "You are not a container.\n\r", ch );
	    break;

	case ITEM_PORTAL:
	    pRoomIndex = get_room_index(obj->value[0]);
	    location = ch->in_room;
	    if ( pRoomIndex == NULL )
	    {
		send_to_char( "You don't seem to lead anywhere.\n\r", ch );
		return;
	    }
	    char_from_room(ch);
	    char_to_room(ch,pRoomIndex);

	    found = FALSE;
	    for ( portal = ch->in_room->contents; portal != NULL; portal = portal_next )
	    {
		portal_next = portal->next_content;
		if ( ( obj->value[0] == portal->value[3]  )
		    && (obj->value[3] == portal->value[0]) )
		{
		    found = TRUE;
		    if (IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
			!IS_SET(portal->extra_flags, ITEM_SHADOWPLANE) )
		    {
			REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
	    		do_look(ch,"auto");
			SET_BIT(ch->affected_by, AFF_SHADOWPLANE);
			break;
		    }
		    else if (!IS_AFFECTED(ch, AFF_SHADOWPLANE) &&
			IS_SET(portal->extra_flags, ITEM_SHADOWPLANE) )
		    {
			SET_BIT(ch->affected_by, AFF_SHADOWPLANE);
	    		do_look(ch,"auto");
			REMOVE_BIT(ch->affected_by, AFF_SHADOWPLANE);
			break;
		    }
		    else
		    {
	    		do_look(ch,"auto");
			break;
		    }
	    	}
	    }
	    char_from_room(ch);
	    char_to_room(ch,location);
	    break;

	case ITEM_DRINK_CON:
	    if ( obj->value[1] <= 0 )
	    {
		send_to_char( "You are empty.\n\r", ch );
		break;
	    }
	    if (obj->value[1] < obj->value[0] / 5)
	    	sprintf( buf, "There is a little %s liquid left in you.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 4)
	    	sprintf( buf, "You contain a small about of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 3)
	    	sprintf( buf, "You're about a third full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0] / 2)
	    	sprintf( buf, "You're about half full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] < obj->value[0])
	    	sprintf( buf, "You are almost full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else if (obj->value[1] == obj->value[0])
	    	sprintf( buf, "You're completely full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    else
	    	sprintf( buf, "Somehow you are MORE than full of %s liquid.\n\r",liq_table[obj->value[2]].liq_color);
	    send_to_char( buf, ch );
	    break;

	case ITEM_CONTAINER:
	case ITEM_CORPSE_NPC:
	case ITEM_CORPSE_PC:
	    act( "$p contain:", ch, obj, NULL, TO_CHAR );
	    show_list_to_char( obj->contains, ch, TRUE, TRUE );
	    break;
	}
	return;
    }
    send_to_char( "You are carrying:\n\r", ch );
    show_list_to_char( ch->carrying, ch, TRUE, TRUE );
    return;
}



void do_equipment( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *obj;
    int iWear;
    bool found;

    send_to_char( "You are using:\n\r", ch );
    found = FALSE;
    for ( iWear = 0; iWear < MAX_WEAR; iWear++ )
    {
	if( ( where_name[iWear].place == WEAR_THIRD 
	   || where_name[iWear].place == WEAR_FOURTH )
	   && !IS_CLASS(ch,CLASS_DROW) 
	   && !IS_CLASS(ch,CLASS_DEMON) )
		continue;

	obj = get_eq_char( ch, where_name[iWear].place );
	
	send_to_char( where_name[iWear].name, ch );
	if( !obj )
	    stc( "\n\r",ch);
	else if ( can_see_obj( ch, obj ) )
	{
	    send_to_char( format_obj_to_char( obj, ch, TRUE ), ch );
	    send_to_char( "\n\r", ch );
	}
	else
	{
	    send_to_char( "something.\n\r", ch );
	}
	found = TRUE;
    }

    if ( !found )
	send_to_char( "Nothing.\n\r", ch );

    return;
}

void do_compare( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    OBJ_DATA *obj1;
    OBJ_DATA *obj2;
    int value1;
    int value2;
    char *msg;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
    if ( arg1[0] == '\0' )
    {
	send_to_char( "Compare what to what?\n\r", ch );
	return;
    }

    if ( ( obj1 = get_obj_carry( ch, arg1 ) ) == NULL )
    {
	send_to_char( "You do not have that item.\n\r", ch );
	return;
    }

    if ( arg2[0] == '\0' )
    {
	for ( obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content )
	{
	    if ( obj2->wear_loc != WEAR_NONE
	    &&   can_see_obj( ch, obj2 )
	    &&   obj1->item_type == obj2->item_type
	    && ( obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0 )
		break;
	}

	if ( obj2 == NULL )
	{
	    send_to_char( "You aren't wearing anything comparable.\n\r", ch );
	    return;
	}
    }
    else
    {
	if ( ( obj2 = get_obj_carry( ch, arg2 ) ) == NULL )
	{
	    send_to_char( "You do not have that item.\n\r", ch );
	    return;
	}
    }
	    
    msg		= NULL;
    value1	= 0;
    value2	= 0;

    if ( obj1 == obj2 )
    {
	msg = "You compare $p to itself.  It looks about the same.";
    }
    else if ( obj1->item_type != obj2->item_type )
    {
	msg = "You can't compare $p and $P.";
    }
    else
    {
	switch ( obj1->item_type )
	{
	default:
	    msg = "You can't compare $p and $P.";
	    break;

	case ITEM_ARMOR:
	    value1 = obj1->value[0];
	    value2 = obj2->value[0];
	    break;

	case ITEM_WEAPON:
	    value1 = obj1->value[1] + obj1->value[2];
	    value2 = obj2->value[1] + obj2->value[2];
	    break;
	}
    }

    if ( msg == NULL )
    {
	     if ( value1 == value2 ) msg = "$p and $P look about the same.";
	else if ( value1  > value2 ) msg = "$p looks better than $P.";
	else                         msg = "$p looks worse than $P.";
    }

    act( msg, ch, obj1, obj2, TO_CHAR );
    return;
}



void do_credits( CHAR_DATA *ch, char *argument )
{
    do_help( ch, "diku" );
    return;
}



void do_wizlist( CHAR_DATA *ch, char *argument )
{
    do_help( ch, "wizlist" );
    return;
}



void do_where( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    DESCRIPTOR_DATA *d;
    bool found;

    one_argument( argument, arg );


   if (IS_SET(sysdata.world, WORLD_FOG))
    {
    send_to_char("It is too foggy to locate anyone.\n\r",ch);
    return;
    }


    if ( arg[0] == '\0' )
    {
	send_to_char( "Players near you:\n\r", ch );
	found = FALSE;
	for ( d = descriptor_list; d != NULL; d = d->next )
	{
	    if ( d->connected == CON_PLAYING
	    && ( victim = d->character ) != NULL
	    &&   !IS_NPC(victim)
	    &&   victim->in_room
	    &&   victim->in_room->area == ch->in_room->area
	    &&   !victim->pcdata->chobj
	    &&   can_see( ch, victim ) )
	    {
		found = TRUE;
		sprintf( buf, "%-28s %s\n\r",
		    victim->name, victim->in_room->name );
		send_to_char( buf, ch );
	    }
	}
	if ( !found )
	    send_to_char( "None\n\r", ch );
    }
    else
    {
	found = FALSE;
	for ( victim = char_list; victim != NULL; victim = victim->next )
	{
	    if ( victim->in_room != NULL
	    &&   victim->in_room->area == ch->in_room->area
	    &&   !IS_AFFECTED(victim, AFF_HIDE)
	    &&   !IS_AFFECTED(victim, AFF_SNEAK)
	    &&   can_see( ch, victim )
	    &&   is_name( arg, victim->name ) )
	    {
		found = TRUE;
		sprintf( buf, "%-28s %s\n\r",
		    PERS(victim, ch), victim->in_room->name );
		send_to_char( buf, ch );
		break;
	    }
	}
	if ( !found )
	    act( "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
    }

    return;
}




void do_consider( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    char *msg;
    int diff;
    int overall;
    int con_hit;
    int con_dam;
    int con_ac;
    int con_hp;

    one_argument( argument, arg );
    overall = 0;

    if ( arg[0] == '\0' )
    {
	send_to_char( "Consider killing whom?\n\r", ch );
	return;
    }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	send_to_char( "They're not here.\n\r", ch );
	return;
    }

    act( "You examine $N closely, looking for $S weaknesses.", ch, NULL, victim, TO_CHAR );
    act( "$n examine $N closely, looking for $S weaknesses.", ch, NULL, victim, TO_NOTVICT );
    act( "$n examines you closely, looking for your weaknesses.", ch, NULL, victim, TO_VICT );

    if (!IS_NPC(victim)) do_skill(ch,victim->name);

    if (!IS_NPC(victim) && IS_CLASS(victim, CLASS_VAMPIRE) && 
	IS_EXTRA(victim, EXTRA_FAKE_CON))
    {
	con_hit = victim->pcdata->fake_hit;
	con_dam = victim->pcdata->fake_dam;
	con_ac = victim->pcdata->fake_ac;
	con_hp = victim->pcdata->fake_hp;
    }
    else
    {
	con_hit = char_hitroll(victim);
	con_dam = char_damroll(victim);
	con_ac = char_ac(victim);
	con_hp = victim->hit;
    }
    if (con_hp < 1) con_hp = 1;

    diff = victim->level - ch->level + con_hit - char_hitroll(ch);
         if ( diff <= -35 ) {msg = "You are FAR more skilled than $M."; overall = overall + 3;}
    else if ( diff <= -15 ) {msg = "$E is not as skilled as you are."; overall = overall + 2;}
    else if ( diff <=  -5 ) {msg = "$E doesn't seem quite as skilled as you."; overall = overall + 1;}
    else if ( diff <=   5 ) {msg = "You are about as skilled as $M.";}
    else if ( diff <=  15 ) {msg = "$E is slightly more skilled than you are."; overall = overall - 1;}
    else if ( diff <=  35 ) {msg = "$E seems more skilled than you are."; overall = overall -2;}
    else                    {msg = "$E is FAR more skilled than you."; overall = overall - 3;}
    act( msg, ch, NULL, victim, TO_CHAR );

    diff = victim->level - ch->level + con_dam - char_damroll(ch);
         if ( diff <= -35 ) {msg = "You are FAR more powerful than $M."; overall = overall + 3;}
    else if ( diff <= -15 ) {msg = "$E is not as powerful as you are."; overall = overall + 2;}
    else if ( diff <=  -5 ) {msg = "$E doesn't seem quite as powerful as you."; overall = overall + 1;}
    else if ( diff <=   5 ) {msg = "You are about as powerful as $M.";}
    else if ( diff <=  15 ) {msg = "$E is slightly more powerful than you are."; overall = overall - 1;}
    else if ( diff <=  35 ) {msg = "$E seems more powerful than you are."; overall = overall -2;}
    else                    {msg = "$E is FAR more powerful than you."; overall = overall - 3;}
    act( msg, ch, NULL, victim, TO_CHAR );

    diff = ch->hit * 100 / con_hp;
         if ( diff <=  10 ) {msg = "$E is currently FAR healthier than you are."; overall = overall - 3;}
    else if ( diff <=  50 ) {msg = "$E is currently much healthier than you are."; overall = overall - 2;}
    else if ( diff <=  75 ) {msg = "$E is currently slightly healthier than you are."; overall = overall - 1;}
    else if ( diff <= 125 ) {msg = "$E is currently about as healthy as you are.";}
    else if ( diff <= 200 ) {msg = "You are currently slightly healthier than $M."; overall = overall + 1;}
    else if ( diff <= 500 ) {msg = "You are currently much healthier than $M."; overall = overall + 2;}
    else                    {msg = "You are currently FAR healthier than $M."; overall = overall + 3;}
    act( msg, ch, NULL, victim, TO_CHAR );

    diff = con_ac - char_ac(ch);
         if ( diff <= -100) {msg = "$E is FAR better armoured than you."; overall = overall - 3;}
    else if ( diff <= -50 ) {msg = "$E looks much better armoured than you."; overall = overall - 2;}
    else if ( diff <= -25 ) {msg = "$E looks better armoured than you."; overall = overall - 1;}
    else if ( diff <=  25 ) {msg = "$E seems about as well armoured as you.";}
    else if ( diff <=  50 ) {msg = "You are better armoured than $M."; overall = overall + 1;}
    else if ( diff <=  100) {msg = "You are much better armoured than $M."; overall = overall + 2;}
    else                    {msg = "You are FAR better armoured than $M."; overall = overall + 3;}
    act( msg, ch, NULL, victim, TO_CHAR );

    diff = overall;
         if ( diff <= -11 ) msg = "Conclusion: $E would kill you in seconds.";
    else if ( diff <=  -7 ) msg = "Conclusion: You would need a lot of luck to beat $M.";
    else if ( diff <=  -3 ) msg = "Conclusion: You would need some luck to beat $N.";
    else if ( diff <=   2 ) msg = "Conclusion: It would be a very close fight.";
    else if ( diff <=   6 ) msg = "Conclusion: You shouldn't have a lot of trouble defeating $M.";
    else if ( diff <=  10 ) msg = "Conclusion: $N is no match for you.  You can easily beat $M.";
    else                    msg = "Conclusion: $E wouldn't last more than a few seconds against you.";
    act( msg, ch, NULL, victim, TO_CHAR );

    return;
}

void set_prefix( CHAR_DATA *ch, char *prefix )
{
    char buf[MAX_STRING_LENGTH];

    if ( IS_NPC(ch) )
    {
	bug( "Set_title: NPC.", 0 );
	return;
    }

    if ( isalpha(prefix[0]) || isdigit(prefix[0]) )
    {
	strcpy( buf, prefix );
    }
    else
    {
	strcpy( buf, prefix );
    }

    free_string( ch->prefix );
    ch->prefix = str_dup( buf );
    return;
}



void do_prefix( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) )
	return;

if ( !str_cmp( argument, "none" ))
{
free_string( ch->prefix );
return;
} 
   if ( argument[0] == '\0' )
    {
	send_to_char( "Change your prefix to what?\n\r", ch );
	return;
    }

    if ( strlen(argument) > 13 )
	argument[13] = '\0';

    smash_tilde( argument );
    set_prefix( ch, argument );
    send_to_char( "Prefix Set.\n\r", ch );
}


void set_title( CHAR_DATA *ch, char *title )
{
    char buf[MAX_STRING_LENGTH];

    if ( IS_NPC(ch) )
    {
	bug( "Set_title: NPC.", 0 );
	return;
    }

    if ( isalpha(title[0]) || isdigit(title[0]) )
    {
	buf[0] = ' ';
	strcpy( buf+1, title );
    }
    else
    {
	strcpy( buf, title );
    }

    free_string( ch->pcdata->title );
    ch->pcdata->title = str_dup( buf );
    return;
}



void do_title( CHAR_DATA *ch, char *argument )
{
/*    int i;*/
    if ( IS_NPC(ch) )
	return;

    if (IS_IMMORTAL(ch))
    {
       send_to_char("You must use 'immtitle', immortals don't have titles\n\rthus it is used for immtitle.",ch);
       return;
    }

    if ( argument[0] == '\0' )
    {
	send_to_char( "Change your title to what?\n\r", ch );
	return;
    }

/*    for ( i = 0; i < strlen(argument); i++ )
    {
        if (( argument[i] == '#' ) || (argument[i] == '{' ) || (argument[i] == '`' ))
	{
	    stc("You cannot use color in titles.\n\r",ch);
	    return;
	}
    }*/

    if ( strlen(argument) > 38 )
    {
	argument[37] = ' ';
        argument[38] = '\0';
    }

    smash_tilde( argument );
    set_title( ch, argument );
    send_to_char( "Ok.\n\r", ch );
}


void do_afk( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];

	if ( IS_NPC(ch) )
	return;

        if (IS_SET(ch->flag2, EXTRA_AFK))
	{
	free_string( ch->pcdata->title);
	ch->pcdata->title = str_dup( ch->short_descr );
	free_string( ch->short_descr );
	ch->short_descr = NULL;
	send_to_char( "You are no longer AFK.\n\r", ch );
	sprintf(buf,"%s is no longer AFK!",ch->name);
        ADD_COLOUR(ch,buf,L_RED);
	do_info(ch,buf);
	REMOVE_BIT(ch->flag2,EXTRA_AFK);
        return;
	}
	
	else if (!IS_SET(ch->flag2,EXTRA_AFK))
	{
	free_string( ch->short_descr );
	ch->short_descr = str_dup( ch->pcdata->title );
	free_string( ch->pcdata->title );
	ch->pcdata->title = str_dup("..IS AFK");
	send_to_char( "You are now AFK.\n\r", ch );
	sprintf(buf,"%s is now AFK!",ch->name);
	ADD_COLOUR(ch,buf,L_RED);
	do_info(ch,buf);
	SET_BIT(ch->flag2,EXTRA_AFK);
	WAIT_STATE(ch, 25);
        return;
	}

else
return;

}



void do_email( CHAR_DATA *ch, char *argument )
{
    if ( IS_NPC(ch) )
	return;

    if ( argument[0] == '\0' )
    {
	send_to_char( "What do you wish to set your email address to?\n\r", ch );
	return;
    }

    if ( strlen(argument) > 50 )
	argument[50] = '\0';

    smash_tilde( argument );
    free_string( ch->pcdata->email );
    ch->pcdata->email = str_dup( argument );
    send_to_char( "Ok.\n\r", ch );
}



void do_description( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    int i;

    if ( argument[0] != '\0' )
    {
        for ( i = 0; i < strlen(argument); i++ )
	{
	        if (( argument[i] == '#' ) || argument[i] == '{' )
	        {
	            send_to_char("No color in that please.\n\r",ch);
	            return;
	        }
 
        }
    
    }

   
    if( !str_cmp( argument, "write" ) )
    {
	string_append( ch, &ch->description );
	return;
    }
	
    buf[0] = '\0';
    smash_tilde( argument );

    if( argument[0] != '\0' )
    {
	if ( argument[0] == '+' )
	{
	    if ( ch->description != NULL )
		strcat( buf, ch->description );
	    argument++;
	    while ( isspace(*argument) )
		argument++;
	}

	if ( strlen(buf) + strlen(argument) >= MAX_STRING_LENGTH - 2 )
	{
	    send_to_char( "Description too long.\n\r", ch );
	    return;
	}

	strcat( buf, argument );
	strcat( buf, "\n\r" );
	free_string( ch->description );
	ch->description = str_dup( buf );
    }
    if( !ch->description )
 	send_to_char( "You have no current description set.  Please see 'help descripton'\n\r", ch );
    else
    {
        send_to_char( "Your description is:\n\r", ch );
        send_to_char( ch->description , ch );
    }
	
    return;
}



void do_report( CHAR_DATA *ch, char *argument )
{
    CHAR_DATA *vch;
    CHAR_DATA *vch_next;
    char buf[MAX_STRING_LENGTH];
    char hit_str[MAX_INPUT_LENGTH];
    char mana_str[MAX_INPUT_LENGTH];
    char move_str[MAX_INPUT_LENGTH];
    char mhit_str[MAX_INPUT_LENGTH];
    char mmana_str[MAX_INPUT_LENGTH];
    char mmove_str[MAX_INPUT_LENGTH];
    char exp_str[MAX_INPUT_LENGTH];
    sprintf(hit_str, "%ld", ch->hit);
    COL_SCALE(hit_str, ch, ch->hit, ch->max_hit);
    sprintf(mana_str, "%ld", ch->mana);
    COL_SCALE(mana_str, ch, ch->mana, ch->max_mana);
    sprintf(move_str, "%ld", ch->move);
    COL_SCALE(move_str, ch, ch->move, ch->max_move);
    sprintf(exp_str, "%d", ch->exp);
    COL_SCALE(exp_str, ch, ch->exp, 1000);
    sprintf(mhit_str, "%ld", ch->max_hit);
    ADD_COLOUR(ch, mhit_str, L_CYAN);
    sprintf(mmana_str, "%ld", ch->max_mana);
    ADD_COLOUR(ch, mmana_str, L_CYAN);
    sprintf(mmove_str, "%ld", ch->max_move);
    ADD_COLOUR(ch, mmove_str, L_CYAN);
    sprintf( buf,
	"You report: %s/%s hp %s/%s mana %s/%s mv %s xp.\n\r",
	hit_str,  mhit_str,
	mana_str, mmana_str,
	move_str, mmove_str,
	exp_str   );

    send_to_char( buf, ch );

    for ( vch = char_list; vch != NULL; vch = vch_next )
    {
	vch_next	= vch->next;
	if ( vch == NULL ) continue;
	if ( vch == ch ) continue;
	if ( vch->in_room == NULL ) continue;
	if ( vch->in_room != ch->in_room ) continue;
    	sprintf(hit_str, "%ld", ch->hit);
    	COL_SCALE(hit_str, vch, ch->hit, ch->max_hit);
    	sprintf(mana_str, "%ld", ch->mana);
    	COL_SCALE(mana_str, vch, ch->mana, ch->max_mana);
    	sprintf(move_str, "%ld", ch->move);
    	COL_SCALE(move_str, vch, ch->move, ch->max_move);
    	sprintf(exp_str, "%d", ch->exp);
    	COL_SCALE(exp_str, vch, ch->exp, 1000);
    	sprintf(mhit_str, "%ld", ch->max_hit);
    	ADD_COLOUR(vch, mhit_str, L_CYAN);
    	sprintf(mmana_str, "%ld", ch->max_mana);
    	ADD_COLOUR(vch, mmana_str, L_CYAN);
    	sprintf(mmove_str, "%ld", ch->max_move);
    	ADD_COLOUR(vch, mmove_str, L_CYAN);
    	if (!IS_NPC(ch) && IS_AFFECTED(ch,AFF_POLYMORPH))
    	    sprintf( buf, "%s reports: %s/%s hp %s/%s mana %s/%s mv %s xp.\n\r",
	    ch->morph,
	    hit_str,  mhit_str,
	    mana_str, mmana_str,
	    move_str, mmove_str,
	    exp_str   );
        else
    	    sprintf( buf, "%s reports: %s/%s hp %s/%s mana %s/%s mv %s xp.\n\r",
	    IS_NPC(ch) ? capitalize(ch->short_descr) : ch->name,
	    hit_str,  mhit_str,
	    mana_str, mmana_str,
	    move_str, mmove_str,
	    exp_str   );
	buf[0] = UPPER(buf[0]);
    	send_to_char( buf, vch );
    }
    return;
}



void do_practice( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    int sn;

    char * coll [] = { "{m", "{r", "{b", "{g", "{Y" };
    if ( IS_NPC(ch) )
	return;

    if ( argument[0] == '\0' )
    {
	int col;

	col    = 0;
	for ( sn = 0; sn < MAX_SKILL; sn++ )
	{
	    if ( skill_table[sn].name == NULL )
		break;
	    if ( ch->level < skill_table[sn].skill_level )
		continue;
	    sprintf( buf, "%s%18s{x %3d%%  ",
		coll[skill_table[sn].target],
		skill_table[sn].name, ch->pcdata->learned[sn] );
	    send_to_char( buf, ch );
	    if ( ++col % 3 == 0 )
		send_to_char( "\n\r", ch );
	}

	if ( col % 3 != 0 )
	    send_to_char( "\n\r", ch );

	sprintf( buf, "You have %d exp left.\n\r", ch->exp );
	send_to_char( buf, ch );
    }
    else
    {
	if ( !IS_AWAKE(ch) )
	{
	    send_to_char( "In your dreams, or what?\n\r", ch );
	    return;
	}

	if ( ch->exp <= 0 )
	{
	    send_to_char( "You have no exp left.\n\r", ch );
	    return;
	}

	if ( ( sn = skill_lookup( argument ) ) < 0
	|| ( !IS_NPC(ch)
	&&   ch->level < skill_table[sn].skill_level ) )
	{
	    send_to_char( "You can't practice that.\n\r", ch );
	    return;
	}

	
	if ( ch->pcdata->learned[sn] >= SKILL_ADEPT )
	{
	    sprintf( buf, "You are already an adept of %s.\n\r",
	         skill_table[sn].name );
	    send_to_char( buf, ch );
	}
	else if ( ch->pcdata->learned[sn] > 0 &&
		(ch->pcdata->learned[sn]*5000) > ch->exp )
	{
	    sprintf( buf, "You need %d exp to increase %s any more.\n\r",
		(ch->pcdata->learned[sn]*5000),skill_table[sn].name );
	    send_to_char( buf, ch );
	}
	else if ( ch->pcdata->learned[sn] == 0 && ch->exp < 5000 )
	{
	    sprintf( buf, "You need 5000 exp to learn %s.\n\r",
		skill_table[sn].name );
	    send_to_char( buf, ch );
	}
	else
	{
  	    if (ch->pcdata->learned[sn] == 0)
	    {
	    	ch->exp -= 5000;
	    	ch->pcdata->learned[sn] += get_curr_int(ch);
	    }
	    else
	    {
	    	ch->exp -= (ch->pcdata->learned[sn]*5000);
	    	ch->pcdata->learned[sn] += get_curr_int(ch);
	    }
	    if ( ch->pcdata->learned[sn] < SKILL_ADEPT )
	    {
		act( "You practice $T.",
		    ch, NULL, skill_table[sn].name, TO_CHAR );
	    }
	    else
	    {
		ch->pcdata->learned[sn] = SKILL_ADEPT;
		act( "You are now an adept of $T.",
		    ch, NULL, skill_table[sn].name, TO_CHAR );
	    }
	}
    }
    return;
}



/*
 * 'Wimpy' originally by Dionysos.
 */
void do_wimpy( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    char arg[MAX_INPUT_LENGTH];
    int wimpy;

    one_argument( argument, arg );

    if ( arg[0] == '\0' )
	wimpy = ch->max_hit / 5;
    else
	wimpy = atoi( arg );

    if ( wimpy < 0 )
    {
	send_to_char( "Your courage exceeds your wisdom.\n\r", ch );
	return;
    }

    if ( wimpy > ch->max_hit )
    {
	send_to_char( "Such cowardice ill becomes you.\n\r", ch );
	return;
    }

    ch->wimpy	= wimpy;
    sprintf( buf, "Wimpy set to %d hit points.\n\r", wimpy );
    send_to_char( buf, ch );
    return;
}



void do_password( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char *pArg;
    char *pwdnew;
    char *p;
    char cEnd;

    if ( IS_NPC(ch) )
	return;

    /*
     * Can't use one_argument here because it smashes case.
     * So we just steal all its code.  Bleagh.
     */
    pArg = arg1;
    while ( isspace(*argument) )
	argument++;

    cEnd = ' ';
    if ( *argument == '\'' || *argument == '"' )
	cEnd = *argument++;

    while ( *argument != '\0' )
    {
	if ( *argument == cEnd )
	{
	    argument++;
	    break;
	}
	*pArg++ = *argument++;
    }
    *pArg = '\0';

    pArg = arg2;
    while ( isspace(*argument) )
	argument++;

    cEnd = ' ';
    if ( *argument == '\'' || *argument == '"' )
	cEnd = *argument++;

    while ( *argument != '\0' )
    {
	if ( *argument == cEnd )
	{
	    argument++;
	    break;
	}
	*pArg++ = *argument++;
    }
    *pArg = '\0';

    if ( arg1[0] == '\0' || arg2[0] == '\0' )
    {
	send_to_char( "Syntax: password <old> <new>.\n\r", ch );
	return;
    }

    if ( strcmp( arg1, ch->pcdata->pwd ) &&
         strcmp( crypt( arg1, ch->pcdata->pwd ), ch->pcdata->pwd ) )
    {
	WAIT_STATE( ch, 40 );
	send_to_char( "Wrong password.  Wait 10 seconds.\n\r", ch );
	return;
    }

   if ( strlen(arg2) < 5 )
    {
	send_to_char(
	    "New password must be at least five characters long.\n\r", ch );
	return;
    }

    /*
     * No tilde allowed because of player file format.
     */
    pwdnew = crypt( arg2, ch->name );
    for ( p = pwdnew; *p != '\0'; p++ )
    {
	if ( *p == '~' )
	{
	    send_to_char(
		"New password not acceptable, try again.\n\r", ch );
	    return;
	}
    }

    free_string( ch->pcdata->pwd );
    ch->pcdata->pwd = str_dup( pwdnew );
    if (!IS_EXTRA(ch,EXTRA_NEWPASS)) SET_BIT(ch->extra,EXTRA_NEWPASS);
    save_char_obj( ch );
    if (ch->desc != NULL && ch->desc->connected == CON_PLAYING )
	send_to_char( "Ok.\n\r", ch );
    return;
}



void do_socials( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    int iSocial;
    int col;

    col = 0;

    for ( iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++ )
    {
	sprintf( buf, "%-12s", social_table[iSocial].name );
	send_to_char( buf, ch );
	if ( ++col % 6 == 0 )
	    send_to_char( "\n\r", ch );
    }
 
    if ( col % 6 != 0 )
	send_to_char( "\n\r", ch );

    return;
}

void do_xsocials( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    int iSocial;
    int col;

    col = 0;

    for ( iSocial = 0; xsocial_table[iSocial].name[0] != '\0'; iSocial++ )
    {
	sprintf( buf, "%-12s", xsocial_table[iSocial].name );
	send_to_char( buf, ch );
	if ( ++col % 6 == 0 )
	    send_to_char( "\n\r", ch );
    }
 
    if ( col % 6 != 0 )
	send_to_char( "\n\r", ch );

    return;
}



void do_spells( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH];
    int sn;
    int col;
    int mana;

    show_spell(ch,0);
    show_spell(ch,1);
    show_spell(ch,2);
    show_spell(ch,3);
    show_spell(ch,4);
    col = 0;

    if( !argument || str_cmp( argument, "cost" ) )
	return;

    for ( sn = 0; sn < MAX_SKILL && skill_table[sn].name != NULL; sn++ )
    {
	if ( skill_table[sn].spell_fun == spell_null )
	   continue;

        if( ch->level < skill_table[sn].skill_level && !IS_IMMORTAL(ch) )
	   continue;

	mana = skill_table[sn].min_mana;
        mana *= ch->spl[skill_table[sn].target] * 10;
        mana /= ch->spl[PURPLE_MAGIC];
	sprintf( buf, "%-15.15s %4dpts  ", skill_table[sn].name, mana );
	send_to_char( buf, ch );
	if ( ++col % 3 == 0 )
	    send_to_char( "\n\r", ch );
    }

    if ( col % 6 != 0 )
	send_to_char( "\n\r", ch );
    return;
}


bool see_command( struct cmd_type * cmd, CHAR_DATA *ch )
{
    if( !IS_SET(ch->newbits, NEW_MUDCOP) && IS_SET(cmd->show, CSHOW_MUDCOP) )
        return FALSE;

    if( IS_SET(cmd->show,CSHOW_NEVER) )
        return FALSE;

    if( cmd->level >= 7 )
	return FALSE;

    if( get_trust(ch) < cmd->level )
	return FALSE;

    if( cmd->disabled_by[0] != '\0' )
	return FALSE;

    if( IS_SET(cmd->show, CSHOW_VAMPIRE)
     || IS_SET(cmd->show, CSHOW_WEREWOLF)
     || IS_SET(cmd->show, CSHOW_MAGE )
     || IS_SET(cmd->show, CSHOW_ANGEL)
     || IS_SET(cmd->show, CSHOW_DEMON)
     || IS_SET(cmd->show, CSHOW_NINJA)
     || IS_SET(cmd->show, CSHOW_MONK)
     || IS_SET(cmd->show, CSHOW_PRIEST)
     || IS_SET(cmd->show, CSHOW_DROW) )
        return FALSE;

    return TRUE;
}

/*
 * Contributed by Alander.
 */
void do_commands( CHAR_DATA *ch, char *argument )
{
#define SEECMD( bit )  IS_SET( cmd_table[cmd].show, bit )
    int cmd;
    int col;

    col = 0;

    ptc( " ----------------------------------[{CNormal{x]----------------------------------\n\r",ch);
    
    for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
    {
        if ( see_command( &cmd_table[cmd], ch ))
        {
            pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
            if ( ++col % 6 == 0 )
                page_to_char( "\n\r", ch );
        }
    }

    if( ch->level > 2 )
    {
        switch( ch->class )
        {
        case CLASS_DEMON:
            ptc( " ----------------------------------[{CDemon {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_DEMON ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_DROW:
            ptc( " ----------------------------------[{C Drow {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_DROW ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_PRIEST:
            ptc( " ----------------------------------[{CPriest{x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_PRIEST ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_MONK:
            ptc( " ----------------------------------[{C Monk {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_MONK ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_NINJA:
            ptc( " ----------------------------------[{CNinja {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_NINJA ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_ANGEL:
            ptc( " ----------------------------------[{CAngel {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_ANGEL ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_MAGE:
            ptc( " ----------------------------------[{C Mage {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_MAGE ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_VAMPIRE:
            ptc( " ----------------------------------[{C Vamp {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_VAMPIRE ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;
        case CLASS_WEREWOLF:
            ptc( " ----------------------------------[{CGarou {x]----------------------------------\n\r",ch);

            for ( cmd = 0; cmd_table[cmd].name[0]; cmd++ )
            {
                if ( SEECMD( CSHOW_WEREWOLF ) )
                {
                    pager_printf( ch, "%-12.12s ", cmd_table[cmd].name );
                    if ( ++col % 6 == 0 )
                        page_to_char( "\n\r", ch );
                }
            }
            break;

        }
    }
#undef SEECMD
    return;
}




void do_diagnose( CHAR_DATA *ch, char *argument )
{
    char buf  [MAX_STRING_LENGTH];
    char arg  [MAX_INPUT_LENGTH];
    int teeth = 0;
    int ribs = 0;
    CHAR_DATA *victim;

    argument = one_argument( argument, arg );

    if (arg == '\0')
    {
	send_to_char("Who do you wish to diagnose?\n\r",ch);
	return;
    }

    if ( ( victim = get_char_room( ch, arg ) ) == NULL )
    {
	send_to_char("Nobody here by that name.\n\r",ch);
	return;
    }
    act("$n examines $N carefully, diagnosing $S injuries.",ch,NULL,victim,TO_NOTVICT);
    act("$n examines you carefully, diagnosing your injuries.",ch,NULL,victim,TO_VICT);
    act("Your diagnoses of $N reveals the following...",ch,NULL,victim,TO_CHAR);
    send_to_char("--------------------------------------------------------------------------------\n\r",ch);
    if ( ( victim->loc_hp[0] + victim->loc_hp[1] + victim->loc_hp[2] + 
	   victim->loc_hp[3] + victim->loc_hp[4] + victim->loc_hp[5] +
	   victim->loc_hp[6] ) == 0 )
    {
	act("$N has no apparent injuries.",ch,NULL,victim,TO_CHAR);
	send_to_char("--------------------------------------------------------------------------------\n\r",ch);
	return;
    }
    /* Check head */
    if (IS_HEAD(victim,LOST_EYE_L) && IS_HEAD(victim,LOST_EYE_R))
	act("$N has lost both of $S eyes.",ch,NULL,victim,TO_CHAR);
    else if (IS_HEAD(victim,LOST_EYE_L))
	act("$N has lost $S left eye.",ch,NULL,victim,TO_CHAR);
    else if (IS_HEAD(victim,LOST_EYE_R))
	act("$N has lost $S right eye.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,LOST_EAR_L) && IS_HEAD(victim,LOST_EAR_R))
	act("$N has lost both of $S ears.",ch,NULL,victim,TO_CHAR);
    else if (IS_HEAD(victim,LOST_EAR_L))
	act("$N has lost $S left ear.",ch,NULL,victim,TO_CHAR);
    else if (IS_HEAD(victim,LOST_EAR_R))
	act("$N has lost $S right ear.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,LOST_NOSE))
	act("$N has lost $S nose.",ch,NULL,victim,TO_CHAR);
    else if (IS_HEAD(victim,BROKEN_NOSE))
	act("$N has got a broken nose.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,BROKEN_JAW))
	act("$N has got a broken jaw.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,LOST_HEAD))
    {
	act("$N has had $S head cut off.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_HEAD))
	    act("...Blood is spurting from the stump of $S neck.",ch,NULL,victim,TO_CHAR);
    }
    else
    {
	if (IS_BODY(victim,BROKEN_NECK))
	    act("$N has got a broken neck.",ch,NULL,victim,TO_CHAR);
	if (IS_BODY(victim,CUT_THROAT))
	{
	    act("$N has had $S throat cut open.",ch,NULL,victim,TO_CHAR);
	    if (IS_BLEEDING(victim,BLEEDING_THROAT))
		act("...Blood is pouring from the wound.",ch,NULL,victim,TO_CHAR);
	}
    }
    if (IS_HEAD(victim,BROKEN_SKULL))
	act("$N has got a broken skull.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,LOST_TOOTH_1 )) teeth += 1;
    if (IS_HEAD(victim,LOST_TOOTH_2 )) teeth += 2;
    if (IS_HEAD(victim,LOST_TOOTH_4 )) teeth += 4;
    if (IS_HEAD(victim,LOST_TOOTH_8 )) teeth += 8;
    if (IS_HEAD(victim,LOST_TOOTH_16)) teeth += 16;
    if (teeth > 0)
    {
	sprintf(buf,"$N has had %d teeth knocked out.",teeth);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    if (IS_HEAD(victim,LOST_TONGUE))
	act("$N has had $S tongue ripped out.",ch,NULL,victim,TO_CHAR);
    if (IS_HEAD(victim,LOST_HEAD))
    {
    	send_to_char("--------------------------------------------------------------------------------\n\r",ch);
    	return;
    }
    /* Check body */
    if (IS_BODY(victim,BROKEN_RIBS_1 )) ribs += 1;
    if (IS_BODY(victim,BROKEN_RIBS_2 )) ribs += 2;
    if (IS_BODY(victim,BROKEN_RIBS_4 )) ribs += 4;
    if (IS_BODY(victim,BROKEN_RIBS_8 )) ribs += 8;
    if (IS_BODY(victim,BROKEN_RIBS_16)) ribs += 16;
    if (ribs > 0)
    {
	sprintf(buf,"$N has got %d broken ribs.",ribs);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    if (IS_BODY(victim,BROKEN_SPINE))
	act("$N has got a broken spine.",ch,NULL,victim,TO_CHAR);
    /* Check arms */
    check_left_arm(ch,victim);
    check_right_arm(ch,victim);
    check_left_leg(ch,victim);
    check_right_leg(ch,victim);
    send_to_char("--------------------------------------------------------------------------------\n\r",ch);
    return;
}

void check_left_arm( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf    [MAX_STRING_LENGTH];
    char finger [10];
    int fingers = 0;

    if (IS_ARM_L(victim,LOST_ARM) && IS_ARM_R(victim,LOST_ARM))
    {
	act("$N has lost both of $S arms.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_ARM_L) && IS_BLEEDING(victim,BLEEDING_ARM_R))
	    act("...Blood is spurting from both stumps.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_ARM_L))
	    act("...Blood is spurting from the left stump.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_ARM_R))
	    act("...Blood is spurting from the right stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_ARM_L(victim,LOST_ARM))
    {
	act("$N has lost $S left arm.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_ARM_L))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_ARM_L(victim,BROKEN_ARM) && IS_ARM_R(victim,BROKEN_ARM))
	act("$N arms are both broken.",ch,NULL,victim,TO_CHAR);
    else if (IS_ARM_L(victim,BROKEN_ARM))
	act("$N's left arm is broken.",ch,NULL,victim,TO_CHAR);
    if (IS_ARM_L(victim,LOST_HAND) && IS_ARM_R(victim,LOST_HAND) &&
	!IS_ARM_R(victim,LOST_ARM))
    {
	act("$N has lost both of $S hands.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_HAND_L) && IS_BLEEDING(victim,BLEEDING_HAND_R))
	    act("...Blood is spurting from both stumps.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_HAND_L))
	    act("...Blood is spurting from the left stump.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_HAND_R))
	    act("...Blood is spurting from the right stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_ARM_L(victim,LOST_HAND))
    {
	act("$N has lost $S left hand.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_HAND_L))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_ARM_L(victim,LOST_FINGER_I)) fingers += 1;
    if (IS_ARM_L(victim,LOST_FINGER_M)) fingers += 1;
    if (IS_ARM_L(victim,LOST_FINGER_R)) fingers += 1;
    if (IS_ARM_L(victim,LOST_FINGER_L)) fingers += 1;
    if (fingers == 1) sprintf(finger,"finger");
    else sprintf(finger,"fingers");
    if (fingers > 0 && IS_ARM_L(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has lost %d %s and $S thumb from $S left hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (fingers > 0)
    {
	sprintf(buf,"$N has lost %d %s from $S left hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_ARM_L(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has lost the thumb from $S left hand.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    fingers = 0;
    if (IS_ARM_L(victim,BROKEN_FINGER_I) && !IS_ARM_L(victim,LOST_FINGER_I)) fingers += 1;
    if (IS_ARM_L(victim,BROKEN_FINGER_M) && !IS_ARM_L(victim,LOST_FINGER_M)) fingers += 1;
    if (IS_ARM_L(victim,BROKEN_FINGER_R) && !IS_ARM_L(victim,LOST_FINGER_R)) fingers += 1;
    if (IS_ARM_L(victim,BROKEN_FINGER_L) && !IS_ARM_L(victim,LOST_FINGER_L)) fingers += 1;
    if (fingers == 1) sprintf(finger,"finger");
    else sprintf(finger,"fingers");
    if (fingers > 0 && IS_ARM_L(victim,BROKEN_THUMB) && !IS_ARM_L(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has broken %d %s and $S thumb on $S left hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (fingers > 0)
    {
	sprintf(buf,"$N has broken %d %s on $S left hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_ARM_L(victim,BROKEN_THUMB) && !IS_ARM_L(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has broken the thumb on $S left hand.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    return;
}

void check_right_arm( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf    [MAX_STRING_LENGTH];
    char finger [10];
    int fingers = 0;

    if (IS_ARM_L(victim,LOST_ARM) && IS_ARM_R(victim,LOST_ARM))
	return;
    if (IS_ARM_R(victim,LOST_ARM))
    {
	act("$N has lost $S right arm.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_ARM_R))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (!IS_ARM_L(victim,BROKEN_ARM) && IS_ARM_R(victim,BROKEN_ARM))
	act("$N's right arm is broken.",ch,NULL,victim,TO_CHAR);
    else if (IS_ARM_L(victim,LOST_ARM) && IS_ARM_R(victim,BROKEN_ARM))
	act("$N's right arm is broken.",ch,NULL,victim,TO_CHAR);
    if (IS_ARM_L(victim,LOST_HAND) && IS_ARM_R(victim,LOST_HAND))
	return;
    if (IS_ARM_R(victim,LOST_HAND))
    {
	act("$N has lost $S right hand.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_HAND_R))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_ARM_R(victim,LOST_FINGER_I)) fingers += 1;
    if (IS_ARM_R(victim,LOST_FINGER_M)) fingers += 1;
    if (IS_ARM_R(victim,LOST_FINGER_R)) fingers += 1;
    if (IS_ARM_R(victim,LOST_FINGER_L)) fingers += 1;
    if (fingers == 1) sprintf(finger,"finger");
    else sprintf(finger,"fingers");
    if (fingers > 0 && IS_ARM_R(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has lost %d %s and $S thumb from $S right hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (fingers > 0)
    {
	sprintf(buf,"$N has lost %d %s from $S right hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_ARM_R(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has lost the thumb from $S right hand.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    fingers = 0;
    if (IS_ARM_R(victim,BROKEN_FINGER_I) && !IS_ARM_R(victim,LOST_FINGER_I)) fingers += 1;
    if (IS_ARM_R(victim,BROKEN_FINGER_M) && !IS_ARM_R(victim,LOST_FINGER_M)) fingers += 1;
    if (IS_ARM_R(victim,BROKEN_FINGER_R) && !IS_ARM_R(victim,LOST_FINGER_R)) fingers += 1;
    if (IS_ARM_R(victim,BROKEN_FINGER_L) && !IS_ARM_R(victim,LOST_FINGER_L)) fingers += 1;
    if (fingers == 1) sprintf(finger,"finger");
    else sprintf(finger,"fingers");
    if (fingers > 0 && IS_ARM_R(victim,BROKEN_THUMB) && !IS_ARM_R(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has broken %d %s and $S thumb on $S right hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (fingers > 0)
    {
	sprintf(buf,"$N has broken %d %s on $S right hand.",fingers,finger);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_ARM_R(victim,BROKEN_THUMB) && !IS_ARM_R(victim,LOST_THUMB))
    {
	sprintf(buf,"$N has broken the thumb on $S right hand.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    return;
}

void check_left_leg( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf    [MAX_STRING_LENGTH];
    char toe [10];
    int toes = 0;

    if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
    {
	act("$N has lost both of $S legs.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_LEG_L) && IS_BLEEDING(victim,BLEEDING_LEG_R))
	    act("...Blood is spurting from both stumps.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_LEG_L))
	    act("...Blood is spurting from the left stump.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_LEG_R))
	    act("...Blood is spurting from the right stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_LEG_L(victim,LOST_LEG))
    {
	act("$N has lost $S left leg.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_LEG_L))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_LEG_L(victim,BROKEN_LEG) && IS_LEG_R(victim,BROKEN_LEG))
	act("$N legs are both broken.",ch,NULL,victim,TO_CHAR);
    else if (IS_LEG_L(victim,BROKEN_LEG))
	act("$N's left leg is broken.",ch,NULL,victim,TO_CHAR);
    if (IS_LEG_L(victim,LOST_FOOT) && IS_LEG_R(victim,LOST_FOOT))
    {
	act("$N has lost both of $S feet.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_FOOT_L) && IS_BLEEDING(victim,BLEEDING_FOOT_R))
	    act("...Blood is spurting from both stumps.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_FOOT_L))
	    act("...Blood is spurting from the left stump.",ch,NULL,victim,TO_CHAR);
	else if (IS_BLEEDING(victim,BLEEDING_FOOT_R))
	    act("...Blood is spurting from the right stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_LEG_L(victim,LOST_FOOT))
    {
	act("$N has lost $S left foot.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_FOOT_L))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_LEG_L(victim,LOST_TOE_A)) toes += 1;
    if (IS_LEG_L(victim,LOST_TOE_B)) toes += 1;
    if (IS_LEG_L(victim,LOST_TOE_C)) toes += 1;
    if (IS_LEG_L(victim,LOST_TOE_D)) toes += 1;
    if (toes == 1) sprintf(toe,"toe");
    else sprintf(toe,"toes");
    if (toes > 0 && IS_LEG_L(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has lost %d %s and $S big toe from $S left foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (toes > 0)
    {
	sprintf(buf,"$N has lost %d %s from $S left foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_LEG_L(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has lost the big toe from $S left foot.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    toes = 0;
    if (IS_LEG_L(victim,BROKEN_TOE_A) && !IS_LEG_L(victim,LOST_TOE_A)) toes += 1;
    if (IS_LEG_L(victim,BROKEN_TOE_B) && !IS_LEG_L(victim,LOST_TOE_B)) toes += 1;
    if (IS_LEG_L(victim,BROKEN_TOE_C) && !IS_LEG_L(victim,LOST_TOE_C)) toes += 1;
    if (IS_LEG_L(victim,BROKEN_TOE_D) && !IS_LEG_L(victim,LOST_TOE_D)) toes += 1;
    if (toes == 1) sprintf(toe,"toe");
    else sprintf(toe,"toes");
    if (toes > 0 && IS_LEG_L(victim,BROKEN_TOE_BIG) && !IS_LEG_L(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has broken %d %s and $S big toe from $S left foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (toes > 0)
    {
	sprintf(buf,"$N has broken %d %s on $S left foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_LEG_L(victim,BROKEN_TOE_BIG) && !IS_LEG_L(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has broken the big toe on $S left foot.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    return;
}

void check_right_leg( CHAR_DATA *ch, CHAR_DATA *victim )
{
    char buf    [MAX_STRING_LENGTH];
    char toe [10];
    int toes = 0;

    if (IS_LEG_L(victim,LOST_LEG) && IS_LEG_R(victim,LOST_LEG))
	return;
    if (IS_LEG_R(victim,LOST_LEG))
    {
	act("$N has lost $S right leg.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_LEG_R))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (!IS_LEG_L(victim,BROKEN_LEG) && IS_LEG_R(victim,BROKEN_LEG))
	act("$N's right leg is broken.",ch,NULL,victim,TO_CHAR);
    if (IS_LEG_L(victim,LOST_FOOT) && IS_LEG_R(victim,LOST_FOOT))
	return;
    if (IS_LEG_R(victim,LOST_FOOT))
    {
	act("$N has lost $S right foot.",ch,NULL,victim,TO_CHAR);
	if (IS_BLEEDING(victim,BLEEDING_FOOT_R))
	    act("...Blood is spurting from the stump.",ch,NULL,victim,TO_CHAR);
	return;
    }
    if (IS_LEG_R(victim,LOST_TOE_A)) toes += 1;
    if (IS_LEG_R(victim,LOST_TOE_B)) toes += 1;
    if (IS_LEG_R(victim,LOST_TOE_C)) toes += 1;
    if (IS_LEG_R(victim,LOST_TOE_D)) toes += 1;
    if (toes == 1) sprintf(toe,"toe");
    else sprintf(toe,"toes");
    if (toes > 0 && IS_LEG_R(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has lost %d %s and $S big toe from $S right foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (toes > 0)
    {
	sprintf(buf,"$N has lost %d %s from $S right foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_LEG_R(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has lost the big toe from $S right foot.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    toes = 0;
    if (IS_LEG_R(victim,BROKEN_TOE_A) && !IS_LEG_R(victim,LOST_TOE_A)) toes += 1;
    if (IS_LEG_R(victim,BROKEN_TOE_B) && !IS_LEG_R(victim,LOST_TOE_B)) toes += 1;
    if (IS_LEG_R(victim,BROKEN_TOE_C) && !IS_LEG_R(victim,LOST_TOE_C)) toes += 1;
    if (IS_LEG_R(victim,BROKEN_TOE_D) && !IS_LEG_R(victim,LOST_TOE_D)) toes += 1;
    if (toes == 1) sprintf(toe,"toe");
    else sprintf(toe,"toes");
    if (toes > 0 && IS_LEG_R(victim,BROKEN_TOE_BIG) && !IS_LEG_R(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has broken %d %s and $S big toe on $S right foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (toes > 0)
    {
	sprintf(buf,"$N has broken %d %s on $S right foot.",toes,toe);
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    else if (IS_LEG_R(victim,BROKEN_TOE_BIG) && !IS_LEG_R(victim,LOST_TOE_BIG))
    {
	sprintf(buf,"$N has broken the big toe on $S right foot.");
	act(buf,ch,NULL,victim,TO_CHAR);
    }
    return;
}

void obj_score( CHAR_DATA *ch, OBJ_DATA *obj )
{
    char buf[MAX_STRING_LENGTH];
    AFFECT_DATA *paf;
    int itemtype;

    
    sprintf( buf,"You are %s.\n\r", STR(obj,short_descr));
    send_to_char( buf, ch );

    sprintf( buf,"Type %s, Extra flags %s.\n\r",
	flag_string( type_flags, obj->item_type ),
	flag_string( extra_flags, obj->extra_flags ));
    send_to_char( buf, ch );

    sprintf( buf,"You weigh %d pounds and are worth %d gold coins.\n\r",obj->weight,obj->cost);
    send_to_char( buf, ch );

    if (obj->questmaker != NULL && strlen(obj->questmaker) > 1 &&
	obj->questowner != NULL && strlen(obj->questowner) > 1)
    {
	sprintf( buf, "You were created by %s, and are owned by %s.\n\r", obj->questmaker,obj->questowner );
	send_to_char( buf, ch );
    }
    else if (obj->questmaker != NULL && strlen(obj->questmaker) > 1)
    {
	sprintf( buf, "You were created by %s.\n\r", obj->questmaker );
	send_to_char( buf, ch );
    }
    else if (obj->questowner != NULL && strlen(obj->questowner) > 1)
    {
	sprintf( buf, "You are owned by %s.\n\r", obj->questowner );
	send_to_char( buf, ch );
    }

    switch ( obj->item_type )
    {
    case ITEM_SCROLL: 
    case ITEM_POTION:
	sprintf( buf, "You contain level %d spells of:", obj->value[0] );
	send_to_char( buf, ch );

	if ( obj->value[1] >= 0 && obj->value[1] < MAX_SKILL )
	{
	    send_to_char( " '", ch );
	    send_to_char( skill_table[obj->value[1]].name, ch );
	    send_to_char( "'", ch );
	}

	if ( obj->value[2] >= 0 && obj->value[2] < MAX_SKILL )
	{
	    send_to_char( " '", ch );
	    send_to_char( skill_table[obj->value[2]].name, ch );
	    send_to_char( "'", ch );
	}

	if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL )
	{
	    send_to_char( " '", ch );
	    send_to_char( skill_table[obj->value[3]].name, ch );
	    send_to_char( "'", ch );
	}

	send_to_char( ".\n\r", ch );
	break;

    case ITEM_QUEST:
	sprintf( buf, "Your quest point value is %d.\n\r", obj->value[0] );
	send_to_char( buf, ch );
	break;

    case ITEM_WAND: 
    case ITEM_STAFF: 
	sprintf( buf, "You have %d(%d) charges of level %d",
	    obj->value[1], obj->value[2], obj->value[0] );
	send_to_char( buf, ch );

	if ( obj->value[3] >= 0 && obj->value[3] < MAX_SKILL )
	{
	    send_to_char( " '", ch );
	    send_to_char( skill_table[obj->value[3]].name, ch );
	    send_to_char( "'", ch );
	}

	send_to_char( ".\n\r", ch );
	break;
      
    case ITEM_WEAPON:
	sprintf( buf, "You inflict %d to %d damage in combat (average %d).\n\r",
	    obj->value[1], obj->value[2],
	    ( obj->value[1] + obj->value[2] ) / 2 );
	send_to_char( buf, ch );

	if (obj->value[0] >= 1000)
	    itemtype = obj->value[0] - ((obj->value[0] / 1000) * 1000);
	else
	    itemtype = obj->value[0];

	if (itemtype > 0)
	{
	    if (obj->level < 10)
		sprintf(buf,"You are a minor spell weapon.\n\r");
	    else if (obj->level < 20)
		sprintf(buf,"You are a lesser spell weapon.\n\r");
	    else if (obj->level < 30)
		sprintf(buf,"You are an average spell weapon.\n\r");
	    else if (obj->level < 40)
		sprintf(buf,"You are a greater spell weapon.\n\r");
	    else if (obj->level < 50)
		sprintf(buf,"You are a major spell weapon.\n\r");
	    else
		sprintf(buf,"You are a supreme spell weapon.\n\r");
	    send_to_char(buf,ch);
	}

	if (itemtype == 1)
	    sprintf (buf, "You are dripping with corrosive acid.\n\r");
	else if (itemtype == 4)
	    sprintf (buf, "You radiate an aura of darkness.\n\r");
	else if (itemtype == 30)
	    sprintf (buf, "You are the bane of all evil.\n\r");
	else if (itemtype == 34)
	    sprintf (buf, "You drink the souls of your victims.\n\r");
	else if (itemtype == 37)
	    sprintf (buf, "You have been tempered in hellfire.\n\r");
	else if (itemtype == 48)
	    sprintf (buf, "You crackle with sparks of lightning.\n\r");
	else if (itemtype == 53)
	    sprintf (buf, "You are dripping with a dark poison.\n\r");
	else if (itemtype > 0)
	    sprintf (buf, "You have been imbued with the power of %s.\n\r",skill_table[itemtype].name);
	if (itemtype > 0)
	    send_to_char( buf, ch );

	if (obj->value[0] >= 1000)
	    itemtype = obj->value[0] / 1000;
	else
	    break;

	if (itemtype == 4 || itemtype == 1)
	    sprintf (buf, "You radiate an aura of darkness.\n\r");
	else if (itemtype == 27 || itemtype == 2)
	    sprintf (buf, "You allow your wielder to see invisible things.\n\r");
	else if (itemtype == 39 || itemtype == 3)
	    sprintf (buf, "You grant your wielder the power of flight.\n\r");
	else if (itemtype == 45 || itemtype == 4)
	    sprintf (buf, "You allow your wielder to see in the dark.\n\r");
	else if (itemtype == 46 || itemtype == 5)
	    sprintf (buf, "You render your wielder invisible to the human eye.\n\r");
	else if (itemtype == 52 || itemtype == 6)
	    sprintf (buf, "You allow your wielder to walk through solid doors.\n\r");
	else if (itemtype == 54 || itemtype == 7)
	    sprintf (buf, "You protect your wielder from evil.\n\r");
	else if (itemtype == 57 || itemtype == 8)
	    sprintf (buf, "You protect your wielder in combat.\n\r");
	else if (itemtype == 9)
	    sprintf (buf, "You allow your wielder to walk in complete silence.\n\r");
	else if (itemtype == 10)
	    sprintf (buf, "You surround your wielder with a shield of lightning.\n\r");
	else if (itemtype == 11)
	    sprintf (buf, "You surround your wielder with a shield of fire.\n\r");
	else if (itemtype == 12)
	    sprintf (buf, "You surround your wielder with a shield of ice.\n\r");
	else if (itemtype == 13)
	    sprintf (buf, "You surround your wielder with a shield of acid.\n\r");
	else if (itemtype == 14)
	    sprintf (buf, "You protect your wielder from attacks from DarkBlade clan guardians.\n\r");
	else if (itemtype == 15)
	    sprintf (buf, "You surround your wielder with a shield of chaos.\n\r");
	else if (itemtype == 16)
	    sprintf (buf, "You regenerate the wounds of your wielder.\n\r");
	else if (itemtype == 17)
	    sprintf (buf, "You enable your wielder to move at supernatural speed.\n\r");
	else if (itemtype == 18)
	    sprintf (buf, "You can slice through armour without difficulty.\n\r");
	else if (itemtype == 19)
	    sprintf (buf, "You protect your wielder from player attacks.\n\r");
	else if (itemtype == 20)
	    sprintf (buf, "You surround your wielder with a shield of darkness.\n\r");
	else if (itemtype == 21)
	    sprintf (buf, "You grant your wielder superior protection.\n\r");
	else if (itemtype == 22)
	    sprintf (buf, "You grant your wielder supernatural vision.\n\r");
	else if (itemtype == 23)
	    sprintf (buf, "You make your wielder fleet-footed.\n\r");
	else if (itemtype == 24)
	    sprintf (buf, "You conceal your wielder from sight.\n\r");
	else if (itemtype == 25)
	    sprintf (buf, "You invoke the power of your wielders beast.\n\r");
	else
	    sprintf (buf, "You are bugged...please report it.\n\r");
	if (itemtype > 0)
	    send_to_char( buf, ch );
	break;

    case ITEM_ARMOR:
	sprintf( buf, "Your armor class is %d.\n\r", obj->value[0] );
	send_to_char( buf, ch );
	if (obj->value[3] < 1)
	    break;
	if (obj->value[3] == 4 || obj->value[3] == 1)
	    sprintf (buf, "You radiate an aura of darkness.\n\r");
	else if (obj->value[3] == 27 || obj->value[3] == 2)
	    sprintf (buf, "You allow your wearer to see invisible things.\n\r");
	else if (obj->value[3] == 39 || obj->value[3] == 3)
	    sprintf (buf, "You grant your wearer the power of flight.\n\r");
	else if (obj->value[3] == 45 || obj->value[3] == 4)
	    sprintf (buf, "You allow your wearer to see in the dark.\n\r");
	else if (obj->value[3] == 46 || obj->value[3] == 5)
	    sprintf (buf, "You render your wearer invisible to the human eye.\n\r");
	else if (obj->value[3] == 52 || obj->value[3] == 6)
	    sprintf (buf, "You allow your wearer to walk through solid doors.\n\r");
	else if (obj->value[3] == 54 || obj->value[3] == 7)
	    sprintf (buf, "You protect your wearer from evil.\n\r");
	else if (obj->value[3] == 57 || obj->value[3] == 8)
	    sprintf (buf, "You protect your wearer in combat.\n\r");
	else if (obj->value[3] == 9)
	    sprintf (buf, "You allow your wearer to walk in complete silence.\n\r");
	else if (obj->value[3] == 10)
	    sprintf (buf, "You surround your wearer with a shield of lightning.\n\r");
	else if (obj->value[3] == 11)
	    sprintf (buf, "You surround your wearer with a shield of fire.\n\r");
	else if (obj->value[3] == 12)
	    sprintf (buf, "You surround your wearer with a shield of ice.\n\r");
	else if (obj->value[3] == 13)
	    sprintf (buf, "You surround your wearer with a shield of acid.\n\r");
	else if (obj->value[3] == 14)
	    sprintf (buf, "You protect your wearer from attacks from DarkBlade clan guardians.\n\r");
	else if (obj->value[3] == 15)
	    sprintf (buf, "You surround your wielder with a shield of chaos.\n\r");
	else if (obj->value[3] == 16)
	    sprintf (buf, "You regenerate the wounds of your wielder.\n\r");
	else if (obj->value[3] == 17)
	    sprintf (buf, "You enable your wearer to move at supernatural speed.\n\r");
	else if (obj->value[3] == 18)
	    sprintf (buf, "You can slice through armour without difficulty.\n\r");
	else if (obj->value[3] == 19)
	    sprintf (buf, "You protect your wearer from player attacks.\n\r");
	else if (obj->value[3] == 20)
	    sprintf (buf, "You surround your wearer with a shield of darkness.\n\r");
	else if (obj->value[3] == 21)
	    sprintf (buf, "You grant your wearer superior protection.\n\r");
	else if (obj->value[3] == 22)
	    sprintf (buf, "You grant your wearer supernatural vision.\n\r");
	else if (obj->value[3] == 23)
	    sprintf (buf, "You make your wearer fleet-footed.\n\r");
	else if (obj->value[3] == 24)
	    sprintf (buf, "You conceal your wearer from sight.\n\r");
	else if (obj->value[3] == 25)
	    sprintf (buf, "You invoke the power of your wearers beast.\n\r");
	else
	    sprintf (buf, "You are bugged...please report it.\n\r");
	if (obj->value[3] > 0)
	    send_to_char( buf, ch );
	break;
    }

    for ( paf = obj->pIndexData->affected; paf != NULL; paf = paf->next )
    {
	if ( paf->location != APPLY_NONE && paf->modifier != 0 )
	{
	    sprintf( buf, "You affect %s by %d.\n\r",
		affect_loc_name( paf->location ), paf->modifier );
	    send_to_char( buf, ch );
	}
    }

    for ( paf = obj->affected; paf != NULL; paf = paf->next )
    {
	if ( paf->location != APPLY_NONE && paf->modifier != 0 )
	{
	    sprintf( buf, "You affect %s by %d.\n\r",
		affect_loc_name( paf->location ), paf->modifier );
	    send_to_char( buf, ch );
	}
    }
    return;
}


void do_anonymous( CHAR_DATA *ch, char *argument )
{
	if ( IS_NPC(ch) ) return;
/*
	if ( IS_IMMORTAL(ch) )
	{
		send_to_char("You don't need to go anonymous, you dolt!.\n\r",ch);
		return;
	}*/

	if ( IS_SET(ch->flag2, AFF2_ANONYMOUS ) )
	{
		send_to_char("You are now no longer anonymous.\n\r",ch);
		REMOVE_BIT(ch->flag2, AFF2_ANONYMOUS );
		return;
	}
	if ( !IS_SET(ch->flag2, AFF2_ANONYMOUS ) )
	{
		send_to_char("You are now anonymous.\n\r",ch);
		SET_BIT(ch->flag2, AFF2_ANONYMOUS);
		return;
	}
	else
	{
		send_to_char(" BUG: Report this to Cuthbert or Dreimas.\n\r",ch);
		return;
	}
	return;
}



bool is_name2_prefix( const char *str, char *namelist )
{
    char name[MAX_INPUT_LENGTH];

    for ( ; ; )
    {
	namelist = one_argument( namelist, name );
	if ( name[0] == '\0' )
	    return FALSE;
	if ( !str_prefix( str, name ) )
	    return TRUE;
    }
}


bool nifty_is_name_prefix( char *str, char *namelist )
{
    char name[MAX_INPUT_LENGTH];
    
    if ( !str || str[0] == '\0' )
      return FALSE;
 
    for ( ; ; )
    {
	str = one_argument( str, name );
	if ( name[0] == '\0' )
	    return TRUE;
	if ( !is_name2_prefix( name, namelist ) )
	    return FALSE;
    }
}


/*
 * Show help topics in a level range	 -Dreimas
 */
void do_hlist( CHAR_DATA *ch, char *argument )
{
    int min, max, minlimit, maxlimit, cnt;
    char arg[MAX_INPUT_LENGTH];
    HELP_DATA *help;
    bool minfound, maxfound;
    char *idx;

    maxlimit = get_trust(ch);
    minlimit = maxlimit >= LEVEL_JUDGE ? -1 : 0;
    
    min = minlimit;
    max  = maxlimit;
    
    idx = NULL;
    minfound = FALSE;
    maxfound = FALSE;
    
    for ( argument = one_argument(argument, arg); arg[0] != '\0';
	  argument = one_argument(argument, arg))
    {
	if( !isdigit(arg[0]) )
	{
 	    if ( idx )
	    {
		ch_printf(ch, 
		"You may only use a single keyword to index the list.\n\r");
		return;
	    }
	    idx = str_dup(arg);
    	}
	else
	{
	    if ( !minfound )
	    {
		min = URANGE(minlimit, atoi(arg), maxlimit);
		minfound = TRUE;
	    }
	    else
	    if ( !maxfound )
	    {
		max = URANGE(minlimit, atoi(arg), maxlimit);
		maxfound = TRUE;
	    }
	    else
	    {
		ch_printf(ch, "You may only use two level limits.\n\r");
		return;
	    }
	}
    }
    
    if ( min > max )
    {
	int temp = min;

	min = max;
	max = temp;
    }
    
    pager_printf( ch, "Help Topics in level range %d to %d:\n\r\n\r", min, max );
    for ( cnt = 0, help = help_first; help; help = help->next )
    {
        if ( help->level >= min && help->level <= max
             &&  (!idx || nifty_is_name_prefix(idx, help->keyword)) )
        {
            pager_printf( ch, "   %3d %20.20s", help->level, help->keyword );
            ++cnt;
            if( cnt % 3 == 0 )
                pager_printf( ch, "\n\r" );
        }
    }
    
    if ( cnt )
	pager_printf( ch, "\n\r%d pages found.\n\r", cnt );
    else
        send_to_char( "None found.\n\r", ch );

    if ( idx )
    	free_string(idx);
    
    return;
}



void do_gain( CHAR_DATA *ch, char *argument )
{
        int cost;
      
	if( IS_NPC(ch) )
	{
		stc( "This is not for NPC's.\n\r", ch );
		return;
	}

        cost = ch->pcdata->stats[LEVEL] * 5000;

        if (ch->pcdata->stats[LEVEL] >= 300)
        {send_to_char("The max Zlevel is 300. GO YOU!\n\r",ch); return;}
         
        if (ch->pcdata->stats[DEMON_CURRENT] < cost)
        {
                ch_printf( ch, "You need more cps, %s!\n\r",
			ch->name);
                return;
        }
        
        if (ch->pcdata->stats[DEMON_CURRENT] >= cost)
        {
                ch->pcdata->stats[LEVEL] += 1;
                ch->pcdata->stats[DEMON_CURRENT] -= cost;
        }
        send_to_char("You gain a zapped-level!\n\r",ch);
        return;
}

void do_worth (CHAR_DATA * ch, char *argument)
{
  char buf [ 16 ];
  char buf1 [ 16 ];
  char buf2 [ 16 ];
  char buf3 [ 16 ];

  if (IS_NPC (ch))
    {
      return;
    } 

   ch_printf( ch, 
           "You have %s experience, %s cps, and %s qps.\n\r"
	   "You need %s cps to gain a new zapped level.\n\r",
           num_punct( buf, ch->exp), 
           num_punct( buf1, PC(ch,stats[DEMON_CURRENT]) ), 
	   num_punct( buf2, PC(ch,quest) ), 
           num_punct( buf3, PC(ch,stats[LEVEL]) * 5000) );

  ch_printf( ch, "You have %s zlevels.\n\r", num_punct( buf, PC(ch,stats[LEVEL]) ) );

  return;
}

void do_affects( CHAR_DATA *ch, char *argument )
{
   AFFECT_DATA *paf;

   if (IS_NPC(ch))
        return;

   send_to_char("{CYou are affected by the following shields:\n\r\n\r",ch);
     if ( IS_ITEMAFF(ch, ITEMA_SHOCKSHIELD) )
        send_to_char("{YShockShield ", ch);
     if ( IS_ITEMAFF(ch, ITEMA_FIRESHIELD) )
        send_to_char("{RFireShield ", ch);
     if ( IS_ITEMAFF(ch, ITEMA_ICESHIELD) )
        send_to_char("{CIceShield ", ch);
     if ( IS_ITEMAFF(ch, ITEMA_ACIDSHIELD) )
        send_to_char("{GAcidShield ", ch);
     if ( IS_ITEMAFF(ch, ITEMA_CHAOSSHIELD) )
        send_to_char("{DChaosShield ", ch);
     if ( IS_ITEMAFF(ch, ITEMA_REFLECT) )
        send_to_char("{BReflectShield ", ch);
     if ( IS_AFFECTED(ch, AFF_STEELSHIELD) )
        send_to_char("{DSteelShield", ch);
     send_to_char("\n\r", ch);

     if( ch->affected )
     {
         send_to_char("{CYou are affected by the following spells:\n\r\n\r", ch);
         for ( paf = ch->affected; paf != NULL; paf = paf->next )
         {
               ch_printf(ch, "{M%21.21s {n: mods {R%-15.15s {nby {W%4d {nfor {W%6d hrs\n\r",
                        paf->type > 1 ? skill_table[paf->type].name 
			              : "(Mud Internal Error)",
                        affect_loc_name( paf->location ),
                        paf->modifier,
                        paf->duration );
         }
    }
    send_to_char("\n\r{COther permanent spell affects:\n\r\n\r{M", ch );
    ch_printf(ch,"{M%s\n\r\n\r", flag_string( affect_flags, ch->affected_by ) );
    return;
}


char * king_name( char * buf, CHAR_DATA *wch )
{
   int kingdom;

   kingdom = PC(wch, kingdom);

   strcpy( buf, "{b{W{b" );
   if( strlen(king_table[ kingdom ].name) < 3 )
   	return buf;

   sprintf( buf, "{b-{W");
   if( IS_SET( wch->special, SPC_LEADER ) )
   {
	strcat( buf, IS_FEMALE(wch) ? "Queen" : "King");
   }
   else if( IS_SET( wch->special, SPC_PRINCE ) )
   {
	strcat( buf, IS_FEMALE(wch) ? "Princess" : "Prince" );
   }
   else
        strcat( buf, "Member" );

   strcat( buf, " of ");
   strcat( buf, king_table[ kingdom ].name );
   strcat( buf, "{b-" );
   return buf;
}


void do_bountylist(CHAR_DATA *ch, char *argument)
{  
  char buf [ MAX_STRING_LENGTH ];
  char buf2 [ MAX_STRING_LENGTH ];

  int  count;
 
  DESCRIPTOR_DATA *d;
  CHAR_DATA       *wch;

  if( IS_NPC(ch) )
     return;

  send_to_char( LINE_SEPERATOR, ch );
  send_to_char( "{C   Class Status       Name          Clan and Rank                   PK B\n\r", ch );
  send_to_char( LINE_SEPERATOR, ch );
  count = 0;
  for ( d = descriptor_list; d; d = d->next )
  {
	if( d->connected != CON_PLAYING )
		continue;
	if( !(wch = CH(d)) )
		continue;
	if( wch->level < 3 )
		continue;
	if( !can_see( ch, wch ) )
		continue;
	if( wch->level > 7 )
		continue;

	count++;
	ch_printf( ch, "{b[ %s {b] {r%13s {b| %-39.39s [{Y%2d{b|{y%6d{b]\n\r",
			status_level(buf, wch->race, wch->class),
			capitalize( wch->name ),
			king_name( buf2, wch ),
			wch->race,
			PC(wch,bounty) );
  }
  send_to_char( LINE_SEPERATOR, ch );
  sprintf( buf, "{nThere are a total of [ {Y%2d{n ] {Wvisible{n avatars connected on {CAtD{x", count );
  centre_text( buf, ch );
  send_to_char( LINE_SEPERATOR, ch );
  return;
}

void do_mudstat( CHAR_DATA *ch, char * argument )
{
    stc( LINE_SEPERATOR, ch );
    stc( "                        {RAscension to Darkness's Mud Stats\n\r", ch );
    stc( LINE_SEPERATOR, ch );
    ch_printf(ch, "{WPlayers:\n\r"
              "  {nMax: {W%d  {nTime of Max: {W%s\n\r",
              sysdata.maxplayers, sysdata.time_of_max );
    ch_printf(ch, "  {nAll Time max: {W%d\n\r",
              sysdata.alltimemax );
    ch_printf(ch, "{WClass:\n\r"
              "  {nDrows: {W%3.3d  {nMonks: {W%3.3d  {nMages: {W%3.3d {nNinjas:  {W%3.3d\n\r"
              "  {nPriests: {W%3.3d {nAngels: {W%3.3d  {nDemons: {W%3.3d {nVampires: {W%3.3d\n\r"
              "  {nWerewolfs: {W%3.3d\n\r",
              sysdata.drows, sysdata.monks, sysdata.mages, sysdata.ninjas,
	      sysdata.priests, sysdata.angels, sysdata.demons,
	      sysdata.vampires, sysdata.werewolfs );
    ch_printf(ch, "{WTotal Classed Pfiles: %d\n\r",
              sysdata.drows + sysdata.monks + sysdata.mages + sysdata.ninjas +
	      sysdata.priests + sysdata.angels + sysdata.demons +
              sysdata.vampires + sysdata.werewolfs );
    stc( LINE_SEPERATOR, ch );
    stc( LINE_SEPERATOR, ch );
    return;
}