/*


 ---  ---  ---  ---  ---  ---          ---  ---  ---  --- 
 |S|  |P|  |I|  |R|  |A|  |L|          |V|  |O|  |I|  |D| 
 ---  ---  ---  ---  ---  ---          ---  ---  ---  ---


 Place this code in player.c above your current score
 Just copy and paste all this stuff
 
 Then you can either rename this score or your old score to do_score2
 
 and add the command score2 to your mud through whatever way you add commands
 look at mud.h and tables.c if your not sure



 ----------------------------------------------------------
*/





/*
int num is the ability number
- written by spiral void June 2, 2005
*/
char *exp_bar(CHAR_DATA *ch,int num)
{
 static char buf[MAX_STRING_LENGTH];
 int ability = num;
 int level = ch->skill_level[ability];
 
 int max_exp=(level)*(level)*(500);
 int exp[19];
 int cur=ch->experience[ability];
 
 exp[0]=(level)*(level)*(25);
 exp[1]=(level)*(level)*(50);
 exp[2]=(level)*(level)*(75);
 exp[3]=(level)*(level)*(100);
 exp[4]=(level)*(level)*(125);
 exp[5]=(level)*(level)*(150);
 exp[6]=(level)*(level)*(175);
 exp[7]=(level)*(level)*(200);
 exp[8]=(level)*(level)*(225);
 exp[9]=(level)*(level)*(250);
 exp[10]=(level)*(level)*(275);
 exp[11]=(level)*(level)*(300);
 exp[12]=(level)*(level)*(325);
 exp[13]=(level)*(level)*(350);
 exp[14]=(level)*(level)*(375);
 exp[15]=(level)*(level)*(400);
 exp[16]=(level)*(level)*(425);
 exp[17]=(level)*(level)*(450);
 exp[18]=(level)*(level)*(475);
 exp[19]=(level)*(level)*(499);
 
 
                    if( cur < exp[0] ) sprintf(buf,"&c[&w-------------------&c]");
   if( cur >= exp[0] && cur < exp[1] ) sprintf(buf,"&c[&R|&w------------------&c]");
   if( cur >= exp[1] && cur < exp[2] ) sprintf(buf,"&c[&R||&w-----------------&c]");
   if( cur >= exp[2] && cur < exp[3] ) sprintf(buf,"&c[&R|||&w----------------&c]");
   if( cur >= exp[3] && cur < exp[4] ) sprintf(buf,"&c[&R||||&w---------------&c]");
   if( cur >= exp[4] && cur < exp[5] ) sprintf(buf,"&c[&R|||||&w--------------&c]");
   if( cur >= exp[5] && cur < exp[6] ) sprintf(buf,"&c[&R||||||&w-------------&c]");
   if( cur >= exp[6] && cur < exp[7] ) sprintf(buf,"&c[&R|||||||&w------------&c]");
   if( cur >= exp[7] && cur < exp[8] ) sprintf(buf,"&c[&R||||||||&w-----------&c]");
   if( cur >= exp[8] && cur < exp[9] ) sprintf(buf,"&c[&R|||||||||&w----------&c]");
  if( cur >= exp[9] && cur < exp[10] ) sprintf(buf,"&c[&R||||||||||&w---------&c]");
 if( cur >= exp[10] && cur < exp[11] ) sprintf(buf,"&c[&R|||||||||||&w--------&c]");
 if( cur >= exp[11] && cur < exp[12] ) sprintf(buf,"&c[&R||||||||||||&w-------&c]");
 if( cur >= exp[12] && cur < exp[13] ) sprintf(buf,"&c[&R|||||||||||||&w------&c]");
 if( cur >= exp[13] && cur < exp[14] ) sprintf(buf,"&c[&R||||||||||||||&w-----&c]");
 if( cur >= exp[14] && cur < exp[15] ) sprintf(buf,"&c[&R|||||||||||||||&w----&c]");
 if( cur >= exp[15] && cur < exp[16] ) sprintf(buf,"&c[&R||||||||||||||||&w---&c]");
 if( cur >= exp[16] && cur < exp[17] ) sprintf(buf,"&c[&R|||||||||||||||||&w--&c]");
 if( cur >= exp[17] && cur < exp[18] ) sprintf(buf,"&c[&R||||||||||||||||||&w-&c]");
 if( cur >= exp[18] && cur < max_exp ) sprintf(buf,"&c[&R|||||||||||||||||||&c]");

 
 return buf;
}


/* from swfote */
/*
 fixed division by zero bug
 if max is 0
 then per will try to get a value of division by 0
 wich we all should know is not possible
 6/7/05
 - cirus
*/
char *drawlife(int min, int max){
   static char buf[MAX_STRING_LENGTH];
   int per;
   if( max == 0 ) 
   {
    per = 0;
   }
   else
   {
   per = ((min * 100) / max);
   }
   if (per < 0) per = 0;
   if (per > 100) per = 100;
                   if (per == 100)  sprintf(buf, "&G&W[&R|||||||||||||&w&W]");
   else if (per >= 90 && per < 100) sprintf(buf, "&G&W[&R||||||||||||&w-&W]");
   else if (per >= 80 && per < 90)  sprintf(buf, "&G&W[&R|||||||||||&w--&W]");
   else if (per >= 70 && per < 80)  sprintf(buf, "&G&W[&R||||||||||&w---&W]");
   else if (per >= 60 && per < 70)  sprintf(buf, "&G&W[&R||||||||&w-----&W]");
   else if (per >= 50 && per < 60)  sprintf(buf, "&G&W[&R|||||||&w------&W]");
   else if (per >= 40 && per < 50)  sprintf(buf, "&G&W[&R||||||&w-------&W]");
   else if (per >= 30 && per < 40)  sprintf(buf, "&G&W[&R|||||&w--------&W]");
   else if (per >= 30 && per < 40)  sprintf(buf, "&G&W[&R||||&w---------&W]");
   else if (per >= 20 && per < 40)  sprintf(buf, "&G&W[&R|||&w----------&W]");
   else if (per >= 10 && per < 40)  sprintf(buf, "&G&W[&R||&w-----------&W]");
   else if (per >= 0 &&  per < 10)  sprintf(buf, "&G&W[&R&w-------------&W]");
   //else sprintf(buf, "&G&W[&R&W]");
   return buf;
}


/*
 fixed division by zero bug
 if max is 0
 then per will try to get a value of division by 0
 wich we all should know is not possible
 6/7/05
 - cirus
 */
char *drawforce(int min, int max,CHAR_DATA *ch){
   static char buf[MAX_STRING_LENGTH];
   int per;
   
   if ( IS_IMMORTAL(ch) || ch->skill_level[FORCE_ABILITY] > 1 )
   {
   if( max == 0 ) 
   {
    per = 0;
   }
   else
   {
   per = ((min * 100) / max);
   }
   if (per < 0) per = 0;
   if (per > 100) per = 100;
                   if (per == 100)  sprintf(buf, "&G&W[&R|||||||||||||&w&W]");
   else if (per >= 90 && per < 100) sprintf(buf, "&G&W[&R||||||||||||&w-&W]");
   else if (per >= 80 && per < 90)  sprintf(buf, "&G&W[&R|||||||||||&w--&W]");
   else if (per >= 70 && per < 80)  sprintf(buf, "&G&W[&R||||||||||&w---&W]");
   else if (per >= 60 && per < 70)  sprintf(buf, "&G&W[&R||||||||&w-----&W]");
   else if (per >= 50 && per < 60)  sprintf(buf, "&G&W[&R|||||||&w------&W]");
   else if (per >= 40 && per < 50)  sprintf(buf, "&G&W[&R||||||&w-------&W]");
   else if (per >= 30 && per < 40)  sprintf(buf, "&G&W[&R|||||&w--------&W]");
   else if (per >= 30 && per < 40)  sprintf(buf, "&G&W[&R||||&w---------&W]");
   else if (per >= 20 && per < 40)  sprintf(buf, "&G&W[&R|||&w----------&W]");
   else if (per >= 10 && per < 40)  sprintf(buf, "&G&W[&R||&w-----------&W]");
   else if (per >= 0 &&  per < 10)  sprintf(buf, "&G&W[&R&w-------------&W]");
   //else sprintf(buf, "&G&W[&R&W]");
   }
   else
    sprintf(buf,"               ");
    
   return buf;
}

/* from swfote */
char *drawmove(int min, int max){
   static char buf[MAX_STRING_LENGTH];
   int per;
   per = ((min * 100) / max);
                   if (per == 100)  sprintf(buf, "&G&W[&R|||||||&w&W]");
   else if (per >= 90 && per < 100) sprintf(buf, "&G&W[&R||||||&w-&W]");
   else if (per >= 80 && per < 90)  sprintf(buf, "&G&W[&R|||||&w--&W]");
   else if (per >= 70 && per < 80)  sprintf(buf, "&G&W[&R||||&w---&W]");
   else if (per >= 60 && per < 70)  sprintf(buf, "&G&W[&R|||&w----&W]");
   else if (per >= 50 && per < 60)  sprintf(buf, "&G&W[&R||&w-----&W]");
   else if (per >= 40 && per < 50)  sprintf(buf, "&G&W[&R|&w------&W]");
   else if (per >= 30 && per < 40)  sprintf(buf, "&G&W[&R|&w------&W]");
   else if (per >= 20 && per < 40)  sprintf(buf, "&G&W[&R|&w------&W]");
   else if (per >= 10 && per < 40)  sprintf(buf, "&G&W[&R|&w------&W]");
   else if (per >= 0 &&  per < 10)  sprintf(buf, "&G&W[&R&w-------&W]");
   else sprintf(buf, "&G&W[&R&W]");
   return buf;
}

/* from swfote */
char *drawalign(int align){
  static char buf[MAX_STRING_LENGTH];
  if (align >= 100) sprintf(buf, "&W[&C============&W|&W]");
  else if (align >= 90 && align < 100) sprintf(buf, "&W[&C===========&W|&C=&W]");
  else if (align >= 60 && align < 90) sprintf(buf, "&W[&C==========&W|&C==&W]");
  else if (align >= 40 && align < 60) sprintf(buf, "&W[&C=========&W|&C===&W]");
  else if (align >= 20 && align < 40) sprintf(buf, "&W[&C========&W|&C====&W]");
  else if (align >= 10 && align < 20) sprintf(buf, "&W[&C=======&W|&C=====&W]");
  else if (align >= 0 && align < 10) sprintf(buf, "&W[&C======&W|&C======&W]");
  else if (align <= -1 && align > -20) sprintf(buf, "&W[&C=====&W|&C=======&W]");
  else if (align <= -20 && align > -40) sprintf(buf, "&W[&C====&W|&C========&W]");
  else if (align <= -60 && align > -80) sprintf(buf, "&W[&C===&W|&C=========&W]");
  else if (align <= -80 && align > -100) sprintf(buf, "&W[&C==&W|&C==========&W]");
  else if (align <= -100) sprintf(buf, "&W[&W|&C============&W]");
  
  return buf;
}



/* SWFOTE Score */
/* Modified by Spiral Void */
/*
At some point we need to decide wich score is going to be
the score and wich one is going to be score2

This score has been put in as score
after being heavily striped and redone
6/3/05

This score command was striped of all swfote code
then redone

This score accepts an argument of a player name
so you can view the score of someone else
very nice

*/
/* 
  New Score by Goku
*/
void do_score( CHAR_DATA *ch, char *argument )
{
  CHAR_DATA *victim;
  int ability;
    if(!argument || argument[0] == '\0')
        victim = ch;
    else if(IS_IMMORTAL(ch))
    {
        if(  ( victim = get_char_world( ch, argument ) ) == NULL)
        {
            send_to_char("Victim not found.\r\n",ch);
          return;
        }
        if(IS_SET(victim->act, PLR_WIZINVIS) && victim->pcdata->wizinvis > ch->top_level)
        {
            send_to_char("Victim not found.\r\n",ch);
          return;
        }
    }
    else
        victim = ch;
    if (IS_NPC(victim))
    {
	do_oldscore(ch, argument);
	return;
    }

  send_to_char("&z.--------------------------------------------------------------------.&W\n\r", ch);
  send_to_char("&z|                                                                    &z|&W\n\r", ch);
  send_to_char("&z|                                                                    |&W\n\r", ch);
  send_to_char("&z|                                                                    &z|&W\n\r", ch);
  ch_printf(ch, "&z|  &cName:  &g%-25.25s                   &cStrength: &g%-2d   &z|\n\r", victim->name, get_curr_str(victim));
  if (victim->pcdata->clan)
    ch_printf(ch, "&z|  &cClan:  &g%-25.25s                  &cDexterity: &g%-2d   &z|\n\r", victim->pcdata->clan->name, get_curr_dex(victim));
  else
  ch_printf(ch, "&z|  &cClan:  &g%-25.25s                  &cDexterity: &g%-2d   &z|\n\r", "None", get_curr_dex(victim));
  ch_printf(ch, "&z|  &cRace:  &g%-25.25s               &cConstitution: &g%-2d   &z|\n\r", capitalize(get_race(victim)), get_curr_con(victim));
  ch_printf(ch, "&z|  &cArmor: &g%-25d               &cIntelligence: &g%-2d   &z|\n\r", GET_AC(victim), get_curr_int(victim));
  ch_printf(ch, "&z|  &cHP:    %s  &cMove:  %s             &cWisdom: &g%-2d   &z|\n\r", drawlife(victim->hit, victim->max_hit), drawmove(victim->move, victim->max_move), get_curr_wis(victim));
  ch_printf(ch, "&z|  &cAlign: %s  &cForce: %s     &cCharisma: &g%-2d   &z|\n\r", drawalign(victim->alignment),drawforce(victim->mana,victim->max_mana,ch), get_curr_cha(victim));
  send_to_char("&z|--------------------------------------------------------------------|&W\n\r", ch);
  ch_printf(ch, "&z|  &cCredits: &g%-10d             &cSavings: &g%-10d               &z|&W\n\r", victim->gold, victim->pcdata->bank);
  ch_printf(ch, "&z|  &cWeight:  %s        &cItems: %s            &z|&W\n\r", drawlife(victim->carry_weight, can_carry_w(victim)), drawlife(victim->carry_number, can_carry_n(victim)));
  send_to_char("&z|--------------------------------------------------------------------|&W\n\r", ch);
  for ( ability = 0 ; ability < MAX_ABILITY ; ability++ )
  {
    if ( ability != FORCE_ABILITY )
    {
      ch_printf( ch, "&z| &c%-15s   Level: &g%-3d   &cof  &g%-3d   &cExp: %s&z|\n\r",
       ability_name[ability], victim->skill_level[ability], max_level(victim, ability), exp_bar(ch,ability));
    }
    else if ( ( ability == FORCE_ABILITY ) && ( IS_IMMORTAL(victim) || victim->skill_level[FORCE_ABILITY] > 1 ))
    {
      ch_printf( ch, "&z| &c%-15s   Level: &g%-3d   &cof  &g%-3d   &cExp: %s&z|\n\r",
       ability_name[ability], victim->skill_level[ability], max_level(victim, ability), exp_bar(ch,ability));
    }
  }
     
  send_to_char("&z|--------------------------------------------------------------------|&W\n\r", ch);      
  send_to_char("&z|                                                                    &z|\n\r", ch);
  send_to_char("&z|--------------------------------------------------------------------|&W\n\r", ch);
  ch_printf(ch,"&R&z|                                                                    &z|&W\n\r" );
  send_to_char("&z|--------------------------------------------------------------------|&W\n\r", ch);
  send_to_char("&z|                                                                    &z|\n\r", ch);
  send_to_char("&z+--------------------------------------------------------------------+&W\n\r", ch);
  
}