本文整理汇总了C++中ch_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ ch_printf函数的具体用法?C++ ch_printf怎么用?C++ ch_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ch_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: show_pfiles
void show_pfiles (CHAR_DATA *ch, char *x)
{
DIR *dp;
struct dirent *dentry;
char directory_name[100];
sh_int count = 0;
ch_printf( ch, "&w&W&W&CPfiles Starting With %s\n\r", capitalize(x) );
ch_printf( ch, "&B-----------------------\n\r" );
sprintf( directory_name, "%s%s", PLAYER_DIR, x );
dp = opendir( directory_name );
dentry = readdir( dp );
while ( dentry )
{
if ( dentry->d_name[0] != '.' && str_suffix(".home", dentry->d_name) && str_suffix(".clone", dentry->d_name) )
{
ch_printf(ch, "&O%s&w&W&W\n\r\n\r", dentry->d_name);
count++;
}
dentry = readdir( dp );
}
closedir( dp );
if ( count == 0 )
{
send_to_char("&RThere are no pfiles beginning with that letter!&w&W&W\n\r", ch);
}
else
{
ch_printf(ch, "&WTotal %s Pfiles: &R%d&w&W&W\n\r", capitalize(x), count);
}
ch_printf( ch, "&B-----------------------" );
return;
}
开发者ID:ccubed,项目名称:SWFoteCustom,代码行数:35,代码来源:pfiles.c
示例2: do_finger
/* File read/write code redone using standard Smaug I/O routines - Samson 9-12-98 */
void do_finger( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
if( IS_NPC(ch) )
{
send_to_char( "Mobs can't use the finger command.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char("Finger whom?\n\r", ch );
return;
}
victim = get_char_world(ch, argument);
if ( ( victim == NULL ) || (!victim) )
{
read_finger( ch, argument );
return;
}
if ( IS_IMMORTAL(victim) && !IS_IMMORTAL(ch) )
{
send_to_char( "Cannot finger an immortal.\n\r", ch );
return;
}
/*
if ( ( ch->top_level < victim->top_level && ch->top_level < LEVEL_INFINITE ) && IS_IMMORTAL(ch) )
{
send_to_char( "Cannot finger an immortal above your own level.\n\r", ch );
return;
}
*/
if ( IS_NPC( victim ) )
{
read_finger( ch, argument );
return;
}
if ( !can_see( ch, victim ) )
{
send_to_char("They aren't here.\n\r", ch );
return;
}
send_to_char("&w Finger Info\n\r", ch);
send_to_char(" -----------\n\r", ch);
ch_printf(ch, "&wName : &G%-20s &wAge: &G%d\n\r", victim->name, victim->pcage );
ch_printf(ch, "&wSex : &G%-20s\n\r",
victim->sex == SEX_MALE ? "Male" :
victim->sex == SEX_FEMALE ? "Female" : "Neutral" );
ch_printf(ch, "&wTitle: &G%s\n\r", victim->pcdata->title );
ch_printf(ch, "&wHomepage: &G%s\n\r", victim->pcdata->homepage ? victim->pcdata->homepage : "None" );
// ch_printf(ch, "&wClan: &G%s\n\r", victim->pcdata->clan ? victim->pcdata->clan->name : "Unclanned" );
ch_printf(ch, "&wLast on: &G%s\n\r", (char *) ctime( &ch->logon ) );
return;
}
开发者ID:bcass,项目名称:Cowboy-Bebop-Space-Cowboy,代码行数:61,代码来源:finger.c
示例3: do_timezone
void do_timezone( CHAR_DATA* ch, const char* argument)
{
int i;
if( IS_NPC( ch ) )
return;
if( !argument || argument[0] == '\0' )
{
ch_printf( ch, "%-6s %-30s (%s)\r\n", "Name", "City/Zone Crosses", "Time" );
send_to_char( "-------------------------------------------------------------------------\r\n", ch );
for( i = 0; i < MAX_TZONE; i++ )
{
ch_printf( ch, "%-6s %-30s (%s)\r\n", tzone_table[i].name, tzone_table[i].zone, c_time( current_time, i ) );
}
send_to_char( "-------------------------------------------------------------------------\r\n", ch );
return;
}
i = tzone_lookup( argument );
if( i == -1 )
{
send_to_char( "That time zone does not exists. Make sure to use the exact name.\r\n", ch );
return;
}
ch->pcdata->timezone = i;
ch_printf( ch, "Your time zone is now %s %s (%s)\r\n", tzone_table[i].name,
tzone_table[i].zone, c_time( current_time, i ) );
}
开发者ID:InfiniteAxis,项目名称:SmaugFUSS,代码行数:31,代码来源:calendar.c
示例4: scan_forcers
void scan_forcers( CHAR_DATA *ch )
{
DIR *dp;
struct dirent *dentry;
char directory_name[100];
sh_int alpha_loop;
ch_printf( ch, "&w&W&W&CForcers&w&W&W\n\r");
ch_printf( ch, "&B-----------------------&w&W&W\n\r" );
for ( alpha_loop = 0; alpha_loop <= 25; alpha_loop++ )
{
sprintf( directory_name, "%s%c", PLAYER_DIR, 'a' + alpha_loop );
dp = opendir( directory_name );
dentry = readdir( dp );
while ( dentry )
{
if ( dentry->d_name[0] != '.' && str_suffix(".home1", dentry->d_name) && str_suffix(".home2", dentry->d_name) && str_suffix(".home3", dentry->d_name) && str_suffix(".clone", dentry->d_name) )
{
read_fpfile( ch, directory_name, dentry->d_name);
}
dentry = readdir( dp );
}
closedir( dp );
}
ch_printf( ch, "&B-----------------------&w&W&W\n\r" );
return;
}
开发者ID:ccubed,项目名称:SWFoteCustom,代码行数:28,代码来源:pfiles.c
示例5: redit_disp_exit_flag_menu
/* For exit flags */
void redit_disp_exit_flag_menu( DESCRIPTOR_DATA *d )
{
EXIT_DATA *pexit = d->character->spare_ptr;
char buf[MSL];
int x;
write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 );
for ( x = 0; x < MAX_EXIT; x++ )
{
if ( (x == EXIT_RES1) || (x == EXIT_RES2) || (x == EXIT_PORTAL) )
continue;
ch_printf( d->character, "&g%2d&w) %-20.20s\r\n", x+1, code_name(NULL, x, CODE_EXIT) );
}
buf[0] = '\0';
for ( x = 0; x < MAX_EXIT; x++ )
{
if ( HAS_BIT(pexit->flags, x) )
{
strcat( buf, code_name(NULL, x, CODE_EXIT) );
strcat( buf, " " );
}
}
ch_printf( d->character, "\r\nExit flags: &c%s&w\r\n"
"Enter room flags, 0 to quit: ", buf );
OLC_MODE(d) = REDIT_EXIT_FLAGS;
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:30,代码来源:olc_redit.c
示例6: free_game
void free_game( GAME_BOARD_DATA * board )
{
if ( !board )
return;
#ifdef IMC
if ( board->type == TYPE_IMC )
{
imc_send_chess( board->player1 ? board->player1 : NULL, board->player2, "stop" );
STRFREE( board->player2 );
}
#endif
if ( board->player1 )
{
if ( CHAR_DATA * ch = get_char_world( supermob, board->player1 ) ) // Added for bugfix - Findecano 23/11/07
{
ch_printf( ch, "The game has been stopped at %d total moves.\r\n", board->turn );
ch->pcdata->game_board = NULL;
}
}
if ( board->player2 )
{
if ( CHAR_DATA * ch = get_char_world( supermob, board->player2 ) ) // Added for bugfix - Findecano 23/11/07
{
ch_printf( ch, "The game has been stopped at %d total moves.\r\n", board->turn );
ch->pcdata->game_board = NULL;
}
}
STRFREE( board->player1 );
STRFREE( board->player2 );
DISPOSE( board );
}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:34,代码来源:chess.c
示例7: do_report
void do_report( CHAR_DATA * ch, const char *argument )
{
char buf[MAX_INPUT_LENGTH];
if ( IS_NPC( ch ) && ch->fighting )
return;
if ( IS_AFFECTED( ch, AFF_POSSESS ) )
{
send_to_char( "You can't do that in your current state of mind!\r\n", ch );
return;
}
if ( IS_VAMPIRE( ch ) )
ch_printf( ch,
"You report: %d/%d hp %d/%d blood %d/%d mv %d xp.\r\n", ch->hit, ch->max_hit, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->move, ch->max_move, ch->exp );
else
ch_printf( ch, "You report: %d/%d hp %d/%d mana %d/%d mv %d xp.\r\n", ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move, ch->exp );
if ( IS_VAMPIRE( ch ) )
snprintf( buf, MAX_INPUT_LENGTH, "$n reports: %d/%d hp %d/%d blood %d/%d mv %d xp.\r\n",
ch->hit, ch->max_hit, ch->pcdata->condition[COND_BLOODTHIRST], 10 + ch->level, ch->move, ch->max_move, ch->exp );
else
snprintf( buf, MAX_INPUT_LENGTH, "$n reports: %d/%d hp %d/%d mana %d/%d mv %d xp.", ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move, ch->exp );
act( AT_REPORT, buf, ch, NULL, NULL, TO_ROOM );
return;
}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:30,代码来源:player.c
示例8: do_time
void do_time( CHAR_DATA* ch, const char* argument)
{
HOLIDAY_DATA *holiday;
extern char str_boot_time[];
// Uncomment if you have Samson's Pfile Cleanup Snippet installed.
//char buf[MSL];
const char *suf;
short day;
day = time_info.day + 1;
if( day > 4 && day < 20 )
suf = "th";
else if( day % 10 == 1 )
suf = "st";
else if( day % 10 == 2 )
suf = "nd";
else if( day % 10 == 3 )
suf = "rd";
else
suf = "th";
ch_printf( ch, "&wIt is &W%d&w o'clock &W%s&w, Day of &W%s&w,&W %d%s&w day in the Month of &W%s&w.\r\n"
"&wIt is the season of %s&w, in the year &W%d&w.\r\n"
"&wThe mud started up at : &W %s\r\n"
"&wThe system time : &W %s\r\n",
( time_info.hour % sysdata.hournoon == 0 ) ? sysdata.hournoon : time_info.hour % sysdata.hournoon,
time_info.hour >= sysdata.hournoon ? "pm" : "am", day_name[( time_info.day ) % sysdata.daysperweek], day, suf,
month_name[time_info.month], season_name[time_info.season], time_info.year, str_boot_time,
c_time( current_time, -1 ) );
ch_printf( ch, "&wYour local time : &W %s&D\r\n", c_time( current_time, ch->pcdata->timezone ) );
holiday = get_holiday( time_info.month, day - 1 );
if( holiday != NULL )
ch_printf( ch, "&wIt's a holiday today:&W %s\r\n", holiday->name );
if( !IS_NPC( ch ) )
{
if( day == ch->pcdata->day + 1 && time_info.month == ch->pcdata->month )
send_to_char( "&WToday is your &Pb&pi&Yr&Oth&Yd&pa&Py&R!&D\r\n", ch );
}
/* Uncomment if you have Samson's Pfile Cleanup Snippet installed.
if( IS_IMMORTAL( ch ) && sysdata.CLEANPFILES == TRUE )
{
long ptime, curtime;
ptime = ( long int )( new_pfile_time_t );
curtime = ( long int )( current_time );
buf[0] = '\0';
sec_to_hms( ptime - curtime, buf );
ch_printf( ch, "&wThe next pfile cleanup is in&W %s&w.&D\r\n", buf );
} */
return;
}
开发者ID:InfiniteAxis,项目名称:SmaugFUSS,代码行数:57,代码来源:calendar.c
示例9: do_level
/* -Thoric
* Display your current exp, level, and surrounding level exp requirements
*/
void do_level( CHAR_DATA * ch, const char *argument )
{
int ability;
for( ability = 0; ability < MAX_ABILITY; ability++ )
if( ability != FORCE_ABILITY || ch->skill_level[FORCE_ABILITY] > 1 )
ch_printf( ch, "%-15s Level: %-3d Max: %-3d Exp: %-10ld Next: %-10ld\r\n",
ability_name[ability], ch->skill_level[ability], max_level( ch, ability ), ch->experience[ability],
exp_level( ch->skill_level[ability] + 1 ) );
else
ch_printf( ch, "%-15s Level: %-3d Max: ??? Exp: ??? Next: ???\r\n",
ability_name[ability], ch->skill_level[ability], ch->experience[ability] );
}
开发者ID:m241dan,项目名称:swrproject,代码行数:16,代码来源:player.c
示例10: show_status
/*
* stampa al pg il suo stato attuale di gioco
*/
void show_status( CHAR_DATA *ch, CHESSBOARD_DATA *board )
{
if ( !ch )
{
send_log( NULL, LOG_BUG, "print_status: ch passato è NULL" );
return;
}
if ( !board )
{
send_to_char( ch, "Non sto giocando a nessuna partita di scacchi.\r\n" );
return;
}
if ( !board->player1 )
send_to_char( ch, "Non ho nessun giocatore per i pezzi neri con cui gareggiare.\r\n" );
else if ( board->player1 == ch )
send_to_char( ch, "Sono io il giocatore dei pezzi neri.\r\n" );
else
ch_printf( ch, "%s è il giocatore che tiene i pezzi neri.\r\n", board->player1->name );
if ( king_in_possible_checkmate(board, PIECE_KING, COLOR_BLACK) )
send_to_char( ch, "Il re nero potrebbe essere sotto scacco matto.\r\n" );
else if ( king_in_check(board, PIECE_KING, COLOR_BLACK) > 0 )
send_to_char( ch, "Il re nero è sotto scacco.\r\n" );
if ( !board->player2 )
send_to_char( ch, "Non ho nessun giocatore per i pezzi bianchi con cui gareggiare.\r\n" );
else if ( board->player2 == ch )
send_to_char( ch, "Sono io il giocatore dei pezzi bianchi.\r\n" );
else
ch_printf( ch, "%s è il giocatore che tiene i pezzi bianchi.\r\n", board->player2->name );
if ( king_in_possible_checkmate(board, PIECE_KING, COLOR_WHITE) )
send_to_char( ch, "Il re bianco potrebbe essere sotto scacco matto.\r\n" );
else if ( king_in_check(board, PIECE_KING, COLOR_WHITE) > 0 )
send_to_char( ch, "Il re bianco è sotto scacco.\r\n" );
if ( !board->player2 || !board->player1 )
return;
if ( board->moves < 0 )
send_to_char( ch, "Il gioco non è ancora iniziato.\r\n" );
else
ch_printf( ch, "%d turni.\r\n", board->moves );
if ( board->turn == ch )
send_to_char( ch, "E' il mio turno.\r\n" );
else
ch_printf( ch, "E' il turno di %s.\r\n", board->turn->name );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:54,代码来源:game_chess.c
示例11: do_calendar
DO_RET do_calendar( CHAR_DATA *ch, char *argument )
{
set_char_color( AT_PLAIN, ch );
send_to_char( ch, get_calendar_string() );
if ( IS_ADMIN(ch) )
{
/* (FF) bisognerebbe farle bene rimandando un \r\n ma bisogna togliere quindi a tutti l'\n finale. */
ch_printf( ch, "\r\n%s : %21.21s\r\n", MUD_NAME, str_boot_time );
ch_printf( ch, "Ora Locale Server: %21.21s\r\n", friendly_ctime(¤t_time) );
ch_printf( ch, "Prossimo reboot previsto: %s", reboot_time );
}
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:14,代码来源:calendar.c
示例12: redit_disp_exit_menu
/* For exits */
void redit_disp_exit_menu( DESCRIPTOR_DATA *d )
{
ROOM_DATA *room = d->character->dest_buf;
EXIT_DATA *pexit;
int cnt;
OLC_MODE(d) = REDIT_EXIT_MENU;
write_to_buffer( d, "50\x1B[;H\x1B[2J", 0 );
for ( cnt = 0, pexit = room->first_exit; pexit; pexit = pexit->next )
{
ch_printf( d->character,
"&g%2d&w) %-10.10s to %-5d. Key: %d Keywords: %s Flags: %s.\r\n",
++cnt,
code_name(NULL, pexit->vdir, CODE_DIR),
(pexit->to_room) ? pexit->to_room->vnum : 0,
pexit->key,
code_bit(NULL, pexit->flags, CODE_EXIT),
(VALID_STR(pexit->keyword)) ? pexit->keyword : "(none)" );
}
if ( room->first_exit )
send_to_char( d->character, "\r\n" );
send_to_char( d->character, "&gA&w) Add a new exit\r\n" );
send_to_char( d->character, "&gR&w) Remove an exit\r\n" );
send_to_char( d->character, "&gQ&w) Quit\r\n" );
send_to_char( d->character, "\r\nEnter choice: " );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:31,代码来源:olc_redit.c
示例13: end_tag
void end_tag( void )
{
DESCRIPTOR_DATA *d,
*d_next;
tag_game.status = TAG_OFF;
tag_game.timer = -1;
tag_game.next = number_range( 30, 50 );
tag_game.playing = 0;
for ( d = first_descriptor; d; d = d_next ) {
d_next = d->next;
if ( d->connected != CON_PLAYING || !d->character || !d->character->in_room )
continue;
if ( d->character->in_room->vnum < FTAG_MIN_VNUM - 1
|| d->character->in_room->vnum > FTAG_MAX_VNUM )
continue;
xREMOVE_BIT( d->character->act, PLR_RED );
xREMOVE_BIT( d->character->act, PLR_BLUE );
xREMOVE_BIT( d->character->act, PLR_FROZEN );
xREMOVE_BIT( d->character->act, PLR_PLAYING );
xREMOVE_BIT( d->character->act, PLR_WAITING );
xREMOVE_BIT( d->character->act, PLR_PKSAFE );
char_from_room( d->character );
char_to_room( d->character, get_room_index( ROOM_VNUM_TEMPLE ) );
do_look( d->character, ( char * ) "auto" );
act( AT_TELL, "¡$n cae del cielo!\r\n", d->character, NULL, NULL, TO_ROOM );
d->character->quest_curr += 10;
d->character->quest_accum += 10;
ch_printf( d->character,
"¡Ganas 10 puntos de gloria por participar en el evento de congelación!\r\n" );
}
}
开发者ID:jpavonabian,项目名称:6Dragones,代码行数:34,代码来源:ftag.c
示例14: send_timer
void send_timer( struct timerset *vtime, CHAR_DATA * ch )
{
struct timeval ntime;
int carry;
if( vtime->num_uses == 0 )
return;
ntime.tv_sec = vtime->total_time.tv_sec / vtime->num_uses;
carry = ( vtime->total_time.tv_sec % vtime->num_uses ) * 1000000;
ntime.tv_usec = ( vtime->total_time.tv_usec + carry ) / vtime->num_uses;
ch_printf( ch, "Has been used %d times this boot.\r\n", vtime->num_uses );
ch_printf( ch, "Time (in secs): min %ld.%06ld; avg: %ld.%06ld; max %ld.%06ld"
"\r\n", vtime->min_time.tv_sec, vtime->min_time.tv_usec, ntime.tv_sec,
ntime.tv_usec, vtime->max_time.tv_sec, vtime->max_time.tv_usec );
return;
}
开发者ID:m241dan,项目名称:W4M-Repo,代码行数:16,代码来源:interp.c
示例15: do_statreport
/*
* New stat and statreport command coded by Morphina
* Bug fixes by Shaddai
*/
void do_statreport( CHAR_DATA* ch, const char* argument)
{
char buf[MAX_STRING_LENGTH];
if( IS_NPC( ch ) )
{
send_to_char( "Huh?\r\n", ch );
return;
}
if( IS_VAMPIRE( ch ) )
{
ch_printf( ch, "You report: %d/%d hp %d/%d blood %d/%d mv %d xp.\r\n",
ch->hit, ch->max_hit, ch->pcdata->condition[COND_BLOODTHIRST],
10 + ch->level, ch->move, ch->max_move, ch->exp );
snprintf( buf, MAX_STRING_LENGTH, "$n reports: %d/%d hp %d/%d blood %d/%d mv %d xp.",
ch->hit, ch->max_hit, ch->pcdata->condition[COND_BLOODTHIRST],
10 + ch->level, ch->move, ch->max_move, ch->exp );
act( AT_REPORT, buf, ch, NULL, NULL, TO_ROOM );
}
else
{
ch_printf( ch, "You report: %d/%d hp %d/%d mana %d/%d mv %d xp.\r\n",
ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move, ch->exp );
snprintf( buf, MAX_STRING_LENGTH, "$n reports: %d/%d hp %d/%d mana %d/%d mv %d xp.",
ch->hit, ch->max_hit, ch->mana, ch->max_mana, ch->move, ch->max_move, ch->exp );
act( AT_REPORT, buf, ch, NULL, NULL, TO_ROOM );
}
ch_printf( ch, "Your base stats: %-2d str %-2d wis %-2d int %-2d dex %-2d con %-2d cha %-2d lck.\r\n",
ch->perm_str, ch->perm_wis, ch->perm_int, ch->perm_dex, ch->perm_con, ch->perm_cha, ch->perm_lck );
snprintf( buf, MAX_STRING_LENGTH, "$n's base stats: %-2d str %-2d wis %-2d int %-2d dex %-2d con %-2d cha %-2d lck.",
ch->perm_str, ch->perm_wis, ch->perm_int, ch->perm_dex, ch->perm_con, ch->perm_cha, ch->perm_lck );
act( AT_REPORT, buf, ch, NULL, NULL, TO_ROOM );
ch_printf( ch, "Your current stats: %-2d str %-2d wis %-2d int %-2d dex %-2d con %-2d cha %-2d lck.\r\n",
get_curr_str( ch ), get_curr_wis( ch ), get_curr_int( ch ),
get_curr_dex( ch ), get_curr_con( ch ), get_curr_cha( ch ), get_curr_lck( ch ) );
snprintf( buf, MAX_STRING_LENGTH, "$n's current stats: %-2d str %-2d wis %-2d int %-2d dex %-2d con %-2d cha %-2d lck.",
get_curr_str( ch ), get_curr_wis( ch ), get_curr_int( ch ),
get_curr_dex( ch ), get_curr_con( ch ), get_curr_cha( ch ), get_curr_lck( ch ) );
act( AT_REPORT, buf, ch, NULL, NULL, TO_ROOM );
return;
}
开发者ID:Igdra,项目名称:smaugfuss,代码行数:48,代码来源:player.c
示例16: do_level
/* -Thoric
* Display your current exp, level, and surrounding level exp requirements
*/
void do_level( CHAR_DATA * ch, const char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int x, lowlvl, hilvl;
if ( ch->level == 1 )
lowlvl = 1;
else
lowlvl = UMAX( 2, ch->level - 5 );
hilvl = URANGE( ch->level, ch->level + 5, MAX_LEVEL );
set_char_color( AT_SCORE, ch );
ch_printf( ch, "\r\nExperience required, levels %d to %d:\r\n______________________________________________\r\n\r\n", lowlvl, hilvl );
snprintf( buf, MAX_STRING_LENGTH, " exp (Current: %12s)", num_punct( ch->exp ) );
snprintf( buf2, MAX_STRING_LENGTH, " exp (Needed: %12s)", num_punct( exp_level( ch, ch->level + 1 ) - ch->exp ) );
for ( x = lowlvl; x <= hilvl; x++ )
ch_printf( ch, " (%2d) %12s%s\r\n", x, num_punct( exp_level( ch, x ) ), ( x == ch->level ) ? buf : ( x == ch->level + 1 ) ? buf2 : " exp" );
send_to_char( "______________________________________________\r\n", ch );
}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:22,代码来源:player.c
示例17: appraise_all
void appraise_all( CHAR_DATA * ch, CHAR_DATA * keeper, const char *fixstr )
{
OBJ_DATA *obj = NULL;
char buf[MAX_STRING_LENGTH], *pbuf = buf;
int cost = 0, total = 0;
for( obj = ch->first_carrying; obj != NULL; obj = obj->next_content )
{
if( obj->wear_loc == WEAR_NONE
&& can_see_obj( ch, obj )
&& ( obj->item_type == ITEM_ARMOR
|| obj->item_type == ITEM_WEAPON
|| obj->item_type == ITEM_DEVICE ) )
{
if( !can_drop_obj( ch, obj ) )
{
ch_printf( ch, "You can't let go of %s.\r\n", obj->name );
}
else if( ( cost = get_repaircost( keeper, obj ) ) < 0 )
{
if( cost != -2 )
{
act( AT_TELL,
"$n tells you, 'Sorry, I can't do anything with $p.'",
keeper, obj, ch, TO_VICT );
}
else
{
act( AT_TELL, "$n tells you, '$p looks fine to me!'",
keeper, obj, ch, TO_VICT );
}
}
else
{
sprintf( buf,
"$N tells you, 'It will cost %d credit%s to %s %s'",
cost, cost == 1 ? "" : "s", fixstr, obj->name );
act( AT_TELL, buf, ch, NULL, keeper, TO_CHAR );
total += cost;
}
}
}
if( total > 0 )
{
send_to_char( "\r\n", ch );
sprintf( buf,
"$N tells you, 'It will cost %d credit%s in total.'",
total, cost == 1 ? "" : "s" );
act( AT_TELL, buf, ch, NULL, keeper, TO_CHAR );
strcpy( pbuf,
"$N tells you, 'Remember there is a 10% surcharge for repair all.'" );
act( AT_TELL, buf, ch, NULL, keeper, TO_CHAR );
}
}
开发者ID:ccubed,项目名称:SWRCustom,代码行数:55,代码来源:shops.c
示例18: do_prompt
void do_prompt( CHAR_DATA * ch, const char *argument )
{
char arg[MAX_INPUT_LENGTH];
set_char_color( AT_GREY, ch );
if ( IS_NPC( ch ) )
{
send_to_char( "NPC's can't change their prompt..\r\n", ch );
return;
}
smash_tilde( argument );
one_argument( argument, arg );
if ( !*arg || !str_cmp( arg, "display" ) )
{
send_to_char( "Your current prompt string:\r\n", ch );
set_char_color( AT_WHITE, ch );
ch_printf( ch, "%s\r\n", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
set_char_color( AT_GREY, ch );
send_to_char( "Type 'help prompt' for information on changing your prompt.\r\n", ch );
return;
}
send_to_char( "Replacing old prompt of:\r\n", ch );
set_char_color( AT_WHITE, ch );
ch_printf( ch, "%s\r\n", !str_cmp( ch->pcdata->prompt, "" ) ? "(default prompt)" : ch->pcdata->prompt );
if ( ch->pcdata->prompt )
STRFREE( ch->pcdata->prompt );
char prompt[128];
mudstrlcpy( prompt, argument, 128 );
/*
* Can add a list of pre-set prompts here if wanted.. perhaps
* 'prompt 1' brings up a different, pre-set prompt
*/
if ( !str_cmp( arg, "default" ) )
ch->pcdata->prompt = STRALLOC( "" );
else
ch->pcdata->prompt = STRALLOC( prompt );
return;
}
开发者ID:andycervantes,项目名称:SMAUG-Pi,代码行数:42,代码来源:player.c
示例19: do_shopstat
void do_shopstat( CHAR_DATA *ch, char *argument )
{
SHOP_DATA *shop;
MOB_INDEX_DATA *mob;
int vnum;
if ( argument[0] == '\0' )
{
send_to_char( "Usage: shopstat <keeper vnum>\n\r", ch );
return;
}
vnum = atoi( argument );
if ( (mob = get_mob_index(vnum)) == NULL )
{
send_to_char( "Mobile not found.\n\r", ch );
return;
}
if ( !mob->pShop )
{
send_to_char( "This mobile doesn't keep a shop.\n\r", ch );
return;
}
shop = mob->pShop;
ch_printf( ch, "Keeper: %d %s\n\r", shop->keeper, mob->short_descr );
ch_printf( ch, "buy0 [%s] buy1 [%s] buy2 [%s] buy3 [%s] buy4 [%s]\n\r",
o_types[shop->buy_type[0]],
o_types[shop->buy_type[1]],
o_types[shop->buy_type[2]],
o_types[shop->buy_type[3]],
o_types[shop->buy_type[4]] );
ch_printf( ch, "Profit: buy %3d%% sell %3d%%\n\r",
shop->profit_buy,
shop->profit_sell );
ch_printf( ch, "Hours: open %2d close %2d\n\r",
shop->open_hour,
shop->close_hour );
return;
}
开发者ID:smthbh,项目名称:SWFotE-Mud,代码行数:42,代码来源:shops.c
示例20: redit_disp_extradesc_prompt_menu
/*
* Nice fancy redone Extra Description stuff :)
*/
void redit_disp_extradesc_prompt_menu( DESCRIPTOR_DATA *d )
{
EXTRA_DESCR_DATA *ed;
ROOM_DATA *room = d->character->dest_buf;
int counter = 0;
for ( ed = room->first_extradescr; ed; ed = ed->next )
ch_printf( d->character, "&g%2d&w) %-40.40s\r\n", counter++, ed->keyword );
send_to_char( d->character, "\r\nWhich extra description do you want to edit? " );
}
开发者ID:Onirik79,项目名称:bardmud,代码行数:14,代码来源:olc_redit.c
注:本文中的ch_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论