act_info.c

src/act_info.c · 230.6 KB

From the archive mrmudsrc14.tar.gz

Download the archive   « Back to the archive contents

/**************************************************************************
 *  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.                                                  *
 ***************************************************************************/

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

extern bool can_see_is_hidden;

char *  const   where_name      [] =
{
    "   <Used as Light> ",
    "<Worn on L Finger> ",
    "<Worn on R Finger> ",
    "<Worn around Neck> ",
    "<Worn around Neck> ",
    "    <Worn on Body> ",
    "    <Worn on Head> ",
    "    <Worn on Legs> ",
    "    <Worn on Feet> ",
    "   <Worn on Hands> ",
    "    <Worn on Arms> ",
    "          <Shield> ",
    " <Worn about Body> ",
    "<Worn about Waist> ",
    " <Worn on L Wrist> ",
    " <Worn on R Wrist> ",
    "         <Wielded> ",
    "            <Held> ",
    "           <Heart> ",
    "    <Dual Wielded> "
};


/*
 * Global functions.
 */

/*
 * Local functions.
 */
char *  format_obj_to_char      args( ( OBJ_DATA *obj, CHAR_DATA *ch,
				    int fShort ) );
void    show_list_to_char       args( ( OBJ_DATA *list, CHAR_DATA *ch,
				    int fShort, bool fShowNothing ) );
void    show_char_to_char_0     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    get_affects_string    ( CHAR_DATA *, CHAR_DATA *, char *, int );

int lookup_race( char *arg )
  {
  int cnt;

  for( cnt=0; cnt<MAX_RACE; cnt++)
    if( !str_prefix( arg, race_table[cnt].race_name) )
      return( cnt );

  return( -1 );
  }


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

    blen = 0;
    buf[0] = '\0';
/*
  if( TEST_GAME && obj->obj_quest>0)
    {
    char buf2[32];
    sprintf( buf2, "[%8X]", (unsigned int)obj->obj_quest);
    blen = str_apd_max( buf, buf2, blen, MAX_STRING_LENGTH );
    }
*/

#ifdef EQUIPMENT_DAMAGE
   if( obj->item_type==ITEM_ARMOR || obj->item_type==ITEM_WEAPON )
    {
    if( ch->level > 50 )
      {
      char buf2[32];
      sprintf( buf2, "%2d%%  ", obj->condition);
      blen = str_apd_max( buf, buf2, blen, MAX_STRING_LENGTH );
      }
    else if( obj->condition >=90 )
      blen = str_apd_max( buf, "[E] ", blen, MAX_STRING_LENGTH );
    else if( obj->condition >=70 )
      blen = str_apd_max( buf, "[G] ", blen, MAX_STRING_LENGTH );
    else if( obj->condition >=50 )
      blen = str_apd_max( buf, "[F] ", blen, MAX_STRING_LENGTH );
    else if( obj->condition >=30 )
      blen = str_apd_max( buf, "[P] ", blen, MAX_STRING_LENGTH );
    else if( obj->condition >=10 )
      blen = str_apd_max( buf, "[B] ", blen, MAX_STRING_LENGTH );
    else
      blen = str_apd_max( buf, "[D] ", blen, MAX_STRING_LENGTH );
    }
  else
    {
    if( ch->level > 50 )
      blen = str_apd_max( buf, "     ", blen, MAX_STRING_LENGTH );
    else
      blen = str_apd_max( buf, "    ", blen, MAX_STRING_LENGTH );
    }
#endif
     
    if ( fShort==0 )
    {
	if ( obj->short_descr != NULL )
          blen = str_apd_max( buf, capitalize(obj->short_descr), 
                       blen, MAX_STRING_LENGTH );
    }
    else
    if ( fShort==1 )
    {
	if ( obj->description != NULL )
          blen = str_apd_max( buf, obj->description,
                  blen, MAX_STRING_LENGTH );
    }
    else
    if ( fShort==2 )
    {
	if ( obj->long_descr != NULL )
          blen = str_apd_max( buf, obj->long_descr, blen, MAX_STRING_LENGTH );
    }

if( ( IS_OBJ_STAT(obj, ITEM_INVIS)     ) 
    || ( IS_AFFECTED(ch, AFF_DETECT_EVIL) && IS_OBJ_STAT(obj, ITEM_EVIL)   )  
    || ( IS_AFFECTED(ch, AFF_DETECT_MAGIC) && IS_OBJ_STAT(obj, ITEM_MAGIC)  ) 
    || ( IS_OBJ_STAT(obj, ITEM_GLOW)      )
    || ( IS_OBJ_STAT(obj, ITEM_HUM)       ) 
    || ( IS_OBJ_STAT(obj, ITEM_FORGERY))  
    || ( IS_OBJ_STAT(obj, ITEM_PROTOTYPE))  
    || obj->poison!=NULL )
  {
  if( !IS_NPC(ch ) && ch->ansi == 1 )
    blen = str_apd_max( buf, get_color_string(ch,COLOR_TEXT,VT102_BOLD),
                    blen, MAX_STRING_LENGTH );

    if ( IS_OBJ_STAT(obj, ITEM_INVIS)     ) 
        blen = str_apd_max( buf, " (Invis)" , blen, MAX_STRING_LENGTH    );
    if ( IS_AFFECTED(ch, AFF_DETECT_EVIL) && IS_OBJ_STAT(obj, ITEM_EVIL)   )  
        blen = str_apd_max( buf, " (Red Aura)" , blen, MAX_STRING_LENGTH    );
    if ( IS_AFFECTED(ch, AFF_DETECT_MAGIC) && IS_OBJ_STAT(obj, ITEM_MAGIC)  ) 
        blen = str_apd_max( buf, " (Magical)" , blen, MAX_STRING_LENGTH    );
    if ( IS_OBJ_STAT(obj, ITEM_GLOW)      )
        blen = str_apd_max( buf, " (Glowing)" , blen, MAX_STRING_LENGTH    );
    if ( IS_OBJ_STAT(obj, ITEM_HUM)       ) 
        blen = str_apd_max( buf, " (Humming)" , blen, MAX_STRING_LENGTH    );
    if ( IS_OBJ_STAT(obj, ITEM_PROTOTYPE)       ) 
        blen = str_apd_max( buf, " (PROTO)" , blen, MAX_STRING_LENGTH    );
    if ((IS_NPC(ch)||number_percent()<ch->pcdata->learned[gsn_detect_forgery])
	 && IS_OBJ_STAT(obj, ITEM_FORGERY))
        blen = str_apd_max( buf, " (Forgery)" , blen, MAX_STRING_LENGTH    );
    if (!IS_NPC(ch) && obj->poison!=NULL && 
        obj->poison->owner==ch->pcdata->pvnum )
      {
      char buf2[100];
      if( obj->poison->for_npc )
        sprintf( buf2, " (Poisoned M%c)", obj->poison->poison_type );
      else
        sprintf( buf2, " (Poisoned C%c)", obj->poison->poison_type );
      blen = str_apd_max( buf, buf2, blen, MAX_STRING_LENGTH);
      }
  }

    return buf;
}



/*
 * Show a list to a character.
 * Can coalesce duplicated items.
 */
void show_list_to_char( OBJ_DATA *list, CHAR_DATA *ch, int fShort,
       bool fShowNothing )
{
    char buf[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH], buf3[10];
    int leng, lenb;
    char **prgpstrShow, dim[10], bold[10];
    int *prgnShow;
    int *refShow;
    char *pstrShow;
    OBJ_DATA *obj, *tobj;
    int nShow, iShow;
    int count;
    bool tPrev;

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

    /*
     * if there's no list... Let's get outta here!  -Martin
     */
    if ( !list )
    {
        if ( fShowNothing )
           send_to_char( "Nothing.\n\r", ch );
        return;
    }


    if(!IS_NPC(ch) && ch->ansi==0 && ch->vt100==1)
      {
      strcpy(dim,"\033[m");
      strcpy(bold,"\033[1m");
      }
    else if(!IS_NPC(ch) && ch->ansi==1)
      {
      sprintf(dim,"\033[0;%d;%dm", ch->pcdata->color[0][10], 
	  ch->pcdata->color[1][10]);
      sprintf(bold,"\033[1;%d;%dm", ch->pcdata->color[0][10], 
	  ch->pcdata->color[1][10]);
      }
    else
      {
      strcpy(dim,"");
      strcpy(bold,"");
      }
    leng = str_cpy_max(buf2, dim, MAX_STRING_LENGTH);

    /*
     * Alloc space for output lines.
     */
    count = 0;
    for ( obj = list; obj != NULL; obj = obj->next_content )
	count++;

    CREATE( prgpstrShow, char *, count );
    CREATE( prgnShow, int, count );
    CREATE( refShow, int, count );
    nShow       = 0;

    /*
     * Format the list of objects.
     */
    for ( obj = list; obj != NULL; obj = obj->next_content )
    { 
	if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) )
	  {

          /* Look for previous matches - Chaos 4/17/99 */
          tPrev = FALSE;
	  if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
    if ( IS_NPC(ch) || IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ||
             (obj->basic && obj->item_type!=ITEM_ARMOR &&
             obj->item_type!=ITEM_CONTAINER && obj->item_type!=ITEM_WEAPON ))
          for ( tobj = list; tobj != obj; tobj = tobj->next_content )
	    if ( tobj->wear_loc == WEAR_NONE && can_see_obj( ch, tobj ) )
    if ( IS_NPC(ch) || IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ||
             (tobj->basic && tobj->item_type!=ITEM_ARMOR &&
             tobj->item_type!=ITEM_CONTAINER && tobj->item_type!=ITEM_WEAPON ))
              if(tobj->pIndexData->vnum==obj->pIndexData->vnum &&
                 tobj->short_descr == obj->short_descr )
                {
                tPrev = TRUE;
                break;
                }
           if(tPrev)
             continue;

	    pstrShow = format_obj_to_char( obj, ch, fShort );
	    prgnShow[nShow]=1;
	    refShow[nShow]=obj->index_reference[0]%1000;
            if( (obj->basic && obj->item_type!=ITEM_ARMOR &&
                obj->item_type!=ITEM_CONTAINER && obj->item_type!=ITEM_WEAPON)
                || !CAN_WEAR(obj, ITEM_TAKE) )
              refShow[nShow]=-1;
    if ( IS_NPC(ch) || IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) )
              refShow[nShow]=-1;

	    if ( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE) )
	    {
            /* Look for further matches - Chaos 4/17/99 */
    if ( IS_NPC(ch) || IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ||
             (obj->basic && obj->item_type!=ITEM_ARMOR &&
              obj->item_type!=ITEM_CONTAINER && obj->item_type!=ITEM_WEAPON ))
            for ( tobj=obj->next_content; tobj!=NULL; tobj=tobj->next_content)
	     if ( tobj->wear_loc == WEAR_NONE && can_see_obj( ch, tobj ) )
    if ( IS_NPC(ch) || IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ||
             (tobj->basic && tobj->item_type!=ITEM_ARMOR &&
             tobj->item_type!=ITEM_CONTAINER && tobj->item_type!=ITEM_WEAPON ))
              if(tobj->pIndexData->vnum==obj->pIndexData->vnum &&
                 tobj->short_descr == obj->short_descr )
                {
		prgnShow[nShow]++;
                }

		/*
		 * Look for duplicates, case sensitive.
		 * Matches tend to be near end so run loop backwords.
		 * This code is really shitty  -  Chaos 4/17/99
		for ( iShow = nShow - 1; iShow >= 0; iShow-- )
		{
		    if ( !strcmp( prgpstrShow[iShow], pstrShow ) )
		    {
			prgnShow[iShow]++;
			fCombine = TRUE;
			break;
		    }
		}  */
	    }

		prgpstrShow [nShow] = STRALLOC( pstrShow );
		nShow++;
	}
    }

    /*
     * Output the formatted list.
     */
    for ( iShow = 0; iShow < nShow; iShow++ )
      {
      lenb=0;
      if (( IS_NPC(ch) || IS_SET(ch->act, PLR_COMBINE)) && prgnShow[iShow]!=1 )
          {
          sprintf( buf, "%s(%2d) ", dim, prgnShow[iShow] );
          lenb = strlen( buf );
          }
      else
       if( refShow[iShow]>0 )
        {
        lenb = str_cpy_max( buf, dim, MAX_STRING_LENGTH);
	lenb = str_apd_max( buf, "#", lenb, MAX_STRING_LENGTH);
        *buf3 = '0'+(refShow[iShow]/100)%10;
        *(buf3+1) = '0'+(refShow[iShow]/10)%10;
        *(buf3+2) = '0'+(refShow[iShow])%10;
        *(buf3+3) = '\0';
	lenb = str_apd_max( buf, buf3, lenb, MAX_STRING_LENGTH);
	lenb = str_apd_max( buf, " ", lenb, MAX_STRING_LENGTH);
        }
      else
	lenb = str_cpy_max( buf, "     ", MAX_STRING_LENGTH);
      lenb = str_apd_max( buf, bold, lenb, MAX_STRING_LENGTH);
      lenb = str_apd_max( buf, prgpstrShow[iShow], lenb, MAX_STRING_LENGTH );
      lenb = str_apd_max( buf, dim, lenb, MAX_STRING_LENGTH);
      lenb = str_apd_max( buf, "\n\r", lenb, MAX_STRING_LENGTH);
      leng = str_apd_max ( buf2, buf, leng, MAX_STRING_LENGTH );
      STRFREE (prgpstrShow[iShow] );
      }

    if ( fShowNothing && nShow == 0 )
      send_to_char( "Nothing.\n\r", ch );
    if ( nShow != 0 )
      send_to_char( buf2, ch );

    /*
     * Clean up.
     */
    DISPOSE( prgpstrShow );
    DISPOSE( prgnShow );
    DISPOSE( refShow );
    return;
}



void show_char_to_char_0( CHAR_DATA *victim, CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH];
    int leng;

  if( IS_NPC( victim ) && IS_AFFECTED( victim, AFF_ETHEREAL ) && 
      (( !IS_NPC(ch) && !IS_SET(ch->act, PLR_HOLYLIGHT) ) || IS_NPC(ch) ) )
    return;

    if( !IS_NPC(ch) )
        leng = str_cpy_max( buf,  get_color_string(ch,COLOR_MOBILES,VT102_DIM),
                                        MAX_STRING_LENGTH );
    else
      {
      *buf = '\0';
      leng = 0;
      }
   if(  !IS_NPC( victim )
        && victim->long_descr!=NULL
 	&& strlen(victim->long_descr)>0
	&& victim->position == POS_STANDING 
        && !is_affected(ch, gsn_truesight) )

       leng = str_cpy_max( buf, victim->long_descr, MAX_STRING_LENGTH );
   else
   {
    if ( !IS_NPC(victim) &&  IS_SET(ch->act, PLR_HOLYLIGHT)
	&&  IS_SET(victim->act, PLR_WIZINVIS) )
     leng = str_apd_max ( buf, "(Wizinvis) " , leng, MAX_STRING_LENGTH);
    if (!IS_NPC(victim) && !victim->desc)
     leng = str_apd_max ( buf, "(Link Dead) " , leng, MAX_STRING_LENGTH);
    if ( !IS_NPC(victim) && IS_SET(victim->pcdata->player2_bits, PLR2_AFK) ) 
     leng = str_apd_max ( buf, "[AFK] " , leng, MAX_STRING_LENGTH);

    if ( victim->desc && victim->desc->connected == CON_EDITING )
     leng = str_apd_max ( buf, "(Writing) ", leng, MAX_STRING_LENGTH );

    if( !can_see( ch, victim )  && IS_NPC( victim ) )	
     {
      if( !can_see_in_room(ch, ch->in_room ) )
         leng = str_apd_max ( buf, "(Dark Room) " , leng, MAX_STRING_LENGTH);
      else
         leng = str_apd_max ( buf, "(Shouldn't see) ", leng,MAX_STRING_LENGTH);	
     }

    if ( IS_AFFECTED(victim, AFF2_MIRROR_IMAGE)) 
          leng = str_apd_max (buf, "(Multiple) " , leng, MAX_STRING_LENGTH);
    if ( IS_AFFECTED(victim, AFF_INVISIBLE)   ) 
          leng = str_apd_max ( buf, "(Invis) "   , leng, MAX_STRING_LENGTH   );
    if ( IS_AFFECTED(victim, AFF_HIDE)        ) 
          leng = str_apd_max ( buf, "(Hide) "     , leng, MAX_STRING_LENGTH  );
    if ( IS_AFFECTED(victim, AFF_STEALTH)     )
          leng = str_apd_max ( buf, "(Stealth) "  , leng, MAX_STRING_LENGTH  );
    if ( IS_NPC(victim) && IS_SET(victim->act, ACT_PROTOTYPE ) )
	  leng = str_apd_max ( buf, "(PROTO) "    , leng, MAX_STRING_LENGTH );
    if(IS_NPC(ch)||
       ch->mclass[CLASS_ILLUSIONIST]>=30||ch->mclass[CLASS_NECROMANCER]>=30)
      if(IS_AFFECTED(victim, AFF_CHARM)       ) 
          leng = str_apd_max ( buf, "(Charmed) " , leng, MAX_STRING_LENGTH   );
    if ( IS_AFFECTED(victim, AFF_PASS_DOOR)   ) 
          leng = str_apd_max ( buf, "(Translucent) ", leng, MAX_STRING_LENGTH);
    if ( IS_AFFECTED(victim, AFF_FAERIE_FIRE) ) 
          leng = str_apd_max ( buf, "(Pink Aura) ", leng, MAX_STRING_LENGTH  );
    if ( IS_AFFECTED(victim, AFF2_MAGE_SHIELD) ) 
          leng = str_apd_max ( buf, "(Shimmering) " , leng, MAX_STRING_LENGTH );
    if ( IS_AFFECTED(victim, AFF2_POSSESS) && is_affected(ch, gsn_truesight) ) 
          leng = str_apd_max ( buf, "(Possessed) " , leng, MAX_STRING_LENGTH );
    if ( IS_AFFECTED(victim, AFF2_FIRESHIELD) )
          leng = str_apd_max ( buf, "(Burning) " , leng, MAX_STRING_LENGTH );
    if ( IS_EVIL(victim)
    &&   IS_AFFECTED(ch, AFF_DETECT_EVIL)     ) 
          leng = str_apd_max ( buf, "(Red Aura) "  , leng, MAX_STRING_LENGTH );
    if ( IS_AFFECTED(victim, AFF_SANCTUARY)   ) 
          leng = str_apd_max ( buf, "(White Aura) ", leng, MAX_STRING_LENGTH );
    if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_KILLER ) )
	  leng = str_apd_max ( buf, "(KILLER) "    , leng, MAX_STRING_LENGTH );
    if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_OUTCAST ) )
	  leng = str_apd_max ( buf, "(OUTCAST) "    , leng, MAX_STRING_LENGTH );
    if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_THIEF  ) )
	  leng = str_apd_max ( buf, "(THIEF) "     , leng, MAX_STRING_LENGTH );
    if ( IS_NPC(victim) && !IS_NPC(ch) && ch->race==RACE_HALFLING &&
         IS_SET(victim->act, ACT_AGGRESSIVE ) )
	  leng = str_apd_max ( buf, "(Aggressive) ", leng, MAX_STRING_LENGTH );
    if ( IS_NPC( victim ) && IS_AFFECTED( victim, AFF_ETHEREAL ) )
	  leng = str_apd_max ( buf, "(ETHEREAL) ", leng, MAX_STRING_LENGTH );

  if(IS_NPC(victim))
    if ( victim->position == POS_STANDING && victim->long_descr[0] != '\0' )
      {
	    leng = str_apd_max ( buf, victim->long_descr, leng, 
                                      MAX_STRING_LENGTH );
      if( buf[strlen(buf)-1]!='\n' && buf[strlen(buf)-1]!='\r')
	leng = str_apd_max ( buf, "\n\r", leng, MAX_STRING_LENGTH );
      buf[0] = UPPER(buf[0]);
      send_to_char( buf, ch );
      return;
      }

      leng = str_apd_max ( buf, get_name(victim), leng, MAX_STRING_LENGTH );
    

    switch ( victim->position )
    {
    case POS_DEAD:     
          leng = str_apd_max ( buf, " is DEAD!!", leng, MAX_STRING_LENGTH );
          break;
    case POS_MORTAL:   
          leng = str_apd_max ( buf, " is mortally wounded.", leng, 
                                                    MAX_STRING_LENGTH );
          break;
    case POS_INCAP:    
          leng = str_apd_max ( buf, " is incapacitated.", leng, 
                                                    MAX_STRING_LENGTH );
          break;
    case POS_STUNNED:  
          leng = str_apd_max ( buf, " is lying here stunned.", leng, 
                                                    MAX_STRING_LENGTH );
          break;
    case POS_SLEEPING: 
          leng = str_apd_max ( buf, " is sleeping here.", leng, 
                                                    MAX_STRING_LENGTH );
          break;
    case POS_RESTING:  
          leng = str_apd_max ( buf, " is resting here.", leng, 
                                                    MAX_STRING_LENGTH );
          break;
    case POS_FIGHTING:
	leng = str_apd_max ( buf, " is here, fighting ", leng, 
                                                    MAX_STRING_LENGTH );
	if ( victim->fighting == NULL )
	    leng = str_apd_max ( buf, "thin air??", leng, 
                                                    MAX_STRING_LENGTH );
	else if ( who_fighting( victim ) == ch )
	    leng = str_apd_max ( buf, "YOU!", leng, MAX_STRING_LENGTH );
	else if ( victim->in_room == victim->fighting->who->in_room )
	{
	    leng = str_apd_max ( buf, PERS( victim->fighting->who, ch ) , leng, 
                                                     MAX_STRING_LENGTH );
	    leng = str_apd_max ( buf, ".", leng, MAX_STRING_LENGTH  );
	}
	else
	    leng = str_apd_max ( buf, "somone who left??", leng,
                                                     MAX_STRING_LENGTH );
	break;
    default: 
    /*
      What's the point in going through all that if the person has a different
      long descr anyway ? :) Martin 7/8/98 
        if((!IS_NPC(victim))&&(victim->long_descr!=NULL)&&
	 (strlen(victim->long_descr)>0))
	leng = str_cpy_max( buf, victim->long_descr, MAX_STRING_LENGTH );
      else */
	leng = str_apd_max ( buf, " is here.", leng, MAX_STRING_LENGTH );
      break;
    }
    }
    leng = str_apd_max( buf, "\n\r", leng, MAX_STRING_LENGTH );
    buf[0] = UPPER(buf[0]);
    send_to_char( buf, ch );
    return;
}



void show_char_to_char_1( CHAR_DATA *victim, CHAR_DATA *ch )
{
    char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
    OBJ_DATA *obj;
    CHAR_DATA *fch;
    int iWear;
    int percent;
    bool found;
    int leng;

  if( ch != NULL)
   {
    if ( can_see( victim, ch ) && !FINGER_MODE)
    {
	act( "$n looks at you.", ch, NULL, victim, TO_VICT    );
	act( "$n looks at $N.",  ch, NULL, victim, TO_NOTVICT );
    }

    if ( victim->description[0] != '\0' )
    {
    if( IS_NPC( victim ) )
	send_to_char( (const char *)ansi_translate_text( ch,
            victim->description), ch );
    else
	send_to_char( (const char *)ansi_translate_text( ch,
            victim->description), ch );
    }
    else
    {
	act( "You see nothing special about $M.", ch, NULL, victim, TO_CHAR );
    }
   }

if( FINGER_MODE )
  return;


    if ( victim->max_hit > 0 )
	percent = ( 100 * victim->hit ) / victim->max_hit;
    else
	percent = -1;
    if( ch!= NULL)
      leng =str_cpy_max( buf, capitalize(PERS(victim, ch)), MAX_STRING_LENGTH );
    else
      {
      *buf='\0';
      leng = 0;
      }

	 if ( percent >= 100 )
            leng = str_apd_max ( buf, " is in perfect health."  , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  90 )
            leng = str_apd_max ( buf, " is slightly scratched." , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  80 )
            leng = str_apd_max ( buf, " has a few bruises."     , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  70 )
            leng = str_apd_max ( buf, " has some cuts."         , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  60 )
            leng = str_apd_max ( buf, " has several wounds."    , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  50 )
            leng = str_apd_max ( buf, " has many nasty wounds." , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  40 )
            leng = str_apd_max ( buf, " is bleeding freely."    , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  30 )
            leng = str_apd_max ( buf, " is covered in blood."   , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  20 )
            leng = str_apd_max ( buf, " is leaking guts."       , leng,
                                        MAX_STRING_LENGTH );
    else if ( percent >=  10 )
            leng = str_apd_max ( buf, " is almost dead."        , leng,
                                        MAX_STRING_LENGTH );
    else   
            leng = str_apd_max ( buf, " is DYING."              , leng,
                                        MAX_STRING_LENGTH );

    buf[0] = UPPER(buf[0]);
  if( ch != NULL )
    send_to_char( buf, ch );
  else
    {
    strcpy( buf2, "    ");
    strcat( buf2, capitalize(get_name( victim )));
    strcat( buf2, buf);
    strcat( buf2, "\n\r");
    for( fch = victim->in_room->first_person ; fch != NULL; fch = fch->next_in_room)
      if( !IS_NPC( fch) && victim!=fch)
        if(fch->position>POS_SLEEPING&&(can_see(fch,victim)||can_see_is_hidden)
           && !IS_SET(fch->act,PLR_DAMAGE))
          {
             if( is_same_group( fch, victim ) &&
             fch->ansi==1 && fch->leader!=NULL)
	          {
	          char buf3[160];
	          sprintf( buf3, "\033[0;%d;%dm%s", fch->pcdata->color[0][8],
	             fch->pcdata->color[1][8], buf2);
                  if( !IS_SET( fch->pcdata->spam, 16))
	            send_to_combat_char( buf3, fch);
	          }
         else if(victim->fighting!=NULL &&
                   is_same_group( fch, victim->fighting->who ) &&
                   fch->ansi==1 && fch->leader!=NULL)
	         {
	         char buf3[160];
	         sprintf( buf3, "\033[0;%d;%dm%s", fch->pcdata->color[0][5],
	         fch->pcdata->color[1][5], buf2);
                 if( !IS_SET( fch->pcdata->spam, 64) &&
                     !IS_SET( fch->pcdata->spam, 1))
	           send_to_combat_char( buf3, fch);
	         }
	       else
                 if( !IS_SET( fch->pcdata->spam, 256))
	           send_to_combat_char( buf2, fch);
	       }
    return;
    }

    /* greater peek junk -Dug */
    if ( victim != ch
    &&   !IS_NPC(ch)
    &&   number_percent( ) < ch->pcdata->learned[gsn_greater_peek] )
      {
      sprintf(buf,"%s has about %d hitpoints left.\n\r",
	  capitalize(PERS(victim,ch)), victim->hit);
      send_to_char( buf, ch );
      }

    leng = 0;
    *buf = '\0';

    found = FALSE;
    for ( iWear = 0; iWear < MAX_WEAR; iWear++ )
    {
	if ( ( obj = get_eq_char( victim, iWear ) ) != NULL
	&&   can_see_obj( ch, obj ) )
	{
	    if ( !found )
	    {
            leng = str_apd_max ( buf,get_name(victim),leng,MAX_STRING_LENGTH );
            leng = str_apd_max ( buf, " is using:\n\r", leng,
                                              MAX_STRING_LENGTH );
		found = TRUE;
	    }
	    leng = str_apd_max(buf, where_name[iWear], leng,MAX_STRING_LENGTH);
	    leng = str_apd_max(buf, format_obj_to_char( obj, ch, 0), leng,
                                              MAX_STRING_LENGTH);
	    leng = str_apd_max(buf, "\n\r", leng, MAX_STRING_LENGTH);
	}
    }

	    if ( !found )
	    {
            leng = str_apd_max ( buf,get_name(victim),leng,MAX_STRING_LENGTH );
            leng = str_apd_max ( buf, " is using:    Nothing!\n\r", leng,
                                              MAX_STRING_LENGTH );
            }

    send_to_char( buf, ch );


    if ( victim != ch
    &&   !IS_NPC(ch)
    &&  !IS_SET( ch->pcdata->player2_bits, PLR2_PEEK )
    &&  ((number_percent( ) < ch->pcdata->learned[gsn_peek] ) ||
         (which_god(ch) == GOD_POLICE) || (ch->level == MAX_LEVEL)))
    {
	send_to_char( "You peek at the inventory:\n\r", ch );
	show_list_to_char( victim->first_carrying, ch, 0, TRUE );
    }

    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 ( rch == ch )
	    continue;

	if ( !IS_NPC(rch)
        &&  !IS_SET(ch->act, PLR_HOLYLIGHT)
	&&  IS_SET(rch->act, PLR_WIZINVIS) )
	    continue;

        /* Slight chance that person doesn't see someone due to smoke 
           Martin 14/8/98 */

	if( ch->position>POS_SLEEPING&& (can_see( ch, rch )) &&
	   ((!IS_AFFECTED( rch, AFF_HIDE)) ||
         ( IS_AFFECTED( rch, AFF_HIDE) && IS_AFFECTED( ch, AFF_DETECT_HIDDEN))))
	{
           if (IS_SET(ch->in_room->room_flags, ROOM_SMOKE) 
                && number_percent()<(40-get_curr_int(ch)))
            send_to_char("The smoke obscures the outline of a large shape.\n\r", ch);
           else
	    show_char_to_char_0( rch, ch );
	}
	else if ( !can_see_in_room( ch, ch->in_room ) 
		  && !IS_AFFECTED( rch, AFF_HIDE)
		  && IS_AFFECTED(rch, AFF_INFRARED ) )
	{
          if( IS_NPC(rch) && !IS_NPC(ch) && ch->race==RACE_HALFLING &&
             IS_SET(rch->act, ACT_AGGRESSIVE ) )
	    send_to_char( "You see glowing aggressive eyes watching YOU!\n\r", ch );
          else
	    send_to_char( "You see glowing red eyes watching YOU!\n\r", ch );
	}
        else
          if( IS_NPC(rch) && !IS_NPC(ch) && ch->race==RACE_HALFLING &&
             IS_SET(rch->act, ACT_AGGRESSIVE ) )
	    send_to_char( "You see a lurking presense.\n\r", ch );
    }

    return;
} 



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

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

    return TRUE;
}


int sCRrNum;

void showCharRoom(CHAR_DATA *ch,ROOM_INDEX_DATA *rm,int dirNum,int look_range)
  {
  CHAR_DATA *rch;
  char buf[MAX_STRING_LENGTH];
  int look_chance;

  if(++sCRrNum>look_range)
    return;

if( rm==NULL )
  {
  log_string( "Null room in showChar");
  return;
  }

  switch(look_range)
    {
    case SHORT_RANGE:
    default:
      if( !IS_NPC(ch) && ch->pcdata->learned[gsn_short_range]==0)
	return;
      if(!IS_NPC(ch))
	look_chance=ch->pcdata->learned[gsn_short_range];
      else
	look_chance=90;
      break;
    case MED_RANGE:
      if( !IS_NPC(ch) && ch->pcdata->learned[gsn_med_range]==0)
	return;
      if(!IS_NPC(ch))
	look_chance=(2*ch->pcdata->learned[gsn_short_range]+
		     ch->pcdata->learned[gsn_med_range])/3;
      else
	look_chance=80;
      break;
    case LONG_RANGE:
      if( !IS_NPC(ch) && ch->pcdata->learned[gsn_long_range]==0)
	return;
      if(!IS_NPC(ch))
	look_chance=(3*ch->pcdata->learned[gsn_short_range]+
		   2*ch->pcdata->learned[gsn_med_range]+
		   ch->pcdata->learned[gsn_long_range])/6;
      else
	look_chance=70;
      break;
    case 6:  /* stop over the limit */
      return;
    }

  if(IS_SET(rm->room_flags,ROOM_SAFE|ROOM_SOLITARY|ROOM_PRIVATE))
    {
    sprintf(buf,"%d> A stretch of nothing...\n\r", look_range);
    send_to_char(buf,ch);
    }
  else if(!IS_NPC(ch) && !IS_AFFECTED(ch,AFF_INFRARED) &&
	  !IS_SET(ch->act, PLR_HOLYLIGHT) && !can_see_in_room(ch,rm) )
    {
    sprintf(buf,"%d> A length of darkness...\n\r", look_range);
    send_to_char(buf,ch);
    }
  else
    {
    if(IS_NPC(ch) || IS_SET(ch->act, PLR_HOLYLIGHT) || can_see_in_room(ch,rm) )
      sprintf(buf,"%d> %s\n\r",look_range,rm->name);
    else
      sprintf(buf,"%d> A length of darkness...\n\r", look_range);
    send_to_char(buf,ch);
  
    for(rch=rm->first_person;rch!=NULL;rch=rch->next_in_room)
      {
      if(can_see(ch,rch)&&!(IS_AFFECTED(rch,AFF_HIDE)||
	 IS_AFFECTED(rch,AFF_STEALTH)))
        {
	if(number_percent()<look_chance)
	  {
	  sprintf(buf,"    %s%s\n\r",
              get_color_string(ch,COLOR_MOBILES,VT102_BOLD),
              get_name( rch ) );
	  send_to_char(buf,ch);
	  }
        }
      else
       if( !IS_NPC(ch) && IS_NPC(rch) && IS_SET(rch->act, ACT_AGGRESSIVE) &&
           ch->race==RACE_HALFLING )
        {
	if(number_percent()<look_chance)
	  {
	  sprintf(buf,"    %sA lurking presense.\n\r",
              get_color_string(ch,COLOR_MOBILES,VT102_BOLD) );
	  send_to_char(buf,ch);
	  }
        }
      }
    }
  if(rm->exit[dirNum]==NULL)
    return;
  if(IS_SET(rm->exit[dirNum]->exit_info, EX_CLOSED))
    return;
  if(rm->exit[dirNum]->to_room==NULL)
    return;

      if(IS_SET(rm->exit[dirNum]->exit_info, EX_CLOSED) ||
        (IS_SET(rm->exit[dirNum]->exit_info,EX_HIDDEN) &&
	  !IS_AFFECTED(ch,AFF_DETECT_HIDDEN))  ||
	(!can_use_exit(ch, rm, dirNum) ) )
        return;

  showCharRoom(ch,rm->exit[dirNum]->to_room,dirNum,look_range+1);
  return;
  }

int showCharDir(CHAR_DATA *ch,int dirNum)
  {
  /* extern char * const dir_name[]; */
  int look_range;

  if(ch->in_room->exit[dirNum]!=NULL)
    if(ch->in_room->exit[dirNum]->to_room!=NULL)
      {
      if(IS_SET(ch->in_room->exit[dirNum]->exit_info, EX_CLOSED) ||
        (IS_SET(ch->in_room->exit[dirNum]->exit_info,EX_HIDDEN) &&
	  !IS_AFFECTED(ch,AFF_DETECT_HIDDEN))  ||
	  !can_use_exit(ch, ch->in_room, dirNum))
	return 0;
      if(IS_NPC(ch))
	look_range=MED_RANGE;
      else
	look_range=ch->pcdata->learned[gsn_long_range]>0?LONG_RANGE:
	  ch->pcdata->learned[gsn_med_range]>0?MED_RANGE:SHORT_RANGE;
      /* switch(dirNum)
	{
	case DIR_UP:
	  strcpy(buf1,"above");
	  break;
	case DIR_DOWN:
	  strcpy(buf1,"below");
	  break;
	default:
	  sprintf(buf1,"to the %s of",dir_name[dirNum]);
	  break;
	}
      sprintf(buf,"...in the distance %s you, you see...",buf1);
      send_to_char(buf,ch); */
      sCRrNum=0;
      showCharRoom(ch,ch->in_room->exit[dirNum]->to_room,dirNum,1);
      }
  return sCRrNum;
  }

    /* Chaos 12/15/93 
       modified slightly by Martin 7/3/99 to do extract_char and close_socket
       seeing as level 1 characters now save...  */
void do_delete( CHAR_DATA *ch, char *arg)
{
  char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH], buf3[80] ;
  char name_buf[20];
  bool PassRqd;
  DESCRIPTOR_DATA *d;
  CHAR_DATA *rch;

  DISALLOW_SNOOP = TRUE;

  if(IS_NPC(ch)||ch->position==POS_FIGHTING||ch->fighting!=NULL)
    {
    send_to_char( "You may not do that now.\n\r", ch);
    wipe_string( arg );
    return;
    }
  if (ch->which_god== GOD_DEMISE && ch->level < ch->pcdata->demisedlevel+3)
  {
   send_to_char("You must gain 3 levels before you can delete !\n\r",ch);
   return;
  }
  if( arg == NULL )
    PassRqd = FALSE;
  else
    PassRqd = TRUE;
  if(PassRqd && arg[0]=='\0')
    {
    send_to_char( "You must use a password with this command.\n\rThis command permanently deletes your character!!!!\n\rWarning!   Warning!\n\r", ch);
    wipe_string( arg );
    return;
    }
  if( !PassRqd || !strcmp(crypt(arg,ch->pcdata->pwd),ch->pcdata->pwd) )
    {
    strcpy( buf3, ch->name);
    buf3[1]='\0';
    if( buf3[0]>='A' && buf3[0]<='Z')
      buf3[0]+=( 'a' - 'A');
    if( PassRqd )
      send_to_char( "You have permanently deleted your character!\n\r", ch);
    else
      {
      send_to_char( "Your character has been permanently deleted!\n\r", ch);
      send_to_char( "You have a serious bug that could not be corrected.\n\r",ch);
      }
    strcpy( name_buf, capitalize( ch->name ) );

    if( ch->pcdata->clan != NULL)
     ch->pcdata->clan->members--;

    save_clan (ch->pcdata->clan);

    if( COMPRESS_FILES)
      {
      sprintf( buf, "%s/%s/%s.gz", PLAYER_DIR, buf3, name_buf);
      sprintf(buf2,"%s/%s/delete.%s.gz",PLAYER_DIR,buf3, name_buf);
      }
    else
      {
      sprintf( buf, "%s/%s/%s", PLAYER_DIR, buf3, name_buf );
      sprintf(buf2,"%s/%s/delete.%s", PLAYER_DIR, buf3, name_buf );
      }
    remove( buf2 );
    rename( buf, buf2);

/*    ch->level=1;
    do_quit( ch, "arglebargle");*/

    if (ch->master != NULL)
      stop_follower (ch);
 
    if (ch->pcdata->bet_mode == 2)
      do_resign (ch, NULL);
    do_return (ch, NULL);

    if (ch->vt100 != 0 && is_desc_valid (ch))
      vt100off (ch);

    for (rch = ch->in_room->first_person; rch != NULL; rch = rch->next_in_room)
     if (can_see (rch, ch) && rch != ch && rch->position > POS_SLEEPING)
      ch_printf (rch, "%s has left the game.\n\r", get_name (ch));

    log_printf ("%s has deleted.", get_name(ch));

  if (ch->desc != NULL)
  {
   d = ch->desc;
   force_help (d, "goodbye");
   write_to_port (d);
   *d->inbuf = '\0';
  }
  extract_char (ch, TRUE);
  if (d != NULL)
    d->character = NULL;
  if (d != NULL)
    close_socket (d, TRUE);

    wipe_string( arg );
    return;
    }
  else
    {
    send_to_char( "That was not your password.\n\rThis command permanently deletes your character!!!!\n\rWarning!   Warning!\n\r", ch);
    }
    wipe_string( arg );
  return;
}

void do_speak( CHAR_DATA *ch, char *argument )
{
   char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
   int cnt;
   if(IS_NPC(ch) || argument[0]=='\0')
      return;
   buf[0]=argument[0];
   buf[1]=argument[1];
   buf[2]='\0';
   buf2[2]='\0';
   for(cnt=0;cnt<MAX_RACE;cnt++)
      {
      buf2[0]=race_table[cnt].race_name[0];
      buf2[1]=race_table[cnt].race_name[1];
      if(!strcasecmp(buf,buf2))
	if(IS_SHIFT(ch->language,cnt))
	  {
	  sprintf(buf,"Language set to %s.\n\r", race_table[cnt].race_name);
	  send_to_char( buf, ch);
	  ch->speak=SHIFT(cnt);
	  return;
	  }
      }
    send_to_char( "You cannot speak that language.\n\r", ch);
    return;
    }

void do_notice( CHAR_DATA *ch, char *argument)
    {
    CHAR_DATA *list;
    char buf[MAX_STRING_LENGTH];
    if(IS_NPC(ch))
      return;
    if(IS_AFFECTED(ch, AFF_BLIND))
      {
      send_to_char("You are to blind to do that.\n\r", ch);
      return;
      }
    if(ch->pcdata->learned[gsn_notice]>number_percent())
      {
      send_to_char("You search the room for creatures.\n\r", ch);
      for( list=ch->in_room->first_person; list!=NULL; list=list->next_in_room)
	if(ch!=list && (IS_NPC(list) || !IS_SET(list->act, PLR_WIZINVIS)) &&
          ( !IS_NPC(list) || !IS_AFFECTED( list, AFF_ETHEREAL ) ) )
	  {
	  if((!IS_AFFECTED(list, AFF_INVISIBLE))
	     ||(IS_AFFECTED(list,AFF_INVISIBLE)
		&& (is_affected(ch, gsn_truesight) || IS_AFFECTED(ch, AFF_DETECT_INVIS))))
	    {
	    if(!IS_NPC(list))
	      strcpy(buf,list->name);
	    else
	      strcpy(buf,list->short_descr);
	    }
	  else
	    strcpy(buf,"Someone");
	  if(buf[0]>='a' && buf[0]<='z')
	    buf[0]-=('a'-'A');
	  strcat(buf, " is here.");
	  send_to_char(buf, ch);
	  }
      }
    return;
    }
      
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;
    OBJ_DATA *obj;
    char *pdesc;
    int door;
    char buft[200];
    int cnt;

    if ( ch->desc == NULL )
	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!\n\r", ch );
	return;
    }

    if ( !check_blind( ch ) )
	return;

    if ( !IS_NPC(ch) 
    &&   !IS_SET(ch->act, PLR_HOLYLIGHT)
    &&   !can_see_in_room( ch, ch->in_room )
    &&   !IS_AFFECTED(ch, AFF_INFRARED))
    {
	send_to_char( "It is pitch black ... \n\r", ch );
	show_char_to_char( ch->in_room->first_person, ch );
	  return;
    }
  
    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );

    if ( arg1[0] == '\0' || !strcasecmp( arg1, "auto" ) )
    {
    int leng;
	/* 'look' or 'look auto' */
    if( !IS_NPC(ch) && ch->ansi==1)
      {
      leng = str_cpy_max( buf,  get_color_string(ch,COLOR_PROMPT,VT102_BOLD),
                                        MAX_STRING_LENGTH );
      leng = str_apd_max( buf, ch->in_room->name, leng, MAX_STRING_LENGTH );
      leng = str_apd_max( buf, "\n\r", leng, MAX_STRING_LENGTH );
      }
    else
      {
      leng = str_cpy_max( buf, "  ", MAX_STRING_LENGTH );
      leng = str_apd_max( buf, ch->in_room->name, leng, MAX_STRING_LENGTH );
      leng = str_apd_max( buf, "\n\r", leng, MAX_STRING_LENGTH );
      }
    send_to_char( buf,  ch );

	if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT))
	    do_exits( ch, "auto" );


	if ( arg1[0] == '\0'
	|| ( !IS_NPC(ch) && !IS_SET(ch->act, PLR_BRIEF) ) )
      {
      if( !IS_NPC(ch) && ch->ansi==1)
        leng = str_cpy_max( buf,  get_color_string( ch, COLOR_TEXT, VT102_DIM),
                                        MAX_STRING_LENGTH );
      else
        {
        leng = 0;
        *buf = '\0';
        }
      if (IS_SET(ch->in_room->room_flags, ROOM_HALLUCINATE) && 
          !is_affected(ch, gsn_truesight) && !IS_SET(ch->act, PLR_HOLYLIGHT)) 
        leng = str_apd_max( buf, (const char *)ansi_translate_text( ch,
              ch->in_room->hallucinate_room->description), 
              leng, MAX_STRING_LENGTH );
      else
        leng = str_apd_max( buf, (const char *)ansi_translate_text( ch,
              ch->in_room->description) , leng, 
              MAX_STRING_LENGTH );
      if( buf[leng-2]!='\n' &&  buf[leng-2]!='\r')
	leng = str_apd_max( buf, "\n", leng, MAX_STRING_LENGTH);
      if( buf[leng-1]!='\r')
	leng = str_apd_max( buf, "\r", leng, MAX_STRING_LENGTH);
      send_to_char( buf, ch );
      }
        if (IS_SET(ch->in_room->room_flags, ROOM_SMOKE))
         send_to_char( "A cloud of dark purple smoke partially obscures your vision.\n\r", ch );
        for(cnt=0;cnt<MAX_LAST_LEFT;cnt++)
        {
         if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_BLOOD))
         {
          char buf[MAX_INPUT_LENGTH];

          if (ch->ansi==1)
           sprintf(buf, "     \033[1;31mA trail of blood "); 
          else
           sprintf(buf, "     A trail of blood "); 
          
         if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_NORTH))
            strcat(buf, "leads to the north.\n\r");
         else if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_SOUTH))
            strcat(buf, "leads to the south.\n\r");
         else if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_EAST))
            strcat(buf, "leads to the east.\n\r");
         else if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_WEST))
            strcat(buf, "leads to the west.\n\r");
         else if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_UP))
            strcat(buf, "leads up.\n\r");
         else if (IS_SET(ch->in_room->last_left_bits[cnt], TRACK_DOWN))
            strcat(buf, "leads down.\n\r");
          send_to_char(buf, ch);
          break;
         }
        }
	show_list_to_char( ch->in_room->first_content, ch, 1, FALSE );
	show_char_to_char( ch->in_room->first_person,   ch );
	return;
    }

    if ( !strcasecmp( arg1, "i" ) || !strcasecmp( arg1, "in" ) )
    {
	/* 'look in' */
	if ( arg2[0] == '\0' )
	{
	    send_to_char( "Look in what?\n\r", ch );
	    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_DRINK_CON:
	    if ( obj->value[1] <= 0 )
	    {
		send_to_char( "It is empty.\n\r", ch );
		break;
	    }

	    sprintf( buf, "It's %s full of a %s liquid.\n\r",
		obj->value[1] <     obj->value[0] / 4
		    ? "less than" :
		obj->value[1] < 3 * obj->value[0] / 4
		    ? "about"     : "more than",
		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->first_content, ch, 0, TRUE );
	    break;
	}
	return;
    }

    /*  

      Changed this to normal get_char_room...otherwise ppl can look at 
      stealthed ppl without even having detect hidden...big hole
      Martin 6/8/98
     if(( victim = get_char_room_even_hidden( ch, arg1 ) ) != NULL )
    */
    if(( victim = get_char_room( ch, arg1 ) ) != NULL )
    {
	show_char_to_char_1( victim, ch );


  if( !IS_NPC( ch ) && ch->desc!=NULL && IS_NPC(victim) &&
      ch->desc->character==ch && victim->pIndexData->mob_file !=NULL &&
      !IS_SET( ch->pcdata->player2_bits, PLR2_EXTERNAL_FILES ) &&
      IS_SET( ch->act, PLR_TERMINAL ) )
    {
    /* Send notice of file */

    write_to_port( ch->desc );
    sprintf( buf, "%c%c%s%c", 29, 'E', victim->pIndexData->mob_file, 29);
    write_to_buffer( ch->desc, buf, 1000000 );
    }
    


        if( IS_NPC( victim ) && !IS_NPC( ch ) )
          if( ch->ansi != 0 && victim->pIndexData->picture != NULL)
            act( "$N has a displayable picture.", ch, NULL, victim, TO_CHAR );
/*
        if( TEST_GAME )
          {
          AREA_DATA *pArea;
  if(!IS_NPC(victim))
    {
    unsigned long num;

    for(pArea=first_area;pArea!=NULL;pArea=pArea->next)
      {
      if(victim->pcdata->quest[(num=(pArea->low_r_vnum/100))]!=0)
	{
	sprintf(buf,"%s:%08lX\n",pArea->name, victim->pcdata->quest[num]);
	send_to_char( buf, ch );
	}
      }
    }
  else
    {
    sprintf(buf,"Quest '%s' #%08lX\n",victim->pIndexData->area->name,
	   victim->pIndexData->mob_quest);
	  send_to_char( buf, ch );
    }
          }
*/
	return;
    }

    for ( obj = ch->first_carrying; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
          {
	    pdesc = get_extra_descr( arg1, obj->first_extradesc );
	    if ( pdesc != NULL )
	    {
		send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
         if( !IS_NPC( ch ) )
          if( ch->ansi != 0 && obj->pIndexData->picture != NULL)
              act( "$p has a picture.", ch, obj, NULL, TO_CHAR);
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->first_extradesc );
	    if ( pdesc != NULL )
	    {
		send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
         if( !IS_NPC( ch ) )
          if( ch->ansi != 0 && obj->pIndexData->picture != NULL)
              act( "$p has a picture.", ch, obj, NULL, TO_CHAR);
		return;
	    }
	}

	if ( is_name( arg1, obj->name ) || 
             ( is_object_reference(obj,arg1) &&
    !IS_NPC(ch) && !IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ))
	{

#ifdef EQUIPMENT_DAMAGE
  if( ch->level > 50 )
    {
      sprintf( buft, "%s has a condition of %d%%.\n\r",
         capitalize(obj->short_descr), obj->condition );
    }
  else
    {
        if( obj->condition >= 90 )
          sprintf( buft, "%s is in great condition.\n\r",
              capitalize(obj->short_descr));
        else if( obj->condition >= 70 )
          sprintf( buft, "%s is in good condition.\n\r",
              capitalize(obj->short_descr));
        else if( obj->condition >= 50 )
          sprintf( buft, "%s is in fair condition.\n\r",
              capitalize(obj->short_descr));
        else if( obj->condition >= 30 )
          sprintf( buft, "%s is in poor condition.\n\r",
              capitalize(obj->short_descr));
        else if( obj->condition >= 10 )
          sprintf( buft, "%s is in bad condition.\n\r",
              capitalize(obj->short_descr));
        else 
          sprintf( buft, "%s is about to fall apart.\n\r",
              capitalize(obj->short_descr));
      }
    send_to_char( buft, ch );
#endif

	    if( obj->long_descr[0]=='\0')
	      {
	      sprintf( buft, "You see nothing special about %s.\n\r",
		  obj->short_descr );
	      send_to_char( buft, ch );
	      }
	    else
              send_to_char( (const char *)ansi_translate_text(ch, obj->long_descr), ch );
         if( !IS_NPC( ch ) )
          {
  if( !IS_NPC( ch ) && ch->desc!=NULL && 
      ch->desc->character==ch && obj->pIndexData->obj_file !=NULL &&
      !IS_SET( ch->pcdata->player2_bits, PLR2_EXTERNAL_FILES ) &&
      IS_SET( ch->act, PLR_TERMINAL ) )
    {
    /* Send notice of file */

    write_to_port( ch->desc );
    sprintf( buf, "%c%c%s%c", 29, 'E', obj->pIndexData->obj_file, 29);
    write_to_buffer( ch->desc, buf, 1000000 );
    }

          if( ch->ansi != 0 && obj->pIndexData->picture != NULL)
              act( "$p has a picture.", ch, obj, NULL, TO_CHAR);
          if( obj->poison != NULL && obj->poison->owner == ch->pcdata->pvnum )
            {
            char bufc[12];
            if( obj->poison->instant_damage_high > 0 &&
                obj->poison->constant_damage_high > 0 )
              strcpy( bufc, "green" );
            else
            if( obj->poison->constant_damage_high > 0 )
              strcpy( bufc, "blue" );
            else
              strcpy( bufc, "purple" );
            if( obj->poison->for_npc )
              sprintf( buf, "There is murky %s poison on this object.\n\r", 
                 bufc );
            else
              sprintf( buf, "There is clear %s poison on this object.\n\r", 
                 bufc );
            send_to_char( buf, ch );
            }
          }
	    return;
	}
    }

    for ( obj = ch->in_room->first_content; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
	{
	    pdesc = get_extra_descr( arg1, obj->first_extradesc );
	    if ( pdesc != NULL )
	    {
		send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->first_extradesc );
	    if ( pdesc != NULL )
	    {
		send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
		return;
	    }
	}

	if ( is_name( arg1, obj->name ) || (is_object_reference(obj,arg1) &&
    !IS_NPC(ch) && !IS_SET(ch->pcdata->player2_bits, PLR2_ITEM_REF ) ))
	{
	    if( obj->long_descr[0]=='\0')
	      {
	      sprintf( buft, "You see nothing special about %s.\n\r",
		 obj->short_descr );
	      send_to_char( buft, ch );
	      }
	    else
	      send_to_char( (const char *)ansi_translate_text(ch, obj->long_descr), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
	    return;
	}
    }

    pdesc = get_extra_descr( arg1, ch->in_room->first_extradesc );
    if ( pdesc != NULL )
    {
	send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
	return;
    }
    for ( obj = ch->first_carrying; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
	{
	    pdesc = get_extra_descr( arg1, obj->first_extradesc );
	    if ( pdesc != NULL )
	    {
	send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->first_extradesc );
	    if ( pdesc != NULL )
	    {
	send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
		return;
	    }
	}

	if ( is_name_short( arg1, obj->name ) )
	{
	    if( obj->long_descr[0]=='\0')
	      {
	      sprintf( buft, "You see nothing special about %s.\n\r",
		  obj->short_descr );
	      send_to_char( buft, ch );
	      }
	    else
	      send_to_char( (const char *)ansi_translate_text(
                            ch, obj->long_descr), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
	    return;
	}
     }
    for ( obj = ch->in_room->first_content; obj != NULL; obj = obj->next_content )
    {
	if ( can_see_obj( ch, obj ) )
	{
	    pdesc = get_extra_descr( arg1, obj->first_extradesc );
	    if ( pdesc != NULL )
	    {
	send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
		return;
	    }

	    pdesc = get_extra_descr( arg1, obj->pIndexData->first_extradesc );
	    if ( pdesc != NULL )
	    {
	send_to_char( (const char *)ansi_translate_text(ch, pdesc), ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
		return;
	    }
	}

	if ( is_name_short( arg1, obj->name ) )
	{
	    if( obj->long_descr[0]=='\0')
	      {
	      sprintf( buft, "You see nothing special about %s.\n\r",
		 obj->short_descr );
	      send_to_char( buft, ch );
	      }
	    else
	send_to_char( (const char *)ansi_translate_text(ch, obj->long_descr),
                       ch );
            if( obj->pIndexData->picture != NULL )
              send_to_char( "This object has a picture.\n\r", ch );
	    return;
	}
     }

	 if ( !strcasecmp( arg1, "n" ) || !strcasecmp( arg1, "north" ) ) door = 0;
    else if ( !strcasecmp( arg1, "e" ) || !strcasecmp( arg1, "east"  ) ) door = 1;
    else if ( !strcasecmp( arg1, "s" ) || !strcasecmp( arg1, "south" ) ) door = 2;
    else if ( !strcasecmp( arg1, "w" ) || !strcasecmp( arg1, "west"  ) ) door = 3;
    else if ( !strcasecmp( arg1, "u" ) || !strcasecmp( arg1, "up"    ) ) door = 4;
    else if ( !strcasecmp( arg1, "d" ) || !strcasecmp( 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 ( pexit->description != NULL && pexit->description[0] != '\0' )
	send_to_char( pexit->description, ch );
    else
	send_to_char( "Nothing special there.\n\r", ch );

    if ( pexit->keyword    != NULL
    &&   pexit->keyword[0] != '\0'
    &&  !IS_SET(pexit->exit_info,EX_UNBARRED)
    &&   pexit->keyword[0] != ' ' )
      {
      if(((!IS_SET(pexit->exit_info,EX_HIDDEN))||
	  IS_AFFECTED(ch,AFF_DETECT_HIDDEN))
	 && can_use_exit(ch,ch->in_room, door) )
	{
	      if ( IS_SET(pexit->exit_info, EX_CLOSED) )
		{
		act( "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR );
		}
	      else if ( IS_SET(pexit->exit_info, EX_BASHED) )
		{
		act( "The $d has been bashed from its hinges!", ch, NULL, pexit->keyword, TO_CHAR );
		}
	      else if ( IS_SET(pexit->exit_info, EX_ISDOOR) )
		{
		act( "The $d is open.",   ch, NULL, pexit->keyword, TO_CHAR );
		}
	}
      }
    if(IS_NPC(ch)||
       (((ch->pcdata->learned[gsn_short_range]>0)||
	 (ch->pcdata->learned[gsn_med_range]>0)||
	 (ch->pcdata->learned[gsn_long_range]>0))&&
	((!IS_SET(pexit->exit_info,EX_HIDDEN))||
	 IS_AFFECTED(ch,AFF_DETECT_HIDDEN))&&
	 can_use_exit(ch, ch->in_room, door)))
	 showCharDir(ch,door);

    return;
}


void do_scan( CHAR_DATA *ch, char *argument )
  {
  char arg[MAX_INPUT_LENGTH],*c,buf[MAX_INPUT_LENGTH];
  bool found;
  char bufc[20];
  
  one_argument( argument, arg );

  if(arg[0]=='\0')
    strcpy(arg,"neswud");

  strcpy( bufc,  get_color_string(ch,COLOR_PROMPT,VT102_BOLD) );

  for(c=arg;*c!='\0';c++)
    {
    found = TRUE;
    switch(*c)
      {
      case 'n':
         if ( ch->in_room->exit[0] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sTo the north:\n\r", bufc);
         break;
      case 'e':
         if ( ch->in_room->exit[1] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sTo the east:\n\r", bufc);
         break;
      case 's':
         if ( ch->in_room->exit[2] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sTo the south:\n\r", bufc);
         break;
      case 'w':
         if ( ch->in_room->exit[3] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sTo the west:\n\r", bufc);
         break;
       case 'u':
         if ( ch->in_room->exit[4] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sUp:\n\r", bufc);
         break;
       case 'd':
         if ( ch->in_room->exit[5] == NULL )
           found = FALSE;
         else
	   sprintf(buf, "%sDown:\n\r", bufc);
         break;
      default:
	sprintf(buf,"There is no direction abbreviated by '%c'.\n\r",*c);
	send_to_char(buf,ch); 
	strcpy( buf, "");
	break;
     }
    if( buf[0]=='\0')
      continue;
    if( found)
      {
      send_to_char(buf,ch); 
      sprintf(buf,"%c",*c);
      do_look(ch,buf);
      }
    }
  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 )
    {
	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], buf2[MAX_STRING_LENGTH], *cnt;
    EXIT_DATA *pexit;
    bool found;
    bool fAuto;
    int door,num_exits=0;
    char dim[10], bold[10], buf3[MAX_STRING_LENGTH];
    ROOM_INDEX_DATA * room;

    buf[0] = '\0';
    fAuto  = !strcasecmp( argument, "auto" );

    if ( !check_blind( ch ) )
	return;

    if( ch->ansi==1)
      {
      sprintf( bold, "\033[1;%d;%dm", ch->pcdata->color[0][7],
	  ch->pcdata->color[1][7]);
      sprintf( dim, "\033[0;%d;%dm", ch->pcdata->color[0][7], 
	  ch->pcdata->color[1][7]);
      }
  else if(ch->vt100==1)
     {
      strcpy(bold,"\033[1m");
      strcpy(dim,"\033[m");
     }
  else
    {
    bold[0]='\0';
    dim[0]='\0';
    }
    if (IS_SET(ch->in_room->room_flags, ROOM_HALLUCINATE) && 
          !is_affected(ch, gsn_truesight) && !IS_SET(ch->act, PLR_HOLYLIGHT)) 
     room = ch->in_room->hallucinate_room;
    else
     room = ch->in_room;

    found = FALSE;
    /* Slight chance first_person miss exits due to smoke - Martin 14/8/98 */
    for ( door = 0; door <= 5; door++ )
    {
	if ( ( pexit = room->exit[door] ) != NULL
	&& pexit->to_room != NULL
        && (!IS_SET(ch->in_room->room_flags, ROOM_SMOKE) 
            || number_percent()>(40-get_curr_int(ch)))
        && ( !IS_SET(pexit->to_room->room_flags,ROOM_IS_CASTLE)  
	    || IS_NPC( ch ) || ch->pcdata==NULL
	    || !IS_SET(ch->pcdata->player2_bits, PLR2_CASTLES))
	&& ((!IS_SET(pexit->exit_info,EX_HIDDEN))||
           IS_AFFECTED(ch,AFF_DETECT_HIDDEN))
           &&  can_use_exit(ch, ch->in_room, door))
	    {
	    found = TRUE;
            num_exits++;
	    if(fAuto)
	      {
	      buf2[0]=dir_name[door][0];
	      buf2[1]='-';
	      buf2[2]='\0';
	      }
	     else
	      {
	      strcpy(buf2, dir_name[door]);
	      while(strlen(buf2)<7)
		strcat(buf2,"-");
	      }

	      if(buf2[0]>'Z')
		buf2[0]-=('a'-'A');
	      strcpy(buf3, bold);
	      strcat(buf3, buf2);
	      strcat(buf3, dim);
	      strcpy(buf2, buf3);

	      if(!IS_SET(pexit->exit_info, EX_CLOSED))
	      {
		if( !can_see_in_room( ch, pexit->to_room))
		  sprintf(buf3, "Too dark to tell");
		else
		  sprintf(buf3, pexit->to_room->name);
	      }
	      else
		if(fAuto)
	        {
		 if(pexit->keyword!=NULL && 
		    pexit->keyword[0]!='\0')
		  sprintf( buf3, pexit->keyword);
		 else
		  sprintf( buf3, "door");
	        }
		else
		  {
		  if(pexit->description!=NULL && pexit->description[0]!='\0')
		    strcat( buf2, pexit->description);
		  else
		    strcat(buf2, "You see nothing special.");
		  while((cnt=strstr(buf2,"\n"))!=NULL)
		     *cnt=' ';
		  while((cnt=strstr(buf2,"\r"))!=NULL)
		     *cnt=' ';
		  }
              if (fAuto)
             {
               while(strlen(buf3)<18) strcat (buf3, " ");
               buf3[17]=' ';
               buf3[18]='\0';
               if (num_exits%4==0) strcat(buf3,"\n\r");
             }
             else
               strcat(buf3,"\n\r");

             strcat(buf2,buf3);
             strcat(buf,buf2);
        }
    }

    if ( !num_exits )
        strcat( buf, fAuto ? "You see no visible exits." : "None." );

    if (buf[strlen(buf)-1]!='\r' && buf[strlen(buf)-2]!='\n')
      strcat(buf,"\n\r");

    send_to_char( buf, ch);
    return;
}



void do_score( CHAR_DATA *ch, char *argument )
  {
  get_string_score_v1( ch, ch);

  send_to_char( get_string_score_txt, ch );
  return;
  }


void get_string_score_v1( CHAR_DATA *ch, CHAR_DATA *viewer)
  {
  char buf[MAX_STRING_LENGTH],buf1[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH];
  char tbuf1[MAX_INPUT_LENGTH],tbuf2[MAX_INPUT_LENGTH];
  /* AFFECT_DATA *paf;*/
  char bold[10],dim[10];
  int cnt, gac, leng;

  *get_string_score_txt = '\0';
  if( IS_NPC( ch))
    return;

    /* Universal code for color shifting, regardless of terminal type */
  strcpy( dim,  get_color_string( viewer, COLOR_SCORE, VT102_DIM) );
  strcpy( bold, get_color_string( viewer, COLOR_SCORE, VT102_BOLD) );

  sprintf(buf,"%s  __________________________________________________________________________\n\r",bold);
  leng = str_cpy_max( get_string_score_txt, buf, MAX_STRING_LENGTH);
  sprintf(buf,"%s-|__________________________________________________________________________|-\n\r",bold);
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf1,"%s%s",ch->name,IS_NPC(ch) ? " the monster" : ch->pcdata->title);
  if(strlen(buf1)>70)
    buf1[70]='\0';
  sprintf(buf,"%s   |%s|\n\r",bold,str_resize(buf1,tbuf1,-70));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf,"%s   |%s    Class:%s%s%s  Age:%s%3d%s yrs (%05d hrs) RACE:%s %s|\n\r"
	  ,bold,dim,bold,
	  str_resize(class_table[ch->class].who_name_long,tbuf1,-20),
	  dim,bold,
	  get_age(ch),dim,
	  (ch->played)/3600 ,
	  bold,str_resize(race_table[ch->race].race_name,tbuf2,-8) );
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf,"%s   | %s   Level:%s%2d%s (%s:%s%2d%s  %s:%s%2d%s  %s:%s%2d%s  %s:%s%2d%s  %s:%s%2d%s  %s:%s%2d%s  %s:%s%2d%s) %s|\n\r", bold,dim,bold,
	  ch->level,dim,
	  class_table[0].who_name,bold,ch->mclass[0],dim,
	  class_table[1].who_name,bold,ch->mclass[1],dim,
	  class_table[2].who_name,bold,ch->mclass[2],dim,
	  class_table[3].who_name,bold,ch->mclass[3],dim,
	  class_table[4].who_name,bold,ch->mclass[4],dim,
	  class_table[5].who_name,bold,ch->mclass[5],dim,
	  class_table[6].who_name,bold,ch->mclass[6],dim, bold);
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf,"%s   | %s   Stats:Str:%s%2d%s  Int:%s%2d%s  Wis:%s%2d%s  Dex:%s%2d%s  Con:%s%2d                      |\n\r",bold,dim,bold,
	  get_curr_str(ch),dim,bold,
	  get_curr_int(ch),dim, bold,
	  get_curr_wis(ch),dim, bold,
	  get_curr_dex(ch),dim, bold,
	  get_curr_con(ch));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf1,"%d/%d",ch->hit,ch->max_hit);
  sprintf(buf2,"%d (%d lost)",ch->exp,ch->exp_lost);
sprintf(buf,"%s   |%sHitpoints:%s%s%s    Experience:%s%s |\n\r", 
	bold, dim,bold,str_resize(buf1,tbuf1,-11),dim,bold,
	str_resize(buf2,tbuf2,-33));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf1,"%d/%d",ch->mana,ch->max_mana);
  sprintf(buf,"%s   |  %s   Mana:%s%s%s          Gold:%s%-9d                         |\n\r", bold, dim, bold,str_resize(buf1,tbuf1,-11),dim,bold, ch->gold);
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf1,"%d/%d",ch->move,ch->max_move);
  sprintf(buf2,"%d/%d items",ch->carry_number,can_carry_n(ch));
  sprintf(buf,"   %s|%s Movement:%s%s%s      Carrying:%s%s                   |\n\r",bold,dim,bold,str_resize(buf1,tbuf1,-11),dim,bold,str_resize(buf2,tbuf2,-15));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf1,"%d/%d",ch->carry_weight,can_carry_w(ch));
  sprintf(buf,"%s   |%sPractices:%s%-3d%s          Carry Weight:%s%s                   |\n\r", bold, dim, bold,ch->practice,dim,bold,
	  str_resize(buf1,tbuf1,-15));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  gac = GET_AC(ch)+ch->level*3;
       if ( gac >=  101 ) strcpy( buf2, "WORSE than naked!");
  else if ( gac >=   80 ) strcpy( buf2, "naked.");
  else if ( gac >=   60 ) strcpy( buf2, "wearing clothes.");
  else if ( gac >=   40 ) strcpy( buf2, "slightly armored.");
  else if ( gac >=   20 ) strcpy( buf2, "somewhat armored.");
  else if ( gac >=    0 ) strcpy( buf2, "armored.");
  else if ( gac >= - 20 ) strcpy( buf2, "well armored.");
  else if ( gac >= - 40 ) strcpy( buf2, "strongly armored.");
  else if ( gac >= - 60 ) strcpy( buf2, "heavily armored.");
  else if ( gac >= - 80 ) strcpy( buf2, "superbly armored.");
  else if ( gac >= -100 ) strcpy( buf2, "divinely armored.");
  else                           strcpy( buf2, "invincible!");
/* level > 24 sees ac number */
  if(ch->level>24)
    {
    sprintf(buf,"(%2d)",GET_AC(ch));
    strcat(buf2,buf);
    }
  switch(ch->speed)
    {
      case 0: strcpy(buf1,"walking"); break;
      case 1: strcpy(buf1,"normal"); break;
      case 2: strcpy(buf1,"jogging"); break;
      case 3: strcpy(buf1,"running"); break;
      case 4: strcpy(buf1,"haste"); break;
    }
  sprintf(buf,"%s   |%s    Speed:%s%s%s      Armor Class:%s%s|\n\r",
	  bold,dim,bold,str_resize(buf1,tbuf1,-8),dim,bold,
	  str_resize(buf2,tbuf2,-34));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
       if ( ch->alignment >  900 ) strcpy( buf2, "angelic.");
  else if ( ch->alignment >  700 ) strcpy( buf2, "saintly.");
  else if ( ch->alignment >  350 ) strcpy( buf2, "good.");
  else if ( ch->alignment >  100 ) strcpy( buf2, "kind.");
  else if ( ch->alignment > -100 ) strcpy( buf2, "neutral.");
  else if ( ch->alignment > -350 ) strcpy( buf2, "mean.");
  else if ( ch->alignment > -700 ) strcpy( buf2, "evil.");
  else if ( ch->alignment > -900 ) strcpy( buf2, "demonic.");
  else                             strcpy( buf2, "satanic.");
/* level > 17 sees alignment number */
  if(ch->level>17)
    {
    sprintf(buf,"(%d)",ch->alignment);
    strcat(buf2,buf);
    }
  sprintf(buf1,"%d hp",ch->wimpy);
  sprintf(buf,"%s   | %s   Wimpy:%s%s%s        Alignment:%s%s|\n\r",
	  bold,dim,bold,str_resize(buf1,tbuf1,-8),dim,bold,
	  str_resize(buf2,tbuf2,-34));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  strcpy(buf1,get_room_index(ch->recall)->name);
  if(strlen(buf1)>33)
    buf1[33]='\0';
  sprintf(buf,"%s   |%s AutoExit:%s%s%s           Recall Room:%s%s|\n\r", 
       bold, dim, bold,
       (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOEXIT)) ? "yes" : "no ",dim,bold,
       str_resize(buf1,tbuf1,-34));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  strcpy(buf1,get_room_index(ch->pcdata->death_room)->name);
  sprintf(buf,"%s   |%s AutoLoot:%s%s%s            Death Room:%s%s|\n\r",
       bold,dim,bold,
       (!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOLOOT)) ? "yes" : "no ",dim,bold,
       str_resize(buf1,tbuf1,-34));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf,"%s   |%s    Quiet:%s%s%s               AutoSac:%s%s                               |\n\r",bold,dim,bold,
	(!IS_NPC(ch) && IS_SET(ch->act, PLR_QUIET)) ? "yes" : "no ", dim, bold,
	(!IS_NPC(ch) && IS_SET(ch->act, PLR_AUTOSAC) ) ? "yes" : "no ");
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
/* only for level > 14 */
  if(ch->level>14)
    {
    OBJ_DATA *wield;

    wield = get_eq_char(ch, WEAR_WIELD );
    if((!IS_NPC(ch))&&(ch->mclass[CLASS_MONK]>0)&&(wield==NULL))
      {
      int numDice,sizeDice,sizePlus;

      numDice=1;
      sizeDice=4+ch->level/6+ch->mclass[CLASS_MONK]*2/3;
      sizePlus=GET_DAMROLL(ch);

      sprintf(buf1,"%dd%d+%d",numDice,sizeDice,sizePlus);
      }
    else
      sprintf(buf1,"%-3d",GET_DAMROLL(ch));
    sprintf(buf,"%s   |%s  HitRoll:%s%-3d%s               DamRoll:%s%s                       |\n\r",bold,dim,bold,
	    GET_HITROLL(ch),dim,bold,str_resize(buf1,tbuf1,-11));
    leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
    }

  buf[0]='\0';
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK]   > 10 )
    strcat(buf,"You are drunk. ");
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] ==  0 )
    strcat(buf,"You are thirsty. ");
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL]   ==  0 )
    strcat(buf,"You are hungry. ");
  if(IS_NPC(ch))
    strcat(buf,"You are an NPC! ");
  switch ( ch->position )
    {
    case POS_DEAD:     
	strcat(buf, "You are DEAD!! ");  break;
    case POS_MORTAL:
	strcat(buf, "You are mortally wounded! ");  break;
    case POS_INCAP:
	strcat(buf, "You are incapacitated! ");  break;
    case POS_STUNNED:
	strcat(buf, "You are stunned! ");  break;
    case POS_SLEEPING:
	strcat(buf, "You are sleeping. ");  break;
    case POS_RESTING:
	strcat(buf, "You are resting. ");  break;
    case POS_STANDING:
	strcat(buf, "You are standing. ");  break;
    case POS_FIGHTING:
	strcat(buf, "You are fighting! ");  break;
    }
  buf[63]='\0';
  sprintf(buf2,"%s   |%sOTHER: %s%s|\n\r",bold, dim, bold,
	  str_resize(buf,tbuf1,-63));
  leng = str_apd_max( get_string_score_txt, buf2, leng, MAX_STRING_LENGTH);
  buf2[0]='\0';
  for(cnt=0;cnt<MAX_RACE;cnt++)
    if(IS_SHIFT( ch->language, cnt))
    {
      char buffer3[20];
      strcpy(buffer3, race_table[cnt].race_name);
      buffer3[3]='\0';
      strcat(buf2,buffer3);
      strcat(buf2," ");
    }
  sprintf(buf,"%s   |%sKnown: %s%s|\n\r",bold, dim, 
	  str_resize(buf2,tbuf1,-63), bold);
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf( buf, "%s   |%sCurrently Speaking: %s%s|\n\r", bold,dim,bold,
	    str_resize(race_table[UNSHIFT(ch->speak)].race_name,tbuf1,-50));
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);
  sprintf(buf,"%s   |______________________________________________________________________| \n\r",bold);
  leng = str_apd_max( get_string_score_txt, buf, leng, MAX_STRING_LENGTH);

  return;
  }


void do_status( CHAR_DATA *ch, char *argument )
  {
  char buf[MAX_STRING_LENGTH],buf1[MAX_STRING_LENGTH],buf2[MAX_STRING_LENGTH];
  char tbuf1[MAX_INPUT_LENGTH],tbuf2[MAX_INPUT_LENGTH];
  /* AFFECT_DATA *paf;*/
  char bold[10],dim[10];
  int gac;
  int cnt;

  if( IS_NPC( ch))
    return;

  strcpy( dim,  get_color_string( ch, COLOR_SCORE, VT102_DIM) );
  strcpy( bold, get_color_string( ch, COLOR_SCORE, VT102_BOLD) );

  sprintf(buf,"%s  __________________________________________________________________________\n\r",bold);
  send_to_char( buf, ch);
  sprintf(buf,"%s-|__________________________________________________________________________|-\n\r",bold);
  send_to_char( buf, ch);
  sprintf(buf1,"%s%s",ch->name,IS_NPC(ch) ? " the monster" : ch->pcdata->title);
  if(strlen(buf1)>70)
    buf1[70]='\0';
  sprintf(buf,"%s   |%s|\n\r",bold,str_resize(buf1,tbuf1,-70));
  if( strcasecmp( argument, "reincarnate") )
    send_to_char( buf, ch);
  sprintf(buf,"%s   | %s     Stats:  Str:%s%2d%s  Int:%s%2d%s  Wis:%s%2d%s  Dex:%s%2d%s  Con:%s%2d                  |\n\r",bold,dim,bold,
	  get_curr_str(ch),dim,bold,
	  get_curr_int(ch),dim, bold,
	  get_curr_wis(ch),dim, bold,
	  get_curr_dex(ch),dim, bold,
	  get_curr_con(ch));
  send_to_char( buf, ch);
  sprintf(buf1,"%d/%d",ch->carry_weight,can_carry_w(ch));
  sprintf(buf,"%s   |%s  Practices:%s%-3d%s                      Carry Weight:%s%s     |\n\r", bold, dim, bold,ch->practice,dim,bold,
	  str_resize(buf1,tbuf1,-15));
  send_to_char( buf, ch);
  gac = GET_AC(ch)+ch->level*3;
       if ( gac >=  101 ) strcpy( buf1, "WORSE than naked!");
  else if ( gac >=   80 ) strcpy( buf1, "naked.");
  else if ( gac >=   60 ) strcpy( buf1, "wearing clothes.");
  else if ( gac >=   40 ) strcpy( buf1, "slightly armored.");
  else if ( gac >=   20 ) strcpy( buf1, "somewhat armored.");
  else if ( gac >=    0 ) strcpy( buf1, "armored.");
  else if ( gac >= - 20 ) strcpy( buf1, "well armored.");
  else if ( gac >= - 40 ) strcpy( buf1, "strongly armored.");
  else if ( gac >= - 60 ) strcpy( buf1, "heavily armored.");
  else if ( gac >= - 80 ) strcpy( buf1, "superbly armored.");
  else if ( gac >= -100 ) strcpy( buf1, "divinely armored.");
  else                           strcpy( buf1, "invincible!");
/* level > 24 sees ac number */
  if(ch->level>24)
    {
    sprintf(buf,"(%2d)",GET_AC(ch));
    strcat(buf1, buf);
    }
       if ( ch->alignment >  900 ) strcpy( buf2, "angelic.");
  else if ( ch->alignment >  700 ) strcpy( buf2, "saintly.");
  else if ( ch->alignment >  350 ) strcpy( buf2, "good.");
  else if ( ch->alignment >  100 ) strcpy( buf2, "kind.");
  else if ( ch->alignment > -100 ) strcpy( buf2, "neutral.");
  else if ( ch->alignment > -350 ) strcpy( buf2, "mean.");
  else if ( ch->alignment > -700 ) strcpy( buf2, "evil.");
  else if ( ch->alignment > -900 ) strcpy( buf2, "demonic.");
  else                             strcpy( buf2, "satanic.");
  if(ch->level>17)
    {
    sprintf(buf,"(%d)",ch->alignment);
    strcat(buf2, buf);
    }
  sprintf(buf,"%s   |%sArmor Class:%s%s%s  Alignment:%s%s|\n\r",
	  bold,dim,bold,str_resize(buf1,tbuf1,-26),dim,bold,
	  str_resize(buf2,tbuf2,-20));
  if( strcasecmp( argument, "reincarnate") )
    send_to_char( buf, ch);
/* only for level > 14 */
  if(ch->level>14)
    {
    OBJ_DATA *wield;

    wield = get_eq_char(ch, WEAR_WIELD );
    if((!IS_NPC(ch))&&(ch->mclass[CLASS_MONK]>0)&&(wield==NULL))
      {
      int numDice,sizeDice,sizePlus;

      numDice=1;
      sizeDice=4+ch->level/6+ch->mclass[CLASS_MONK]*2/3;
      sizePlus=GET_DAMROLL(ch);

      sprintf(buf1,"%dd%d+%d",numDice,sizeDice,sizePlus);
      }
    else
      sprintf(buf1,"%-3d",GET_DAMROLL(ch));
    sprintf(buf,"%s   |%s    HitRoll:%s%-3d%s                           DamRoll:%s%s         |\n\r",bold,dim,bold,
	    GET_HITROLL(ch),dim,bold,str_resize(buf1,tbuf1,-11));
  if( strcasecmp( argument, "reincarnate") )
    send_to_char( buf, ch);
    }

  buf[0]='\0';
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK]   > 10 )
    strcat(buf,"You are drunk. ");
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] ==  0 )
    strcat(buf,"You are thirsty. ");
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_FULL]   ==  0 )
    strcat(buf,"You are hungry. ");
  if(IS_NPC(ch))
    strcat(buf,"You are an NPC! ");
  switch ( ch->position )
    {
    case POS_DEAD:     
	strcat(buf, "You are DEAD!! ");  break;
    case POS_MORTAL:
	strcat(buf, "You are mortally wounded! ");  break;
    case POS_INCAP:
	strcat(buf, "You are incapacitated! ");  break;
    case POS_STUNNED:
	strcat(buf, "You are stunned! ");  break;
    case POS_SLEEPING:
	strcat(buf, "You are sleeping. ");  break;
    case POS_RESTING:
	strcat(buf, "You are resting. ");  break;
    case POS_STANDING:
	strcat(buf, "You are standing. ");  break;
    case POS_FIGHTING:
	strcat(buf, "You are fighting! ");  break;
    }
  buf[63]='\0';
  sprintf(buf2,"%s   |%s      OTHER: %s%s|\n\r",bold, dim, bold,
	  str_resize(buf,tbuf1,-57));
  if( strcasecmp( argument, "reincarnate") )
    send_to_char( buf2, ch);
  sprintf(buf,"%s   |%s    Class:%s%s%s  Age:%s%3d%s yrs (%05d hrs) RACE:%s %s|\n\r"
	  ,bold,dim,bold,
	  str_resize(class_table[ch->class].who_name_long,tbuf1,-20),
	  dim,bold,
	  get_age(ch),dim,
	  (ch->played)/3600 + (IS_NPC(ch)?0:ch->pcdata->previous_hours),
	  bold,str_resize(race_table[ch->race].race_name,tbuf2,-8) );
  if( !strcasecmp( argument, "reincarnate") )
    send_to_char( buf, ch);
  buf2[0]='\0';
  for(cnt=0;cnt<MAX_RACE;cnt++)
    if(IS_SHIFT( ch->language, cnt))
      {
      strcat(buf2,race_table[cnt].race_name);
      strcat(buf2," ");
      }
  sprintf(buf,"%s   |%sKnown: %s%s|\n\r",bold, dim, 
	  str_resize(buf2,tbuf1,-63), bold);
  if( !strcasecmp( argument, "reincarnate") )
    send_to_char( buf, ch);

  if (IS_IMMORTAL(ch))
  {
        ch_printf(ch, "%s   |%sIMMORTAL DATA:  %sWizinvis [%s]\n\r",
                bold, dim, bold, IS_SET(ch->act, PLR_WIZINVIS) ? "X" : " ");

        ch_printf(ch, "%s   |%sBamfin:%s  %s %s.\n\r", bold, dim, bold, ch->name, (ch->pcdata->bamfin[0] != '\0')
                ? ch->pcdata->bamfin : "appears in a swirling mist.");
        ch_printf(ch, "%s   |%sBamfout:%s %s %s.\n\r", bold, dim, bold,ch->name, (ch->pcdata->bamfout[0]
 != '\0')
                ? ch->pcdata->bamfout : "leaves in a swirling mist.");


        if (ch->pcdata->area)
        {
            ch_printf(ch, "%s   |%sVnums:   Room%s (%-5.5d - %-5.5d)   %sObject%s (%-5.5d - %-5.5d)   %sMob%s (%-5.5d - %-5.5d)\n\r",
		bold, dim,bold,
                ch->pcdata->area->low_r_vnum, ch->pcdata->area->hi_r_vnum,
		dim, bold,
                ch->pcdata->area->low_o_vnum, ch->pcdata->area->hi_o_vnum,
		dim, bold,
                ch->pcdata->area->low_m_vnum, ch->pcdata->area->hi_m_vnum);
	}
  }
  sprintf(buf,"%s   |______________________________________________________________________| \n\r",bold);
  send_to_char( buf, ch);
  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"
};


  /* Enhanced AFFECTS command  -  Chaos  4/3/99  */
void do_affects( CHAR_DATA *ch, char *argument )
  {
  char buf[MAX_STRING_LENGTH];

  get_affects_string( ch, ch, buf, MAX_STRING_LENGTH );
  send_to_char( buf, ch );

  return;
  }

void get_affects_string( CHAR_DATA *ch, CHAR_DATA *viewer, char *outbuf,
      int outbufleng )
  {
  char buf[MAX_INPUT_LENGTH],buf1[MAX_INPUT_LENGTH],buf2[MAX_INPUT_LENGTH];
  int oleng, slen;
  char tbuf1[MAX_INPUT_LENGTH];
  AFFECT_DATA *paf;
  char bold[10],dim[10];

    /* Universal code for color shifting, regardless of terminal type */
  strcpy( dim,  get_color_string( viewer, COLOR_SCORE, VT102_DIM) );
  strcpy( bold, get_color_string( viewer, COLOR_SCORE, VT102_BOLD) );

  sprintf(buf,"%s  __________________________________________________________________________\n\r",bold);
  oleng = str_cpy_max( outbuf, buf, outbufleng );
  sprintf(buf,"-|__________________________________________________________________________|-\n\r");
  oleng = str_apd_max( outbuf, buf, oleng, outbufleng );
  sprintf(buf1,"%s%s",ch->name,IS_NPC(ch) ? " the monster" : ch->pcdata->title);
  if(strlen(buf1)>70)
    buf1[70]='\0';
  sprintf(buf,"   |%s|\n\r",str_resize(buf1,tbuf1,-70));
  oleng = str_apd_max( outbuf, buf, oleng, outbufleng );
    sprintf(buf,"   |%sAFFECTS:                                                              %s|\n\r", dim, bold);
  oleng = str_apd_max( outbuf, buf, oleng, outbufleng );
  if ( ch->first_affect != NULL )
    {
    for ( paf = ch->first_affect; paf != NULL; paf = paf->next )
      {
      sprintf( buf, "Spell: '%s%s%s'", bold,skill_table[paf->type].name,dim );
      slen = strlen( skill_table[paf->type].name ) + 9;
      if ( ch->level >= 30 )
	{
	sprintf( buf2, " modifies %s by %d for %d hours", 
            affect_loc_name( paf->location ), paf->modifier, paf->duration );
        slen += strlen( buf2 );
	strcat(buf,buf2);
	}
      for( *buf2='\0'; slen < 68; slen++)
        strcat( buf2, " " );
      sprintf(buf1,"   |%s  %s%s%s|\n\r",dim,buf,buf2,bold);
      oleng = str_apd_max( outbuf, buf1, oleng, outbufleng );
      }
    }
  else
    {
    strcpy( buf, "   |  none.                                                               |\n\r");
      oleng = str_apd_max( outbuf, buf, oleng, outbufleng );
    }
   sprintf(buf,"   |______________________________________________________________________| \n\r");
      oleng = str_apd_max( outbuf, buf, oleng, outbufleng );

  return;
  }

void do_time( CHAR_DATA *ch, char *argument )
{
    extern char str_boot_time[];
    char buf[MAX_STRING_LENGTH];
    char *suf;
    int day;

    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";

    sprintf( buf,
	"It is %d %s, the %d%s day of the Month of %s.\n\rMrMud started up at %s\rThe system time is %s\r",

	(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],
	str_boot_time,
	(char *) ctime( &current_time )
	);

    send_to_char( buf, ch );
    return;
}



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

    if ( !IS_OUTSIDE(ch) )
    {
	send_to_char( "You can't see the weather indoors.\n\r", ch );
        sprintf( buf, "The temperature is in the %d0's.\n\r",
              ch->in_room->area->weather_info.temperature / 10 );
        send_to_char( buf, ch );
	return;
    }

    if( ch->in_room->area->weather_info.temperature < 32 )
      switch( ch->in_room->area->weather_info.sky )
        {
        case 0: strcpy( buf, "The sky is clear" ); break;
        case 1: strcpy( buf, "The sky is a bit frosty" ); break;
        case 2: strcpy( buf, "It is snowing" ); break;
        case 3: strcpy( buf, "You are in a blizzard" ); break;
        }
    else
    if( ch->in_room->area->weather_info.temperature < 34 )
      switch( ch->in_room->area->weather_info.sky )
        {
        case 0: strcpy( buf, "The sky is clear" ); break;
        case 1: strcpy( buf, "The sky is chilling" ); break;
        case 2: strcpy( buf, "It is sleeting" ); break;
        case 3: strcpy( buf, "You are in a hail storm" ); break;
        }
    else
      switch( ch->in_room->area->weather_info.sky )
        {
        case 0: strcpy( buf, "The sky is clear" ); break;
        case 1: strcpy( buf, "The sky is cloudy" ); break;
        case 2: strcpy( buf, "It is raining" ); break;
        case 3: strcpy( buf, "You are in a storm" ); break;
        }


     if( ch->in_room->area->weather_info.change > 50 )
       strcat( buf, " and a southernly breeze blows" );
     if( ch->in_room->area->weather_info.change < -50 )
       strcat( buf, " and a northern gust blows" );

    strcat( buf, ".\n\r" );
    send_to_char( buf, ch );

    if( ch->in_room->area->weather_info.temperature < 0 )
      sprintf( buf, "The temperature is in the %d0's.\n\r",
          ch->in_room->area->weather_info.temperature / 10 - 1 );
    else
      sprintf( buf, "The temperature is in the %d0's.\n\r",
          ch->in_room->area->weather_info.temperature / 10 );
    send_to_char( buf, ch );

    if( ch->level < 99 )
      return;

    sprintf( buf, "Sky: %d\n\rChange: %d\n\rmmhg: %d\n\rSunlight: %d\n\rTemperature: %d\n\r",
        ch->in_room->area->weather_info.sky,
        ch->in_room->area->weather_info.change,
        ch->in_room->area->weather_info.mmhg,
        ch->in_room->area->weather_info.sunlight,
        ch->in_room->area->weather_info.temperature);
    send_to_char( buf, ch );

    return;
}

HELP_DATA *get_help( CHAR_DATA *ch, char *argument )
{
    char argall[MAX_INPUT_LENGTH];
    char argone[MAX_INPUT_LENGTH];
    char argnew[MAX_INPUT_LENGTH];
    HELP_DATA *pHelp;
    int lev;

    if ( isdigit((int)argument[0]) )
    {
        lev = number_argument( argument, argnew );
        argument = argnew;
    }
    else
        lev = -2;
    /*
     * 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 );
    }

    for ( pHelp = help_first; pHelp; pHelp = pHelp->next )
    {
        if ( pHelp->level > get_trust( ch ) )
            continue;
        if ( lev != -2 && pHelp->level != lev )
            continue;

        if ( is_name( argall, pHelp->keyword ) )
            return pHelp;
    }

    return NULL;
}


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

    if ( argument[0] == '\0' )
	argument = "mainmenu";

    if( IS_NPC( ch ) )
      return;

    if ( (pHelp = get_help( ch, argument )) == NULL )
    {
        send_to_char( "No help on that word.\n\r", ch );
        return;
    }

    found=FALSE;
    buf[0]='\0';

    send_to_char_color("{300}", ch);

    /*
     * Strip leading '.' to allow initial blanks.
     */
    ch->pcdata->prev_help=ch->pcdata->last_help;
    ch->pcdata->last_help=pHelp;
    ch->pcdata->help_mode=TRUE;

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

  return;
}


void do_multi( CHAR_DATA *ch, char *argument )
{
    char buf[MAX_STRING_LENGTH],buf_race[20],buf_lang[80];
    char buf2[MAX_STRING_LENGTH], buf_name[40];
    CHAR_DATA *fch;
    DESCRIPTOR_DATA *d;
    int iLevelLower;
    int iLevelUpper;
    int nNumber;
    int nMatch;
    int nTotal;
    bool fNameRestrict;
    bool fImmortalOnly, tong, under;
    int  cnt, lrang, hrang;
	CHAR_DATA *wch;
	char const *class;
    bool follower;
    bool enemy;
    PLAYER_GAME *fpl, *matchpl;
    int leng;
 
    /*
     * Set default arguments.
     */
    fch = NULL;
    iLevelLower    = 0;
    iLevelUpper    = MAX_LEVEL;
    fNameRestrict = FALSE;
    fImmortalOnly  = FALSE;
    lrang=ch->level*3/4-2;
    hrang=ch->level*5/4+2;
    follower       = FALSE;
    enemy          = FALSE;
    matchpl=NULL;

    /*
     * Parse arguments.
     */
    nNumber = 0;
    for ( ;; )
    {
	char arg[MAX_STRING_LENGTH];

	argument = one_argument( argument, arg );
	if ( arg[0] == '\0' )
	    break;
   
    if( !strcasecmp( arg, "god"))
	follower=TRUE;
    enemy=!strcasecmp(arg,"enemy");
	if( !strcasecmp( arg, "all") || follower || enemy )
	  {
	  lrang=0;
	  hrang=100;
	  arg[0]='\0';
	  break;
	  }

	if ( is_number( arg ) )
	{
	    switch ( ++nNumber )
	    {
	    case 1: iLevelLower = atol(arg);lrang=iLevelLower;hrang=MAX_LEVEL;break;
	    case 2: iLevelUpper = atol(arg);hrang=iLevelUpper;break;
	    default:
		send_to_char( "Only two level numbers allowed.\n\r", ch );
		return;
	    }
	}
	else
	{
	    /*
	     * Look for classes to turn on.
	     */
	    if ( !strcasecmp( arg, "imm" ) )
	    {
		fImmortalOnly = TRUE;
	    }
	    else
	    {     
		lrang=0;
		hrang=100;
                for( fpl=first_player; fpl!=NULL && !fNameRestrict; 
                        fpl=fpl->next)
                  {
                  fch = fpl->ch;
		    if ( is_name( arg, fch->name ) )
		      {
  		      if( IS_SET( fch->act, PLR_WIZINVIS) 
			  && ch->level<(MAX_LEVEL-3))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
  			if(fch!=ch && is_affected(fch, gsn_greater_stealth) 
			   && ( !is_affected(ch, gsn_truesight)
	                   || ch->mclass[CLASS_ILLUSIONIST] < fch->level )
			   && !IS_SET(ch->act, PLR_HOLYLIGHT))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
		      fNameRestrict = TRUE;
		      matchpl = fpl;
		      break;
		      }
                   }
	       if(!fNameRestrict)
                for( fpl=first_player; fpl!=NULL && !fNameRestrict; 
                        fpl=fpl->next)
                  {
                  fch = fpl->ch;
		    if ( is_name_short( arg, fch->name ) )
		      {
  		      if( IS_SET( fch->act, PLR_WIZINVIS) 
			  && ch->level<(MAX_LEVEL-3))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
  			if(fch!=ch && is_affected(fch, gsn_greater_stealth) 
			   && ( !is_affected(ch, gsn_truesight)
	                   || ch->mclass[CLASS_ILLUSIONIST] < fch->level )
			   && !IS_SET(ch->act, PLR_HOLYLIGHT))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
		      fNameRestrict = TRUE;
		      matchpl = fpl;
		      break;
		      }
		   }
		if(!fNameRestrict)
		  {
		  send_to_char( "No one has that name.\n\r", ch);
		  return;
		  }
	    }
	}
    }

    /*
     * Now show matching chars.
     */

    nMatch = 0;
    nTotal = 0;
    buf[0] = '\0';
    leng = 0;
   for( fpl=first_player; fpl!=NULL; fpl=fpl->next)
    {
    wch=fpl->ch;
    d=NULL;
    if(is_desc_valid( wch))
      d=wch->desc;
  if( IS_SET( wch->act, PLR_WIZINVIS) && ch->level<(MAX_LEVEL-3))
    continue;
  if (wch!=ch && is_affected(wch, gsn_greater_stealth) &&
     !((is_affected(ch, gsn_truesight) && ch->mclass[CLASS_ILLUSIONIST] >= wch->level) || IS_SET(ch->act, PLR_HOLYLIGHT)))
    continue;

  nTotal++;
	if ( wch->level < iLevelLower
	||   wch->level > iLevelUpper
	|| ( fImmortalOnly  && wch->level < LEVEL_HERO )
	|| ( fNameRestrict && fpl!=matchpl) 
  || ( wch->level < lrang)
  || ( wch->level > hrang)
  || ( follower && ((which_god( ch) != which_god( wch))))
  || ( enemy && ((which_god( ch) == which_god( wch)) ||
                  which_god(wch) == GOD_NEUTRAL)))
      continue;
	nMatch++;
     

	/*
	 * Figure out what to print for class.
	 */
	class = class_table[wch->class].who_name;
	switch ( wch->level )
	{
	default: break;
	case MAX_LEVEL - 0: class = "GOD"; break;
	case MAX_LEVEL - 1: class = "DUK"; break;
	case MAX_LEVEL - 2: if (which_god(wch) == GOD_POLICE)
			     class = "COP";
			    else
			     class = "COU"; break;
	/*case MAX_LEVEL - 3: class = "ANG"; break;*/
	}

	strcpy(buf_race,race_table[wch->race].race_name);
	buf_race[3]='\0';

	cnt=0;
	/* get rid of stinking ESC sequence for nonVT100 -Dug 12/2/93 */
	buf_lang[0]='\0';
	tong           = FALSE;
	under          = FALSE;

    sprintf( buf_lang,"Ill:%2d  Ele:%2d  Rog:%2d  Ran:%2d  Nec:%2d  Mon:%2d  Asn:%2d",
	  wch->mclass[0],
	  wch->mclass[1],
	  wch->mclass[2],
	  wch->mclass[3],
	  wch->mclass[4],
	  wch->mclass[5],
	  wch->mclass[6]);
	/*
	 * Format it up.
	 */
  strcpy(buf_name, wch->name);
  buf_name[11]='\0';
  while(strlen(buf_name)<11)
    strcat( buf_name, " ");
	sprintf( buf2, "%s%s%s [%2d %s %s] %s%s",
	  ch->vt100==1 ? "\033[1m" : "" ,
	  buf_name,
	  ch->vt100==1 ? "\033[m" : "" ,
		wch->level,
		class,
	  buf_race,
	  ch->vt100==1 ? "\033[1m"  : "" ,
	  buf_lang);
       leng = str_apd_max( buf, buf2, leng, MAX_STRING_LENGTH );
       leng = str_apd_max( buf, "\n\r", leng, MAX_STRING_LENGTH );
    }

    sprintf( buf2, "%d/%d players.  %s\n\r", nMatch, nTotal,
     fNameRestrict || lrang!=0 || hrang!=100 ? "This is a partial list." : "");
    send_to_char( buf2, ch );
    send_to_char( buf, ch );
    return;
}
/*
 * New 'who' command originally by Alander of Rivers of Mud.
 */
void doit_who( CHAR_DATA *, char *, int );
void do_language( CHAR_DATA *ch, char *argument )
  {
  doit_who( ch, argument, 1);
  return;
  }
void do_who( CHAR_DATA *ch, char *argument )
  {
  doit_who( ch, argument, 0);
  return;
  }

void doit_who( CHAR_DATA *ch, char *argument, int typ )
{
    char buf[MAX_STRING_LENGTH],buf_race[20],buf_lang[100];
    char buf2[MAX_STRING_LENGTH];
    char pbuf[MAX_STRING_LENGTH];
    char *pt;
    int plen;
    CHAR_DATA *fch;
    DESCRIPTOR_DATA *d;
    CLAN_DATA *nc;
    int iLevelLower;
    int iLevelUpper;
    int nNumber;
    int nMatch;
    int nTotal;
    bool fClass, fRace;
    bool fClan, fOrder;
    CLAN_DATA * iClan = NULL;
    int iRaceClass;
    bool fNameRestrict;
    bool fImmortalOnly, tong, under;
    int  cnt, lrang, hrang;
	CHAR_DATA *wch;
	char const *class;
    bool follower;
    bool enemy,target;
    PLAYER_GAME *fpl,*matchpl;
 
    /*
     * Set default arguments.
     */
    matchpl=NULL;
    *buf='\0';
    *buf_race='\0';
    *buf_lang='\0';
    *buf2='\0';
    nc=NULL;
    fch = NULL;
    iLevelLower    = 0;
    iLevelUpper    = MAX_LEVEL;
    fNameRestrict = FALSE;
    fImmortalOnly  = FALSE;
    fRace = FALSE;
    fClass = FALSE;
    fClan = FALSE;
    fOrder = FALSE;
    iRaceClass = -1;
    lrang=ch->level*3/4-2;
    hrang=ch->level*5/4+2;
    follower       = FALSE;
    enemy          = FALSE;
    target         = FALSE;

    /*
     * Parse arguments.
     */
    nNumber = 0;
    plen=0;
    pbuf[0]='\0';
    for ( ;; )
    {
	char arg[MAX_STRING_LENGTH];

	argument = one_argument( argument, arg );
	if ( arg[0] == '\0' )
	    break;
   
    follower=!strcasecmp( arg, "god");
    enemy=!strcasecmp( arg, "enemy");
    target=!strcasecmp( arg, "target");

    if( ( fClan = !strcasecmp( arg, "clan" ) ) == TRUE )
      {
      bool found=FALSE;
      if (strlen(argument)>=2)
       for (iClan= first_clan;iClan!=NULL;iClan=iClan->next)
	{
	 if (!str_prefix (argument, iClan->name)
	     && iClan->type ==CLAN_WARLIKE)
	 { 
	  found=TRUE; 
	  break;
 	 }
	}
      if( !found)
        {
        if (!IS_NPC(ch) && ch->pcdata->clan !=NULL )
	 {
          if (ch->pcdata->clan->type==CLAN_WARLIKE) 
 	   iClan = ch->pcdata->clan;
	  else
	   {
            send_to_char( "You are not in a clan, and did not specify a clan to list.\n\r", ch );
            return;
	   }
	 }
        else
 	 {
          send_to_char( "That clan does not exist.\n\r", ch );
          return;
         }
        }
      }
    if( ( fOrder = !strcasecmp( arg, "order" ) ) == TRUE )
      {
      bool found=FALSE;
      if (strlen(argument)>=2)
        for (iClan= first_clan;iClan!=NULL;iClan=iClan->next)
	{
	 if (!str_prefix (argument, iClan->name)
	     && iClan->type ==CLAN_PEACEFUL )
	 { found=TRUE; break;}
	}
      if( !found)
        {
        if (!IS_NPC(ch) && ch->pcdata->clan)
	 {
          if (ch->pcdata->clan->type==CLAN_PEACEFUL) 
 	   iClan = ch->pcdata->clan;
	  else
	   {
            send_to_char( "You are not in an order, and did not specify an order to list.\n\r", ch );
            return;
	   }
	 }
        }
      }
    if( ( fRace = !strcasecmp( arg, "race" ) ) == TRUE )
      {
      if (strlen(argument)>=2)
        iRaceClass = lookup_race( argument );
      else
	iRaceClass = ch->race;
      }
    if( ( fClass = !strcasecmp( arg, "class" ) ) == TRUE )
      {
      iRaceClass = -1;
      if (strlen(argument)>=2)
      {
       for(cnt=0;cnt<MAX_CLASS;cnt++)
        if(!str_prefix(argument, class_table[cnt].who_name_long ))
	   iRaceClass = cnt;
      }
      else
	iRaceClass=ch->class;
      }

    if( (!strcasecmp( arg, "all")) || target || follower || enemy || fClan
				   || fRace || fOrder || fClass )
      {
      lrang=0;
      hrang=100;
      arg[0]='\0';
      break;
      }

	if ( is_number( arg ) )
	{
	    switch ( ++nNumber )
	    {
	    case 1: iLevelLower = atol(arg);lrang=iLevelLower;hrang=MAX_LEVEL;break;
	    case 2: iLevelUpper = atol(arg);hrang=iLevelUpper;break;
	    default:
		send_to_char( "Only two level numbers allowed.\n\r", ch );
		return;
	    }
	}
	else
	{
	    /*
	     * Look for classes to turn on.
	     */
	    if ( !strcasecmp( arg, "imm" ) )
	    {
		fImmortalOnly = TRUE;
	    }
	    else
	    {     
		lrang=0;
		hrang=100;
                if( !enemy && !follower )
                for( fpl=first_player; fpl!=NULL && !fNameRestrict; 
                        fpl=fpl->next)
                  {
                  fch = fpl->ch;
		    if ( is_name( arg, fch->name ) )
		      {
  		      if( IS_SET( fch->act, PLR_WIZINVIS) 
			  && ch->level<(MAX_LEVEL-3))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
  			if(fch!=ch && is_affected(fch, gsn_greater_stealth) 
			   && ( !is_affected(ch, gsn_truesight)
	                   || ch->mclass[CLASS_ILLUSIONIST] < fch->level )
			   && !IS_SET(ch->act, PLR_HOLYLIGHT))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
		      fNameRestrict = TRUE;
		      matchpl = fpl;
		      break;
		      }
		    }
	       if(!fNameRestrict)
                if( !enemy && !follower )
                for( fpl=first_player; fpl!=NULL && !fNameRestrict; 
                        fpl=fpl->next)
                  {
                  fch = fpl->ch;
		    if ( is_name_short( arg, fch->name ) )
		      {
  		      if( IS_SET( fch->act, PLR_WIZINVIS) 
			  && ch->level<(MAX_LEVEL-3))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
  			if(fch!=ch && is_affected(fch, gsn_greater_stealth) 
			   && ( !is_affected(ch, gsn_truesight)
	                   || ch->mclass[CLASS_ILLUSIONIST] < fch->level )
			   && !IS_SET(ch->act, PLR_HOLYLIGHT))
		       {
		  	send_to_char( "No one has that name.\n\r", ch);
		  	return;
		       }
		      fNameRestrict = TRUE;
		      matchpl = fpl;
		      break;
		      }
		    }
		if(!fNameRestrict)
		  {
		  send_to_char( "No one has that name.\n\r", ch);
		  return;
		  }
	    }
	}
    }

    /*
     * Now show matching chars.
     */


    nMatch = 0;
    nTotal = 0;
    buf[0] = '\0';
    plen = 0;
   for( fpl=first_player; fpl!=NULL; fpl=fpl->next)
    {
    wch=fpl->ch;
    d=NULL;
    if(is_desc_valid( wch))
      d=wch->desc;
	/*
	 * Check for match against restrictions.
	 * Don't use trust as that exposes trusted mortals.
	      Chaos set to see all chars, invis or not.
	 */
  if( IS_SET( wch->act, PLR_WIZINVIS) && ch->level<(MAX_LEVEL-3))
    continue;

  if (wch!=ch && is_affected(wch, gsn_greater_stealth) && 
     !((is_affected(ch, gsn_truesight) && ch->mclass[CLASS_ILLUSIONIST] >= wch->level) || IS_SET(ch->act, PLR_HOLYLIGHT)))
    continue;

  nTotal++;
	if( wch->level < iLevelLower
           ||   wch->level > iLevelUpper
           || ( fImmortalOnly  && wch->level < LEVEL_HERO )
           || ( fNameRestrict && fpl!=matchpl) 
           || ( wch->level < lrang)
           || ( wch->level > hrang)
           || ( fRace && wch->race != iRaceClass )
           || ( fClass && wch->class != iRaceClass )
           || ( (fClan || fOrder) && !IS_NPC(wch) && wch->pcdata->clan != iClan )
           || ( follower && ((which_god( ch) != which_god( wch))))
      	   || ( target && (!(can_attack (ch, wch)) || wch==ch))
           || ( enemy && ((which_god(ch)==which_god(wch)) ||
                           which_god(wch)==GOD_INIT_ORDER ||
                           which_god(wch)==GOD_INIT_CHAOS ||
                           which_god(wch)==GOD_NEUTRAL)) )
          continue;
	nMatch++;
     

        plen=str_apd_max( pbuf, "{030}[", plen, MAX_STRING_LENGTH);
        sprintf(buf_race,"%2d", wch->level);
        plen=str_apd_max( pbuf, buf_race, plen, MAX_STRING_LENGTH);
        plen=str_apd_max( pbuf, " ", plen, MAX_STRING_LENGTH);

	/*
	 * Figure out what to print for class.
	 */
	class = class_table[wch->class].who_name;
	switch ( wch->level )
	{
	default: break;
	case MAX_LEVEL - 0: class = "{120}GOD{030}"; break;
	case MAX_LEVEL - 1: class = "{120}DUK{030}"; break;
	case MAX_LEVEL - 2: if (which_god(wch) == GOD_POLICE)
			     class = "{120}COP{030}";
			    else
			     class = "{120}COU{030}"; break;
	case MAX_LEVEL - 3: class = "{120}LRD{030}"; break;
	}
        plen=str_apd_max( pbuf, class, plen, MAX_STRING_LENGTH);

        plen=str_apd_max( pbuf, " ", plen, MAX_STRING_LENGTH);
	strcpy(buf_race,race_table[wch->race].race_name);
	buf_race[3]='\0';
	if(wch->level>MAX_LEVEL-4)
	  strcpy(buf_race,"---");
        if( wch->pcdata->army_status == 1 )
          {
          plen=str_apd_max( pbuf, "{140}", plen, MAX_STRING_LENGTH);
          if( *buf_race >='a' && *buf_race <= 'z' )
            *buf_race -= ('a' - 'A');
          if( *(buf_race+1) >='a' && *(buf_race+1) <= 'z' )
            *(buf_race+1) -= ('a' - 'A');
          if( *(buf_race+2) >='a' && *(buf_race+2) <= 'z' )
            *(buf_race+2) -= ('a' - 'A');
          }
        plen=str_apd_max( pbuf, buf_race, plen, MAX_STRING_LENGTH);
        if( wch->pcdata->army_status == 1 )
          plen=str_apd_max( pbuf, "{030}", plen, MAX_STRING_LENGTH);
        plen=str_apd_max( pbuf, "]", plen, MAX_STRING_LENGTH);

	switch(which_god(wch))
	  {
	  case GOD_INIT_ORDER: 
            plen=str_apd_max( pbuf, "{060}o{020}<", plen, MAX_STRING_LENGTH);
            break;
	  case GOD_INIT_CHAOS: 
            plen=str_apd_max( pbuf, "{030}c{020}<", plen, MAX_STRING_LENGTH);
            break;
	  case GOD_ORDER: 
            plen=str_apd_max( pbuf, "{160}O{020}<", plen, MAX_STRING_LENGTH);
            break;
	  case GOD_CHAOS: 
            plen=str_apd_max( pbuf, "{130}C{020}<", plen, MAX_STRING_LENGTH);
            break;
	  case GOD_DEMISE: 
            plen=str_apd_max( pbuf, "{110}D{020}<", plen, MAX_STRING_LENGTH);
            break;
	  case GOD_POLICE: 
            plen=str_apd_max( pbuf, "{150}E{020}<", plen, MAX_STRING_LENGTH);
            break;
	  default: 
            plen=str_apd_max( pbuf, "-{020}<", plen, MAX_STRING_LENGTH);
            break;
	  }

	cnt=0;
	tong           = FALSE;
	under          = FALSE;
	if( wch->level >= 90 || IS_AFFECTED( wch, AFF_TONGUES))
	  tong=TRUE;
	if( IS_AFFECTED( wch, AFF_UNDERSTAND) && wch->level <= MAX_LEVEL-5 )
	  under=TRUE;
	if(tong)
          {
          if( typ==0 )
            plen=str_apd_max( pbuf, "{120}All{020}", plen, MAX_STRING_LENGTH);
          else
            plen=str_apd_max( pbuf, "{120}", plen, MAX_STRING_LENGTH);
          }
       if(typ==1)
        {
	for(cnt=0;cnt<MAX_RACE;cnt++)
	  if(IS_SHIFT(wch->language,cnt) || under)
	    {
	    if(IS_SHIFT(wch->speak,cnt)  && !tong)
                plen=str_apd_max( pbuf, "{120}", plen, MAX_STRING_LENGTH);
	    strcpy(buf2,race_table[cnt].race_name);
	    if(IS_SHIFT(wch->speak,cnt))
	      {
	      if(ch->vt100!=1)
                {
		/*if(buf2[2]>'Z')
		  buf2[2]-=('a'-'A');*/
		if(buf2[1]>'Z')
		  buf2[1]-=('a'-'A');
                }
	      }
	    else
	    if(!IS_SHIFT(wch->language,cnt))
		{
		/*buf2[2]='.';*/
		buf2[1]='.';
		buf2[0]+=('a'-'A');
		}
	    /*buf2[3]='\0';*/
	    buf2[2]='\0';
            plen=str_apd_max( pbuf, buf2, plen, MAX_STRING_LENGTH);

	    if(IS_SHIFT(wch->speak,cnt)  && !tong)
                plen=str_apd_max( pbuf, "{020}", plen, MAX_STRING_LENGTH);
	    }
	  else
            /*plen=str_apd_max( pbuf, " | ", plen, MAX_STRING_LENGTH);*/
            plen=str_apd_max( pbuf, " |", plen, MAX_STRING_LENGTH);
        plen=str_apd_max( pbuf, "{020}", plen, MAX_STRING_LENGTH);
        }
      else
       if( !tong )
        {
	for(cnt=0;cnt<MAX_RACE;cnt++)
	  if(IS_SHIFT(wch->speak,cnt))
            break;

        strcpy(buf2,race_table[cnt].race_name);
	      if(ch->vt100!=1)
                {
		if(buf2[2]>'Z')
		  buf2[2]-=('a'-'A');
		if(buf2[1]>'Z')
		  buf2[1]-=('a'-'A');
                }
        buf2[3]='\0';
        plen=str_apd_max( pbuf, buf2, plen, MAX_STRING_LENGTH);
        }

       if(  IS_SET(wch->act, PLR_KILLER) )
         plen=str_apd_max( pbuf, ">{010}K{170}", plen, MAX_STRING_LENGTH);
       else
       if(  IS_SET(wch->act, PLR_THIEF) )
         plen=str_apd_max( pbuf, ">{020}T{170}", plen, MAX_STRING_LENGTH);
       else
       if( IS_SET(wch->pcdata->player2_bits, PLR2_AFK))
         plen=str_apd_max( pbuf, ">{040}A{170}", plen, MAX_STRING_LENGTH);
       else
         plen=str_apd_max( pbuf, "> {170}", plen, MAX_STRING_LENGTH);

      if( typ==0 )
        {
        if( IS_NPC(wch) )
          strcpy( buf, "the monster" );
        else
          strcpy( buf, wch->pcdata->title );
        for( pt=buf; *pt!='\0'; pt++)
          {
          if( *pt=='{' )
            *pt='[';
          else
          if( *pt=='}' )
            *pt=']';
          }
        sprintf( buf2,"%s{070}%s                                                                      ",wch->name,
            buf);
        buf2[52]='\0';
        }
      else
        {  
          if (!IS_NPC(wch) && wch->pcdata->clan_name[0] != '\0')
	  {
            sprintf(buf2, "%-15s {002}%-15s                                                                            ",wch->name, wch->pcdata->clan_name);
            buf2[31]='\0';
	  }
 	  else
	  {
            sprintf(buf2, "%-15s                                                                             ",wch->name);
            buf2[26]='\0';
	  }
        }

      plen=str_apd_max( pbuf, buf2, plen, MAX_STRING_LENGTH);
      
      plen=str_apd_max( pbuf, "{134}", plen, MAX_STRING_LENGTH);
       if( (wch->pcdata->switched || wch->desc !=NULL) &&
               !IS_AFFECTED( wch, AFF_STEALTH ))
	 {
         sprintf(buf2, "%-14s", wch->in_room->area->name);
	 buf2[13]='\0';
	 }
       else
         if( wch->desc == NULL )
	   strcpy(buf2, "  L

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

Site Stats

Snippets: 1791
Codebases: 571