Ejemplo n.º 1
0
void NPC_reCheckMyPetUnusual( int meindex, int toindex)//¼ì²é³èÎïÒì³£
{
	char *buf=NULL;
	int petindex,i;
	for( i=0; i<CHAR_MAXPETHAVE; i++)	{
		petindex = CHAR_getCharPet( toindex, i);
		if( !CHAR_CHECKINDEX( petindex) )continue;
		if( (buf=CHAR_getChar( petindex, CHAR_NAME)) == NULL ||
			strlen( buf) <= 0 ){
			char *PetNAME;
			int array, parry, petID;

			petID = CHAR_getInt( petindex, CHAR_PETID);
			array = ENEMY_getEnemyArrayFromTempNo( petID);

			if( !ENEMY_CHECKINDEX( array)){
				print("ANDY Pet(ID:%d) err Array:%d (file:%s %d) !! \n",
					petID, array, __FILE__, __LINE__ );
				continue;
			}
			parry = ENEMYTEMP_getEnemyTempArray( array);
			if( (PetNAME = ENEMYTEMP_getChar( parry, E_T_NAME)) == NULL ||
				strlen( PetNAME) <= 0 ){
				print("ANDY Pet(ID:%d) Array:%d err Name:%s (file:%s %d) !! \n",
					petID, array, (PetNAME==NULL)?"NULL":PetNAME, __FILE__, __LINE__ );
				continue;
			}
			char tempname[128];
			if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL)
				sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME));
			else
				sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME));
			CHAR_setChar( petindex, CHAR_NAME, tempname);
			CHAR_setChar( petindex, CHAR_USERPETNAME , "");
			//andy_log
			print("ANDY Pet(ID:%d) Name -> %s (%s:%s)(file:%s %d) !! \n",
				petID, PetNAME, CHAR_getUseName( toindex),
				CHAR_getChar( toindex, CHAR_CDKEY), __FILE__, __LINE__ );
		}
	}

	for( i=0; i<CHAR_MAXPETHAVE; i++){
		char szPet[256];
		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 );
	}
}
Ejemplo n.º 2
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
	);
}
Ejemplo n.º 3
0
BOOL CHECK_PETBBI( int toindex)
{
	int i, petindex, PetID;
	BOOL Finds = FALSE;
	char token[256];
	for( i=0; i < CHAR_MAXPETHAVE; i++)	{
		int parry, array, PetBBI;
		petindex = CHAR_getCharPet( toindex, i);
		if( !CHAR_CHECKINDEX( petindex) ) continue;
		PetID = CHAR_getInt( petindex, CHAR_PETID);
		array = ENEMY_getEnemyArrayFromTempNo( PetID);
		if( !ENEMY_CHECKINDEX( array)) continue;
		parry = ENEMYTEMP_getEnemyTempArray( array);
		PetBBI = ENEMYTEMP_getInt( parry, E_T_IMGNUMBER);

		if( CHAR_getInt( petindex, CHAR_BASEBASEIMAGENUMBER) != PetBBI ||
			CHAR_getInt( petindex, CHAR_BASEIMAGENUMBER) != PetBBI ){
			CHAR_setInt( petindex, CHAR_BASEBASEIMAGENUMBER, PetBBI);
			CHAR_setInt( petindex, CHAR_BASEIMAGENUMBER, PetBBI);
			sprintf( token, "ÐÞÕý%sͼºÅ", CHAR_getUseName( petindex));
			CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
			Finds = TRUE;
		}
		CHAR_setInt( petindex, CHAR_EARTHAT, ENEMYTEMP_getInt( parry, E_T_EARTHAT) );
		CHAR_setInt( petindex, CHAR_WATERAT, ENEMYTEMP_getInt( parry, E_T_WATERAT) );
		CHAR_setInt( petindex, CHAR_FIREAT, ENEMYTEMP_getInt( parry, E_T_FIREAT) );
		CHAR_setInt( petindex, CHAR_WINDAT, ENEMYTEMP_getInt( parry, E_T_WINDAT) );
		char tempname[128];
		if(strstr(CHAR_getChar(petindex,CHAR_NAME),"*")!=NULL)
			sprintf(tempname,"*%s",ENEMYTEMP_getChar( parry, E_T_NAME));
		else
			sprintf(tempname,"%s",ENEMYTEMP_getChar( parry, E_T_NAME));
		CHAR_setChar( petindex, CHAR_NAME, tempname);
		CHAR_setChar( petindex, CHAR_USERPETNAME , "");
	}
	for( i=0; i<CHAR_MAXPETHAVE; i++){
		char szPet[128];
		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 );
	}
	if( Finds == FALSE ){
		sprintf( token, "ûÓдíÎóͼºÅµÄ³èÎï");
		CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
	}
	return Finds;
}
Ejemplo n.º 4
0
int NPC_Lua_NLG_DelHaveIndexPet(lua_State *_NLL)
{
	CheckEx(_NLL, 2);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	int TM_PetHaveIndex = (int)lua_tointeger(_NLL, 2);
	int TM_Num = 1;
	int TM_PetIndex = -1;
	int TM_Ret = 0;
	
	if(TM_PetHaveIndex<0 || TM_PetHaveIndex>4){
		LRetErrInt(_NLL, -1, "传入的索引是无效的。");
	}
		TM_PetIndex = CHAR_getCharPet( TM_Index, TM_PetHaveIndex);
		
		if(!CHAR_CHECKINDEX(TM_PetIndex))
		{
			LRetErrInt(_NLL, -1, "传入的索引是无效的。");
		}

		TM_Ret = NPC_DelPet( TM_Index, TM_PetHaveIndex);
		if(TM_Ret < 0)
		{
			char TM_MsgBuff[128];
			snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "删除宠物时产生错误 错误号: %d。", TM_Ret);
			LRetErrInt(_NLL , -1, TM_MsgBuff);
		}

	LRetInt(_NLL, 1);
}
Ejemplo n.º 5
0
/*--½ý¤Ä¤¤¤Æ¤¤¤ë¤Î¤Ê¤é¡bTRUE¤òÊÖ¤¹--*/
BOOL NPC_PetHealerCheck(int talker)
{

	int petindex;
	int i;
	
	/*--¥Ú¥Ã¥È¤Ï¶³¤Þ¤±¤Ç²óÉü¤·¤Æ¤¢¹²¤ë--*/
	for(i=0;i<CHAR_MAXPETHAVE;i++){
    	petindex = CHAR_getCharPet(talker,i);

		if( petindex == -1  )  continue;

		/*  ¥­¥ã¥é¤Î    ¥Á¥§¥Ã¥¯    */
		if( !CHAR_CHECKINDEX( talker ) )  continue;
		
		
		if( CHAR_getInt(petindex,CHAR_HP) != CHAR_getWorkInt(petindex,CHAR_WORKMAXHP) )
		{
			return TRUE;
		}
	}
	
	return FALSE;

}
Ejemplo n.º 6
0
/*--輜勾中化中月及卅日}TRUE毛忒允--*/
BOOL NPC_PetHealerCheck(int talker)
{

	int petindex;
	int i;
	
	/*--矢永玄反雲引仃匹莢汊仄化丐僕月--*/
	for(i=0;i<CHAR_MAXPETHAVE;i++){
    	petindex = CHAR_getCharPet(talker,i);

		if( petindex == -1  )  continue;

		/*  平乓仿及    民尼永弁    */
		if( !CHAR_CHECKINDEX( talker ) )  continue;
		
		
		if( CHAR_getInt(petindex,CHAR_HP) != CHAR_getWorkInt(petindex,CHAR_WORKMAXHP) )
		{
			return TRUE;
		}
	}
	
	return FALSE;

}
Ejemplo n.º 7
0
void NPC_PetDate(int meindex,int talker,int select,char *token)
{
	
	int petindex;
	int cost;
	char *petname;
	char buf[1024];

	/*--·¥¡õÛͼ°âÙÓå¼À--*/
	CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,select);

	petindex = CHAR_getCharPet( talker, select-1);
        

   if( !CHAR_CHECKINDEX(petindex) ) return;

  	NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_REALY, buf);

	cost=NPC_GetCost(meindex,talker,petindex);

	petname = CHAR_getUseName( petindex);

	sprintf(token,"\nÊÇ[%s]û´í°É£¿""%s"
					"\n\n    ÂòÂô¼Û¸ñ         %d STONE\n"
					,petname,buf,cost);	
		
}
Ejemplo n.º 8
0
void NPC_PetDate2(int meindex,int talker,int select,char *token)
{
	
	int petindex;
	char *petname;
	CHAR_setWorkInt(talker,CHAR_WORKSHOPRELEVANT,select);

	petindex = CHAR_getCharPet( talker, select-1);
	if( !CHAR_CHECKINDEX(petindex) ) return;
	petname = CHAR_getUseName( petindex);
	sprintf(token,"\n¼Ä·Å[%s]"
					"\n\n    ¼Ä·Å¼Û¸ñ            %d stone\n"
					,petname, NPC_GETPOOLCOST( talker)
					);	
}
Ejemplo n.º 9
0
int NPC_Lua_NLG_DelPet(lua_State *_NLL)
{
	CheckEx2(_NLL, 2, 3);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	int TM_PetID = (int)lua_tointeger(_NLL, 2);
	int TM_Num = 1;
	int TM_PetIndex = -1;
	int TM_Ret = 0;
	int TM_Count = 0;

	if(lua_gettop(_NLL) == 3)
	{
		TM_Num = (int)lua_tointeger(_NLL, 3);
	}
	int i = 0;
	for(i = 0; i < CHAR_MAXPETHAVE ; i++)
	{
		TM_PetIndex = CHAR_getCharPet( TM_Index, i);
		
		if(!CHAR_CHECKINDEX(TM_PetIndex))
		{
			continue;
		}
		if(CHAR_getInt( TM_PetIndex, CHAR_PETID) != TM_PetID)
		{
			continue;
		}

		TM_Ret = NPC_DelPet( TM_Index, i);
		if(TM_Ret < 0)
		{
			char TM_MsgBuff[128];
			snprintf(TM_MsgBuff, sizeof(TM_MsgBuff), "删除宠物时产生错误 错误号: %d。", TM_Ret);
			LRetErrInt(_NLL , -1, TM_MsgBuff);
		}

		TM_Count++;
		if(TM_Count == TM_Num)
		{
			break;
		}
	}
	LRetInt(_NLL, TM_Count);
}
Ejemplo n.º 10
0
int NPCS_getUserPetAmount( int charaindex, int objID, int flg)
{
	int i, Amount=0, reAmount=0,petindex;
	for( i=0 ;i <CHAR_MAXPETHAVE; i++) {
		petindex = CHAR_getCharPet( charaindex, i);
		if( !CHAR_CHECKINDEX( petindex)){
			reAmount++;
		}else{
			if( CHAR_getInt( petindex, CHAR_PETID) == objID)
				Amount++;
		}
	}
	if( flg == 1 ){
		return Amount;
	}else{
		return reAmount;
	}

}
Ejemplo n.º 11
0
/*--        --*/
void NPC_CharmUp(int meindex,int talker)
{
	int cost;
	int i;
	int petindex;
	char petsend[64];	

	/*--云嗯毛蛹日仄引仄斤丹--*/
	cost = NPC_CharmCost( meindex, talker);
	CHAR_setInt( talker, CHAR_GOLD,
			CHAR_getInt( talker, CHAR_GOLD) - cost);
	CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);

	/*--    互ㄠㄟㄟ动晓卞卅月桦宁反雄娄卞ㄠㄟㄟ卞允月--*/
	if(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL >= 100) {
		CHAR_setInt( talker, CHAR_CHARM, 100);
	}else{
		/*--    毛本永玄--*/
		CHAR_setInt(talker, CHAR_CHARM,
	 			(CHAR_getInt( talker, CHAR_CHARM) + CHARMHEAL));
	}
	
	/*--旦  □正旦及凳蕙--*/
	CHAR_complianceParameter( talker );
	CHAR_send_P_StatusString( talker, CHAR_P_STRING_CHARM);


	/*--矢永玄及由仿丢□正毛凳蕙--*/
	for( i = 0 ; i < CHAR_MAXPETHAVE ; i++){
    	petindex = CHAR_getCharPet( talker, i);

		if( petindex == -1  )  continue;

	   /*  平乓仿及    民尼永弁    */
		if( !CHAR_CHECKINDEX( talker ) )  continue;

		/*--由仿丢□正譬帮--*/
		CHAR_complianceParameter( petindex );
		sprintf( petsend, "K%d", i );
		CHAR_sendStatusString( talker , petsend );
	}
}
Ejemplo n.º 12
0
BOOL PetTalk_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid)
{
	int petsel,petindex=-1;	

	for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++)     {
		petindex = CHAR_getCharPet( talker, petsel);
		if( petindex == -1  )
			continue;
	        if(CHAR_getInt( petindex, CHAR_PETID) !=  petid )
			continue;
		break;
	}
	if( petsel  == CHAR_MAXPETHAVE )	{
		return FALSE;
	}else	{	//找到条件宠
		if( PetTalk_BigSmallLastCheck( petLv, CHAR_getInt( petindex, CHAR_LV), flg ) == TRUE  )
			return TRUE;
	}
	return FALSE;                                             
}
Ejemplo n.º 13
0
BOOL NPCEnemy_CheckMyPet( int meindex, int talker, int petLv, int flg, int petid)
{
	int petsel,petindex=-1;	
	for(petsel=0 ; petsel < CHAR_MAXPETHAVE ; petsel++)     {
		petindex = CHAR_getCharPet( talker, petsel);
		if( petindex == -1  )
			continue;
	        if(CHAR_getInt( petindex, CHAR_PETID) !=  petid )
			continue;
		break;
	}
	if( petsel  == CHAR_MAXPETHAVE )	{
		return FALSE;
	}else	{	//找到條件寵
		switch( flg)	{
		case 0:
			if( CHAR_getInt( petindex, CHAR_LV) != petLv )
				return TRUE;
		break;
		case 1:
			if( CHAR_getInt( petindex, CHAR_LV) < petLv )
				return TRUE;
		break;
		case 2:
			if( CHAR_getInt( petindex, CHAR_LV) > petLv )
				return TRUE;
		break;
		case 3:
			if( CHAR_getInt( petindex, CHAR_LV) == petLv )
				return TRUE;
		break;
		}
		return FALSE;
	}
	return FALSE;                                             
}
Ejemplo n.º 14
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;
}
Ejemplo n.º 15
0
static void NPC_NewNpcMan_selectWindow( int meindex, int toindex, int num, int flg)
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
	char token[256];

	int buttontype = 0, windowtype = 0, windowno = 0;
	int fd = getfdFromCharaIndex( toindex);

	windowtype = WINDOW_MESSAGETYPE_MESSAGE;

	if(NPC_Util_isFaceToFace( meindex ,toindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( toindex, meindex, 1) == FALSE)
			return;
	}

	memset( npcarg, 0, sizeof( npcarg));
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		return;
	}

	memset( token, 0, sizeof( token));
	switch( num)	{
	case WINDOW_START:
		if( NPC_Util_GetStrFromStrWithDelim( npcarg, "START_MSG", token, sizeof( token) ) == NULL) {
			return;
		}
		buttontype = WINDOW_BUTTONTYPE_YESNO;
		windowno = NPC_PROGRAMEGINEER_DEFIND;
		break;
	case WINDOW_SELECT1:
		sprintf(token,"              ÇëÑ¡Ôñ"
			      "\n             ¡¶ÐÞÕý³èÎïÒì³£¡·"
				  "\n             ¡¶ÐÞÕý³èÎïͼºÅ¡·"
			      "\n              ¡¶¸ü»»ÁéÁ¦îø¡·"
#ifdef _PET_LOSTPET
				  "\n             ¡¶Áì»ØÒÅʧ³èÎï¡·"
#endif
//				  "\n            ¡¶»¹Ô­ÌúǹÈþ¶Ñµþ¡·"

				  );
		windowtype = WINDOW_MESSAGETYPE_SELECT;
		buttontype = WINDOW_BUTTONTYPE_CANCEL;
		windowno = NPC_PROGRAMEGINEER_SELECT2;
		break;
	case WINDOW_SELECT2:
		switch( flg){
		case 1://ÐÞÕý³èÎïÒì³£
			NPC_reCheckMyPetUnusual( meindex, toindex);
			CHAR_talkToCli( toindex, -1, "ÉíÉϳèÎï¼ì²éÍê±Ï!", CHAR_COLORYELLOW);
			return;
			break;
		case 2://ÐÞÕý³èÎïͼºÅ
			CHECK_PETBBI( toindex);
			return;
			break;
		case 3://¸ü»»ÁéÁ¦îø
			if( CHECK_ITEMEQUIT( toindex) == TRUE ){
				CHAR_talkToCli( toindex, -1, "¼ì²éÍê±Ï!", CHAR_COLORYELLOW);
			}
			return;
			break;

		case 4:
#ifdef _PET_LOSTPET
			if( NPC_reFindMyLostPet( meindex, toindex, token) == FALSE ){
				CHAR_talkToCli( toindex, -1, "²éÎÞ×ÊÁÏ£¡", CHAR_COLORYELLOW);
				return;
			}
			windowtype = WINDOW_MESSAGETYPE_SELECT;
			buttontype = WINDOW_BUTTONTYPE_CANCEL;
			windowno = NPC_PROGRAMEGINEER_SELECTLOSTPET;
#endif
			break;
		case 5: //»¹Ô­ÌúǹÈþ¶Ñµþ
//			NPC_reCheckItemPilenum( meindex, toindex);
			return;
			break;
		}
		break;
/*
	case WINDOW_SELECT3:
			{
				int petnum, petindex;
				petnum = atoi( data)-1;
				if( petnum >= CHAR_MAXPETHAVE || petnum < 0 ) return;
				petindex = CHAR_getCharPet( talker, petsel);
				if( !CHAR_CHECKINDEX(petindex) ) return;
				break;
			}
*/
	case WINDOW_SELECTLOSTPET:
#ifdef _PET_LOSTPET
		{
			int ret, i, ti, ltime, cost;
			Char ch;
			char msgbuf[256];
			char petstring1[2048];

			int havepetelement = CHAR_getCharPetElement( toindex);
			ti = flg;
			if( havepetelement < 0 ){
				CHAR_talkToCli( toindex, -1, "³èÎïÀ¸Î»ÒÑÂú£¡", CHAR_COLORYELLOW);
				return;
			}
			if( NPC_getLostPetString( meindex, toindex) == FALSE ) {
				CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
				return;
			}

			if( getStringFromIndexWithDelim( petstring[ti-1], "#", 2, petstring1, sizeof( petstring1)) == FALSE ){
				CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
				return;	
			}else{
				char buf1[256];
				if( getStringFromIndexWithDelim( petstring[ti-1], "|", 6, buf1, sizeof( buf1)) == FALSE ) return;
					ltime = atoi(buf1);
					ltime = time( NULL) - ltime;
					ltime = ltime/(60*60*24);
				if( getStringFromIndexWithDelim( petstring[ti-1], "|", 4, buf1, sizeof( buf1)) == FALSE ) return;
					cost = atoi( buf1);
#if 0	// ÐÞÕý±£Êͽð
				cost = cost + (ltime*100);
				cost = (cost>10000)?10000:cost;
#else
				cost = cost + (ltime*10000);
#endif
				if( CHAR_getInt( toindex, CHAR_GOLD) < cost ) {
					sprintf( buf1, "³èÎïÒѼķÅ%dÌ죬¹²Ðè%dʯ±Ò²Å¿ÉÁì»Ø¡£", ltime, cost);
					CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW);
					return;	
				}
			}


			ret = CHAR_makePetFromStringToArg( petstring1, &ch, -2);
			strcpy( petstring[ti-1], "");
			if( ret ) {
				char buf1[256];
				int petindex = PET_initCharOneArray( &ch );
				if( !CHAR_CHECKINDEX( petindex) ){
					CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
					return;
				}
				print("ANDY petindex:%d[%s]\n", petindex, CHAR_getChar( petindex, CHAR_NAME) );

				CHAR_complianceParameter( petindex );
				CHAR_setInt( petindex, CHAR_HP, CHAR_getWorkInt( petindex, CHAR_WORKMAXHP));
				CHAR_setWorkInt( petindex, CHAR_WORKPLAYERINDEX, toindex);
				CHAR_setCharPet( toindex, havepetelement, petindex);
				CHAR_setChar( petindex, CHAR_OWNERCDKEY,
							CHAR_getChar( toindex, CHAR_CDKEY));
				CHAR_setChar( petindex, CHAR_OWNERCHARANAME,
							CHAR_getChar( toindex, CHAR_NAME));

				if( NPC_backupLostPetString( toindex) == FALSE ){
					print("ANDY err backup petstring !!\n");
					return;
				}
				
				sprintf( buf1, "LostPGet:%d", cost);
				LogPet(
					CHAR_getChar( toindex, CHAR_NAME ),
					CHAR_getChar( toindex, CHAR_CDKEY ),
					CHAR_getChar( petindex, CHAR_NAME),
					CHAR_getInt( petindex, CHAR_LV),
					buf1,
					CHAR_getInt( toindex,CHAR_FLOOR),
					CHAR_getInt( toindex,CHAR_X ),
					CHAR_getInt( toindex,CHAR_Y ),
					CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14
				);
				sprintf( buf1, "ÁìÈ¡³èÎï%s¡£", CHAR_getUseName( petindex));
				CHAR_talkToCli( toindex, meindex, buf1, CHAR_COLORYELLOW);
				for( i = 0; i < CHAR_MAXPETHAVE; i++){
					int petindex = CHAR_getCharPet( toindex, i);
					if( !CHAR_CHECKINDEX( petindex) )
						continue;
					CHAR_complianceParameter( petindex );
					snprintf( msgbuf, sizeof( msgbuf ), "K%d", i );
					CHAR_sendStatusString( toindex, msgbuf );
					snprintf( msgbuf, sizeof( msgbuf ), "W%d", i );
					CHAR_sendStatusString( toindex, msgbuf );
				}
				CHAR_DelGold( toindex, cost);
			}else{
					CHAR_talkToCli( toindex, -1, "ÁìÈ¡³èÎïʧ°Ü£¡", CHAR_COLORYELLOW);
					return;
			}
			return;
 		}
#endif
		return;
		break;
	case WINDOW_DEFIND:
		{
			int i;
			int face = CHAR_getInt( toindex, CHAR_FACEIMAGENUMBER);
			if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECK_MSG", token, sizeof( token) ) == NULL) {
				return;
			}
			for( i=0; i<48; i++){
				if( face >= checkPc[i][0] && face < checkPc[i][1] )
					break;
			}
			if( i >= 48 )return;
			CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, meindex);
			CHAR_setInt( toindex, CHAR_BASEIMAGENUMBER, checkPc[i][2]);
			CHAR_complianceParameter( toindex );
			CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX ));
			CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);

			buttontype = WINDOW_BUTTONTYPE_YESNO;
			windowno = NPC_PROGRAMEGINEER_END;
		}
		break;
	case WINDOW_END:
		{
			CHAR_setWorkInt( toindex, CHAR_WORKNPCMETAMO, -1);
			CHAR_setInt( toindex, CHAR_BASEBASEIMAGENUMBER,
				CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) );

			CHAR_complianceParameter( toindex );
			CHAR_sendCToArroundCharacter( CHAR_getWorkInt( toindex , CHAR_WORKOBJINDEX ));
			CHAR_send_P_StatusString( toindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
			return;
		}
		break;
	}

	lssproto_WN_send( fd, windowtype, buttontype, windowno,
		CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), token);
}
Ejemplo n.º 16
0
/*-------------------------------------
	  端卞覲菁  午竣  毛莢汊今六月午仇欠
---------------------------------------*/
void NPC_WindowHealerAllHeal( int talker,int mode )
{
	int i;
	int petindex;
	char petsend[64];	
	char msgbuf[64];

	/*--覲菁  及心莢汊--*/
	if(mode==1){
		/*--HP互覲菁  卅及匹丐月--*/
    	CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) );
	}else if(mode==2){
		/*--竣  及心莢汊--*/
		/*--MP互竣  卅及匹丐月--*/
    	CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) );
	}else if(mode==3){
    	/*--蟈莢汊---*/
    	CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) );
    	CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) );
	}

	/*--矢永玄反雲引仃匹莢汊仄化丐僕月--*/
	for(i=0;i<CHAR_MAXPETHAVE;i++){
    	petindex = CHAR_getCharPet(talker,i);

		if( petindex == -1  )  continue;

	   /*  平乓仿及    民尼永弁    */
		if( !CHAR_CHECKINDEX( talker ) )  continue;

		/*--莢汊--*/
		CHAR_setFlg( petindex,CHAR_ISDIE,0 );
		CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) );
		CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) );

		/*--由仿丟□正譬幫--*/
		CHAR_complianceParameter( petindex );
		sprintf( petsend, "K%d", i );
		CHAR_sendStatusString( talker , petsend );

	}

	/*--由仿丟□正霜曰--*/
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_HP);
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_MP);


	/*---醮棉互中木壬醮棉卞手霜耨--*/
	if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE )
	{
		int	topartyarray = -1;
		int	oyaindex = CHAR_getWorkInt( talker	, CHAR_WORKPARTYINDEX1);

		if( CHAR_CHECKINDEX( oyaindex )) {
			int		i;
		
			/* 憤坌午慫仄凶支勾及醮棉及    及樺赭毛潸   */
			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
				int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i);
		
				if( CHAR_CHECKINDEX( workindex) ) {
					if( workindex == talker ) {
						topartyarray = i;
						break;
					}
				}
			}
		
			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
				int otherindex = CHAR_getPartyIndex( talker, i);
		
				/* 醮棉由仿丟□正毛霜月 */
				if( CHAR_CHECKINDEX( otherindex) ) {
					snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray);
					if( otherindex != talker) {
						CHAR_sendStatusString( otherindex, msgbuf);
					}
				}
			}
		}
	}

}
Ejemplo n.º 17
0
void NPC_PetDel(int meindex, int talker,int select,char* token)
{
	int petindex;
	int petsel;
	char szPet[128];
	int cost;
	int defpet;
	int fd = getfdFromCharaIndex( talker );

	NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_THANKS, token);
	petsel=(CHAR_getWorkInt(talker,CHAR_WORKSHOPRELEVANT)-1);
	petindex = CHAR_getCharPet( talker, petsel);
	
    if( !CHAR_CHECKINDEX(petindex) ) return;

        // CoolFish: Family 2001/6/14
	if (CHAR_getInt(petindex, CHAR_PETFAMILY) == 1){	
/*		char buf[1024];
		lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE,
			WINDOW_BUTTONTYPE_OK,
			-1, -1,
		makeEscapeString("\n\nºÜ±§Ç¸¡«ÊØ»¤ÊÞÎÞ·¨··Âôร¡\nÇë×Ô¼ººÃºÃÕչˣ¡", buf, sizeof(buf)));
*/
		sprintf(token,"\n\nºÜ±§Ç¸¡«ÊØ»¤ÊÞÎÞ·¨··Âôร¡\nÇë×Ô¼ººÃºÃÕչˣ¡");
		return;
	}

        // Robin 0725
        if (CHAR_getInt( talker, CHAR_RIDEPET ) == petsel ){	
/*        	char buf[1024];
        	lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE,
        		WINDOW_BUTTONTYPE_OK,
        		-1, -1,
        		makeEscapeString("\n\nÆï³ËÖеijèÎïÎÞ·¨··Âôร¡", buf, sizeof(buf)));
*/
					sprintf(token,"\n\nÆï³ËÖеijèÎïÎÞ·¨··Âôร¡");
        	return;
        }

	if( CHAR_getWorkInt( CONNECT_getCharaindex(fd),
                         CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ;
	defpet=CHAR_getInt(talker,CHAR_DEFAULTPET);
	if(defpet==petsel){
		CHAR_setInt(talker,CHAR_DEFAULTPET,-1);
		lssproto_KS_send( fd, -1, TRUE);
	}
   	CHAR_setCharPet( talker, petsel, -1);
	LogPet(
		CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â   */
		CHAR_getChar( talker, CHAR_CDKEY ),
		CHAR_getChar( petindex, CHAR_NAME),
		CHAR_getInt( petindex, CHAR_LV),
		"sell(Âô³è)",
		CHAR_getInt( talker,CHAR_FLOOR),
		CHAR_getInt( talker,CHAR_X ),
		CHAR_getInt( talker,CHAR_Y ),
		CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14
	);
	CHAR_endCharOneArray( petindex );
		
	snprintf( szPet, sizeof( szPet ), "K%d", petsel);
	CHAR_sendStatusString( talker, szPet );
	cost=NPC_GetCost(meindex,talker,petindex);
	CHAR_AddGold( talker, cost);

}
Ejemplo n.º 18
0
void NPC_PetDel2( int meindex, int talker, int select, char *token)
{
	
	int petindex;
	int selectpet;
	int emptyindex;
	char szPet[128];
	int fd = getfdFromCharaIndex( talker );

	if( fd == -1 ) {
		fprint( "err\n");
		return;
	}
	// ʸÓÀÐþ·¸¡õÕý  µÊ£ÛʸÓÀÐþ      Øê  Ä¾  
	selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) -1;
	petindex = CHAR_getCharPet( talker, selectpet);
	if( !CHAR_CHECKINDEX( petindex) ) return;
	
        // Robin 0725
        if (CHAR_getInt( talker, CHAR_RIDEPET ) == selectpet )
        {
/*        	char buf[1024];
        	lssproto_WN_send(fd, WINDOW_MESSAGETYPE_MESSAGE,
        		WINDOW_BUTTONTYPE_OK,
        		-1, -1,
        		makeEscapeString("\n\nÆï³ËÖеijèÎïÎÞ·¨¼Ä·Åร¡", buf, sizeof(buf)));
*/
					sprintf(token,"\n\nÆï³ËÖеijèÎïÎÞ·¨¼Ä·Åร¡");
        	return;
        }
        
	// ÎëÎåë¼ëÔÊ£Ûó¡±å¼ëØÆ»¯ÃñÄáÓÀÛÍØÆ»¯ÖÐÔ¼°Æ¥£Ý³ð³ðÆ¥ÎëÖл¯ÖÐئÖм°·´Ôƾ®ØÆÖÐ
	emptyindex = CHAR_getCharPoolPetElement( talker);
	if( emptyindex == -1 ) {
		fprint( "err\n");
		return;
	}
	// ¾ô  ÉÍ  åÃʸÓÀÐþئÈգݹ«Ä¾¼°è¶  ëÛÕÔÊ£Û
	if( CHAR_getInt( talker, CHAR_DEFAULTPET) == selectpet) {
		CHAR_setInt( talker, CHAR_DEFAULTPET, -1);
		lssproto_KS_send( fd, -1, TRUE);
	}
	//   Øê  Ä¾  ±å£ÝʸÓÀÐþ¼°Ä̼þ·¸ÓÀÛ͵©Ã«Îìñâ¡õ
	CHAR_setCharPoolPet( talker, emptyindex, petindex);
	// ʸÓÀÐþ  ¾®ÈÕÛÕÔÊ
	CHAR_setCharPet( talker, selectpet, -1);
	
	// ¶ªÓÀ±¾¡õ³âäú  
	NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token);
	// ÔÆàÅÓ¼ÈÕÔÊ

	CHAR_DelGold( talker, NPC_GETPOOLCOST( talker) );

	// ÔÆàÅ·¸¡õÕý˪ÔÂ
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD);

	snprintf( szPet, sizeof( szPet ), "K%d", selectpet);
	// Þ¥ØÆÖÐʸÓÀÐþµ©  ¡õÕýµ©ËªÔ»¹´ØêÔÂ
	CHAR_sendStatusString( talker, szPet );
	// ʸÓÀÐþë  ØêÐ×·òºë
	LogPet(
		CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â   */
		CHAR_getChar( talker, CHAR_CDKEY ),
		CHAR_getChar( petindex, CHAR_NAME),
		CHAR_getInt( petindex, CHAR_LV),
		"pool(¼Ä·Å³èÎïµê)",
		CHAR_getInt( talker,CHAR_FLOOR),
		CHAR_getInt( talker,CHAR_X ),
		CHAR_getInt( talker,CHAR_Y ),
        CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14
	);

}	
Ejemplo n.º 19
0
/*-------------------------------------
	  ºÝ¤ËÂÑµ×  ¤Èµ¤  ¤ò²óÉü¤µ¤»¤ë¤È¤³¤í
---------------------------------------*/
void NPC_WindowHealerAllHeal( int talker,int mode )
{
	int i;
	int petindex;
	char petsend[64];	
	char msgbuf[64];

	/*--ÂÑµ×  ¤Î¤ß²óÉü--*/
	if(mode==1){
		/*--HP¤¬ÂÑµ×  ¤Ê¤Î¤Ç¤¢¤ë--*/
    	CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) );
	}else if(mode==2){
		/*--µ¤  ¤Î¤ß²óÉü--*/
		/*--MP¤¬µ¤  ¤Ê¤Î¤Ç¤¢¤ë--*/
    	CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) );
	}else if(mode==3){
    	/*--Á´²óÉü---*/
    	CHAR_setInt( talker , CHAR_HP ,CHAR_getWorkInt( talker, CHAR_WORKMAXHP ) );
    	CHAR_setInt( talker , CHAR_MP ,CHAR_getWorkInt( talker, CHAR_WORKMAXMP ) );
	}

	/*--¥Ú¥Ã¥È¤Ï¶³¤Þ¤±¤Ç²óÉü¤·¤Æ¤¢¹²¤ë--*/
	for(i=0;i<CHAR_MAXPETHAVE;i++){
    	petindex = CHAR_getCharPet(talker,i);

		if( petindex == -1  )  continue;

	   /*  ¥­¥ã¥é¤Î    ¥Á¥§¥Ã¥¯    */
		if( !CHAR_CHECKINDEX( talker ) )  continue;

		/*--²óÉü--*/
		CHAR_setFlg( petindex,CHAR_ISDIE,0 );
		CHAR_setInt( petindex , CHAR_HP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXHP ) );
		CHAR_setInt( petindex , CHAR_MP ,CHAR_getWorkInt( petindex, CHAR_WORKMAXMP ) );

		/*--¥Ñ¥é¥á¡¼¥¿Ä´À°--*/
		CHAR_complianceParameter( petindex );
		sprintf( petsend, "K%d", i );
		CHAR_sendStatusString( talker , petsend );

	}

	/*--¥Ñ¥é¥á¡¼¥¿Á÷¤ê--*/
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_HP);
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_MP);


	/*---Ãç´Ö¤¬¤¤¤ì¤ÐÃç´Ö¤Ë¤âÁ÷¿®--*/
	if(CHAR_getWorkInt( talker, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE )
	{
		int	topartyarray = -1;
		int	oyaindex = CHAR_getWorkInt( talker	, CHAR_WORKPARTYINDEX1);

		if( CHAR_CHECKINDEX( oyaindex )) {
			int		i;
		
			/* ¼«Ê¬¤È¼£¤·¤¿¤ä¤Ä¤ÎÃç´Ö¤Î    ¤Î¾ì½ê¤ò¼è   */
			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
				int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i);
		
				if( CHAR_CHECKINDEX( workindex) ) {
					if( workindex == talker ) {
						topartyarray = i;
						break;
					}
				}
			}
		
			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
				int otherindex = CHAR_getPartyIndex( talker, i);
		
				/* Ãç´Ö¥Ñ¥é¥á¡¼¥¿¤òÁ÷¤ë */
				if( CHAR_CHECKINDEX( otherindex) ) {
					snprintf( msgbuf, sizeof( msgbuf), "N%d", topartyarray);
					if( otherindex != talker) {
						CHAR_sendStatusString( otherindex, msgbuf);
					}
				}
			}
		}
	}

}
Ejemplo n.º 20
0
void NPC_PetSkillShopWindowTalked( int meindex, int talkerindex, 
								int seqno, int select, char *data)
{
	int skill;
	int pet;
	int slot;
	int cost;
	int skillID=0;
	int petskillindex;
	char buf[64];
	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[512];
	int petindex;
	char msgbuf[128];
	int fd = getfdFromCharaIndex( talkerindex );
	double rate= 1.0;

	if( NPC_Util_CharDistance( talkerindex, meindex ) > 2) {
		return;
	}

	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("GetArgStrErr");
		return;
	}
	makeStringFromEscaped( data);
	getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf));
	skill=atoi(buf);
	getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf));
	pet=atoi(buf);
	getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf));
	slot=atoi(buf);
	getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf));
	cost=atoi(buf);

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){
		getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf));
		skillID=atoi(buf);
	}

	slot--;
	if( !CHAR_CHECKPETSKILLINDEX( slot)){
	 	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
		return ; 
	}
	petindex = CHAR_getCharPet( talkerindex, pet-1);
    if( !CHAR_CHECKINDEX(petindex) ){
    	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
    	return ;
	}
	if(skillID < 0) return ;

	if(petindex == -1){
		print("petskillshop.c:170 PetindexError");
		return;
	}

	if( CHAR_getWorkInt( CONNECT_getCharaindex(fd),
                         CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE) return ;
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){
		rate = atof( msg);
	}

	petskillindex =  PETSKILL_getPetskillArray( skillID );
	if(petskillindex == -1){
		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
		return ;
	}

	cost = PETSKILL_getInt( petskillindex, PETSKILL_COST );
	cost = cost * rate;

	if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost){
		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
		return;
	}
	CHAR_setPetSkill( petindex, slot, skillID);

	CHAR_DelGold( talkerindex, cost );

	snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1);
	CHAR_sendStatusString( talkerindex, msgbuf );
	CHAR_sendStatusString( talkerindex, "P");
	NPC_PetSkillShop_selectWindow( meindex, talkerindex,0,-1);
}
Ejemplo n.º 21
0
int NPC_Lua_NLG_UpChar(lua_State *_NLL)
{
	CheckEx(_NLL, 1);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	if(!CHAR_CHECKINDEX(TM_Index))
	{
		LRetErrInt(_NLL, -1, "传入的索引是无效的。");
	}

	CHAR_complianceParameter( TM_Index );
	
	if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPET){
		int playindex = CHAR_getWorkInt(TM_Index,CHAR_WORKPLAYERINDEX);
		if(!CHAR_CHECKINDEX(playindex)){
			LRetErrInt(_NLL, -1, "传入的索引是无效的。");
		}else{
			int i;
			for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) {
				int workindex = CHAR_getCharPet( playindex, i );
				if( workindex == TM_Index ){
					CHAR_send_K_StatusString( playindex, i, CHAR_K_STRING_BASEIMAGENUMBER|
																									CHAR_K_STRING_HP|
																									CHAR_K_STRING_MAXHP|
																									CHAR_K_STRING_MP|
																									CHAR_K_STRING_MAXMP|
																									CHAR_K_STRING_EXP|
																									CHAR_K_STRING_NEXTEXP|
																									CHAR_K_STRING_LV|
																									CHAR_K_STRING_ATK|
																									CHAR_K_STRING_DEF|
																									CHAR_K_STRING_QUICK|
																									CHAR_K_STRING_AI|
																									CHAR_K_STRING_EARTH|
																									CHAR_K_STRING_WATER|
																									CHAR_K_STRING_FIRE|
																									CHAR_K_STRING_WIND|
																									CHAR_K_STRING_SLOT|
																									CHAR_K_STRING_CHANGENAMEFLG|
																									CHAR_K_STRING_NAME|
																									CHAR_K_STRING_USERPETNAME);
					char msgbuf[128];
					snprintf( msgbuf, sizeof( msgbuf ), "W%d",i);
					CHAR_sendStatusString( playindex, msgbuf );
					CHAR_sendStatusString( playindex, "P");
					break;
				}
			}
		}
	}else if(CHAR_getInt(TM_Index,CHAR_WHICHTYPE)==CHAR_TYPEPLAYER){
		CHAR_send_P_StatusString( TM_Index, CHAR_P_STRING_GOLD );
	}

	if(CHAR_getFlg(TM_Index,	CHAR_ISVISIBLE) == FALSE)
	{
		int TM_objindex = CHAR_getWorkInt(TM_Index,CHAR_WORKOBJINDEX);

		CHAR_sendCDArroundChar
		(
			OBJECT_getFloor(TM_objindex),
			OBJECT_getX(TM_objindex),
			OBJECT_getY(TM_objindex),
			TM_objindex
		);
	}else
	{
		CHAR_sendCToArroundCharacter( CHAR_getWorkInt( TM_Index , CHAR_WORKOBJINDEX ));
	}
	LRetNull(_NLL);
}
Ejemplo n.º 22
0
/*----------------------------------------------------------------------
 * ¾¿Í¤ò²óÉü
 * °ú¿ô
 * charaindex		int		¼«Ê¬¤Îindex
 * toindex			int		²óÉü¤¹¤ë¿Í¤Îindex
 * magicindex		int		ËâË¡¤Îindex
 *---------------------------------------------------------------------*/
int MAGIC_OtherRecovery_Field( int charaindex, int toindex, int magicindex)
{
	char *magicarg;
	float power;
	int workhp;
	int	prevhp;
	char	msgbuf[64];

#ifdef _TYPE_TOXICATION
	if( CHAR_CanCureFlg( charaindex, "HP") == FALSE )return FALSE;
#endif
	magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION );
	power =	atoi( magicarg );
	power = RAND( (power*0.9), (power*1.1) );
#ifndef _MAGIC_REHPAI
	power *= GetRecoveryRate( toindex );
#endif
	prevhp = CHAR_getInt( toindex, CHAR_HP );
	workhp = prevhp + (int)power;
	CHAR_setInt( toindex, CHAR_HP,
		min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) );
	if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) {
		if( charaindex != toindex ) {
			CHAR_send_P_StatusString( toindex, CHAR_P_STRING_HP);
		}
	}
	CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP);
	if( charaindex != toindex) {
		CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP);
		CHAR_PartyUpdate( toindex, CHAR_N_STRING_HP);
	}
	else {
		CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP|CHAR_N_STRING_HP);
	}
	if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){
		int		i;
		for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) {
			int workindex = CHAR_getCharPet( charaindex, i );
			if( workindex == toindex ){
				CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP);
			}
		}
	}

	if( charaindex != toindex) {
		snprintf( msgbuf, sizeof( msgbuf), "%sªº­@¤[¤O¦^´_%d",
				CHAR_getUseName( toindex ),
				min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);

		if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) {
			snprintf( msgbuf, sizeof( msgbuf), "ÂÇ¥Ñ%s­@¤[¤O¦^´_%d",
					CHAR_getUseName( charaindex ),
					min( workhp,CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp);
			CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE);
		}
	}
	else {
		snprintf( msgbuf, sizeof( msgbuf), "­@¤[¤O¦^´_%d",
				min( workhp,CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);

	}

	return TRUE;

}
Ejemplo n.º 23
0
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp )
{
	int battlemode, haveindex, power, i;
	char msg[128];
	
	if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;
	
	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
	// 爵  釩銨凜反  骰允月
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}
	// 爵    分勻凶日
	if( IsBATTLING( charaindex ) == TRUE ){
		//MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
		//return FALSE;
		toindex = BATTLE_No2Index(
				CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex );
		//print(" battle_metamo:%d ", toindex);
	}

	if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE;

	if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ){
		CHAR_talkToCli( charaindex, -1, "無法變身,騎乘中不能變身!", CHAR_COLORWHITE );
		return FALSE;
	}
#ifdef _FIX_METAMORIDE
	if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){
		CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORYELLOW );
		return FALSE;
	}
#else
	if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ){
		CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORWHITE );
		return FALSE;
	}
#endif
#ifdef _FIXBUG_ATTACKBOW
	{
		int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM);
		if( ITEM_CHECKINDEX( armindex) == TRUE )	{
			int armtype = BATTLE_GetWepon( charaindex);
			if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW ||
				armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG)	{
				CHAR_talkToCli( charaindex, -1, "使用遠距離武器無法變身!", CHAR_COLORYELLOW );
				return FALSE;
			}
		}
	}
#endif
	haveindex = -1;	
	for( i = 0; i < 5; i++ )
	{
		if( CHAR_getCharPet( charaindex, i) == toindex ) {
			haveindex = i;
			break;
		}
	}
	if( haveindex == -1 && charaindex != toindex )
	{
		CHAR_talkToCli( charaindex, -1, "無法變身,只能變成自己的寵物!", CHAR_COLORWHITE );
		return FALSE;
	}

	if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ){
		CHAR_talkToCli( charaindex, -1, "不能變身成加美!", CHAR_COLORWHITE );
		return FALSE;
	}

	power = atoi(MAGIC_getChar( marray, MAGIC_OPTION ));

	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP);

	if( toindex != charaindex ) {
		CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power);
		sprintf( msg, "變身成%s!", CHAR_getChar( toindex, CHAR_NAME) );
	}
	else {
		CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0);
		sprintf( msg, "變回自己!");
	}
	CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE );

	CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER,
					CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
	CHAR_complianceParameter( charaindex);
	CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ));
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
//#endif

	return TRUE;
}
Ejemplo n.º 24
0
void NPC_FreePetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data)
{
	int skill;
	int pet;
	int slot;
	int cost;
	int skillID=0;
	int petskillindex;
	int fd = getfdFromCharaIndex( talkerindex);
	char buf[64];
	char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char msg[512];
	int petindex;
	char msgbuf[128];
	double rate= 1.0;
#ifdef _STONEAGEA8XXX_S
	int petskCostFametemp=-1;
#endif
	if((argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof(argstr1)))==NULL){
		print("GetArgStrErr");
		return;
	}

    if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
    	return;
    }
	if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){
		if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;
	}
	if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)
		return ;


	switch( seqno)	{
	case SELECTSKILL_START:
		if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 2 )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1);
		break;
	case SELECTSKILL_TEACH:
		if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 3 )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		makeStringFromEscaped( data);
		getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf));
		skill=atoi(buf);
		getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf));
		pet=atoi(buf);
		getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf));
		slot=atoi(buf);
		getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf));
		cost=atoi(buf);

		if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){
			getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf));
			skillID=atoi(buf);
		}
		slot--;
		if( slot < 0 )	return;

		petindex = CHAR_getCharPet( talkerindex, pet-1);
		if( !CHAR_CHECKINDEX(petindex) ){
    		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
    		return ;
		}
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){
			rate = atof( msg);
		}
#ifdef _STONEAGEA8XXX_S
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "petskCostFame", msg, sizeof( msg)) != NULL){
			getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf));
			petskCostFametemp = atoi(buf);
		}
#endif
		petskillindex =  PETSKILL_getPetskillArray( skillID );
		if( !PETSKILL_CHECKINDEX( petskillindex)){
	 		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			return ;
		}

		cost = PETSKILL_getInt( petskillindex, PETSKILL_COST );
		cost = cost * rate;

		//條件判斷
		if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost && CHAR_getInt(talkerindex,CHAR_FAME)< petskCostFametemp){
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			return;
		}

		if( NPC_CHECKFREEPETSKILL( talkerindex, petindex, skillID ) == TRUE ){

			if( Action_RunDoEventAction( meindex, talkerindex, argstr) == FALSE ){
				CHAR_talkToCli( talkerindex, -1, "所需物品不足!!", CHAR_COLORYELLOW);
				CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
				CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
				return;
			}

			CHAR_setPetSkill( petindex, slot, skillID);
			CHAR_setInt( talkerindex, CHAR_GOLD, ( CHAR_getInt( talkerindex, CHAR_GOLD) - cost) );
#ifdef _STONEAGEA8XXX_S
			if (petskCostFametemp!=-1 && petskCostFametemp!=0){
				float FlpetCFameTemp;
				CHAR_setInt( talkerindex, CHAR_FAME, ( CHAR_getInt( talkerindex, CHAR_FAME) - petskCostFametemp) );
				FlpetCFameTemp = petskCostFametemp/100;
#ifdef _ADD_STATUS_2
				sprintf(msgbuf,"FAME|%d",CHAR_getInt(talkerindex,CHAR_FAME)/100);
				lssproto_S2_send(fd,msgbuf);
#endif
				snprintf( msgbuf, sizeof( msgbuf ), "扣除聲望點數:%4.2f",FlpetCFameTemp);
			}
#endif
			CHAR_talkToCli( talkerindex, -1, msgbuf, CHAR_COLORYELLOW);
			snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1);
			CHAR_sendStatusString( talkerindex, msgbuf );
			CHAR_sendStatusString( talkerindex, "P");
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			//WARP
			if( NPC_SkillShopWarp( meindex, talkerindex) == TRUE )
					return;
		}else	{
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			CHAR_talkToCli( talkerindex, -1, "條件不足!!", CHAR_COLORYELLOW);
		}
		//ADD
		NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1);
		break;
	case SELECTSKILL_END:
		break;
	}
	
	return;
}
Ejemplo n.º 25
0
void NPC_FreePetSkillShopWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data)
{
	int skill;
	int pet;
	int slot;
	int cost;
	int skillID=0;
	int petskillindex;
	char buf[64];
	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[512];
	int petindex;
	char msgbuf[128];
	double rate= 1.0;

	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("GetArgStrErr");
		return;
	}

    if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
    	return;
    }
	if(NPC_Util_isFaceToFace(talkerindex,meindex,2 )==FALSE){
		if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;
	}
	if( CHAR_getWorkInt( talkerindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE)
		return ;


	switch( seqno)	{
	case SELECTSKILL_START:
		if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 2 )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1);
		break;
	case SELECTSKILL_TEACH:
		if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) != 3 )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
			return;
		}
		makeStringFromEscaped( data);
		getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf));
		skill=atoi(buf);
		getStringFromIndexWithDelim(data,"|",2,buf,sizeof(buf));
		pet=atoi(buf);
		getStringFromIndexWithDelim(data,"|",3,buf,sizeof(buf));
		slot=atoi(buf);
		getStringFromIndexWithDelim(data,"|",4,buf,sizeof(buf));
		cost=atoi(buf);

		if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){
			getStringFromIndexWithDelim(msg,",",skill,buf,sizeof(buf));
			skillID=atoi(buf);
		}
		slot--;
		if( slot < 0 )	return;

		petindex = CHAR_getCharPet( talkerindex, pet-1);
		if( !CHAR_CHECKINDEX(petindex) ){
    		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
    		return ;
		}
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "skill_rate", msg, sizeof( msg)) != NULL){
			rate = atof( msg);
		}
		petskillindex =  PETSKILL_getPetskillArray( skillID );
		if( !PETSKILL_CHECKINDEX( petskillindex)){
	 		CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			return ;
		}

		cost = PETSKILL_getInt( petskillindex, PETSKILL_COST );
		cost = cost * rate;

		//条件判断
		if(CHAR_getInt(talkerindex,CHAR_GOLD) < cost){
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			return;
		}

		if( NPC_CHECKFREEPETSKILL( talkerindex, petindex, skillID ) == TRUE ){

			if( Action_RunDoEventAction( meindex, talkerindex, argstr) == FALSE ){
				CHAR_talkToCli( talkerindex, -1, "所需物品不足!!", CHAR_COLORYELLOW);
				CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
				CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
				return;
			}

			CHAR_setPetSkill( petindex, slot, skillID);
			CHAR_setInt( talkerindex, CHAR_GOLD, ( CHAR_getInt( talkerindex, CHAR_GOLD) - cost) );
			snprintf( msgbuf, sizeof( msgbuf ), "W%d",pet-1);
			CHAR_sendStatusString( talkerindex, msgbuf );
			CHAR_sendStatusString( talkerindex, "P");
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			//WARP
			if( NPC_SkillShopWarp( meindex, talkerindex) == TRUE )
					return;
		}else	{
			CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
			CHAR_talkToCli( talkerindex, -1, "条件不足!!", CHAR_COLORYELLOW);
		}
		//ADD
		NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, SKILL_WINDOW, -1);
		break;
	case SELECTSKILL_END:
		break;
	}
	
	return;
}
Ejemplo n.º 26
0
void NPC_DepotPet_Add( int meindex, int talker, int select, char *token)
{
	
	int petindex;
	int selectpet;
	int emptyindex;
	char szPet[128];
	int fd = getfdFromCharaIndex( talker );

	if( fd == -1 ) {
		fprint( "err\n");
		return;
	}
	// ʸÓÀÐþ·¸¡õÕý  µÊ£ÛʸÓÀÐþ      Øê  Ä¾  
	selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) -1;
	//print("\n selectpet:%d ", selectpet);
	petindex = CHAR_getCharPet( talker, selectpet);
	if( !CHAR_CHECKINDEX( petindex) ) return;
	
    // Robin 0725
    if (CHAR_getInt( talker, CHAR_RIDEPET ) == selectpet )
    {
		sprintf(token,"\n\nÆï³ËÖеijèÎïÎÞ·¨´æÈë²Ö¿âร¡");
		return;
	}

	if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 )
	{
		sprintf(token,"\n\n¼Ò×åÊØ»¤ÊÞÎÞ·¨´æÈë²Ö¿âร¡");
		return;
	}

#ifdef _CHECK_ENEMY_PET
	{
		int j;
		for( j=0;j<ENEMYTEMP_getEnemyNum();j++ ) {//ENEMY_getEnemyNum()
			if( CHAR_getInt( petindex, CHAR_PETID) == ENEMYTEMP_getInt( j, E_T_TEMPNO ) ) {//ENEMY_getInt( j, ENEMY_TEMPNO)
				if( ENEMYTEMP_getInt( j, E_T_PETFLG ) == 0 ){//ENEMY_getInt( j, ENEMY_PETFLG) 
				    sprintf(token,"\n\nÕâÊDz»ÄܳÖÓеijèÎïร¡");
					return;
				}
			}
		}
	}
#endif    
	// ÎëÎåë¼ëÔÊ£Ûó¡±å¼ëØÆ»¯ÃñÄáÓÀÛÍØÆ»¯ÖÐÔ¼°Æ¥£Ý³ð³ðÆ¥ÎëÖл¯ÖÐئÖм°·´Ôƾ®ØÆÖÐ
	emptyindex = CHAR_getCharDepotPetElement( talker);
	if( emptyindex == -1 ) {
		fprint( "err\n");
		return;
	}

	// ¾ô  ÉÍ  åÃʸÓÀÐþئÈգݹ«Ä¾¼°è¶  ëÛÕÔÊ£Û
	if( CHAR_getInt( talker, CHAR_DEFAULTPET) == selectpet) {
		CHAR_setInt( talker, CHAR_DEFAULTPET, -1);
		lssproto_KS_send( fd, -1, TRUE);
	}
	//   Øê  Ä¾  ±å£ÝʸÓÀÐþ¼°Ä̼þ·¸ÓÀÛ͵©Ã«Îìñâ¡õ
	CHAR_setDepotPetIndex( talker, emptyindex, petindex);
	// ʸÓÀÐþ  ¾®ÈÕÛÕÔÊ
	CHAR_setCharPet( talker, selectpet, -1);
	
	// ¶ªÓÀ±¾¡õ³âäú  
	NPC_MaxGoldOver( meindex, talker, NPC_PETSHOP_MSG_POOLTHANKS, token);
	// ÔÆàÅÓ¼ÈÕÔÊ

	CHAR_DelGold( talker, NPC_GETPOOLCOST( talker) );

	// ÔÆàÅ·¸¡õÕý˪ÔÂ
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD);

	snprintf( szPet, sizeof( szPet ), "K%d", selectpet);
	// Þ¥ØÆÖÐʸÓÀÐþµ©  ¡õÕýµ©ËªÔ»¹´ØêÔÂ
	CHAR_sendStatusString( talker, szPet );
	// ʸÓÀÐþë  ØêÐ×·òºë
	if( NPC_DepotPet_CheckRepeat( talker) == 0)  // ¼ì²é±àÂëÖظ´³è
	{
		LogPet(
			CHAR_getChar( talker, CHAR_NAME ), /* ƽÅÒ·Â   */
			CHAR_getChar( talker, CHAR_CDKEY ),
			CHAR_getChar( petindex, CHAR_NAME),
			CHAR_getInt( petindex, CHAR_LV),
			"pool(´æÈë³èÎï²Ö¿â)",
			CHAR_getInt( talker,CHAR_FLOOR),
			CHAR_getInt( talker,CHAR_X ),
			CHAR_getInt( talker,CHAR_Y ),
			CHAR_getChar( petindex, CHAR_UNIQUECODE)   // shan 2001/12/14
		);
	}
	else
	{
		CHAR_talkToCli( talker, -1, "ÕâÊÇ·Ç·¨µÄ³èÎïà¸!!", CHAR_COLORYELLOW);
	}

}	
Ejemplo n.º 27
0
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp )
{
    int battlemode, haveindex, power, i;
    char msg[128];

    if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }
    // ¾ô    ·ÖÔÈÐ×ÈÕ
    if( IsBATTLING( charaindex ) == TRUE ) {
        //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
        //return FALSE;
        toindex = BATTLE_No2Index(
                      CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex );
        //print(" battle_metamo:%d ", toindex);
    }

    if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE;

    if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Æï³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE );
        return FALSE;
    }
#ifdef _FIX_METAMORIDE
    if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORYELLOW );
        return FALSE;
    }
#else
    if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE );
        return FALSE;
    }
#endif
#ifdef _FIXBUG_ATTACKBOW
    {
        int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM);
        if( ITEM_CHECKINDEX( armindex) == TRUE )	{
            int armtype = BATTLE_GetWepon( charaindex);
            if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW ||
                    armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG)	{
                CHAR_talkToCli( charaindex, -1, "ʹÓÃÔ¶¾àÀëÎäÆ÷ÎÞ·¨±äÉí£¡", CHAR_COLORYELLOW );
                return FALSE;
            }
        }
    }
#endif
    haveindex = -1;
    for( i = 0; i < 5; i++ )
    {
        if( CHAR_getCharPet( charaindex, i) == toindex ) {
            haveindex = i;
            break;
        }
    }
    if( haveindex == -1 && charaindex != toindex )
    {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Ö»Äܱä³É×Ô¼ºµÄ³èÎ", CHAR_COLORWHITE );
        return FALSE;
    }

    if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ) {
        CHAR_talkToCli( charaindex, -1, "²»ÄܱäÉí³É¼ÓÃÀ£¡", CHAR_COLORWHITE );
        return FALSE;
    }

    power = atoi(MAGIC_getChar( marray, MAGIC_OPTION ));

    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );
    CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP);

    if( toindex != charaindex ) {
        CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power);
        sprintf( msg, "±äÉí³É%s£¡", CHAR_getChar( toindex, CHAR_NAME) );
    }
    else {
        CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0);
        sprintf( msg, "±ä»Ø×Ô¼º£¡");
    }
    CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE );

    CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER,
                 CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
    CHAR_complianceParameter( charaindex);
    CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ));
    CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
//#endif

    return TRUE;
}
Ejemplo n.º 28
0
void NPC_PetMakerTalked( int meindex , int talker , char *msg ,int color )
{
    char* npcarg;
    char  token[32],tmpbuf[256];
    int   msgNo/*,translv*/;
    int   point,ckpoint,array,shift; 
    int   i,num=0;

    array   = EVFLG / 32;
    shift   = EVFLG % 32;
    point   = CHAR_getInt( talker, CHAR_ENDEVENT + array);
    ckpoint = point;

    npcarg = CHAR_getChar(meindex,CHAR_NPCARGUMENT);

    getStringFromIndexWithDelim( npcarg, "|", 1, token,sizeof( token));
    msgNo  = atoi( token );

    if( CHAR_getInt( talker , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )	
        return;

    if( NPC_Util_isFaceToFace( talker, meindex , 2 ) == FALSE ) 
    {
    	if( NPC_Util_isFaceToFace( talker, meindex , 1 ) == FALSE ) 
        	return;
    }
    
    //translv = CHAR_getInt( talker, CHAR_TRANSMIGRATION);    // 白虎
    
    for(i=0; i<CHAR_MAXPETHAVE; i++)
        if(CHAR_getCharPet(talker, i) != -1) 
            num++;

    // 白虎
    /*if( translv < 5 || CHAR_getInt( talker, CHAR_LV ) < 125){
        sprintf(tmpbuf, "抱歉哦~等到转生5次及等级125级时再来找我吧!");
        CHAR_talkToCli( talker, meindex,
                        tmpbuf,CHAR_COLORWHITE);
        return;
    }*/   
	// 青龙	
    if( CHAR_getInt( talker, CHAR_FAME) < 200000){
        sprintf(tmpbuf, "抱歉哦~你目前个人声望 %d 点,请等到超过二千点时再来找我吧!", (CHAR_getInt( talker, CHAR_FAME)/100));
        CHAR_talkToCli( talker, meindex,
                        tmpbuf,CHAR_COLORWHITE);
        return;
    }
    else if( ckpoint & (1 << shift) ){
        sprintf(tmpbuf, "哦~我记得我好像给过你了吧!");
        CHAR_talkToCli( talker, meindex,
                        tmpbuf,CHAR_COLORWHITE);
        return;
    }    
    else if( num>=CHAR_MAXPETHAVE ){
        sprintf(tmpbuf, "抱歉~没多余的空间可放置宠物。");
        CHAR_talkToCli( talker, meindex,
                        tmpbuf,CHAR_COLORWHITE);
        return;    
    }
    
    pet_make( talker, "1845" );
    
    point = point | (1 << shift);
    CHAR_setInt( talker, CHAR_ENDEVENT + array, point);
}