Ok well after a few hours I got it to look how I wanted. so decided to post
it up if anyoen wants to look at it maybe tell me any bugs they see or a
better way to do it
void do_affects(CHAR_DATA *ch, char *argument )
{
AFFECT_DATA *paf, *paf_last = NULL;
char buf[MAX_STRING_LENGTH];
char buf1[MAX_STRING_LENGTH];
char word[MAX_INPUT_LENGTH];
char *curaff;
char *racestring;
int space, length, i;
buf[0] = '\0';
racestring = "{c[{W:{BRace{W::{c] {W";
buf1[0] = '\0';
strcat( buf, racestring);
send_to_char("==-===-==\n\r", ch);
send_to_char("|AFFECTS|", ch);
send_to_char("==-===-==\n\r", ch);
if ( race_table[ch->race].aff != 0 && IS_AFFECTED ( ch,
race_table[ch->race].aff ) )
{
curaff = flag_string ( affect_flags, race_table[ch->race].aff );
for (; ;)
{
curaff = one_argument( curaff, word );
if ( word[0] == '\0' )
{
break;
}
word[0] = UPPER(word[0]);
strcat( buf1, buf );
strcat( buf1, word );
length = strlen(word);
space = 15 - length;
for (i = 0; i < space; i++)
{
strcat(buf1, " ");
}
strcat(buf1, ": Racial Affect");
strcat( buf1, "\n\r" );
}
send_to_char( buf1, ch );
}
if ( ch->affected != NULL )
{
for ( paf = ch->affected; paf != NULL; paf = paf->next )
{
if (paf_last != NULL && paf->type == paf_last->type)
sprintf( buf, " ");
else
sprintf( buf, "{c[{W:{BSpell{W:{c]{W %-15s",
skill_table[paf->type].name );
send_to_char( buf, ch );
sprintf( buf, ": modifies %s by %d and ",
affect_loc_name( paf->location ), paf->modifier);
send_to_char( buf, ch );
if ( paf->duration == -1 )
sprintf( buf, "permanently" );
else
sprintf( buf, "lasts for %d hours", paf->duration );
send_to_char( buf, ch );
send_to_char( "\n\r", ch );
paf_last = paf;
}
}
else
send_to_char(" None \n\r", ch);
return;
}