if (victim->imm_flags)
{
sprintf(buf, "Immune: %s\n\r",imm_bit_name(victim->imm_flags));
send_to_char(buf,ch);
}
if (victim->res_flags)
{
sprintf(buf, "Resist: %s\n\r", imm_bit_name(victim->res_flags));
send_to_char(buf,ch);
}
if (victim->vuln_flags)
{
sprintf(buf, "Vulnerable: %s\n\r", imm_bit_name(victim->vuln_flags));
send_to_char(buf,ch);
}
if (victim->affected_by)
{
sprintf(buf, "Affected by %s\n\r",
affect_bit_name(victim->affected_by));
send_to_char(buf,ch);
}
( ch->played + (int) (current_time - ch->logon) ) / 3600)
int seconds_played, minutes_played, hours_played;
hours_played = current_time - ch->logon / 3600;
minutes_played = ( current_time - ch->logon / 60 ) - ( hours_played * 60 );
seconds_played = ( current_time - ch->logon ) - ( ( hours_played * 3600 ) + ( minutes_played * 60 ) );
char * display_timer( int timer, bool shortTime )
{
int day, hour, min, sec;
static char stime[MSL];
day = timer/86400;
hour = (timer/3600)%24;
min = (timer%3600)/60;
sec = timer%60;
stime[0] = '\0';
if ( day > 0 )
sprintf( stime, "%d%s%s", day, shortTime ? "d" : " day", day == 1 || shortTime ? "" : "s" );
if ( hour > 0 )
sprintf( stime + strlen(stime), "%s%d%s%s",
day && !shortTime ? " " : "", hour, shortTime ? "h" : " hour",
hour == 1 || shortTime ? "" : "s" );
if ( min > 0 )
sprintf( stime + strlen(stime), "%s%d%s%s",
(day || hour) && !shortTime ? ", " : "", min, shortTime ? "m" : " minute",
min != 1 && !shortTime ? "s" : "" );
if ( sec > 0 )
sprintf( stime + strlen(stime), "%s%d%s%s",
(day || hour || min) && !shortTime ? ", " : "", sec, shortTime ? "s" : " second",
sec != 1 && !shortTime ? "s" : "" );
return stime;
}
/* Calling function must insure tstr buffer is large enough.
* Returns the address of the buffer passed, allowing things like
* this printf example: 123456secs = 1day 10hrs 17mins 36secs
* time_t tsecs = 123456;
* char buff[ MSL ];
*
* printf( "Duration is %s\n", duration( tsecs, buff ) );
*/
#define DUR_SCMN ( 60 )
#define DUR_MNHR ( 60 )
#define DUR_HRDY ( 24 )
#define DUR_DYWK ( 7 )
#define DUR_ADDS( t ) ( (t) == 1 ? '\0' : 's' )
char *sec_to_hms( time_t loctime, char *tstr )
{
time_t t_rem;
int sc, mn, hr, dy, wk;
int sflg = 0;
char buff[MSL];
if( loctime < 1 )
{
mudstrlcat( tstr, "no time at all", MSL );
return ( tstr );
}
sc = loctime % DUR_SCMN;
t_rem = loctime - sc;
if( t_rem > 0 )
{
t_rem /= DUR_SCMN;
mn = t_rem % DUR_MNHR;
t_rem -= mn;
if( t_rem > 0 )
{
t_rem /= DUR_MNHR;
hr = t_rem % DUR_HRDY;
t_rem -= hr;
if( t_rem > 0 )
{
t_rem /= DUR_HRDY;
dy = t_rem % DUR_DYWK;
t_rem -= dy;
if( t_rem > 0 )
{
wk = t_rem / DUR_DYWK;
if( wk )
{
sflg = 1;
snprintf( buff, MSL, "%d week%c", wk, DUR_ADDS( wk ) );
mudstrlcat( tstr, buff, MSL );
}
}
if( dy )
{
if( sflg == 1 )
mudstrlcat( tstr, " ", MSL );
sflg = 1;
snprintf( buff, MSL, "%d day%c", dy, DUR_ADDS( dy ) );
mudstrlcat( tstr, buff, MSL );
}
}
if( hr )
{
if( sflg == 1 )
mudstrlcat( tstr, " ", MSL );
sflg = 1;
snprintf( buff, MSL, "%d hour%c", hr, DUR_ADDS( hr ) );
mudstrlcat( tstr, buff, MSL );
}
}
if( mn )
{
if( sflg == 1 )
mudstrlcat( tstr, " ", MSL );
sflg = 1;
snprintf( buff, MSL, "%d minute%c", mn, DUR_ADDS( mn ) );
mudstrlcat( tstr, buff, MSL );
}
}
if( sc )
{
if( sflg == 1 )
mudstrlcat( tstr, " ", MSL );
snprintf( buff, MSL, "%d second%c", sc, DUR_ADDS( sc ) );
mudstrlcat( tstr, buff, MSL );
}
return ( tstr );
}
if (t_rem > 0) {
nest nest nest
}
if (trem <= 0) {
return;
}
the rest of the code goes here
am trying to do something like this
Immune: disease
Resist: charm
Vulnerable: acid
Affected by: invisible detect_invis sanctuary flying
I am trying to display the Immune, Resist, Vulnerable and affected by
flags that the player has based on race and I cannot figure out how
to do this.
Any ideas or help would be excellent!
Goran