I just realized how poorly I explained that... here:
in mud.h
struct class_type
{
const char *who_name; /* Name for 'who' */
EXT_BV affected;
short attr_prime; /* Prime attribute */
short attr_second; /* Second attribute */
short attr_deficient; /* Deficient attribute */
add--> int race_restriction; /* Flags for illegal races */
int resist;
int suscept;
int weapon; /* First weapon */
int guild; /* Vnum of guild room */
short skill_adept; /* Maximum skill level */
short thac0_00; /* Thac0 for level 0 */
short thac0_32; /* Thac0 for level 32 */
short hp_min; /* Min hp gained on leveling */
short hp_max; /* Max hp gained on leveling */
bool fMana; /* Class gains mana on level */
short exp_base; /* Class base exp */
};
and in act_wiz.c
void do_showclass( CHAR_DATA* ch, const char* argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
struct class_type *Class;
int cl, low, hi, i, ct;
set_pager_color( AT_PLAIN, ch );
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if( arg1[0] == '\0' )
{
send_to_char( "Syntax: showclass <class> [level range]\r\n", ch );
return;
}
if( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS )
Class = class_table[cl];
else
{
Class = NULL;
for( cl = 0; cl < MAX_CLASS && class_table[cl]; cl++ )
if( !str_cmp( class_table[cl]->who_name, arg1 ) )
{
Class = class_table[cl];
break;
}
}
if( !Class )
{
send_to_char( "No such class.\r\n", ch );
return;
}
pager_printf_color( ch, "&wCLASS: &W%s\r\n&wPrime Attribute: &W%-14s &wWeapon: &W%-5d &wGuild: &W%-5d\r\n",
Class->who_name, affect_loc_name( Class->attr_prime ), Class->weapon, Class->guild );
pager_printf_color( ch, "&wSecond Attribute: &W%-14s &wDeficient Attribute: &W%-14s\r\n",
affect_loc_name( Class->attr_second ), affect_loc_name( Class->attr_deficient ) );
pager_printf_color( ch, "&wMax Skill Adept: &W%-3d &wThac0 : &W%-5d &wThac32: &W%d\r\n",
Class->skill_adept, Class->thac0_00, Class->thac0_32 );
pager_printf_color( ch, "&wHp Min/Hp Max : &W%-2d/%-2d &wMana : &W%-3s &wExpBase: &W%d\r\n",
Class->hp_min, Class->hp_max, Class->fMana ? "yes" : "no ", Class->exp_base );
pager_printf_color( ch, "&wAffected by: &W%s\r\n", affect_bit_name( &Class->affected ) );
pager_printf_color( ch, "&wResistant to: &W%s\r\n", flag_string( Class->resist, ris_flags ) );
pager_printf_color( ch, "&wSusceptible to: &W%s\r\n", flag_string( Class->suscept, ris_flags ) );
send_to_char( "Disallowed races: ", ch );
for( i = 0; i < MAX_RACE; i++ )
{
if( IS_SET( Class->race_restriction, 1 << i ) )
{
ct++;
ch_printf( ch, "%s ", race_table[.i]->race_name );
if( ct % 6 == 0 )
send_to_char( "\r\n", ch );
}
}
if( ( ct % 6 != 0 ) || ( ct == 0 ) )
send_to_char( "\r\n", ch );
ct = 0;
send_to_char( "Allowed races: ", ch );
for( i = 0; i < MAX_RACE; i++ )
{
if( !IS_SET( Class->race_restriction, 1 << i ) )
{
ct++;
ch_printf( ch, "%s ", race_table[.i]->race_name );
if( ct % 6 == 0 )
send_to_char( "\r\n", ch );
}
}
That was how mine looks. to prevent the forum from making it italic in I added a [.i] period in there, remove it in the code. Though it does display "unused" when you type showclass # Someone else might be able to clean that up, it eludes me.
in tables.c
search for KEY ( "Resist"
case 'R':
add--> KEY( "Races", Class->race_restriction, fread_number( fp ) );
KEY( "Resist", Class->resist, fread_number( fp ) );
break;
and...
search for fprintf( fpout, "Class %d\n", cl );
below it add
fprintf( fpout, "Races %d\n", Class->race_restriction );
then finally in comm.c
write_to_buffer( d, "\r\nSelect a class, or type help [class] to learn more about that class.\r\n[", 0 );
buf[0] = '\0';
for( iClass = 0; iClass < MAX_PC_CLASS; iClass++ )
{
if( class_table[iClass]->who_name && class_table[iClass]->who_name[0] != '\0'
&& !IS_SET( class_table[iClass]->race_restriction, 1 << ch->race ) )
and...
if( iClass == MAX_PC_CLASS
|| !class_table[iClass]->who_name
|| IS_SET( class_table[iClass]->race_restriction, 1 << ch->race )
|| class_table[iClass]->who_name[0] == '\0' || !str_cmp( class_table[iClass]->who_name, "unused" ) )
{
write_to_buffer( d, "That's not a class.\r\nWhat IS your class? ", 0 );
return;
}
|