Пример #1
0
void pet_make( int charaindex, char* message )
{
    int  ret;
    char msgbuf[64];
    int  enemynum;
    int  enemyid;
    int  i;

    enemyid  = atoi(message);
    enemynum = ENEMY_getEnemyNum();

    for( i=0; i<enemynum; i++ ){
        if( ENEMY_getInt( i, ENEMY_ID) == enemyid){
            break;
        }
    }
    if(i==enemynum) return;

    ret = ENEMY_createPetFromEnemyIndex( charaindex, i);
    snprintf( msgbuf, sizeof( msgbuf), "哦~以你的能力足以配得上一只传说宠物,好吧!就是你了。");
    CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW);
                
    for( i=0; i<CHAR_MAXPETHAVE; i++ ){
        if( CHAR_getCharPet( charaindex, i) == ret )break;
    }
  
    if( i==CHAR_MAXPETHAVE) i = 0;
    if( CHAR_CHECKINDEX( ret ) == TRUE ){
		CHAR_setMaxExpFromLevel( ret, CHAR_getInt( ret, CHAR_LV ));
    }
                                                                                                
    snprintf( msgbuf, sizeof( msgbuf ), "K%d", i );
    CHAR_sendStatusString( charaindex, msgbuf );
                     
    snprintf( msgbuf, sizeof( msgbuf ), "W%d", i );
    CHAR_sendStatusString( charaindex, msgbuf );
	
	for( i=0; i<CHAR_MAXPETHAVE; i++ )
		if( CHAR_getCharPet(charaindex, i) == ret )
			CHAR_send_K_StatusString(charaindex, i, CHAR_K_STRING_HP|CHAR_K_STRING_AI);
	
	LogPet(
		CHAR_getChar( charaindex, CHAR_NAME ), /* 平乓仿   */
		CHAR_getChar( charaindex, CHAR_CDKEY ),
		"凯恩",1,"PetMaker",
		CHAR_getInt( charaindex,CHAR_FLOOR),
		CHAR_getInt( charaindex,CHAR_X ),
		CHAR_getInt( charaindex,CHAR_Y ),
		CHAR_getChar( ret, CHAR_UNIQUECODE)   // shan 2001/12/14
	);
}
Пример #2
0
//¸ü»»³èÎï
BOOL CHECK_ReplacePET( int toindex)
{
	int i, petindex;
	BOOL Finds = FALSE;
	char szPet[256];

	if( CHAR_getWorkInt( toindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ) return FALSE;

	for( i=0; i<CHAR_MAXPETHAVE; i++)	{
		int array, ret;
		petindex = CHAR_getCharPet( toindex, i);
		if( !CHAR_CHECKINDEX( petindex) )continue;
		if( CHAR_getInt( petindex, CHAR_PETID) != 1133 ) continue;
		if( CHAR_getInt( petindex, CHAR_SLOT) != 7 ) continue;
		if( CHAR_getInt( petindex, CHAR_TRANSMIGRATION ) > 0 )continue;

		if( i == CHAR_getInt( toindex, CHAR_DEFAULTPET) )	{
			int fd = getfdFromCharaIndex( toindex);
			CHAR_setInt( toindex, CHAR_DEFAULTPET, -1);
			lssproto_KS_send( fd, -1, TRUE);
		}

		snprintf( szPet,sizeof( szPet), "½»³ö%s¡£", CHAR_getUseName( petindex) );
		CHAR_talkToCli( toindex, -1, szPet, CHAR_COLORYELLOW);
		LogPet(
			CHAR_getChar( toindex, CHAR_NAME ),
			CHAR_getChar( toindex, CHAR_CDKEY ),
			CHAR_getChar( petindex, CHAR_NAME),
			CHAR_getInt( petindex, CHAR_LV),
			"TenseiDel",
			CHAR_getInt( toindex,CHAR_FLOOR),
			CHAR_getInt( toindex,CHAR_X ),
			CHAR_getInt( toindex,CHAR_Y ),
			CHAR_getChar( petindex, CHAR_UNIQUECODE)
		);

		Finds = TRUE;
		CHAR_setCharPet( toindex, i, -1);
		CHAR_endCharOneArray( petindex );

		array = ENEMY_getEnemyArrayFromTempNo( 1133);
		if( !ENEMY_CHECKINDEX( array)) continue;
		ret = ENEMY_createPetFromEnemyIndex( toindex, array);
		if( !CHAR_CHECKINDEX( ret ) ) continue;

		snprintf( szPet, sizeof( szPet), "Äõ½%s¡£", CHAR_getUseName( ret) );
		CHAR_talkToCli( toindex, -1, szPet,  CHAR_COLORWHITE);

		LogPet(
			CHAR_getChar( toindex, CHAR_NAME ),
			CHAR_getChar( toindex, CHAR_CDKEY ),
			CHAR_getChar( ret, CHAR_NAME),
			CHAR_getInt( ret, CHAR_LV),
			"TenseiGet",
			CHAR_getInt( toindex,CHAR_FLOOR),
			CHAR_getInt( toindex,CHAR_X ),
			CHAR_getInt( toindex,CHAR_Y ),
			CHAR_getChar( ret, CHAR_UNIQUECODE)
		);

	}

	for( i=0; i<CHAR_MAXPETHAVE; i++){
		petindex = CHAR_getCharPet(toindex, i);
		if( !CHAR_CHECKINDEX( petindex) )continue;
		CHAR_complianceParameter( petindex );
		snprintf( szPet, sizeof( szPet ), "K%d", i);
		CHAR_sendStatusString( toindex, szPet );
		snprintf( szPet, sizeof( szPet ), "W%d", i);
		CHAR_sendStatusString( toindex, szPet );
	}

	return Finds;
}