예제 #1
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;
}
예제 #2
0
int NPC_Util_SearchNear( int meindex, int maxlen, int type )
{
#if 1
    int	floor, x, y, i,iTarget = -1;
    if( !CHAR_CHECKINDEX( meindex ) )return -1;
    floor = CHAR_getInt( meindex, CHAR_FLOOR );
    x  = CHAR_getInt( meindex, CHAR_X );
    y  = CHAR_getInt( meindex, CHAR_Y );

	for( i = 0; i < maxlen; i ++ ){
		iTarget = SearchNearAround( x, y, floor, RAND( 0,3 ), i+1, type );
		if( iTarget >= 0 )break;
	}
	return iTarget;


#else
    int	floor, x, y, i,iTarget = -1, iLen, iMin = 655360, tX, tY;
    if( !CHAR_CHECKINDEX( meindex ) )return -1;
    floor = CHAR_getInt( meindex, CHAR_FLOOR );
    x  = CHAR_getInt( meindex, CHAR_X );
    y  = CHAR_getInt( meindex, CHAR_Y );

    /*  ���� */
    for( i = 0 ; i<objnum ; i++ ){
        /*ƽ�ҷ�����������*/
        if( obj[i].type != OBJTYPE_CHARA ) continue;
        if( CHAR_getInt( obj[i].index,CHAR_WHICHTYPE)
            != type ) continue;
	    if( floor != obj[i].floor ) continue;

	    /* CHAR_TYPEENEMY ���ݷ�index�����м�������ؤ�¼�ƥ������������ */
        if( obj[i].index == meindex ) continue;

		tX = ABS( x-CHAR_getInt(obj[i].index,CHAR_X) );
		tY = ABS( y-CHAR_getInt(obj[i].index,CHAR_Y) );
		if( tX > maxlen )continue;	/* �Tľ�ʿ�*/
		if( tY > maxlen )continue;	/* ئ���ݳ�*/

		iLen = tX*tX+tY*tY;
		if( iMin > iLen ){
			iMin = iLen;
			iTarget = obj[i].index;	/* �̼������͵�ë趪E*/
		}
	}

	return iTarget;
#endif
}
예제 #3
0
파일: npc_petshop.c 프로젝트: BlueKarl/gmsv
int NPC_DepotPet_CheckRepeat( int charaindex)
{
	int petindex1, petindex2;
	int i, j, find, ret = FALSE;
	int workindex[CHAR_MAXDEPOTPETHAVE], cnt =0;

	for( i =0; i <(CHAR_MAXDEPOTPETHAVE-1); i++)
	{
		petindex1 = CHAR_getDepotPetIndex( charaindex, i);
		if( !CHAR_CHECKINDEX( petindex1)) continue;
		find = 0;
		for( j =(i+1); j <CHAR_MAXDEPOTPETHAVE; j++)
		{
			petindex2 = CHAR_getDepotPetIndex( charaindex, j);
			if( !CHAR_CHECKINDEX( petindex2)) continue;
			if( petindex1 == petindex2 ) continue;
			if( !strcmp( CHAR_getChar( petindex1, CHAR_UNIQUECODE),
						CHAR_getChar( petindex2, CHAR_UNIQUECODE) ) )
			{
				print(" ÔÚ²Ö¿âÕÒµ½·Ç·¨³èÁË ");
				CHAR_setDepotPetIndex( charaindex, j, -1);
				NPC_DepotPet_CheckRepeat_del( charaindex, petindex2);
				find ++;
				ret = TRUE;
			}
		}
		if( find >0)
		{
			CHAR_setDepotPetIndex( charaindex, i, -1);
			NPC_DepotPet_CheckRepeat_del( charaindex, petindex1);
		}
	}

	for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
		workindex[i] = -1;
	}
	for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
		int pindex = CHAR_getDepotPetIndex( charaindex, i);
		if( CHAR_CHECKINDEX( pindex) ) {
			workindex[cnt++] = pindex;
		}
	}
	for( i = 0; i < CHAR_MAXDEPOTPETHAVE; i ++ ) {
		CHAR_setDepotPetIndex( charaindex, i, workindex[i]);
	}

	return ret;
}
예제 #4
0
void ChatRoom_Leave ( int myindex )
{
	int i , NextMaker = -1 ; 
	int Num = CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMNUM );
	if ( !CHAR_CHECKINDEX ( myindex ) ) 
		return ;
	if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 1 ) {
		for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
			if ( ChatRoom[ Num ].MemberList[ i ] != myindex &&
				ChatRoom[ Num ].MemberList[ i ] != -1 ) {
				if ( CHAR_CHECKINDEX ( ChatRoom[ Num ].MemberList[ i ] ) ) {
					if ( CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_LV ) >= 30 || 
						CHAR_getInt ( ChatRoom[ Num ].MemberList[ i ] , CHAR_TRANSMIGRATION ) >= 1 ) {
						NextMaker = ChatRoom[ Num ].MemberList[ i ] ; 
						break;
					}
				}
			}
		}
		if ( NextMaker != -1 ) {
			ChatRoom_Make( myindex , NextMaker ) ; 
			CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMTYPE , 0) ; 
			CHAR_setWorkInt ( myindex , CHAR_WORKCHATROOMNUM, -1) ; 
			ChatRoom[ Num ].NowPeople --;
			for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
				if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) {
					ChatRoom[ Num ].MemberList[ i ] = -1 ; 
					break;
				}
			}
		}else{
			ChatRoom_Destroy( myindex ) ; 
			return ; 
		}

	}else if ( CHAR_getWorkInt ( myindex , CHAR_WORKCHATROOMTYPE ) == 2 ) {
		CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMTYPE, 0) ; 
		CHAR_setWorkInt ( myindex, CHAR_WORKCHATROOMNUM, -1) ; 
		ChatRoom[ Num ].NowPeople --;
		for ( i = 0 ; i < MAX_PPLINROOM ; i ++ ) {
			if ( ChatRoom[ Num ].MemberList[ i ] == myindex ) {
				ChatRoom[ Num ].MemberList[ i ] = -1 ; 
				break;
			}
		}
	}
	ChatRoom_Refresh ( Num ) ; 
}
예제 #5
0
int	MAGIC_Weaken( int charaindex, int toindex, int marray, int mp )
{

    int battlemode;
    //check index
    if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ//??
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }

    //mp²»×ã
    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
    //ÏûºÄmp
    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );

    //checkÊÇ·ñÕ½¶·ÖÐ
    if( IsBATTLING( charaindex ) == TRUE ) {
        return MAGIC_ParamChange_Turn_Battle( charaindex, toindex, marray, mp );
    } else {
        return FALSE;
    }
}
예제 #6
0
// ¿¢å§¾®ÈÕãâÍÙ¡Ö  Ü·  »¿
int	MAGIC_ResAndDef( int charaindex, int toindex, int marray, int mp )
{
    int battlemode;

    // INDEXÃñÄáÓÀÛÍ
    if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //£ûÁÃ

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }

    //     ÛÕ  ÃñÄáÓÀÛÍ
    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; //   ¾®ÔÈÐ×ÈÕĸ¶ª
    // ³ð¼°  Ü··´  ɧ±å    ÛÕ  ØÆ»¯  ÖУÛѨÄ̹ϵ©±åئÔ³ðÎç·´  ÖÐ
    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );

    // ¾ô    ·ÖÔÈÐ×ÈÕ
    if( IsBATTLING( charaindex ) == TRUE ) {
        return MAGIC_ResAndDef_Battle( charaindex, toindex, marray, mp );
    } else {
        // ¾ô    ƥئ¾®ÔÈÐ×ÈÕ
        return FALSE;
    }
}
예제 #7
0
// µ©  ¡õÕýµ©³ªéÙëܸÒüÔ  Ü·
int	MAGIC_StatusChange2( int charaindex, int toindex, int marray, int mp )
{
    int battlemode;

    // INDEXÃñÄáÓÀÛÍ
    if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //£ûÁÃ

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }

    //¿ÛÆø
    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;

    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );

    //call func
    if( IsBATTLING( charaindex ) == TRUE ) {
        return MAGIC_StatusChange_Battle2( charaindex, toindex, marray, mp );
    } else {
        return FALSE;
    }
}
예제 #8
0
int	MAGIC_StatusChange( int charaindex, int toindex, int marray, int mp )
{
    int battlemode;
    if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;
    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }

    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
    CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp );
    if( IsBATTLING( charaindex ) == TRUE ) {
#ifdef _PREVENT_TEAMATTACK	//Ò쳣״̬²»µÃʹÓÃÓÑ·½
        int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
        if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER &&
                BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P ) {
            if( BATTLE_CheckSameSide( charaindex, toindex) == 1 ) { //ͬ±ß
                int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
                BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
                CHAR_talkToCli( charaindex, -1, "Ò쳣״̬..²»µÃÊ©ÓèÓÑ·½¡£", CHAR_COLORYELLOW);
                return FALSE;
            }
        }
#endif
        return MAGIC_StatusChange_Battle( charaindex, toindex, marray, mp );
    } else {
        return FALSE;
    }
}
예제 #9
0
int CHAR_talkToCli(int talkedcharaindex, int talkcharaindex, char *message, CHAR_COLOR color) {
  static char lastbuf[2048];
  static char escapebuf[2048];
  static char mesgbuf[1024];
  int fd;

  if(!CHAR_CHECKINDEX(talkedcharaindex))
    return FALSE;
  if(CHAR_getInt(talkedcharaindex, CHAR_WHICHTYPE) != CHAR_TYPEPLAYER) {
    print("err CHAR_talkToCli CHAR_WHICHTYPE != CHAR_TYPEPLAYER\n");
    return FALSE;
  }

  fd = getfdFromCharaIndex(talkedcharaindex);
  if(fd == -1) {
    print("err CHAR_talkToCli can't get fd from:%d \n", talkedcharaindex);
    return FALSE;
  }

  if(color < CHAR_COLORWHITE && color > CHAR_COLORGREEN2) {
    print("CHAR_talkToCli color err\n");
    return FALSE;
  }
  snprintf(lastbuf, sizeof(lastbuf), "P|%s", makeEscapeString(CHAR_appendNameAndTitle(talkcharaindex, message, mesgbuf, sizeof(mesgbuf)), escapebuf, sizeof(escapebuf)));
  int talkchar = -1;
  if(talkcharaindex != -1)
    talkchar = CHAR_getWorkInt(talkcharaindex, CHAR_WORKOBJINDEX);
  lssproto_TK_send(fd, talkchar, lastbuf, color);
  return TRUE;
}
예제 #10
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);
}
예제 #11
0
파일: npc_petshop.c 프로젝트: BlueKarl/gmsv
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);	
		
}
예제 #12
0
파일: npc_petshop.c 프로젝트: BlueKarl/gmsv
// ¼ì²éµÈ¼¶ÊÇ·ñ×ã¹»
int NPC_DepotPet_CheckLevel(int meindex,int talker,int select,char *token)
{
	int petindex;
	int selectpet;

	if( !CHAR_CheckDepotPet( talker) )
		return FALSE;

	selectpet = CHAR_getWorkInt( talker, CHAR_WORKSHOPRELEVANT) ;
	petindex = CHAR_getDepotPetIndex( talker, selectpet);
	if( !CHAR_CHECKINDEX(petindex) ) return FALSE;
	
	//print("\n trans:%d char_lv:%d pet_lv:%d ",
	//	CHAR_getInt( talker, CHAR_TRANSMIGRATION),
	//	CHAR_getInt( talker, CHAR_LV),
	//	CHAR_getInt( petindex, CHAR_LV) );

	// Èç¹ûÊÇÊØ»¤ÊÞ¸ÄΪÆÕͨÊÞ
	if( CHAR_getInt( petindex, CHAR_PETFAMILY) == 1 
		&& CHAR_getInt( talker, CHAR_FMLEADERFLAG) != 3 ) {
		CHAR_setInt( petindex, CHAR_PETFAMILY, 0);
	}

	if( CHAR_getWorkInt( talker, CHAR_PickAllPet) == TRUE ) { // ×°±¸Ñ±ÊÞ½äÖ¸µÄ»°...
		return TRUE;
	}

	if( CHAR_getInt( talker, CHAR_TRANSMIGRATION) > 0 
		|| CHAR_getInt( talker, CHAR_LV)+5 >= CHAR_getInt( petindex, CHAR_LV) ) {
		return TRUE;
	}
	
	return FALSE;
	
}
예제 #13
0
/*
 * ふたつのキャラが隣りあってるかどうかをしらべる。
 * 絶対値をみるので、同じ位置でも隣りだと認定される
 *
 * int ind1 , ind2 : ふたつのキャラクタのindex
 *
 *
 * となりあってたら TRUE , そうじゃないならFALSE
 */
BOOL NPC_Util_CharNearby(int ind1,int ind2)
{
    if( !CHAR_CHECKINDEX(ind1)) return FALSE;
    if( !CHAR_CHECKINDEX(ind2)) return FALSE;

    if( CHAR_getInt( ind1 , CHAR_FLOOR ) !=
        CHAR_getInt( ind2 , CHAR_FLOOR ) ){
        return FALSE;
    }
    
    return NPC_Util_Nearby( CHAR_getInt( ind1,CHAR_X),
                            CHAR_getInt( ind1,CHAR_Y),
                            CHAR_getInt( ind2,CHAR_X),
                            CHAR_getInt( ind2,CHAR_Y));
                            
}
예제 #14
0
void NPC_BlackMarketWindowTalked( int index, int talker, int seqno, int select, char *data)
{
	int  i;
	char sBuf[1024]="", sBuf1[256]="";
    
    if(!CHAR_CHECKINDEX( talker)) return;	
    if(getfdFromCharaIndex( talker)==-1) return;
	if(CHAR_getInt( talker, CHAR_WHICHTYPE)!=CHAR_TYPEPLAYER) return;    
    if(NPC_Util_isFaceToFace( talker, index, 1)!=TRUE) return;
        
    if( seqno == CHAR_WINDOWTYPE_BLACKMARKET){
		for(i=0; i<12; i++){
		    CONNECT_set_BMList( getfdFromCharaIndex( talker), i, BMSellList[i]);		    
		    sprintf( sBuf1, "%d|%d|%s\n", BMSellList[i], BMItem[BMSellList[i]].iGraphicsNum, BMItem[BMSellList[i]].iName); 
		    strcat( sBuf, sBuf1);
		}

	    lssproto_WN_send( getfdFromCharaIndex( talker), 
		                  WINDOW_MESSAGETYPE_BLACKMARKET, 
		                  WINDOW_BUTTONTYPE_NONE,
				    	  CHAR_WINDOWTYPE_BLACKMARKET,
				          CHAR_getWorkInt( index, CHAR_WORKOBJINDEX),
					      sBuf );
	}
}
예제 #15
0
void ITEM_contract( int charaindex, int toindex, int haveitemindex)
{
	int itemindex;
	int conindex;
	char data[2048+1024];
	
	if( !CHAR_CHECKINDEX( charaindex ) )  return;

	itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( !ITEM_CHECKINDEX(itemindex) )  return;

	//conindex = atoi( ITEM_getChar( itemundex, ITEM_CONTRACTNUM));
	conindex = atoi( ITEM_getChar( itemindex, ITEM_ARGUMENT));

	sprintf( data, "%s|%d|%s|%s", ITEM_contractTbl[conindex].detail, 
		ITEM_contractTbl[conindex].argnum,
		ITEM_getChar( itemindex, ITEM_CONTRACTARG),
		ITEM_getChar( itemindex, ITEM_CONTRACTTIME) );

	print("\n contract_send:%s\n", data);

	lssproto_WN_send( getfdFromCharaIndex( charaindex), WINDOW_MESSAGETYPE_CONTRACT,
		WINDOW_BUTTONTYPE_YESNO,
		CHAR_WINDOWTYPE_CONTRACT_ANSWER,
		itemindex,
		data );

}
예제 #16
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;

}
예제 #17
0
파일: magic.c 프로젝트: Nurarihyo/smo-sa
int	MAGIC_Weaken( int charaindex, int toindex, int marray, int mp )
{

	int battlemode;
	//check index
	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

	// 爵  釩銨凜反  骰允月//??
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}

	//mp不足
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; 
	//消耗mp
	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );

	//check是否戰鬥中
	if( IsBATTLING( charaindex ) == TRUE ){
		return MAGIC_ParamChange_Turn_Battle( charaindex, toindex, marray, mp );
	}else{
		return FALSE;
	}
}
예제 #18
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;

}
예제 #19
0
BOOL NPC_reloadNPC(void)
{
	int i;
	int charnum = getFdnum()+ getPetcharnum()+getOtherscharnum();
	for(i=0;i<charnum;i++){
		if(!CHAR_CHECKINDEX(i)) continue;
		if(CHAR_getWorkInt(i,CHAR_WORKNPCTYPE)==1){
			NPC_Util_NPCDelete(i);
		}
	}
	if(NPC_readNPCSettingFiles( getNpcdir(), getNpctemplatenum(),
                                  getNpccreatenum() )==TRUE)
  	NPC_generateLoop( 1 );
  if(getReloadNpcType()==1){
  	int j;
  	int playernum = CHAR_getPlayerMaxNum();
  	for(j=0;j<playernum;j++){
  		if( CHAR_getCharUse(j) != FALSE ) {
  			if(CHAR_getWorkInt(j,CHAR_WORK_OFFLINE)==0 && CHAR_getWorkInt(j,CHAR_WORKBATTLEMODE)==BATTLE_CHARMODE_NONE){
  				CHAR_warpToSpecificPoint(j,CHAR_getInt(j,CHAR_FLOOR),CHAR_getInt(j,CHAR_X),CHAR_getInt(j,CHAR_Y));
  			}
  		}
  	}
  }
  return TRUE;
}
예제 #20
0
파일: magic.c 프로젝트: Nurarihyo/smo-sa
// 竣濮井日汊唾≒  芊  豢
int	MAGIC_ResAndDef( int charaindex, int toindex, int marray, int mp )
{
	int battlemode;

	// INDEX民尼永弁
	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //{撩  

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

	// 爵  釩銨凜反  骰允月
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}

	//     壅  民尼永弁
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; //   井勻凶日母丟
	// 仇及  芊反  騷卞    壅  仄化  中〔穴奶瓜旦卞卅月仇午反  中
	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );

	// 爵    分勻凶日
	if( IsBATTLING( charaindex ) == TRUE ){
		return MAGIC_ResAndDef_Battle( charaindex, toindex, marray, mp );
	}else{
	// 爵    匹卅井勻凶日
		return FALSE;
	}
}
예제 #21
0
파일: magic.c 프로젝트: Nurarihyo/smo-sa
int MAGIC_AttMagic( int charaindex , int toindex , int marray , int mp )
{
   int battlemode;
   
   if( FALSE == CHAR_CHECKINDEX( charaindex ) )
   	return FALSE;
   	
   battlemode = CHAR_getWorkInt( charaindex , CHAR_WORKBATTLEMODE );
   if( BATTLE_CHARMODE_INIT == battlemode )
   	return FALSE;
	 // 若是寵物魔法,不扣mp
   if(CHAR_getInt(charaindex,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER)
	 {
     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_AttMagic_Battle( charaindex , toindex , marray , mp );
   	
   return FALSE;   

}
예제 #22
0
파일: magic.c 프로젝트: Nurarihyo/smo-sa
// 旦  □正旦唱橘毛芨尹月  芊
int	MAGIC_StatusChange2( int charaindex, int toindex, int marray, int mp )
{
	int battlemode;

	// INDEX民尼永弁
	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE; //{撩  

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

	// 爵  釩銨凜反  骰允月
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}

    //扣氣
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; 

	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );

    //call func
	if( IsBATTLING( charaindex ) == TRUE ){
		return MAGIC_StatusChange_Battle2( charaindex, toindex, marray, mp );
	}else{
		return FALSE;
	}
}
예제 #23
0
파일: magic.c 프로젝트: Nurarihyo/smo-sa
int	MAGIC_MagicDef( int charaindex, int toindex, int marray, int mp )
{
	int battlemode;
	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;
	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}

	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
	CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp );
	if( IsBATTLING( charaindex ) == TRUE ){
#ifdef _PREVENT_TEAMATTACK //光鏡守..不得使用敵方
		int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
		if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER 
			/*&& BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P*/ ){
			if( BATTLE_CheckSameSide( charaindex, toindex) == 0 ){//不同邊
				int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
				BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
				CHAR_talkToCli( charaindex, -1, "光鏡守..不得施予敵方。", CHAR_COLORYELLOW);
				return FALSE;
			}
		}
#endif
		return MAGIC_MagicDef_Battle( charaindex, toindex, marray, mp );
	}else{
		return FALSE;
	}
}
예제 #24
0
static BOOL ADDRESSBOOK_makeEntryFromCharaindex( int charaindex,
												 ADDRESSBOOK_entry* ae)
{
	char *cdkey;

	if( !CHAR_CHECKINDEX(charaindex) ) return FALSE;

	memset( ae,0,sizeof(ADDRESSBOOK_entry) );
	cdkey = CHAR_getChar( charaindex, CHAR_CDKEY);
	if( cdkey == NULL ){
		print( "ADDRESSBOOK_makeEntryFromCharaindex:"
			   " strange! getcdkeyFromCharaIndex returns NULL!"
			   " charaindex: %d\n" , charaindex );
		return FALSE;
	}
	strcpysafe( ae->cdkey , sizeof( ae->cdkey ),cdkey);

	strcpysafe( ae->charname,sizeof( ae->charname),
				CHAR_getChar(charaindex,CHAR_NAME) );
	ae->level       = CHAR_getInt( charaindex , CHAR_LV );
	ae->duelpoint   = CHAR_getInt( charaindex, CHAR_DUELPOINT);
	ae->graphicsno  = CHAR_getInt( charaindex , CHAR_FACEIMAGENUMBER );
	ae->online = getServernumber();
	ae->use = TRUE;
	ae->transmigration = CHAR_getInt( charaindex, CHAR_TRANSMIGRATION);

	return TRUE;
}
예제 #25
0
void CHAR_recoveryStatus( int charaindex )
{
    int     i;
    int     cure=FALSE;
    if( !CHAR_CHECKINDEX(charaindex) )return;

    for( i=0 ; i < arraysizeof(pShow) ; i ++ ) {
        if( CHAR_getInt(charaindex,pShow[i].paramindex) > 0 ) {
            int old;
            old = CHAR_setInt(charaindex,pShow[i].paramindex,
                              CHAR_getInt(charaindex,
                                          pShow[i].paramindex) - 1 );
            if( old == 1 ) {
                if( CHAR_getInt(charaindex,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) {
                    CHAR_talkToCli( charaindex,-1, pShow[i].offmessage,
                                    CHAR_COLORWHITE );
                }
                cure = TRUE;
            }
        }
    }
    if( cure ) {
        CHAR_sendStatusString( charaindex, "P" );
        CHAR_sendCToArroundCharacter( CHAR_getWorkInt(
                                          charaindex, CHAR_WORKOBJINDEX) );
    }
}
예제 #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_setChar( petindex, CHAR_NAME, PetNAME);
			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 );
	}
}
예제 #27
0
/**************************************
 * 戚及樺赭毛本永玄允月
 **************************************/
static int NPC_AirSetPoint( int meindex, char *argstr)
{
	char	buf[4096];
	char	buf2[256];
	char	buf3[256];
	int floor,warpx,warpy;
	int ret;
	char routetostring[64];
	
	snprintf( routetostring, sizeof( routetostring), "routeto%d", 
				CHAR_getWorkInt( meindex, NPC_WORK_CURRENTROUTE));
	
	if( NPC_Util_GetStrFromStrWithDelim( argstr, routetostring,buf, sizeof(buf))
		== NULL ) 
	{
		print( "npcair:nothing route \n");
		return FALSE;
	}

	ret = getStringFromIndexWithDelim( buf, ";", 
		CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT),
		buf2, sizeof(buf2));
	if( ret == FALSE ) return FALSE;

	// Arminius: add floor
	
	ret = getStringFromIndexWithDelim( buf2, ",", 1,
		buf3, sizeof(buf3));
	if( ret == FALSE) return FALSE;
	floor = atoi(buf3);

	ret = getStringFromIndexWithDelim( buf2, ",", 2,
		buf3, sizeof(buf3));
	if( ret == FALSE) return FALSE;
	CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, atoi( buf3));
	warpx = atoi(buf3);
	
	ret = getStringFromIndexWithDelim( buf2, ",", 3,
		buf3, sizeof(buf3));
	if( ret == FALSE) return FALSE;
	CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, atoi( buf3));
	warpy = atoi(buf3);

	if (floor!=CHAR_getInt(meindex, CHAR_FLOOR)) {
		int	i;
		CHAR_warpToSpecificPoint(meindex, floor, warpx, warpy);

		for( i = 1; i < CHAR_PARTYMAX; i ++ ) {
			int toindex = CHAR_getWorkInt( meindex, i + CHAR_WORKPARTYINDEX1);
			if( CHAR_CHECKINDEX(toindex) ) {
				CHAR_warpToSpecificPoint(toindex, floor, warpx, warpy);
			}
		}
		CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, warpx);
		CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, warpy);
	}

	return TRUE;
}
예제 #28
0
BOOL NPC_PairForage( int meindex, int toindex, char *arg, char *token)
{
	char buf1[256];
	int i;
	int codes = CHAR_getWorkInt( toindex, CHAR_MYPAIRCODE);
	int Psex = CHAR_getSexInt( CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
	Psex = (Psex==1)?1:0;


	for( i=0; i<MAXPAIRNUMS; i++)	{//forindex
		char *name;
		char *cdKey;
		int fd;
		char buf[256];
		if( PairList[Psex][i].use <= 0 ) continue;
		if( !CHAR_CHECKINDEX( PairList[Psex][i].pindex) ) continue;
		if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE )
			continue;
		if( codes != CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRCODE) ) continue;
		if( CHAR_getWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG) > 0 ) continue;
		name = CHAR_getChar( PairList[Psex][i].pindex, CHAR_NAME);
		cdKey = CHAR_getChar( PairList[Psex][i].pindex, CHAR_CDKEY);
		if( strcmp( PairList[Psex][i].name, name) || strcmp( PairList[Psex][i].cdKey, cdKey) ){
			PairList[Psex][i].use = -1;
			PairList[Psex][i].forindex = -1;
			continue;
		}
		sprintf( token, "你的配对对象为: %s\n已送出邀请,请等候对方回应。", name);
		if( NPC_Util_GetStrFromStrWithDelim( arg, "InviteMsg", buf1, sizeof( buf1) ) == NULL){
			break;
		}
		PairList[Psex][i].forindex = toindex;
		fd = getfdFromCharaIndex( PairList[Psex][i].pindex);

		CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, 1);
		CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, PairList[Psex][i].pindex);
		CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRFLG, 2);
		CHAR_setWorkInt( PairList[Psex][i].pindex, CHAR_MYPAIRINDEX, toindex);

		name = CHAR_getChar( toindex, CHAR_NAME);
		sprintf( buf, "%s:\n玩家%s\n%s", CHAR_getChar( meindex, CHAR_NAME),name, buf1);
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE, WINDOW_BUTTONTYPE_OKCANCEL, WINDOW_TALKPAIR,
				CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX), buf);
		break;
	}
	if( i>= MAXPAIRNUMS )	{
		if( NPC_Util_GetStrFromStrWithDelim( arg, "NoPairMsg", buf1, sizeof( buf1) ) != NULL){
			sprintf( token, "%s",buf1);
		}else	{
			sprintf( token, "没有找到对象。");
		}
		if( CHAR_getWorkInt( toindex, CHAR_MYPAIRFLG) <= 0 )	{
			NPC_PairRegister( toindex);
		}
		return FALSE;
	}
	return TRUE;
}
예제 #29
0
void NPC_MakePairManLoop( int meindex)
{
	int i;
	for( i=0; i<MAXPAIRNUMS; i++)	{
		if( PairList[0][i].use > 0 ){
			if( !CHAR_CHECKINDEX( PairList[0][i].pindex) ){
				PairList[0][i].pindex = -1;
				PairList[0][i].use = -1;
			}
		}
		if( PairList[1][i].use > 0 ){
			if( !CHAR_CHECKINDEX( PairList[1][i].pindex) ){
				PairList[1][i].pindex = -1;
				PairList[1][i].use = -1;
			}
		}
	}
}
예제 #30
0
int NPC_DoorRefreshOverFlg( int meind )
{
    if( !CHAR_CHECKINDEX(meind))return FALSE;
    if( NPC_Door_isOpen( meind ) ==1 ){
        CHAR_setFlg( meind , CHAR_ISOVERED , 1 );
    } else {
        CHAR_setFlg( meind , CHAR_ISOVERED , 0 );
    }
    return TRUE;
}