本文整理汇总了C++中send_to_char函数的典型用法代码示例。如果您正苦于以下问题:C++ send_to_char函数的具体用法?C++ send_to_char怎么用?C++ send_to_char使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_to_char函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hcontrol_build_house
void hcontrol_build_house(struct char_data * ch, char *arg)
{
char arg1[MAX_INPUT_LENGTH];
struct house_control_rec temp_house;
int virt_house, real_house, real_atrium, virt_atrium, exit_num;
long owner;
if (num_of_houses >= MAX_HOUSES) {
send_to_char("Max houses already defined.\r\n", ch);
return;
}
/* first arg: house's vnum */
arg = one_argument(arg, arg1);
if (!*arg1) {
send_to_char(HCONTROL_FORMAT, ch);
return;
}
virt_house = atoi(arg1);
if ((real_house = real_room(virt_house)) < 0) {
send_to_char("No such room exists.\r\n", ch);
return;
}
if ((find_house(virt_house)) >= 0) {
send_to_char("House already exists.\r\n", ch);
return;
}
/* second arg: direction of house's exit */
arg = one_argument(arg, arg1);
if (!*arg1) {
send_to_char(HCONTROL_FORMAT, ch);
return;
}
if ((exit_num = search_block(arg1, dirs, FALSE)) < 0) {
sprintf(buf, "'%s' is not a valid direction.\r\n", arg1);
send_to_char(buf, ch);
return;
}
if (TOROOM(real_house, exit_num) == NOWHERE) {
sprintf(buf, "There is no exit %s from room %d.\r\n", dirs[exit_num],
virt_house);
send_to_char(buf, ch);
return;
}
real_atrium = TOROOM(real_house, exit_num);
virt_atrium = world[real_atrium].number;
if (TOROOM(real_atrium, rev_dir[exit_num]) != real_house) {
send_to_char("A house's exit must be a two-way door.\r\n", ch);
return;
}
/* third arg: player's name */
arg = one_argument(arg, arg1);
if (!*arg1) {
send_to_char(HCONTROL_FORMAT, ch);
return;
}
if ((owner = get_id_by_name(arg1)) < 0) {
sprintf(buf, "Unknown player '%s'.\r\n", arg1);
send_to_char(buf, ch);
return;
}
temp_house.mode = HOUSE_PRIVATE;
temp_house.vnum = virt_house;
temp_house.atrium = virt_atrium;
temp_house.exit_num = exit_num;
temp_house.built_on = time(0);
temp_house.last_payment = 0;
temp_house.owner = owner;
temp_house.num_of_guests = 0;
house_control[num_of_houses++] = temp_house;
SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_HOUSE);
SET_BIT_AR(ROOM_FLAGS(real_house), ROOM_PRIVATE);
SET_BIT_AR(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
House_crashsave(virt_house);
send_to_char("House built. Mazel tov!\r\n", ch);
House_save_control();
}
示例2: do_ban
void do_ban( CHAR_DATA* ch, const char* argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char arg3[MAX_INPUT_LENGTH];
char arg4[MAX_INPUT_LENGTH];
char *temp;
BAN_DATA *pban;
int value = 0, btime;
if( IS_NPC( ch ) ) /* Don't want mobs banning sites ;) */
{
send_to_char( "Monsters are too dumb to do that!\r\n", ch );
return;
}
if( !ch->desc ) /* No desc means no go :) */
{
bug( "%s", "do_ban: no descriptor" );
return;
}
set_char_color( AT_IMMORT, ch );
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
argument = one_argument( argument, arg3 );
argument = one_argument( argument, arg4 );
/*
* Do we have a time duration for the ban?
*/
if( arg4[0] != '\0' && is_number( arg4 ) )
btime = atoi( arg4 );
else
btime = -1;
/*
* -1 is default, but no reason the time should be greater than 1000
* * or less than 1, after all if it is greater than 1000 you are talking
* * around 3 years.
*/
if( btime != -1 && ( btime < 1 || btime > 1000 ) )
{
send_to_char( "Time value is -1 (forever) or from 1 to 1000.\r\n", ch );
return;
}
/*
* Need to be carefull with sub-states or everything will get messed up.
*/
switch ( ch->substate )
{
default:
bug( "%s", "do_ban: illegal substate" );
return;
case SUB_RESTRICTED:
send_to_char( "You cannot use this command from within another command.\r\n", ch );
return;
case SUB_NONE:
ch->tempnum = SUB_NONE;
break;
/*
* Returning to end the editing of the note
*/
case SUB_BAN_DESC:
add_ban( ch, "", "", 0, 0 );
return;
}
if( arg1[0] == '\0' )
goto syntax_message;
/*
* If no args are sent after the class/site/race, show the current banned
* * items. Shaddai
*/
if( !str_cmp( arg1, "site" ) )
{
if( arg2[0] == '\0' )
{
show_bans( ch, BAN_SITE );
return;
}
/*
* Are they high enough to ban sites?
*/
if( get_trust( ch ) < sysdata.ban_site_level )
{
ch_printf( ch, "You must be %d level to add bans.\r\n", sysdata.ban_site_level );
return;
}
if( arg3[0] == '\0' )
//.........这里部分代码省略.........
示例3: do_warn
/*
* Sets the warn flag on bans.
*/
void do_warn( CHAR_DATA* ch, const char* argument)
{
char arg1[MAX_STRING_LENGTH];
char arg2[MAX_STRING_LENGTH];
char *name;
int count = -1, type;
BAN_DATA *pban;
/*
* Don't want mobs or link-deads doing this.
*/
if( IS_NPC( ch ) )
{
send_to_char( "Monsters are too dumb to do that!\r\n", ch );
return;
}
if( !ch->desc )
{
bug( "%s", "do_warn: no descriptor" );
return;
}
argument = one_argument( argument, arg1 );
argument = one_argument( argument, arg2 );
if( arg1[0] == '\0' || arg2[0] == '\0' )
goto syntax_message;
if( arg2[0] == '#' )
{
name = arg2;
name++;
if( !is_number( name ) )
goto syntax_message;
count = atoi( name );
if( count < 1 )
{
send_to_char( "The number has to be above 0.\r\n", ch );
return;
}
}
/*
* We simply set up which ban list we will be looking at here.
*/
if( !str_cmp( arg1, "class" ) )
type = BAN_CLASS;
else if( !str_cmp( arg1, "race" ) )
type = BAN_RACE;
else if( !str_cmp( arg1, "site" ) )
type = BAN_SITE;
else
type = -1;
if( type == BAN_CLASS )
{
pban = first_ban_class;
arg2[0] = toupper( arg2[0] );
}
else if( type == BAN_RACE )
{
pban = first_ban_race;
arg2[0] = toupper( arg2[0] );
}
else if( type == BAN_SITE )
{
pban = first_ban;
}
else
goto syntax_message;
for( ; pban && count != 0; count--, pban = pban->next )
if( count == -1 && !str_cmp( pban->name, arg2 ) )
break;
if( pban )
{
/*
* If it is just a warn delete it, otherwise remove the warn flag.
*/
if( pban->warn )
{
if( pban->level == BAN_WARN )
{
dispose_ban( pban, type );
send_to_char( "Warn has been deleted.\r\n", ch );
}
else
{
pban->warn = FALSE;
send_to_char( "Warn turned off.\r\n", ch );
}
}
else
{
//.........这里部分代码省略.........
示例4: do_prayer
//Command Status: Installed, fairly well tested, near completetion.
void do_prayer( CHAR_DATA *ch, char *argument )
{
char arg[MIL];
AFFECT_DATA af;
one_argument( argument, arg );
if ( IS_NPC( ch ) )
return;
if ( IS_AFFECTED( ch, AFF_CHARM ) )
return;
if ( !arg || arg[0] == '\0' ) {
send_to_char( "Syntax: Prayer start\r\nSyntax: Prayer stop\r\n", ch );
return;
}
if ( !IS_AWAKE( ch ) ) {
send_to_char( "You cant pray while asleep.", ch );
return;
}
if ( ch->position == POS_MEDITATING ) {
send_to_char( "You are already meditating!\r\n", ch );
return;
}
if ( IS_AFFECTED( ch, AFF_PRAYER ) && !str_cmp( arg, "start" ) ) {
send_to_char( "But you're already praying.\r\n", ch );
return;
}
if ( !str_cmp( arg, "start" ) ) {
if ( can_use_skill( ch, number_percent( ), gsn_prayer ) ) {
if ( ch->fighting ) {
send_to_char( "You cannot start a prayer during combat.\r\n", ch );
return;
}
send_to_char( "You close your eyes and begin to pray.\r\n", ch );
af.type = gsn_prayer;
af.location = APPLY_NONE;
af.modifier = 0;
af.level = ch->level;
af.duration = -1;
af.bitvector = meb( AFF_PRAYER );
affect_to_char( ch, &af );
learn_from_success( ch, gsn_prayer );
}
else {
send_to_char( "You can't seem to concentrate enough to properly pray.\r\n", ch );
learn_from_failure( ch, gsn_prayer );
}
return;
}
if ( !str_cmp( arg, "stop" ) ) {
if ( !IS_AFFECTED( ch, AFF_PRAYER ) ) {
send_to_char( "But you're not praying.\r\n", ch );
return;
}
if ( ch->position != POS_STANDING )
set_position( ch, POS_STANDING );
send_to_char( "You come to an end in your prayer and slowly open your eyes.\r\n", ch );
affect_strip( ch, gsn_prayer );
xREMOVE_BIT( ch->affected_by, AFF_PRAYER );
return;
}
}
示例5: money_from_char_to_char
/**
* przekazywanie pieniêdzy
*/
bool money_from_char_to_char( CHAR_DATA *ch, CHAR_DATA *victim, long int amount, int nomination )
{
char buf [ MAX_INPUT_LENGTH ];
int multiplier = RATTING_NONE;
switch ( nomination )
{
case NOMINATION_COPPER:
if ( ch->copper < amount )
{
send_to_char( "Przecie¿ nie masz a¿ tylu miedzianych monet.\n\r", ch );
return FALSE;
}
ch->copper -= amount;
victim->copper += amount;
multiplier = RATTING_COPPER;
break;
case NOMINATION_SILVER:
if ( ch->silver < amount )
{
send_to_char( "Przecie¿ nie masz a¿ tylu srebrnych monet.\n\r", ch );
return FALSE;
}
ch->silver -= amount;
victim->silver += amount;
multiplier = RATTING_SILVER;
break;
case NOMINATION_GOLD:
if ( ch->gold < amount )
{
send_to_char( "Przecie¿ nie masz a¿ tylu z³otych monet.\n\r", ch );
return FALSE;
}
ch->gold -= amount;
victim->gold += amount;
multiplier = RATTING_GOLD;
break;
case NOMINATION_MITHRIL:
if ( ch-> mithril < amount )
{
send_to_char( "Przecie¿ nie masz a¿ tylu mithrilowych monet.\n\r", ch );
return FALSE;
}
ch->mithril -= amount;
victim->mithril += amount;
multiplier = RATTING_MITHRIL;
break;
default:
send_to_char( "Ale o co chodzi z tymi wszystkimi monetami?\n\r", ch );
return FALSE;
}
sprintf ( buf, "$n daje ci %s.", money_string_simple( amount, nomination, TRUE ) );
act( buf, ch, NULL, victim, TO_VICT );
act( "$n daje $X trochê monet.", ch, NULL, victim, TO_NOTVICT );
sprintf ( buf, "Dajesz $X %s.", money_string_simple( amount, nomination, TRUE ) );
act( buf, ch, NULL, victim, TO_CHAR );
amount *= multiplier;
append_file_format_daily
(
ch,
MONEY_LOG_FILE,
"-> S: %d %d (%d) - da³ kasê postaci %s",
money_count_copper( ch ) + amount,
money_count_copper( ch ),
-amount,
IS_NPC( victim ) ? victim->short_descr : victim->name
);
append_file_format_daily
(
victim,
MONEY_LOG_FILE,
"-> S: %d %d (%d) - dosta³ kasê od postaci %s",
money_count_copper( victim ) - amount,
money_count_copper( victim ),
amount,
IS_NPC( ch ) ? ch->short_descr : ch->name
);
return TRUE;
}
示例6: show_board
/*
* Stampa su scermo la scacchiera in grande
*/
void show_board( CHAR_DATA *ch, CHESSBOARD_DATA *board )
{
char buf[MSL*2];
int x;
int y;
if ( !ch )
{
send_log( NULL, LOG_BUG, "show_board: ch passato è NULL" );
return;
}
if ( !board )
{
send_log( NULL, LOG_BUG, "show_board: board passata è NULL" );
return;
}
send_to_char( ch, "&W 1 2 3 4 5 6 7 8\r\n" );
buf[0] = '\0';
for ( x = 0; x < 8; x++ )
{
/* Prima linea */
sprintf( buf+strlen(buf), " " );
for ( y = 0; y < 8; y++ )
{
if ( (x%2) == 0 )
strcat( buf, (y%2 == 0) ? WHITE_BACK : BLACK_BACK );
else
strcat( buf, (y%2 == 0) ? BLACK_BACK : WHITE_BACK );
strcat( buf, table_pieces[PIECE_NONE].wgraph1 );
}
sprintf( buf+strlen(buf), "%s\r\n", BLACK_BACK );
/* Seconda linea */
sprintf( buf+strlen(buf), "&W%c ", 'A' + x );
for ( y = 0; y < 8; y++ )
{
if ( (x%2) == 0 )
strcat( buf, (y%2 == 0) ? WHITE_BACK : BLACK_BACK );
else
strcat( buf, (y%2 == 0) ? BLACK_BACK : WHITE_BACK );
strcat( buf, (board->color[x][y] == COLOR_WHITE) ? WHITE_FORE : BLACK_FORE );
strcat( buf, (board->color[x][y] == COLOR_WHITE) ? table_pieces[board->piece[x][y]].wgraph1 : table_pieces[board->piece[x][y]].bgraph1 );
}
sprintf( buf+strlen(buf), "%s\r\n", BLACK_BACK );
/* Terza linea */
sprintf( buf+strlen(buf), " " );
for ( y = 0; y < 8; y++ )
{
if ( (x%2) == 0 )
strcat( buf, (y%2 == 0) ? WHITE_BACK : BLACK_BACK );
else
strcat( buf, (y%2 == 0) ? BLACK_BACK : WHITE_BACK );
strcat( buf, (board->color[x][y] == COLOR_WHITE) ? WHITE_FORE : BLACK_FORE );
strcat( buf, (board->color[x][y] == COLOR_WHITE) ? table_pieces[board->piece[x][y]].wgraph2 : table_pieces[board->piece[x][y]].bgraph2 );
}
sprintf( buf+strlen(buf), "%s\r\n", BLACK_BACK );
}
ch_printf( ch, "%s&w", buf );
}
示例7: is_valid_move
/*
* Controlla e ritorna il tipo di mossa effettuata
*/
int is_valid_move( CHAR_DATA *ch, CHESSBOARD_DATA *board, int x, int y, int dx, int dy )
{
if ( !ch )
{
send_log( NULL, LOG_BUG, "is_valid_move: ch è NULL" );
return MOVE_INVALID;
}
if ( !board )
{
send_log( NULL, LOG_BUG, "is_valid_move: board è NULL" );
return MOVE_INVALID;
}
if ( x < 0 || y < 0 || x >= 8 || y >= 8 )
{
send_log( NULL, LOG_BUG, "is_valid_move: coordinate passate errate: x=%d y =%d", x, y );
return MOVE_INVALID;
}
if ( dx < 0 || dy < 0 || dx >= 8 || dy >= 8 )
{
send_log( NULL, LOG_BUG, "is_valid_move: coordinate passate errate: dx=%d dy =%d", dx, dy );
return MOVE_OFFBOARD;
}
if ( board->piece[x][y] == PIECE_NONE )
{
send_to_char( ch, "Non trovo nessun pezzo in quella casella.\r\n" );
return MOVE_INVALID;
}
if ( x == dx && y == dy )
{
send_to_char( ch, "La sorgente e l'arrivo della mossa sono identiche.\r\n" );
return MOVE_INVALID;
}
if ( (board->color[x][y] == COLOR_WHITE && ch == board->player1)
|| (board->color[x][y] == COLOR_BLACK && ch == board->player2) )
{
send_to_char( ch, "Sto cercando di muovere un pezzo che non è del mio colore.\r\n" );
return MOVE_WRONGCOLOR;
}
switch ( board->piece[x][y] )
{
default:
send_log( NULL, LOG_BUG, "is_valid_move():chess.c invaild piece: %d", board->piece[x][y] );
send_to_char( ch, "-> Mossa sbagliata, avverti i Coder <-" );
return MOVE_INVALID;
break;
case PIECE_PAWN:
if ( board->color[x][y] == COLOR_WHITE && dx == x+2 && x == 1 && dy == y
&& board->piece[dx][dy] == PIECE_NONE && board->piece[x+1][dy] == PIECE_NONE )
return MOVE_OK;
if ( board->color[x][y] == COLOR_BLACK && dx == x-2 && x == 6 && dy == y
&& board->piece[dx][dy] == PIECE_NONE && board->piece[x-1][dy] == PIECE_NONE )
return MOVE_OK;
if ( (board->color[x][y] == COLOR_WHITE && dx != x+1)
|| (board->color[x][y] == COLOR_BLACK && dx != x-1) )
{
send_to_char( ch, "Debbo muovere il pedone di un passo per volta, solo dalle caselle di partenza del pedone è consentito una mossa da 2.\r\n" );
return MOVE_INVALID;
}
if ( dy != y && dy != y-1 && dy != y+1 )
{
send_to_char( ch, "Debbo muovere il pedone sempre in avanti, oppure in diagonale di una casella quando può fare gambetto.\r\n" );
return MOVE_INVALID;
}
if ( dy == y )
{
if ( board->piece[dx][dy] == PIECE_NONE )
return MOVE_OK;
if ( SAME_COLOR(x, y, dx, dy) )
{
send_to_char( ch, "Non posso muovere dove c'è un'altro pezzo del mio stesso colore.\r\n" );
return MOVE_SAMECOLOR;
}
send_to_char( ch, "Non posso eseguire questa mossa.\r\n" );
return MOVE_BLOCKED;
}
else
{
if ( board->piece[dx][dy] == PIECE_NONE )
{
/* (FF) (bb) Bisognerebbe gestire anche il gambetto */
send_to_char( ch, "Non c'è nessun pezzo da mangiare in quella casella.\r\n" );
return MOVE_INVALID;
}
if ( SAME_COLOR(x, y, dx, dy) )
{
//.........这里部分代码省略.........
示例8: build_save_rooms
void build_save_rooms()
{
ROOM_INDEX_DATA *pRoomIndex;
EXTRA_DESCR_DATA *pEd;
int d;
EXIT_DATA *pexit;
int locks=0;
if (Pointer==NULL) /* Start */
{
if (CurSaveArea->first_area_room==NULL)
{
Section++;
return;
}
send_to_char("Saving rooms.\n",CurSaveChar);
fprintf(SaveFile,"#ROOMS\n");
Pointer=CurSaveArea->first_area_room;
}
pRoomIndex=Pointer->data;
fprintf(SaveFile,"#%i\n",pRoomIndex->vnum);
fprintf(SaveFile,"%s~\n",pRoomIndex->name);
fprintf(SaveFile,"%s~\n",pRoomIndex->description);
fprintf(SaveFile,"%i %i\n",pRoomIndex->room_flags,pRoomIndex->sector_type);
/* Now do doors. */
for (d=0;d<6;d++)
{
if (pRoomIndex->exit[d] )
{
fprintf(SaveFile,"D%i\n",d);
pexit=pRoomIndex->exit[d];
fprintf(SaveFile,"%s~\n",pexit->description);
fprintf(SaveFile,"%s~\n",pexit->keyword);
/* Deal with locks */
/* -S- Mod: Filter out EX_LOCKED and EX_CLOSED and save exit_info */
locks=pexit->exit_info;
if ( IS_SET( locks, EX_CLOSED ) )
REMOVE_BIT( locks, EX_CLOSED );
if ( IS_SET( locks, EX_LOCKED ) )
REMOVE_BIT( locks, EX_LOCKED );
#if 0
/* BUG: before, an isdoor OR pickproof flag alone would give locks=1 */
if (pexit->exit_info & EX_ISDOOR)
locks++;
if (pexit->exit_info & EX_PICKPROOF)
locks++;
#endif
fprintf(SaveFile,"%i %i %i\n",locks,pexit->key,pexit->vnum);
}
}
/* Now do extra descripts.. */
pEd=pRoomIndex->first_exdesc;
while (pEd)
{
fprintf(SaveFile,"E\n");
fprintf(SaveFile,"%s~\n",pEd->keyword);
fprintf(SaveFile,"%s~\n",pEd->description);
pEd=pEd->next;
}
/* End of one room */
fprintf(SaveFile,"S\n");
Pointer=Pointer->next;
if (Pointer==NULL) /* End */
{
fprintf(SaveFile,"#0\n");
Section++;
}
return;
}
示例9: show_char_to_char
void show_char_to_char(struct char_data *i, struct char_data *ch, int mode)
{
char buffer[MAX_STRING_LENGTH];
int j, found, percent;
struct obj_data *tmp_obj;
if (mode == 0) {
if (IS_AFFECTED(i, AFF_HIDE) || !CAN_SEE(ch,i)) {
if (IS_AFFECTED(ch, AFF_SENSE_LIFE))
send_to_char("You sense a hidden life form in the room.\n\r", ch);
return;
}
if (!(i->player.long_descr)||(GET_POS(i) != i->specials.default_pos)) {
/* A player char or a mobile without long descr, or not in default pos. */
if (!IS_NPC(i)) {
strcpy(buffer,GET_NAME(i));
strcat(buffer," ");
strcat(buffer,GET_TITLE(i));
} else {
strcpy(buffer, i->player.short_descr);
CAP(buffer);
}
if ( IS_AFFECTED(i,AFF_INVISIBLE))
strcat(buffer," (invisible)");
switch(GET_POS(i)) {
case POSITION_STUNNED :
strcat(buffer," is lying here, stunned.");
break;
case POSITION_INCAP :
strcat(buffer," is lying here, incapacitated.");
break;
case POSITION_MORTALLYW:
strcat(buffer," is lying here, mortally wounded.");
break;
case POSITION_DEAD :
strcat(buffer," is lying here, dead.");
break;
case POSITION_STANDING :
strcat(buffer," is standing here.");
break;
case POSITION_SITTING :
strcat(buffer," is sitting here.");
break;
case POSITION_RESTING :
strcat(buffer," is resting here.");
break;
case POSITION_SLEEPING :
strcat(buffer," is sleeping here.");
break;
case POSITION_FIGHTING :
if (i->specials.fighting) {
strcat(buffer," is here, fighting ");
if (i->specials.fighting == ch)
strcat(buffer," YOU!");
else {
if (i->in_room == i->specials.fighting->in_room)
if (IS_NPC(i->specials.fighting))
strcat(buffer, i->specials.fighting->player.short_descr);
else
strcat(buffer, GET_NAME(i->specials.fighting));
else
strcat(buffer, "someone who has already left.");
}
} else /* NIL fighting pointer */
strcat(buffer," is here struggling with thin air.");
break;
default :
strcat(buffer," is floating here.");
break;
}
if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
if (IS_EVIL(i))
strcat(buffer, " (Red Aura)");
}
strcat(buffer,"\n\r");
send_to_char(buffer, ch);
}
else /* npc with long */
{
if (IS_AFFECTED(i,AFF_INVISIBLE))
strcpy(buffer,"*");
else
*buffer = '\0';
if (IS_AFFECTED(ch, AFF_DETECT_EVIL)) {
if (IS_EVIL(i))
strcat(buffer, " (Red Aura)");
}
strcat(buffer, i->player.long_descr);
send_to_char(buffer, ch);
}
//.........这里部分代码省略.........
示例10: build_save_mobs
void build_save_mobs()
{
MOB_INDEX_DATA *pMobIndex;
MPROG_DATA* mprg;
int finish_progs;
if (Pointer==NULL) /* Start */
{
if (CurSaveArea->first_area_mobile==NULL)
{
Section++;
return;
}
send_to_char("Saving mobs.\n",CurSaveChar);
fprintf(SaveFile,"#MOBILES\n");
Pointer=CurSaveArea->first_area_mobile;
}
pMobIndex=Pointer->data;
fprintf(SaveFile,"#%i\n",pMobIndex->vnum);
fprintf(SaveFile,"%s~\n",pMobIndex->player_name);
fprintf(SaveFile,"%s~\n",pMobIndex->short_descr);
fprintf(SaveFile,"%s~\n",pMobIndex->long_descr);
fprintf(SaveFile,"%s~\n",pMobIndex->description);
fprintf(SaveFile,"%i %i %i S\n",pMobIndex->act,
pMobIndex->affected_by,pMobIndex->alignment);
fprintf(SaveFile,"%i %i\n",pMobIndex->level,pMobIndex->sex);
fprintf(SaveFile,"%i %i %i\n",pMobIndex->ac_mod, pMobIndex->hr_mod,
pMobIndex->dr_mod);
/* Save in Envy format.... */
/* fprintf(Envy,"#%i\n",((pMobIndex->vnum)+offset) ); */
/* fprintf(Envy,"%s~\n",pMobIndex->player_name); */
/* fprintf(Envy,"%s~\n",pMobIndex->short_descr); */
/* fprintf(Envy,"%s~\n",pMobIndex->long_descr); */
/* fprintf(Envy,"%s~\n",pMobIndex->description); */
/* fprintf(Envy,"%i %i %i S\n",pMobIndex->act, */
/* pMobIndex->affected_by,pMobIndex->alignment); */
/* fprintf(Envy,"%i 0 0 0d0+0 0d0+0\n0 0\n0 0 */
/* %i\n",convert(pMobIndex->level),pMobIndex->sex); */
/* Write out new details - clan, class, race and skills
* The '!' signifies new section to load_mobiles() in db.c
*/
fprintf( SaveFile, "! %i %i %i %i %i %i %i\n",
pMobIndex->class,
pMobIndex->clan,
pMobIndex->race,
pMobIndex->position,
pMobIndex->skills,
pMobIndex->cast,
pMobIndex->def );
mprg=pMobIndex->first_mprog;
finish_progs=0;
while (mprg)
{
if (mprg->filename == NULL)
{
fprintf(SaveFile,">%s ",mprog_type_to_name(mprg->type));
fprintf(SaveFile,"%s~\n",mprg->arglist);
fprintf(SaveFile,"%s~\n",mprg->comlist);
finish_progs=1;
}
mprg=mprg->next;
}
if (finish_progs)
{
fprintf(SaveFile,"|\n");
}
Pointer=Pointer->next;
if (Pointer==NULL) /* End */
{
fprintf(SaveFile,"#0\n");
Section++;
}
return;
}
示例11: build_save_objects
void build_save_objects()
{
OBJ_INDEX_DATA *pObject;
AFFECT_DATA * pAf;
EXTRA_DESCR_DATA *pEd;
int val0,val1,val2,val3;
if (Pointer==NULL) /* Start */
{
if (CurSaveArea->first_area_object==NULL)
{
Section++;
return;
}
send_to_char("Saving objects.\n",CurSaveChar);
fprintf(SaveFile,"#OBJECTS\n");
Pointer=CurSaveArea->first_area_object;
}
pObject=Pointer->data;
fprintf(SaveFile,"#%i\n",pObject->vnum);
fprintf(SaveFile,"%s~\n",pObject->name);
fprintf(SaveFile,"%s~\n",pObject->short_descr);
fprintf(SaveFile,"%s~\n",pObject->description);
fprintf(SaveFile,"%i %i %i %i\n",pObject->item_type,pObject->extra_flags,
pObject->wear_flags,pObject->item_apply);
/* Check for pills, potions, scrolls, staffs and wands. */
val0=pObject->value[0];
val1=pObject->value[1];
val2=pObject->value[2];
val3=pObject->value[3];
switch ( pObject->item_type )
{
case ITEM_PILL:
case ITEM_POTION:
case ITEM_SCROLL:
val1=val1<0 ? -1 : skill_table[val1].slot;
val2=val2<0 ? -1 : skill_table[val2].slot;
val3=val3<0 ? -1 : skill_table[val3].slot;
break;
case ITEM_STAFF:
case ITEM_WAND:
val3=val3<0 ? -1 : skill_table[val3].slot;
break;
}
fprintf(SaveFile,"%i %i %i %i\n",val0,val1,val2,val3);
fprintf(SaveFile,"%i\n",pObject->weight);
pAf=pObject->first_apply;
while (pAf)
{
fprintf(SaveFile,"A\n");
fprintf(SaveFile,"%i %i\n",pAf->location,pAf->modifier);
pAf=pAf->next;
}
pEd=pObject->first_exdesc;
while (pEd)
{
fprintf(SaveFile,"E\n");
fprintf(SaveFile,"%s~\n",pEd->keyword);
fprintf(SaveFile,"%s~\n",pEd->description);
pEd=pEd->next;
}
if ( ( pObject->level > 1 ) && (pObject->level < 130 ) )
{
fprintf(SaveFile, "L\n");
fprintf(SaveFile,"%d\n",pObject->level);
}
else
{
fprintf(SaveFile, "L\n");
fprintf(SaveFile,"%d\n", 1);
}
/* Now for Envy... taken from my OLC :P */
Pointer=Pointer->next;
if (Pointer==NULL) /* End */
{
fprintf(SaveFile,"#0\n");
Section++;
}
return;
}
示例12: substitute_alias
/* does aliasing and other fun stuff */
void substitute_alias(DESCRIPTOR_DATA *d, const char *argument)
{
CHAR_DATA *ch;
char buf[MAX_STRING_LENGTH],prefix[MAX_INPUT_LENGTH],name[MAX_INPUT_LENGTH];
const char *point;
char* lines;
int alias;
ch = d->original ? d->original : d->character;
/* check for prefix */
if (ch->prefix[0] != '\0' && str_prefix("prefix",argument)) {
if (strlen(ch->prefix) + strlen(argument) > MAX_INPUT_LENGTH)
send_to_char("Line to long, prefix not processed.\r\n",ch);
else {
sprintf(prefix,"%s %s",ch->prefix,argument);
argument = prefix;
}
}
if ( IS_NPC(ch)
|| ch->pcdata->alias[0] == NULL
|| !str_prefix("alias",argument) || !str_prefix("una",argument)
|| !str_prefix("prefix",argument)) {
interpret(d->character,argument);
return;
}
strcpy(buf,argument);
for (alias = 0; alias < MAX_ALIAS; alias++) { /* go through the aliases */
if (ch->pcdata->alias[alias] == NULL)
break;
if (!str_prefix(ch->pcdata->alias[alias],argument)) {
point = one_argument(argument,name);
if (!strcmp(ch->pcdata->alias[alias],name)) {
buf[0] = '\0';
strcat(buf,ch->pcdata->alias_sub[alias]);
if (*point != 0) {
strcat(buf," ");
strcat(buf,point);
}
break;
}
if (strlen(buf) > MAX_INPUT_LENGTH) {
send_to_char("Alias substitution too long. Truncated.\r\n",ch);
buf[MAX_INPUT_LENGTH -1] = '\0';
}
}
}
/* ';' is now command separator... By Oxtal 1997*/
if ( (lines = strchr(buf,';')) == NULL )
interpret(d->character,buf); // A single command : just play it
else {
// Process 1st cmd; delay others
char *sep;
int lineslen;
*lines = 0; // Truncate buf; lines = rest and lineslen... its length!
lines++;
lineslen = strlen(lines);
// replace ; by LF
for (sep = strchr(lines,';'); sep != NULL; sep = strchr(sep,';'))
*sep = '\n';
// Just put lines into the desc. buffer!
if ( lineslen + strlen(d->inbuf) + 1 >= sizeof(d->inbuf) - 10 ) {
send_to_char("Do you know that you've just failed to crash the mud?\n\r",ch);
return; // That's for spam's kings
}
else {
memmove(d->inbuf+lineslen+1,d->inbuf,strlen(d->inbuf)+1);
memcpy(d->inbuf,lines,lineslen);
d->inbuf[lineslen] = '\n';
//send_to_charf(ch,"Buf %s\n\r",d->inbuf);
}
// Then play 1st cmd
interpret(d->character,buf);
}
}
示例13: do_alias
void do_alias(CHAR_DATA *ch, const char *argument)
{
CHAR_DATA *rch;
char arg[MAX_INPUT_LENGTH],buf[MAX_STRING_LENGTH];
// Modified by SinaC 2001 int before
unsigned int pos;
// smash_tilde(argument);
if (ch->desc == NULL)
rch = ch;
else
rch = ch->desc->original ? ch->desc->original : ch;
if (IS_NPC(rch))
return;
argument = one_argument(argument,arg);
if (arg[0] == '\0') {
if (rch->pcdata->alias[0] == NULL) {
send_to_char("You have no aliases defined.\n\r",ch);
return;
}
send_to_char("Your current aliases are:\n\r",ch);
for (pos = 0; pos < MAX_ALIAS; pos++) {
if (rch->pcdata->alias[pos] == NULL
|| rch->pcdata->alias_sub[pos] == NULL)
break;
sprintf(buf," %s: %s\n\r",rch->pcdata->alias[pos],
rch->pcdata->alias_sub[pos]);
send_to_char(buf,ch);
}
return;
}
if (!str_prefix("una",arg) || !str_cmp("alias",arg)) {
send_to_char("Sorry, that word is reserved.\n\r",ch);
return;
}
if (argument[0] == '\0') {
for (pos = 0; pos < MAX_ALIAS; pos++) {
if (rch->pcdata->alias[pos] == NULL
|| rch->pcdata->alias_sub[pos] == NULL)
break;
if (!str_cmp(arg,rch->pcdata->alias[pos])) {
sprintf(buf,"%s aliases to '%s'.\n\r",rch->pcdata->alias[pos],
rch->pcdata->alias_sub[pos]);
send_to_char(buf,ch);
return;
}
}
send_to_char("That alias is not defined.\n\r",ch);
return;
}
// Added by SinaC 2000
for ( pos = 0; pos < strlen(arg); pos++ )
if ( arg[pos]=='\'' || arg[pos]=='"' ) {
send_to_char("Aliases with that kind of character are not allowed!\n\r", ch);
return;
}
/*
for ( pos = 0; pos < strlen(argument); pos++ )
if ( argument[pos]=='\'' || argument[pos]=='"' ) {
send_to_char("Aliases with that kind of character are not allowed!\n\r", ch);
return;
}
*/
if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix")) {
send_to_char("That shall not be done!\n\r",ch);
return;
}
for (pos = 0; pos < MAX_ALIAS; pos++) {
if (rch->pcdata->alias[pos] == NULL)
break;
if (!str_cmp(arg,rch->pcdata->alias[pos])) {/* redefine an alias */
rch->pcdata->alias_sub[pos] = str_dup(argument);
sprintf(buf,"%s is now realiased to '%s'.\n\r",arg,argument);
send_to_char(buf,ch);
return;
}
}
if (pos >= MAX_ALIAS) {
send_to_char("Sorry, you have reached the alias limit.\n\r",ch);
return;
}
/* make a new alias */
//.........这里部分代码省略.........
示例14: do_alia
void do_alia(CHAR_DATA *ch, const char *argument)
{
send_to_char("I'm sorry, alias must be entered in full.\n\r",ch);
return;
}
示例15: board_move_messages
/*
* Invia i messaggi delle mosse ai giocatori e a quelli della stanza
*/
void board_move_messages( CHAR_DATA *ch, int ret, char *extra )
{
CHESSBOARD_DATA *board;
CHAR_DATA *opp;
if ( !ch )
{
send_log( NULL, LOG_BUG, "board_move_messages: ch passato è NULL" );
return;
}
if ( ret < 0 || ret >= MAX_MOVE )
{
send_log( NULL, LOG_BUG, "board_move_messages: ret passato errato: %d", ret );
return;
}
if ( IS_MOB(ch) )
{
send_to_char( ch, "I mob non possono giocare a scacchi.\r\n" );
return;
}
board = get_chessboard( ch );
if ( !board )
{
send_to_char( ch, "Non sto giocando a nessuna partita di scacchi.\r\n" );
return;
}
if ( ch == board->player1 )
opp = board->player2;
else
opp = board->player1;
if ( !opp )
{
send_log( NULL, LOG_BUG, "board_move_messages: %s non ha nessun avversario", ch->name );
return;
}
show_board( ch, board );
show_board( opp, board );
switch ( ret )
{
case MOVE_OK:
ch_printf( ch, "Muovo, %s.\r\n", extra );
act( AT_ACTION, "$n muove, $t.\r\n", ch, extra, NULL, TO_ROOM );
break;
case MOVE_CASTLE:
ch_printf( ch, "Arrocco, %s.\r\n", extra );
act( AT_ACTION, "$n arrocca, $t.", ch, extra, NULL, TO_ROOM );
break;
case MOVE_PROMOTE:
ch_printf( ch, "Promuovo un pedone a %s.\r\n", extra );
act( AT_ACTION, "$n promuove un pedone a $t.", ch, extra, NULL, TO_ROOM );
break;
case MOVE_INVALID:
send_to_char( ch, "Non posso effettuare questa mossa.\r\n" );
break;
case MOVE_BLOCKED:
send_to_char( ch, "Sono bloccato in quella direzione.\r\n" );
break;
case MOVE_TAKEN:
send_to_char( ch, "Hai catturato un pezzo nemico!\r\n" );
act( AT_ACTION, "$n muove, $t, e cattura uno dei tuoi pezzi!", ch, extra, NULL, TO_ROOM );
break;
case MOVE_OFFBOARD:
send_to_char( ch, "Questa mossa mi porterebbe fuori la scacchiera.\r\n" );
break;
case MOVE_SAMECOLOR:
send_to_char( ch, "Uno dei miei stessi pezzi mi blocca la via.\r\n" );
break;
case MOVE_CHECK:
act( AT_ACTION, "Con questa mossa metto sotto scacco il re di $N.\r\n", ch, NULL, opp, TO_CHAR );
act( AT_ACTION, "$n prova una mossa e il re di $N è sotto scacco.", ch, NULL, opp, TO_NOVICT );
act( AT_ACTION, "$n prova una mossa e il tuo re è sotto scacco.", ch, NULL, opp, TO_VICT );
break;
case MOVE_WRONGCOLOR:
send_to_char( ch, "Questo non è uno dei miei pezzi.\r\n" );
break;
case MOVE_INCHECK:
send_to_char( ch, "Con questa mossa il mio re sarebbe sotto scacco, non posso eseguirla.\r\n" );
break;
}
}