eldhamud_2.3.3/clans/
eldhamud_2.3.3/councils/
eldhamud_2.3.3/doc/
eldhamud_2.3.3/doc/DIKU/
eldhamud_2.3.3/doc/DIKU/.svn/
eldhamud_2.3.3/doc/DIKU/.svn/prop-base/
eldhamud_2.3.3/doc/DIKU/.svn/text-base/
eldhamud_2.3.3/doc/MERC/
eldhamud_2.3.3/doc/MERC/.svn/
eldhamud_2.3.3/doc/SMAUG/.svn/
eldhamud_2.3.3/doc/SMAUG/mudprogs/
eldhamud_2.3.3/doc/SMAUG/mudprogs/.svn/
eldhamud_2.3.3/doc/mudprogs/
eldhamud_2.3.3/gods/
eldhamud_2.3.3/houses/
eldhamud_2.3.3/player/a/
/****************************************************************************
 *			Eldhamud Codebase V2.2				    *
 * ------------------------------------------------------------------------ *
 *          EldhaMUD code (C) 2003-2008 by Robert Powell (Tommi)            *
 * ------------------------------------------------------------------------ *
 * Original SMAUG 1.4a written by Thoric (Derek Snider) with Altrag,        *
 * Blodkai, Haus, Narn, Scryn, Swordbearer, Tricops, Gorog, Rennard,        *
 * Grishnakh, Fireblade, and Nivek.                                         *
 *                                                                          *
 * Original MERC 2.1 code by Hatchet, Furey, and Kahn.                      *
 *                                                                          *
 * Original DikuMUD code by: Hans Staerfeldt, Katja Nyboe, Tom Madsen,      *
 * Michael Seifert, and Sebastian Hammer.                                   *
 ****************************************************************************/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include "./Headers/mud.h"
void do_train( CHAR_DATA * ch, char *argument )
{
   char buf[MAX_STRING_LENGTH];
   char buf1[20];
   CHAR_DATA *mob = NULL;
   int add_hp = 0;
   int add_mana = 0;
   short *AttrPerm;
   char *pOutput;
   int cost = 8, cost1 = 8, cost2 = 8, cost3 = 8, cost4 = 8, cost5 = 8; /* Urrgghh */

   send_mip_image(ch, "weapons.bmp", "Map 1");
   if( IS_NPC( ch ) )
   {
      send_to_char( "Not for NPCs.  Sorry.\n\r", ch );
      return;
   }
   /*
    * Check for trainer. 
    */
   for( mob = ch->in_room->first_person; mob; mob = mob->next_in_room )
   {
      if( IS_NPC( mob ) && IS_ACT_FLAG( mob, ACT_TRAINER ) )
         break;
   }
   if( mob == NULL )
   {
      send_to_char( "You can't do that here.\n\r", ch );
      return;
   }
   if( NULLSTR( argument ) )
   {
      sprintf( buf, "You have %d practice sessions.\n\r", ch->practice );
      send_to_char( buf, ch );
      /*
       * Work out the costs  
       */
      if( Class_table[ch->Class]->attr_prime == APPLY_STR )
         cost1 = 6;
      if( Class_table[ch->Class]->attr_second == APPLY_STR )
         cost1 = 7;
      if( Class_table[ch->Class]->attr_prime == APPLY_INT )
         cost2 = 6;
      if( Class_table[ch->Class]->attr_second == APPLY_INT )
         cost2 = 7;
      if( Class_table[ch->Class]->attr_prime == APPLY_WIS )
         cost3 = 6;
      if( Class_table[ch->Class]->attr_second == APPLY_WIS )
         cost3 = 7;
      if( Class_table[ch->Class]->attr_prime == APPLY_DEX )
         cost4 = 6;
      if( Class_table[ch->Class]->attr_second == APPLY_DEX )
         cost4 = 7;
      if( Class_table[ch->Class]->attr_prime == APPLY_CON )
         cost5 = 6;
      if( Class_table[ch->Class]->attr_second == APPLY_CON )
         cost5 = 7;
      strcpy( buf, "You can train: hp (4)  mana (5)" );
      if( ch->perm_str < 25 )
      {
         sprintf( buf1, " str (%d)", cost1 );
         strcat( buf, buf1 );
      }
      if( ch->perm_int < 25 )
      {
         sprintf( buf1, " int (%d)", cost2 );
         strcat( buf, buf1 );
      }
      if( ch->perm_wis < 25 )
      {
         sprintf( buf1, " wis (%d)", cost3 );
         strcat( buf, buf1 );
      }
      if( ch->perm_dex < 25 )
      {
         sprintf( buf1, " dex (%d)", cost4 );
         strcat( buf, buf1 );
      }
      if( ch->perm_con < 25 )
      {
         sprintf( buf1, " con (%d)", cost5 );
         strcat( buf, buf1 );
      }
      if( buf[strlen( buf ) - 1] != ':' )
      {
         strcat( buf, ".\n\r" );
         send_to_char( buf, ch );
      }
      return;
   }
   if( !str_cmp( argument, "str" ) )
   {
      if( Class_table[ch->Class]->attr_second == APPLY_STR )
         cost = 7;
      else if( Class_table[ch->Class]->attr_prime == APPLY_STR )
         cost = 6;
      AttrPerm = &ch->perm_str;
      pOutput = "strength";
      if( *AttrPerm >= 25 )
      {
         act( AT_ACTION, "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
         return;
      }
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= cost;
      ch->perm_str += 1;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "int" ) )
   {
      if( Class_table[ch->Class]->attr_second == APPLY_INT )
         cost = 6;
      else if( Class_table[ch->Class]->attr_prime == APPLY_INT )
         cost = 6;
      AttrPerm = &ch->perm_int;
      pOutput = "intelligence";
      if( *AttrPerm >= 25 )
      {
         act( AT_ACTION, "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
         return;
      }
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= cost;
      ch->perm_int += 1;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "wis" ) )
   {
      if( Class_table[ch->Class]->attr_prime == APPLY_WIS )
         cost = 7;
      else if( Class_table[ch->Class]->attr_prime == APPLY_WIS )
         cost = 6;
      AttrPerm = &ch->perm_wis;
      pOutput = "wisdom";
      if( *AttrPerm >= 25 )
      {
         act( AT_ACTION, "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
         return;
      }
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= cost;
      ch->perm_wis += 1;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "dex" ) )
   {
      if( Class_table[ch->Class]->attr_second == APPLY_DEX )
         cost = 7;
      else if( Class_table[ch->Class]->attr_prime == APPLY_DEX )
         cost = 6;
      AttrPerm = &ch->perm_dex;
      pOutput = "dexterity";
      if( *AttrPerm >= 25 )
      {
         act( AT_ACTION, "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
         return;
      }
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= cost;
      ch->perm_dex += 1;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "con" ) )
   {
      if( Class_table[ch->Class]->attr_second == APPLY_CON )
         cost = 7;
      else if( Class_table[ch->Class]->attr_prime == APPLY_CON )
         cost = 6;
      AttrPerm = &ch->perm_con;
      pOutput = "constitution";
      if( *AttrPerm >= 25 )
      {
         act( AT_ACTION, "Your $T is already at maximum.", ch, NULL, pOutput, TO_CHAR );
         return;
      }
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= cost;
      ch->perm_con += 1;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "hp" ) )
   {
      AttrPerm = &ch->max_hit;
      pOutput = "number of hit points";
      cost = 10;  /* this is pracs per "train hp" */
      add_hp = 10;   /* this is hp gained per "train hp" */
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= 10;
      /*
       *AttrPerm           += add_hp;*/
      ch->max_hit += add_hp;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   else if( !str_cmp( argument, "mana" ) )
   {
      AttrPerm = &ch->max_mana;
      pOutput = "amount of mana";
      cost = 10;
      add_mana = 10;
      if( cost > ch->practice )
      {
         send_to_char( "You don't have enough practices.\n\r", ch );
         return;
      }
      ch->practice -= 10;
      /*
       *AttrPerm           += add_mana;*/
      ch->max_mana += add_mana;
      act( AT_ACTION, "Your $T increases!", ch, NULL, pOutput, TO_CHAR );
      act( AT_ACTION, "$n's $T increases!", ch, NULL, pOutput, TO_ROOM );
      return;
   }
   send_to_char( "Sorry that is not a trainable stat, please check your spelling.\n\r", ch );
   return;
}