legend/
legend/area/
legend/player/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
/***************************************************************************
 *  God Wars Mud copyright (C) 1994, 1995, 1996 by Richard Woolcock        *
 *  									   *
 *  Legend of Chrystancia copyright (C) 1999, 2000, 2001 by Matthew Little *
 *  This mud is NOT to be copied in whole or in part, or to be run without *
 *  the permission of Matthew Little. Nobody else has permission to        *
 *  authorise the use of this code.                                        *
 ***************************************************************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
#include <time.h>
#include "merc.h"
#include "bastet.h"

NCLANS_DATA *nclans_table;

char *const where_name[] = {
   "#w[#cL#Cight#w             ] #n",
   "#w[#cO#Cn #cF#Cinger     #w] #n",
   "#w[#cO#Cn #cF#Cinger     #w] #n",
   "#w[#cA#Cround #cN#Ceck   #w] #n",
   "#w[#cA#Cround #cN#Ceck   #w] #n",
   "#w[#cO#Cn #cB#Cody       #w] #n",
   "#w[#cO#Cn #cH#Cead       #w] #n",
   "#w[#cO#Cn #cL#Cegs       #w] #n",
   "#w[#cO#Cn #cF#Ceet       #w] #n",
   "#w[#cO#Cn #cH#Cands      #w] #n",
   "#w[#cO#Cn #cA#Crms       #w] #n",
   "#w[#cO#Cff #cH#Cand      #w] #n",
   "#w[#cA#Cround #cB#Cody   #w] #n",
   "#w[#cA#Cround #cW#Caist  #w] #n",
   "#w[#cA#Cround #cW#Crist  #w] #n",
   "#w[#cA#Cround #cW#Crist  #w] #n",
   "#w[#cR#Cight #cH#Cand    #w] #n",
   "#w[#cL#Ceft #cH#Cand     #w] #n",
   "#w[#cT#Chird #cH#Cand    #w] #n",
   "#w[#cF#Courth #cH#Cand   #w] #n",

   "#w[#cO#Cn #cF#Cace       #w] #n",
   "#w[#cL#Ceft #cS#Ccabbard #w] #n",
   "#w[#cR#Cight #cS#Ccabbard#w] #n",
   "#w[#cI#Cnside #cC#Cloak  #w] #n",
   "#w[#cB#Coth #cH#Cands    #w] #n",
};

/*
 * Local functions.
 */
void reformat_desc( char *desc, bool map );
char *set_comma (long long int init);
char *show_char_to_char_0 (CHAR_DATA * victim, CHAR_DATA * ch);
char *format_obj_to_char args ((OBJ_DATA * obj, CHAR_DATA * ch, bool fShort));
void show_char_to_char_1 args ((CHAR_DATA * victim, CHAR_DATA * ch));
void show_char_to_char args ((CHAR_DATA * list, CHAR_DATA * ch));
bool check_blind args ((CHAR_DATA * ch));

void evil_eye args ((CHAR_DATA * victim, CHAR_DATA * ch));
void check_left_arm args ((CHAR_DATA * ch, CHAR_DATA * victim));
void check_right_arm args ((CHAR_DATA * ch, CHAR_DATA * victim));
void check_left_leg args ((CHAR_DATA * ch, CHAR_DATA * victim));
void check_right_leg args ((CHAR_DATA * ch, CHAR_DATA * victim));
void kingdom2 (CHAR_DATA * ch, char *kname);
void obj_score args ((CHAR_DATA * ch, OBJ_DATA * obj));
int col_str_len (char *txt);
char *centerjob(char *fill, const char *txt, int maxlen);
sh_int str_similar (const char *astr, const char *bstr)
{
   sh_int matches = 0;

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

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

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

   return matches;
}

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


   if (!IS_NPC (ch) && IS_SET (ch->extra2, MINIFLAGS))
   {
      sprintf (buf, "#w[#c.#e.#b.#R.#g.#y.#e.#n.#w]#n ");
      if (IS_SET (obj->quest, QUEST_ARTIFACT))
	 buf[5] = 'A';
      else if (IS_SET (obj->quest, QUEST_RELIC))
	 buf[5] = 'R';
      else if (obj->points > 0)
      {
	 if (IS_SET (obj->quest, QUEST_IMPROVED))
	    buf[5] = 'M';
	 else
	    buf[5] = 'L';
      }
      else if (obj->item_type == ITEM_QPRIZE)
	 buf[5] = 'p';
      else if (IS_SET (obj->quest, ITEM_EQUEST))
	 buf[5] = 'P';
      if (IS_OBJ_STAT (obj, ITEM_INVIS))
	 buf[8] = 'I';
      if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	  && !IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	  && IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 buf[11] = 'B';
      else if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	       && !IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 buf[11] = 'r';
      else if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	       && !IS_OBJ_STAT (obj, ITEM_ANTI_NEUTRAL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 buf[11] = 'Y';
      if (IS_AFFECTED (ch, AFF_DETECT_MAGIC) && IS_OBJ_STAT (obj, ITEM_MAGIC))
	 buf[14] = 'm';
      if (IS_OBJ_STAT (obj, ITEM_GLOW))
	 buf[17] = 'G';
      if (IS_OBJ_STAT (obj, ITEM_HUM))
	 buf[20] = 'H';
      if (IS_OBJ_STAT (obj, ITEM_SHADOWPLANE) && obj->in_room != NULL
	  && !IS_AFFECTED (ch, AFF_SHADOWPLANE))
	 buf[23] = 'S';
      if (!IS_OBJ_STAT (obj, ITEM_SHADOWPLANE) && obj->in_room != NULL
	  && IS_AFFECTED (ch, AFF_SHADOWPLANE))
	 buf[26] = 'N';
      if (!str_cmp (buf, "#w[#c.#e.#b.#R.#g.#y.#e.#n.#w]#n "))
	 buf[0] = '\0';
      if (obj->item_type == ITEM_QUESTCARD)
      {
	if ((obj->value[0] == -1)
        && (obj->value[1] == -1)
        && (obj->value[2] == -1)
        && (obj->value[3] == -1))
          strcat(buf, "#r(Completed)#n ");
      } 

      strcat (buf, "#e");
      if (fShort)
      {
	 if (obj->short_descr != NULL)
	    strcat (buf, obj->short_descr);
	 if (obj->condition < 100)
	    strcat (buf, " #w[#r#FD#n#w]#n");
      }
      else
      {
	 if (obj->description != NULL)
	    strcat (buf, obj->description);
      }
   }
   else

   {

      buf[0] = '\0';
      if (IS_SET (obj->quest, QUEST_ARTIFACT))
	 strcat (buf, "#w(#CArtifact#w)#n ");
      else if (IS_SET (obj->quest, QUEST_RELIC))
	 strcat (buf, "#w(#oRelic#w)#n ");

   else if (obj->item_ver == IV_MAGIC)
      strcat (buf, "#w(#RMagical#w)#n ");   
   else if (obj->item_ver == IV_RARE)
      strcat (buf, "#w(#cRare#w)#n ");
      else if (obj->points > 0)
      {
	 if (IS_SET (obj->quest, QUEST_IMPROVED))
	    strcat (buf, "#w(#cMythical#w)#n ");
	 else
	    strcat (buf, "#w(#pLegendary#w)#n ");
      }
      if (IS_SET (obj->quest, ITEM_EQUEST) || obj->item_type == ITEM_QPRIZE)
	 strcat (buf, "#w(#yPriceless#w)#n ");
      if (IS_OBJ_STAT (obj, ITEM_INVIS))
	 strcat (buf, "#w(#eI#wn#ev#wi#es#w)#n ");
      if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	  && !IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	  && IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 strcat (buf, "#w(#bBlue Aura#w)#n ");
      else if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	       && !IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 strcat (buf, "#w(#rRed Aura#w)#n ");
      else if (IS_AFFECTED (ch, AFF_DETECT_EVIL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_GOOD)
	       && !IS_OBJ_STAT (obj, ITEM_ANTI_NEUTRAL)
	       && IS_OBJ_STAT (obj, ITEM_ANTI_EVIL))
	 strcat (buf, "#w(#yYellow Aura#w)#n ");
      if (IS_AFFECTED (ch, AFF_DETECT_MAGIC) && IS_OBJ_STAT (obj, ITEM_MAGIC))
	 strcat (buf, "#w(#RMagical#w)#n ");
      if (IS_SET (obj->specxtype, XITEM_AOP))
         strcat( buf, "#r(#RAOP#r)#n ");
      if (IS_OBJ_STAT (obj, ITEM_GLOW))
	 strcat (buf, "#w(#gGlowing#w)#n ");
      if (IS_OBJ_STAT (obj, ITEM_HUM))
	 strcat (buf, "#w(#yHumming#w)#n ");
      if (IS_OBJ_STAT (obj, ITEM_APPLYT))
         strcat (buf, "#C(#eAPPLY#C)#n ");
      if (IS_OBJ_STAT (obj, ITEM_SHADOWPLANE) && obj->in_room != NULL
	  && !IS_AFFECTED (ch, AFF_SHADOWPLANE))
	 strcat (buf, "#w(#eShadowplane#w)#n ");

      if (!IS_OBJ_STAT (obj, ITEM_SHADOWPLANE) && obj->in_room != NULL
	  && IS_AFFECTED (ch, AFF_SHADOWPLANE))
	 strcat (buf, "#w(Normal plane)#n ");
      if (obj->item_type == ITEM_QUESTCARD)
      {
	if ((obj->value[0] == -1)
        && (obj->value[1] == -1)
        && (obj->value[2] == -1)
        && (obj->value[3] == -1))
          strcat(buf, "#r(Completed)#n ");
      } 
      strcat (buf, "#e");
     if (fShort)
      {
	 if (obj->short_descr != NULL)
	    strcat (buf, obj->short_descr);
      }
      else
      {
	 if (obj->description != NULL)
	    strcat (buf, obj->description);
      }
      strcat (buf, "#n");
   }

   return buf;
}

int char_hitroll (CHAR_DATA * ch)
{
   float hr = GET_HITROLL (ch);
   int rage = .25 * ch->max_hit;
   int sn;

   if (!IS_NPC (ch))
   {
      if (WORN_ARTIFACT (ch, ARTI_GREENLEAF_CLOAK) && (IS_SET (ch->flag2, AFF2_INARENA) ||
         (ch->in_room != NULL && (ch->in_room->sector_type == SECT_INSIDE || ch->in_room->sector_type == SECT_CITY))))
         hr -= 50;

      if (IS_CLASS (ch, CLASS_MONK) && ch->monkab[COMBAT] > 0)
         hr += (ch->monkab[COMBAT] * 35);

      if (IS_CLASS (ch, CLASS_VAMPIRE) && get_disc(ch, VAM_CELE) > 0)
         hr += (get_disc(ch, VAM_CELE) * 30);

        if ( IS_CLASS( ch, CLASS_WRAITH ))
        {
         if ( IS_WRATED( ch, WRAT_DEATHPLANE ))
            hr += 100;
         if ( ch->arcanoi[WFATL] == 5 )
            hr += 600;
         else if ( ch->arcanoi[WFATL] == 4 )
            hr += 500;
         else if ( ch->arcanoi[WFATL] == 3 )
            hr += 250;
         else if ( ch->arcanoi[WFATL] == 2 )
            hr += 100;
         else if ( ch->arcanoi[WFATL] == 1 )
            hr += 50;
        }
        if (!IS_CLASS( ch, CLASS_WRAITH ) && IS_WRATED( ch, WRAT_DEATHPLANE ) )
            hr -= 100;
        if (IS_SET(ch->wbits, WRAT_BALLAD)) 
            hr += 250;

      if (IS_CLASS (ch, CLASS_VAMPIRE) && ch->pcdata->stats[UNI_RAGE] > 0)
	 hr += ch->pcdata->stats[UNI_RAGE];
      if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->stats[UNI_RAGE] > 0)
	 hr += ch->pcdata->stats[UNI_RAGE];
      if (IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->special, SPC_SEEMING))
	 hr += 250;

      if (IS_CLASS (ch, CLASS_MAGE) && IS_SET (ch->mflags, MAGE_BETTERBODY))
	 hr += 115;

      if ((IS_CLASS(ch, CLASS_DROW) && IS_SET (ch->special, SPC_DROW_WAR) && rage >= ch->hit))
         hr += 500;
/*
 * Werewolves get a hitroll bonus from Moon phase at night.
 */
      if (IS_CLASS (ch, CLASS_WEREWOLF))
      {
	 if (weather_info.moonphase == MOON_HALF
	     && weather_info.time_of_day == NIGHT)
	    hr += 25;
	 if (weather_info.moonphase == MOON_FULL
	     && weather_info.time_of_day == NIGHT)
	    hr += 75;
      }
      if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 6
	  && ch->pcdata->powers[HARA_KIRI] > 0)
	 hr += 100;

      if (IS_SET (ch->special, SPC_WOLFMAN)
	  && ch->pcdata->stats[UNI_RAGE] > 0)
	 hr += ch->pcdata->stats[UNI_RAGE];

      if (IS_CLASS (ch, CLASS_DEMON) && ch->pcdata->stats[DEMON_POWER] > 0)
	 hr +=
	    ((ch->pcdata->stats[DEMON_POWER] *
	      ch->pcdata->stats[DEMON_POWER]) << 1);

      if (IS_CLASS (ch, CLASS_DRAGON))
      {
         hr += GET_AGE(ch) * 20;
      }
      if (IS_CLASS (ch, CLASS_HIGHLANDER)
	  && (get_eq_char (ch, WEAR_DUAL) != NULL))
      {
	 int wpn = ch->wpn[1];

	 if (wpn >= 500 && wpn < 1000)
	    hr += 500;
	 else if (wpn == 1000)
	    hr += 1000;
	 else
	    hr += wpn;
      }

   }
   if (IS_CLASS (ch, CLASS_DROW) && IS_POLYAFF(ch, POLY_SPIDERFORM))
      hr += 400;
   if (IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->extra2, EXTRA2_WYRM))
      hr += 200;
   if (IS_CLASS (ch, CLASS_WRAITH) && IS_POLYAFF (ch, POLY_ZULO))
      hr += 300;
   if (IS_CLASS (ch, CLASS_DROW) && IS_POLYAFF (ch, POLY_ZULO))
      hr += 200;
   if (IS_CLASS (ch, CLASS_DEMON) && IS_POLYAFF (ch, POLY_ZULO))
      hr += 200;
   if (IS_CLASS (ch, CLASS_VAMPIRE) && IS_POLYAFF (ch, POLY_ZULO))
      hr += 200;
   if (IS_CLASS (ch, CLASS_DRAGON) && IS_POLYAFF (ch, POLY_DRAGON))
      hr += GET_AGE(ch) * 18;
   if (IS_SET (ch->newbits, NEW_POWER))
      hr += 150;
   if (IS_EXTRA2 (ch, EXTRA2_INFECTED) && IS_PARA (3))
      hr *= 1.5;
   hr += ch->xhitroll;
   if (!IS_SET (ch->newbits, NEW_NOPAIN)
       && ch->hit < ch->max_hit && ch->max_hit > 0 &&
       !(IS_CLASS (ch, CLASS_DRAGON) && IS_SET (ch->pcdata->dragonaff, DRA_TOUGHNESS)) &&
       !(IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->garou1, WW_GRANITE)) &&
       !(IS_CLASS (ch, CLASS_HIGHLANDER) && ch->quickening[0] > 0) &&
       !(IS_CLASS (ch, CLASS_MAGE) && is_affected (ch, (sn = skill_lookup ("spirit kiss"))) &&
       !(IS_CLASS (ch, CLASS_MONK) && ch->chi[CURRENT] > 0) &&
       !(ch->pcdata->stats[UNI_RAGE] > 0) &&
       !(ch->in_room != NULL &&
       (((IS_CLASS (ch, CLASS_DEMON) || IS_SET (ch->special, SPC_CHAMPION)) && ch->in_room->vnum == 30000) ||
       (IS_CLASS (ch, CLASS_DROW) && ((ch->in_room->vnum == 29701) || (ch->in_room->vnum == 29702)))))
       ))
   {
      hr = ((hr * ch->hit) / (2 * ch->max_hit)) + ((hr) / 2);
   }
   return hr;
}

int char_damroll (CHAR_DATA * ch)
{
   float dr = GET_DAMROLL (ch);
   int rage = .25 * ch->max_hit;
   int sn;

   if (!IS_NPC (ch))
   {
      if (WORN_ARTIFACT (ch, ARTI_GREENLEAF_CLOAK) && (IS_SET (ch->flag2, AFF2_INARENA) ||
         (ch->in_room != NULL && (ch->in_room->sector_type == SECT_INSIDE || ch->in_room->sector_type == SECT_CITY))))
         dr -= 50;

        if ( IS_CLASS( ch, CLASS_WRAITH ))
        {
         if (IS_WRATED( ch, WRAT_DEATHPLANE ) )
            dr += 100;
         if ( ch->arcanoi[WFATL] == 5 )
            dr += 600;
         else if ( ch->arcanoi[WFATL] == 4 )
            dr += 500;
         else if ( ch->arcanoi[WFATL] == 3 )
            dr += 250;
         else if ( ch->arcanoi[WFATL] == 2 )
            dr += 100;
         else if ( ch->arcanoi[WFATL] == 1 )
            dr += 50;
        }
        if (!IS_CLASS( ch, CLASS_WRAITH ) && IS_WRATED( ch, WRAT_DEATHPLANE ) )
            dr -= 100;
        if (IS_SET(ch->wbits, WRAT_BALLAD))
            dr += 250;
      if (IS_CLASS (ch, CLASS_VAMPIRE) && get_disc(ch, VAM_POTE) > 0)
         dr += (get_disc(ch, VAM_POTE) * 30);

      if (IS_CLASS (ch, CLASS_MONK) && ch->monkab[COMBAT] > 0)
         dr += (ch->monkab[COMBAT] * 35);

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

      else if (IS_SET (ch->special, SPC_WOLFMAN)
	       && ch->pcdata->stats[UNI_RAGE] > 0)
	 dr += ch->pcdata->stats[UNI_RAGE];
      else if (IS_CLASS (ch, CLASS_DEMON)
	       && ch->pcdata->stats[DEMON_POWER] > 0)
	 dr +=
	    ((ch->pcdata->stats[DEMON_POWER] *
	      ch->pcdata->stats[DEMON_POWER]) << 1);

  
      if (IS_CLASS (ch, CLASS_MAGE) && IS_SET (ch->mflags, MAGE_BETTERBODY))
	 dr += 200;
      if ((IS_CLASS(ch, CLASS_DROW) && IS_SET (ch->special, SPC_DROW_WAR) && rage >= ch->hit))
         dr += 500;
      if (IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->special, SPC_SEEMING))
	 dr += 250;

      if (IS_CLASS (ch, CLASS_WEREWOLF))
      {
	 if (weather_info.moonphase == MOON_HALF
	     && weather_info.time_of_day == NIGHT)
	    dr += 25;
	 if (weather_info.moonphase == MOON_FULL
	     && weather_info.time_of_day == NIGHT)
	    dr += 75;
      }
      if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_CHIKYU] >= 6
	  && ch->pcdata->powers[HARA_KIRI] > 0)
	 dr += 50;
   }
   if (IS_CLASS (ch, CLASS_DRAGON))
   {
      dr += GET_AGE(ch) * 20;
   }
   if (IS_CLASS (ch, CLASS_HIGHLANDER)
       && (get_eq_char (ch, WEAR_DUAL) != NULL))
   {
      int wpn = ch->wpn[1];

      if (wpn >= 500 && wpn < 1000)
	 dr += 500;
      else if (wpn == 1000)
	 dr += 1000;
      else
	 dr += wpn;

   }
   if (IS_CLASS (ch, CLASS_DROW) && IS_POLYAFF(ch, POLY_SPIDERFORM))
      dr += 400;
   if (IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->extra2, EXTRA2_WYRM))
      dr += 400;
   if (IS_CLASS (ch, CLASS_WRAITH) && IS_POLYAFF (ch, POLY_ZULO))
      dr += 300;
   if (IS_CLASS (ch, CLASS_VAMPIRE) && IS_POLYAFF (ch, POLY_ZULO))
      dr += 200;
   if (IS_CLASS (ch, CLASS_DROW) && IS_POLYAFF (ch, POLY_ZULO))
      dr += 200;
   if (IS_CLASS (ch, CLASS_DEMON) && IS_POLYAFF (ch, POLY_ZULO))
      dr += 200;
   if (IS_CLASS (ch, CLASS_DRAGON) && IS_POLYAFF (ch, POLY_DRAGON))
      dr += GET_AGE(ch) * 18;
   if (IS_SET (ch->newbits, NEW_POWER))
      dr += 150;
   if (IS_EXTRA2 (ch, EXTRA2_INFECTED) && IS_PARA (3))
      dr *= 1.5;

   dr += ch->xdamroll;

   if (!IS_SET (ch->newbits, NEW_NOPAIN)
       && ch->hit < ch->max_hit && ch->max_hit > 0 &&
       !(IS_CLASS (ch, CLASS_DRAGON) && IS_SET (ch->pcdata->dragonaff, DRA_TOUGHNESS)) &&
       !(IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->garou1, WW_GRANITE)) &&
       !(IS_CLASS (ch, CLASS_HIGHLANDER) && ch->quickening[0] > 0) &&
       !(IS_CLASS (ch, CLASS_MAGE) && is_affected (ch, (sn = skill_lookup ("spirit kiss"))) &&
       !(IS_CLASS (ch, CLASS_MONK) && ch->chi[CURRENT] > 0) &&
       !(ch->pcdata->stats[UNI_RAGE] > 0) &&
       !(ch->in_room != NULL &&
       (((IS_CLASS (ch, CLASS_DEMON) || IS_SET (ch->special, SPC_CHAMPION)) && ch->in_room->vnum == 30000) ||
       (IS_CLASS (ch, CLASS_DROW) && ((ch->in_room->vnum == 29701) || (ch->in_room->vnum == 29702)))))
       ))
   {
      dr = ((dr * ch->hit) / (2 * ch->max_hit)) + ((dr) / 2);
   }
   return dr;
}

int char_ac (CHAR_DATA * ch)
{
   float a_c = GET_AC (ch);
   int rage = .25 * ch->max_hit;
   int sn;

   if (!IS_NPC (ch))
   {
      if (IS_CLASS (ch, CLASS_HIGHLANDER))
	 a_c -= 300;

      if (IS_CLASS (ch, CLASS_VAMPIRE) && get_disc(ch, VAM_FORT) > 0)
         a_c -= (get_disc(ch, VAM_FORT) * 30);

      if (IS_CLASS (ch, CLASS_DRAGON))
      {
         a_c -= GET_AGE(ch) * 40;
      }

      if ((IS_CLASS(ch, CLASS_DROW) && IS_SET (ch->special, SPC_DROW_WAR) && rage >= ch->hit))
         a_c -= 500;
      if (IS_CLASS (ch, CLASS_HIGHLANDER)
	  && (get_eq_char (ch, WEAR_DUAL) != NULL))
      {
	 int wpn = ch->wpn[1];

	 a_c -= wpn;
      }
      if (IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->extra2, EXTRA2_WYRM))
	 a_c -= 200;
      else if (IS_POLYAFF (ch, POLY_ZULO))
      {
	 a_c -= 200;
      }
      else if (IS_POLYAFF (ch, POLY_DRAGON))
      {
	 a_c -= 200;
      }
   }
   if (IS_EXTRA2 (ch, EXTRA2_INFECTED) && IS_PARA (6))
      a_c *= 1.5;
   a_c -= ch->xac;

if (IS_CLASS(ch, CLASS_WRAITH) && IS_WRATED( ch, WRAT_DEATHPLANE ) )
        a_c -= 150;
if (!IS_CLASS(ch, CLASS_WRAITH) && IS_WRATED( ch, WRAT_DEATHPLANE ) )
        a_c += 50;
if (IS_SET(ch->wbits, WRAT_BALLAD))
        a_c -= 100;

   if (!IS_SET (ch->newbits, NEW_NOPAIN)
       && ch->hit < ch->max_hit && ch->max_hit > 0 &&
       !(IS_CLASS (ch, CLASS_DRAGON) && IS_SET (ch->pcdata->dragonaff, DRA_TOUGHNESS)) &&
       !(IS_CLASS (ch, CLASS_FAE) && IS_SET (ch->garou1, WW_GRANITE)) &&
       !(IS_CLASS (ch, CLASS_HIGHLANDER) && ch->quickening[0] > 0) &&
       !(IS_CLASS (ch, CLASS_MAGE) && is_affected (ch, (sn = skill_lookup ("spirit kiss"))) &&
       !(IS_CLASS (ch, CLASS_MONK) && ch->chi[CURRENT] > 0) &&
       !(ch->pcdata->stats[UNI_RAGE] > 0) &&
       !(ch->in_room != NULL &&
       (((IS_CLASS (ch, CLASS_DEMON) || IS_SET (ch->special, SPC_CHAMPION)) && ch->in_room->vnum == 30000) ||
       (IS_CLASS (ch, CLASS_DROW) && ((ch->in_room->vnum == 29701) || (ch->in_room->vnum == 29702)))))
       ))
   {
      a_c = ((a_c * ch->hit) / (2 * ch->max_hit)) + ((a_c) / 2);
   }

   if (a_c < -7500)
   {
     return -7500;
   }

   return a_c;
}

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

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

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

   nShow = 0;

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

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

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

   /*
    * Output the formatted list.
    */
   for (iShow = 0; iShow < nShow; iShow++)
   {
      if (IS_NPC (ch) || IS_SET (ch->act, PLR_COMBINE))
      {
	 if (prgnShow[iShow] != 1)
	 {
	    sprintf (buf, "#e(#w%2d#e) ", prgnShow[iShow]);
	    send_to_char (buf, ch);
	 }
	 else
	 {
	    send_to_char ("     ", ch);
	 }
      }
      send_to_char (prgpstrShow[iShow], ch);
      send_to_char ("\n\r", ch);
      free_string (prgpstrShow[iShow]);
   }

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

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

   return;
}

char *show_char_to_char_0 (CHAR_DATA * victim, CHAR_DATA * ch)
{
   static char buf[MSL];
   char buf2[MSL], spacer[MSL], mount2[MSL], name[MSL], wizi[MSL];
   CHAR_DATA *mount;

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

   sprintf (spacer, "     ");

   if (!IS_NPC (victim) && victim->pcdata->chobj != NULL)
      return buf;
   if ((mount = victim->mount) != NULL && IS_SET (victim->mounted, IS_MOUNT))
      return buf;
/*
   if (!IS_NPC (victim) && IS_SET (victim->flag2, VAMP_OBJMASK))
   {
      sprintf (buf, "%s\n\r", victim->objdesc);
      return buf;
   }
*/
   if (IS_HEAD (victim, LOST_HEAD) && IS_AFFECTED (victim, AFF_POLYMORPH))
   {
      sprintf (buf, "%s is lying here\n\r", PERS (victim, ch));
      return buf;
   }
   else
   {
      char aff[MSL];

      aff[0] = '\0';

      if (!IS_NPC (ch) && IS_SET (ch->extra2, MINIFLAGS))
      {
	 sprintf (aff, "#w[#C.#w.#c.#g.#p.#w.#r.#P.#p.#R.#w.#e.#w]#n ");
	 if (!IS_NPC (victim) && victim->desc == NULL
	     && victim->pcdata->login_timer == 0)
	    aff[5] = 'L';
	 if (IS_SET (victim->newbits, NEW_NOTEWRITE))
	    aff[8] = 'N';
	 if (IS_AFFECTED (victim, AFF_INVISIBLE))
	    aff[11] = 'I';
	 if (IS_AFFECTED (victim, AFF_HIDE))
	    aff[14] = 'H';
	 if (IS_AFFECTED (victim, AFF_CHARM))
	    aff[17] = 'C';
	 if (IS_AFFECTED (victim, AFF_PASS_DOOR)
	     || IS_AFFECTED (victim, AFF_ETHEREAL))
	    aff[20] = 'T';
	 if (IS_SET (victim->flag2, EXTRA_AFK))
	    aff[23] = 'A';
	 if (IS_SET (victim->extra2, EXTRA2_INFECTED))
	    aff[26] = 'p';
	 if (IS_AFFECTED (victim, AFF_FAERIE_FIRE))
	    aff[29] = 'P';
	 if (IS_EVIL (victim) && IS_AFFECTED (ch, AFF_DETECT_EVIL))
	    aff[32] = 'R';
	 if (IS_AFFECTED (victim, AFF_SANCTUARY))
	    aff[35] = 'W';
	 if (IS_AFFECTED (ch, AFF_SHADOWPLANE)
	     && !IS_AFFECTED (victim, AFF_SHADOWPLANE))
	    aff[38] = 'n';
	 else if (!IS_AFFECTED (ch, AFF_SHADOWPLANE)
		  && IS_AFFECTED (victim, AFF_SHADOWPLANE))
	    aff[38] = 'S';
	 if (IS_WRATED( ch, WRAT_DEATHPLANE)
	     && !IS_WRATED(victim, WRAT_DEATHPLANE))
	    aff[38] = 'm';
	 else if (!IS_WRATED(ch, WRAT_DEATHPLANE)
		  && IS_WRATED(victim, WRAT_DEATHPLANE))
	    aff[38] = 'D';

	 if (!str_cmp (aff, "#w[#C.#w.#c.#g.#p.#w.#r.#P.#p.#R.#w.#e.#w]#n "))
	    aff[0] = '\0';
	 if (!IS_NPC (victim) && victim->desc)
	 {
	    if (victim->desc->pString)
	       strcat (aff, "#w[#gString #bEditor#w]#n ");
	    if (victim->desc->connected < 0)
	       strcat (aff, "#g[#bO#BL#bC#g] #n");
	 }

	 if (IS_IMMORTAL (victim) && IS_SET (victim->act, PLR_WIZINVIS)
	     && victim->pcdata->wizinvis >= 7)
	 {
	    sprintf (wizi, "#e[#wINVIS %d#e]#n ", victim->pcdata->wizinvis);
	    strcat (aff, wizi);
	 }

	 if (!IS_NPC (victim) && IS_SET (victim->extra2, WHINER))
	    strcat (aff, "#w->#F#rWHINER#n#w<-#n ");

         if (!IS_NPC (victim) && IS_SET (victim->extra2, DEMENTED))
            strcat (aff, "#r-#F#wDEMENTED#n#r-#n");

	 if (IS_IMMORTAL (victim) && IS_SET (victim->act, PLR_INCOG))
	    strcat (aff, "#e[#wINCOG#e]#n ");

      }
      else
      {
	 if (!IS_NPC (victim) && victim->desc == NULL)
	    strcat (aff, "#C(Link-Dead)#n ");
	 if (!IS_NPC (victim) && victim->desc)
	 {
	    if (victim->desc->pString)
	       strcat (aff, "#w(#gString #bEditor#w)#n ");
	    if (victim->desc->connected < 0)
	       strcat (aff, "#g(#bO#BL#bC#g) #n");
	 }
	 if (IS_SET (victim->newbits, NEW_NOTEWRITE))
	    strcat (aff, "#w(Writing Note)#n ");
	 if (IS_IMMORTAL (victim) && IS_SET (victim->act, PLR_WIZINVIS)
	     && victim->pcdata->wizinvis >= 7)
	 {
	    sprintf (wizi, "#e(#wINVIS %d#e)#n ", victim->pcdata->wizinvis);
	    strcat (aff, wizi);
	 }
	 if (IS_IMMORTAL (victim) && IS_SET (victim->act, PLR_INCOG))
	    strcat (aff, "#e(#wINCOG#e)#n ");

	 if (IS_AFFECTED (victim, AFF_INVISIBLE))
	    strcat (aff, "#c(Invis)#n ");
	 if (IS_AFFECTED (victim, AFF_HIDE))
	    strcat (aff, "#g(Hide)#n ");
	 if (IS_AFFECTED (victim, AFF_CHARM))
	    strcat (aff, "#p(Charmed)#n ");
	 if (IS_AFFECTED (victim, AFF_PASS_DOOR))
	    strcat (aff, "#w(Translucent)#n ");
	 if (IS_AFFECTED (victim, AFF_ETHEREAL))
	    strcat (aff, "#w(Ethereal)#n ");
	 if (IS_SET (victim->flag2, EXTRA_AFK))
	    strcat (aff, "(#r->AFK<-#n) ");
	 if (IS_SET (victim->extra2, WHINER))
	    strcat (aff, "#w->#F#rWHINER#n#w<-#n ");
         if (IS_SET (victim->extra2, DEMENTED))
            strcat (aff, "#r-#F#wDEMENTED#n#r-#n ");
	 if (IS_SET (victim->extra2, EXTRA2_INFECTED))
	    strcat (aff, "(#pPaRaSiTe#n) ");
	 if (IS_AFFECTED (victim, AFF_FAERIE_FIRE))
	    strcat (aff, "#p(Pink Aura)#n  ");
	 if (IS_EVIL (victim) && IS_AFFECTED (ch, AFF_DETECT_EVIL))
	    strcat (buf, "#r(Red Aura)#n ");
	 if (IS_AFFECTED (victim, AFF_SANCTUARY))
	    strcat (buf, "#w(White Aura)#n ");
	 if (IS_AFFECTED (victim, AFF_STEELSHIELD))
	    strcat (aff, "#b(Majesty)#n ");

	 if (IS_WRATED(ch, WRAT_DEATHPLANE)
	     && !IS_WRATED (victim, WRAT_DEATHPLANE))
	    strcat (aff, "#w(Material Plane)#n ");
	 else if (!IS_WRATED(ch, WRAT_DEATHPLANE)
		  && IS_WRATED(victim, WRAT_DEATHPLANE))
	    strcat (aff, "#e(Death Plane)#n ");
	 if (IS_AFFECTED (ch, AFF_SHADOWPLANE)
	     && !IS_AFFECTED (victim, AFF_SHADOWPLANE))
	    strcat (aff, "#e(Normal plane)#n ");
	 else if (!IS_AFFECTED (ch, AFF_SHADOWPLANE)
		  && IS_AFFECTED (victim, AFF_SHADOWPLANE))
	    strcat (aff, "#e(Shadowplane)#n ");
    if (IS_NPC(victim) &&ch->questmob > 0 && victim->pIndexData->vnum == ch->questmob)
        strcat( aff, "#R[#rTARGET#R] #n");

      }

      strcat (buf, aff);
   }

   if (ch->class > 0)
   {
      if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_VAMPIRE))
	 strcat (buf, "#r(Vampire)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_WEREWOLF))
	 strcat (buf, "#o(Werewolf)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_DEMON))
	 strcat (buf, "#y(Demon)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_MAGE))
	 strcat (buf, "#b(Mage)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_HIGHLANDER))
	 strcat (buf, "#C(Highlander)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_DROW))
	 strcat (buf, "#g(Ilythiiri)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_NINJA))
	 strcat (buf, "#p(Ninja)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_MONK))
	 strcat (buf, "#g(Monk)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_PHOENIX))
         strcat (buf, "#r(Phoenix)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_FAE))
	 strcat (buf, "#b(F#ca#be)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_WRAITH))
	 strcat (buf, "#w(#eW#wr#ea#wi#et#wh)#n ");
      else if (!IS_NPC (ch) && IS_CLASS (victim, CLASS_DRAGON))
	 strcat (buf, "#g(Dr#wag#gon)#n ");

   }

   if (!IS_NPC (ch) && IS_VAMPAFF (ch, VAM_AUSPEX) &&
       !IS_NPC (victim) && IS_CLASS (victim, CLASS_VAMPIRE) &&
       IS_VAMPAFF (victim, VAM_DISGUISED))
   {
      strcat (buf, "#w(#r");
      strcat (buf, victim->name);
      strcat (buf, "#w) #n");
   }
   if (IS_NPC (victim))
      strcat (buf, "#o");
   else if (IS_IMMORTAL (victim))
      strcat (buf, "#c");
   else
      strcat (buf, "#w");
   if (victim->position == POS_STANDING
       && victim->long_descr[0] != '\0'
       && strlen (victim->long_descr) > 3
       && !(mount = victim->mount) && victim->stance[0] < 1)
   {
      strcpy (name, victim->long_descr);
      name[strlen (name) - 2] = '\0';
   }
   else if (!IS_NPC (victim) && IS_AFFECTED (victim, AFF_POLYMORPH))
      strcat (name, victim->morph);
   else
      strcat (name, PERS (victim, ch));
   strcat (buf, name);

   if ((mount = victim->mount) != NULL && victim->mounted == IS_RIDING)
   {
      sprintf (mount2, " is here riding %s", PERS (mount, ch));
      strcat (buf, mount2);

      if (victim->position == POS_FIGHTING)
      {
	 strcat (buf, ", fighting ");

	 if (victim->fighting == NULL)
	    strcat (buf, "thin air");
	 else if (victim->fighting == ch)
	    strcat (buf, "YOU");
	 else if (victim->in_room == victim->fighting->in_room)
	 {
	    strcat (buf, PERS (victim->fighting, ch));
	 }
	 else
	    strcat (buf, "someone who left");
      }
   }

   else
   {
      switch (victim->position)
      {
      case POS_DEAD:
	 strcat (buf, " is DEAD!!");
	 break;
      case POS_MORTAL:
	 strcat (buf, " is #Rmortally wounded#n.");
	 break;
      case POS_INCAP:
	 strcat (buf, " is #rincapacitated#n.");
	 break;
      case POS_STUNNED:
	 strcat (buf, " is lying here #Cstunned#n.");
	 break;
      case POS_SLEEPING:
	 strcat (buf, " is sleeping here");
	 break;
      case POS_RESTING:
	 strcat (buf, " is resting here");
	 break;
      case POS_MEDITATING:
	 strcat (buf, " is meditating here");
	 break;
      case POS_SITTING:
	 strcat (buf, " is sitting here");
	 break;
      case POS_STANDING:
         
	 if (victim->stance[0] == STANCE_NORMAL)
	    strcat (buf, " is here, crouched in a fighting stance.");
	 else if ( victim->stance[0] == STANCE_VIPER)
	    strcat (buf, " is here, crouched in a viper fighting stance.");
	 else if (victim->stance[0] == STANCE_CRANE)
	    strcat (buf, " is here, crouched in a crane fighting stance.");
	 else if (victim->stance[0] == STANCE_CRAB)
	    strcat (buf, " is here, crouched in a crab fighting stance.");
	 else if (victim->stance[0] == STANCE_MONGOOSE)
	    strcat (buf, " is here, crouched in a mongoose fighting stance.");
	 else if (victim->stance[0] == STANCE_BULL)
	    strcat (buf, " is here, crouched in a bull fighting stance.");
	 else if (victim->stance[0] == STANCE_MANTIS)
	    strcat (buf, " is here, crouched in a mantis fighting stance.");
	 else if (victim->stance[0] == STANCE_DRAGON)
	    strcat (buf, " is here, crouched in a dragon fighting stance.");
	 else if (victim->stance[0] == STANCE_TIGER)
	    strcat (buf, " is here, crouched in a tiger fighting stance.");
	 else if (victim->stance[0] == STANCE_MONKEY)
	    strcat (buf, " is here, crouched in a monkey fighting stance.");
	 else if (victim->stance[0] == STANCE_SWALLOW)
	    strcat (buf, " is here, crouched in a swallow fighting stance.");

	 else if (victim->position == POS_STANDING && !IS_IMMORTAL (victim)
		  && IS_AFFECTED (victim, AFF_FLYING))
	    strcat (buf, " is hovering here");
	 else if (victim->position == POS_STANDING
		  && (!IS_NPC (victim) && (IS_VAMPAFF (victim, VAM_FLYING))))
	    strcat (buf, " is hovering here");
	 else if (victim->position == POS_STANDING
		  && (!IS_NPC (victim) && IS_CLASS (victim, CLASS_DROW)
		      && IS_SET (victim->pcdata->powers[1],
				 DPOWER_LEVITATION)))
	    strcat (buf, " is hovering here");
	 else if (victim->position == POS_STANDING
		  && (!IS_NPC (victim) && IS_CLASS (victim, CLASS_DRAGON)
		      && IS_SET (victim->pcdata->dragonaff, DRA_WINGS)))
	    strcat (buf, " is hovering here");
	 else if (!IS_NPC (victim))
	    strcat (buf, " is here.");
	 break;
      case POS_FIGHTING:
	 strcat (buf, " is here, fighting ");
	 if (victim->fighting == NULL)
	    strcat (buf, "thin air");
	 else if (victim->fighting == ch)
	    strcat (buf, "YOU");
	 else if (victim->in_room == victim->fighting->in_room)
	 {
	    strcat (buf, PERS (victim->fighting, ch));
	 }
	 else
	    strcat (buf, "someone who left");
	 break;
      }
   }
   if (IS_SET (victim->war, TEAM_RED))
   {
      sprintf (buf2, "\n\r#n%s.....is in the war on the #rRED#n Team.", spacer);
      strcat (buf, buf2);
   }
   if (IS_SET (victim->war, TEAM_BLUE))
   {
      sprintf (buf2, "\n\r#n%s.....is in the war on the #bBLUE#n Team.",
	       spacer);
      strcat (buf, buf2);
   }
   if (victim->embracing != NULL)
   {
      sprintf (buf2, "\n\r#n%s.....is holding %s in a stern embrace!", spacer,
	       PERS (victim->embracing, ch));
      strcat (buf, buf2);
   }
   else if (victim->embraced != NULL)
   {
      sprintf (buf2, "\n\r#n%s.....is being embraced by %s!", spacer,
	       PERS (victim->embraced, ch));
      strcat (buf, buf2);
   }

   if (IS_SET (victim->flag2, AFF2_ROT))
   {
      sprintf (buf2, "\n\r#n%s.....is coated with a layer of rotten skin!",
	       spacer);
      strcat (buf, buf2);
   }

   if (IS_AFFECTED (victim, AFF_FLAMING))
   {
      sprintf (buf2, "\n\r#n%s.....is engulfed in #rblazing flames!#n", spacer);
      strcat (buf, buf2);
   }

   if (IS_EXTRA (victim, TIED_UP))
   {
      sprintf (buf2, "\n\r#n%s.....is tied up", spacer);
      if (IS_EXTRA (victim, GAGGED) && IS_EXTRA (victim, BLINDFOLDED))
	 strcat (buf2, ", gagged and blindfolded!");
      else if (IS_EXTRA (victim, GAGGED))
	 strcat (buf2, " and gagged!");
      else if (IS_EXTRA (victim, BLINDFOLDED))
	 strcat (buf2, " and blindfolded!");
      else
	 strcat (buf2, "!");
      strcat (buf, buf2);
   }

   if (IS_AFFECTED (victim, AFF_ENTRAILS))
   {
      sprintf (buf2, "\n\r#n%s.....is covered with entrails.", spacer);
      strcat (buf, buf2);
   }
   if (IS_AFFECTED (victim, AFF_WEBBED))
   {
      sprintf (buf2, "\n\r#n%s.....is coated in a sticky web.", spacer);
      strcat (buf, buf2);
   }

   if (IS_NPC (ch) || !IS_SET (ch->act, PLR_BRIEF))
   {
      if (IS_ITEMAFF (victim, ITEMA_SHOCKSHIELD))
      {
	 sprintf (buf2,
		  "\n\r#n%s.....is surrounded by a shield of #ylightning#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_FIRESHIELD))
      {
	 sprintf (buf2, "\n\r#n%s.....is surrounded by a shield of #rfire#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_ICESHIELD))
      {
	 sprintf (buf2, "\n\r#n%s.....is surrounded by a shield of #cice#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_ACIDSHIELD))
      {
	 sprintf (buf2, "\n\r#n%s.....is surrounded by a shield of #oacid#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_SOLARSHIELD))
      {
         sprintf (buf2, "\n\r#n%s.....is surrounded by a shield of #ysolar energy#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_CHAOSSHIELD))
      {
	 sprintf (buf2,
		  "\n\r#n%s.....is surrounded by a shield of #.c#.h#.a#.o#.s#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_REFLECT))
      {
	 sprintf (buf2,
		  "\n\r#n%s.....is surrounded by a shield of #0darkness#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_ITEMAFF (victim, ITEMA_SUNSHIELD))
      {
	 sprintf (buf2,
		  "\n\r#n%s.....is surrounded by a glowing halo of #ysun#n.",
		  spacer);
	 strcat (buf, buf2);
      }
      if (IS_SET (victim->extra2, AURA_NO_MAGIC))
      {
	 sprintf (buf2, "\n\r#n%s.....is surrounded by a #pMagickal Aura#n.",
		  spacer);
	 strcat (buf, buf2);
      }

   }
   strcat (buf, "#n");
   return buf;
}

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

   return;

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

      (*skill_table[victim->specpower].spell_fun) (victim->specpower,
						   victim->spl[tabletype],
						   victim, ch);
   }
   return;
}

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

   if (!IS_NPC (ch) && (ch->lstatus > 1) && (number_range (1, 100) <= 80)
       && !IS_IMMORTAL (ch))
   {
      act ("You glance at $N.", ch, NULL, victim, TO_CHAR);
   }

   else if (IS_NPC (ch)
	    || (can_see (victim, ch)
		&& (ch->pcdata->wizinvis <= victim->level)))
   {
      act ("$n looks at you.", ch, NULL, victim, TO_VICT);
      act ("$n looks at $N.", ch, NULL, victim, TO_NOTVICT);
   }
   if (!IS_NPC (ch) && IS_HEAD (victim, LOST_HEAD))
   {
      act ("$N is lying here.", ch, NULL, victim, TO_CHAR);
      return;
   }
   if (victim->description[0] != '\0')
   {
      send_to_char (victim->description, ch);
   }
/*
   else
   {
      act ("You see nothing special about $M.", ch, NULL, victim, TO_CHAR);
   }
*/
   if (victim->max_hit > 0)
      percent = (100 * victim->hit) / victim->max_hit;
   else
      percent = -1;

   strcpy (buf, PERS (victim, ch));

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

   buf[0] = UPPER (buf[0]);
   send_to_char (buf, ch);

   if (!IS_NPC (victim))
   {
      if (IS_CLASS (victim, CLASS_DRAGON))
      {
	 if (IS_SET (victim->pcdata->dragonaff, DRA_FANGS))
	    act ("$N has many sharp pointed teeth.", ch, NULL, victim,
		 TO_CHAR);
	 if (IS_SET (victim->pcdata->dragonaff, DRA_WINGS))
	    act ("$N has a pair of huge leathery wings extending from $S back.", ch, NULL, victim, TO_CHAR);
	 if (IS_SET (victim->pcdata->dragonaff, DRA_TAIL))
	 {
            switch (GET_AGE(victim))
	    {
	    case 1:
	       act ("$N has a tail 16 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 2:
	       act ("$N has a tail 28 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 3:
	       act ("$N has a tail 38 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 4:
	       act ("$N has a tail 50 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 5:
	       act ("$N has a tail 60 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 6:
	       act ("$N has a tail 70 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 7:
	       act ("$N has a tail 84 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 8:
	       act ("$N has a tail 95 feet long.", ch, NULL, victim, TO_CHAR);
	       break;
	    case 9:
	       act ("$N has a tail 108 feet long.", ch, NULL, victim,
		    TO_CHAR);
	       break;
	    case 10:
	       act ("$N has a tail 120 feet long.", ch, NULL, victim,
		    TO_CHAR);
	       break;
	    case 11:
	       act ("$N has a tail 150 feet long.", ch, NULL, victim,
		    TO_CHAR);
	       break;
	    case 12:
	       act ("$N has a tail 200 feet long.", ch, NULL, victim,
		    TO_CHAR);
	       break;
	    default:
	       act ("$N has a tail over 200 feet long.", ch, NULL, victim,
		    TO_CHAR);
	    }
	 }
      }

      if (IS_CLASS (victim, CLASS_VAMPIRE)
	  && IS_SET (victim->newbits, NEW_OBEAH))
      {
	 if (victim->pcdata->obeah > 0)
	    act ("$N has a brightly glowing eye in the centre of $S forehead.", ch, NULL, victim, TO_CHAR);
	 else
	    act ("$N has an eye in the centre of $S forehead.", ch, NULL,
		 victim, TO_CHAR);
      }

      if (IS_AFFECTED (victim, AFF_INFRARED)
	  || IS_VAMPAFF (victim, VAM_NIGHTSIGHT))
	 act ("$N's eyes are glowing bright red.", ch, NULL, victim, TO_CHAR);
      if (IS_AFFECTED (victim, AFF_FLYING))
	 act ("$N is hovering in the air.", ch, NULL, victim, TO_CHAR);
      if (!IS_NPC (victim) && IS_CLASS (victim, CLASS_DROW)
	  && IS_SET (victim->pcdata->powers[1], DPOWER_LEVITATION))
	 act ("$N is hovering in the air.", ch, NULL, victim, TO_CHAR);
      if (IS_VAMPAFF (victim, VAM_FANGS))
	 act ("$N has a pair of long, pointed fangs.", ch, NULL, victim,
	      TO_CHAR);
      if (!IS_NPC (victim) && IS_CLASS (victim, CLASS_VAMPIRE)
	  && IS_VAMPAFF (victim, VAM_CLAWS))
	 act ("$N has razer sharp claws protruding from under $S finger nails.", ch, NULL, victim, TO_CHAR);
      else if (!IS_NPC (victim) && IS_VAMPAFF (victim, VAM_CLAWS))
	 act ("$N has razer sharp talons extending from $S fingers.", ch,
	      NULL, victim, TO_CHAR);
      if (!IS_NPC (victim ) && IS_DEMAFF (victim, DEM_HORNS))
	    act ("$N has a pair of pointed horns extending from $S head.", ch,
		 NULL, victim, TO_CHAR);
      if (!IS_NPC (victim)
	  && (IS_CLASS (victim, CLASS_DEMON)
	      || IS_SET (victim->special, SPC_CHAMPION)))
      {
	 if (IS_DEMAFF (victim, DEM_HOOVES))
	    act ("$N has a huge pair of hooves in place of $S feet.", ch,
		 NULL, victim, TO_CHAR);
	 if (IS_DEMAFF (victim, DEM_TAIL))
            act ("$N has a huge tail extended from $S backside.", ch, NULL,
		 victim, TO_CHAR);
	 if (IS_CLASS (ch, CLASS_DEMON) && IS_SET (ch->warp, WARP_KNIFE))
	    act ("$N has a knife stuck in $S head.", ch, NULL, victim,
		 TO_CHAR);
	 if (IS_CLASS (ch, CLASS_DEMON) && IS_SET (ch->warp, WARP_SPOON))
	    act ("$N has a spoon stuck on $S ear.", ch, NULL, victim,
		 TO_CHAR);
	 if (IS_CLASS (ch, CLASS_DEMON) && IS_SET (ch->warp, WARP_FORK))
	    act ("$N has a fork stuck in $S nose", ch, NULL, victim, TO_CHAR);

      }
      if (IS_DEMAFF (victim, DEM_WINGS))
      {
         if (IS_DEMAFF (victim, DEM_UNFOLDED))
            act ("$N has a pair of batlike wings spread out from behind $S back.", ch, NULL, victim, TO_CHAR);
         else
            act ("$N has a pair of batlike wings folded behind $S back.",
                 ch, NULL, victim, TO_CHAR);
      }
      else if (IS_VAMPAFF (victim, VAM_WINGS))
         act ("$N has large wings protruding from $S back.", ch, NULL, victim, TO_CHAR);
   }
   found = FALSE;
   for (iWear = 0; iWear < MAX_WEAR; iWear++)
   {
      if (iWear == WEAR_CLOAK && !WORN_ARTIFACT(victim, ARTI_CLOAK_OF_THE_ARCHMAGI)) continue;
      if ((obj = get_eq_char (victim, iWear)) != NULL
	  && can_see_obj (ch, obj))
      {
	 if (!found)
	 {
	    send_to_char ("\n\r", ch);
	    act ("$N is using:", ch, NULL, victim, TO_CHAR);
	    found = TRUE;
	 }
	 send_to_char (where_name[iWear], ch);
	 if (IS_NPC (ch) || ch->pcdata->chobj == NULL
	     || ch->pcdata->chobj != obj)
	 {
	    send_to_char (format_obj_to_char (obj, ch, TRUE), ch);
	    send_to_char ("\n\r", ch);
	 }
	 else
	    send_to_char ("you\n\r", ch);
      }
   }

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

   return;
}

void show_char_to_char (CHAR_DATA * list, CHAR_DATA * ch)
{
   CHAR_DATA *rch;
   char **prgpstrShow, *pstrShow, buf[MSL];
   int *prgnShow, nShow, iShow, count;
   CHAR_DATA *mount;
   bool fCombine;

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

   count = 0;
   for (rch = list; rch; rch = rch->next_in_room)
   {
      if (rch == list && count > 0) break;
      count++;
   }
   prgpstrShow = alloc_mem (count * sizeof (char *));
   prgnShow = alloc_mem (count * sizeof (int));
   nShow = 0;

   for (rch = list; rch != NULL; rch = rch->next_in_room)
   {
      if (rch == ch)
	 continue;

      if (IS_IMMORTAL (ch) || IS_IMMORTAL (rch))
      {

	 if (!IS_NPC (rch) && IS_SET (rch->act, PLR_WIZINVIS)
	     && get_trust (ch) < rch->pcdata->wizinvis && ch->level < 12 && ch->trust < 12)

	    continue;
      }
      else
      {
	 if (!IS_NPC (rch)
	     && (IS_SET (rch->act, PLR_WIZINVIS)
		 || IS_ITEMAFF (rch, ITEMA_VANISH))
	     && !IS_SET (ch->act, PLR_HOLYLIGHT)
	     && !IS_ITEMAFF (ch, ITEMA_VISION)
	     && !IS_SET (rch->tag_flags, TAG_PLAYING))
	    continue;
      }

      if (!IS_NPC (rch))
      {
	 if (IS_HEAD (rch, LOST_HEAD))
	    continue;
	 if (IS_EXTRA (rch, EXTRA_OSWITCH))
	    continue;
      }
      if (IS_SET (rch->mounted, IS_MOUNT))
	 continue;
      if (can_see (ch, rch))
      {
	 pstrShow = show_char_to_char_0 (rch, ch);
	 fCombine = FALSE;

	 if (IS_NPC (ch) || IS_SET (ch->act, PLR_COMBINE))
	 {
	    for (iShow = nShow - 1; iShow >= 0; iShow--)
	    {
	       //  if ((mount = rch->mount) != NULL && IS_SET (rch->mounted, IS_MOUNT))
	       //     break;
	       if (!strcmp (prgpstrShow[iShow], pstrShow))
	       {
		  prgnShow[iShow]++;
		  fCombine = TRUE;
		  break;
	       }
	    }
	 }

	 if (!fCombine)
	 {
	    prgpstrShow[nShow] = str_dup (pstrShow);
	    prgnShow[nShow] = 1;
	    nShow++;
	 }
      }
   }

   for (iShow = 0; iShow < nShow; iShow++)
   {
      if (IS_NPC (ch) || IS_SET (ch->act, PLR_COMBINE))
      {

	 if (prgnShow[iShow] != 1)
	 {
	    sprintf (buf, "#e(#w%2d#e)#w ", prgnShow[iShow]);
	    send_to_char (buf, ch);
	 }
	 else
	    send_to_char ("     #w", ch);
      }

      send_to_char (prgpstrShow[iShow], ch);
      send_to_char ("#n\n\r", ch);
      free_string (prgpstrShow[iShow]);
   }

   for (rch = list; rch != NULL; rch = rch->next_in_room)
   {
      if (rch == ch)
	 continue;

      if ((mount = rch->mount) != NULL && IS_SET (rch->mounted, IS_MOUNT))
	 continue;
      if (IS_IMMORTAL (ch) || IS_IMMORTAL (rch))
      {
	 if (!IS_NPC (rch) &&
	     IS_SET (rch->act, PLR_WIZINVIS) &&
	     get_trust (ch) < get_trust (rch))
	    continue;
      }
      else
      {
	 if (!IS_NPC (rch) &&
	     (IS_SET (rch->act, PLR_WIZINVIS) ||
	      IS_ITEMAFF (rch, ITEMA_VANISH)) &&
	     !IS_SET (ch->act, PLR_HOLYLIGHT) &&
	     !IS_ITEMAFF (ch, ITEMA_VISION))
	    continue;
      }

      if (!IS_NPC (rch))
      {
	 if (IS_HEAD (rch, LOST_HEAD))
	    continue;
	 if (IS_EXTRA (rch, EXTRA_OSWITCH))
	    continue;
      }

      if (!can_see (ch, rch))
      {
	 if (room_is_dark (rch->in_room))
	 {
	    if (IS_AFFECTED (rch, AFF_INFRARED) ||
		(!IS_NPC (rch) && IS_VAMPAFF (rch, VAM_NIGHTSIGHT)))
	    {
	       if (IS_NPC (ch) || IS_SET (ch->act, PLR_COMBINE))
		  send_to_char ("     ", ch);
	       stc ("You see a pair of glowing #Rred#n eyes watching you!\n\r", ch);
	    }
	 }
      }
   }

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

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

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

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

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

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

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

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

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

   if (ch->in_room == NULL)
      return;
   if (IS_SET (ch->war, WARRING))
   {
      if (ch->in_room->vnum > WHVNUM || ch->in_room->vnum < WLVNUM)
      {
	 putbackinwar (ch);
	 return;
      }
   }

   if (!IS_SET (ch->war, WARRING) && war->bits != 0)
   {
      if (ch->in_room->vnum > WLVNUM && ch->in_room->vnum < WHVNUM
	  && !IS_IMMORTAL (ch))
      {
	 smackdown (ch);
	 stc ("Stay out of the war!\n\r", ch);
	 return;
      }
   }

   ch->last_room = ch->in_room;

   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->in_room->room_flags, ROOM_TOTAL_DARKNESS)
       && !IS_ITEMAFF (ch, ITEMA_VISION) && !IS_IMMORTAL (ch) && (!IS_CLASS (ch, CLASS_DROW))
       && !(IS_CLASS(ch, CLASS_FAE) && IS_KITH (ch, KITH_SLUAGH))
       && !WORN_ARTIFACT (ch, ARTI_HEART_OF_DARKNESS) && !WORN_ARTIFACT (ch, ARTI_MASK_OF_THE_SUN))
   {
      send_to_char ("It is pitch black ... \n\r", ch);
      return;
   }

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

   argument = one_argument (argument, arg1);
   argument = one_argument (argument, arg2);

   if (arg1[0] == '\0' || !str_cmp (arg1, "auto"))
   {
      /* 'look' or 'look auto' */

      if (IS_SET (ch->extra2, MAP) && IS_SET (ch->more, MORE_NODESC))
         REMOVE_BIT (ch->extra2, MAP);

      if (ch->in_room != NULL && ch->in_room->vnum == ROOM_VNUM_IN_OBJECT
	  && !IS_NPC (ch) && ch->pcdata->chobj != NULL
	  && ch->pcdata->chobj->in_obj != NULL)
	 act ("$p", ch, ch->pcdata->chobj->in_obj, NULL, TO_CHAR);
      else if (IS_AFFECTED (ch, AFF_SHADOWPLANE) && !IS_SET (ch->extra2, MAP))
	 stc ("#eThe Shadow Plane#n\n\r", ch);
      else if (IS_WRATED (ch, WRAT_DEATHPLANE)
	       && !IS_SET (ch->extra2, MAP) && !IS_CLASS (ch, CLASS_WRAITH))
	 stc ("#eThe Death Plane#n\n\r", ch);

      else if (IS_WRATED (ch, WRAT_DEATHPLANE)
	       && !IS_SET (ch->extra2, MAP) && IS_CLASS (ch, CLASS_WRAITH))
	 stcprintf (ch, "#eThe Death Plane #w(%s)#n\n\r", ch->in_room->name);

      else if (!IS_SET (ch->extra2, MAP)
	       && !IS_WRATED(ch, WRAT_DEATHPLANE))
      {
	 if (IS_IMMORTAL (ch) && IS_SET (ch->more, MORE_ROOMFLAGS))
	 {
	    sprintf (buf, "#g[%5d] #w%s #g[%s] [%s]#n\n\r", ch->in_room->vnum,
		     ch->in_room->name,
		     room_bit_name (ch->in_room->room_flags),
		     sector_name (ch->in_room->sector_type));
	 }
	 else
	 {
	    sprintf (buf, "#w%s\n\r", ch->in_room->name);
	 }
	 send_to_char (buf, ch);

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

      if (ch->in_room != NULL && ch->in_room->vnum == ROOM_VNUM_IN_OBJECT
	  && !IS_NPC (ch) && ch->pcdata->chobj != NULL
	  && ch->pcdata->chobj->in_obj != NULL)
      {
	 act ("You are inside $p.", ch, ch->pcdata->chobj->in_obj, NULL,
	      TO_CHAR);
	 show_list_to_char (ch->pcdata->chobj->in_obj->contains, ch, FALSE,
			    FALSE);
      }
      else if ((arg1[0] == '\0' || !str_cmp (arg1, "auto"))
	       && IS_AFFECTED (ch, AFF_SHADOWPLANE)
	       && !IS_SET (ch->extra2, MAP))
	 send_to_char ("You are standing in complete darkness.\n\r", ch);
      else if ((arg1[0] == '\0' || !str_cmp (arg1, "auto"))
	       && IS_WRATED (ch, WRAT_DEATHPLANE)
	       && !IS_SET (ch->extra2, MAP) && !IS_CLASS (ch, CLASS_WRAITH))
      send_to_char( "Stenches of death and decay arise from around you.\n\r", ch );
      else if ((!IS_NPC (ch) && !IS_SET (ch->more, MORE_NODESC))
	       && (arg1[0] == '\0' || !str_cmp (arg1, "auto")))
      {

	 if (IS_SET (ch->extra2, MAP))
	 {
	    char dbuf[MSL];
	    sprintf (dbuf, "#C%s#n", ch->in_room->description);
	    draw_map (ch, dbuf);
	 }
	 else if (ch->in_room->vnum == 2700 || ch->in_room->vnum == 3 || ch->in_room->vnum == 31000)
         {
	    char dbuf[MSL];
	    sprintf (dbuf, "#C%s", ch->in_room->description);
	    stc (dbuf, ch);
         }
         else
	 {
           char roombuf[MSL];
            sprintf(roombuf, "#C%s#n", ch->in_room->description );
            reformat_desc( roombuf, FALSE );
            send_to_char(roombuf, ch);
          //}
	    if (ch->in_room->sector_type != SECT_INSIDE && IS_OUTSIDE (ch))
	    {
	       if (number_range (0, 10) < 5)
	       {
		  if (weather_info.sky == SKY_RAINING)
		     send_to_char
			("#cA cool wind howls and brings a light rain.#n\n\r",
			 ch);
		  else if (weather_info.sky == SKY_CLOUDY)
		     send_to_char ("#cA cold wind is blowing.#n\n\r", ch);
	       }
	    }
	 }
	 if (ch->in_room->blood == 1000)
	    sprintf (buf,
		     "You notice that the room is completely drenched in blood.\n\r");
	 else if (ch->in_room->blood > 750)
	    sprintf (buf,
		     "You notice that there is a very large amount of blood around the room.\n\r");
	 else if (ch->in_room->blood > 500)
	    sprintf (buf,
		     "You notice that there is a large quantity of blood around the room.\n\r");
	 else if (ch->in_room->blood > 250)
	    sprintf (buf,
		     "You notice a fair amount of blood on the floor.\n\r");
	 else if (ch->in_room->blood > 100)
	    sprintf (buf,
		     "You notice several blood stains on the floor.\n\r");
	 else if (ch->in_room->blood > 50)
	    sprintf (buf, "You notice a few blood stains on the floor.\n\r");
	 else if (ch->in_room->blood > 25)
	    sprintf (buf,
		     "You notice a couple of blood stains on the floor.\n\r");
	 else if (ch->in_room->blood > 0)
	    sprintf (buf,
		     "You notice a few drops of blood on the floor.\n\r");
	 else
	    sprintf (buf, "You notice nothing special in the room.\n\r");
	 ADD_COLOUR (ch, buf, L_RED);
	 if (ch->in_room->blood > 0)
	    send_to_char (buf, ch);
      }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   /* 'look direction' */
   if ((pexit = ch->in_room->exit[door]) == NULL)
   {
      send_to_char ("Nothing special there.\n\r", ch);
      return;
   }
/*
    if ( 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'
       && pexit->keyword[0] != ' ')
   {
      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_ISDOOR))
      {
	 act ("The $d is open.", ch, NULL, pexit->keyword, TO_CHAR);
	 if ((pexit = ch->in_room->exit[door]) == NULL)
	    return;
	 if ((pRoomIndex = pexit->to_room) == NULL)
	    return;
	 location = ch->in_room;
	 char_from_room (ch);
	 char_to_room (ch, pRoomIndex);
	 do_look (ch, "auto");
	 char_from_room (ch);
	 char_to_room (ch, location);
      }
      else
      {
	 if ((pexit = ch->in_room->exit[door]) == NULL)
	    return;
	 if ((pRoomIndex = pexit->to_room) == NULL)
	    return;
	 location = ch->in_room;
	 char_from_room (ch);
	 char_to_room (ch, pRoomIndex);
	 do_look (ch, "auto");
	 char_from_room (ch);
	 char_to_room (ch, location);
      }
   }
   else
   {
      if ((pexit = ch->in_room->exit[door]) == NULL)
	 return;
      if ((pRoomIndex = pexit->to_room) == NULL)
	 return;
      location = ch->in_room;
      char_from_room (ch);
      char_to_room (ch, pRoomIndex);
      do_look (ch, "auto");
      char_from_room (ch);
      char_to_room (ch, location);
   }

   return;
}

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

   one_argument (argument, arg);

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

   do_look (ch, arg);

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

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

   return;
}

/*
 * Thanks to Zrin for auto-exit part.
 */
void do_exits (CHAR_DATA * ch, char *argument)
{
   extern char *const dir_name[];
   char buf[MAX_STRING_LENGTH];
   char tempbuf[MSL];
   EXIT_DATA *pexit;
   bool found;
   bool fAuto;
   int door;

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

   if (!check_blind (ch))
      return;

   strcpy (buf, fAuto ? "#w[Exits:#n" : "Obvious exits:\n\r");

   found = FALSE;
   for (door = 0; door <= 5; door++)
   {
      if ((pexit = ch->in_room->exit[door]) != NULL && pexit->to_room != NULL)
//        && !IS_SET (pexit->exit_info, EX_CLOSED))
      {
	 found = TRUE;
	 if (fAuto)
	 {
	    strcat (buf, "#w ");
	    if (IS_SET (pexit->exit_info, EX_CLOSED))
	    {
	       sprintf (tempbuf, "<SEND href=\"%s\">(%s)</SEND>",
			exit_name[door], dir_name[door]);
	       strcat (buf, tempbuf);
	    }
	    else if (!IS_SET (pexit->exit_info, EX_CLOSED))
	    {
	       sprintf (tempbuf, "<SEND href=\"%s\">%s</SEND>",
			exit_name[door], dir_name[door]);
	       strcat (buf, tempbuf);
	    }
	 }
	 else
	 {

	    if (!IS_NPC (ch) && IS_IMMORTAL (ch))
	    {
	       sprintf (buf + strlen (buf), "%-5s #w- %s #w(#g%d#w)#n\n\r",
			dir_name2[door], pexit->to_room->name,
			pexit->to_room->vnum);
	    }
	    else if (IS_SET (pexit->exit_info, EX_CLOSED))
	    {
	       sprintf (buf + strlen (buf), "#w%-5s - %s (Closed door)\n\r",
			dir_name2[door], pexit->to_room->name);
	    }
	    else if (IS_SET (world_affects, WORLD_FOG))
	    {
	       sprintf (buf + strlen (buf),
			"#w%-5s - Too foggy to tell.#n\n\r", dir_name2[door]);
	    }
	    else if (!IS_NPC (ch) && IS_VAMPAFF (ch, VAM_NIGHTSIGHT))
	    {
	       sprintf (buf + strlen (buf), "%-5s #w- %s\n\r",
			dir_name2[door], pexit->to_room->name);
	    }

	    else
	       sprintf (buf + strlen (buf), "#w%-5s - %s#n\n\r",
			dir_name2[door],
			room_is_dark (pexit->to_room) ? "#wToo dark to tell#n"
			: pexit->to_room->name);
	 }
      }
   }

   if (!found)
      strcat (buf, fAuto ? " #wnone#n" : "#wNone.#n\n\r");

   if (fAuto)
      strcat (buf, "#w]#n\n\r");

   mxp_to_char (ch, buf, MXP_ALL);
   return;
}

void do_applytokens( CHAR_DATA *ch, char *argument )
{
    OBJ_DATA *obj = NULL;
    char arg1[MIL];
    char arg2[MIL];
    int apply;
    
    argument = one_argument(argument, arg1);
    argument = one_argument(argument, arg2);
    
    if (IS_NPC(ch)) return;
    
    if ( arg1[0] == '\0' || arg2[0] == '\0' )
    {
        send_to_char("Syntax : applytoken <hitroll/damroll/ac/hp/mana/move> <item>\n\r",ch);
        return;
    }
    
    if (!(obj = get_obj_carry(ch, arg2)))
    {
        send_to_char( "You are not carrying that item.\n\r", ch );
        return;
    }
    
    if (obj->item_type != ITEM_WEAPON && obj->item_type != ITEM_ARMOR)
    {
        send_to_char("You can only apply tokens to weapons and armor.\n\r", ch);
        return;
    }

    if (IS_OBJ_STAT (obj, ITEM_APPLYT))
    {
         stc("A token has already been applied to that item.\n\r",ch); 
         return;
    }

    if (!str_cmp(arg1,"hitroll")) apply = 0;
    else if (!str_cmp(arg1,"damroll")) apply = 1;
    else if (!str_cmp(arg1,"ac")) apply = 2;
    else if (!str_cmp(arg1,"hp")) apply = 3;
    else if (!str_cmp(arg1,"mana")) apply = 4;
    else if (!str_cmp(arg1,"move")) apply = 5;
    else { stc("Not a valid apply.\n\r",ch); return; }

    if (ch->tokens[apply] < 1) { send_to_char("You don't have a token to cover that.\n\r",ch); return; }

    if (apply == 0) affect_to_obj (obj, -1, APPLY_HITROLL, 20);
    else if (apply == 1) affect_to_obj (obj, -1, APPLY_DAMROLL, 20);
    else if (apply == 2) affect_to_obj (obj, -1, APPLY_AC, -100);
    else if (apply == 3) affect_to_obj (obj, -1, APPLY_HIT, -100);
    else if (apply == 4) affect_to_obj (obj, -1, APPLY_MANA, -100);
    else if (apply == 5) affect_to_obj (obj, -1, APPLY_MOVE, -100);
    else { 
    stc("You cannot apply that token.\n\rYou most likely need an immortal to redeem that token.\n\r",ch);
    return;
    }
    
    SET_BIT(obj->extra_flags, ITEM_APPLYT);
    ch->tokens[apply] -= 1;
    stc("You have applied a token to an object!\n\r",ch);
    return;
}

void do_tokens (CHAR_DATA * ch, char *argument)
{
   char buf[MSL];
stc("#r[#w    Tokens     #r]#n\n\r",ch);
stc("#r[#e-=-=-=-=-=-=-=-#r]#n\n\r",ch);
sprintf(buf,"#r[#o Hitroll#C:#G %-3d  #r]#n\n\r",ch->tokens[0]);
stc(buf,ch);
sprintf(buf,"#r[#o Damroll#C:#G %-3d  #r]#n\n\r",ch->tokens[1]);
stc(buf,ch);
sprintf(buf,"#r[#o      AC#C:#G %-3d  #r]#n\n\r",ch->tokens[2]);
stc(buf,ch);
sprintf(buf,"#r[#o     -Hp#C:#G %-3d  #r]#n\n\r",ch->tokens[3]);
stc(buf,ch);
sprintf(buf,"#r[#o   -Mana#C:#G %-3d  #r]#n\n\r",ch->tokens[4]);
stc(buf,ch);
sprintf(buf,"#r[#o   -Move#C:#G %-3d  #r]#n\n\r",ch->tokens[5]);
stc(buf,ch);
sprintf(buf,"#r[#o    Wear#C:#G %-3d  #r]#n\n\r",ch->tokens[6]);
stc(buf,ch);
sprintf(buf,"#r[#o  Rename#C:#G %-3d  #r]#n\n\r",ch->tokens[7]);
stc(buf,ch);
stc("#r[#e-=-=-=-=-=-=-=-#r]#n\n\r",ch);
sprintf(buf,"#r[#G   Owner#C:#R %-3d  #r]#n\n\r",ch->tokens[8]);
stc(buf,ch);
sprintf(buf,"#r[#G     Imp#C:#P %-3d  #r]#n\n\r",ch->tokens[9]);
stc(buf,ch);
sprintf(buf,"#r[#G      HJ#C:#o %-3d  #r]#n\n\r",ch->tokens[10]);
stc(buf,ch);
stc("#r[#e-=-=-=-=-=-=-=-#r]#n\n\r",ch);
  return;
}

DO_COM (do_tokencount)
{
   OBJ_DATA *obj;
   char buf[MAX_STRING_LENGTH];
   int num=0;
   int owner=0,imp=0,hj=0, stat=0;
      
   if (IS_NPC (ch))
      return;
   
      for (obj = object_list; obj != NULL; obj = obj->next)
      {
        // if (obj->item_type != ITEM_NEWTOKEN) continue;
//         if (obj->item_type == ITEM_NEWTOKEN) num++;
           if (obj->item_type == ITEM_NEWTOKEN)
           {
           if ((obj->carried_by != NULL) && (!IS_NPC (obj->carried_by)) && obj->value[0] <= 8) num -= 1;
           if ((obj->carried_by != NULL) && (!IS_NPC (obj->carried_by)) && obj->value[0] == 9) hj -= 1;   
           if ((obj->carried_by != NULL) && (!IS_NPC (obj->carried_by)) && obj->value[0] == 10) imp -= 1;   
           if ((obj->carried_by != NULL) && (!IS_NPC (obj->carried_by)) && obj->value[0] == 11) owner -= 1;
           } 
         //if ((obj->carried_by != NULL) && (!IS_NPC (obj->carried_by)) && obj->item_type == ITEM_STOKEN) stat -= 1; 
           if (obj->item_type == ITEM_NEWTOKEN)
           {
  
         if (obj->value[0] == 9) { hj++; }
         if (obj->value[0] == 10) { imp++; }
         if (obj->value[0] == 11) { owner++; }
         if (obj->item_type == ITEM_NEWTOKEN) { num++; }
            }
         if (obj->item_type == ITEM_STOKEN) { stat++; }
      }
   sprintf(buf,"There are %d status tokens scattered throughout the world.\n\r",stat);
   stc(buf,ch);
   sprintf(buf,"There are %d enhancement tokens scattered throughout the world.\n\r",num);
   stc(buf,ch);
   sprintf(buf,"There are %d owner tokens scattered throughout the world.\n\r",owner);
   stc(buf,ch);
   sprintf(buf,"There are %d implementor tokens scattered throughout the world.\n\r",imp);
   stc(buf,ch);
   sprintf(buf,"There are %d high judge tokens scattered throughout the world.\n\r",hj);
   stc(buf,ch);
   return;
}

void do_score (CHAR_DATA * ch, char *argument)
{
   int online = 0;
   int total = 0;
   int a_c = char_ac (ch);
   float chtier;
   float chtierexp;
   int percent;
   int nexttier;
   char buf[MAX_STRING_LENGTH];
   char hit_str[MAX_INPUT_LENGTH];
   char mana_str[MAX_INPUT_LENGTH];
   char move_str[MAX_INPUT_LENGTH];
   char mhit_str[MAX_INPUT_LENGTH];
   char mmana_str[MAX_INPUT_LENGTH];
   char mmove_str[MAX_INPUT_LENGTH];
   char exp_str[MAX_INPUT_LENGTH];
   int days;
   int hours;
   int minutes;
   int seconds;

   online = (int) (current_time - ch->logon);
   total = ch->played + online;

   sprintf (hit_str, "%d", ch->hit);
   COL_SCALE (hit_str, ch, ch->hit, ch->max_hit);
   sprintf (mana_str, "%d", ch->mana);
   COL_SCALE (mana_str, ch, ch->mana, ch->max_mana);
   sprintf (move_str, "%d", ch->move);
   COL_SCALE (move_str, ch, ch->move, ch->max_move);
   sprintf (exp_str, "%lli", ch->exp);
   COL_SCALE (exp_str, ch, ch->exp, 1000);
   sprintf (mhit_str, "%d", ch->max_hit);
   ADD_COLOUR (ch, mhit_str, L_CYAN);
   sprintf (mmana_str, "%d", ch->max_mana);
   ADD_COLOUR (ch, mmana_str, L_CYAN);
   sprintf (mmove_str, "%d", ch->max_move);
   ADD_COLOUR (ch, mmove_str, L_CYAN);

   if (IS_NPC (ch))
      return;

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

   sprintf (buf, " #wName:#n %s%-15s#n.\n\r", ch->name,
	    IS_NPC (ch) ? "" : ch->pcdata->title);
   send_to_char (buf, ch);
   if (!IS_NPC (ch))
   {
      sprintf (buf, " #wCreated:#n %s\n\r", ch->createtime);
      send_to_char (buf, ch);
   }
   if (!IS_NPC (ch))
      birth_date (ch, TRUE);
   if (!IS_NPC (ch) && IS_EXTRA (ch, EXTRA_PREGNANT))
      birth_date (ch, FALSE);

   days = (total / 86400);
   hours = ((total / 3600) % 24);
   minutes = ((total / 60) % 60);
   seconds = (total % 60);
   sprintf (buf,
	    " #wPlayed:#n %d day%s, %d hour%s, %d minute%s, and %d second%s\n\r",
	    days, days == 1 ? "" : "s", hours, hours == 1 ? "" : "s", minutes,
	    minutes == 1 ? "" : "s", seconds, seconds == 1 ? "" : "s");
   send_to_char (buf, ch);

   hours = ((online / 3600));
   minutes = ((online / 60) % 60);
   seconds = (online % 60);
   sprintf (buf,
	    " #wThis Session:#n %d hour%s, %d minute%s, and %d second%s\n\r",
	    hours, hours == 1 ? "" : "s", minutes, minutes == 1 ? "" : "s",
	    seconds, seconds == 1 ? "" : "s");
   send_to_char (buf, ch);

   if (get_trust (ch) != ch->level)

   {
      divide7_to_char (ch);

      sprintf (buf, " #wTrust:#n %d.\n\r", get_trust (ch));
      send_to_char (buf, ch);
   }
   divide7_to_char (ch);

   sprintf (buf,
	    " #wHP:#n %s/%s.  #wMANA:#n %s/%s.  #wMOVE:#n %s/%s.  #wPrimal:#n %d.\n\r",
	    hit_str, mhit_str, mana_str, mmana_str, move_str, mmove_str,
	    ch->practice);
   send_to_char (buf, ch);

   sprintf (buf,
	    " #wCarrying:#n %d/%d items.  #wCarried Weight:#n %d/%d kg.",
	    ch->carry_number, can_carry_n (ch), ch->carry_weight,
	    can_carry_w (ch));
   send_to_char (buf, ch);

   stcprintf (ch, " #wPage Length: #n%d.\n\r", ch->pcdata->pagelen);

   sprintf (buf,
	    " #wStr:#n %d (%d)  #wInt: #n%d (%d)  #wWis:#n %d (%d)  #wDex:#n %d (%d)  #wCon:#n %d (%d).\n\r",
	    get_curr_str (ch), ch->pcdata->perm_str, get_curr_int (ch),
	    ch->pcdata->perm_int, get_curr_wis (ch), ch->pcdata->perm_wis,
	    get_curr_dex (ch), ch->pcdata->perm_dex, get_curr_con (ch),
	    ch->pcdata->perm_con);
   send_to_char (buf, ch);


   sprintf (buf, " #wEXP:#n %lli.  #wGold:#n %d.  #wQuest Points: #n%d.",
	    ch->exp, ch->gold, ch->pcdata->quest);
   send_to_char (buf, ch);
   sprintf (buf, "#w  Tier Points:#n %d.\n\r", ch->tpoints);
   stc (buf, ch);

   divide7_to_char (ch);

   sprintf (buf,
	    " #wAutoexit:#n [%s]  #wAutoloot:#n    [%s]  #wAutosac:#n    [%s]  #wAutogold#n   [%s]  #wShields#n [%s]\n\r",
	    (!IS_NPC (ch) && IS_SET (ch->act, PLR_AUTOEXIT)) ? "X" : " ",
	    (!IS_NPC (ch) && IS_SET (ch->act, PLR_AUTOLOOT)) ? "X" : " ",
	    (!IS_NPC (ch)
	     && IS_SET (ch->act, PLR_AUTOSAC)) ? "X" : " ", (!IS_NPC (ch)
							     &&
							     IS_SET (ch->more,
								     PLR_AUTOGOLD))
	    ? "X" : " ", (!IS_NPC (ch)
			  && IS_SET (ch->more, MORE_SHIELDS)) ? "X" : " ");
   send_to_char (buf, ch);
   sprintf (buf,
	    " #wNo Summon:#n[%s]  #wNo Transport:#n[%s]  #wNo Desc:#n    [%s]  #wAnsiColor:#n [%s]\n\r", 
/*  #wBackup#n  [%s]\n\r",*/
	    !IS_SET (ch->immune, IMM_SUMMON) ? "X" : " ", !IS_SET (ch->immune,
								   IMM_TRANSPORT)
	    ? "X" : " ", IS_SET (ch->more, MORE_NODESC) ? "X" : " ",
	    IS_SET (ch->act, PLR_ANSI) ? "X" : " ");
	    //IS_SET (ch->act, PLR_AUTOBACKUP) ? "X" : " ");
   stc (buf, ch);
   sprintf (buf,
	    " #wMCCP:#n     [%s]  #wMXP:#n         [%s]  #wUsing MXP:#n  [%s]\n\r",
	    ch->desc->out_compress ? "X" : " ", ch->desc->mxp ? "X" : " ",
	    USE_MXP (ch) ? "X" : " ");
   stc (buf, ch);
   if (IS_IMMORTAL (ch))
   {

      sprintf (buf,
	       " #wWizinvis:#n [%s]  #wIncog:#n       [%s]  #wInvis Level:#n[%d].\n\r",
	       (!IS_NPC (ch)
		&& IS_SET (ch->act, PLR_WIZINVIS)) ? "X" : " ", (!IS_NPC (ch)
								 &&
								 IS_SET
								 (ch->act,
								  PLR_INCOG))
	       ? "X" : " ", ch->pcdata->wizinvis);
      send_to_char (buf, ch);
   }

   if (!IS_NPC (ch) && IS_CLASS (ch, CLASS_DRAGON))
   {
      divide7_to_char (ch);
      sprintf (buf, "#w Dragon Points: #n %d.\n\r",
	       ch->pcdata->stats[DEMON_CURRENT]);
      send_to_char (buf, ch);
   }

   if (!IS_NPC (ch)
       && (IS_CLASS (ch, CLASS_DEMON) || IS_SET (ch->special, SPC_CHAMPION)))
   {
      divide7_to_char (ch);

      sprintf (buf,
	       " #wCurrent Demonic Power:#n %d.   #wMax Demonic Power:#n %d.\n\r",
	       ch->pcdata->stats[DEMON_CURRENT],
	       ch->pcdata->stats[DEMON_TOTAL]);
      send_to_char (buf, ch);
   }

   if (!IS_NPC (ch) && IS_CLASS (ch, CLASS_DROW))
   {
      divide7_to_char (ch);

      sprintf (buf, " #wDrow Points:#n %d.\n\r",
	       ch->pcdata->stats[DROW_POWER]);
      send_to_char (buf, ch);
      sprintf (buf, " #wMagic Resistance:#n %d.\n\r",
	       ch->pcdata->stats[DROW_MAGIC]);
      send_to_char (buf, ch);
   }

   if (ch->level > 2)
   {
      divide7_to_char (ch);

      sprintf (buf, " #w[Arena Stats] Wins: #n%d. #wLosses:#n %d.\n\r",
	       ch->awins, ch->alosses);
      send_to_char (buf, ch);
      if (ch->challenged != NULL)
      {
	 if (IS_SET (ch->flag2, AFF2_CHALLENGED))
	 {
	    sprintf (buf, " #w[Arena]#n You have been challenged by %s.\n\r",
		     ch->challenged->name);
	    send_to_char (buf, ch);
	 }
	 if (IS_SET (ch->flag2, AFF2_CHALLENGER))
	 {
	    sprintf (buf, " #w[Arena]#n You have challenged %s.\n\r",
		     ch->challenged->name);
	    send_to_char (buf, ch);
	 }
      }
      if (ch->gladiator != NULL)
      {
	 sprintf (buf, " #w[Arena Bet]#n You have a %d QP bet on %s\n\r",
		  ch->pcdata->plr_wager, ch->gladiator->name);
	 send_to_char (buf, ch);
      }

   }
   switch (ch->position)
   {
   case POS_DEAD:
      send_to_char (" #wPosition:#n DEAD!!", ch);
      break;
   case POS_MORTAL:
      send_to_char (" #wPosition:#n MORTALLY WOUNDED.", ch);
      break;
   case POS_INCAP:
      send_to_char (" #wPosition:#n Incapacitated.", ch);
      break;
   case POS_STUNNED:
      send_to_char (" #wPosition:#n Stunned.", ch);
      break;
   case POS_SLEEPING:
      send_to_char (" #wPosition:#n Sleeping.", ch);
      break;
   case POS_RESTING:
      send_to_char (" #wPosition:#n Resting.", ch);
      break;
   case POS_MEDITATING:
      send_to_char (" #wPosition:#n Meditating.", ch);
      break;
   case POS_SITTING:
      send_to_char (" #wPosition:#n Sitting.", ch);
      break;
   case POS_STANDING:
      send_to_char (" #wPosition:#n Standing.", ch);
      break;
   case POS_FIGHTING:
      send_to_char (" #wPosition:#n Fighting.", ch);
      break;
   }

   if ((ch->pcdata->condition[COND_DRUNK] > 10
	|| ch->pcdata->condition[COND_THIRST] == 0
	|| ch->pcdata->condition[COND_FULL] == 0))
      send_to_char ("  #wCondition:#n", ch);
   if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
      send_to_char (" Drunk", ch);
   if (!IS_NPC (ch) && ch->pcdata->condition[COND_THIRST] == 0)
      send_to_char (" Thirsty", ch);
   if (!IS_NPC (ch) && ch->pcdata->condition[COND_FULL] == 0)
      send_to_char (" Hungry", ch);

   sprintf (buf, "  #wWimpy:#n %d.", ch->wimpy);
   if (!IS_NPC (ch) && IS_EXTRA (ch, EXTRA_DONE))
      strcat (buf, "  Non-Virgin.\n\r");
   else
      strcat (buf, "\n\r");
   send_to_char (buf, ch);

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

   divide7_to_char (ch);

   if (ch->level >= 0)
   {
      sprintf (buf, " #wAC:#n %d ", a_c);
      send_to_char (buf, ch);
   }

   send_to_char ("#w:#n ", ch);
   if (a_c >= 101)
      send_to_char ("Naked!\n\r", ch);
   else if (a_c >= 80)
      send_to_char ("Barely clothed.\n\r", ch);
   else if (a_c >= 60)
      send_to_char ("Wearing clothes.\n\r", ch);
   else if (a_c >= 40)
      send_to_char ("Slightly armored.\n\r", ch);
   else if (a_c >= 20)
      send_to_char ("Somewhat armored.\n\r", ch);
   else if (a_c >= 0)
      send_to_char ("Armored.\n\r", ch);
   else if (a_c >= -50)
      send_to_char ("Well armored.\n\r", ch);
   else if (a_c >= -100)
      send_to_char ("Strongly armored.\n\r", ch);
   else if (a_c >= -250)
      send_to_char ("Heavily armored.\n\r", ch);
   else if (a_c >= -500)
      send_to_char ("Superbly armored.\n\r", ch);
   else if (a_c >= -749)
      send_to_char ("Divinely armored.\n\r", ch);
   else
      send_to_char ("Ultimately armored!\n\r", ch);


   sprintf (buf,
	    " #wHitroll:#n %d.  #wDamroll:#n %d.  #wDamcap:#n %d.  #wSave vs Spell:#n %d.",
	    char_hitroll (ch), char_damroll (ch), ch->damcap[0],
	    ch->saving_throw);
   send_to_char (buf, ch);

   if (!IS_NPC (ch) && IS_CLASS (ch, CLASS_VAMPIRE))
   {
      sprintf (buf, "\n\r #wBlood:#n %d.", ch->pcdata->condition[COND_THIRST]);
      send_to_char (buf, ch);

      sprintf (buf, "  #wBeast:#n %d.  ", ch->beast);
      send_to_char (buf, ch);
      if (ch->beast < 0)
	 send_to_char ("You are a cheat!\n\r", ch);
      else if (ch->beast == 0)
	 send_to_char ("You have attained Golconda!\n\r", ch);
      else if (ch->beast <= 5)
	 send_to_char ("You have almost reached Golconda!\n\r", ch);
      else if (ch->beast <= 10)
	 send_to_char ("You are nearing Golconda!\n\r", ch);
      else if (ch->beast <= 15)
	 send_to_char ("You have great control over your beast.\n\r", ch);
      else if (ch->beast <= 20)
	 send_to_char
	    ("Your beast has little influence over your actions.\n\r", ch);
      else if (ch->beast <= 30)
	 send_to_char ("You are in control of your beast.\n\r", ch);
      else if (ch->beast <= 40)
	 send_to_char ("You are able to hold back the beast.\n\r", ch);
      else if (ch->beast <= 60)
	 send_to_char
	    ("You are constantly struggling for control of your beast.\n\r",
	     ch);
      else if (ch->beast <= 75)
	 send_to_char ("Your beast has great control over your actions.\n\r",
		       ch);
      else if (ch->beast <= 90)
	 send_to_char ("The power of the beast overwhelms you.\n\r", ch);
      else if (ch->beast <= 99)
	 send_to_char ("You have almost lost your battle with the beast!\n\r",
		       ch);
      else
	 send_to_char ("The beast has taken over!\n\r", ch);

   }

   else if (!IS_CLASS (ch, CLASS_VAMPIRE))
      send_to_char ("\n\r", ch);

   if (ch->level >= 0)
   {
      divide7_to_char (ch);

      sprintf (buf, " #wAlignment:#n %d ", ch->alignment);
      send_to_char (buf, ch);
   }

   send_to_char ("#w:#n", ch);
   if (ch->alignment > 900)
      send_to_char ("Angelic.", ch);
   else if (ch->alignment > 700)
      send_to_char ("Saintly.", ch);
   else if (ch->alignment > 350)
      send_to_char ("Good.", ch);
   else if (ch->alignment > 100)
      send_to_char ("Kind.", ch);
   else if (ch->alignment > -100)
      send_to_char ("Neutral.", ch);
   else if (ch->alignment > -350)
      send_to_char ("Mean.", ch);
   else if (ch->alignment > -700)
      send_to_char ("Evil.", ch);
   else if (ch->alignment > -900)
      send_to_char ("Demonic.", ch);
   else
      send_to_char ("Satanic.", ch);

   if (!IS_NPC (ch) && ch->level >= 0)
   {
      sprintf (buf, " #wStatus:#n %d.  ", ch->race);
      send_to_char (buf, ch);
   }

   if (!IS_NPC (ch))
      send_to_char ("You are ", ch);

   if (!IS_NPC (ch) && ch->level == 1)
      send_to_char ("a Newbie.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 2)
      send_to_char ("a Mortal.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 7)
      send_to_char ("a Newbie Helper.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 8)
      send_to_char ("a Builder.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 9)
      send_to_char ("an Enforcer.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 10)
      send_to_char ("a Judge.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 11)
      send_to_char ("a High Judge.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 12)
      send_to_char ("an Implementor.\n\r", ch);
   else if (!IS_NPC (ch) && ch->level == 12)
      send_to_char ("a Co-Owner.\n\r", ch);

   else if (!str_cmp (ch->name, "Tijer"))
      stc ("the Owner of the Mud.\n\r", ch);

   else if (!IS_NPC (ch) && ch->race <= 0)
      send_to_char ("an Avatar.\n\r", ch);
   else if (ch->race <= 4)
      send_to_char ("a Peasant.\n\r", ch);
   else if (ch->race <= 9)
      send_to_char ("a Page.\n\r", ch);
   else if (ch->race <= 14)
      send_to_char ("a Apprentice.\n\r", ch);
   else if (ch->race <= 19)
      send_to_char ("a Scout.\n\r", ch);
   else if (ch->race <= 24)
      send_to_char ("a Soldier.\n\r", ch);
   else if (ch->race <= 29)
      send_to_char ("a Lieutenant.\n\r", ch);
   else if (ch->race <= 34)
      send_to_char ("a Captain.\n\r", ch);
   else if (ch->race <= 39)
      send_to_char ("a Major.\n\r", ch);
   else if (ch->race <= 44)
      send_to_char ("a General.\n\r", ch);
   else if (ch->race <= 49)
      send_to_char ("a Knight.\n\r", ch);

   else if ((ch->race <= 54) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Lady.\n\r", ch);
   else if ((ch->race <= 54) && (ch->sex == SEX_MALE))
      send_to_char ("a Lord.\n\r", ch);
   else if ((ch->race <= 59) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Baroness.\n\r", ch);
   else if ((ch->race <= 59) && (ch->sex == SEX_MALE))
      send_to_char ("a Baron.\n\r", ch);
   else if ((ch->race <= 64) && (ch->sex == SEX_FEMALE))
      stc ("a Viscountess.\n\r", ch);
   else if ((ch->race <= 64) && (ch->sex == SEX_MALE))
      stc ("a Viscount.\n\r", ch);
   else if ((ch->race <= 69) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Countess.\n\r", ch);
   else if ((ch->race <= 69) && (ch->sex == SEX_MALE))
      send_to_char ("an Earl.\n\r", ch);
   else if ((ch->race <= 74) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Duchess.\n\r", ch);
   else if ((ch->race <= 74) && (ch->sex == SEX_MALE))
      send_to_char ("a Duke.\n\r", ch);
   else if ((ch->race <= 79) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Princess.\n\r", ch);
   else if ((ch->race <= 79) && (ch->sex == SEX_MALE))
      send_to_char ("a Prince.\n\r", ch);
   else if ((ch->race >= 80) && (ch->sex == SEX_FEMALE))
      send_to_char ("a Queen.\n\r", ch);
   else if ((ch->race >= 80) && (ch->sex == SEX_MALE))
      stc ("a King.\n\r", ch);

   if (!IS_NPC (ch) && (get_hours (ch) < 6))
   {
      sprintf (buf, " #wYou receive Newbie Experience.\n\r");
      stc (buf, ch);
   }
   else if (!IS_NPC (ch) && (get_hours (ch) < 10)
	    && !IS_SET (ch->extra2, PKREADY))
   {
      sprintf (buf, " #wYou are safe from Player Killing.\n\r");
      stc (buf, ch);
   }
   if (!IS_NPC (ch))
   {
      if (strlen (ch->pcdata->decapped) > 3)
      {
	 sprintf (buf, " #wLast Decap: #n%s.\n\r", ch->pcdata->decapped);
	 stc (buf, ch);
      }
      if (strlen (ch->pcdata->decappedby) > 3)
      {
	 sprintf (buf, " #wLast Decapped by:#n %s.\n\r",
		  ch->pcdata->decappedby);
	 stc (buf, ch);
      }

   }

   if (!IS_NPC (ch) && ch->lstatus > 0)
   {
      sprintf (buf, " #wLegend Status:#n %d.", ch->lstatus);
      send_to_char (buf, ch);
   }


   if (!IS_NPC (ch))
   {
      chtier = ch->tier;
      chtierexp = ch->tierxp;

      percent = (chtierexp / (chtier * 100000.00)) * 100.00;
      nexttier = (ch->tier + 1);
      sprintf (buf, " #wTier Level:#n %d.", ch->tier);
      stc (buf, ch);
      if (nexttier > 250)
	 nexttier = 250;
      if (ch->tier < 250)
      {
	 sprintf (buf, "  %d%% of the way to be Tier %d.  \n\r", percent,
		  nexttier);
	 stc (buf, ch);
      }
   }

   if (ch->fight_timer > 0)
   {
      sprintf (buf, " #wFight Timer:#n %d seconds remaining.\n\r",
	       ch->fight_timer);
      send_to_char (buf, ch);
   }

   if (ch->class != 0 && ch->pcdata->gpoints > 0)
   {
      sprintf (buf, " #wGeneration Points: #n%d.\n\r", ch->pcdata->gpoints);
      stc (buf, ch);
   }
   if (ch->paradox[1] > 0)
   {
      sprintf (buf, " #wParadox Points:#n %d.\n\r", ch->paradox[1]);
      stc (buf, ch);
   }

   divide7_to_char (ch);

   if (!IS_NPC (ch))
   {
      sprintf (buf, " #wMob Kills:#n %d.  #wMob Deaths:#n %d.", ch->mkill,
	       ch->mdeath);
      send_to_char (buf, ch);
      sprintf (buf, " #wPlayer Kills:#n %d.  #wPlayer Deaths:#n %d.\n\r",
	       ch->pkill, ch->pdeath);
      send_to_char (buf, ch);
      sprintf (buf,
               "#w AQuests Completed:#n %d.  #wAQuests Failed: #n%d.\n\r",
               ch->questcomp,
               ch->questfail);
      stc (buf, ch);
      sprintf (buf,
               "#w Quests Completed:#n %lli.  #wEarned Questpoints: #n%lli.\n\r",
	       ch->pcdata->score[SCORE_NUM_QUEST],
	       ch->pcdata->score[SCORE_QUEST]);
      stc (buf, ch);

   }

   if (!IS_NPC (ch))
   {
      if (IS_CLASS (ch, CLASS_WEREWOLF)
	  && ch->pcdata->powers[WPOWER_SILVER] > 0)
      {
	 sprintf (buf, " #wSilver Tolerance:#n %d.  ",
		  ch->pcdata->powers[WPOWER_SILVER]);
	 send_to_char (buf, ch);
      }
      if (IS_CLASS (ch, CLASS_WEREWOLF))
      {
	 sprintf (buf, " #wGnosis:#n %d/%d\n\r", ch->gnosis[GCURRENT],
		  ch->gnosis[GMAXIMUM]);
	 send_to_char (buf, ch);
      }
      if (!IS_NPC (ch) && IS_CLASS (ch, CLASS_MONK))
      {
	 divide7_to_char (ch);
	 sprintf (buf,
		  "#w Block counter:#n %d.  #wCurrent Chi:#n %d.  #wMaximum Chi:#n %d. \n\r",
		  ch->monkblock, ch->chi[CURRENT], ch->chi[MAXIMUM]);
	 stc (buf, ch);

      }
      if (IS_CLASS (ch, CLASS_DRAGON))
      {
	 sprintf (buf,
		  " #wDragon Age: #nAffecting Hitroll and Damroll by +%d.\n\r",
                  GET_AGE(ch) * 20);
	 send_to_char (buf, ch);
      }
      if (IS_CLASS (ch, CLASS_NINJA))
      {
	 sprintf (buf, " #wKI:#n %d/150.\n\r", ch->pcdata->powers[NINJAKI]);
	 stc (buf, ch);
      }
      if (IS_CLASS (ch, CLASS_VAMPIRE) && ch->pcdata->stats[UNI_RAGE] > 0)
      {
	 sprintf (buf,
		  " #wBeasting:#n  Affecting Hitroll and Damroll by +%d.\n\r",
		  ch->pcdata->stats[UNI_RAGE]);
	 send_to_char (buf, ch);
      }
      else if (IS_SET (ch->special, SPC_WOLFMAN)
	       && ch->pcdata->stats[UNI_RAGE] > 0)
      {
	 sprintf (buf,
		  " #wWolf Rage:#n  Affecting Hitroll and Damroll by +%d.\n\r",
		  ch->pcdata->stats[UNI_RAGE]);
	 send_to_char (buf, ch);
      }
      else if (IS_CLASS (ch, CLASS_NINJA) && ch->pcdata->stats[UNI_RAGE] > 0)
      {
	 sprintf (buf,
		  " #wMichi:#n Affecting Hitroll and Damroll by +%d.\n\r",
		  ch->pcdata->stats[UNI_RAGE]);
	 send_to_char (buf, ch);
      }
      else if (IS_CLASS (ch, CLASS_DEMON)
	       && ch->pcdata->stats[DEMON_POWER] > 0)
      {
	 int bonus =
	    (ch->pcdata->stats[DEMON_POWER] *
	     ch->pcdata->stats[DEMON_POWER] << 1);

	 sprintf (buf,
		  " #wDemonic EQ:#n Affects Hitroll and Damroll by +%d.\n\r",
		  bonus);

	 send_to_char (buf, ch);
      }
   }
   divide8_to_char (ch);

   return;
}

/*
char *const day_name[] = {
   "the Moon", "the Bull", "Reaping", "Thunder", "Freedom",
   "the Great Gods", "the Master"
};

char *const month_name[] = {
   "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces",
   "the Grand Struggle", "the Spring", "Nature", "The Great Mistress",
   "the Dragon",
   "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows",
   "the Long Shadows", "the Ancient Darkness", "the Great Evil"
};
*/
char *const day_name[] = {
   "Friday", "Saturday", "Sunday", "Monday",
   "Tuesday", "Wednesday", "Thursday"
};

char *const month_name[] = {
   "January", "February", "March", "April",
   "May", "June", "July", "August", "September",
   "October", "November", "December"
};
void do_gtime (CHAR_DATA * ch, char *argument)
{
   extern int bootcount;
   extern int doublecount;
   extern int nosafecount;
   char buf[MSL];

   stc ("Game Flags:\n\r\n\r", ch);

   sprintf (buf, "Double Counter  : %d\n\r", doublecount);
   stc (buf, ch);
   sprintf (buf, "No Safe Counter : %d\n\r", nosafecount);
   stc (buf, ch);
   sprintf (buf, "Reboot Counter  : %d\n\r", bootcount);
   stc (buf, ch);
   sprintf (buf, "Exp Modifier    : %d  for %d Minutes\n\r",
	    WizConfig->xpbonus, WizConfig->xptimer);
   stc (buf, ch);
   sprintf (buf, "Qp Modifier     : %d  for %d Minutes\n\r",
	    WizConfig->qpbonus, WizConfig->qptimer);
   stc (buf, ch);
   return;
}

void do_timer (CHAR_DATA * ch, char *argument)
{
   char buf[MSL];

    int hour;
    int min;
    int sec;
    int total;
  
    total = ch->pcdata->get_exp;
 
    hour = ((total / 3600) % 24);
    min = ((total / 60) % 60);
    sec = (total % 60);

   stc ("The timers you currently have on you:\n\r\n\r", ch);

   if (ch->pcdata->login_timer > 0)
   {
      sprintf (buf, "  Login Timer		: %d\n\r",
	       ch->pcdata->login_timer);
      stc (buf, ch);
   }
   else
      stc ("  Login Timer		: CLEAR\n\r", ch);

   if (ch->fight_timer > 0)
   {
      sprintf (buf, "  Fight Timer		: %d\n\r", ch->fight_timer);
      stc (buf, ch);
   }
   else
      stc ("  Fight Timer		: CLEAR\n\r", ch);

   if (ch->pcdata->pkill_timer > 0)
   {
      sprintf (buf, "  PK Timer		: %d\n\r", ch->pcdata->pkill_timer);
      stc (buf, ch);
   }
   else
      stc ("  PK Timer		: CLEAR\n\r", ch);

   if (ch->arena_timer > 0)
   {
      sprintf (buf, "  Arena Timer		: %d\n\r", ch->arena_timer);
      stc (buf, ch);
   }
   else
      stc ("  Arena Timer		: CLEAR\n\r", ch);

   if (ch->pcdata->schallenge > 0)
   {
      sprintf (buf,
	       "  Status Challenge Timer: %d\n\r", ch->pcdata->schallenge);
      stc (buf, ch);
   }
   else
      stc ("  Status Challenge Timer: CLEAR\n\r", ch);

   if (ch->pcdata->jailed > 0)
   {
      stcprintf (ch,
		 "  Jailed		: %s.\n\r",
		 get_time (ch->pcdata->jailed));

   }
   if (ch->pcdata->silenced > 0)
   {
      stcprintf (ch,
		 "  Silenced		: %s.\n\r",
		 get_time ((ch->pcdata->silenced - current_time)));
   }

/*
   if (ch->pcdata->get_exp <= 0)
   {
      stc("  Generation Point      : You have earned your gen point.  Login after midnight. (Server time)\n\r",ch);
   }
   else
        sprintf(buf,"  Generation Point        : You will earn your generation point in %d minutes and %d seconds.\n\r",  min, sec); 
    send_to_char(buf,ch);
*/

/*
	stc("\n\rGame Timers:\n\r\n\r", ch);

	if (pulse_arena > 1)
	{
		sprintf(buf, "  Next War		: %d hour(s) and %d minute(s).\n\r", 
pulse_arena / 60, pulse_arena - (pulse_arena / 60) * 60);
		send_to_char(buf, ch);
	}
	if (WizConfig->modtimer > 1)
	{
		sprintf(buf, "  Next XP/QP Modifer	: %d hour(s) and %d minute(s).\n\r", WizConfig->modtimer / 60, WizConfig->modtimer - (WizConfig->modtimer / 60) * 60);
		stc(buf, ch);
	}
	return;
*/

}
char *get_time (int secs)
{
   static char time[4096];
   int temp, days, hours, minutes, seconds;

   time[0] = '\0';
   

   temp = secs;
    days    = (temp / 86400);
    hours   = ((temp / 3600) % 24);
    minutes = ((temp / 60) % 60);
    seconds = ((temp ) % 60);

   if (days > 0)
   {  
      sprintf (time, "#r%d #cday%s, #r%d #chour%s, #r%d#c minute%s#c and #r%d#c second%s.", 
                 days, days == 1 ? "" : "s",
               hours, hours == 1 ? "" : "s", minutes, minutes == 1 ? "" : "s",
               seconds, seconds == 1 ? "" : "s");
   }
   else if (hours > 0)
   {  
      sprintf (time, "#r%d #chour%s, #r%d#c minute%s#c and #r%d#c second%s.",
               hours, hours == 1 ? "" : "s", minutes, minutes == 1 ? "" : "s",
               seconds, seconds == 1 ? "" : "s");
   }
   else if (minutes > 0)
   {
      sprintf (time, "#r%d#c minute%s #cand #r%d#c second%s.", minutes,
               minutes == 1 ? "" : "s", seconds, seconds == 1 ? "" : "s");
   }
   else
   {
      sprintf (time, "#r%d #wsecond%s.", seconds, seconds == 1 ? "" : "s");
   }
   return time;
    
}
void do_time (CHAR_DATA * ch, char *argument)
{
  extern int bootcount;
  extern int copycount;
  extern time_t boot_time;
  extern time_t hboot_time;
  extern char str_boot_time[];
  extern char copy_time[];
  char buf[MAX_STRING_LENGTH];
  char boot[MAX_STRING_LENGTH];
  char tboot[MAX_STRING_LENGTH];
  char *suf;
  int day;
  
   int weekday;
      
  int days;
  int hours; 
  int minutes;
  int seconds;
  int tdays;
  int thours;
  int tminutes;
  int tseconds;
  int uptime;
  int tuptime;
  uptime = (int) (current_time - boot_time);
  tuptime = (int) (current_time - hboot_time);
  days = (uptime / 86400);
  hours = ((uptime / 3600) % 24);
  minutes = ((uptime / 60) % 60);
  seconds = (uptime % 60);
  tdays = (tuptime / 86400);
  thours = ((tuptime / 3600) % 24);
  tminutes = ((tuptime / 60) % 60);
  tseconds = (tuptime % 60);  
  
   day = time_info.day + 1;   
   weekday = time_info.daylist % 7;

   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";
   if (days > 0)
   {
      sprintf (boot,   
               "#r%d#e day%s, #r%d#e hour%s, #r%d#e minute%s, #r%d#e second%s ago",
               days, days == 1 ? "" : "s", hours, hours == 1 ? "" : "s",
               minutes, minutes == 1 ? "" : "s", seconds,
               seconds == 1 ? "" : "s");
   }
   else if (hours > 0)
   {
      sprintf (boot,
               "#r%d#e hour%s, #r%d#e minute%s, #r%d#e second%s ago",
               hours, hours == 1 ? "" : "s", minutes,
               minutes == 1 ? "" : "s", seconds, seconds == 1 ? "" : "s");   
   }
   else if (minutes > 0)
   {
      
      sprintf (boot,
               "#r%d#e minute%s, #r%d#e second%s ago", minutes,
               minutes == 1 ? "" : "s", seconds, seconds == 1 ? "" : "s");
   }
   else
   {
      sprintf (boot, "#r%d#e second%s ago", seconds, seconds == 1 ? "" : "s");
   }
   if (tdays > 0)
   {
      sprintf (tboot,
               "#r%d#e day%s, #r%d#e hour%s, #r%d#e minute%s, #r%d#e second%s ago",
               tdays, tdays == 1 ? "" : "s", thours, thours == 1 ? "" : "s",
               tminutes, tminutes == 1 ? "" : "s", tseconds,
               tseconds == 1 ? "" : "s");
   }
   else if (thours > 0)
   {
      sprintf (tboot,
               "#r%d#e hour%s, #r%d#e minute%s, #r%d#e second%s ago",
               thours, thours == 1 ? "" : "s", tminutes,
               tminutes == 1 ? "" : "s", tseconds, tseconds == 1 ? "" : "s");
   }
   else if (tminutes > 0)
   {
      sprintf (tboot,
               "#r%d#e minute%s, #r%d#e second%s ago", tminutes,
               tminutes == 1 ? "" : "s", tseconds, tseconds == 1 ? "" : "s");
   }
   else
   {
      sprintf (tboot,
               "#r%d#e second%s ago", tseconds, tseconds == 1 ? "" : "s");
   }

   loc_to_char (ch);
   sprintf (buf,
            "#wIt is #y%d:%2.2d %s#w, #y%s#w, #y%d%s %s %d#w.",
	    (time_info.hour % 12 == 0) ? 12 : time_info.hour % 12,
            59 - (pulse_weather / (PULSE_WEATHER / 60)),
	    time_info.hour >= 12 ? "pm" : "am", day_name[weekday], day, suf,
	    month_name[time_info.month], time_info.year);
   cent_to_char (buf, ch);

  sprintf (buf, "#wLast Startup: #y%s (%s#y)", str_boot_time,//datestring (str_boot_time),
            tboot);
   cent_to_char (buf, ch);
   sprintf (buf, "#wLast Copyover: #y%s (%s#y)", copy_time, //datestring (copy_time),
            boot);
   cent_to_char (buf, ch);
   sprintf (buf, "#wSystem Time: #y%s#n", new_date (current_time));
   cent_to_char (buf, ch);
   if (bootcount > 0)
    {
        sprintf(buf, "#wThe Mud will reboot in %s", get_time(bootcount));
        cent_to_char(buf, ch);
    }
    if (copycount > 0)
    {
        sprintf(buf, "#wThe Mud will copyover in %s", get_time(copycount));
        cent_to_char(buf, ch);
    }
   if (WizConfig->xpbonus > 1)
      cent_to_char
	 ("#wThe Exp Multiplier is #rON!.#w (Check statistics for info)", ch);
   divide7_to_char (ch);
   return;
}

void do_phase (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];
   int moonphase;
   char waning[MSL];

   if (weather_info.moonphase >= MOON_WANING)
   {
      moonphase = weather_info.moonphase - MOON_WANING;
      sprintf (waning, "waning");
   }
   else
   {
      moonphase = weather_info.moonphase;
      sprintf (waning, "waxing");
   }
/*   
 * Werewolves can sense the moonphases anytime
 */
   if (!IS_OUTSIDE (ch) && !IS_CLASS (ch, CLASS_WEREWOLF)
       && !IS_IMMORTAL (ch))
   {
      send_to_char ("You can't see the moon indoors.\n\r", ch);
      return;
   }

   if (weather_info.moonlight == MOON_DOWN && !IS_CLASS (ch, CLASS_WEREWOLF) && !IS_IMMORTAL(ch))
   {
      send_to_char ("The moon is not up.\n\r", ch);
      return;
   }

   switch (moonphase)
   {
   default:
      sprintf (buf, "Bug, please inform an implementor.\n\r");
      break;
   case MOON_NEW:
      sprintf (buf, "The moon is new.\n\r");
      break;
   case MOON_CRESCENT:
      sprintf (buf, "The %s moon is crescent.\n\r", waning);
      break;
   case MOON_HALF:
      if (weather_info.moonphase >= MOON_WANING)
	 sprintf (buf, "The moon is in its last quarter.\n\r");
      else
	 sprintf (buf, "The moon is in its first quarter.\n\r");
      break;
   case MOON_GIBBOUS:
      sprintf (buf, "The %s moon is gibbous.\n\r", waning);
      break;
   case MOON_FULL:
      sprintf (buf, "The moon is full.\n\r");
      break;
   }
   stc (buf, ch);
}


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

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

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

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

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

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

   sprintf (buf, "The sky is %s and %s.\n\r", sky_look[weather_info.sky],
	    weather_info.change >=
	    0 ? "a warm southerly breeze blows" :
	    "a cold northern gust blows");
   send_to_char (buf, ch);
   return;
}
void text_bar (CHAR_DATA * ch, char *argument)
{
   char bar_buf[MAX_INPUT_LENGTH];	/* Buffer to store text bar */
   int text_length = strlen (argument);	/* Length of the text */
   int word_start;		/* Start of text word */
   int loop;			/* Loop counter */

   word_start = 37 - ((text_length + 1) >> 1);	/* Initialise word start */

   /* If the text is too big, just display it as is */
   if (text_length > 70)
   {
      send_to_char (argument, ch);
      send_to_char ("\n\r", ch);
      return;
   }

   sprintf (bar_buf, "#y-#w%s#y", capitalize (ch->name));
   /* Set the left half of the bar to spaces */
   for (loop = strlen (bar_buf); loop < word_start; loop++)
   {
      bar_buf[loop] = '-';
   }
   /* Terminate the bar string so that strcat can be used to add the word */
   bar_buf[word_start] = '\0';

   strcat (bar_buf, "#r[#n ");
   strcat (bar_buf, argument);
   strcat (bar_buf, " #r]");

   for (loop = strlen (bar_buf) - 1; loop < SCREEN_WIDTH - 10; loop++)
      strcat (bar_buf, "#y-#w");

//    strcat( bar_buf, short_date());
   strcat (bar_buf, "#y-");
   strcat (bar_buf, "\n\r");

   /* Display the text bar */
   send_to_char (bar_buf, ch);

   return;
}
void line_text (CHAR_DATA * ch, char *text, int length)
{
   int number, line_length;

   if (ch == NULL)
      return;

   if (length <= 0)
      length = SCREEN_WIDTH;

   if (col_str_len (text) > length - 6)
   {
//  bugf( "Line_text - text too long!" );
      page_to_char (text, ch);
      page_to_char ("\n\r", ch);
      return;
   }

   line_length = ((length - col_str_len (text)) / 2) - 2;

   for (number = 0; number < line_length; number++)
      stc ("#C-", ch);

   page_to_char ("#w[#y ", ch);
   page_to_char (text, ch);
   page_to_char (" #w]", ch);

   for (number = 0; number < line_length; number++)
      page_to_char ("#C-", ch);

   page_to_char ("#n\n\r", ch);
   return;
}
void line_text2 (CHAR_DATA * ch, char *text, int length)
{
   int number, line_length;

   if (ch == NULL)
      return;

   if (length <= 0)
      length = SCREEN_WIDTH;

   if (strlen (text) > length - 6)
   {
//  bugf( "Line_text - text too long!" );
      page_to_char (text, ch);
      page_to_char ("\n\r", ch);
      return;
   }

   line_length = ((length - strlen (text)) / 2) - 2;

   for (number = 0; number < line_length; number++)
      stc ("#R-", ch);

   page_to_char ("#w[#y ", ch);
   page_to_char (text, ch);
   page_to_char (" #w]", ch);

   for (number = 0; number < line_length; number++)
      page_to_char ("#C-", ch);

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

void similar_help_files (CHAR_DATA * ch, char *argument)
{
   HELP_DATA *pHelp = NULL;
   char buf[MAX_STRING_LENGTH];
   char *extension;
   sh_int lvl = 0;
   bool single = FALSE;

   send_to_char ("#wSimilar Help Files:\n\r", ch);

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

      if (pHelp->level > get_trust (ch))
	 continue;

      while (extension[0] != '\0')
      {
	 extension = one_argument (extension, buf);

	 if (str_similar (argument, buf) > lvl)
	 {
	    lvl = str_similar (argument, buf);
	    single = TRUE;
	 }
	 else if (str_similar (argument, buf) == lvl && lvl > 0)
	 {
	    single = FALSE;
	 }
      }
   }
   if (lvl == 0)
   {
      send_to_char ("#wNo similar help files.\n\r", ch);
      return;
   }

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

	 if (str_similar (argument, buf) >= lvl
	     && pHelp->level <= get_trust (ch))
	 {
	    if (single)
	    {
	       send_to_char ("#cOpening only similar helpfile.\n\r", ch);
	       do_help (ch, buf);
	       return;
	    }

	    stcprintf (ch, "'help %s'\n\r", pHelp->keyword);
	    break;

	 }

      }
   }
   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 (argument[0] == '\0')
      argument = "summary";
      
   if (isdigit (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 (ch == NULL)
      {
         if (pHelp->level > LEVEL_AVATAR)
            continue;
      }
      else if (pHelp->level > get_trust (ch))
         continue;
      
      if (lev != -2 && pHelp->level != lev)
         continue;
      if (is_name (argall, pHelp->keyword))
         return pHelp;
   }
   for (pHelp = help_first; pHelp; pHelp = pHelp->next)
   {
      if (ch == NULL)
      {
         if (pHelp->level > LEVEL_AVATAR)
            continue;
      }
      else if (pHelp->level > get_trust (ch))
         continue;
      
      if (lev != -2 && pHelp->level != lev)
         continue;
      if (is_abbr (argall, pHelp->keyword))
         return pHelp;
   }
    
   return NULL;
}
void do_help (CHAR_DATA * ch, char *argument) 
{
//   char buf[MAX_STRING_LENGTH];
   HELP_DATA *pHelp;
     char UPPER_TEXT[500];
      int loop_var = 0;

   if (!str_cmp(argument, "clan"))
   {
     do_clanindex(ch, "");
     return;
   }
   
   if ((pHelp = get_help (ch, argument)) == NULL)
   { 
      if (!check_help_soundex (argument, ch))   
      {
         printf_to_char (ch, "%s\n\n\r",
                         generate_banner ("Nothing Found", 56, "#C"));
        printf_to_char (ch,
                         " There is no helpfile by the name of '#7%s#n'.\n\r",
                         argument);
         printf_to_char (ch,
                         " Perhaps you should try the #7search#n command.\n\r");
         printf_to_char (ch, "\n\r%s\n\r", generate_banner ("", 56, "#C"));
      }
      /* what help files does newbies want ? */
      if ((get_age (ch) - 17) < 2)
      {
         sprintf (log_buf, "%s : could not find HELP on : %s", ch->name, argument);   
         wiznet (ch, WIZ_HELPS, get_trust (ch), log_buf);
         log_string_sil (log_buf);
      }
      return;
   }
   
      sprintf (UPPER_TEXT, pHelp->keyword);   
      for (;;)
      {
         if (strlen (UPPER_TEXT) < 2)
            break;  
         if (loop_var > strlen (UPPER_TEXT))
            break;
         if (UPPER_TEXT[loop_var] == '\0')
            break;
         UPPER_TEXT[loop_var] = UPPER (UPPER_TEXT[loop_var]);
         loop_var++;
      }
    if (pHelp->level >= 0 && str_cmp (argument, "imotd"))
//   if (pHelp->level >= 0)
      printf_to_char (ch, "#G%s\n\r",
                      generate_banner (UPPER_TEXT, 80, "#C"));
   /*
    * Strip leading '.' to allow initial blanks.
    */
   if (pHelp->text[0] == '.')
      send_to_char (pHelp->text + 1, ch);
   else
      send_to_char (pHelp->text, ch);
      
    if (pHelp->level >= 0 && str_cmp (argument, "imotd"))
//   if (pHelp->level >= 0)
   printf_to_char (ch, "\n\r%s\n\r", generate_banner ("", 80, "#C"));
}
void do_search (CHAR_DATA * ch, char *argument)
{
   HELP_DATA *pHelp;
   char buf[MAX_STRING_LENGTH];
   char arg[MAX_INPUT_LENGTH];
   char keyword[MAX_INPUT_LENGTH];
   char *str;
   bool found = FALSE;
   int i = 0;
          
   one_argument (argument, arg);
   if (arg[0] == '\0')
   {
      send_to_char ("What kind of helpfiles are you searching for?\n\r", ch);
      return;
   }
          
   buf[0] = '\0';
   sprintf (buf + strlen (buf), "%s\n\r",
            generate_banner ("Search Results", 80, "#C"));
sprintf (buf + strlen (buf),
            " The following helpfile entries are the results when searching for\n\r");
   sprintf (buf + strlen (buf),
            " the keyword '#7%s#n'. There may still exist helpfiles on the subject\n\r",
            arg);
   sprintf (buf + strlen (buf),
            " which were not found with this search tool.\n\n\r");
      
   for (pHelp = help_first; pHelp; pHelp = pHelp->next)
   {
      char UPPER_TEXT[500];
      bool match = FALSE;
      int loop_var = 0;
      str = pHelp->keyword;
      str = one_argument (str, keyword);
      if (pHelp->level > ch->level)
         continue;
   
      if (SoundexMatch (GetSoundexKey (arg), GetSoundexKey (keyword)) > 75)
         match = TRUE;
      else   
      {   
         while (keyword[0] != '\0')
         {
            if (!str_prefix (arg, keyword))
            {
               match = TRUE;
               break;
            }
            str = one_argument (str, keyword);
         }
      }
     sprintf (UPPER_TEXT, keyword);
      for (;;)
      {
         if (strlen (UPPER_TEXT) < 2)
            break;
         if (loop_var > strlen (UPPER_TEXT))
            break;
         if (UPPER_TEXT[loop_var] == '\0')
            break;
         UPPER_TEXT[loop_var] = UPPER (UPPER_TEXT[loop_var]);
         loop_var++;
      }
   
      if (match)
      {
         found = TRUE;
         sprintf (buf + strlen (buf), "  %-22.22s%s", keyword,
                  (++i % 3) ? "  " : "\n\r");
      }
   }
   
   if (!found)
      sprintf (buf + strlen (buf), "  Nothing found...\n\r");
      
   sprintf (buf + strlen (buf), "%s\n\r%s\n\r", (i % 3) ? "\n" : "",
            generate_banner ("", 80, "#C"));
   send_to_char (buf, ch);
}

void do_ohelp (CHAR_DATA * ch, char *argument)
{
   char argall[MAX_INPUT_LENGTH];
   char argone[MAX_INPUT_LENGTH];
   HELP_DATA *pHelp;
   char buf[MSL];

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

   /*
    * 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 != NULL; pHelp = pHelp->next)
   {
      char UPPER_TEXT[500];
      int loop_var = 0;
      if (pHelp->level > get_trust (ch))
	 continue;

      sprintf (UPPER_TEXT, pHelp->keyword);
      for (;;)
      {
	 if (strlen (UPPER_TEXT) < 2)
	    break;
	 if (loop_var > strlen (UPPER_TEXT))
	    break;
	 if (UPPER_TEXT[loop_var] == '\0')
	    break;
	 UPPER_TEXT[loop_var] = UPPER (UPPER_TEXT[loop_var]);
	 loop_var++;
      }
      if (is_name (argall, pHelp->keyword))
      {
	 if (pHelp->level >= 0 && str_cmp (argall, "imotd"))

	 {
	    sprintf (buf, "#w%s#n", UPPER_TEXT);
	    line_text (ch, buf, 80);
	 }

	 /*
	  * Strip leading '.' to allow initial blanks.
	  */

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

	 return;
      }
   }
   for (pHelp = help_first; pHelp != NULL; pHelp = pHelp->next)
   {
      char UPPER_TEXT[500];
      int loop_var = 0;

      if (pHelp->level > get_trust (ch))
	 continue;

      sprintf (UPPER_TEXT, pHelp->keyword);
      for (;;)
      {
	 if (strlen (UPPER_TEXT) < 2)
	    break;
	 if (loop_var > strlen (UPPER_TEXT))
	    break;
	 if (UPPER_TEXT[loop_var] == '\0')
	    break;
	 UPPER_TEXT[loop_var] = UPPER (UPPER_TEXT[loop_var]);
	 loop_var++;
      }
      if (is_abbr (argall, pHelp->keyword))
      {
	 if (pHelp->level >= 0 && str_cmp (argall, "imotd"))
	 {
	    sprintf (buf, "#w%s#n", UPPER_TEXT);
	    line_text (ch, buf, 80);
	 }

	 /*
	  * Strip leading '.' to allow initial blanks.
	  */

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

	 return;
      }
   }
   sprintf (log_buf, "%s : could not find HELP on : %s", ch->name, argone);
   wiznet (ch, WIZ_HELPS, get_trust (ch), log_buf);
   log_string_sil (log_buf);
   pager_printf (ch, "#cNo help is available on '#w%s#c'.#n\n\r", argone);
   //similar_help_files(ch, argone);
   check_help_soundex (argone, ch);
   return;
}
void do_linkdead (CHAR_DATA * ch, char *argument)
{
   char titbuf[MSL];
   CHAR_DATA *gch;
   char buf[MAX_STRING_LENGTH];
   bool found = FALSE;
   int col = 0;

   sprintf (titbuf, "#yL I N K D E A D");
   line_text (ch, titbuf, 80);
   for (gch = char_list; gch != NULL; gch = gch->next)
   {
      if (IS_NPC (gch) || gch->desc)
	 continue;
      found = TRUE;
      sprintf (buf, "#w%12s#n", gch->name);;
      send_to_char (buf, ch);
      if (++col % 6 == 0)
	 send_to_char ("\n\r", ch);

   }
   if (col % 6 != 0)
      send_to_char ("\n\r", ch);
   stc ("#R-------------------------------------------------------------------------------#n\n\r", ch);

   if (!found)
      send_to_char ("#wNo players are currently linkdead.#n\n\r", ch);
   else
      stcprintf (ch, "#wThere are #r%d#w players currently linkdead.#n\n\r",
		 col);
   stc ("#R-------------------------------------------------------------------------------#n\n\r", ch);
   return;
}
char *mult_time (int count)
{
   char *time;
   static char buf[MAX_STRING_LENGTH];

   if (count >= ((PULSE_PER_SECOND * 60) * 60) * 24)
   {
      count /= ((PULSE_PER_SECOND * 60) * 60) * 24;
      time = "Day";
   }
   else if (count >= ((PULSE_PER_SECOND * 60) * 60))
   {
      count /= (PULSE_PER_SECOND * 60) * 60;
      time = "Hour";
   }
   else if (count >= (PULSE_PER_SECOND * 60))
   {
      count /= (PULSE_PER_SECOND * 60);
      time = "Minute";
   }
   else
   {
      count /= PULSE_PER_SECOND;
      time = "Second";
   }

   sprintf (buf, "#w[#y%d] %s%s#n", count, time, (count > 1) ? "s" : "");
   return buf;
}

/*
 * New 'who' command originally by Alander of Rivers of Mud.
 */
void do_who (CHAR_DATA * ch, char *argument)
{
   extern int total_number_login;
   extern int high_number_login;
   char BSD[MSL];
   char newbie[MSL];
   char slbuf[MSL];
   char sbuf[MSL];
   char lbuf[MSL];
   char buf[MAX_STRING_LENGTH];
   char buf3[MAX_STRING_LENGTH];
   char xpbonus[MAX_STRING_LENGTH];
   char qpbonus[MAX_STRING_LENGTH];
   char mort[MAX_STRING_LENGTH];
   char avat[MAX_STRING_LENGTH];
   char arg[MAX_STRING_LENGTH];
   char arg2[MAX_STRING_LENGTH];
   char a1[MSL];
   char a2[MSL];
   char a3[MSL];
   char a4[MSL];
   char a5[MSL];
   char a6[MSL];
   char a7[MSL];
   char a0[MSL];
   char immo[MAX_STRING_LENGTH];
   char kav[MAX_STRING_LENGTH];
   char prefix[MAX_STRING_LENGTH];
//   char king[MAX_STRING_LENGTH];
   char wizi[MAX_STRING_LENGTH];
   char incog[MSL];
   char invisi[MSL];
   char openb[5];
   char namething[MSL];
//   char immnamething[MSL];
   char closeb[5];
   DESCRIPTOR_DATA *d;
   int iLevelLower;
   int iLevelUpper;
   int nNumber;
   int nMatch;
   int immMatch;

   int nTotal;
   int nInvis;
   int mor, ava, imm;
   bool fClassRestrict;
   bool fImmortalOnly;
   bool isName = FALSE;
   bool ftalk;
   int loop = 0;

   smash_tilde (argument);

   one_argument (argument, arg);

   if (arg[0] != '\0')
   {
      sprintf (arg2, "|%s*", argument);
      while (arg2[loop++] != '\0')
      {
	 if (arg2[loop] == ' ')
	    arg2[loop] = '*';
      }
   }
   if (IS_NPC (ch))
      return;

   if (!str_cmp (arg, "status"))
   {
      status_who (ch);
      return;
   }
   if (!str_cmp (arg, "linkdead") && IS_IMMORTAL (ch))
   {
      do_linkdead (ch, "");
      return;
   }

   if (!str_cmp (arg, "ftalk")
       && (IS_SET (ch->more, MORE_FTALK2) || IS_CREATOR (ch)))
   {
      ftalk_who (ch);
      return;
   }

   /*
    * Set default arguments.
    */
   iLevelLower = 0;
   iLevelUpper = MAX_LEVEL + 2;
   fClassRestrict = FALSE;
   fImmortalOnly = FALSE;
   isName = FALSE;
   ftalk = FALSE;

   /*
    * Parse arguments.
    */

   nNumber = 0;
   for (;;)
   {
      char arg[MAX_STRING_LENGTH];

      argument = one_argument (argument, arg);
      if (arg[0] == '\0')
	 break;

      if (is_number (arg))
      {
	 send_to_char
	    ("Enter 'Avatar' for level 3's, or 'God' for level 4's and 5's.\n\r",
	     ch);
	 return;
      }
      else
      {
	 /*
	  * Look for classes to turn on.
	  */
	 arg[3] = '\0';
	 if (!str_cmp (arg, "imm") || !str_cmp (arg, "immortal")
	     || !str_cmp (arg, "ava") || !str_cmp (arg, "avatar"))
	 {
	    fClassRestrict = TRUE;
	    break;
	 }

	 else if (!str_cmp (arg, "god") || !str_cmp (arg, "imp"))
	 {
	    fImmortalOnly = TRUE;
	    break;
	 }
	 else if (!str_cmp (arg, "ftalk"))
	 {
	    ftalk = TRUE;
	    break;
	 }
	 else
	 {
	    isName = TRUE;
	    break;
	 }
      }
   }

   /*
    * Now show matching chars.
    */

   nInvis = 0;
   nTotal = 0;
   nMatch = 0;
   immMatch = 0;
   buf[0] = '\0';
   mort[0] = '\0';
   avat[0] = '\0';
   immo[0] = '\0';
   a1[0] = '\0';
   a2[0] = '\0';
   a3[0] = '\0';
   a4[0] = '\0';
   a5[0] = '\0';
   a6[0] = '\0';
   a7[0] = '\0';
   a0[0] = '\0';

   mor = ava = imm = 0;
   for (d = first_descriptor; d != NULL; d = d->next)
   {
      CHAR_DATA *wch;
      char const *class;
      char const *statuslegend;
      char const *lstatus;

      /*
       * Check for match against restrictions.
       * Don't use trust as that exposes trusted mortals.
       */

      if (!IS_IMMORTAL (ch) && d->connected != CON_PLAYING)
	 continue;

      if (d->character == NULL)
	 continue;

 if (IS_IMMORTAL (d->character) && !can_see (ch, d->character))
         continue;
   
      if (!IS_IMMORTAL (d->character))
         nTotal++;
      
      if (!can_see (ch, d->character) && get_hours (ch) < 10)
         continue;
   
      wch = (d->original != NULL) ? d->original : d->character;
      if (wch->level < iLevelLower || wch->level > iLevelUpper
	  || (fImmortalOnly && wch->level < LEVEL_IMMORTAL) || (fClassRestrict
								&& wch->
								level !=
								LEVEL_HERO))
	 continue;

      if (arg2[0] != '\0' && isName && !IS_NPC (wch))
      {
	 if (!is_in (wch->name, arg2) && !is_in (wch->pcdata->title, arg2))
	    continue;
      }
      if (ftalk && !IS_NPC (wch))
      {
	 if (!IS_SET (d->character->more, MORE_FTALK2))
	    continue;
      }
      if (wch->level > 7)
	 immMatch++;
      else
	 nMatch++;

      /*
       * Figure out what to print for class.
       */
      statuslegend = " ";
      class = " ";
      lstatus = " ";
/*
      switch (wch->lstatus)
      {  
      default:
         lstatus = "#C Unknown#n";
         break;
      case 1:
         lstatus = " #GP#7e#Ga#7s#Ga#7n#Gt#n";
         break;
      case 2:
         lstatus = " #cCitizen#n";
         break;
      case 3:
         lstatus = "#oWayfarer#n";
         break;
      case 4:
         lstatus = "#yAdventurer#n";
         break;
      case 5:
         lstatus = "#PN#poble#n";  
         break;
      case 6:
         lstatus = "#oP#yrophet#n";
         break;
      case 7:
         lstatus = "#cO#Cracle#n";
         break;
      case 8:
         lstatus = "#cM#Cyt#7hi#Cca#cl#n";
         break;
      case 9:
         lstatus = "#yM#oanical#n";
         break;
      case 10:
         lstatus = "#RL#regendary#n";
         break;
      }
*/
switch (wch->lstatus)
      {   
      default:
         lstatus = "  #rU#Rnknown#n";
         break;
      case 1:
         lstatus = "  #gC#Gitizen#n";
         break;
      case 2:
         lstatus = "   #bS#bavior#n";
         break;
      case 3:
         lstatus = " #yM#oythical#n";
         break;
      case 4:
         lstatus = "#cL#Cegendary#n";  
         break;
      case 5:
         lstatus = "    #pT#Pitan#n";
         break;
      case 6:
         lstatus = " #wI#Wmmortal#n";
         break;
      case 7:
         lstatus = "   #rO#Rr#ra#Rc#rl#Re#n";
         break;
      case 8:
         lstatus = "  #bD#Be#bm#Bi#bG#Bo#bd#n";
         break;
      case 9:
         lstatus = "    #gD#Ge#gi#Gt#gy#n";
         break;
      case 10:
         lstatus = " #yA#Yl#ym#Yi#yg#Yh#yt#Yy";
         break;
      case 11:
         lstatus = "#wS#WU#wP#n";
         break;
      }
      if (wch->desc != NULL && wch->desc->connected != CON_PLAYING)
      {
	 if (wch->desc->connected == CON_NOTE_TO ||
	     wch->desc->connected == CON_NOTE_SUBJECT
	     || wch->desc->connected == CON_NOTE_EXPIRE
	     || wch->desc->connected == CON_NOTE_TEXT
	     || wch->desc->connected == CON_NOTE_FINISH)
         {
            if (IS_IMMORTAL(wch))
               class = centerjob(" ", "#wWriting Note#n", 22);
            else
	       class = "#wWriting Note#n";
         }
	 else if (wch->desc->connected > CON_PLAYING)
         {
            if (IS_IMMORTAL(wch) )
                 class = centerjob(" ","#wConnecting#n", 22);
            else 
	 class = "#wConnecting  #n";
         }
	 else if (wch->desc->connected == CON_AEDITOR
		  || wch->desc->connected == CON_REDITOR
		  || wch->desc->connected == CON_MEDITOR
		  || wch->desc->connected == CON_OEDITOR)
	    class = centerjob(" ", "#w->OLC<-#n", 22);
	 else if (wch->desc->connected == CON_HEDITOR)
	    class = centerjob(" ", "#wHelp Editor #n", 22);

      }

      else if ((IS_HEAD (wch, LOST_HEAD) || IS_EXTRA (wch, EXTRA_OSWITCH))
	       && wch->pcdata->chobj != NULL)
      {
	 if (wch->pcdata->chobj->pIndexData->vnum == 12)
	       class = "#wHead#n        ";
	 else if (wch->pcdata->chobj->pIndexData->vnum == 30005)
	       class = "#wBrain#n       ";
	 else
   	       class = "#eObject#n      ";

      }
      else if (IS_SET (wch->extra2, EXTRA2_INFECTED))
   	       class = "#pPaRaSiTe    #n";
      else if (IS_SET (wch->more, MORE_TEST))
	 class = "#wTEST-CHAR   #n#n";
      else if (IS_SET (wch->extra2, WHINER))
	 class = "#w->#r#FWHINER#n#w<- #n";
      else if (IS_SET (wch->extra2, DEMENTED))
         class = "#r-#F#wDEMENTED#n#r-#n  ";

      else if (IS_IMMORTAL (wch) && (wch->level >= LEVEL_IMMORTAL))
      {
            if (wch->prefix && str_cmp(wch->prefix,"") && str_cmp(wch->prefix,"(null)"))
                        class = centerjob(" ",wch->prefix,22);
	    else if (wch->level == (MAX_LEVEL + 2))
	       class = centerjob(" ", "OWNER#n", 22);
	    else if (wch->level == (MAX_LEVEL + 1))
	       class = centerjob(" ", "CO-OWNER#n", 22);
	    else if (wch->level == MAX_LEVEL)
	       class = centerjob(" ", "#rImplementor#n", 22);
	    else if (wch->level == (MAX_LEVEL - 1))
	       class = centerjob(" ", "#yHigh Judge", 22);
	    else if (wch->level == (MAX_LEVEL - 2))
	       class = centerjob(" ", "#gJudge#n", 22);
	    else if (wch->level == (MAX_LEVEL - 3))
	       class = centerjob(" ", "#bEnforcer#n", 22);
	    else if (wch->level == (MAX_LEVEL - 4))
	       class = centerjob(" ", "#gBuilder#n", 22);
	    else if (wch->level == (MAX_LEVEL - 5))
	       class = centerjob(" ", "#cQuest Maker#n", 22);
      }
else if (wch->level == 2)

         class = "#yM#oortal      #n";
      else if (wch->level <= 1)
         class = "#gN#Gewbie      #n";
      else if (wch->race < 1)
         class = "#wA#evatar#n      ";
      else if (wch->race < 5)
         class = "#rP#Reasant#n     ";
      else if (wch->race < 10)
         class = "#gP#Gage#n        ";
      else if (wch->race < 15)  
         class = "#yA#Ypprentice#n  ";
      else if (wch->race < 20)
         class = "#cS#Ccout#n       ";
      else if (wch->race < 25)  
         class = "#PS#eoldier#n     ";
      else if (wch->race < 30)  
         class = "#bL#Cieutenant#n  ";
      else if (wch->race < 35)
         class = "#pC#Paptain#n     ";
      else if (wch->race < 40)
         class = "#GM#gajor#n       ";
      else if (wch->race < 45)
         class = "#eG#Weneral#n     ";
      else if (wch->race < 50)
         class = "#RK#rnight#n      ";
      else if (wch->race < 55) 
      {
         if (wch->sex == SEX_FEMALE) 
            class = "#RL#oady#n        ";
         else
            class = "#RL#oord#n        ";
      }
      else if (wch->race < 60)
      {
         if (wch->sex == SEX_FEMALE)  
            class = "#yB#Yaroness#n    ";
         else
            class = "#yB#Yaron#n       ";
      }
      else if (wch->race < 65)
      {
         if (wch->sex == SEX_FEMALE)
            class = "#bV#Ciscountess#n ";
         else
            class = "#bV#Ciscount#n    ";
      }
      else if (wch->race < 70)
      {
         if (wch->sex == SEX_FEMALE)  
            class = "#wC#yountess#n    ";
         else
            class = "#wE#yarl#n        ";
      }
      else if (wch->race < 75)
      {
         if (wch->sex == SEX_FEMALE)
            class = "#PD#euchess#n     ";
         else
            class = "#PD#euke#n        ";
      }
      else if (wch->race < 80)
      {
         if (wch->sex == SEX_FEMALE)
            class = "#BP#brincess#n    ";
         else
            class = "#BP#brince#n      ";
      }
      else
      {
         if (wch->sex == SEX_FEMALE)
            class = "#yQ#wue#we#yn#n       ";
         else
            class = "#yK#win#yg#n        ";
      }
      sprintf(sbuf, "%-12s", class);
      sprintf(lbuf, "%12s", lstatus);
      sprintf(slbuf, "%-12s %12s", lbuf, sbuf);
      statuslegend = slbuf;
//centerjob(" ",slbuf,22);
      
      if (IS_SET (wch->extra2, NHELPER))
            class = "#RH#relper#n      ";
      //if (wch->registerred != 1 && wch->email_set != 2)
      //      class = "#cUnRegistered#n";

      /*
       * Format it up.
       */
      if (IS_CLASS (wch, CLASS_VAMPIRE))
      {
	 strcpy (openb, "#r<<");
	 strcpy (closeb, "#r>>#n");
      }
      else if (IS_CLASS (wch, CLASS_FAE))
      {
	 strcpy (openb, "#B[#b<#c");
	 strcpy (closeb, "#b>#B]#n");
      }
      else if (IS_CLASS (wch, CLASS_WRAITH))
      {
	 strcpy (openb, "#e+-#w");
	 strcpy (closeb, "#e-+#n");
      }
//BASTETADDITION
      else if (IS_CLASS (wch, CLASS_BASTET))
      {
	 strcpy (openb, "#w-#o(");
	 strcpy (closeb, "#o)#w-#n");
      }
      else if (IS_CLASS (wch, CLASS_WEREWOLF))
      {
	 strcpy (openb, "#o((");
	 strcpy (closeb, "#o))#n");
      }
      else if (IS_CLASS (wch, CLASS_MAGE))
      {
	 strcpy (openb, "#b{{");
	 strcpy (closeb, "#b}}#n");
      }
      else if (IS_CLASS (wch, CLASS_HIGHLANDER))
      {
	 strcpy (openb, "#C-=#c");
	 strcpy (closeb, "#C=-#n");
      }
      else if (IS_CLASS (wch, CLASS_NINJA))
      {
	 strcpy (openb, "#p**");
	 strcpy (closeb, "#p**#n");
      }
      else if (IS_CLASS (wch, CLASS_MONK))
      {
	 strcpy (openb, "#g<:");
	 strcpy (closeb, "#g:>#n");
      }
      else if (IS_CLASS (wch, CLASS_DRAGON))
      {
	 strcpy (openb, "#g(#w=#g)");
	 strcpy (closeb, "#g(#w=#g)#n");
      }
      else if (IS_CLASS (wch, CLASS_GARGOYLE))
      {
	 strcpy (openb, "#e-*-#o");
	 strcpy (closeb, "#e-*-#n");
      }
      else if (IS_CLASS (wch, CLASS_DROW))
      {
	 strcpy (openb, "#c.o0");
	 strcpy (closeb, "#c0o.#n");
      }
      else if (IS_CLASS (wch, CLASS_PHOENIX))
      {
         strcpy (openb,  "#y.#r^^^^#n");
         strcpy (closeb, "#r^^^^#y.#n");
      }
      else if (IS_CLASS(wch, CLASS_NEWDROW))
      {
         strcpy (openb,  "#cOo.");
         strcpy (closeb, "#c.oO#n");
      }
      else
      {
	 strcpy (openb, "#y[[");
	 strcpy (closeb, "#y]]#n");
      }

      if ((IS_CLASS (wch, CLASS_WRAITH))
	       && (wch->pcdata->stats[UNI_GEN] <= 2))
	 sprintf (kav, "%sFathomless%s", openb, closeb);
      else if (IS_CLASS (wch, CLASS_WRAITH))
	 sprintf (kav, "%sWraith%s", openb, closeb);
      else if (IS_CLASS (wch, CLASS_BASTET))
	 sprintf (kav, "%sBastet%s", openb, closeb);
      else if (IS_CLASS (wch, CLASS_DEMON))
      {
	 if (wch->clannum > 0)
         {
            if ( IS_CLASS(wch, CLASS_DEMON) && !str_cmp(wch->name, nclans_table[wch->clannum].leader)
                 && wch->sex == SEX_FEMALE )
                sprintf( kav, "%sDemon Lady of %s%s", openb, nclans_table[wch->clannum].display, closeb);
            else if ( IS_CLASS(wch, CLASS_DEMON) && !str_cmp(wch->name, nclans_table[wch->clannum].leader))
                sprintf( kav, "%sDemon Lord of %s%s", openb, nclans_table[wch->clannum].display, closeb );

                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince) && wch->sex == SEX_FEMALE)
                    sprintf( kav, "%sDemon Princess of %s%s", openb, nclans_table[wch->clannum].display,closeb );
                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                    sprintf( kav, "%sDemon Prince of %s%s", openb,nclans_table[wch->clannum].display,closeb );
		else if (IS_SET(wch->special, SPC_SIRE))
                    sprintf( kav, "%sDemon of %s%s", openb,nclans_table[wch->clannum].display,closeb );
		else
                    sprintf( kav, "%sChampion of %s%s", openb,nclans_table[wch->clannum].display,closeb );
         }
	 else 
	 {
               switch(wch->pcdata->stats[UNI_GEN])
               {
               default:
	       sprintf (kav, "%sDemon%s", openb, closeb);
               break;
               case 1:                    
	       sprintf (kav, "%sDemonic Pit Lord%s", openb, closeb);
               break;
               case 2:                    
	       sprintf (kav, "%sDemonic Pit Fiend%s", openb, closeb);
               break;
               case 3:                    
	       sprintf (kav, "%sDemonic Gelugon%s", openb, closeb);
               break;
               case 4:                    
	       sprintf (kav, "%sDemonic Cornugon%s", openb, closeb);
               break;
               case 5:                    
	       sprintf (kav, "%sDemonic Amnizu%s", openb, closeb);
               break;
               case 6:                    
	       sprintf (kav, "%sDemonic Erinyes%s", openb, closeb);
               break;
               case 7:                    
	       sprintf (kav, "%sDemonic Hamatula%s", openb, closeb);
               break;
               case 8:                    
	       sprintf (kav, "%sDemonic Osyluth%s", openb, closeb);
               break;
               case 9:                    
	       sprintf (kav, "%sDemonic Abishai%s", openb, closeb);
               break;
               case 10:                    
	       sprintf (kav, "%sDemonic Barbazu%s", openb, closeb);
               break;
               case 11:                    
	       sprintf (kav, "%sDemonic Spinagon%s", openb, closeb);
               break;
               case 12:                    
	       sprintf (kav, "%sDemonic Nupperibo%s", openb, closeb);
               break;
               case 13:                    
	       sprintf (kav, "%sDemonic Lemure%s", openb, closeb);
               break;
               }  
	 }
      }
      else if (IS_CLASS (wch, CLASS_DROW))
      {
	 char dbuf[MSL];
         if (wch->clannum > 0)
         {
                if (wch->pcdata->stats[UNI_GEN] == 2)
                {
                        if (wch->sex == SEX_MALE)
                           sprintf(kav, "%s%s #cDalharuk%s", openb, nclans_table[wch->clannum].display, closeb);  
                        else if (wch->sex == SEX_FEMALE)
                           sprintf(kav,"%s%s #cDalharil%s", openb, nclans_table[wch->clannum].display, closeb );
                        else
                           sprintf(kav,"%s%s #cEunuch%s", openb, nclans_table[wch->clannum].display, closeb );
                }
		else if (IS_SET(wch->special, SPC_DROW_WAR))
                {
                        if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                           sprintf(kav, "%s%s #cQu'el'saruk%s", openb, nclans_table[wch->clannum].display, closeb);
                        else 
                           sprintf(kav, "%s%s #cSargtlin%s", openb, nclans_table[wch->clannum].display, closeb );
                }
		else if (IS_SET(wch->special, SPC_DROW_CLE))
                {
                        if(!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                           sprintf(kav, "%s%s #cHigh Yathrin%s",openb, nclans_table[wch->clannum].display, closeb); 
                        else    
                           sprintf(kav, "%s%s #cYathrin%s", openb, nclans_table[wch->clannum].display, closeb );
                }
		else if (IS_SET(wch->special, SPC_DROW_MAG))
                {       
                        if(!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                           sprintf(kav, "%s%s #cHigh Qu'el'faeruk%s",openb, nclans_table[wch->clannum].display, closeb);
                        else                
                           sprintf(kav, "%s%s #cQu'el'faeruk%s", openb, nclans_table[wch->clannum].display, closeb );
                }
		else if (IS_SET(wch->special, SPC_DROW_ASN))
                {       
                        if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                           sprintf(kav, "%s%s #cHigh Qu'el'velguk%s",openb, nclans_table[wch->clannum].display, closeb);
                        else                
                           sprintf(kav, "%s%s #cQu'el'velguk%s", openb, nclans_table[wch->clannum].display, closeb );
                }
                else sprintf(kav, "%s%s #cShebali%s", openb, nclans_table[wch->clannum].display, closeb);
		
                if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                {
                        if (wch->sex == SEX_MALE)
                           sprintf(kav, "%s%s #cIlharn%s", openb, nclans_table[wch->clannum].display, closeb);
                        else if (wch->sex == SEX_FEMALE)
                           sprintf(kav,"%s%s #cIlharess%s", openb, nclans_table[wch->clannum].display, closeb );
                        else
                           sprintf(kav,"%s%s 'cEunuch%s", openb, nclans_table[wch->clannum].display, closeb );
                }
         }
         else if (wch->clannum == 0)
       {   
	 if (wch->pcdata->stats[UNI_GEN] <= 2)
	 {
	    if (wch->sex == SEX_MALE)
	       sprintf (dbuf, "Patron");
	    else if (wch->sex == SEX_FEMALE)
	       sprintf (dbuf, "Matron");
	    else
	       sprintf (dbuf, "Eunuch");
	    sprintf (kav, "%sIlythiiri %s%s", openb, dbuf, closeb);
	 }
	 else
	 {

	    if (IS_SET (wch->special, SPC_DROW_WAR))
	       sprintf (dbuf, "Sargtlin");
	    else if (IS_SET (wch->special, SPC_DROW_CLE))
	       sprintf (dbuf, "Yathrin");
	    else if (IS_SET (wch->special, SPC_DROW_MAG))
	       sprintf (dbuf, "Qu'el'faeruk");
            else if (IS_SET (wch->special, SPC_DROW_ASN))
               sprintf (dbuf, "Qu'el'velguk");
	    else
	       sprintf (dbuf, "Shebali");
	 }

	 sprintf (kav, "%sIlythiiri %s%s", openb, dbuf, closeb);
         }


      }
      else if (IS_CLASS(wch, CLASS_NEWDROW))
      {
          sprintf (kav, "%s Shebali %s",openb,closeb);
      }
      else if (IS_CLASS(wch, CLASS_PHOENIX))
      {
          sprintf (kav, "%sPhoenix%s",openb,closeb);
      }
      else if (IS_CLASS (wch, CLASS_NINJA))
      {
	 if (wch->clannum > 0)
         {
         if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%sSennin of %s%s", openb, nclans_table[wch->clannum].display, closeb );
                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                    sprintf( kav, "%sShogun of %s%s", openb, nclans_table[wch->clannum].display, closeb );

            else if ((wch->pcdata->stats[UNI_GEN] == 3))
               sprintf (kav, "%sJounin of %s%s", openb, nclans_table[wch->clannum].display,closeb);
            else if (wch->pcdata->stats[UNI_GEN] == 4)
               sprintf (kav, "%sTokubetsu Jounin of %s%s", openb,nclans_table[wch->clannum].display, closeb);
            else if (wch->pcdata->stats[UNI_GEN] == 5)
               sprintf (kav, "%sChuunin of %s%s", openb, nclans_table[wch->clannum].display,closeb);
            else if (wch->pcdata->stats[UNI_GEN] == 6)
               sprintf (kav, "%sGenin of %s%s", openb, nclans_table[wch->clannum].display,closeb);
            else
            sprintf (kav, "%s%s%s", openb, nclans_table[wch->clannum].display, closeb);
         }
	 else
	 {
	    if ((wch->pcdata->stats[UNI_GEN] == 1))
	       sprintf (kav, "%sKage%s", openb, closeb);
	    else if ((wch->pcdata->stats[UNI_GEN] == 2))
	       sprintf (kav, "%sSennin%s", openb, closeb);
	    else if ((wch->pcdata->stats[UNI_GEN] == 3))
	       sprintf (kav, "%sJounin%s", openb, closeb);
	    else if (wch->pcdata->stats[UNI_GEN] == 4)
	       sprintf (kav, "%sTokubetsu Jounin%s", openb, closeb);
	    else if (wch->pcdata->stats[UNI_GEN] == 5)
	       sprintf (kav, "%sChuunin%s", openb, closeb);
	    else if (wch->pcdata->stats[UNI_GEN] == 6)
	       sprintf (kav, "%sGenin%s", openb, closeb);
	    else
	       sprintf (kav, "%sAcademy Student%s", openb, closeb);
	 }
      }
      else if (IS_CLASS (wch, CLASS_HIGHLANDER))
      {
	 if (wch->clannum > 0)
         {
            if (!str_cmp(wch->clan, "Black Spiral Dancers"))
            {
                sprintf(BSD, "B.S.D");
   	        sprintf (kav, "%sMercenary of %s%s", openb, BSD, closeb);
            }
	    else
            sprintf (kav, "%sMercenary of %s%s", openb, nclans_table[wch->clannum].display, closeb);
         }
	 else if (wch->pcdata->stats[UNI_GEN] == 2)
	    sprintf (kav, "%s#cWeapons Master%s", openb, closeb);
	 else
	    switch (wch->wpn[1])
	    {
	    default:
	       sprintf (kav, "%sInitiate%s", openb, closeb);
	       break;
	    case 250:
	       sprintf (kav, "%sStudent%s", openb, closeb);
	       break;
	    case 500:
	       sprintf (kav, "%sWarrior%s", openb, closeb);
	       break;
	    case 750:
	       sprintf (kav, "%sSwordsmaster%s", openb, closeb);
	       break;
	    case 1000:
	       sprintf (kav, "%sMentor%s", openb, closeb);
	       break;
	    }
      }
      else if (IS_CLASS (wch, CLASS_VAMPIRE))
      {
            if (wch->clannum > 0)
	    {
		bool get_age = FALSE;
		char clanname[20];

                if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%sFounder of %s%s", openb, nclans_table[wch->clannum].display, closeb );
                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                    sprintf( kav, "%s%s #rPrince%s", openb, nclans_table[wch->clannum].display, closeb );
		else if (IS_SET(wch->special, SPC_INCONNU))
		    get_age = TRUE;
	    	else if (IS_SET(wch->special, SPC_ANARCH))
		    get_age = TRUE;
	    	else if (wch->clannum == 0)
		    get_age = TRUE;
	    	else get_age = TRUE;
		if (get_age)
		{
		    if (IS_SET(wch->special, SPC_INCONNU))
//                        strcpy( clanname, "Independent" );
                        strcpy( clanname, "Inconnu" );
		    else if (IS_SET(wch->special, SPC_ANARCH))
			strcpy( clanname, "Anarch" );
		    else if (wch->clannum == 0)
			strcpy( clanname, "Caitiff" );
		    else
                        strcpy( clanname, nclans_table[wch->clannum].display );
		    if (wch->pcdata->stats[UNI_GEN] == 2)
			sprintf( kav, "%s%s#r Antediluvian%s", openb, clanname, closeb );
		    else switch ( wch->pcdata->rank )
		    {
		    default:
			sprintf( kav, "%s%s #rChilde%s", openb, clanname, closeb );
			break;
		    case AGE_NEONATE:
			sprintf( kav, "%s%s #rNeonate%s", openb, clanname, closeb );
			break;
		    case AGE_ANCILLA:
			sprintf( kav, "%s%s #rAncilla%s", openb, clanname, closeb );
			break;
		    case AGE_ELDER:
			sprintf( kav, "%s%s #rElder%s", openb, clanname, closeb );
			break;
		    case AGE_METHUSELAH:
			sprintf( kav, "%s%s #rMethuselah%s", openb, clanname, closeb );
			break;
		    }
		}
	    }
           else
	    {
		bool get_age = FALSE;
		char clanname[20];

		if (IS_SET(wch->special, SPC_INCONNU))
		    get_age = TRUE;
	    	else if (IS_SET(wch->special, SPC_ANARCH))
		    get_age = TRUE;
	    	else if (wch->clannum == 0)
		    get_age = TRUE;
	    	else get_age = TRUE;
		if (get_age)
		{
		    if (IS_SET(wch->special, SPC_INCONNU))
//                        strcpy( clanname, "Independent" );
                        strcpy( clanname, "Inconnu" );
		    else if (IS_SET(wch->special, SPC_ANARCH))
			strcpy( clanname, "Anarch" );
		    else
			strcpy( clanname, "Caitiff" );

		    if (wch->pcdata->stats[UNI_GEN] == 2)
			sprintf( kav, "%s%s Antediluvian%s", openb, clanname, closeb );
		    else switch ( wch->pcdata->rank )
		    {
		    default:
			sprintf( kav, "%s%s #rChilde%s", openb, clanname, closeb );
			break;
		    case AGE_NEONATE:
			sprintf( kav, "%s%s #rNeonate%s", openb, clanname, closeb );
			break;
		    case AGE_ANCILLA:
			sprintf( kav, "%s%s #rAncilla%s", openb, clanname, closeb );
			break;
		    case AGE_ELDER:
			sprintf( kav, "%s%s #rElder%s", openb, clanname, closeb );
			break;
		    case AGE_METHUSELAH:
			sprintf( kav, "%s%s #rMethuselah%s", openb, clanname, closeb );
			break;
		    }
		}
	    }

      }
      else if (IS_CLASS (wch, CLASS_WEREWOLF))
      {
            if (wch->clannum > 0)
	    {
                if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%s%s #oChief%s", openb, nclans_table[wch->clannum].display, closeb );
                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince) )
                    sprintf(kav, "%s%s #oShaman%s", openb, nclans_table[wch->clannum].display, closeb );
                else if (wch->pcdata->stats[UNI_GEN] == 2)
                    sprintf( kav, "%s%s #oElder%s", openb, nclans_table[wch->clannum].display, closeb );
                else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince))
                    sprintf( kav, "%s%s 'iShaman%s", openb, nclans_table[wch->clannum].display, closeb );
	    	else
                    sprintf( kav, "%s%s%s", openb, nclans_table[wch->clannum].display, closeb );
	    }

            else if (IS_CLASS(wch, CLASS_WEREWOLF) && IS_SET(wch->special, SPC_ANARCH))
                    sprintf( kav, "%sRonin%s", openb, closeb);
                        
	    else if ( wch->clannum < 1 )
  	    	sprintf( kav, "%sOrphan%s", openb, closeb );

      }
      else if (IS_CLASS (wch, CLASS_MONK))
      {
	 if (wch->clannum > 0)
         {
         if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%sAbbot of %s%s", openb, nclans_table[wch->clannum].display, closeb );

         else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince) )
                    sprintf(kav, "%sFriar of %s%s", openb, nclans_table[wch->clannum].display, closeb );
         else if (wch->pcdata->stats[UNI_GEN] == 2)
            sprintf (kav, "%sSaint of %s%s", openb, nclans_table[wch->clannum].display,closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 3)
            sprintf (kav, "%sCardinal of %s%s", openb, nclans_table[wch->clannum].display,closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 4)
            sprintf (kav, "%sArchBishop of %s%s", openb, nclans_table[wch->clannum].display,closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 5)
            sprintf (kav, "%sBishop of %s%s", openb, nclans_table[wch->clannum].display, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 6)
            sprintf (kav, "%sFather of %s%s", openb, nclans_table[wch->clannum].display,closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 7)
            sprintf (kav, "%sPriest of %s%s", openb, nclans_table[wch->clannum].display, closeb);
	 else
            sprintf (kav, "%sBrother of %s%s", openb,nclans_table[wch->clannum].display, closeb);
         }
	 else if (wch->clannum == 0)
         {
         if (wch->pcdata->stats[UNI_GEN] == 2)
            sprintf (kav, "%sAbbot%s", openb, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 3)
            sprintf (kav, "%sCardinal%s", openb, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 4)
            sprintf (kav, "%sArchBishop%s", openb, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 5)
            sprintf (kav, "%sBishop%s", openb, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 6)
            sprintf (kav, "%sFather%s", openb, closeb);
         else if (wch->pcdata->stats[UNI_GEN] == 7)
            sprintf (kav, "%sPriest%s", openb, closeb);
	 else
            sprintf (kav, "%sBrother%s", openb, closeb);
         }
      }
      else if (IS_CLASS (wch, CLASS_MAGE))
      {
             if ( wch->pcdata->stats[UNI_GEN] == 1 )
                  sprintf( kav, "%sMaster of #rS#go#br#yc#Pe#rr#gy%s", openb, closeb);
             else if (wch->clannum > 0)
             {
             if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%sOracle of %s%s", openb, nclans_table[wch->clannum].display, closeb );    
             else if (!str_cmp(wch->name, nclans_table[wch->clannum].prince) && wch->clannum > 0)
                  sprintf( kav, "%sParagon of %s%s", openb, nclans_table[wch->clannum].display, closeb);
             else
             {
                switch ( wch->level )
                {
	
                    default:
                    case LEVEL_APPRENTICE:
                        sprintf( kav, "%sDisciple of %s%s", openb, nclans_table[wch->clannum].display, closeb );
                        break;
                    case LEVEL_MAGE:
                        sprintf( kav, "%sAdept of %s%s", openb, nclans_table[wch->clannum].display, closeb );
                        break;
                    case LEVEL_ARCHMAGE:
                        sprintf( kav, "%sArchmage of %s%s", openb, nclans_table[wch->clannum].display, closeb );
                        break;

                       }

	}      }
         else if (wch->clannum == 0)
         {
	   if (wch->level == LEVEL_APPRENTICE)
	    sprintf (kav, "%sDisciple%s", openb, closeb);
	   else if (wch->level == LEVEL_MAGE)
	    sprintf (kav, "%sAdept%s", openb, closeb);
	   else if (wch->level == LEVEL_ARCHMAGE)
	    sprintf (kav, "%sArchmage%s", openb, closeb);
	   else
	    sprintf (kav, "%sMage%s", openb, closeb);
         }
      }
      else if (IS_CLASS (wch, CLASS_FAE))
      {
		char kith[100];
		switch(wch->kith)
		{
		  default: strcpy(kith,"Fae");break;
		  case KITH_SATYR:
			strcpy(kith,"Satyr");
			break;
		  case KITH_TROLL:
			strcpy(kith,"Troll");
			break;
		  case KITH_SIDHE:
			strcpy(kith,"Sidhe");
			break;
		  case KITH_BOGGAN:
			strcpy(kith,"Boggan");
			break;
		  case KITH_ESHU:
			strcpy(kith,"Eshu");
			break;
		  case KITH_NOCKER:
			strcpy(kith,"Nocker");
			break;
		  case KITH_REDCAP:
			strcpy(kith,"Redcap");
			break;
		  case KITH_SLUAGH:
			strcpy(kith,"Sluagh");
			break;
		  case KITH_POOKA:
			strcpy(kith,"Pooka");
			break;
		}
		if (wch->clannum > 0)
	    {
                if (!str_cmp(wch->name, nclans_table[wch->clannum].leader))
                    sprintf( kav, "%sKing of %s%s", openb, nclans_table[wch->clannum].display, closeb );
             	else if ((!str_cmp(wch->name, nclans_table[wch->clannum].prince)) && (wch->clannum > 0) && (wch->sex == SEX_FEMALE))
                    sprintf( kav, "%s%s Princess%s", openb, nclans_table[wch->clannum].display, closeb);
             	else if ((!str_cmp(wch->name, nclans_table[wch->clannum].prince)) && (wch->clannum > 0) && (wch->sex == SEX_MALE))
                    sprintf( kav, "%s%s Prince%s", openb, nclans_table[wch->clannum].display, closeb);
		else if (( wch->pcdata->stats[UNI_GEN] == 2 ) && (wch->clannum>0))
		    sprintf( kav, "%s%s Knight%s", openb, nclans_table[wch->clannum].display, closeb);
		else if (( wch->pcdata->stats[UNI_GEN] == 2 ) && (wch->clannum<1))
                  sprintf( kav, "%sKith Lord%s", openb, closeb);
		else sprintf(kav,"%s%s %s%s",openb,kith,nclans_table[wch->clannum].display,closeb);
	    }

		else sprintf( kav,"%s%s%s",openb,kith,closeb);

      }
      else if (IS_CLASS (wch, CLASS_DRAGON))
      {
	 if (wch->clannum > 0)
            sprintf (kav, "%s%s%s", openb, nclans_table[wch->clannum].display, closeb);
	 else
            switch (GET_AGE(wch))
	    {
	    default:
	       sprintf (kav, "%s%s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case HATCHLING:
	       sprintf (kav, "%s%s Hatchling%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case YOUNG:
	       sprintf (kav, "%sYoung %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case JUVENILE:
	       sprintf (kav, "%sJuvenile %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case YOUNG_ADULT:
	       sprintf (kav, "%sYoung Adult %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case ADULT:
	       sprintf (kav, "%sAdult %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case MATURE:
	       sprintf (kav, "%sMature %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case ELDER:
	       sprintf (kav, "%sElder %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case VENERABLE:
	       sprintf (kav, "%sVenerable %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case ANCIENT:
	       sprintf (kav, "%sAncient %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;

	    case LESSER_WYRM:
	       sprintf (kav, "%sLesser %s Wyrm%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case WYRM:
	       sprintf (kav, "%sWyrm of %s%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    case SUPREME:
	       sprintf (kav, "%sSupreme %s Dragon%s", openb,
			dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
	       break;
	    }
	 if ((wch->pcdata->stats[UNI_GEN] <= 2))
         {
	    sprintf (kav, "%sDivine %s Dragon%s", openb,
		     dcolor[wch->pcdata->disc_a[DRAGON_COLOR]], closeb);
         }
      }
      else
	 sprintf (kav, " ");
      /*if (IS_SET (wch->more, MORE_NOKING))
	 sprintf (kav, "%s#GOutcast#n%s", openb, closeb);
      */
      if (wch->pcdata->wizinvis >= 7 && IS_SET (wch->act, PLR_WIZINVIS))
	 sprintf (wizi, "#w(#yInvis #r%d#w)", wch->pcdata->wizinvis);
      else

	 strcpy (wizi, "");
      if (get_hours (wch) < 10 && wch->race == 0
	  && !IS_SET (wch->extra2, PKREADY) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#wN#n");
      else if (IS_SET (wch->flag2, AFF2_INARENA) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#pA#n");
      else if (IS_SET (wch->flag2, EXTRA_AFK))
	 sprintf (newbie, "#ra#n");
      else if (IS_SET (wch->flag2, EXTRA_CODING))
	 sprintf (newbie, "#yCn");
      else if (wch->fight_timer > 0 && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#rF#n");
      else if (wch->pcdata->login_timer > 0 && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#yL#n");
      else if (IS_SET (wch->more, MORE_JAIL) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#bJ#n");
      else if (IS_SET (wch->act, PLR_SILENCE) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#PS#n");
      else if (IS_SET (wch->newbits, WANTED)&& !IS_IMMORTAL(wch))
	 sprintf (newbie, "#.*#n");
      else if (IS_SET (wch->extra2, NHELPER) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#gH#n");
      else if (IS_SET (wch->act, PLR_FREEZE) && !IS_IMMORTAL(wch))
	 sprintf (newbie, "#eF#n");
      else
	 sprintf (newbie, " ");

      if (strlen (wch->prefix) > 1)
	 strcpy (prefix, wch->prefix);
      else
	 strcpy (prefix, "");
      sprintf (namething, "#w%s#e%s", wch->name, wch->pcdata->title);


      if IS_SET
	 (wch->act, PLR_INCOG) sprintf (incog, "#w(#CIncog#w)");
      else
	 strcpy (incog, "");

      sprintf(invisi, "%s%s", wizi, incog);
	 if (wch->level > 6)
	 {
	    cprintf (immo + strlen (immo),
		     "#C| %s #C| #w%s #w%-29s%-32s#C|#n\n\r", class,newbie, namething, invisi);
//		      put_spc(namething, 29, FALSE),  put_spc(invisi, 32, FALSE));
	    imm++;
	 }
	 else if (wch->level > 2 && wch->level < 7)
	 {
//	    kingdom (wch, king);
	    cprintf (a0 + strlen (a0),
		     "#C| %s #C|#n %s #w%-27s#n  %-32s#C|\n\r", statuslegend, newbie, namething, kav);
// put_spc( namething, 27, FALSE),put_spc(kav, 32, FALSE));
	    ava++;
	 }
	 else
	 {
	    cprintf (mort + strlen (mort),
		     "#C| %s #C| %s #w%-60s #C|\n\r", statuslegend,
		     newbie,  namething); //put_spc(namething, 60, FALSE));
	    mor++;
  	 }
   }
   stc ("\n\r", ch);
       wloc_to_char (ch);

   if (ava > 0)
   {
      if (ava == 1)
	 stc ("#w+#C------------------------------------#w=[  #gAVATAR#w   ]=#C--------------------------------------#w+#n\n\r", ch);

      else
	 
stc ("#w+#C------------------------------------#w=[  #gAVATARS#w  ]=#C--------------------------------------#w+#n\n\r", 
ch);

      stc (a0, ch);
   }

   if (mor > 0)
   {
      if (mor == 1)
	 stc ("#w+#C------------------------------------#w=[  #yMORTAL#w   ]=#C--------------------------------------#w+#n\n\r", 
ch);

      else
	 stc ("#w+#C------------------------------------#w=[  #yMORTALS#w  ]=#C--------------------------------------#w+#n\n\r", 
ch);

      stc (mort, ch);
   }
   if (imm > 0)
   {
      if (imm == 1)
	 stc ("#w+#C------------------------------------#w=[ #cIMMORTAL#w  ]=#C--------------------------------------#w+#n\n\r", 
ch);             

      else
	 stc ("#w+#C------------------------------------#w=[ #cIMMORTALS#w ]=#C--------------------------------------#w+#n\n\r", 
ch);

      stc (immo, ch);
   }

   divide9_to_char (ch);
   sprintf (buf3,
	    "#C|     #wIMMORTALS : #r%3.3d  #wPLAYERS : #r%2.2d  #wINVIS : #r%2.2d  #wTOTAL LOGINS : #r%3.3d  #wHIGH LOGINS : #r%3.3d    #C|",
	    immMatch, nMatch,( nTotal-nMatch), total_number_login,
	    high_number_login);
   cent_to_char (buf3, ch);
   if (WizConfig->qpbonus > 1)
      sprintf (qpbonus, "#gYes");
   else
      sprintf (qpbonus, "#rNo ");

   if (WizConfig->xpbonus > 1)
      sprintf (xpbonus, "#gYes");
   else
      sprintf (xpbonus, "#rNo ");
   sprintf (buf3,
	    "#C|       #wEXP MOD : %-3s#n                 #wMAX PLAYERS EVER: #r%3.3d#n               #wQP MOD : %-3s#n    #C|\n\r",
	    xpbonus, WizConfig->maxplayers,qpbonus);

   send_to_char (buf3, ch);
   divide10_to_char (ch);
   return;
}

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

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

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

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

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

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

void do_equipment (CHAR_DATA * ch, char *argument)
{
   OBJ_DATA *obj;
   int iWear;
   bool found;
//   int i;
//   int damage;
   char pc[MSL];
   char gauge[MSL];
   char buf[MSL];

   stc ("#wYou are using:\n\r", ch);
   found = FALSE;
   for (iWear = 1; iWear < MAX_WEAR; iWear++)
   {
      if (iWear == 11 || iWear == 18 || iWear == 19)
	 continue;

      if (iWear == WEAR_CLOAK && !WORN_ARTIFACT(ch, ARTI_CLOAK_OF_THE_ARCHMAGI)) continue;
      if ((obj = get_eq_char (ch, iWear)) == NULL)
      {
         if (get_eq_char(ch, WEAR_DUAL) == NULL && iWear == 24) continue;
         if (get_eq_char(ch, WEAR_DUAL) != NULL && (iWear == 16 || iWear == 17)) continue;
         //if (iWear == 24) continue;
	 if (iWear == 21 || iWear == 22)
	    continue;
	 stc (where_name[iWear], ch);

	 stc ("#wN#eothing#n\n\r", ch);
	 continue;
      }
      send_to_char (where_name[iWear], ch);

      if (can_see_obj (ch, obj))
      {
	 if IS_SET
	    (ch->more, PLR_SEE_DAMAGE)
	 {
/*	    damage = obj->condition / 10;
	    gauge[0] = '\0';
	    for (i = 0; i < 10; i++)
	    {
	       if (i < damage)
		  strcat (gauge, "*");
	       else
		  strcat (gauge, " ");
	    }
*/
	    gauge[0] = '\0';
	    sprintf(pc, "%3d#r%%#n", obj->condition);
            strcat(gauge, pc);
       
	    COL_SCALE (gauge, ch, obj->condition, 100);
	    sprintf (buf, "#w[%s#w]#n %s\n\r", gauge,
		     format_obj_to_char (obj, ch, TRUE));
	    send_to_char (buf, ch);
	 }
	 else
	 {
	    send_to_char (format_obj_to_char (obj, ch, TRUE), ch);
	    send_to_char ("\n\r", ch);
	 }
      }
      else
      {
	 send_to_char ("something.\n\r", ch);
      }
      found = TRUE;
   }


   return;
}

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

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

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

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

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

   msg = NULL;
   value1 = 0;
   value2 = 0;

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

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

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

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

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

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

void do_tijlist (CHAR_DATA * ch, char *argument)
{
   do_help (ch, "wizlist");
   return;
}
void do_owizlist (CHAR_DATA * ch, char *argument)
{
   int random;

   random = number_range (1, 25);

   switch (random)
   {

   default:
      do_help (ch, "wizlist");
      break;
   case 1:
   case 6:
   case 11:
   case 16:
   case 21:
      do_help (ch, "test1");
      break;
   case 2:
   case 7:
   case 12:
   case 17:
   case 22:
      do_help (ch, "test2");
      break;
   case 3:
   case 8:
   case 13:
   case 18:
   case 23:
      do_help (ch, "test3");
      break;
   case 4:
   case 9:
   case 14:
   case 19:
   case 24:
      do_help (ch, "test4");
      break;
   case 5:
   case 10:
   case 15:
   case 20:
   case 25:
      do_help (ch, "test5");
      break;
   }
   return;
}

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

   one_argument (argument, arg);

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

   if (ch->in_room->vnum >= 32900 && ch->in_room->vnum <= 32904)
   {
      stc ("You dont know where you are!\n\r", ch);
      return;
   }
   if (IS_SET (world_affects, WORLD_FOG))
   {
      send_to_char ("It is too foggy to locate anyone.\n\r", ch);
      return;
   }

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

   return;
}

void do_consider (CHAR_DATA * ch, char *argument)
{
   char buf[MSL];
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   char *msg;
   int diff;
   int overall;
   int con_hit= 0, con_dam=0, con_ac=0, con_hp=0, con_damcap=0, con_str=0, con_dex=0,
      con_const=0;

   one_argument (argument, arg);
   overall = 0;

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

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

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

   stc ("#b+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#n\n\r", ch);
   if (!IS_NPC (victim))
   {
      do_skill (ch, victim->name);
      stc ("#b+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#n\n\r", ch);
   }
   if (!IS_NPC (victim) && IS_CLASS (victim, CLASS_VAMPIRE)
       && IS_EXTRA (victim, EXTRA_FAKE_CON))
   {
      con_hit = victim->pcdata->fake_hit;
      con_dam = victim->pcdata->fake_dam;
      con_ac = victim->pcdata->fake_ac;
      con_hp = victim->pcdata->fake_hp;
   }
   else
   {
      con_hit = char_hitroll (victim);
      con_dam = char_damroll (victim);
      con_ac = char_ac (victim);
      con_hp = victim->hit / victim->max_hit;
      con_damcap = victim->damcap[0];
      con_str = get_curr_str (victim);
      con_dex = get_curr_dex (victim);
      con_const = get_curr_con (victim);
   }
   if (con_hp < 1)
      con_hp = 1;


   diff = (+char_hitroll (ch) + char_damroll (ch)) - (con_hit + con_dam);

   if (diff <= -500)
   {
      msg = "$E is an extremely good fighter compared to you.";
      overall = overall - 3;
   }
   else if (diff <= -250)
   {
      msg = "Compared to you, $E is a very good fighter.";
      overall = overall - 2;
   }
   else if (diff <= -100)
   {
      msg = "$E is a better fighter than you.";
      overall = overall - 1;
   }
   else if (diff <= 100)
   {
      msg = "$E is about as good a fighter as you.";
   }
   else if (diff <= 250)
   {
      msg = "You are a better fighter than $M.";
      overall = overall + 1;
   }
   else if (diff <= 500)
   {
      msg = "You are a very good fighter compared to $M.";
      overall = overall + 2;
   }
   else
   {
      msg = "Compared to $M, you are an extremely good fighter.";
      overall = overall + 3;
   }
   act (msg, ch, NULL, victim, TO_CHAR);

   diff = (ch->hit / ch->max_hit) * 100 / con_hp;

   if (diff <= 10)
   {
      msg = "$E has far fewer wounds than you.";
      overall = overall - 3;
   }
   else if (diff <= 50)
   {
      msg = "$E has quite fewer wounds than you.";
      overall = overall - 2;
   }
   else if (diff <= 75)
   {
      msg = "$E has fewer wounds than you.";
      overall = overall - 1;
   }
   else if (diff <= 125)
   {
      msg = "$E has about the same amount of wounds as you.";
   }
   else if (diff <= 200)
   {
      msg = "You have less wounds than $M.";
      overall = overall + 1;
   }
   else if (diff <= 500)
   {
      msg = "You have quite fewer wounds than $M.";
      overall = overall + 2;
   }
   else
   {
      msg = "You have far fewer wounds than $M.";
      overall = overall + 3;
   }
   act (msg, ch, NULL, victim, TO_CHAR);



   diff = get_curr_str (ch) - con_str;
   if (diff <= -5)
   {
      msg = "$E is FAR stronger than you are.";
      overall = overall - 3;
   }
   else if (diff <= -3)
   {
      msg = "$E is much stronger than you are.";
      overall = overall - 2;
   }
   else if (diff <= -1)
   {
      msg = "$E is stronger than you are.";
      overall = overall - 1;
   }

   else if (diff <= 1)
   {
      msg = "$E is about as strong as you are.";
   }
   else if (diff <= 3)
   {
      msg = "You are stronger than $M.";
      overall = overall + 1;
   }
   else if (diff <= 5)
   {
      msg = "You are much stronger than $M.";
      overall = overall + 2;
   }
   else
   {
      msg = "You are FAR stronger than $M.";
      overall = overall + 3;
   }

   act (msg, ch, NULL, victim, TO_CHAR);




   diff = get_curr_dex (ch) - con_dex;
   if (diff <= -5)
   {
      msg = "$E is far more limber than you are.";
      overall = overall - 3;
   }
   else if (diff <= -3)
   {
      msg = "$E is much more limber than you are.";
      overall = overall - 2;
   }
   else if (diff <= -1)
   {
      msg = "$E is more limber than you are.";
      overall = overall - 1;
   }

   else if (diff <= 1)
   {
      msg = "$E is about as dextrous as you are.";
   }
   else if (diff <= 3)
   {
      msg = "You are more limber than $M.";
      overall = overall + 1;
   }
   else if (diff <= 5)
   {
      msg = "You are much more limber than $M.";
      overall = overall + 2;
   }
   else
   {
      msg = "You are FAR more limber than $M.";
      overall = overall + 3;
   }

   act (msg, ch, NULL, victim, TO_CHAR);
   diff = get_curr_con (ch) - con_const;

   if (diff <= -5)
   {
      msg = "$E is currently FAR healthier than you are.";
      overall = overall - 3;
   }
   else if (diff <= -3)
   {
      msg = "$E is currently much healthier than you are.";
      overall = overall - 2;
   }
   else if (diff <= -1)
   {
      msg = "$E is currently slightly healthier than you are.";
      overall = overall - 1;
   }

   else if (diff <= 1)
   {
      msg = "$E is currently about as healthy as you are.";
   }
   else if (diff <= 3)
   {
      msg = "You are currently slightly healthier than $M.";
      overall = overall + 1;
   }
   else if (diff <= 5)
   {
      msg = "You are currently much healthier than $M.";
      overall = overall + 2;
   }
   else
   {
      msg = "You are currently FAR healthier than $M.";
      overall = overall + 3;
   }

   act (msg, ch, NULL, victim, TO_CHAR);

   {
      diff = ch->damcap[0] - con_damcap;
      if (diff <= -2000)
      {
	 msg = "$E can dish out a hell of a lot more than you can.";
	 overall = overall - 3;
      }
      else if (diff <= -1000)
      {
	 msg = "$E can dish out a lot more than you can.";
	 overall = overall - 2;
      }
      else if (diff <= -250)
      {
	 msg = "$E can dish out more than you.";
	 overall = overall - 1;
      }

      else if (diff <= 250)
      {
	 msg = "$E is about as powerful as you are.";
      }
      else if (diff <= 1000)
      {
	 msg = "You can dish out more than $M.";
	 overall = overall + 1;
      }
      else if (diff <= 2000)
      {
	 msg = "You can dish out a lot more than $M.";
	 overall = overall + 2;
      }
      else
      {
	 msg = "You can dish out a hell of a lot more than $M.";
	 overall = overall + 3;
      }

      act (msg, ch, NULL, victim, TO_CHAR);
   }


   sprintf (buf, "You would get around %d attacks against %s.\n\r",
	    number_attacks (ch, victim),
	    IS_NPC (victim) ? victim->short_descr : victim->name);
   stc (buf, ch);
   diff = overall;
   if (diff <= -20)
      msg = "Conclusion: $E would kill you in seconds.";
   else if (diff <= -13)
      msg = "Conclusion: You would need a lot of luck to beat $M.";
   else if (diff <= -5)
      msg = "Conclusion: You would need some luck to beat $N.";
   else if (diff <= 5)
      msg = "Conclusion: It would be a very close fight.";
   else if (diff <= 13)
      msg = "Conclusion: You shouldn't have a lot of trouble defeating $M.";
   else if (diff <= 20)
      msg = "Conclusion: $N is no match for you.  You can easily beat $M.";
   else
      msg =
	 "Conclusion: $E wouldn't last more than a few seconds against you.";
   stc ("#b+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#n\n\r", ch);
   act (msg, ch, NULL, victim, TO_CHAR);
   stc ("#b+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#n\n\r", ch);
   stc ("#wDoing #r5 #gmock #whits to you...\n\r", ch);
   stcf (ch, "#c1st hit #w= #r%d #ydamage#n.\n\r",
	 mock_one_hit (ch, victim, TYPE_UNDEFINED, 1));
   stcf (ch, "#c2nd hit #w= #r%d #ydamage#n.\n\r",
	 mock_one_hit (ch, victim, TYPE_UNDEFINED, 1));
   stcf (ch, "#c3rd hit #w= #r%d #ydamage#n.\n\r",
	 mock_one_hit (ch, victim, TYPE_UNDEFINED, 1));
   stcf (ch, "#c4th hit #w= #r%d #ydamage#n.\n\r",
	 mock_one_hit (ch, victim, TYPE_UNDEFINED, 1));
   stcf (ch, "#c5th hit #w= #r%d #ydamage#n.\n\r",
	 mock_one_hit (ch, victim, TYPE_UNDEFINED, 1));
   stc ("#b+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+#n\n\r", ch);


   return;
}

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

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

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

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

void do_pagelen (CHAR_DATA * ch, char *argument)
{
   if (argument[0] == '\0')
   {
      ch->pcdata->pagelen = 35;
      stcprintf (ch, "Pagelength reset to default %d\n\r",
		 ch->pcdata->pagelen);
      return;
   }
   if (!str_cmp (argument, "off"))
   {
      stc ("Paging is now turned off!!\n\r", ch);
      ch->pcdata->pagelen = 0;
      return;
   }

   if (!is_number (argument))
   {
      stc ("Thats not a number!\n\r", ch);
      return;
   }

   ch->pcdata->pagelen = atoi (argument);
   stcprintf (ch, "Page length set to: %d\n\r", ch->pcdata->pagelen);
   return;
}
char *pbash_color( const char *txt)
{
    static char buf[MSL*4];
    static char buf2[MSL*4];
    static char buf3[MSL*4];
    static char buf4[MSL*4];
    static int num = 0;
    char *p; 
    char *ret;   
    int c=0;
    
    if (!txt || *txt==0) {strcpy(buf,"");return buf;}
    num++;
    p = num==1?buf:num==2?buf2:num==3?buf3:buf4;
    if (num>3) num=0;
            
    ret = p;
  
    for (; *txt && c < (MSL*4)-2;txt++)
    {
        if (*txt == '#' && *(txt+1) != 0)
        {
            txt++; continue;
        }
        else if (*txt == '^' && *(txt+1) != 0)
        {
            txt++; continue;
        }
        c++;
        *p = *txt;
        p++;
    }
    *p = 0;
    return ret;
}
   
  
char *stopat(char *val, int maxlen)
{
    int c =0;
    char *p=val; 
  
    while (*val)
    {
        if (*val=='#' && *(val+1) != '#')
            val++;
        else if (*val=='^' && *(val+1) != '^')
            val++;
        else c++;
  
        if (*val)
            val++;
  
        if (c == maxlen) break;
    }
        
    if (*val) *val = 0;
    return p;
}
char *centerjob(char *fill, const char *txt, int maxlen)
{
  static char buf[MIL];
  static char buf2[MIL];
  static char buf3[MIL];
  static char buf4[MIL];
  char *ret;   
  static int count = -1;
   
  count++;
  ret = count==0?buf:count==1?buf2:count==2?buf3:buf4;
  if (count ==3 ) count = -1;
    
  strcpy(ret,"");
  if (strlen(pbash_color(fill)) == 0) {strcpy(ret, txt);return ret;}
    
  if (strlen(pbash_color(txt)) >= maxlen)
  {
        strcpy(ret, txt);
        return ret;
  }
        
  while (strlen(pbash_color(ret))<(maxlen/2))
        strcat(ret, fill);
            
  stopat(ret, (maxlen/2)-(strlen(pbash_color(txt))/2));
  strcat(ret, txt);
  while (strlen(pbash_color(ret))<maxlen)
        strcat(ret, fill);
    
  return stopat(ret, maxlen);
}
void set_prefix( CHAR_DATA *ch, char *title )
{
    free_string( ch->prefix );
    ch->prefix = str_dup( title );
    return;
}
  
  
   
void do_prefix( CHAR_DATA *ch, char *argument )
{
  
    char buf[MAX_STRING_LENGTH];
  
    if ( IS_NPC(ch) )
        return;
  
    if ( argument[0] == '\0' )
    {
        send_to_char( "Change your prefix to what?\n\r", ch );
        return;
    }   
    else if (!str_cmp(argument, "clear") )  
    {
        free_string(ch->prefix);
        ch->prefix = str_dup("");
        stc("Prefix Cleared!\n\r", ch);
        return;
    }
    smash_tilde( argument );
    strcpy(buf,argument);
    stc("Prefix Set!\n\r", ch );
    set_prefix( ch, stopat(buf,22) );
}
void do_title (CHAR_DATA * ch, char *argument)
{
   int i = 0;

   if (IS_NPC (ch))
      return;

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

   for (i = 0; i < col_str_len (argument); i++)
   {
      if (argument[i] == '`')
      {
	 stc ("You cannot use special characters in titles.\n\r", ch);
	 return;
      }
      if (argument[i] == '^')
      {
	 stc ("You cannot use special characters in titles.\n\r", ch);
	 return;
      }

   }
   if (col_str_len (argument) > 15)
      argument[16] = '\0';

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

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

   if (IS_NPC (ch))
      return;

   if (ch->fight_timer > 0)
   {
      stc ("Not Until your fight timer has cleared!\n\r", ch);
      return;
   }
   if (IS_SET (ch->flag2, EXTRA_AFK))
   {
      send_to_char ("You are no longer AFK.\n\r", ch);
      sprintf (buf, "#y%s #ris no longer AFK!#n", ch->name);
      do_info (ch, buf);
      REMOVE_BIT (ch->flag2, EXTRA_AFK);
      return;
   }
   else if (!IS_SET (ch->flag2, EXTRA_AFK))
   {
      send_to_char ("You are now AFK.\n\r", ch);
      if (argument[0] != '\0')
          sprintf (buf, "#y%s #ris now AFK!(#w%s#r)#n", ch->name, argument);
      else
          sprintf (buf, "#y%s #ris now AFK!#n", ch->name);
      do_info (ch, buf);
      SET_BIT (ch->flag2, EXTRA_AFK);
      WAIT_STATE (ch, 25);
      return;
   }
   return;

}
void do_busy (CHAR_DATA * ch, char *argument)
{

   if (IS_NPC (ch))
      return;

   if (IS_SET (ch->flag2, BUSY))
   {
      send_to_char ("You are no longer in DND mode.\n\r", ch);
      REMOVE_BIT (ch->flag2, BUSY);
      return;
   }
   else if (!IS_SET (ch->flag2, BUSY))
   {
      send_to_char ("You are now in DND mode.\n\r", ch);
      SET_BIT (ch->flag2, BUSY);
      return;
   }
   return;
}

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

   if (IS_NPC (ch))
      return;

   if (IS_SET (ch->flag2, EXTRA_CODING))
   {
      send_to_char ("You are no longer Coding.\n\r", ch);
      sprintf (buf, "#w%s #ris no longer Coding!#n", ch->name);
      do_info (ch, buf);
      REMOVE_BIT (ch->flag2, EXTRA_CODING);
      return;
   }

   else if (!IS_SET (ch->flag2, EXTRA_CODING))
   {
      send_to_char ("You are now Coding.\n\r", ch);
      sprintf (buf, "#w%s#r is now Coding!#n", ch->name);
      do_info (ch, buf);
      SET_BIT (ch->flag2, EXTRA_CODING);
      WAIT_STATE (ch, 25);
      return;
   }

   return;

}

/* Not working yet
void do_contact(CHAR_DATA *ch, char *argument)
{
    char arg[MIL];
    char buf[MSL];
            
    argument = one_argument(argument,arg);
            
    if (arg[0] == '\0')
    {
        sprintf(buf,"Your current contact information:\n\r");
        if (strlen(ch->pcdata->email) > 2)
            sprintf(buf + strlen(buf),"Email: %s%s\n\r",ch->pcdata->email,IS_CINVIS(ch,INVIS_EMAIL) ? " (Invis)" : "");
        if (strlen(ch->pcdata->aim) > 2)
            sprintf(buf + strlen(buf),"AIM  : %s%s\n\r",ch->pcdata->aim,IS_CINVIS(ch,INVIS_AIM) ? " (Invis)" : "");
        if (ch->pcdata->icq > 0)
            sprintf(buf + strlen(buf),"ICQ  : %d%s\n\r",ch->pcdata->icq,IS_CINVIS(ch,INVIS_ICQ) ? " (Invis)" : "");
        sprintf(buf + strlen(buf),"\n\rSyntax: contact <email/aim/icq> <[invis]/[information]>\n\rYou may clear a contact by leaving it blank\n\r", ch);

        stc(buf,ch);
        return;
    }
            
    if (str_cmp(arg,"email") && str_cmp(arg,"aim") && str_cmp(arg,"icq"))
    {
        send_to_char("Email, AIM, and ICQ are the only ones supported at the moment.\n\r",ch);
        return;
    }
        
    if (!str_cmp(argument,"invis"))
    {
        int invis;
     
        if (!str_cmp(arg,"email")) invis = INVIS_EMAIL;
        else if (!str_cmp(arg,"aim")) invis = INVIS_AIM;
        else if (!str_cmp(arg,"icq")) invis = INVIS_ICQ;
        else return;
            
        if (IS_CINVIS(ch,invis))
            REMOVE_BIT(ch->pcdata->cinvis,invis);
        else
            SET_BIT(ch->pcdata->cinvis,invis);
        stc("Done.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"email"))
    {
        stc("You may not change your email address. You may make it invis on finger by typing 'contact email invis'.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"aim"))
    {
        free_string(ch->pcdata->aim);
        if (argument[0] == '\0')
        {   
            stc("AIM information cleared.\n\r",ch);
            ch->pcdata->aim = str_dup("");
            return;
        }
        
        ch->pcdata->aim = str_dup(argument);
        stc("AIM information set.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"icq"))
    {
        int num;
        
        if (argument[0] == '\0')
        {   
            stc("ICQ information cleared.\n\r",ch);
            ch->pcdata->icq = 0;
            return;
        }
        if (!is_number(argument))
        {
            stc("ICQ contact info must be a number.\n\r",ch);
            return;
        }
        num = atoi(argument);
        ch->pcdata->icq = num;
        stc("ICQ information set.\n\r",ch);
        return;
    }
    do_contact(ch,"");
    return;
}
*/
void do_email (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;

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

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

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

/* Profile COde */
void do_profile (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH * 2];
   char arg1[MSL];

   one_argument (argument, arg1);

   if (!str_cmp (arg1, "edit"))
   {
      if (!IS_SET (ch->in_room->room_flags, ROOM_SAFE))
      {
	 stc ("You can only enter the editor in a safe room!\n\r", ch);
	 return;
      }
      string_append (ch, &ch->profile);
      return;
   }
   if (argument[0] != '\0')
   {
      buf[0] = '\0';
      smash_tilde (argument);
      if (!str_cmp (arg1, "clear"))
      {
	 free_string (ch->profile);
	 ch->profile = str_dup ("");
	 stc ("Profile Cleared!\n\r", ch);
	 return;
      }
      if (argument[0] == '+')
      {
	 if (ch->profile != NULL)
	    strcat (buf, ch->profile);
	 argument++;
	 while (isspace (*argument))
	    argument++;
      }

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

      strcat (buf, argument);
      strcat (buf, "\n\r");
      free_string (ch->profile);
      ch->profile = str_dup (buf);
   }

   send_to_char ("Your profile is:\n\r", ch);
   send_to_char (ch->profile ? ch->profile : "(None).\n\r", ch);
   do_save (ch, "");
   return;
}

void do_description (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];
   char arg1[MSL];
   one_argument (argument, arg1);

   if (!str_cmp (arg1, "edit"))
   {
      if (!IS_SET (ch->in_room->room_flags, ROOM_SAFE))
      {
	 stc ("You can only enter the editor in a safe room!\n\r", ch);
	 return;
      }
      string_append (ch, &ch->description);
      return;
   }
   if (argument[0] != '\0')
   {
      buf[0] = '\0';
      smash_tilde (argument);
      if (argument[0] == '+')
      {
	 if (ch->description != NULL)
	    strcat (buf, ch->description);
	 argument++;
	 while (isspace (*argument))
	    argument++;
      }

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

      strcat (buf, argument);
      strcat (buf, "\n\r");
      free_string (ch->description);
      ch->description = str_dup (buf);
   }

   send_to_char ("Your description is:\n\r", ch);
   send_to_char (ch->description ? ch->description : "(None).\n\r", ch);
   return;
}

void do_report (CHAR_DATA * ch, char *argument)
{
   CHAR_DATA *vch;
   CHAR_DATA *vch_next;
   char buf[MAX_STRING_LENGTH];
   char hit_str[MAX_INPUT_LENGTH];
   char mana_str[MAX_INPUT_LENGTH];
   char move_str[MAX_INPUT_LENGTH];
   char mhit_str[MAX_INPUT_LENGTH];
   char mmana_str[MAX_INPUT_LENGTH];
   char mmove_str[MAX_INPUT_LENGTH];
   char exp_str[MAX_INPUT_LENGTH];

   sprintf (hit_str, "%d", ch->hit);
   COL_SCALE (hit_str, ch, ch->hit, ch->max_hit);
   sprintf (mana_str, "%d", ch->mana);
   COL_SCALE (mana_str, ch, ch->mana, ch->max_mana);
   sprintf (move_str, "%d", ch->move);
   COL_SCALE (move_str, ch, ch->move, ch->max_move);
   sprintf (exp_str, "%s", set_comma (ch->exp));
   COL_SCALE (exp_str, ch, ch->exp, 1000);
   sprintf (mhit_str, "%d", ch->max_hit);
   ADD_COLOUR (ch, mhit_str, L_CYAN);
   sprintf (mmana_str, "%d", ch->max_mana);
   ADD_COLOUR (ch, mmana_str, L_CYAN);
   sprintf (mmove_str, "%d", ch->max_move);
   ADD_COLOUR (ch, mmove_str, L_CYAN);
   sprintf (buf, "You report: %s/%s hp %s/%s mana %s/%s mv %s xp.\n\r",
	    hit_str, mhit_str, mana_str, mmana_str, move_str, mmove_str,
	    exp_str);

   send_to_char (buf, ch);

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

bool is_skill (char *argument)
{
   if (skill_table[skill_lookup (argument)].spell_fun == spell_null)
      return TRUE;
   else
      return FALSE;
}

void do_practice (CHAR_DATA * ch, char *argument)
{

   char buf[MAX_STRING_LENGTH];
   int sn;
   char *coll[] = { "#P", "#r", "#b", "#g", "#y", "#n" };

   if (IS_NPC (ch))
      return;

   if (argument[0] == '\0')
   {
      loc_to_char (ch);


      {
	 int col;

	 col = 0;
	 /* 0 */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 0)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "locate object"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }

	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* 1 */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 1)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 2)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 3)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 4)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].spell_fun != spell_null)
	       continue;
	    if (ch->pcdata->learned[sn] == SKILL_ADEPT)
	       continue;
	    sprintf (buf, "#w%18s %3d%%#n  ",
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }

	 if (col % 3 != 0)
	    send_to_char ("\n\r", ch);
	 divide7_to_char (ch);
	 sprintf (buf,
                  "#wYou have '#r%lli#w' experience points left to spend.#n",
		  ch->exp);
	 cent_to_char (buf, ch);
	 cent_to_char
	    ("#wType '#rPRAC LIST#w' to list spells/skills you have already learned.#n",
	     ch);
	 divide7_to_char (ch);
	 return;
      }
   }
   if (!str_cmp (argument, "list"))
   {
      loc_to_char (ch);
      {

	 int col;

	 col = 0;
	 /* 0 */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 0)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* 1 */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 1)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 2)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 3)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 /* Purple */
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (skill_table[sn].spell_fun == spell_null)
	       continue;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].target != 4)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "%s%18s#w %3d%%#n  ",
		     coll[skill_table[sn].target],
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }
	 for (sn = 0; sn < MAX_SKILL; sn++)
	 {
	    if (skill_table[sn].name == NULL)
	       break;
	    if (ch->level < skill_table[sn].skill_level)
	       continue;
	    if (skill_table[sn].spell_fun != spell_null)
	       continue;
	    if (ch->pcdata->learned[sn] != SKILL_ADEPT)
	       continue;
	    if (IS_CLASS (ch, CLASS_HIGHLANDER))
	    {
	       if ((!is_name
		    (skill_table[sn].name,
		     "locate repair quest portal spellproof resistance preserve mend clot regenerate teleport"))
		   && (str_cmp (skill_table[sn].name, "dispel magic")))
		  continue;
	    }
	    sprintf (buf, "#w%18s %3d%%#n  ",
		     skill_table[sn].name, ch->pcdata->learned[sn]);
	    send_to_char (buf, ch);
	    if (++col % 3 == 0)
	       send_to_char ("\n\r", ch);
	 }

	 if (col % 3 != 0)
	    send_to_char ("\n\r", ch);
	 divide7_to_char (ch);
	 sprintf (buf,
		  "#wType '#rPRAC#w' to see spells and skills you haven't learned.");
	 cent_to_char (buf, ch);
	 divide7_to_char (ch);
	 return;
      }
   }
   else if (!strcmp (argument, "all"))
   {
      for (sn = 0; sn < MAX_SKILL; sn++)
      {
	 if (ch->exp < 5000)
	    break;
	 if ((skill_table[sn].name != NULL)
	     && (ch->level >= skill_table[sn].skill_level)
	     && ch->pcdata->learned[sn] < 100)
	 {
	    ch->pcdata->learned[sn] = 100;
	    ch->exp -= 5000;
	 }
      }
      send_to_char ("Ok.\n\r", ch);
      return;
   }
   else
   {
      if (!IS_AWAKE (ch))
      {
	 send_to_char ("In your dreams, or what?\n\r", ch);
	 return;
      }

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

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

      if (ch->pcdata->learned[sn] == SKILL_ADEPT)
      {
	 stc ("You have learned that skill, type 'prac list' to see all known skills.\n\r", ch);
	 return;
      }

      if (ch->pcdata->learned[sn] >= SKILL_ADEPT)
      {
	 sprintf (buf, "You are already an adept of %s.\n\r",
		  skill_table[sn].name);
	 send_to_char (buf, ch);
      }

      else if (ch->pcdata->learned[sn] > 0 && ch->exp < 5000)
      {
	 sprintf (buf, "You need 5000 exp to increase %s any more.\n\r",
		  (skill_table[sn].name));
	 send_to_char (buf, ch);
      }
      else if (ch->pcdata->learned[sn] == 0 && ch->exp < 5000)
      {
	 sprintf (buf, "You need 5000 exp to increase %s.\n\r",
		  skill_table[sn].name);
	 send_to_char (buf, ch);
      }
      else
      {
	 if (ch->pcdata->learned[sn] == 0)
	 {
	    ch->exp -= 5000;
	    ch->pcdata->learned[sn] += 100;
	 }
	 else
	 {
	    ch->exp -= (ch->pcdata->learned[sn] / 2);
	    ch->pcdata->learned[sn] += int_app[get_curr_int (ch)].learn;
	 }
	 if (ch->pcdata->learned[sn] < SKILL_ADEPT)
	 {
	    act ("You practice $T.", ch, NULL, skill_table[sn].name, TO_CHAR);
	 }
	 else
	 {
	    ch->pcdata->learned[sn] = SKILL_ADEPT;
	    act ("You study the art of '$T' for a short while and become an adept of it.", ch, NULL, skill_table[sn].name, TO_CHAR);
	 }
      }
   }
   return;
}

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

   one_argument (argument, arg);

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

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

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

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

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

   if (IS_NPC (ch))
      return;

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

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

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

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

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

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

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

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

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

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

   free_string (ch->pcdata->pwd);
   ch->pcdata->pwd = str_dup (pwdnew);
   if (!IS_EXTRA (ch, EXTRA_NEWPASS))
      SET_BIT (ch->extra, EXTRA_NEWPASS);
   save_char_obj (ch);
   if (ch->desc != NULL && ch->desc->connected == CON_PLAYING)
      send_to_char ("Ok.\n\r", ch);
   return;
}
void do_xsocials(CHAR_DATA *ch, char *argument)
{
    char buf[MAX_STRING_LENGTH];
    int iSocial;
    int col;
   
    col = 0;
  
    for (iSocial = 0; xsocial_table[iSocial].name[0] != '\0'; iSocial++) {
                sprintf(buf, "%-12s", xsocial_table[iSocial].name);
                send_to_char(buf, ch);
                if (++col % 6 == 0)
                        send_to_char("\n\r", ch);
                if (iSocial >= 100) break;
        }
  
    if (col % 6 != 0)
    send_to_char("\n\r", ch);
  
    return;
}  
void do_spells (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];
   int sn;
   int col;

   col = 0;
   for (sn = 0; sn < MAX_SKILL && skill_table[sn].name != NULL; sn++)
   {
      sprintf (buf, "%-12s", skill_table[sn].name);
      send_to_char (buf, ch);
      if (++col % 6 == 0)
	 send_to_char ("\n\r", ch);
   }

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

        
struct sort_struct {
  int sort_pos;
} *cmd_sort_info = NULL;
 
int num_of_cmds;

void sort_commands(void)
{
  int a, b, tmp;

  num_of_cmds = 0;
    
  /*
   * first, count commands (num_of_commands is actually one greater than
   * the number of commands; it inclues the '\n'.
   */
  while(cmd_table[num_of_cmds].name[0] != '\0')
    num_of_cmds++;
     
  /* create data array */
  CREATE(cmd_sort_info, struct sort_struct, num_of_cmds);
        
  /* initialize it */
  for (a = 1; a < num_of_cmds; a++) {
    cmd_sort_info[a].sort_pos = a;  
  }
                
  for (a = 0; a < num_of_cmds; a++)
    for (b = a + 1; b < num_of_cmds; b++)
      if (strcmp(cmd_table[cmd_sort_info[a].sort_pos].name,
                 cmd_table[cmd_sort_info[b].sort_pos].name) > 0) {
        tmp = cmd_sort_info[a].sort_pos;
        cmd_sort_info[a].sort_pos = cmd_sort_info[b].sort_pos;
        cmd_sort_info[b].sort_pos = tmp;
      }
}
/*
 * Contributed by Alander.
 *
 */
void do_commands (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];
   char cbuf[MAX_STRING_LENGTH];
   int cmd;
   int col;
   col = 0;

   loc_to_char (ch);
   for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
   {
      if (cmd_table[cmd].level == 0 && cmd_table[cmd].level <= get_trust (ch))
      {
	 sprintf (buf, "#w%-15s#n", cmd_table[cmd].name);
	 send_to_char (buf, ch);
	 if (++col % 5 == 0)
	    send_to_char ("\n\r", ch);
      }
   }

   if (col % 5 != 0)
      send_to_char ("\n\r", ch);
   divide7_to_char (ch);
   sprintf(cbuf, "#r%d#w Commands found#n", col);
   cent_to_char(cbuf, ch); 
  divide7_to_char (ch);
   return;
}

void do_channels (CHAR_DATA * ch, char *argument)
{
   char arg[MAX_INPUT_LENGTH];

   one_argument (argument, arg);

   if (IS_NPC (ch))
      return;
   if (arg[0] == '\0')
   {
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
      {
	 send_to_char ("You are silenced.\n\r", ch);
	 return;
      }

      send_to_char ("Channels:\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_ALL)
		    ? "[ +ALL        ] ALL channels are ON\n\r"
		    : "[ -all        ] ALL channels are OFF\n\r", ch);
      send_to_char (!IS_SET (ch->deaf, CHANNEL_NEWBIE)
		    ? "[ +NEWBIE     ] NEWBIE channel is ON\n\r"
		    : "[ -newbie     ] NEWBIE channel is OFF\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_CHAT)
		    ? "[ +CHAT       ] CHAT channel is ON\n\r"
		    : "[ -chat       ] CHAT channel is OFF\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_FLAME)
		    ? "[ +FLAME      ] FLAME channel is ON\n\r"
		    : "[ -flame      ] FLAME channel is OFF\n\r", ch);

      if (IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_IMMTALK)
		       ? "[ +IMMTALK    ] IMMTALK channel is ON\n\r"
		       : "[ -immtalk    ] IMMTALK channel is OFF\n\r", ch);
      }

      if ((ch->clannum > 0) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_CLANTALK)
		       ? "[ +CLANTALK   ] CLANTALK channel is ON\n\r"
		       : "[ -clantalk   ] CLANTALK channel is OFF\n\r", ch);
      }
/*
      if (get_kingdom_char (ch->name) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_KTALK)
		       ? "[ +KTALK      ] KINGDOM channel is ON\n\r"
		       : "[ -ktalk      ] KINGDOM channel is OFF\n\r", ch);
      }
*/
      send_to_char (!IS_SET (ch->deaf, CHANNEL_MUSIC)
		    ? "[ +MUSIC      ] MUSIC channel is ON\n\r"
		    : "[ -music      ] MUSIC channel is OFF\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_QUESTION)
		    ? "[ +QUESTION   ] QUESTION channel is ON\n\r"
		    : "[ -question   ] QUESTION channel is OFF\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_SHOUT)
		    ? "[ +SHOUT      ] SHOUT channel is ON\n\r"
		    : "[ -shout      ] SHOUT channel is OFF\n\r", ch);
      send_to_char (!IS_SET (ch->deaf, CHANNEL_TELL)
		    ? "[ +TELL       ] TELL channel is ON\n\r"
		    : "[ -tell       ] TELL channel is OFF\n\r", ch);
      send_to_char (!IS_SET (ch->newbits, NEW_NOREPLY)
		    ? "[ +REPLY      ] You receive REPLIES\n\r"
		    : "[ -reply      ] You dont receive REPLIES\n\r", ch);
      send_to_char (!IS_SET (ch->deaf, CHANNEL_INFO)
		    ? "[ +INFO       ] INFO channel is ON\n\r"
		    : "[ -info       ] INFO channel is OFF\n\r", ch);

      send_to_char (!IS_SET (ch->deaf, CHANNEL_HOWL)
		    ? "[ +HOWL       ] HOWL channel is ON\n\r"
		    : "[ -howl       ] HOWL channel is OFF\n\r", ch);

      if (IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_LOG)
		       ? "[ +LOG        ] LOG channel is ON\n\r"
		       : "[ -log        ] LOG channel is OFF\n\r", ch);
      }
      if (IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_PLOG)
		       ? "[ +PLOG       ] PLAYER LOG channel is ON\n\r"
		       : "[ -plog       ] PLAYER LOG channel is OFF\n\r", ch);
      }

      if (IS_SET (ch->newbits, NEW_FTALK) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_FTALK)
		       ? "[ +FTALK      ] FTALK channel is ON\n\r"
		       : "[ -ftalk      ] FTALK channel is OFF\n\r", ch);
      }
      if (IS_SET (ch->newbits, NEW_CLANLEADER)
	  || (ch->pcdata->kingrank == 5) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_FOUNDERTALK)
		       ? "[ +FOUNDER    ] FOUNDERTALK channel is ON\n\r"
		       : "[ -founder    ] FOUNDERTALK channel is OFF\n\r",
		       ch);
      }

      if (IS_CLASS (ch, CLASS_DEMON) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_PRAY)
		       ? "[ +PRAY       ] PRAY channel is ON\n\r"
		       : "[ -pray       ] PRAY channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_MAGE) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_MAGETALK)
		       ? "[ +MAGE       ] MAGETALK channel is ON\n\r"
		       : "[ -mage       ] MAGETALK channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_MONK) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_MONK)
		       ? "[ +MONK       ] MONKTALK channel is ON\n\r"
		       : "[ -monk       ] MONKTALk channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_NINJA) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_MIKTALK)
		       ? "[ +MIKTALK    ] NINJATALK channel is ON\n\r"
		       : "[ -miktalk    ] NINKATALK channel is OFF\n\r", ch);
      }
      if (IS_CLASS (ch, CLASS_WRAITH) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_WRAITH)
		       ? "[ +WAIL       ] WRAITHTALK channel is ON\n\r"
		       : "[ -wail       ] WRAITHTALK channel is OFF", ch);
      }

      if (IS_CLASS (ch, CLASS_PHOENIX) || IS_IMMORTAL (ch))
      {
         send_to_char (!IS_SET (ch->deaf, CHANNEL_PTALK)
                       ? "[ +PCRY       ] PHOENIXCRY channel is ON\n\r"
                       : "[ -pcry       ] PHOENIXCRY channel is OFF", ch);
      }

//BASTETADDITION
      if (IS_CLASS (ch, CLASS_BASTET) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_PURR)
		       ? "[ +PURR       ] PURRR channel is ON\n\r"
		       : "[ -PURR       ] PURRR channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_VAMPIRE) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_VAMPTALK)
		       ? "[ +VAMP       ] VAMPTALK channel is ON\n\r"
		       : "[ -vamp       ] VAMPTALK channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_HIGHLANDER) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_HIGHTALK)
		       ? "[ +HIGH       ] HIGHTALK channel is ON\n\r"
		       : "[ -high       ] HIGHTALK channel is OFF\n\r", ch);
      }

      if (IS_CLASS (ch, CLASS_DROW) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->deaf, CHANNEL_SIGN)
		       ? "[ +SIGN       ] DROWTALK channel is ON\n\r"
		       : "[ -sign       ] DROWTALK channel is OFF\n\r", ch);
      }
      if (IS_CLASS (ch, CLASS_DRAGON) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->extra2, DEAF_ROAR)
		       ? "[ +ROAR       ] DRAGONTALK channel is ON\n\r"
		       : "[ -roar       ] DRAGONTALK channel is OFF\n\r", ch);
      }
      if (IS_CLASS (ch, CLASS_FAE) || IS_IMMORTAL (ch))
      {
	 send_to_char (!IS_SET (ch->extra2, DEAF_DREAMT)
		       ? "[ +DREAMTALK  ] DREAMTALK channel is ON\n\r"
		       : "[ -DREAMTALK  ] DREAMTALK channel is OFF\n\r", ch);
      }


      send_to_char ("\n\r", ch);
   }
   else
   {
      bool fClear;
      int bit;

      if (arg[0] == '+')
	 fClear = TRUE;
      else if (arg[0] == '-')
	 fClear = FALSE;
      else
      {
	 send_to_char ("Channels -channel or +channel?\n\r", ch);
	 return;
      }

      if (!str_cmp (arg + 1, "newbie"))
	 bit = CHANNEL_NEWBIE;
      else if (!str_cmp (arg + 1, "clantalk"))
	 bit = CHANNEL_CLANTALK;
      else if (!str_cmp (arg + 1, "ktalk"))
	 bit = CHANNEL_KTALK;
      else if (!str_cmp (arg + 1, "chat"))
	 bit = CHANNEL_CHAT;
      else if (!str_cmp (arg + 1, "flame"))
	 bit = CHANNEL_FLAME;
      else if (!str_cmp (arg + 1, "immtalk"))
	 bit = CHANNEL_IMMTALK;
      else if (!str_cmp (arg + 1, "music"))
	 bit = CHANNEL_MUSIC;
      else if (!str_cmp (arg + 1, "question"))
	 bit = CHANNEL_QUESTION;
      else if (!str_cmp (arg + 1, "shout"))
	 bit = CHANNEL_SHOUT;
      else if (!str_cmp (arg + 1, "yell"))
	 bit = CHANNEL_YELL;
      else if (!str_cmp (arg + 1, "howl"))
	 bit = CHANNEL_HOWL;
      else if (IS_IMMORTAL (ch) && !str_cmp (arg + 1, "log"))
	 bit = CHANNEL_LOG;
      else if (IS_IMMORTAL (ch) && !str_cmp (arg + 1, "plog"))
	 bit = CHANNEL_PLOG;
      else if (!str_cmp (arg + 1, "pray"))
	 bit = CHANNEL_PRAY;
      else if (!str_cmp (arg + 1, "info"))
	 bit = CHANNEL_INFO;
      else if (!str_cmp (arg + 1, "vamp"))
	 bit = CHANNEL_VAMPTALK;
      else if (!str_cmp (arg + 1, "tell"))
	 bit = CHANNEL_TELL;
      else if (!str_cmp (arg + 1, "mage"))
	 bit = CHANNEL_MAGETALK;
      else if (!str_cmp (arg + 1, "high"))
	 bit = CHANNEL_HIGHTALK;
      else if (!str_cmp (arg + 1, "sign"))
	 bit = CHANNEL_SIGN;
      else if (!str_cmp (arg + 1, "monk"))
	 bit = CHANNEL_MONK;
      else if (!str_cmp (arg + 1, "miktalk"))
	 bit = CHANNEL_MIKTALK;
      else if (!str_cmp (arg + 1, "ptalk"))
         bit = CHANNEL_PTALK;
      else if (!str_cmp (arg + 1, "wail"))
	 bit = CHANNEL_WRAITH;
//BASTETADDITION
      else if (!str_cmp (arg + 1, "purr"))
	 bit = CHANNEL_PURR;
      else if (!str_cmp (arg + 1, "reply"))
	 bit = NEW_NOREPLY;
      else if (!str_cmp (arg + 1, "roar"))
	 bit = DEAF_ROAR;
      else if (!str_cmp (arg + 1, "dreamtalk"))
	 bit = DEAF_DREAMT;
      else if (!str_cmp (arg + 1, "ftalk"))
	 bit = CHANNEL_FTALK;
      else if (!str_cmp (arg + 1, "founder"))
	 bit = CHANNEL_FOUNDERTALK;
      else if (!str_cmp (arg + 1, "all"))
	 bit = CHANNEL_ALL;
      else
      {
	 send_to_char ("Set or clear which channel?\n\r", ch);
	 return;
      }

      if (!str_cmp (arg + 1, "roar"))
      {
	 if (fClear)
	    REMOVE_BIT (ch->extra2, bit);
	 else
	    SET_BIT (ch->extra2, bit);
      }
      else if (!str_cmp (arg + 1, "dreamtalk"))
      {
	 if (fClear)
	    REMOVE_BIT (ch->extra2, bit);
	 else
	    SET_BIT (ch->extra2, bit);
      }
      else if (!str_cmp (arg + 1, "reply"))
      {
	 if (fClear)
	    REMOVE_BIT (ch->newbits, bit);
	 else
	    SET_BIT (ch->newbits, bit);
      }
      else
      {
	 if (fClear)
	    REMOVE_BIT (ch->deaf, bit);
	 else
	    SET_BIT (ch->deaf, bit);
      }
      send_to_char ("Ok.\n\r", ch);
   }

   return;
}

/*
 * Contributed by Grodyn.
 */
void do_config (CHAR_DATA * ch, char *argument)
{
   char arg[MAX_INPUT_LENGTH];

   if (IS_NPC (ch))
      return;

   one_argument (argument, arg);

   if (arg[0] == '\0')
   {
      send_to_char ("[ Keyword  ] Option\n\r", ch);

      send_to_char (IS_SET (ch->act, PLR_ANSI) ?
		    "[#g+ANSI#n     ] You have ansi colour on.\n\r" :
		    "[#r-ansi#n     ] You have ansi colour off.\n\r", ch);

//Unique additions
/*
      send_to_char (IS_SET (ch->act, PLR_AUTOBACKUP) ?
		    "[#g+BACKUP#n   ] You automatically backup on logout.\n\r"
		    : "[#r-backup#n   ] You do not backup on logout.\n\r",
		    ch);
*/
      send_to_char (IS_SET (ch->more, SHORT_COMBAT) ?
		    "[#g+SHORT#n    ] Your combat is shortened.\n\r" :
		    "[#r-short#n    ] You see long combat messages.\n\r", ch);

      send_to_char (IS_SET (ch->act, PLR_AUTOEXIT) ?
		    "[#g+AUTOEXIT#n ] You automatically see exits.\n\r" :
		    "[#r-autoexit#n ] You don't automatically see exits.\n\r",
		    ch);

      send_to_char (IS_SET (ch->more, PLR_AUTOGOLD) ?
		    "[#g+AUTOGOLD#n ] You automatically loot gold from corpses.\n\r"
		    :
		    "[#r-autogold#n ] You don't automatically loot gold from corpses.\n\r",
		    ch);
      send_to_char (IS_SET (ch->act, PLR_AUTOLOOT) ?
		    "[#g+AUTOLOOT#n ] You automatically loot corpses.\n\r" :
		    "[#r-autoloot#n ] You don't automatically loot corpses.\n\r",
		    ch);

      if (!IS_CLASS (ch, CLASS_DRAGON))
         send_to_char (IS_SET (ch->act, PLR_AUTOSAC) ?
		    "[#g+AUTOSAC#n  ] You automatically sacrifice corpses and heads.\n\r"
		    :
                    "[#r-autosac#n  ] You don't automatically sacrifice corpses and heads.\n\r",
		    ch);
      else
         send_to_char (IS_SET (ch->act, PLR_AUTOSAC) ?
                    "[#g+AUTOSAC#n  ] You automatically consume corpses and sacrifice heads.\n\r"
		    :
                    "[#r-autosac#n  ] You don't automatically consume corpses and sacrifice heads.\n\r",
		    ch);

      send_to_char (IS_SET (ch->act, PLR_BLANK) ?
		    "[#g+BLANK#n    ] You have a blank line before your prompt.\n\r"
		    :
		    "[#r-blank#n    ] You have no blank line before your prompt.\n\r",
		    ch);

      send_to_char (IS_SET (ch->act, PLR_BRIEF) ?
		    "[#g+BRIEF#n    ] You see brief fighting messages.\n\r" :
		    "[#r-brief#n    ] You see long fighting messages.\n\r",
		    ch);

      send_to_char (IS_SET (ch->act, PLR_COMBINE) ?
		    "[#g+COMBINE#n  ] You see object lists in combined format.\n\r"
		    :
		    "[#r-combine#n  ] You see object lists in single format.\n\r",
		    ch);

      send_to_char (IS_SET (ch->act, PLR_PROMPT) ?
		    "[#g+PROMPT#n   ] You have a prompt.\n\r" :
		    "[#r-prompt#n   ] You don't have a prompt.\n\r", ch);

      send_to_char (IS_SET (ch->act, PLR_TELNET_GA) ?
		    "[#g+TELNETGA#n ] You receive a telnet GA sequence.\n\r" :
		    "[#r-telnetga#n ] You don't receive a telnet GA sequence.\n\r",
		    ch);

      send_to_char (IS_SET (ch->more, MORE_NODESC) ?
		    "[#r-desc#n     ] You dont see room descriptions.\n\r" :
		    "[#g+DESC#n     ] You see room descriptions.\n\r", ch);

      send_to_char (IS_SET (ch->more, MORE_SHIELDS) ?
		    "[#r-shield#n   ] You dont see shields combat.\n\r" :
		    "[#g+SHIELD#n   ] You see shields in combat.\n\r", ch);

      send_to_char (IS_SET (ch->act, PLR_SILENCE) ?
		    "[#g+SILENCE  ] You are silenced.\n\r" : "", ch);

      send_to_char (!IS_SET (ch->act, PLR_NO_EMOTE) ? "" :
		    "[#r-emote#n    ] You can't emote.\n\r", ch);

      send_to_char (!IS_SET (ch->act, PLR_NO_TELL) ? "" :
		    "[#r-tell#n     ] You can't use 'tell'.\n\r", ch);
      send_to_char (IS_SET (ch->more, PLR_COMB_EXP) ?
		    "[#g+COMBEXP#n  ] Your experience is combined into one sum.\n\r"
		    :
		    "[#r-combexp#n  ] Your experience is not combined into one sum.\n\r",
		    ch);
      send_to_char (IS_SET (ch->more, PLR_SEE_REGEN) ?
		    "[#g+SEEREGEN#n ] You see pulse based regeneration messages.\n\r"
		    :
		    "[#r-seeregen#n ] You do not see pulse based regeneration messages.\n\r",
		    ch);
      send_to_char (!IS_SET (ch->pcdata->cinvis, INVIS_PROFILE) ?
		    "[#g+PROFILE#n  ] You see others profiles in finger command.\n\r"
		    :
		    "[#r-profile#n  ] You do not see others profiles in finger command.\n\r",
		    ch);
      send_to_char (IS_SET (ch->more, PLR_SEE_DAMAGE) ?
		    "[#g+DAMAGE#n   ] You see *'s on 'eq' to show equipment damage.\n\r"
		    :
		    "[#r-damage#n   ] You do not see *'s on 'eq' to show equipment damage.\n\r",
		    ch);
      send_to_char (!IS_SET (ch->more, MORE_CCHANNELS) ?
                    "[#g+CCHANNELS#n] You see the immortals' channel colours.\n\r"
		    :
                    "[#r-cchannels#n] You do not see the immortals' channel colours.\n\r",
		    ch);
   }
   else
   {
      bool fSet;
      int bit;

      if (arg[0] == '+')
	 fSet = TRUE;
      else if (arg[0] == '-')
	 fSet = FALSE;
      else
      {
	 send_to_char ("Config -option or +option?\n\r", ch);
	 return;
      }

      if (!str_cmp (arg + 1, "ansi"))
	 bit = PLR_ANSI;
//Unique additions
      else if (!str_cmp (arg + 1, "short"))
	 bit = SHORT_COMBAT;
      //else if (!str_cmp (arg + 1, "backup"))
	// bit = PLR_AUTOBACKUP;
      else if (!str_cmp (arg + 1, "autoexit"))
	 bit = PLR_AUTOEXIT;
      else if (!str_cmp (arg + 1, "autoloot"))
	 bit = PLR_AUTOLOOT;
      else if (!str_cmp (arg + 1, "autosac"))
	 bit = PLR_AUTOSAC;
      else if (!str_cmp (arg + 1, "blank"))
	 bit = PLR_BLANK;
      else if (!str_cmp (arg + 1, "brief"))
	 bit = PLR_BRIEF;
      else if (!str_cmp (arg + 1, "combine"))
	 bit = PLR_COMBINE;
      else if (!str_cmp (arg + 1, "prompt"))
	 bit = PLR_PROMPT;
      else if (!str_cmp (arg + 1, "telnetga"))
	 bit = PLR_TELNET_GA;
      else if (!str_cmp (arg + 1, "desc"))
	 bit = MORE_NODESC;
      else if (!str_cmp (arg + 1, "autogold"))
	 bit = PLR_AUTOGOLD;
      else if (!str_cmp (arg + 1, "shield"))
	 bit = MORE_SHIELDS;
      else if (!str_cmp (arg + 1, "combexp"))
	 bit = PLR_COMB_EXP;
      else if (!str_cmp (arg + 1, "seeregen"))
	 bit = PLR_SEE_REGEN;
      else if (!str_cmp (arg + 1, "damage"))
	 bit = PLR_SEE_DAMAGE;
      else if (!str_cmp (arg + 1, "profile"))
	 bit = INVIS_PROFILE;
      else if (!str_cmp (arg + 1, "cchannels"))
         bit = MORE_CCHANNELS;
      else
      {
	 send_to_char ("Config which option?\n\r", ch);
	 return;
      }
      if (!str_cmp (arg + 1, "desc")
       || !str_cmp (arg + 1, "cchannels")
       || !str_cmp (arg + 1, "shield"))
      {
	 if (fSet)
	    REMOVE_BIT (ch->more, bit);
	 else
	    SET_BIT (ch->more, bit);
      }
      else if (!str_cmp (arg + 1, "profile"))
      {
	 if (fSet)
	    REMOVE_BIT (ch->pcdata->cinvis, bit);
	 else
	    SET_BIT (ch->pcdata->cinvis, bit);
      }
      else if (!str_cmp (arg + 1, "combexp")
            || !str_cmp (arg + 1, "seeregen")
            || !str_cmp (arg + 1, "damage")
            || !str_cmp (arg + 1, "autogold")
            || !str_cmp (arg + 1, "short"))
      {
	 if (fSet)
	    SET_BIT (ch->more, bit);
	 else
	    REMOVE_BIT (ch->more, bit);
      }
//Unique additions
      else
      {
	 if (fSet)
	    SET_BIT (ch->act, bit);
	 else
	    REMOVE_BIT (ch->act, bit);
      }
      send_to_char ("Ok.\n\r", ch);
   }

   return;
}

void do_nodesc (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->more, MORE_NODESC))
      REMOVE_BIT (ch->more, MORE_NODESC);

   else
      SET_BIT (ch->more, MORE_NODESC);

   stc ("Done.\n\r", ch);
   return;
}
void do_autotick (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (!IS_SET (ch->act, PLR_AUTOTICK))
   {
      SET_BIT (ch->act, PLR_AUTOTICK);
      stc ("You will now see Ticks!\n\r", ch);
   }
   else
   {
      REMOVE_BIT (ch->act, PLR_AUTOTICK);
      stc ("You no longer will see Ticks!\n\r", ch);
   }

   return;
}

void do_automessage (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->more, MORE_MESSAGE))
   {
      REMOVE_BIT (ch->more, MORE_MESSAGE);
      stc ("You will now see Atmospherics!\n\r", ch);

   }
   else
   {
      SET_BIT (ch->more, MORE_MESSAGE);
      stc ("You no longer will see Atmospherics!\n\r", ch);
   }

   return;
}

void do_ansi (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_ANSI))
      do_config (ch, "-ansi");
   else
      do_config (ch, "+ansi");
   return;
}

void do_autoexit (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_AUTOEXIT))
      do_config (ch, "-autoexit");
   else
      do_config (ch, "+autoexit");
   return;
}

void do_autoloot (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_AUTOLOOT))
      do_config (ch, "-autoloot");
   else
      do_config (ch, "+autoloot");
   return;
}

void do_auto_combined_exp (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->more, PLR_COMB_EXP))
   {
      do_config (ch, "-combexp");
      stc ("You NO LONGER see your experience grouped together.\n\r", ch);
   }
   else
   {
      do_config (ch, "+combexp");
      stc ("You now see your experience grouped together.\n\r", ch);
   }
   return;
}

void do_auto_see_regen (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->more, PLR_SEE_REGEN))
   {
      do_config (ch, "-seeregen");
      stc ("You NO LONGER see pulse based regeneration messages.\n\r", ch);
   }
   else
   {
      do_config (ch, "+seeregen");
      stc ("You now see pulse based regeneration messages.\n\r", ch);
   }
   return;
}

//Unique additions
void do_autobackup (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
/*
   if (IS_SET (ch->act, PLR_AUTOBACKUP))
      do_config (ch, "-backup");
   else
      do_config (ch, "+backup");
*/
   return;
}

void do_autogold (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->more, PLR_AUTOGOLD))
      do_config (ch, "-autogold");
   else
      do_config (ch, "+autogold");
   return;
}

void do_autosac (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_AUTOSAC))
      do_config (ch, "-autosac");
   else
      do_config (ch, "+autosac");
   return;
}

void do_blank (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_BLANK))
      do_config (ch, "-blank");
   else
      do_config (ch, "+blank");
   return;
}

void do_brief (CHAR_DATA * ch, char *argument)
{
   if (IS_NPC (ch))
      return;
   if (IS_SET (ch->act, PLR_BRIEF))
      do_config (ch, "-brief");
   else
      do_config (ch, "+brief");
   return;
}

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

   argument = one_argument (argument, arg);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      switch (obj->pIndexData->vnum)	// Add new artifact idents here
      {
      case ARTI_SHATTERED_BLADE:
	 {
	    stc ("You have been shattered and are continously regenerating the slivers that break off in combat.\n\r", ch);
	    break;
	 }
      }

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

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

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

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

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

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

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

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

/* Do_prompt from Morgenes from Aldara Mud */
void do_prompt (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];

   buf[0] = '\0';
   if (IS_NPC (ch))
      return;

   if (argument[0] == '\0')
   {
      do_help (ch, "prompt");
      return;
   }

   if (!strcmp (argument, "on"))
   {
      if (IS_EXTRA (ch, EXTRA_PROMPT))
	 send_to_char ("But you already have customised prompt on!\n\r", ch);
      else
      {
	 send_to_char ("Ok.\n\r", ch);
	 SET_BIT (ch->extra, EXTRA_PROMPT);
      }
      return;
   }
   else if (!str_cmp (argument, "werewolf"))
   {
      do_prompt (ch, "<[%xX] [%RR] [%hH %mM %vV]>");
      stc ("Default Werewolf Prompt Set\n\r", ch);
      return;
   }
   else if (!str_cmp (argument, "vampire"))
   {
      do_prompt (ch, "<[%xX] [%BB] [%hH %mM %vV]>");
      stc ("Default Vampire Prompt Set\n\r", ch);
      return;
   }
   else if (!str_cmp (argument, "demon"))
   {
      do_prompt (ch, "<[%xX] [%dDP] [%hH %mM %vV]>");
      stc ("Default Demon Prompt Set\n\r", ch);
      return;
   }

   else if (!str_cmp (argument, "immortal") && IS_IMMORTAL (ch))
   {
      do_prompt (ch, "<[%xX] [%Z] [%hH %mM %vV]>");
      stc ("Default Immortal Prompt Set\n\r", ch);
      return;
   }
/*
   else if( !str_cmp(argument, "full") )
   {
	do_prompt(ch, "<[%xX] [%cAc] [%PHr] [%pDr] [%AAl] [%h/%HH %m/%MM %v/%VV]>");
        stc("FULL Stat prompt Set\n\r", ch);
        return;
   }
*/

   else if (!strcmp (argument, "off"))
   {
      if (!IS_EXTRA (ch, EXTRA_PROMPT))
	 send_to_char ("But you already have customised prompt off!\n\r", ch);
      else
      {
	 send_to_char ("Ok.\n\r", ch);
	 REMOVE_BIT (ch->extra, EXTRA_PROMPT);
      }
      return;
   }
   else if (!strcmp (argument, "clear"))
   {
      free_string (ch->prompt);
      ch->prompt = str_dup ("");
      return;
   }
   else
   {
      if (strlen (argument) > 50)
      {
	 argument[50] = '\0';
	 stc ("Prompt cut to 50 characters long\n\r", ch);
      }
      smash_tilde (argument);
      strcat (buf, argument);

   }

   free_string (ch->prompt);
   ch->prompt = str_dup (buf);
   send_to_char ("Ok.\n\r", ch);
   return;
}

/* Do_prompt from Morgenes from Aldara Mud */
void do_cprompt (CHAR_DATA * ch, char *argument)
{
   char buf[MAX_STRING_LENGTH];

   buf[0] = '\0';
   if (IS_NPC (ch))
      return;

   if (argument[0] == '\0')
   {
      do_help (ch, "cprompt");
      return;
   }

   if (!strcmp (argument, "clear"))
   {
      free_string (ch->cprompt);
      ch->cprompt = str_dup ("");
      return;
   }
   else
   {
      if (strlen (argument) > 50)
	 argument[50] = '\0';
      smash_tilde (argument);
      strcat (buf, argument);
   }

   free_string (ch->cprompt);
   ch->cprompt = str_dup (buf);
   send_to_char ("Ok.\n\r", ch);
   return;
}