void do_map( CHAR_DATA * ch, char *argument ) { int counter, size, min, max; char mline[430]; if( !sector_translation[SECT_MAX + 1][0] ) { send_to_char_color( "&C&wYour sector translation table needs to be updated to match your current" " sector types.\r\n", ch ); return; } if( argument && !str_cmp( argument, "legend" ) ) { send_to_char_color( "&C&G[MAP LEGEND]\r\n", ch ); for( counter = 0; counter < SECT_MAX + 2; ++counter ) if( counter != SECT_MAX ) ch_printf_color( ch, " %s - %s\r\n", sector_translation[counter][0], sector_translation[counter][1] ); return; } if( argument && argument[0] != '\0' ) { send_to_char_color( "&C&wSyntax: \r\n", ch ); send_to_char_color( "&C&wmap legend &G- &wMap Symbol Explanation\r\n", ch ); send_to_char_color( "&C&wOtherwise just try map with no arguments.\r\n", ch ); return; } size = 6; min = ( 215 / 2 ) - size / 2; max = ( 215 / 2 ) + size / 2; prep_map( ch->in_room, min, max ); strcpy( mline, "&C&c." ); for( counter = 0; counter < size; counter++ ) strcat( mline, "&C&c-" ); strcat( mline, "&C&c.\r\n" ); for( counter = min; counter < max; counter++ ) { strcat( mline, make_map_line( counter, min, max ) ); strcat( mline, "\r\n" ); } strcat( mline, "&C&c'" ); for( counter = 0; counter < size; counter++ ) strcat( mline, "&C&c-" ); strcat( mline, "&C&c'\r\n" ); send_to_char_color( mline, ch ); return; }
void do_news( CHAR_DATA *ch, char *argument ) { char arg1[MAX_NEWS_LENGTH], buf[MIL], arg2[MAX_NEWS_LENGTH]; if ( IS_NPC( ch ) ) return; if ( argument && argument[0] == '\0' ) { send_to_char( "\r\nuso: noticias [<opción>]\r\n", ch ); send_to_char( "Opción puede ser: version, todas, ultima [<#>], primera [<#>], [#]\r\n", ch ); if ( IS_IMMORTAL( ch ) ) { send_to_char( "\r\nUso: noticias [<campo>]\r\n", ch ); send_to_char( "Campo puede ser: agregar, cargar, editar, eliminar\r\n", ch ); send_to_char( " <fecha>, lista\r\n", ch ); return; } return; } if ( argument && argument[0] != '\0' ) { argument = one_argument( argument, arg1 ); if ( !str_cmp( arg1, "version" ) ) { ch_printf_color( ch, "&cT&Che &cE&Clder &cC&Chronicles &cV&Cersion&c: &W%s&c.\r\n", NEWS_VERSION ); return; } else if ( is_number( arg1 ) ) { show_news( ch, TYPE_SHOW_ONE, atoi( arg1 ) ); return; } else if ( !str_cmp( arg1, "todas" ) ) { show_news( ch, TYPE_ALL, -1 ); send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch ); return; } else if ( !str_cmp( arg1, "primera" ) ) { int show_count = -1; argument = one_argument( argument, arg2 ); if ( !arg2 || arg2[0] == '\0' ) { show_count = -1; } else { if ( is_number( arg2 ) ) show_count = atoi( arg2 ); else show_count = -1; } show_news( ch, TYPE_LIST_FIRST, show_count ); } else if ( !str_cmp( arg1, "ultima" ) ) { int show_count = -1; argument = one_argument( argument, arg2 ); if ( !arg2 || arg2[0] == '\0' ) { show_count = 5; } else { if ( is_number( arg2 ) ) show_count = atoi( arg2 ); else show_count = -1; } show_news( ch, TYPE_LIST_LAST, show_count ); send_to_char( "\r\nPara más detalles teclea 'ayuda noticias'\r\n", ch ); return; } else if ( !IS_IMMORTAL( ch ) ) { show_news( ch, TYPE_NORMAL, -1 ); return; } else if ( !str_cmp( arg1, "html" ) ) { if ( !argument || argument[0] == '\0' ) { ch_printf_color( ch, "&C&Gel sistema de noticias en HTML está &C&W%s&C&G.\r\n", USE_HTML_NEWS == TRUE ? "activado" : "desactivado" ); return; } else if ( !str_cmp( argument, "cambiar" ) || !str_cmp( argument, "activar" ) || !str_cmp( argument, "desactivar" ) ) { if ( !str_cmp( argument, "cambiar" ) ) USE_HTML_NEWS = !USE_HTML_NEWS; else if ( !str_cmp( argument, "activar" ) ) USE_HTML_NEWS = TRUE; else USE_HTML_NEWS = FALSE; do_news( ch, ( char * ) "html" ); write_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); return; } else { do_news( ch, ( char * ) "html" ); do_help( ch, ( char * ) "noticias" ); return; } } else if ( !str_cmp( arg1, "agregar" ) && ( argument && argument[0] != '\0' ) ) { add_news( argument ); send_to_char_color( "&C&GNoticia añadida.\r\n", ch ); /* * Send the message about a note being posted to the mud */ snprintf( buf, MIL, "¡Hay una nueva noticia por %s!", ch->name ); announce( buf ); } else if ( !str_cmp( arg1, "cargar" ) ) { clear_news( FALSE, 0 ); load_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); send_to_char_color( "&C&GNoticias cargadas.\r\n", ch ); } else if ( !str_cmp( arg1, "lista" ) ) { show_news( ch, TYPE_IMM_LIST, -1 ); } else if ( !str_cmp( arg1, "eliminar" ) && ( argument && argument[0] != '\0' ) ) { bool clearAll = FALSE; if ( !str_cmp( argument, "todas" ) ) { clearAll = TRUE; } if ( !clearAll && !is_number( argument ) ) { send_to_char_color( "El argumento debe ser un número de noticia o todas.\r\n", ch ); return; } if ( clearAll != TRUE ) clear_news( TRUE, atoi( argument ) ); else clear_news( FALSE, 0 ); write_news( ); if ( USE_HTML_NEWS == TRUE ) generate_html_news( ); send_to_char_color( "&C&GNoticias eliminadas.\r\n", ch ); } else { do_help( ch, ( char * ) "noticias" ); return; } } else { show_news( ch, TYPE_NORMAL, -1 ); } }
/* * The main entry point for executing commands. * Can be recursively called from 'at', 'order', 'force'. */ void interpret( CHAR_DATA * ch, char *argument ) { char command[MAX_INPUT_LENGTH]; char logline[MAX_INPUT_LENGTH]; char logname[MAX_INPUT_LENGTH]; char log_buf[MAX_STRING_LENGTH]; char *origarg = argument; char *buf; TIMER *timer = NULL; CMDTYPE *cmd = NULL; int trust; int loglvl; bool found; struct timeval time_used; long tmptime; if( !ch ) { bug( "%s: null ch!", __FUNCTION__ ); return; } if( !ch->in_room ) { bug( "%s: null in_room!", __FUNCTION__ ); return; } found = FALSE; if( ch->substate == SUB_REPEATCMD ) { DO_FUN *fun; if( ( fun = ch->last_cmd ) == NULL ) { ch->substate = SUB_NONE; bug( "%s: SUB_REPEATCMD with NULL last_cmd", __FUNCTION__ ); return; } else { int x; /* * yes... we lose out on the hashing speediness here... * but the only REPEATCMDS are wizcommands (currently) */ for( x = 0; x < 126; x++ ) { for( cmd = command_hash[x]; cmd; cmd = cmd->next ) if( cmd->do_fun == fun ) { found = TRUE; break; } if( found ) break; } if( !found ) { cmd = NULL; bug( "%s: SUB_REPEATCMD: last_cmd invalid", __FUNCTION__ ); return; } snprintf( logline, MAX_INPUT_LENGTH, "(%s) %s", cmd->name, argument ); } } if( !cmd ) { /* * Changed the order of these ifchecks to prevent crashing. */ if( !argument || !strcmp( argument, "" ) ) { bug( "%s: null argument!", __FUNCTION__ ); return; } /* * Strip leading spaces. */ while( isspace( *argument ) ) argument++; if( argument[0] == '\0' ) return; /* * xREMOVE_BIT( ch->affected_by, AFF_HIDE ); */ /* * Implement freeze command. */ if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_FREEZE ) ) { send_to_char( "You're totally frozen!\r\n", ch ); return; } /* * Grab the command word. * Special parsing so ' can be a command, * also no spaces needed after punctuation. */ mudstrlcpy( logline, argument, MAX_INPUT_LENGTH ); if( !isalpha( argument[0] ) && !isdigit( argument[0] ) ) { command[0] = argument[0]; command[1] = '\0'; argument++; while( isspace( *argument ) ) argument++; } else argument = one_argument( argument, command ); /* * Look for command in command table. * Check for council powers and/or bestowments */ trust = get_trust( ch ); for( cmd = command_hash[LOWER( command[0] ) % 126]; cmd; cmd = cmd->next ) if( !str_prefix( command, cmd->name ) && ( cmd->level <= trust || ( !IS_NPC( ch ) && ch->pcdata->council && is_name( cmd->name, ch->pcdata->council->powers ) && cmd->level <= ( trust + MAX_CPD ) ) || ( !IS_NPC( ch ) && ch->pcdata->bestowments && ch->pcdata->bestowments[0] != '\0' && is_name( cmd->name, ch->pcdata->bestowments ) && cmd->level <= ( trust + sysdata.bestow_dif ) ) ) ) { found = TRUE; break; } /* * Turn off afk bit when any command performed. */ if( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_AFK ) && ( str_cmp( command, "AFK" ) ) ) { xREMOVE_BIT( ch->act, PLR_AFK ); act( AT_GREY, "$n is no longer afk.", ch, NULL, NULL, TO_CANSEE ); } } /* * Log and snoop. */ snprintf( lastplayercmd, ( MAX_INPUT_LENGTH * 2 ), "%s used %s", ch->name, logline ); if( found && cmd->log == LOG_NEVER ) mudstrlcpy( logline, "XXXXXXXX XXXXXXXX XXXXXXXX", MAX_INPUT_LENGTH ); loglvl = found ? cmd->log : LOG_NORMAL; /* * Write input line to watch files if applicable */ if( !IS_NPC( ch ) && ch->desc && valid_watch( logline ) ) { if( found && IS_SET( cmd->flags, CMD_WATCH ) ) write_watch_files( ch, cmd, logline ); else if( IS_SET( ch->pcdata->flags, PCFLAG_WATCH ) ) write_watch_files( ch, NULL, logline ); } if( ( !IS_NPC( ch ) && xIS_SET( ch->act, PLR_LOG ) ) || fLogAll || loglvl == LOG_BUILD || loglvl == LOG_HIGH || loglvl == LOG_ALWAYS ) { /* * Added by Narn to show who is switched into a mob that executes * a logged command. Check for descriptor in case force is used. */ if( ch->desc && ch->desc->original ) snprintf( log_buf, MAX_STRING_LENGTH, "Log %s (%s): %s", ch->name, ch->desc->original->name, logline ); else snprintf( log_buf, MAX_STRING_LENGTH, "Log %s: %s", ch->name, logline ); /* * Make it so a 'log all' will send most output to the log * file only, and not spam the log channel to death -Thoric */ if( fLogAll && loglvl == LOG_NORMAL && ( IS_NPC( ch ) || !xIS_SET( ch->act, PLR_LOG ) ) ) loglvl = LOG_ALL; log_string_plus( log_buf, loglvl, get_trust( ch ) ); } if( ch->desc && ch->desc->snoop_by ) { snprintf( logname, MAX_INPUT_LENGTH, "%s", ch->name ); write_to_buffer( ch->desc->snoop_by, logname, 0 ); write_to_buffer( ch->desc->snoop_by, "% ", 2 ); write_to_buffer( ch->desc->snoop_by, logline, 0 ); write_to_buffer( ch->desc->snoop_by, "\r\n", 2 ); } /* * check for a timer delayed command (search, dig, detrap, etc) */ if( ( timer = get_timerptr( ch, TIMER_DO_FUN ) ) != NULL ) { int tempsub; tempsub = ch->substate; ch->substate = SUB_TIMER_DO_ABORT; ( timer->do_fun ) ( ch, "" ); if( char_died( ch ) ) return; if( ch->substate != SUB_TIMER_CANT_ABORT ) { ch->substate = tempsub; extract_timer( ch, timer ); } else { ch->substate = tempsub; return; } } /* * Look for command in skill and socials table. */ if( !found ) { if( !check_skill( ch, command, argument ) && !check_ability( ch, command, argument ) // Racial Abilities Support - Kayle 7-8-07 && !rprog_command_trigger( ch, origarg ) && !mprog_command_trigger( ch, origarg ) && !oprog_command_trigger( ch, origarg ) && !check_social( ch, command, argument ) && !news_cmd_hook( ch, command, argument ) #ifdef IMC && !imc_command_hook( ch, command, argument ) #endif ) { EXIT_DATA *pexit; /* * check for an auto-matic exit command */ if( ( pexit = find_door( ch, command, TRUE ) ) != NULL && IS_SET( pexit->exit_info, EX_xAUTO ) ) { if( IS_SET( pexit->exit_info, EX_CLOSED ) && ( !IS_AFFECTED( ch, AFF_PASS_DOOR ) || IS_SET( pexit->exit_info, EX_NOPASSDOOR ) ) ) { if( !IS_SET( pexit->exit_info, EX_SECRET ) ) act( AT_PLAIN, "The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR ); else send_to_char( "You cannot do that here.\r\n", ch ); return; } if( check_pos( ch, POS_STANDING ) ) move_char( ch, pexit, 0 ); return; } send_to_char( "Huh?\r\n", ch ); } return; } /* * Character not in position for command? */ if( !check_pos( ch, cmd->position ) ) return; /* * Berserk check for flee.. maybe add drunk to this?.. but too much * hardcoding is annoying.. -- Altrag * This wasn't catching wimpy --- Blod * if ( !str_cmp(cmd->name, "flee") && * IS_AFFECTED(ch, AFF_BERSERK) ) * { * send_to_char( "You aren't thinking very clearly..\r\n", ch); * return; * } */ /* * So we can check commands for things like Posses and Polymorph * * But still keep the online editing ability. -- Shaddai * * Send back the message to print out, so we have the option * * this function might be usefull elsewhere. Also using the * * send_to_char_color so we can colorize the strings if need be. --Shaddai */ buf = check_cmd_flags( ch, cmd ); if( buf[0] != '\0' ) { send_to_char_color( buf, ch ); return; } /* * Nuisance stuff -- Shaddai */ if( !IS_NPC( ch ) && ch->pcdata->nuisance && ch->pcdata->nuisance->flags > 9 && number_percent( ) < ( ( ch->pcdata->nuisance->flags - 9 ) * 10 * ch->pcdata->nuisance->power ) ) { send_to_char( "You can't seem to do that just now.\r\n", ch ); return; } /* * Dispatch the command. */ ch->prev_cmd = ch->last_cmd; /* haus, for automapping */ ch->last_cmd = cmd->do_fun; start_timer( &time_used ); ( *cmd->do_fun ) ( ch, argument ); end_timer( &time_used ); /* * Update the record of how many times this command has been used (haus) */ update_userec( &time_used, &cmd->userec ); tmptime = UMIN( time_used.tv_sec, 19 ) * 1000000 + time_used.tv_usec; /* * laggy command notice: command took longer than 1.5 seconds */ if( tmptime > 1500000 ) { log_printf_plus( LOG_NORMAL, get_trust( ch ), "[*****] LAG: %s: %s %s (R:%d S:%ld.%06ld)", ch->name, cmd->name, ( cmd->log == LOG_NEVER ? "XXX" : argument ), ch->in_room ? ch->in_room->vnum : 0, time_used.tv_sec, time_used.tv_usec ); cmd->lag_count++; /* count the lag flags */ } tail_chain( ); }
void do_hintedit( CHAR_DATA* ch, const char* argument) { char arg[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; char arg3[MAX_STRING_LENGTH]; HINT_DATA *hintData; int i; int no = 0; int ano = 0; bool found = FALSE; if( IS_NPC( ch ) ) return; if( !IS_IMMORTAL( ch ) ) return; set_char_color( AT_LBLUE, ch ); argument = one_argument( argument, arg ); argument = one_argument( argument, arg2 ); argument = one_argument( argument, arg3 ); if( !str_cmp( arg, "help" ) || arg[0] == '\0' ) { do_help( ch, "imm_hints" ); return; } if( !str_cmp( arg, "list" ) ) { if( first_hint ) { pager_printf( ch, "No | Low | High | Text \r\n" ); pager_printf( ch, "---|-----|------|--------------------------------------------------\r\n" ); i = 0; for( hintData = first_hint; hintData; hintData = hintData->next ) { ++i; pager_printf( ch, "%2d | %3d | %4d | %-30s\r\n", i, hintData->low, hintData->high, hintData->text ); } pager_printf( ch, "\r\n%d hints in file.\r\n", i ); } else send_to_char( "No hints in file.\r\n", ch ); return; } else if( !str_cmp( arg, "remove" ) ) { no = 0; if( !is_number( arg2 ) ) { send_to_char_color( "Remove which hint?\r\n", ch ); return; } ano = atoi( arg2 ); found = FALSE; for( hintData = first_hint; hintData; hintData = hintData->next ) { ++no; if( no == ano ) { ch_printf_color( ch, "&CHint Number %d removed\r\n", ano ); UNLINK( hintData, first_hint, last_hint, next, prev ); STRFREE( hintData->text ); DISPOSE( hintData ); found = TRUE; break; } } if( !found ) { send_to_char( "Hint not found\r\n", ch ); return; } return; } else if( !str_cmp( arg, "add" ) ) { if( arg2 == '\0' ) { send_to_char( "What is the minimum level for this hint?\r\n", ch ); return; } if( arg3 == '\0' ) { send_to_char( "What is the maximum level for this hint?\r\n", ch ); return; } if( atoi( arg2 ) > atoi( arg3 ) ) { send_to_char( "Aborting: max less than min!\r\n", ch ); return; } CREATE( hintData, HINT_DATA, 1 ); hintData->low = atoi( arg2 ); hintData->high = atoi( arg3 ); hintData->text = STRALLOC( argument ); LINK( hintData, first_hint, last_hint, next, prev ); send_to_char( "Ok. Hint created\r\n", ch ); return; } else if( !str_cmp( arg, "force" ) ) { ch_printf_color( ch, "&p( &wHINT&p ): &P%s\r\n", get_hint( LEVEL_AVATAR ) ); return; } else if( !str_cmp( arg, "edit" ) ) { no = 0; i = 0; if( arg2[0] == '\0' ) { send_to_char( "Edit which hint number?\r\n", ch ); return; } else no = atoi( arg2 ); if( arg3[0] == '\0' ) { ch_printf( ch, "Edit which field of hint %d (low/high/text)?\r\n", no ); return; } if( argument[0] == '\0' ) { ch_printf( ch, "Change hint %d's field %s to what ?\r\n", no, arg3 ); return; } for( hintData = first_hint; hintData; hintData = hintData->next ) { ++i; if( i == no ) { found = TRUE; break; } } if( !found ) { ch_printf( ch, "Hint %d not found.\r\n", no ); return; } else { if( !str_cmp( arg3, "text" ) ) { STRFREE( hintData->text ); hintData->text = STRALLOC( argument ); send_to_char( "Hint text changed!\r\n", ch ); return; } else if( !str_cmp( arg3, "low" ) ) { if( atoi( argument ) > hintData->high ) { send_to_char( "Aborting: min higher than max.\r\n", ch ); return; } hintData->low = atoi( argument ); send_to_char( "Minimum level for hint changed.\r\n", ch ); return; } else if( !str_cmp( arg3, "high" ) ) { if( atoi( argument ) < hintData->low ) { send_to_char( "Aborting: max lower than min.\r\n", ch ); return; } hintData->high = atoi( argument ); send_to_char( "Maximum level for hint changed.\r\n", ch ); return; } else { send_to_char( "Valid fields are: low/high/text\r\n", ch ); return; } } } else if( !str_cmp( arg, "save" ) ) { write_hint( ); send_to_char( "Saved.\r\n", ch ); return; } else { send_to_char( "Syntax: hint (list/add/remove/edit/save/force)\r\n", ch ); return; } }
/* * display the news entry from the command hook -Nopey */ void display_news_type( CHAR_DATA * ch, NEWS_TYPE * type, char *argument ) { if( !type->first_news ) { send_to_char_color( "&gThere are currently no news items for this news type.\r\n", ch ); return; } if( argument[0] == '\0' || !str_cmp( argument, "all" ) ) { bool all_news = FALSE; NEWS *news = NULL; int x = type->last_news->number, y = NEWS_VIEW; int skipper = ( x - y ); if( !str_cmp( argument, "all" ) ) all_news = TRUE; pager_printf_color( ch, "\r\n&g--------------------------------------\r\n" ); if( type->header ) send_to_pager( type->header, ch ); pager_printf_color( ch, "&g--------------------------------------\r\n" ); send_to_pager( NEWS_HEADER_ALL, ch ); for( news = type->first_news; news; news = news->next ) { if( !all_news ) { if( skipper > -1 ) { skipper--; continue; } } pager_printf_color( ch, "&g(&W%2d&g) &W%-12s &%-11s &W%s&g\r\n", news->number, news->name, news->date, news->title ); } if( !all_news ) { if( type->last_news->number == 1 ) pager_printf_color( ch, "&g\r\nThere is one news item.\r\n" ); else if( type->last_news->number > NEWS_VIEW - 1 ) pager_printf_color( ch, "\r\n&gThere are &w%d&g total items, the oldest of which are not listed here.\r\nUse '&w%s all&g' to list them all.&g\r\n", type->last_news->number, type->cmd_name ); else pager_printf_color( ch, "\r\n&gThere are &w%d&g total items.\r\n", type->last_news->number ); pager_printf_color( ch, "\r\n&gTo read individual items type '&w%s <number>&g'.\r\n", type->cmd_name ); return; } pager_printf_color( ch, "\r\n&gTo read individual items type '&w%s <number>&g'.\r\n", type->cmd_name ); } { NEWS *news = NULL; if( ( news = grab_news( type, argument ) ) == NULL ) { if( str_cmp( argument, "all" ) ) send_to_char_color( "&g\r\nThat's not a news post number.\r\nUse '&wnews&g' to view them.\r\n", ch ); return; } display_news( ch, news, type ); return; } }
/* Affects-at-a-glance, Blodkai */ void do_affected( CHAR_DATA* ch, const char* argument) { char arg[MAX_INPUT_LENGTH]; AFFECT_DATA *paf; SKILLTYPE *skill; if( IS_NPC( ch ) ) return; set_char_color( AT_SCORE, ch ); argument = one_argument( argument, arg ); if( !str_cmp( arg, "by" ) ) { send_to_char_color( "\r\n&BImbued with:\r\n", ch ); ch_printf_color( ch, "&C%s\r\n", !xIS_EMPTY( ch->affected_by ) ? affect_bit_name( &ch->affected_by ) : "nothing" ); if( ch->level >= 20 ) { send_to_char( "\r\n", ch ); if( ch->resistant > 0 ) { send_to_char_color( "&BResistances: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->resistant, ris_flags ) ); } if( ch->immune > 0 ) { send_to_char_color( "&BImmunities: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->immune, ris_flags ) ); } if( ch->susceptible > 0 ) { send_to_char_color( "&BSuscepts: ", ch ); ch_printf_color( ch, "&C%s\r\n", flag_string( ch->susceptible, ris_flags ) ); } } return; } if( !ch->first_affect ) { send_to_char_color( "\r\n&CNo cantrip or skill affects you.\r\n", ch ); } else { send_to_char( "\r\n", ch ); for( paf = ch->first_affect; paf; paf = paf->next ) if( ( skill = get_skilltype( paf->type ) ) != NULL ) { set_char_color( AT_BLUE, ch ); send_to_char( "Affected: ", ch ); set_char_color( AT_SCORE, ch ); if( ch->level >= 20 || IS_PKILL( ch ) ) { if( paf->duration < 25 ) set_char_color( AT_WHITE, ch ); if( paf->duration < 6 ) set_char_color( AT_WHITE + AT_BLINK, ch ); ch_printf( ch, "(%5d) ", paf->duration ); } ch_printf( ch, "%-18s\r\n", skill->name ); } } return; }
void advance_class_level( CHAR_DATA *ch ) { /* ONLY called for multiclasses */ int level = 0; if ( ch->firstexp >= exp_class_level( ch, ch->firstlevel + 1, ch->Class ) ) { /* Levelled */ ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n", class_table[ch->Class]->who_name, ++ch->firstlevel ); ch->firstexp = URANGE( 0, ( ch->firstexp - exp_class_level( ch, ch->firstlevel, ch->Class ) ), ch->firstexp ); advance_level( ch ); } if ( IS_SECONDCLASS( ch ) && ch->secondexp >= exp_class_level( ch, ch->secondlevel + 1, ch->secondclass ) ) { /* Again */ ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n", class_table[ch->secondclass]->who_name, ++ch->secondlevel ); ch->secondexp = URANGE( 0, ( ch->secondexp - exp_class_level( ch, ch->secondlevel, ch->secondclass ) ), ch->secondexp ); advance_level( ch ); } if ( IS_THIRDCLASS( ch ) && ch->thirdexp >= exp_class_level( ch, ch->thirdlevel + 1, ch->thirdclass ) ) { /* Made * a * level! */ ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n", class_table[ch->thirdclass]->who_name, ++ch->thirdlevel ); ch->thirdexp = URANGE( 0, ( ch->thirdexp - exp_class_level( ch, ch->thirdlevel, ch->thirdclass ) ), ch->thirdexp ); advance_level( ch ); } if ( IS_THIRDCLASS( ch ) ) level = ( ( ch->firstlevel + 1 + ch->secondlevel + ch->thirdlevel ) / 3 ); else if ( IS_SECONDCLASS( ch ) ) level = ( ( ch->firstlevel + 1 + ch->secondlevel ) / 2 ); else level = ( ch->firstlevel + 1 ); if ( level > ch->level ) { /* Should have gained! */ char buf[MSL]; if ( xIS_SET( ch->act, PLR_EXTREME ) ) { ch_printf( ch, "&GPlaying 6D EXTREME you gain 5 glory!&D\r\n" ); ch->quest_curr += 5; } ch_printf( ch, "\r\n&WYou have now obtained an overall experience level %d!&D\r\n", ++ch->level ); restore_char( ch ); send_to_char_color( "&YYou have gained insight in the realms, and have been restored!\r\n", ch ); snprintf( buf, MSL, "The realms rejoice as %s has just achieved level %d!&D", ch->name, ch->level ); announce( buf ); snprintf( buf, MSL, "%24.24s: %s obtained level %d!%s%s&D", ctime( ¤t_time ), ch->name, ch->level, ( doubleexp ? " (Double)" : "" ), ( happyhouron ? " (HappyHour)" : "" ) ); append_to_file( PLEVEL_FILE, buf ); } }
void do_ispell( CHAR_DATA * ch, char *argument ) { char *pc, buf[MAX_STRING_LENGTH]; if( ispell_pid <= 0 ) { send_to_char( "ISpell is not running.\r\n", ch ); return; } if( !argument[0] || strchr( argument, ' ' ) ) { send_to_char_color( "You &Wmight&w want to specify a word?\r\n", ch ); return; } if( argument[0] == '+' ) { for( pc = argument + 1; *pc; pc++ ) if( !isalpha( *pc ) ) { sprintf( buf, "'%c' is not a letter.\r\n", *pc ); send_to_char( buf, ch ); return; } fprintf( ispell_out, "*%s\n", argument + 1 ); fflush( ispell_out ); return; /* we assume everything is OK.. better be so! */ } pc = get_ispell_line( argument ); if( !pc ) { send_to_char( "ISpell: failed.\r\n", ch ); return; } switch ( pc[0] ) { case '*': case '+': /* root */ case '-': /* compound */ send_to_char_color( "&cCorrect.&w\r\n", ch ); break; case '&': /* miss */ sprintf( buf, "&WNot found&w. &cPossible words&W:&w %s\r\n", strchr( pc, ':' ) + 1 ); send_to_char_color( buf, ch ); break; case '?': /* guess */ sprintf( buf, "&WNot found&w. &cPossible words&W:&w %s\r\n", strchr( pc, ':' ) + 1 ); send_to_char_color( buf, ch ); break; case '#': /* none */ send_to_char_color( "&cUnable to find anything that matches.&w\r\n", ch ); break; default: sprintf( buf, "Weird output from ispell: %s\r\n", pc ); send_to_char( buf, ch ); } }