/* Version 1.0 */

/* This is a replacement for do_score in act_info.c.  Some players
   love the old way due to low bandwith etc.  If you switch into a
   mob, this score will tell you to use the OLD score function as this
   is specific to characters.  I renamed the old score function to
   do_oldscore.

   This uses Lopes color code.  It really does look nice and smooth
   when you look at this code.

   It is free.. use it, modify it.  You can give me some credit if you
   wish.  I have a Help snippet on my MUD that lists all the snippets
   arthurs and what they wrote or helped write.  I suggest you do the
   same.  It makes the users see how much the ROM community
   contributes to your mud.

*/



/* This is NEW score listing for The Mage's Lair */
void do_score( CHAR_DATA *ch, char *argument )
{
  char buf[MAX_STRING_LENGTH];
  int i;

  if (IS_NPC(ch))
    {
      send_to_char("Use the OLD score function\n\r",ch);
      return;
    }
    
  send_to_char("{Y------------------------------------------------------------------{x\n\r",ch);
  printf_to_char(ch,
		 "{cYou are {W%s%s{c, level {W%d{c, {W%d {cyears old ({W%d{c hours).\n\r",
		 ch->name,
		 IS_NPC(ch) ? "" : ch->pcdata->title,
		 ch->level, get_age(ch),
		 ( ch->played + (int) (current_time - ch->logon) ) / 3600);

    
  if ( get_trust( ch ) != ch->level )
    {
      printf_to_char(ch, "{cYou are trusted at level {W%d{c.\n\r",
		     get_trust( ch ) );
    }

  printf_to_char(ch, "{cRace: {W%s  {cSex: {W%s  {cClass: {W%s\n\r",
		 race_table[ch->race].name,
		 ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female",
		 IS_NPC(ch) ? "mobile" : class_table[ch->class].name);
  if (ch->clan) { 
    printf_to_char(ch, "{cClan:{x %s  {cRank:{x %s\n\r",
		   clan_table[ch->clan].who_name,
		   clan_rank_table[ch->pcdata->clan_rank].title_of_rank[ch->sex]);
  }
  printf_to_char(ch,
		 "{cStr: {W%d(%d)  {cInt: {W%d(%d)  {cWis: {W%d(%d)  {cDex: {W%d(%d)  {cCon: {W%d(%d)\n\r",
		 ch->perm_stat[STAT_STR],
		 get_curr_stat(ch,STAT_STR),
		 ch->perm_stat[STAT_INT],
		 get_curr_stat(ch,STAT_INT),
		 ch->perm_stat[STAT_WIS],
		 get_curr_stat(ch,STAT_WIS),
		 ch->perm_stat[STAT_DEX],
		 get_curr_stat(ch,STAT_DEX),
		 ch->perm_stat[STAT_CON],
		 get_curr_stat(ch,STAT_CON) );
	
  if ( ch->level >= 15 )
    {
      printf_to_char(ch,
		     "{cToHit: {W%-9d                            {cToDam: {W%d\n\r",
		     GET_HITROLL(ch), GET_DAMROLL(ch) );
    }
  printf_to_char(ch,
		 "{cHP: {W%5d/%-5d                             {cPracs: {W%d \n\r",
		 ch->hit,  ch->max_hit,
		 ch->practice);

  printf_to_char(ch,
		 "{cMANA: {W%5d/%-5d                           {cTrains: {W%d \n\r",
		 ch->mana, ch->max_mana,
		 ch->train);
  printf_to_char(ch,
		 "{cMOVE: {W%5d/%-5d                           {cItems: {W%d/%d \n\r",
		 ch->move, ch->max_move,
		 ch->carry_number, can_carry_n(ch));
  printf_to_char(ch,
		 "{cGlory: {W%-9d                            {cWeight: {W%d/%d \n\r",
		 ch->pcdata->quest_curr,
		 get_carry_weight(ch) / 10, can_carry_w(ch) /10 );

  /*
   * This section (exp, gold, balance and shares) was written by
   * The Maniac from Mythran Mud
   */
  if (IS_NPC(ch))             /* NPC's have no bank balance and shares */
    {                           /* and don't level !!       -- Maniac -- */
      printf_to_char(ch,
		     "You have scored %d exp, and have %ld gold coins\n\r",
		     ch->exp,  ch->gold );
    }

  if (!IS_NPC(ch))            /* PC's do level and can have bank accounts */
    {                           /* HERO's don't level anymore               */
      printf_to_char(ch,
		     "{cExp: {W%-6d       {cTNL: {W%-7d       {cWimpy: {W%d\n\r",
		     ch->exp,IS_HERO(ch) ? (1) : (ch->level + 1) *
		     exp_per_level(ch,ch->pcdata->points) - ch->exp,
		     ch->wimpy);

      printf_to_char(ch,
		     "{YGold: {W%-6d      {cBank: {W%-7d      {cSilver: {W%d\n\r",
		     ch->gold, ch->pcdata->balance, ch->silver);
      if ( ch->pcdata->shares )
        {
	  printf_to_char(ch,"You have %d gold invested in %d shares (%d each).\n\r",
			 (ch->pcdata->shares * share_value),
			 ch->pcdata->shares, share_value);
        }
    }

  send_to_char("{cCONDITION(S): ",ch);
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK]   > 10 )
    send_to_char( "{WDRUNK ",   ch );
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_THIRST] ==  0 )
    send_to_char( "{WTHIRSTY ", ch );
  if ( !IS_NPC(ch) && ch->pcdata->condition[COND_HUNGER]   ==  0 )
    send_to_char( "{WHUNGRY{x",  ch );
  send_to_char(".\n\r",ch);

  send_to_char("{cPOSITION: ",ch);
  switch ( ch->position )
    {
    case POS_DEAD:     
      send_to_char( "{RDEAD{x!!\n\r",ch );
      break;
    case POS_MORTAL:
      send_to_char( "{WMortally wounded{x.\n\r",ch );
      break;
    case POS_INCAP:
      send_to_char( "{WIncapacitated{x.\n\r",ch );
      break;
    case POS_STUNNED:
      send_to_char( "{Wstunned{x.\n\r",ch );
      break;
    case POS_SLEEPING:
      send_to_char( "{WSleeping{x.\n\r",ch );
      break;
    case POS_RESTING:
      send_to_char( "{WResting{x.\n\r",ch );
      break;
    case POS_SITTING:
      send_to_char( "{WSitting{x.\n\r",ch );
      break;
    case POS_STANDING:
      send_to_char( "{WStanding{x.\n\r",ch );
      break;
    case POS_FIGHTING:
      send_to_char( "{WFighting{x.\n\r",ch );
      break;
    }
  /* print AC values */
  if (ch->level >= 25)
    {	
      printf_to_char(ch,"{cArmor: pierce: {W%d  {cbash: {W%d  {cslash: {W%d  {cmagic: {W%d\n\r",
		     GET_AC(ch,AC_PIERCE),
		     GET_AC(ch,AC_BASH),
		     GET_AC(ch,AC_SLASH),
		     GET_AC(ch,AC_EXOTIC));
    } else {
      for (i = 0; i < 4; i++)
	{
	  char * temp;

	  switch(i)
	    {
	    case(AC_PIERCE):	temp = "piercing";	break;
	    case(AC_BASH):	temp = "bashing";	break;
	    case(AC_SLASH):	temp = "slashing";	break;
	    case(AC_EXOTIC):	temp = "magic";		break;
	    default:		temp = "error";		break;
	    }
	
	  send_to_char("You are ", ch);

	  if      (GET_AC(ch,i) >=  101 ) 
	    sprintf(buf,"hopelessly vulnerable to %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= 80) 
	    sprintf(buf,"defenseless against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= 60)
	    sprintf(buf,"barely protected from %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= 40)
	    sprintf(buf,"slightly armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= 20)
	    sprintf(buf,"somewhat armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= 0)
	    sprintf(buf,"armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= -20)
	    sprintf(buf,"well-armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= -40)
	    sprintf(buf,"very well-armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= -60)
	    sprintf(buf,"heavily armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= -80)
	    sprintf(buf,"superbly armored against %s.\n\r",temp);
	  else if (GET_AC(ch,i) >= -100)
	    sprintf(buf,"almost invulnerable to %s.\n\r",temp);
	  else
	    sprintf(buf,"divinely armored against %s.\n\r",temp);

	  send_to_char(buf,ch);
	}
    }

  /* RT wizinvis and holy light */
  if ( IS_IMMORTAL(ch))
    {
      send_to_char("{cHoly Light: ",ch);
      if (IS_SET(ch->act,PLR_HOLYLIGHT))
	send_to_char("{WON",ch);
      else
	send_to_char("{WOFF",ch);
 
      if (ch->invis_level)
	{
	  sprintf(buf, " {c Invisible: level {W%d",ch->invis_level);
	  send_to_char(buf,ch);
	}

      if (ch->incog_level)
	{
	  sprintf(buf,"  {cIncognito: level {W%d",ch->incog_level);
	  send_to_char(buf,ch);
	}
      send_to_char("\n\r",ch);
    }

    
  if ( ch->level >= 10 )
    {
      printf_to_char(ch, "{cAlignment: {W%d.  ", ch->alignment );
    }

  send_to_char( "You are ", ch );
  if ( ch->alignment >  900 ) send_to_char( "angelic.\n\r", ch );
  else if ( ch->alignment >  700 ) send_to_char( "saintly.\n\r", ch );
  else if ( ch->alignment >  350 ) send_to_char( "good.\n\r",    ch );
  else if ( ch->alignment >  100 ) send_to_char( "kind.\n\r",    ch );
  else if ( ch->alignment > -100 ) send_to_char( "neutral.\n\r", ch );
  else if ( ch->alignment > -350 ) send_to_char( "mean.\n\r",    ch );
  else if ( ch->alignment > -700 ) send_to_char( "evil.\n\r",    ch );
  else if ( ch->alignment > -900 ) send_to_char( "demonic.\n\r", ch );
  else                             send_to_char( "satanic.\n\r", ch );
  send_to_char("{Y------------------------------------------------------------------{x\n\r",ch);

  if (IS_SET(ch->comm,COMM_SHOW_AFFECTS)) {
    do_function(ch,&do_affects,"");
    send_to_char("{Y------------------------------------------------------------------{x\n\r",ch);
  }
}
