Exemple #1
0
/*********************************
* 賡渝質  
*********************************/
BOOL NPC_FmLetterInit( int meindex )
{
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	buf[1024];
	//int		i;
	//char	secondToken[1024];
	
	// Robin test
	// print(" fmleter_Init ");	
	
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf))
		== NULL )
	{
		print( "fmletter:沒有指定設定的檔案 。\n");
		return FALSE;
	}
	/* 賡渝凜卞澀爛犯□正毛民尼永弁仄化支月 */
	if( !NPC_FmLetter_readData( meindex, -1, TRUE) ) {
		return FALSE;
	}
	
	CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN );
	
	return TRUE;
}
Exemple #2
0
/*------------------------------------------------------------------------
 * 婁醒井日丟永本□斥毛潸  允月
 *----------------------------------------------------------------------*/
static char *NPC_Sysinfo_GetMsg( int meindex, char *msgindexstr,
								char *out,int outlen, int num )
{

	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	*work;
	char	*buff;
	char	*cret = NULL;
	int 	worklen;

	worklen = strlen( msgindexstr)+3;
	work = (char *)calloc( 1, worklen * sizeof( char));
	buff = (char *)calloc( 1, outlen  * sizeof( char));

	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));

	snprintf( work, worklen, "%s%d", msgindexstr, num);
	if( NPC_Util_GetStrFromStrWithDelim( argstr, work,
									buff, outlen) != NULL )
	{
		strcpy( out, buff);
		cret = out;
	}

	free( work);
	free( buff);
	return( cret);
}
void NPC_LuckyDisp(int meindex,int talker)
{
	char argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char buf[16];
	char token[1024];
	char buf2[512];
	int i = 1;

	/*--ÀßÄê¥Õ¥¡¥¤¥ë¤ò  ¤ß  ¤ß--*/
	if((argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1)))== NULL) {
		print("NPC_Savepoint.c Init: GetArgStrErr");
		return;
	}

	/*--±¿¤ò¸«¤ë--*/
	sprintf( buf, "luck%d", CHAR_getInt( talker, CHAR_LUCK));
	NPC_Util_GetStrFromStrWithDelim( argstr, buf, buf2, sizeof( buf2));

	while(getStringFromIndexWithDelim( buf2, ",", i, token, sizeof( token))
	!= FALSE)
	{
		i++;
	}
	i--;
	i = rand()%i + 1;

	/*--¥é¥ó¥À¥à¤Ç¥á¥Ã¥»¡¼¥¸¤ò  ¼¨¤µ¤»¤ë--*/
	getStringFromIndexWithDelim( buf2,",", i, token, sizeof( token));
	NPC_LuckyMan_selectWindow( meindex, talker, 1, token);
}
Exemple #4
0
/*
 *��������ëGET���£�
 */
void NPC_WarpPointGet(int meindex,int talker,int *fl,int *x,int *y,int judge)
{
   	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *strbuf[2] = {"WinWarp","LoseWarp"};
	char buf[64];
	char buf2[32];

	/*--ɬ�ð����̻�ë  ��  ��--*/
	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("NPC_janken Init: GetArgStrErr");
		return ;
	}


	/*--���������  --*/
	NPC_Util_GetStrFromStrWithDelim( argstr, strbuf[judge], buf, sizeof( buf));
	getStringFromIndexWithDelim(buf,",",1,buf2,sizeof(buf2));
	*fl=atoi(buf2);
	getStringFromIndexWithDelim(buf,",",2,buf2,sizeof(buf2));
	*x=atoi(buf2);
	getStringFromIndexWithDelim(buf,",",3,buf2,sizeof(buf2));
	*y=atoi(buf2);
	
	
}
Exemple #5
0
BOOL NPC_QuizItemFullCheck(int meindex,int talker)
{
    int i;
    int itemindex;
    char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
    char buf2[32];


    for( i = CHAR_STARTITEMARRAY ; i < CHAR_MAXITEMHAVE ; i++ ) {
        itemindex = CHAR_getItemIndex( talker , i );
        if( !ITEM_CHECKINDEX( itemindex) ) {
            return TRUE;
        }
    }

    if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL)
    {
        print("GetArgstrErr:Quiz %s",CHAR_getChar( meindex, CHAR_NAME));
    }

    if(NPC_Util_GetStrFromStrWithDelim( argstr,"EntryItem",	buf2, sizeof( buf2)) != NULL)
    {
        if(NPC_EntryItemCheck( talker, buf2) == FALSE) {
            NPC_Quiz_selectWindow( meindex, talker, 3);
            return  FALSE;

        } else {
            return TRUE;
        }
    }


    return FALSE;

}
BOOL NPC_PetSkillShopInit( int meindex )
{
	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[256];

    CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPESTONESHOP );
	if(NPC_Util_GetArgStr( meindex, argstr, sizeof(argstr))==NULL){
		print("GetArgStrErr");
		return FALSE;
	}
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "pet_skill", msg, sizeof( msg)) != NULL){
		char buf[256], filename[256];
		int k=1, skillID, skillarray;
		while( getStringFromIndexWithDelim( msg, ",", k, buf, sizeof( buf) ) ){
			k++;
			skillID=atoi(buf);
			skillarray = PETSKILL_getPetskillArray( skillID);
			if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue;
			if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1){
				if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ){
					print("PetSkillShop illegal skill:[%d-%s] ->file:%s",
						skillID,
						PETSKILL_getChar( skillarray, PETSKILL_NAME),
						filename );
				}
			}
		}
	}else{
		return FALSE;
	}

    return TRUE;
}
Exemple #7
0
/**************************************
 * �ݼ�����ë����������
 **************************************/
static int NPC_BusSetPoint( int meindex, char *argstr)
{
	char	buf[4096];
	char	buf2[256];
	char	buf3[256];
	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( "npcbus:nothing route \n");
		return FALSE;
	}
	ret = getStringFromIndexWithDelim( buf, ";", 
								CHAR_getWorkInt( meindex, NPC_WORK_ROUTEPOINT),
								buf2, sizeof(buf2));
		
	if( ret == FALSE ) return FALSE;

	ret = getStringFromIndexWithDelim( buf2, ",", 1,
								buf3, sizeof(buf3));
	if( ret == FALSE) return FALSE;
	CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOX, atoi( buf3));
	
	ret = getStringFromIndexWithDelim( buf2, ",", 2,
								buf3, sizeof(buf3));
	if( ret == FALSE) return FALSE;
	CHAR_setWorkInt( meindex, NPC_WORK_ROUTETOY, atoi( buf3));
	return TRUE;
}
BOOL NPC_RidermanInit( int meindex )
{
    char	argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
    char	buf[1024];
    //int		i;
    //char	secondToken[1024];

    // Robin test
    // print(" riderman_Init ");

    NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));

    if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf))== NULL )
    {
        print( "riderman:没有指定设定的档案 。\n");
        return FALSE;
    }
    /* 赓渝凛卞涩烂犯□正毛民尼永弁仄化支月 */
    if( !NPC_Riderman_readData( meindex, -1, TRUE) ) {
        return FALSE;
    }

    CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN );

    return TRUE;
}
Exemple #9
0
/*********************************
*   �ƾ�����ľ���ݼ���  
*********************************/
void NPC_ActionTalked( int meindex , int talkerindex , char *szMes ,
                     int color )
{
	char	argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char	buf[64];

    /* �����������帲�ƻ�����  ɱ���� */
    if( CHAR_getInt( talkerindex , CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER ) {
    	return;
    }
	/* ���������  ���� */
	if( !NPC_Util_charIsInFrontOfChar( talkerindex, meindex, 1 )) return; 

	NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));

	if( NPC_Util_GetStrFromStrWithDelim( argstr, 
										"normal",
										buf, sizeof( buf))
    	!= NULL )
	{
    	CHAR_talkToCli( talkerindex, meindex ,buf , 
    					CHAR_getWorkInt( meindex, CHAR_WORK_MSGCOLOR ));
	}
	
}
/*********************************
* ½é´ü½è  
*********************************/
BOOL NPC_WindowmanInit( int meindex )
{
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	char	buf[1024];
	//int		i;
	//char	secondToken[1024];
	
	
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "conff", buf, sizeof( buf))
		== NULL ) 
	{
		print( "windowman:¨S¦³«ü©w³]©wªºÀÉ®× ¡C\n");
		return FALSE;
	}
	/* ½é´ü»þ¤ËÀßÄê¥Ç¡¼¥¿¤ò¥Á¥§¥Ã¥¯¤·¤Æ¤ä¤ë */
	if( !NPC_Windowman_readData( meindex, -1, TRUE) ) {
		return FALSE;
	}
	
	CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEWINDOWMAN );
	
	return TRUE;
}
Exemple #11
0
void NPC_LuckyDisp(int meindex,int talker)
{
	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char buf[16];
	char token[1024];
	char buf2[512];
	int i = 1;

	/*--ɬÀð×ÑëÄÌ»ïë  ÐÄ  ÐÄ--*/
	if(NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr)) == NULL) {
		print("NPC_Savepoint.c Init: GetArgStrErr");
		return;
	}

	/*--ÞÑëέÔÂ--*/
	sprintf( buf, "luck%d", CHAR_getInt( talker, CHAR_LUCK));
	NPC_Util_GetStrFromStrWithDelim( argstr, buf, buf2, sizeof( buf2));

	while(getStringFromIndexWithDelim( buf2, ",", i, token, sizeof( token))
	!= FALSE)
	{
		i++;
	}
	i--;
	i = rand()%i + 1;

	/*--·Â¼þĸةƥ¶ªÓÀ±¾¡õ³âë  Ô÷½ñÁùÔÂ--*/
	getStringFromIndexWithDelim( buf2,",", i, token, sizeof( token));
	NPC_LuckyMan_selectWindow( meindex, talker, 1, token);
}
Exemple #12
0
BOOL VipShop_GetMenuStr( int meindex, int toindex, char *npcarg, char *token,int index )
{
	char buf1[1024], buf2[32], buf3[36];
	BOOL FINDS=FALSE;
	int talkNo=index*7+1;
	if( npcarg == NULL ) return FALSE;
	
	sprintf( token, "你当前的积分是:%d        %d/%d页\n",sasql_ampoint(CHAR_getUseID(toindex),0,0), index+1, page);
	while( getStringFromIndexWithDelim( npcarg,"}",talkNo, buf1, sizeof( buf1)) != FALSE )	{
		talkNo++;
		memset( buf2, 0, sizeof( buf2));
		if( NPC_Util_GetStrFromStrWithDelim( buf1, "MenuStr", buf2, sizeof( buf2)) == NULL  )
			continue;
		FINDS = TRUE;

		sprintf( buf3, "    %s", buf2);
		if(strlen(buf3)<10)
			strcat( buf3, "   \n");
		else
			strcat( buf3, "\n");
		strcat( token, buf3);
		if(talkNo>(index*7+8))return FINDS;
	}
	return FINDS;
}
Exemple #13
0
/**************************************
 * ϶�ý�ľ��ʧ��  ةë  �Ȼ����¾�������������
 *   �Ȼ������շֻ�
 **************************************/
static BOOL NPC_BusCheckDeniedItem( int meindex, int charaindex, char *argstr)
{
	char	buf[1024];
	BOOL	found = TRUE;

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "denieditem", buf, sizeof( buf))
		!= NULL ) 
	{
		int	i;
		int ret;
		for( i = 1; ; i ++) {
			int itemid;
			char buf2[64];
			int j;
			ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2));
			if( ret == FALSE ) break;
			itemid = atoi( buf2);
			for( j = 0; j < CHAR_MAXITEMHAVE; j ++) {
				int itemindex = CHAR_getItemIndex( charaindex, j);
				if( ITEM_CHECKINDEX( itemindex)) {
					if( ITEM_getInt( itemindex, ITEM_ID) == itemid) {
						found = FALSE;
						break;
					}
				}
			}
		}
	}
	return found;
}
BOOL NPC_FreePetSkillShopInit( int meindex )
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[256];
    CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_FREESKILLSHOP );
	CHAR_setWorkInt( meindex, CHAR_WORK_SKILLSELECT, 0);

	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("GetArgStrErr NO arg !!");
		return FALSE;
	}

	if( NPC_Util_GetStrFromStrWithDelim( npcarg, "pet_skill", msg, sizeof( msg)) != NULL){
		char buf[256], filename[256];
		int k=1, skillID, skillarray;
		while( getStringFromIndexWithDelim( msg, ",", k, buf, sizeof( buf) ) ){
			k++;
			skillID=atoi(buf);
			skillarray = PETSKILL_getPetskillArray( skillID);
			if( PETSKILL_CHECKINDEX( skillarray) == FALSE ) continue;
			if( PETSKILL_getInt( skillarray, PETSKILL_ILLEGAL) == 1){
				if( NPC_Util_CheckAssignArgFile( meindex, filename) != NULL ){
						print("\n宠物技能不规范:[%d-%s] ->文件:%s\n",
						skillID,
						PETSKILL_getChar( skillarray, PETSKILL_NAME),
						filename );
				}
			}
		}
	}else{
		return FALSE;
	}

    return TRUE;
}
Exemple #15
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;
}
Exemple #16
0
/**************************************
 * »ØÄꤵ¤ì¤¿¥¢¥¤  ¥à¤ò  ¤Ã¤Æ¤¤¤ë¤«¥Á¥§¥Ã¥¯¤¹¤ë
 *   ¤Ã¤Æ¤¤¤Ê¤¤¤È¤À¤á
 **************************************/
BOOL NPC_BusCheckAllowItem( int meindex, int charaindex, BOOL pickupmode)
{
	char	buf[1024];
	BOOL	found = TRUE;
	BOOL	pickup = FALSE;
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "pickupitem", buf, sizeof( buf))!= NULL ){
		pickup = TRUE;
	}
	if( NPC_Util_GetStrFromStrWithDelim( argstr, "allowitem", buf, sizeof( buf))!= NULL ){
		int	i;
		int ret;
		for( i = 1; ; i ++) {
			int itemid;
			char buf2[64];
			int j;
			BOOL	getflg;
			ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2));
			if( ret == FALSE ) break;
			itemid = atoi( buf2);
			getflg = FALSE;
			for( j = 0; j < CHAR_MAXITEMHAVE; j ++) {
				int itemindex = CHAR_getItemIndex( charaindex, j);
				if( ITEM_CHECKINDEX( itemindex)) {
					if( ITEM_getInt( itemindex, ITEM_ID) == itemid) {
						if( pickupmode && pickup && !getflg) {
							CHAR_DelItem( charaindex, j);
							getflg = TRUE;
						}
						break;
					}
				}
			}
			if( j == CHAR_MAXITEMHAVE) {
				found = FALSE;
				break;
			}
		}
	}
	return found;
}
Exemple #17
0
/*-----------------------------------------
 * �ͷ���ʧ��������߯�Ȼ������ݱ���̫���ľ�£�
 *
-------------------------------------------*/
void NPC_FMPKManWindowTalked( int meindex, int talkerindex,
                              int seqno, int select, char *data)
{
    int datanum = -1, fl, x, y;
    char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE];
    char buf[1024], buff2[256];

    if (NPC_Util_GetArgStr(meindex, npcarg, sizeof(npcarg)) == NULL)
    {
        print("GetArgStrErr");
        return;
    }
    NPC_Util_GetStrFromStrWithDelim(npcarg, "WARP", buf, sizeof(buf));
    getStringFromIndexWithDelim(buf, ",", 1, buff2, sizeof(buff2));
    fl = atoi(buff2);
    getStringFromIndexWithDelim(buf, ",", 2, buff2, sizeof(buff2));
    x = atoi(buff2);
    getStringFromIndexWithDelim(buf, ",", 3, buff2, sizeof(buff2));
    y = atoi(buff2);

    makeStringFromEscaped( data);

//	print("meindex:%d seqno:%d select:%d data:%s\n", meindex, seqno, select, data);

    datanum = atoi( data);
    switch( seqno) {

    /*--��Ԫ��Ի��    --*/
    case CHAR_WINDOWTYPE_FMPKMAN_START:
        if (datanum == 1)
            NPC_FMPKMan_selectWindow(meindex, talkerindex, 1, -1);
        else if (datanum == 2)
            NPC_FMPKMan_selectWindow(meindex, talkerindex, 2, -1);
        break;
    case CHAR_WINDOWTYPE_FMPKMAN_VIEW:
        break;
    case CHAR_WINDOWTYPE_FMPKMAN_LEAVEPK:
        if (select == WINDOW_BUTTONTYPE_YES)
        {
            if (CHAR_getWorkInt(talkerindex, CHAR_WORKBATTLEMODE)
                    != BATTLE_CHARMODE_NONE)
                return;

            // shan add
            if(NPC_PARTY_CHAECK1( meindex, talkerindex)==FALSE) {
                NPC_ERR_DiSP1( meindex, talkerindex, 1);
                return;
            }

            CHAR_setWorkInt(talkerindex, CHAR_WORKWARPCHECK, FALSE);
            CHAR_warpToSpecificPoint(talkerindex, fl, x, y);
        }
        break;
    default:
        break;
    }
}
int NPC_getNextTitle( int meindex, int toindex, char *arg, int title, int select)
{
	char buf[NPC_UTIL_GETARGSTR_BUFSIZE], buf1[1024], buf2[256];
	int toID=0;
	memset( buf, 0, sizeof( buf));
	if( getStringFromIndexWithDelim( arg, "PSYCHOMETRICS", 2, buf, sizeof( buf)) == FALSE )
		return -1;
	if( getStringFromIndexWithDelim( buf , "}", title, buf1, sizeof( buf1)) == FALSE )
		return -1;
	if( select == WINDOW_BUTTONTYPE_YES ) {
		if( NPC_Util_GetStrFromStrWithDelim( buf1, "YESFOR", buf2, sizeof( buf2 )) == NULL)
			return -1;
	}else {
		if( NPC_Util_GetStrFromStrWithDelim( buf1, "NOFOR", buf2, sizeof( buf2) ) == NULL)
			return -1;
	}
	toID = atoi( buf2);
	return toID;
}
BOOL NPC_PAItemShop_Main(int meindex,int talker, char *argstr,char *token, int sizes)
{
	char buff[256];
	//int fd = getfdFromCharaIndex( talker);
	memset( buff, 0, sizeof( buff));
    if( NPC_Util_GetStrFromStrWithDelim( argstr, "MAIN_MESS", buff, sizeof( buff)) == NULL )
		return FALSE;
	snprintf(token, sizes,"%s|%s", CHAR_getChar( meindex, CHAR_NAME), buff);
	return TRUE;
}
Exemple #20
0
BOOL NPC_NPCEnemy_BattleIn(  int meindex, int charaindex)
{
	int		gym;
	int		ret;
	char	buf[256];
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;

	//memset( argstr, 0, sizeof( argstr));
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	gym = NPC_Util_GetNumFromStrWithDelim( argstr, "gym");

#ifdef _EMENY_CHANCEMAN
	{
		int masterindex=-1;
		masterindex = NPC_EmenyChanceCheck( meindex, charaindex, argstr);
		if( CHAR_CHECKINDEX( masterindex)){
			charaindex = masterindex;
		}else	{
			return TRUE;
		}
	}
#endif
	if( gym > 0 ){
		ret = BATTLE_CreateVsEnemy( charaindex, 2, meindex);
	}else{
		ret = BATTLE_CreateVsEnemy( charaindex, 1, meindex);
	}
	if( ret == 0 ) {
		BattleArray[CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX)].WinFunc	= NPC_NPCEnemy_Dying;
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "startmsg", buf, sizeof( buf))	!= NULL ){
			CHAR_talkToCliAndParty( charaindex, meindex ,buf , CHAR_COLORYELLOW );
		}
		if( NPC_Util_GetStrFromStrWithDelim( argstr, "steal", buf, sizeof( buf))!= NULL ){
			if( atoi( buf) == 0 ) {
				NPC_NPCEnemy_StealItem( argstr, meindex, charaindex);
			}
		}
	}
	return ( ret == 0 ) ?TRUE:FALSE ;
}
void NPC_PairUserAndWarp( int meindex, int toindex, int forindex, char *arg)
{
	char buf1[256];
	int fl=-1, x=-1, y=-1;

	if( !CHAR_CHECKINDEX( toindex)) return;
	CHAR_setWorkInt( toindex, CHAR_MYPAIRINDEX, -1);
	CHAR_setWorkInt( toindex, CHAR_MYPAIRFLG, -1);
	if( !CHAR_CHECKINDEX( forindex)) return;
	CHAR_setWorkInt( forindex, CHAR_MYPAIRINDEX, -1);
	CHAR_setWorkInt( forindex, CHAR_MYPAIRFLG, -1);

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

	if( NPC_Util_GetStrFromStrWithDelim( arg, "PAIRTOPOINT", buf1, sizeof( buf1) ) != NULL){
		char buf2[256];
		if( getStringFromIndexWithDelim( buf1,",",1,buf2,sizeof( buf2)) != FALSE )
			fl = atoi( buf2);
		if( getStringFromIndexWithDelim( buf1,",",2,buf2,sizeof( buf2)) != FALSE )
			x = atoi( buf2);
		if( getStringFromIndexWithDelim( buf1,",",3,buf2,sizeof( buf2)) != FALSE )
			y = atoi( buf2);
	}
	CHAR_DischargePartyNoMsg( toindex);//解散团队
	CHAR_DischargePartyNoMsg( forindex);//解散团队
	if( MAP_IsValidCoordinate( fl, x, y) != FALSE ){
		CHAR_warpToSpecificPoint( toindex, fl, x, y);
		CHAR_warpToSpecificPoint( forindex, fl, x, y);
	}

	CHAR_JoinParty_Main( toindex, forindex);
	//lssproto_PR_send( fd, 0, 1);
	{
		int i;
		for( i=0; i<MAXPAIRNUMS; i++)	{
			if( PairList[0][i].use > 0 ){
				if( PairList[0][i].pindex == toindex ||
					PairList[0][i].pindex == forindex ){
					PairList[0][i].pindex = -1;
					PairList[0][i].use = -1;
				}
			}
			if( PairList[1][i].use > 0 ){
				if( PairList[1][i].pindex == toindex ||
					PairList[1][i].pindex == forindex ){
					PairList[1][i].pindex = -1;
					PairList[1][i].use = -1;
				}
			}
		}
	}
}
Exemple #22
0
BOOL PetTalk_CheckPetEvent( int meindex, int toindex, char *buf)
{
	char buf1[256],buf2[256];
	int k = 0;

	if( NPC_Util_GetStrFromStrWithDelim( buf, "EndSetFlg", buf1,sizeof( buf1) ) != NULL )	{
		k=1;
		while( getStringFromIndexWithDelim(buf1 , "," ,k, buf2, sizeof(buf2) ) != FALSE ){
			k++;
			NPC_EventSetFlg( toindex, atoi( buf2));	
		}
	}
	if( NPC_Util_GetStrFromStrWithDelim( buf, "NowSetFlg", buf1, sizeof( buf1)) != NULL) {
		k=1 ;
		while(getStringFromIndexWithDelim(buf1 , "," , k, buf2, sizeof(buf2))!= FALSE ){
			k++;
			NPC_NowEventSetFlg( toindex, atoi( buf2));
		}
	}
	return TRUE;
}
BOOL NPC_QuizInit( int meindex )
{

	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char buf[1024];
	int *tbl;
	int i;

	NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));

	if(NPC_Util_GetStrFromStrWithDelim( argstr, "StartMsg", buf, sizeof( buf)) == NULL){
		print("Quiz_StartMsgErr:%s", CHAR_getChar( meindex, CHAR_NAME));
		return FALSE;
	}

	if(NPC_Util_GetStrFromStrWithDelim( argstr, "Quiznum", buf, sizeof( buf)) == NULL){
		print("QuizNumErrErr:%s", CHAR_getChar( meindex, CHAR_NAME));
		return FALSE;
	}

	CHAR_setWorkInt( meindex, CHAR_WORK_QUIZNUM, atoi( buf));

	for(i =0  ; i < 8 ; i++){
		CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + i, -1);
	}
	tbl =  NPC_GetQuestion( meindex);

	if( CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) > ( tbl[0] - 1)){
		print(
		 "%sБF▓┼жX▒°еє,╢ъ░щquizк║░▌├D╝╞(%dЦт)дёеX├D╝╞(%d├D)дгим",
			CHAR_getChar( meindex, CHAR_NAME),
			(tbl[0]-1),
			CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM)
		);
		return FALSE;
	}

	return TRUE;

}
BOOL NPC_PAItemShop_BuyMain(int meindex, int talker, char *argstr,char *token, int sizes)
{
	//int fd = getfdFromCharaIndex( talker);
	char token2[NPC_UTIL_GETARGSTR_BUFSIZE];
	char buff2[256];
    char buff[256];

    if( NPC_Util_GetStrFromStrWithDelim( argstr, "MAIN_MESS", buff, sizeof( buff)) == NULL )
		return FALSE;
    if( NPC_Util_GetStrFromStrWithDelim( argstr, "BUY_MESS", buff2, sizeof( buff2)) == NULL )
		return FALSE;
	memset( token2, 0, sizeof( token2));
	sprintf(token,"0|1|%d|%s|%s|%s|", CHAR_WINDOWTYPE_WINDOWITEMSHOP_STARTMSG,
				CHAR_getChar( meindex, CHAR_NAME), buff, buff2);

    if( NPC_Util_GetStrFromStrWithDelim( argstr, "WHAT_MESS", buff, sizeof( buff)) == NULL )
		return FALSE;
    if( NPC_Util_GetStrFromStrWithDelim( argstr, "LEVEL_MESS", buff2, sizeof( buff2)) == NULL )
		return FALSE;

	snprintf( token2, sizeof( token2), "%s|%s", buff, buff2);
	strncat( token, token2, sizes);
    if( NPC_Util_GetStrFromStrWithDelim( argstr, "REALY_MESS", buff, sizeof( buff)) == NULL )
		return FALSE;
    if( NPC_Util_GetStrFromStrWithDelim( argstr, "ITEMFULL_MESS", buff2, sizeof( buff2)) == NULL )
		return FALSE;
	memset( token2, 0, sizeof( token2));
	sprintf( token2, "|%s|%s", buff, buff2);
	strncat(token , token2, sizeof( token2));
	strcpy(token2, "|");
	NPC_PAGetItemList( argstr, token2, sizeof( token2));
	strncat( token, token2, sizes);

	return TRUE;
}
Exemple #25
0
BOOL NPC_QuizInit( int meindex )
{

    char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
    char buf[1024];
    int *tbl;
    int i;

    NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));

    if(NPC_Util_GetStrFromStrWithDelim( argstr, "StartMsg", buf, sizeof( buf)) == NULL) {
        print("Quiz_StartMsgErr:%s", CHAR_getChar( meindex, CHAR_NAME));
        return FALSE;
    }

    if(NPC_Util_GetStrFromStrWithDelim( argstr, "Quiznum", buf, sizeof( buf)) == NULL) {
        print("QuizNumErrErr:%s", CHAR_getChar( meindex, CHAR_NAME));
        return FALSE;
    }

    CHAR_setWorkInt( meindex, CHAR_WORK_QUIZNUM, atoi( buf));

    for(i =0  ; i < 8 ; i++) {
        CHAR_setWorkInt( meindex, CHAR_WORK_PLAYER1 + i, -1);
    }
    tbl =  NPC_GetQuestion( meindex);

    if( CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM) > ( tbl[0] - 1)) {
        print(
            "%s²»·ûºÏÌõ¼þ,ԲȦquizµÄÎÊÌâÊý(%d? ±È³öÌâÊý(%dÌâ)²»×ã",
            CHAR_getChar( meindex, CHAR_NAME),
            (tbl[0]-1),
            CHAR_getWorkInt( meindex, CHAR_WORK_QUIZNUM)
        );
        return FALSE;
    }

    return TRUE;

}
Exemple #26
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;
			}
		}
	}
}
Exemple #27
0
/*********************************
* ������  
*********************************/
BOOL NPC_BodyLanInit( int meindex )
{

	char szP[256], szArg[4096];
	char buf[256];
	int i, needSeq;

    CHAR_setInt( meindex , CHAR_WHICHTYPE , CHAR_TYPEEVENT );

    if( NPC_Util_GetArgStr( meindex, szArg, sizeof( szArg ) ) == NULL ){
    	print( "npc_bodylan.c:û������(%s)\n",
    		CHAR_getChar(meindex,CHAR_NPCARGUMENT) );
    	return FALSE;
    }


	// �ˡ�������ë����
	if( NPC_Util_GetStrFromStrWithDelim( szArg, "Act", szP, sizeof( szP ) ) == NULL ){
		print( "npc_bodylan:������������δ�趨(%s)\n",	szArg );
		return FALSE;
	}

	for( i = 0 ; ; i ++ ){
		//   ۢئ��  
		if( getStringFromIndexWithDelim( szP, ",", i, buf, sizeof( buf)) != FALSE ){
			needSeq = atoi(buf);
			// Ѩ�̹ϵ���  ���ճ����ƥ
			if( needSeq < 0 ){
				if( i <= 0 ){
					print( "npc_bodylan:��������δ�趨(%s)\n", szArg );
				}
				//     �������
				CHAR_setWorkInt( meindex, BODYLAN_E_COMMANDNUM, i );
				break;
			}else{
				// ������ƻ�������
			}
		}else{
			if( i <= 0 ){
				print( "npc_bodylan:��������δ�趨(%s)\n", szArg );
			}
			//     �������
			CHAR_setWorkInt( meindex, BODYLAN_E_COMMANDNUM, i );
			break;
		}
	}



    return TRUE;

}
Exemple #28
0
void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex )
{
	int i;
	int battleindex, attackNo,itemindex;
	char *arg;
	char buf[256];

	struct tagImprecate {
		char fun[256];
		int intfun;
	};
	struct tagImprecate ImList[3] ={
		{"©G",BD_KIND_CURSE},{"®¦",BD_KIND_BESTOW},{"¯¬",BD_KIND_WISHES} };

	if( !CHAR_CHECKINDEX( charaindex) ) return;
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	if( (attackNo = BATTLE_Index2No( battleindex, charaindex )) < 0 ){
		print( "ANDY attackNo=%d\n", attackNo);
		return;
	}
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
	if( arg == NULL ){
		print( "ANDY ITEM id:%d=>arg err\n", ITEM_getInt( itemindex, ITEM_ID));
		return;
	}

	for( i=0; i<3; i++)	{
		if( strstr( arg, ImList[i].fun ) != 0 )	{
			char buf1[256];
			int kind,powers, rounds, HealedEffect;

			if( NPC_Util_GetStrFromStrWithDelim( arg, ImList[i].fun, buf, sizeof( buf)) == NULL )continue;
			kind = ImList[i].intfun;
			if( getStringFromIndexWithDelim( buf,"x", 1, buf1, sizeof( buf1)) == FALSE ) continue;
			powers = atoi( buf1);
			if( getStringFromIndexWithDelim( buf,"x", 2, buf1, sizeof( buf1)) == FALSE ) continue;
			rounds = atoi( buf1);
			HealedEffect = SPR_hoshi;
			BATTLE_ImprecateRecovery(
				battleindex, attackNo, toNo, kind, powers,
				rounds, SPR_item3, HealedEffect );
			CHAR_setItemIndex(charaindex, haveitemindex ,-1);
			CHAR_sendItemDataOne( charaindex, haveitemindex);
			ITEM_endExistItemsOne( itemindex );
			break;
		}
	}
}
BOOL MakePairMan_GetMenuStr( int meindex, int toindex, char *npcarg, char *token)
{
	char buf1[1024], buf2[256], buf3[256];
	BOOL FINDS=FALSE;
	int talkNo=1;
	if( npcarg == NULL ) return FALSE;
	
	if( NPC_Util_GetStrFromStrWithDelim( npcarg, "MenuHead", buf1, sizeof( buf1) ) == NULL){
		return FALSE;
	}
	sprintf( token, "%s\n", buf1);

	sprintf( buf1, "MEMU%d", talkNo);
	while( NPC_Util_GetStrFromStrWithDelim( npcarg, buf1, buf2, sizeof( buf2)) != NULL )	{
		talkNo++;
		sprintf( buf1, "MEMU%d", talkNo);
		FINDS = TRUE;
		sprintf( buf3, "          %s\n", buf2);
		strcat( token, buf3);
	}
	return FINDS;
}
static char *NPC_PoolItemShop_getMsg_noarg( int tablenum, 
								char *argstr, char *retstring, int retstringlen)
{
	char	buf[1024];
	if( tablenum < 0 || tablenum >= arraysizeof( poolshopmsg)) return NULL;
	
	if( NPC_Util_GetStrFromStrWithDelim( argstr, poolshopmsg[tablenum].option, buf, sizeof( buf)) != NULL ) {
		strcpysafe( retstring, retstringlen, buf);
	}else {
		strcpysafe( retstring, retstringlen, poolshopmsg[tablenum].defaultmsg);
	}
	return retstring;
}