BOOL NPC_CHECKFREEPETSKILL( int toindex, int petindex, int skillID)
{
	int skillindex=-1;
	char SCode[256];
	char Free[256];
	int i, petID;
	skillindex =  PETSKILL_getPetskillArray( skillID );
	memset( Free, 0, sizeof( Free));
	if( !PETSKILL_CHECKINDEX( skillindex) )	{
		return FALSE;
	}

	petID = CHAR_getInt( petindex, CHAR_PETID);
	sprintf( SCode, "%s", PETSKILL_getChar( skillindex, PETSKILL_KINDCODE));
	sprintf( Free, "%s", PETSKILL_getChar( skillindex, PETSKILL_FREE));

	//CHECK CODE
	if( !strcmp( SCode, "\0"))	{
		return TRUE;
	}

	for( i=0; i<arraysizeof( Code_skill); i++)	{
		if( Code_skill[i].PetId == petID )	{
			break;
		}
	}

	//找不到这只宠物
	if( i == arraysizeof( Code_skill) )	{
		{
			char buff1[256];
			sprintf( buff1, "%s不能学特殊技能!!", CHAR_getChar( petindex, CHAR_NAME));
			CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
		}
		return FALSE;

	}

	if( strstr( Code_skill[i].Code, SCode ) != NULL )	{
		if( NPC_SkillShopPetCheck( toindex, petindex, skillID) == FALSE )	{
			char buff1[256];
			sprintf( buff1, "%s现在还不能学%s!", CHAR_getChar( petindex, CHAR_NAME),
									PETSKILL_getChar( skillindex, PETSKILL_NAME) );
			CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
			return  FALSE;
		}
		return TRUE;
	}else	{
			char buff1[256];
			sprintf( buff1, "%s不能学%s!!", CHAR_getChar( petindex, CHAR_NAME),
						PETSKILL_getChar( skillindex, PETSKILL_NAME) );
			CHAR_talkToCli( toindex, -1, buff1, CHAR_COLORYELLOW);
	}
	return FALSE;
}
Example #2
0
/* 奶矛件玄蔽  
 * 申永玄白仿弘毛  化月分仃及質  
 */
void  NPC_EventSetFlg(int talker,int shiftbit)

{
	int point=0;
	int array;
	int shift;
#ifdef _TEACHER_SYSTEM
	int iGetFame = 0;
#endif

	/*--  -1反白仿弘卞楮溢互卅中奶矛件玄   -*/
	if(shiftbit==-1) return;

	array = shiftbit / 32;
	shift = shiftbit % 32;

	point = CHAR_getInt( talker, CHAR_ENDEVENT+array);
	
	// Arminius 8.24 prevent wash dp
	if (!(point & (1 << shift))) {
	  // CoolFish: Family Adv 2001/8/4
		AddFMAdv(talker, shiftbit);
#ifdef _TEACHER_SYSTEM
		if(shiftbit < arraysizeof(FMAdvTbl)) iGetFame = FMAdvTbl[shiftbit];
#endif
	}
#ifdef _TEACHER_SYSTEM
	iGetFame /= 20; // 導師獲得學生所得聲望的 5% (1/20)
	// 檢查所得的聲望有沒有大於0
	if(iGetFame > 0){
		// 檢查有沒有導師
		if(strlen(CHAR_getChar(talker,CHAR_TEACHER_ID)) > 0 && strlen(CHAR_getChar(talker,CHAR_TEACHER_NAME)) > 0){
			int iPlayernum = CHAR_getPlayerMaxNum(),i;
			char szMsg[128];
			
			// 檢查導師在不在線上
			for(i=0;i<iPlayernum;i++){
				if(CHAR_getCharUse(i) == FALSE) continue;
				if(strcmp(CHAR_getChar(talker,CHAR_TEACHER_ID),CHAR_getChar(i,CHAR_CDKEY)) == 0 &&
					strcmp(CHAR_getChar(talker,CHAR_TEACHER_NAME),CHAR_getChar(i,CHAR_NAME)) == 0){
					float fGetFame = (float)iGetFame/100;
					// 導師在線上
					CHAR_setWorkInt(i,CHAR_WORK_GET_TEACHER_FAME,CHAR_getWorkInt(i,CHAR_WORK_GET_TEACHER_FAME) + iGetFame);
					sprintf(szMsg,"獲得學生 %s %.2f 點聲望",CHAR_getChar(talker,CHAR_NAME),fGetFame);
					CHAR_talkToCli(i,-1,szMsg,CHAR_COLORYELLOW);
					break;
				}
			}
		}
	}
#endif
	
	point = point | (1 << shift);
	CHAR_setInt( talker, CHAR_ENDEVENT+array, point);
}
Example #3
0
void Check_EnemyWarpMe( int meindex, char *args )
{

	char buf1[256];
	int objindex,index;
	int nfl, nx, ny;
	OBJECT obj;

	memset( buf1, 0, sizeof( buf1));
	if( NPC_Util_GetStrFromStrWithDelim( args, "REPLACEMENT", buf1, sizeof( buf1)) == NULL ) {
		return;
	}
	GetRand_WarpPoint( buf1, &nfl, &nx, &ny );

	if( MAP_IsValidCoordinate( nfl, nx, ny ) == FALSE ){
		char filename[256];
		NPC_Util_CheckAssignArgFile( meindex, filename);
		print( "NPCENEMY REPLACEMENT: %s .Invalid POINT( %d, %d, %d)\n", filename, nfl, nx, ny );
		return;
	}
	{
		int ofl, ox, oy;
		ofl = CHAR_getInt( meindex, CHAR_FLOOR );
		ox = CHAR_getInt( meindex, CHAR_X );
		oy = CHAR_getInt( meindex, CHAR_Y );

		for ( obj=MAP_getTopObj( nfl, nx, ny); obj; obj=NEXT_OBJECT( obj) ) {
			objindex = GET_OBJINDEX( obj);
			if (OBJECT_getType( objindex) != OBJTYPE_CHARA) continue;
			index = OBJECT_getIndex( objindex);
			if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER &&
				CHAR_getWorkInt( index, CHAR_WORKEVENTTYPE) != CHAR_TYPEPET )	{
				CHAR_warpToSpecificPoint( index, ofl, ox, oy);
				CHAR_sendCToArroundCharacter( objindex);
				break;
			}
		}
	}
	objindex = CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX);
	CHAR_warpToSpecificPoint( meindex, nfl, nx, ny);
	CHAR_sendCToArroundCharacter( objindex);
}
Example #4
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 );
	}
}
Example #5
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;                                             
}
Example #6
0
void NPC_NewNpcManTalked( int meindex , int talkerindex , char *msg , int color )
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
	if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )
    		return;
	if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE)
			return;
	}
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("TRANSER_MAN: GetArgStrErr!!");
		return;
	}
	CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
	if( CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER) != 101578 ){
		NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_SELECT1, 0);
		return;
	}
	NPC_NewNpcMan_selectWindow( meindex, talkerindex, WINDOW_START, 0);
}
Example #7
0
void NPC_NowEndEventSetFlgCls(int talker, int shiftbit)
{
	int point = 0;
	int array;
	int shift;
	if (shiftbit == -1)
		return;
	array = shiftbit / 32;
	shift = shiftbit % 32;
	if (NPC_NowEventCheckFlg(talker, shiftbit) == TRUE) {
		point = CHAR_getInt(talker, CHAR_NOWEVENT + array);
		point = point ^ (1 << shift);
		CHAR_setInt(talker, CHAR_NOWEVENT + array, point);
	}
	if (NPC_EventCheckFlg(talker, shiftbit) == TRUE) {
		point = CHAR_getInt(talker, CHAR_ENDEVENT + array);
		point = point ^ (1 << shift);
		CHAR_setInt(talker, CHAR_ENDEVENT + array, point);
	}
}
void NPC_PauctionManTalked( int meindex, int talkerindex, char *msg, int color )
{
	if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )
    		return;
	if(NPC_Util_isFaceToFace( meindex ,talkerindex , 2) == FALSE) {
		if(NPC_Util_isFaceToChara( talkerindex, meindex, 1) == FALSE)
			return;
	}   
	CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
	NPC_Pauctionman_selectWindow( meindex, talkerindex, WINDOW_START, 0);
}
Example #9
0
void NPC_WindowHealerLooked( int meindex , int lookedindex)
{
    if( CHAR_getInt( lookedindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
    	return;
    }
	if( NPC_Util_CharDistance( lookedindex, meindex ) 
		> CHAR_getWorkInt(meindex,CHAR_WORK_RANGE)){
		 return;
	}
	NPC_WindowHealer_selectWindow( meindex, lookedindex,0);
}
Example #10
0
void NPC_MakePairManWindowTalked( int meindex, int talkerindex, int seqno, int select, char *data)
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];

	if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )
    	return;
	memset( npcarg, 0, sizeof( npcarg));
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("err NPC_MakePairMan: GetArgStrErr!!");
		return;
	}
	switch( seqno)	{
	case WINDOW_TALKSTART:
		{
			int choose=atoi( data);
			if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO)
				return;
			switch( choose){
			case 1://查人数
				NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_USER, 0);
				break;
			case 2://配对
				NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIR, 0);
				break;
			case 3://心理测验
				NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_SELECT, 0);
				break;
			}
		}

		break;
	case WINDOW_TALKSELECT:
		{
			int title = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT);
			title = NPC_getNextTitle( meindex, talkerindex, npcarg, title, select);
			if( title < 0 ) return ;
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, title);
			NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_SELECT, select);
		}
		break;
	case WINDOW_TALKPAIR://配对邀请回覆
		if( select == WINDOW_BUTTONTYPE_CANCEL || select == WINDOW_BUTTONTYPE_NO){
			NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIRNO, 0);
		}else	{
			NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_PAIROK, 0);
		}
		break;
	case WINDOW_RETURN:
		NPC_MakePair_selectWindow( meindex, talkerindex, WINDOW_START, 0);
		break;
	case WINDOW_TALKEND:
		break;
	}
}
Example #11
0
void NPC_WarpWatch(int meobjindex, int objindex, CHAR_ACTION act, int x, int y, int dir, int *opt, int optlen) {
  int meindex, moveindex;
  if(OBJECT_getType(objindex) != OBJTYPE_CHARA)return;

  meindex = OBJECT_getIndex(meobjindex);
  moveindex = OBJECT_getIndex(objindex);

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

  if(act != CHAR_ACTWALK)
    return;

  if(opt[0] == x && opt[1] == y)
    return;

  if(CHAR_getInt(meindex, CHAR_X) == x && CHAR_getInt(meindex, CHAR_Y) == y) {
    NPC_WarpWarpCharacter(meindex, moveindex);
  }
}
Example #12
0
int MAGIC_Use( int charaindex, int haveitemindex, int toindex)
{
	int		itemindex;
	int		magicid,marray,mp;
	int		ret;
	MAGIC_CALLFUNC func;

	itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( !ITEM_CHECKINDEX( itemindex) ) return FALSE;
	magicid = ITEM_getInt( itemindex, ITEM_MAGICID);
	marray = MAGIC_getMagicArray( magicid);
	if( marray == -1 ) return FALSE;

	func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME));//MAGIC_NAME
	if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP)) < 0 ){
		print("err mp:%d  -%s-%d\n", mp, ITEM_getChar( itemindex, ITEM_NAME),
			ITEM_getInt( itemindex, ITEM_ID) );
		
	}
	
        // shan add begin
        if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){
            // 光精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){
                if( (marray >=0 && marray <=31) || (marray >= 105 && marray <=107 ))
                    mp *= MP_RATE;
            }
            // 暗精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){
                if( marray >=32 && marray <=81 )
                    mp *= MP_RATE;
            }
        }
        // shan end
	if( func ) {
		ret = func( charaindex, toindex, marray, mp );
	}else {
		ret = FALSE;
	}
	return ret;
}
Example #13
0
int MAGIC_AttSkill( int charaindex, int toindex,int marray, int mp )
{
	int battlemode;
	int battleindex=-1;
	char *magicarg, funName[256];
	int skillID=-1;
	PETSKILL_CALLFUNC func;
	if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;
	if( IsBATTLING( charaindex ) == FALSE ) return FALSE;
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
	if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return FALSE;

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
	if( battlemode == BATTLE_CHARMODE_INIT ) return FALSE;
	if( toindex < 0 || toindex > 19 ) return FALSE;
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp ) return FALSE;

	memset( funName, 0, sizeof( char)*256 );
	//MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
	magicarg = MAGIC_getChar( marray, MAGIC_OPTION );
	if (!magicarg) return FALSE;
	if( strstr( magicarg, ";" ) != NULL )	{
		char buff1[256];
		if( getStringFromIndexWithDelim( magicarg, ";", 1, buff1, sizeof( buff1)) == FALSE )
			return FALSE;
		snprintf( funName, sizeof(funName), buff1);
		if( getStringFromIndexWithDelim( magicarg, ";", 2, buff1, sizeof( buff1)) == FALSE )
			return FALSE;
		skillID = atoi( buff1);
	}else
		return FALSE;
	func = PETSKILL_getPetskillFuncPointer( funName);
	if( !func ){
		print("\n *func not FOUND !!");
		return FALSE;
	}
	if( func( charaindex,  toindex,  skillID, "MAGICSKILL" ) == FALSE ) return FALSE;
	CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp );
	return TRUE;

}
Example #14
0
BOOL CHAR_makeCAOPT1String( int objindex,char* buf, int buflen, int act,int opt1 )
{
    char	objindexbuf[64];
    if( CHECKOBJECT(objindex) == FALSE )    return FALSE;
    if( OBJECT_getType(objindex) != OBJTYPE_CHARA ) return FALSE;
    snprintf( buf,buflen,"%s|%d|%d|%d|%d|%d",
              cnv10to62( objindex,objindexbuf, sizeof(objindexbuf)),
              OBJECT_getX(objindex), OBJECT_getY(objindex),
              act,
              CHAR_getInt(OBJECT_getIndex(objindex),CHAR_DIR), opt1);
    return TRUE;
}
Example #15
0
void NPC_FreePetSkillShopTalked( int meindex , int talkerindex , char *szMes ,int color )
{
    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;
	}
	CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 1 );

	NPC_FreePetSkillShop_selectWindow( meindex, talkerindex, START_WINDOW,-1);
}
Example #16
0
int NPC_Lua_NLG_UpStateBySecond(lua_State *_NLL)
{
	CheckEx2(_NLL, 1, 3);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	
	if(!CHAR_CHECKINDEX(TM_Index))
	{
		LRetErrInt(_NLL, -1, "传入的索引是无效的。");
	}

	char TM_Buff[128];
	int TM_fd = getfdFromCharaIndex(TM_Index);
#ifdef _SAF_MAKE
	snprintf(TM_Buff, sizeof(TM_Buff), "FAME|%d|%d|%d", CHAR_getInt(TM_Index,CHAR_FAME)/100, (int)lua_tointeger(_NLL, 2), (int)lua_tointeger(_NLL, 3));
#else
	snprintf(TM_Buff, sizeof(TM_Buff), "FAME|%d", CHAR_getInt(TM_Index,CHAR_FAME)/100);
#endif
	lssproto_S2_send(TM_fd,TM_Buff);
	LRetInt(_NLL, 0);
}
Example #17
0
/*--云嗯及煌遥--*/
int NPC_CharmCost(int meindex,int talker)
{
	int cost;
	int level;
	int charm;
	int trans;

	level = CHAR_getInt( talker, CHAR_LV);
	charm = CHAR_getInt( talker, CHAR_CHARM);
	trans = CHAR_getInt( talker, CHAR_TRANSMIGRATION);

	if(charm >= 100) return -1;
	
	if(charm <= 1) charm = WARU;
	
	/*-- 煌遥挚 --*/
	cost = level * RATE * (charm / WARU) * (trans+1);

	return cost;

}
Example #18
0
BOOL NPC_NowEventCheckFlg(int talker,int shiftbit)
{
	int point=0;
	int array;
	int shift;
	if(shiftbit==-1) return FALSE;
	if(shiftbit<=255){
	array = shiftbit / 32;
	shift = shiftbit % 32;
	point = CHAR_getInt( talker, CHAR_NOWEVENT+array);
	}
	else if(shiftbit<=510){
	array = (shiftbit-255) / 32;
	shift = (shiftbit-255) % 32;
	point = CHAR_getInt( talker, CHAR_NOWEVENT9+array);
	}
	if( (point & (1<<shift))  == (1<<shift)){
		return TRUE;
	}
	return FALSE;
}
Example #19
0
int NPC_Util_FrontChar( int meindex )
{
    int front_x, front_y,objindex,enemyindex;
    OBJECT obj;
    CHAR_getCoordinationDir( CHAR_getInt(meindex,CHAR_DIR)
                             , CHAR_getInt(meindex,CHAR_X)
                             , CHAR_getInt(meindex,CHAR_Y)
                             ,1, &front_x, &front_y );
    for( obj=MAP_getTopObj(CHAR_getInt(meindex,CHAR_FLOOR),
                           front_x,front_y );obj;
        obj=NEXT_OBJECT(obj) ){
        objindex = GET_OBJINDEX(obj);
        if( OBJECT_getType(objindex) == OBJTYPE_CHARA ){
            enemyindex = OBJECT_getIndex(objindex);
            if(CHAR_CHECKINDEX(enemyindex) ){
                return enemyindex;
            }
        }
    }
    return -1;
}
Example #20
0
BOOL ChatCheck_Free( int myindex)
{
	int old_gold;
	if ( !CHAR_CHECKINDEX ( myindex ) ) 
		return FALSE;
	old_gold = CHAR_getInt( myindex, CHAR_GOLD );
	if( old_gold < 200 ){
		CHAR_talkToCli ( myindex , -1 , "成立聊天室需花费200石币" , CHAR_COLORYELLOW ); 
		return FALSE;
	}
	if ( CHAR_getInt ( myindex , CHAR_LV ) < 30 &&
		CHAR_getInt ( myindex , CHAR_TRANSMIGRATION ) < 1 ) {
		CHAR_talkToCli ( myindex , -1 , "成立聊天室需0转30级以上!" , CHAR_COLORYELLOW );
		return FALSE;
	}
	if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) != 0 ) {
		CHAR_talkToCli ( myindex , -1 , "你已经在其他聊天室中!" , CHAR_COLORYELLOW );
		return FALSE;
	}
	return TRUE;
}
void NPC_PoolItemShopTalked( int meindex , int talkerindex , 
							char *szMes ,int color )
{
	if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
		return;
	}
	CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
	if( !NPC_Util_isFaceToFace( meindex, talkerindex, 2)) {
		if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;
	}
	NPC_PoolItemShop_printWindow_Start( meindex, talkerindex);
}
Example #22
0
int MAGIC_ToCallDragon( int charaindex, int toindex,int marray, int mp )
{
	int battlemode;
   
	print("MAGIC_ToCallDragon in .................\n");
	if( FALSE == CHAR_CHECKINDEX( charaindex ) )
		return FALSE;
   	
	battlemode = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEMODE );
	if( BATTLE_CHARMODE_INIT == battlemode )
		return FALSE;
	if( CHAR_getInt( charaindex , CHAR_MP ) < mp )
		return FALSE;
   
	CHAR_setInt( charaindex , CHAR_MP , CHAR_getInt( charaindex , CHAR_MP ) - mp );

	if( TRUE == IsBATTLING( charaindex ) )
		return MAGIC_ToCallDragon_Battle( charaindex , toindex , marray , mp );
   	
	return FALSE;   
}
Example #23
0
int PET_CleanPetdeletetime( int objmeindex)
{
	int		pindex;

	if( OBJECT_getType(objmeindex) != OBJTYPE_CHARA ) return 0;
	pindex = OBJECT_getIndex( objmeindex);
	if( CHAR_getInt( pindex, CHAR_WHICHTYPE) != CHAR_TYPEPET) return 0;
	if( CHAR_getInt( pindex, CHAR_MAILMODE) != CHAR_PETMAIL_NONE) {
	}else if( CHAR_getWorkInt( pindex, CHAR_WORKPETFOLLOWMODE) == CHAR_PETFOLLOW_NOW ){
	}else {
#ifdef _PET_LOSTPET
//		CHAR_CharSaveLostPet( pindex, 0);
#endif
		LogPet(
			"系统",
			"Watchfunc",
			CHAR_getChar( pindex, CHAR_NAME),
			CHAR_getInt( pindex, CHAR_LV),
			"timeout_lost(系统清除-地上自由宠)",
			CHAR_getInt( pindex, CHAR_FLOOR),
			CHAR_getInt( pindex,CHAR_X ),
			CHAR_getInt( pindex,CHAR_Y ),
			CHAR_getChar( pindex, CHAR_UNIQUECODE)   // shan 2001/12/14
		);
		CHAR_CharaDelete(pindex);
		return 1;
	}
	return 0;
}
Example #24
0
static int TITLE_IntCheck( int charaindex, int elem, int *data, int flg)
{
	int     rc = FALSE;
	int     i;
	for( i = 0; i < TITLE_PARAMSIZE && *(data+i) != -1; i ++ ) {
		switch( flg) {
		  case 0:       /* "<=" */
			if( CHAR_getInt( charaindex, elem) <= *(data+i) ) rc = TRUE;
			break;
		  case 1:       /* ">=" */
			if( CHAR_getInt( charaindex, elem) >= *(data+i) ) rc = TRUE;
			break;
		  case 2:       /* "<>" */
			if( CHAR_getInt( charaindex, elem) != *(data+i) ) rc = TRUE;
			break;
		  case 3:       /* ">" */
			if( CHAR_getInt( charaindex, elem) > *(data+i) ) rc = TRUE;
			break;
		  case 4:       /* "<"  */
			if( CHAR_getInt( charaindex, elem) < *(data+i) ) rc = TRUE;
			break;
		  case 5:       /* "=" */
			if( CHAR_getInt( charaindex, elem) == *(data+i) ) rc = TRUE;
			break;
		  default:
		  rc= FALSE;
		  break;
		}
		if( rc) break;
	}
	return rc;
}
Example #25
0
/*********************************
*   仄井仃日木凶凜及質  
*********************************/
void NPC_FmLetterTalked( int meindex , int talkerindex , char *szMes ,int color )
{
	//print(" FmLetter_fmindex:%d ", CHAR_getInt( meindex, CHAR_FMINDEX) );
	

	int /*fmindex = 0, village,*/ i;
	char token[256];
	char buf[256];
/*	for( i=0 ; i<FMPOINTNUM ; i++ ) {
		getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 9, token, sizeof(token));
		village = atoi(token);
		if( village == CHAR_getInt( meindex, CHAR_FMINDEX ) ) {
			getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
			fmindex = atoi(token);
			break;
		}
	}
#ifdef _FMVER21
	if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){}
#else
#endif 
*/
	for( i=0 ; i<FMPOINTNUM ; i++ ) {
		getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 5, token, sizeof(token));
	if( CHAR_getInt( talkerindex, CHAR_FMINDEX ) == atoi(token) ) {
			
		if( CHAR_getInt( talkerindex, CHAR_FMLEADERFLAG ) == FMMEMBER_LEADER ){
			NPC_FmLetter_selectWindow( meindex, talkerindex, 1 );
			return;
		}
		else
			goto NEXT;
	}
}
NEXT:
			lssproto_WN_send( getfdFromCharaIndex( talkerindex ), WINDOW_MESSAGETYPE_MESSAGE,
				WINDOW_BUTTONTYPE_OK,
				-1, -1,
				makeEscapeString( "\n只有本莊園的族長才能製作邀請函及同意書!", buf, sizeof(buf)));
}
Example #26
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 );
	}
}
Example #27
0
/*-----------------------------------------
¥¯¥é¥¤¥¢¥ó¥È¤«¤éÊ֤äƤ­¤¿»þ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤ë¡e
-------------------------------------------*/
void NPC_LuckyManWindowTalked( int meindex, int talkerindex, 
								int seqno, int select, char *data)
{
	char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char buf[256];
	int money;
	int level;
	
	/*--ÀßÄê¥Õ¥¡¥¤¥ë¤ò  ¤ß  ¤ß--*/
	if((argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof(argstr1)))== NULL) {
		print("NPC_ExChange.c TypeCheck: GetArgStrErr\n");
		print("NPCName=%s\n", CHAR_getChar(meindex,CHAR_NAME));
		return;
	}

	switch( seqno){
		case CHAR_WINDOWTYPE_WINDOWPETSHOP_START:
			if(select == WINDOW_BUTTONTYPE_YES) {
				NPC_Util_GetStrFromStrWithDelim( argstr, "Stone", buf,sizeof(buf));
			
				if(strstr(buf,"LV") != NULL) {
					char buff2[32];
					level = CHAR_getInt( talkerindex, CHAR_LV);
					getStringFromIndexWithDelim( buf, "*", 2, buff2,sizeof( buff2));
					money = level * atoi( buff2);

					if(NPC_LuckyCostCheck(meindex,talkerindex,money) == FALSE) {
						NPC_Util_GetStrFromStrWithDelim( argstr,"NoMoney", buf, sizeof( buf));
						NPC_LuckyMan_selectWindow( meindex, talkerindex, 3, buf);
						return;
					}
				}else{
					money = atoi( buf);
					if(NPC_LuckyCostCheck(meindex,talkerindex ,money) == FALSE) {
						NPC_Util_GetStrFromStrWithDelim( argstr,"NoMoney", buf,sizeof( buf));
						NPC_LuckyMan_selectWindow( meindex, talkerindex, 3, buf);
						return;
					}
				}

				CHAR_DelGold( talkerindex, money );

				CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
				NPC_LuckyDisp( meindex, talkerindex);

			}else if(select == WINDOW_BUTTONTYPE_OK) {

			}
		break;
	}
}
Example #28
0
/*********************************
* watch質  
*********************************/
void NPC_ActionWatch( int meobjindex, int objindex, CHAR_ACTION act,
                    int x,int y,int dir, int* opt,int optlen )
{
	int		meindex;
	int		index;
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	buf[64];
	int		i;
    struct  {
    	CHAR_ACTION		act;
    	char			*string;
    }searchtbl[] = {
	    { CHAR_ACTATTACK,	"attack"},
	    { CHAR_ACTDAMAGE,	"damage"},
		{ CHAR_ACTDOWN,		"down"},
		{ CHAR_ACTSIT,		"sit"},
		{ CHAR_ACTHAND,		"hand"},
		{ CHAR_ACTPLEASURE,	"pleasure"},
		{ CHAR_ACTANGRY,	"angry"},
		{ CHAR_ACTSAD,		"sad"},
		{ CHAR_ACTGUARD,	"guard"},
		{ CHAR_ACTNOD,		"nod"},
		{ CHAR_ACTTHROW,	"throw"},
    };
	
	if( OBJECT_getType( objindex) != OBJTYPE_CHARA) return;
	index = OBJECT_getIndex( objindex);
	/* 皿伊奶乩□卞及心  殺允月 */
	if( CHAR_getInt( index, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) return;
    
    meindex = OBJECT_getIndex( meobjindex);
    
    /* 輊五寧勻化ㄠ弘伉永玉匹卅中午  殺仄卅中 */
    if( NPC_Util_isFaceToFace( meindex, index, 1 ) != TRUE ) return;
	
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	for( i = 0; i < arraysizeof( searchtbl); i ++ ) {
		if( searchtbl[i].act == act) {
			if( NPC_Util_GetStrFromStrWithDelim( argstr, 
												searchtbl[i].string,
												buf, sizeof( buf))
		    	!= NULL )
			{
		    	CHAR_talkToCli( index, meindex ,buf , 
		    					CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR ));
				break;
			}
		}
	}
}
Example #29
0
/*-----------------------------------------
竣  戊旦玄及煌遙
------------------------------------------*/
int NPC_WindowCostCheckMp(int meindex,int talker)
{
	int cost;
	double drate;
	int rate;
	
	rate=CHAR_getWorkInt(meindex,CHAR_WORK_MP);
	drate=(double) rate / 1000 ;
	cost=CHAR_getInt(talker,CHAR_LV);
	cost=(int)cost*drate;
	if(cost==0) cost=1;
	return cost;
}
Example #30
0
/*-------------------------------------
伊矛伙民尼永弁
伊矛伙毛葦化澀爛伊矛伙方曰斕仃木壬    卞允月
  曰襖
	澀爛伊矛伙    		TRUE
	澀爛伊矛伙動曉卅日	FALSE
---------------------------------------*/
BOOL NPC_WindowHealerLevelCheck(int meindex,int talker)
{
		int level;
	
		level=CHAR_getWorkInt(meindex,CHAR_WORK_LEVEL);

		if(level > CHAR_getInt(talker,CHAR_LV)){
			return TRUE;
		}

		return FALSE;

}