Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
Bug in do_drag( )
Oct 8, 2017, 12:40 am
By GatewaySysop
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Beastmaster 6D sound files
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
476
3,704
19,231
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » [BUG] do_setrace
Forum Rules | Mark all | Recent Posts

[BUG] do_setrace
< Newer Topic :: Older Topic > race.lst file fails to update on re

Pages:<< prev 1 next >>
Post is unread #1 Dec 29, 2002, 10:53 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Reposted from the Chronicles forum since it applies here as well.

act_wiz.c, find do_setrace and replace with the following:

/* Modified by Samson to allow setting language by name - 8-6-98 */
void do_setrace( CHAR_DATA *ch, char *argument )
{
  struct race_type *race;
  char buf[MSL], arg1[MIL], arg2[MIL], arg3[MIL];
  FILE *fpList;
  char racelist[256];
  int value, v2, ra, i;

  set_char_color( AT_PLAIN, ch );

  smash_tilde( argument );
  argument = one_argument( argument, arg1 );
  argument = one_argument( argument, arg2 );
  if ( arg1[0] == '\0' || arg2[0] == '\0' )
  {
     send_to_char( "Syntax: setrace <race> <field> <value>\n\r",   ch );
     send_to_char( "Syntax: setrace <race> create      \n\r",   ch );
     send_to_char( "\n\rField being one of:\n\r",                    ch );
     send_to_char( "  name classes strplus dexplus wisplus\n\r",     ch );
     send_to_char( "  intplus conplus chaplus lckplus hit\n\r",     ch );
     send_to_char( "  mana affected resist suscept language\n\r",     ch );
     send_to_char( "  attack defense alignment acplus \n\r",          ch );
     send_to_char( "  minalign maxalign height weight      \n\r",     ch );
     send_to_char( "  hungermod thirstmod expmultiplier    \n\r",     ch );
     send_to_char( "  saving_poison_death saving_wand      \n\r",     ch );
     send_to_char( "  saving_para_petri saving_breath      \n\r",     ch );
     send_to_char( "  saving_spell_staff                   \n\r",     ch );
     send_to_char( "  mana_regen hp_regen                  \n\r",     ch );
     return;
  }
  if( is_number(arg1) && ( ra = atoi( arg1 ) ) >= 0 && ra < MAX_RACE )
     race = race_table[ra];
  else
  {
     race = NULL;
     for( ra = 0; ra < MAX_RACE && race_table[ra]; ra++ )
 {
    if ( !race_table[ra]->race_name )
 continue;

        if ( !str_cmp( race_table[ra]->race_name, arg1 ) )
        {
           race = race_table[ra];
           break;
        }
}
  }

  if ( !str_cmp( arg2, "create" ) && race )
  {
     send_to_char( "That race already exists!\n\r", ch );
 return;
  }
  else if( !race && str_cmp( arg2, "create" ) )
  {
     send_to_char( "No such race.\n\r", ch );
     return;
  }

  if( !str_cmp( arg2, "create" ) )
  {
     if ( MAX_PC_RACE >= MAX_RACE )
     {
        send_to_char( "You need to up MAX_RACE in mud.h and make clean.\n\r", ch );
    return;
     }
     if( ( create_new_race( MAX_PC_RACE, arg1 ) ) == FALSE )
     {
    send_to_char( "Couldn't create a new race.\n\r", ch );
    return;
     }
     write_race_file( MAX_PC_RACE );
     MAX_PC_RACE++;
     sprintf( racelist, "%s%s", RACEDIR, RACE_LIST );
     if( ( fpList = fopen( racelist, "w" ) ) == NULL )
     {
        bug( "%s", "Error opening racelist." );
    return;
     }
     for ( i = 0; i < MAX_PC_RACE; i++ )
    fprintf( fpList, "%s%s.race\n", RACEDIR, race_table[i]->race_name );
     fprintf( fpList, "%s", "$\n" );
     FCLOSE( fpList );
     send_to_char( "Done.\n\r", ch );
     return;
  }

  if( !argument )
  {
     send_to_char( "You must specify an argument.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "name" ) )
  {
sprintf( buf, "%s%s.race", RACEDIR, race->race_name );
     sprintf( race->race_name, "%-.16s", capitalize( argument ) );
write_race_file( ra );
unlink( buf );
     sprintf( racelist, "%s%s", RACEDIR, RACE_LIST );
     if( ( fpList = fopen( racelist, "w" ) ) == NULL )
     {
        bug( "%s", "Error opening racelist." );
    return;
     }
     for ( i = 0; i < MAX_PC_RACE; i++ )
    fprintf( fpList, "%s%s.race\n", RACEDIR, race_table[i]->race_name );
     fprintf( fpList, "%s", "$\n" );
     FCLOSE( fpList );
     send_to_char( "Race name set.\n\r", ch );
     return;
  }

     for ( i = 0; i < MAX_PC_CLASS; i++ )
    fprintf( fpList, "%s%s.class\n", CLASSDIR, class_table[i]->who_name );
     
     fprintf( fpList, "%s", "$\n" );
     FCLOSE( fpList );
return;
  }

  if( !str_cmp( arg2, "strplus" ) )
  {
     race->str_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "dexplus" ) )
  {
     race->dex_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "wisplus" ) )
  {
     race->wis_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "intplus" ) )
  {
     race->int_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "conplus" ) )
  {
     race->con_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "chaplus" ) )
  {
     race->cha_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "lckplus" ) )
  {
     race->lck_plus = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "hit" ) )
  {
     race->hit = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "mana" ) )
  {
     race->mana = (sh_int) atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "affected" ) )
  {
     if ( !argument || argument[0] == '\0' )
     {
        send_to_char( "Usage: setrace <race> affected <flag> [flag]...\n\r", ch );
        return;
     }
     while ( argument[0] != '\0' )
     {
        argument = one_argument( argument, arg3 );
        value = get_aflag( arg3 );
        if ( value < 0 || value > MAX_BITS )
           ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
        else
      xTOGGLE_BIT( race->affected, value );
     }
write_race_file( ra );
     send_to_char( "Racial affects set.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "resist" ) )
  {
     if ( !argument || argument[0] == '\0' )
     {
        send_to_char( "Usage: setrace <race> resist <flag> [flag]...\n\r", ch );
        return;
     }
     while ( argument[0] != '\0' )
     {
        argument = one_argument( argument, arg3 );
        value = get_risflag( arg3 );
        if ( value < 0 || value > 31 )
           ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
        else
           TOGGLE_BIT( race->resist, 1 << value );
     }
write_race_file( ra );
     send_to_char( "Racial resistances set.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "suscept" ) )
  {
     if ( !argument || argument[0] == '\0' )
     {
        send_to_char( "Usage: setrace <race> suscept <flag> [flag]...\n\r", ch );
        return;
     }
     while ( argument[0] != '\0' )
     {
        argument = one_argument( argument, arg3 );
        value = get_risflag( arg3 );
        if ( value < 0 || value > 31 )
           ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
        else
           TOGGLE_BIT( race->suscept, 1 << value );
     }
write_race_file( ra );
     send_to_char( "Racial susceptabilities set.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "language" ) )
  {
     argument = one_argument( argument, arg3 );
value = get_langflag( arg3 );
if ( value == LANG_UNKNOWN )
   ch_printf( ch, "Unknown language: %s\n\r", arg3 );
else
{
   if ( !(value &= VALID_LANGS) )
 ch_printf( ch, "Player races may not speak %s.\n\r", arg3 );
}

     v2 = get_langnum( arg3 );
if ( v2 == -1 )
   ch_printf( ch, "Unknown language: %s\n\r", arg3 );
     else
   TOGGLE_BIT( race->language, 1 << v2 );

write_race_file( ra );
     send_to_char( "Racial language set.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "classes" ) )
  {
     for( i = 0; i < MAX_CLASS; i++ )
     {
        if( !str_cmp( argument, class_table[i]->who_name ) )
        {  
           TOGGLE_BIT( race->class_restriction, 1 << i );   /* k, that's boggling */
 write_race_file( ra );
           send_to_char( "Classes set.\n\r", ch );
           return;
        }  
     }
     send_to_char( "No such class.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "acplus" ) )
  {
     race->ac_plus = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }

  if ( !str_cmp( arg2, "alignment" ) )
  {
     race->alignment = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }

  /* not implemented */
  if ( !str_cmp( arg2, "defense" ) )
  {
     if ( !argument || argument[0] == '\0' )
     {
        send_to_char( "Usage: setrace <race> defense <flag> [flag]...\n\r", ch );
        return;
     }
     while ( argument[0] != '\0' )
     {
        argument = one_argument( argument, arg3 );
        value = get_defenseflag( arg3 );
        if ( value < 0 || value > MAX_BITS )
           ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
        else
           xTOGGLE_BIT( race->defenses,  value );
     }
write_race_file( ra );
     return;
  }

  /* not implemented */
  if ( !str_cmp( arg2, "attack" ) )
  {
     if ( !argument || argument[0] == '\0' )
     {
        send_to_char( "Usage: setrace <race> attack <flag> [flag]...\n\r", ch );
        return;
     }
     while ( argument[0] != '\0' )
     {
        argument = one_argument( argument, arg3 );
        value = get_attackflag( arg3 );
        if ( value < 0 || value > MAX_BITS )
           ch_printf( ch, "Unknown flag: %s\n\r", arg3 );
        else
           xTOGGLE_BIT( race->attacks,  value );
     }
write_race_file( ra );
     return;
  }

  if ( !str_cmp( arg2, "minalign" ) )
  {
     race->minalign = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "maxalign" ) )
  {
     race->maxalign = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "height" ) )
  {
     race->height = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "weight" ) )
  {
     race->weight = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "thirstmod" ) )
  {
     race->thirst_mod = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "hungermod" ) )
  {
     race->hunger_mod = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "maxalign" ) )
  {
     race->maxalign = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "expmultiplier" ) )
  {
     race->exp_multiplier = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "saving_poison_death" ) )
  {
     race->saving_poison_death = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "saving_wand" ) )
  {
     race->saving_wand = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "saving_para_petri" ) )
  {
     race->saving_para_petri = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "saving_breath" ) )
  {
     race->saving_breath = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "saving_spell_staff" ) )
  {
     race->saving_spell_staff = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  /* unimplemented stuff follows */
  if ( !str_cmp( arg2, "mana_regen" ) )
  {
     race->mana_regen = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "hp_regen" ) )
  {
     race->hp_regen = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
#ifdef NEW_RACE_STUFF
  if ( !str_cmp( arg2, "carry_weight" ) )
  {
     race->acplus = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
  if ( !str_cmp( arg2, "carry_number" ) )
  {
     race->acplus = atoi( argument );
write_race_file( ra );
     send_to_char( "Done.\n\r", ch );
     return;
  }
#endif
  do_setrace( ch, "" );
}
       
Pages:<< prev 1 next >>