コード例 #1
0
ファイル: npc_lua_nlg.c プロジェクト: darciusal/stoneagecode
int NPC_Lua_NLG_UpStateByThird(lua_State *_NLL)
{
	CheckEx(_NLL, 2);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	int TM_Flg = (int)lua_tointeger(_NLL, 2);
	BOOL TM_Ret = CHAR_send_P_StatusString(TM_Index, TM_Flg);
	LRetBool(_NLL, TM_Ret);
}
コード例 #2
0
/*----------------------------------------------------------------------
 * ¼«Ê¬¤Î¤ß²óÉü
 * °ú¿ô
 * charaindex		int		¼«Ê¬¤Îindex
 * magicindex		int		ËâË¡¤Îindex
 *---------------------------------------------------------------------*/
int MAGIC_Recovery_Field( int charaindex, int magicindex)
{
	char *magicarg;
	float power;
	int workhp;
	int	prevhp;
	char	msgbuf[64];

#ifdef _TYPE_TOXICATION
	if( CHAR_CanCureFlg( charaindex, "HP") == FALSE ) return TRUE;
#endif
	magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION );
	power =	atoi( magicarg );
	power = RAND( (power*0.9), (power*1.1) );
#ifndef _MAGIC_REHPAI
	power *= GetRecoveryRate( charaindex );
#endif
	prevhp = CHAR_getInt( charaindex, CHAR_HP );
	workhp = prevhp + (int)power;
	CHAR_setInt( charaindex, CHAR_HP,
		min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ) ) );
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_HP|CHAR_P_STRING_MP);
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) {
		int		mypartyarray = -1;
		int		oyaindex = CHAR_getWorkInt( charaindex, 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 == charaindex ) {
						mypartyarray = i;
						break;
					}
				}
			}
			if( mypartyarray != -1 ) {
				for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
					int index = CHAR_getPartyIndex( charaindex, i);
					if( CHAR_CHECKINDEX( index) ) {
						if( index != charaindex) {
							CHAR_send_N_StatusString( index, mypartyarray,
									CHAR_N_STRING_HP|CHAR_N_STRING_MP);
						}
					}
				}
			}
		}
	}
	snprintf( msgbuf, sizeof( msgbuf), "­@¤[¤O¦^´_%d",
			min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp);
	CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);
	return TRUE;

}
コード例 #3
0
ファイル: npc_charm.c プロジェクト: chinaSaber/custom-sa
/*--        --*/
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 );
	}
}
コード例 #4
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;
	}
}
コード例 #5
0
BOOL NPC_DepotItem_gettItem( int meindex, int talkerindex, int num)
{
	int emptyindex;
	int itemindex;

	if( !CHAR_CheckDepotItem( talkerindex) ) return FALSE;

	if( (emptyindex=CHAR_findEmptyItemBox( talkerindex)) == -1 ) return FALSE;
	itemindex = CHAR_getDepotItemIndex( talkerindex, num);
	if( !ITEM_CHECKINDEX( itemindex) )return FALSE;

	CHAR_setDepotItemIndex( talkerindex, num, -1);
	CHAR_setItemIndex( talkerindex, emptyindex, itemindex);
	CHAR_sendItemDataOne( talkerindex, emptyindex);
	
	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);

	LogItem(
		CHAR_getChar( talkerindex, CHAR_NAME ),
		CHAR_getChar( talkerindex, CHAR_CDKEY ),
#ifdef _add_item_log_name
		itemindex,
#else
		ITEM_getInt( itemindex, ITEM_ID),
#endif
		"Depot(取出道具)",
		CHAR_getInt( talkerindex,CHAR_FLOOR),
		CHAR_getInt( talkerindex,CHAR_X ),
 		CHAR_getInt( talkerindex,CHAR_Y ),
		ITEM_getChar( itemindex, ITEM_UNIQUECODE),
		ITEM_getChar( itemindex, ITEM_NAME),
		ITEM_getInt( itemindex, ITEM_ID) );

	{
		int i, cnt=0;
		int work[CHAR_MAXDEPOTITEMHAVE];
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			work[i] = -1;
		}
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			itemindex = CHAR_getDepotItemIndex( talkerindex, i);
			if( !ITEM_CHECKINDEX( itemindex)) continue;
			work[ cnt++] = itemindex;
		}
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			CHAR_setDepotItemIndex( talkerindex, i, work[i]);
		}
	}


	return TRUE;
}
コード例 #6
0
BOOL NPC_DepotItem_InsertItem( int meindex, int talkerindex, int num)
{
	int emptyindex;
	int itemindex;
	int cost = CHAR_getWorkInt( meindex, NPC_WORK_COST);

	if( !CHAR_CheckDepotItem( talkerindex) ) return FALSE;
	if( (emptyindex=CHAR_findEmptyDepotItem( talkerindex) ) == -1 ) return FALSE;
	itemindex = CHAR_getItemIndex( talkerindex, num);
	if( !ITEM_CHECKINDEX( itemindex) )return FALSE;
#if 1 // 共同倉庫不可存的物品
	if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) || // 登出後消失
			ITEM_getInt( itemindex, ITEM_VANISHATDROP) || // 丟棄後消失
			!ITEM_getInt( itemindex, ITEM_CANPETMAIL)) { // 不可寵郵寄
		print("\n 改封包!!非法存放道具:%s ", CHAR_getChar( talkerindex, CHAR_CDKEY) );
		return FALSE;
	}
#endif
	if( CHAR_DelGold( talkerindex, cost ) == 0 ) return FALSE;

	CHAR_setItemIndex( talkerindex, num, -1);
	CHAR_sendItemDataOne( talkerindex, num);
	CHAR_setDepotItemIndex( talkerindex, emptyindex, itemindex);

//	CHAR_DelGold( talkerindex, cost );
	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);

	LogItem(
		CHAR_getChar( talkerindex, CHAR_NAME ),
		CHAR_getChar( talkerindex, CHAR_CDKEY ),
#ifdef _add_item_log_name
		itemindex,
#else
		ITEM_getInt( itemindex, ITEM_ID),
#endif
		"Depot(存放道具)",
		CHAR_getInt( talkerindex,CHAR_FLOOR),
		CHAR_getInt( talkerindex,CHAR_X ),
 		CHAR_getInt( talkerindex,CHAR_Y ),
		ITEM_getChar( itemindex, ITEM_UNIQUECODE),
		ITEM_getChar( itemindex, ITEM_NAME),
		ITEM_getInt( itemindex, ITEM_ID) );

	NPC_DepotItem_CheckRepeat( talkerindex);

	return TRUE;
}
コード例 #7
0
static BOOL NPC_PoolItemShop_PoolItem( int meindex, int talkerindex, int num)
{
	int emptyindex;
	int itemindex;
	int cost = CHAR_getWorkInt( meindex, NPC_WORK_COST);

	emptyindex = CHAR_getCharPoolItemIndexElement( talkerindex);
	if( emptyindex == -1 ) {
		return FALSE;
	}
	                                                                                                  
	itemindex = CHAR_getItemIndex( talkerindex, num);
	if( !ITEM_CHECKINDEX( itemindex)) {
		fprint( "err");
		return FALSE;
	}
	CHAR_DelGold( talkerindex, cost );

	CHAR_setPoolItemIndex( talkerindex, emptyindex, itemindex);

	CHAR_setItemIndex( talkerindex, num, -1);
	CHAR_sendItemDataOne( talkerindex, num);

	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);
	LogItem(
		CHAR_getChar( talkerindex, CHAR_NAME ), /* 平乓仿   */
		CHAR_getChar( talkerindex, CHAR_CDKEY ),
#ifdef _add_item_log_name  // WON ADD 在item的log中增加item名稱
		itemindex,
#else
		ITEM_getInt( itemindex, ITEM_ID),  /* 失奶  丞  寞 */
#endif
		"pool(寄放道具)",
		CHAR_getInt( talkerindex,CHAR_FLOOR),
		CHAR_getInt( talkerindex,CHAR_X ),
 		CHAR_getInt( talkerindex,CHAR_Y ),
		ITEM_getChar( itemindex, ITEM_UNIQUECODE),
				ITEM_getChar( itemindex, ITEM_NAME),
				ITEM_getInt( itemindex, ITEM_ID)

	);
	return TRUE;
}
コード例 #8
0
/*
 *дк╢тд╬║я╜№
 */
BOOL NPC_EntryStoneDel(int talker,char *buf)
{
	int stone;
	int cost;
	char token[256];
	
	cost= atoi( buf);
	stone = CHAR_getInt( talker, CHAR_GOLD);
	
	if((stone-cost) < 0){
		CHAR_setInt( talker, CHAR_GOLD, 0);
	}else{
		CHAR_DelGold( talker, cost );
	}

	sprintf( token, "%d ецеXstoneбC", cost);
	CHAR_talkToCli( talker, -1, token, CHAR_COLORWHITE);

	CHAR_send_P_StatusString( talker, CHAR_P_STRING_GOLD);
	return TRUE;
}
コード例 #9
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);
					}
				}
			}
		}
	}

}
コード例 #10
0
ファイル: npc_airplane.c プロジェクト: Nurarihyo/smo-sa
BOOL NPC_AirCheckJoinParty( int meindex, int charaindex, BOOL msgflg)
{
    //int		fd;
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	int		ret;
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	
	/* ㄠ弘伉永玉動  及心 */
	if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; 
	/*     曇樂反蛐  允月 */
	if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GETTINGON);
		return FALSE;
	}
	/* 天□化不分勻凶日分戶 */
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_NOTPARTY);
		return FALSE;
	}
	/* 由□  奴及諦醒毛民尼永弁允月 */
	if( CHAR_getEmptyPartyArray( meindex) == -1 ) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_OVERPARTY);
		return FALSE;
	}
	/* 失奶  丞及民尼永弁毛允月(嗟鞅失奶  丞) */
	if( !NPC_AirCheckDeniedItem( meindex, charaindex, argstr)) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_DENIEDITEM);
		return FALSE;
	}
#ifdef _ITEM_CHECKWARES
	if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE )	{
		CHAR_talkToCli( charaindex, -1, "無法攜帶貨物上機。", CHAR_COLORYELLOW);
		return FALSE;
	}
#endif
	/* 失奶  丞及民尼永弁毛允月(  邰失奶  丞) */
	if( !NPC_AirCheckAllowItem( meindex, charaindex, FALSE)) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_ALLOWITEM);
		return FALSE;
	}
#ifdef _NPC_AIRDELITEM
	if( !NPC_AirCheckDelItem( meindex, charaindex, FALSE) ){ //若是沒扣除了道具
		if( msgflg ) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_DELITEM);
	    return FALSE;
	}
#endif
	/* 伊矛伙及民尼永弁毛允月 */
	if( !NPC_AirCheckLevel( meindex, charaindex, argstr)) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_LEVEL);
		return FALSE;
	}
#ifdef _NPC_AIRLEVEL
    if( !NPC_AirCheckMaxLevel( meindex, charaindex, argstr)) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_MAXLEVEL);
		return FALSE;
	}
#endif
	/* 奶矛件玄  井民尼永弁允月 */
//	if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 )
//	{
//		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_EVENT);
//		return FALSE;
//	}
	/* 豢嗯及民尼永弁毛允月  雲嗯毛潸月及匹〕  蔽民尼永弁卞允月仇午〞   */
	ret = NPC_AirCheckStone( meindex, charaindex, argstr);
	if( ret == -1 ) {
		if( msgflg) NPC_AirSendMsg( meindex, charaindex, NPC_AIR_MSG_GOLD);
		return FALSE;
	}
	if( ret != 0 ) {
		char msgbuf[128];
		/* 豢嗯毛午月 */
		CHAR_setInt( charaindex, CHAR_GOLD, 
					CHAR_getInt( charaindex, CHAR_GOLD) - ret);
		/* 霜耨 */
		CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD);
		snprintf( msgbuf, sizeof( msgbuf), "支付了%d Stone!", ret);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW);
	}
	/* 由□  奴卞  月 */
	//CHAR_JoinParty_Main( charaindex, meindex);
	
	//fd = getfdFromCharaIndex( charaindex );
	
	//lssproto_PR_send( fd, 1, 1);
	return TRUE;
}
コード例 #11
0
ファイル: npc_bus.c プロジェクト: ChowZenki/Long-Sa-Source
BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg)
{
    //int		fd;
	char	argstr[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	int		ret;
	NPC_Util_GetArgStr( meindex, argstr, sizeof( argstr));

	/* ���������  ���� */
	if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; 
	/*     ��ַ���  ���� */
	if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GETTINGON);
		return FALSE;
	}
	/* ��������������շֻ� */
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_NOTPARTY);
		return FALSE;
	}
	/* �ɡ�  ū������ë������������ */
	if( CHAR_getEmptyPartyArray( meindex) == -1 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_OVERPARTY);
		return FALSE;
	}
	/* ʧ��  ة����������ë����(���ʧ��  ة) */
	if( !NPC_BusCheckDeniedItem( meindex, charaindex, argstr)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_DENIEDITEM);
		return FALSE;
	}
#ifdef _ITEM_CHECKWARES
	if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE )	{
		CHAR_talkToCli( charaindex, -1, "�޷�Я�������ϳ���", CHAR_COLORYELLOW);
		return FALSE;
	}
#endif
	/* ʧ��  ة����������ë����(  ۢʧ��  ة) */
	if( !NPC_BusCheckAllowItem( meindex, charaindex, FALSE)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_ALLOWITEM);
		return FALSE;
	}
	/* ��ì�P��������ë���� */
	if( !NPC_BusCheckLevel( meindex, charaindex, argstr)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_LEVEL);
		return FALSE;
	}
	/* �����  �������������� */
//	if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 )
//	{
//		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_EVENT);
//		return FALSE;
//	}
	/* ���ż���������ë����  ����ë���¼�ƥ��  ���������ͱ����³����   */
	ret = NPC_BusCheckStone( meindex, charaindex, argstr);
	if( ret == -1 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GOLD);
		return FALSE;
	}
	if( ret != 0 ) {
		char msgbuf[128];
		/* ������� */
		CHAR_setInt( charaindex, CHAR_GOLD, 
					CHAR_getInt( charaindex, CHAR_GOLD) - ret);
		/* ˪�� */
		CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD);
		snprintf( msgbuf, sizeof( msgbuf), "֧����%d Stone��", ret);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW);
	}
	/* �ɡ�  ū��  �� */
	//CHAR_JoinParty_Main( charaindex, meindex);
	
	//fd = getfdFromCharaIndex( charaindex );
	
	//lssproto_PR_send( fd, 1, 1);
	
	
	return TRUE;
}
コード例 #12
0
ファイル: npc_doorman.c プロジェクト: beijunyi/custom-sa
void NPC_DoormanTalked( int meindex , int talkerindex , char *msg ,
                     int color )
{
    char mode[128];
    char opt[256];
    char	arg[NPC_UTIL_GETARGSTR_BUFSIZE];

    /* 皿伊奶乩□互玉失穴件及1弘伉永玉动  卅日反氏及丹 */
    if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return;

	NPC_Util_GetArgStr( meindex, arg, sizeof( arg));

    if( !getStringFromIndexWithDelim( arg, "|", 1, mode, sizeof( mode )))
        return;

    if( !getStringFromIndexWithDelim( arg, "|", 2, opt, sizeof( opt ) ))
        return;

    if( strcmp( mode , "gold" ) == 0 ){
        int g = atoi( opt );
        int yn = NPC_Util_YN( msg );
        /*char *nm = CHAR_getChar( meindex , CHAR_NAME );*/
        char msg[256];

        if( g > 0 && yn < 0 ){
            snprintf( msg ,sizeof( msg ) ,
                      "打开门需要给我%d的金子这样可以吗?", g );
            CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
        } else if( g > 0 && yn == 0 ){
            snprintf( msg , sizeof( msg ),
                      "打开门 %d的金子是必要的。", g );
        } else if( g > 0 && yn == 1 ){
            int now_g = CHAR_getInt( talkerindex, CHAR_GOLD );
            if( now_g < g ){
                snprintf( msg , sizeof( msg ) ,
                          "打开门 %d的金子是必要的。", g );
            	CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
            } else {
                snprintf( msg , sizeof( msg ),
                          "%d 收到金子了。现在就来开门。", g );
            	CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );

                /* 云嗯毛必永玄 */
                now_g -= g;
                CHAR_setInt( talkerindex , CHAR_GOLD , now_g );
                /* 丐凶日仄中旦  □正旦毛霜耨 */
                CHAR_send_P_StatusString(talkerindex, CHAR_P_STRING_GOLD);

                /* 玉失夫日仁 */
                NPC_DoormanOpenDoor(
                    CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME));
            }
        }
    } else if( strcmp( mode , "item" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "尚在未支援模式。",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemhave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "尚在未支援模式。",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemnothave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "尚在未支援模式。",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "titlehave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "尚在未支援模式。",
                        CHAR_COLORWHITE);

    } else if( strcmp( mode , "roomlimit" ) == 0 ){

		/*   盒及谛醒孺蜃互丐月桦宁 */
		char szOk[256], szNg[256], szBuf[32];
		int checkfloor;
		int maxnum, i, iNum;

	    if( !getStringFromIndexWithDelim( arg, "|", 2, szBuf, sizeof( szBuf ) ))
    	    return;

		/* 譬屯月白夫失午    谛醒 */
		if( sscanf( szBuf, "%d:%d", &checkfloor, &maxnum ) != 2 ){
			return;
		}

		for( iNum = 0,i = 0; i < getFdnum(); i ++ ){
			/* 皿伊奶乩□动陆卞反饬  互  中 */
			if( CHAR_getCharUse( i ) == FALSE )continue;
			if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue;
			/* 隙烂及白夫失动陆卞饬  互  中 */
			if( CHAR_getInt( i, CHAR_FLOOR ) != checkfloor )continue;
			iNum++;
		}
	    if( !getStringFromIndexWithDelim( arg, "|", 5, szNg, sizeof( szNg ))){
   			strcpy( szNg, "。。。。" );	/* 凤伞卅仄及本伉白 */
		}
    	if( !getStringFromIndexWithDelim( arg, "|", 4, szOk, sizeof( szOk ))){
   			strcpy( szOk, "开门吧。。。" );	/* 凤伞丐曰及本伉白 */
   		}

		if( iNum >= maxnum ){
			/*     毛译尹化中月桦宁 */
	        CHAR_talkToCli( talkerindex, meindex ,szNg, CHAR_COLORWHITE);
		}else{
			/*     卞  凶卅中桦宁 */
	        CHAR_talkToCli( talkerindex, meindex ,szOk, CHAR_COLORWHITE);
            NPC_DoormanOpenDoor(
                    CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME));
		}

    } else if( strcmp( mode , "titlenothave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "尚在未支援模式。",
                        CHAR_COLORWHITE);
    }
}
コード例 #13
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);
}
コード例 #14
0
ファイル: npc_windowhealer.c プロジェクト: Nurarihyo/smo-sa
/*-------------------------------------
	  端卞覲菁  午竣  毛莢汊今六月午仇欠
---------------------------------------*/
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);
					}
				}
			}
		}
	}

}
コード例 #15
0
/*-----------------------------------------------
 * Äù¤áÀÚ¤é¤ì¤¿»þ¤Î½èÍý
 *----------------------------------------------*/
static void NPC_RoomAdminNew_CloseProc( int meindex)
{
	int     pindex;
	char    buff[256];
	char    pname[32];
	int     failed = TRUE;
	
	/* °ìÈÖ¤ª¶â¤ò¿¤¯»ý¤Ã¤Æ¤¤¤ë¥×¥ì¥¤¥ä¡¼¤òõ¤¹ */
	pindex = NPC_RoomAdminNew_SearchPlayerHasMostMoney( meindex);
	/* ³ºÅö¼Ô¥¢¥ê */
	if( pindex != -1) {
		/* £±²ó¤ÇÈ´¤±¤ë¥ë¡¼¥×¤Ç¤¹ */
		while( 1) {
			char    passwd[9];
			int		doorindex;
			doorindex = NPC_DoorSearchByName( 
							CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM));
			/* ¥Ñ¥¹¥ï¡¼¥É¤òÀ¸À®¤¹¤ë */
			NPC_RoomAdminNew_CreatePasswd( passwd, sizeof( passwd));
			/* ¥Õ¥¡¥¤¥ë¤Ë¤³¤Î¿Í¤Î£Ã£Ä¥­¡¼¡¤¥­¥ã¥é̾¡¤Éô²°Ì¾¡¤¥Ñ¥¹¤ò½ñ¤­¹þ¤à */
			if( NPC_RoomAdminNew_WriteDataFile( meindex, pindex,
							CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM),
												passwd, 1)
				== FALSE) 
			{
				break;
			}
			/* ¥É¥¢¤Ë¥Ñ¥¹¤ò¥»¥Ã¥È */
			if( NPC_DoorSetPasswd( doorindex, passwd) == -1 ) {
				break;
			}
			/* Í­¸ú´ü¸Â¤ò¥»¥Ã¥È */
			CHAR_setWorkInt( doorindex, CHAR_WORKDOOREXPIRETIME, 
							CHAR_getWorkInt( meindex, CHAR_WORKINT_NEXTTIME)
							+ NPC_ROOMADMINNEW_2WEEK);
			/* Í¼Ô¥é¥ó¥­¥ó¥°¥Á¥§¥Ã¥¯¡õ¥Õ¥¡¥¤¥ë½ñ¤­¹þ¤ß */
			NPC_RoomAdminNew_WriteScoreFile( meindex, pindex);

			CHAR_setInt( pindex, CHAR_GOLD, 0);

			CHAR_send_P_StatusString( pindex , CHAR_P_STRING_GOLD);
			
			/* ¤ª¤á¤Ç¤È¤¦¡ª¥á¥Ã¥»¡¼¥¸ */
			strcpy( pname, CHAR_getChar( pindex, CHAR_NAME));
			snprintf( buff, sizeof(buff), 
						NPC_ROOMADMINNEW_MSG_CONGRATULATION, pname, pname, pname);
			failed = FALSE;
			break;
		}
	}
	
	/* ³ºÅö¼Ô¥Ê¥·¤Þ¤¿¤Ï½èÍý¼ºÇԤλþ */
	if( failed) {
		/* ¥Õ¥¡¥¤¥ë¤«¤é¤³¤ÎÉô²°¤Î¾ðÊó¤ò¾Ã¤¹ */
		NPC_RoomAdminNew_WriteDataFile( meindex, -1,
					CHAR_getWorkChar( meindex, CHAR_WORKCHAR_NEXTROOM),
										NULL, 0);
		/* ³ºÅö¼Ô¤Ï¤¤¤Þ¤»¤ó¥á¥Ã¥»¡¼¥¸ */
		snprintf( buff, sizeof(buff), 
				NPC_ROOMADMINNEW_MSG_NONE);
	}
	/* ¤³¤Î¥Õ¥í¥¢¤Ë¤¤¤ë¿ÍÁ´°÷¤ËÁ÷¿® */
	NPC_RoomAdminNew_SendMsgThisFloor( meindex, buff);
	
	/* ¼¡¤Îʪ·ï¤È¥ª¡¼¥¯¥·¥ç¥ó³«ºÅ»þ´Ö¤ò¥»¥Ã¥È */
	NPC_RoomAdminNew_SetNextAuction( meindex);
	
}
コード例 #16
0
ファイル: npc_doorman.c プロジェクト: ChowZenki/SMO-Sa-Source
void NPC_DoormanTalked( int meindex , int talkerindex , char *msg ,
                     int color )
{
    char mode[128];
    char opt[256];
    char	arg1[NPC_UTIL_GETARGSTR_BUFSIZE];
    char *arg;

    /* ¥×¥ì¥¤¥ä¡¼¤¬¥É¥¢¥Þ¥ó¤Î1¥°¥ê¥Ã¥É°Ê  ¤Ê¤é¤Ï¤ó¤Î¤¦ */
    if(NPC_Util_CharDistance( talkerindex, meindex ) > 1)return;

	arg = NPC_Util_GetArgStr( meindex, arg1, sizeof( arg1));

    if( !getStringFromIndexWithDelim( arg, "|", 1, mode, sizeof( mode )))
        return;

    if( !getStringFromIndexWithDelim( arg, "|", 2, opt, sizeof( opt ) ))
        return;

    if( strcmp( mode , "gold" ) == 0 ){
        int g = atoi( opt );
        int yn = NPC_Util_YN( msg );
        /*char *nm = CHAR_getChar( meindex , CHAR_NAME );*/
        char msg[256];

        if( g > 0 && yn < 0 ){
            snprintf( msg ,sizeof( msg ) ,
                      "¥´¶}ªù»Ý­nµ¹§Ú%dªºª÷¤l³o¼Ë¥i¥H¶Ü¡H", g );
            CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
        } else if( g > 0 && yn == 0 ){
            snprintf( msg , sizeof( msg ),
                      "¥´¶}ªù %dªºª÷¤l¬O¥²­nªº¡C", g );
        } else if( g > 0 && yn == 1 ){
            int now_g = CHAR_getInt( talkerindex, CHAR_GOLD );
            if( now_g < g ){
                snprintf( msg , sizeof( msg ) ,
                          "¥´¶}ªù %dªºª÷¤l¬O¥²­nªº¡C", g );
            	CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );
            } else {
                snprintf( msg , sizeof( msg ),
                          "%d ¦¬¨ìª÷¤l¤F¡C²{¦b´N¨Ó¶}ªù¡C", g );
            	CHAR_talkToCli( talkerindex, meindex , msg, CHAR_COLORWHITE );

                /* ¶³¶â¤ò¥²¥Ã¥È */
                now_g -= g;
                CHAR_setInt( talkerindex , CHAR_GOLD , now_g );
                /* ¤¢¤¿¤é¤·¤¤¥¹  ¡¼¥¿¥¹¤òÁ÷¿® */
                CHAR_send_P_StatusString(talkerindex, CHAR_P_STRING_GOLD);

                /* ¥É¥¢¤Ò¤é¤¯ */
                NPC_DoormanOpenDoor(
                    CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME));
            }
        }
    } else if( strcmp( mode , "item" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemhave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "itemnothave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    } else if( strcmp( mode , "titlehave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);

    } else if( strcmp( mode , "roomlimit" ) == 0 ){

		/*   ²°¤Î¿Í¿ôÀ©¸Â¤¬¤¢¤ë¾ì¹ç */
		char szOk[256], szNg[256], szBuf[32];
		int checkfloor;
		int maxnum, i, iNum;

	    if( !getStringFromIndexWithDelim( arg, "|", 2, szBuf, sizeof( szBuf ) ))
    	    return;

		/* Ä´¤Ù¤ë¥Õ¤Ò¥¢¤È    ¿Í¿ô */
		if( sscanf( szBuf, "%d:%d", &checkfloor, &maxnum ) != 2 ){
			return;
		}

		for( iNum = 0,i = 0; i < getFdnum(); i ++ ){
			/* ¥×¥ì¥¤¥ä¡¼°Ê³°¤Ë¤Ï¶½  ¤¬  ¤¤ */
			if( CHAR_getCharUse( i ) == FALSE )continue;
			if( CHAR_getInt( i, CHAR_WHICHTYPE ) != CHAR_TYPEPLAYER )continue;
			/* »ØÄê¤Î¥Õ¤Ò¥¢°Ê³°¤Ë¶½  ¤¬  ¤¤ */
			if( CHAR_getInt( i, CHAR_FLOOR ) != checkfloor )continue;
			iNum++;
		}
	    if( !getStringFromIndexWithDelim( arg, "|", 5, szNg, sizeof( szNg ))){
   			strcpy( szNg, "¡C¡C¡C¡C" );	/* »ñ³Ê¤Ê¤·¤Î¥»¥ê¥Õ */
		}
    	if( !getStringFromIndexWithDelim( arg, "|", 4, szOk, sizeof( szOk ))){
   			strcpy( szOk, "¶}ªù§a¡C¡C¡C" );	/* »ñ³Ê¤¢¤ê¤Î¥»¥ê¥Õ */
   		}

		if( iNum >= maxnum ){
			/*     ¤òĶ¤¨¤Æ¤¤¤ë¾ì¹ç */
	        CHAR_talkToCli( talkerindex, meindex ,szNg, CHAR_COLORWHITE);
		}else{
			/*     ¤Ë  ¤¿¤Ê¤¤¾ì¹ç */
	        CHAR_talkToCli( talkerindex, meindex ,szOk, CHAR_COLORWHITE);
            NPC_DoormanOpenDoor(
                    CHAR_getWorkChar( meindex, CHAR_WORKDOORMANDOORNAME));
		}

    } else if( strcmp( mode , "titlenothave" ) == 0 ){
        CHAR_talkToCli( talkerindex, meindex ,
                        "©|¦b¥¼¤ä´©¼Ò¦¡¡C",
                        CHAR_COLORWHITE);
    }
}
コード例 #17
0
ファイル: npc_riderman.c プロジェクト: darciusal/stoneagecode
void NPC_RidermanWindowTalked( int meindex, int talkerindex,
                               int seqno, int select, char *data)

{


    int		button = -1;
    char	buf[512];

    if( NPC_Util_CharDistance( talkerindex, meindex ) > 1) return;

    if( !NPC_Riderman_readData( meindex, seqno - 100, FALSE) ) {
        print( "riderman:readdata error\n");
        return;
    }
    /* 瓷仄凶示正件毛譬屯月 */
    if( w.windowtype == WINDOW_MESSAGETYPE_SELECT ) {
        button = atoi( data)+5;
        if( button > 12 ) {
            print( "riderman:invalid button[%d]\n", button);
            return;
        }
    }
    else if( select & WINDOW_BUTTONTYPE_OK) button = 0;
    else if( select & WINDOW_BUTTONTYPE_CANCEL) button = 1;
    else if( select & WINDOW_BUTTONTYPE_YES) button = 2;
    else if( select & WINDOW_BUTTONTYPE_NO) button = 3;
    else if( select & WINDOW_BUTTONTYPE_PREV) button = 4;
    else if( select & WINDOW_BUTTONTYPE_NEXT) button = 5;
    else {
        print( "riderman:invalid button[%d]\n", select);
        return;
    }
    if( buttonproc[button].use == TRUE ) {
        int	fd;
        int	newwin = -1;

        fd = getfdFromCharaIndex( talkerindex);

        if( newwin == -1 ) {
            newwin = buttonproc[button].gotowin;
        }


        //print(" takegold:%d ", w.takegold );

        // Robin
        // 学习 Lv 40
        if( newwin == 6 )	{

            int charImg;
            // int i, petindex, bFind = 0;

            charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER);
            if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) >= 40 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你已经学会初级班了呀。\n不需要再学了。",
                                                    buf, sizeof(buf)));
                return;
            }

            if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold )
            {
                char buf2[512];

                sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物初级班需要%d石币。", w.takegold);
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( buf2, buf, sizeof(buf)));
                return;
            }
            CHAR_DelGold( talkerindex, w.takegold );

            CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 40 );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE );

            //sprintf( buf, "R|L|1" );
            //lssproto_FM_send( fd, buf );
            lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                              WINDOW_BUTTONTYPE_OK, -1, -1,
                              makeEscapeString(
                                  "\n\n恭喜你!你已经完成骑乘初级班了。\n可以骑乘 Lv40 以下的宠物,\n请小心骑乘喔!",
                                  buf, sizeof(buf)));

            // 家族收入
            {
                int fmindex, fmindexi, village, i;
                char fmname[256], token[256], buf2[64];

                sprintf( buf2, "%d", w.takegold/5 );
                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);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 6, token, sizeof(token));
                        strcpy(fmname, token);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 8, token, sizeof(token));
                        fmindexi = atoi(token);
                        saacproto_ACFixFMData_send( acfd, fmname, fmindex, fmindexi,
                                                    FM_FIX_FMGOLD, buf2 , "",
                                                    CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX),
                                                    CONNECT_getFdid(fd) );

                        //print(" rider_fm:%s ", fmname);
                    }
                }
            }

            return;
        }

        // 学习 Lv 80
        if( newwin == 7 )	{

            int charImg;
            // int i, petindex, bFind = 0;


            charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER);
            if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) >= 80 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你已经学会中级班了呀。\n不需要再学了。",
                                                    buf, sizeof(buf)));
                return;
            }
            else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 40 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你必须先学过初级班才能来中级班唷。",
                                                    buf, sizeof(buf)));
                return;
            }

            if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold )
            {
                char buf2[512];

                sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物中级班需要%d石币", w.takegold);
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( buf2, buf, sizeof(buf)));
                return;
            }
            CHAR_DelGold( talkerindex, w.takegold );

            CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 80 );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE );

            //sprintf( buf, "R|L|1" );
            //lssproto_FM_send( fd, buf );
            lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                              WINDOW_BUTTONTYPE_OK, -1, -1,
                              makeEscapeString( "\n\n恭喜你!你已经完成骑乘中级班了。\n可以骑乘 Lv80 以下的宠物,\n请小心骑乘喔!",
                                                buf, sizeof(buf)));

            // 家族收入
            {
                int fmindex, fmindexi, village, i;
                char fmname[256], token[256], buf2[64];

                sprintf( buf2, "%d", w.takegold/5 );
                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);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 6, token, sizeof(token));
                        strcpy(fmname, token);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 8, token, sizeof(token));
                        fmindexi = atoi(token);
                        saacproto_ACFixFMData_send( acfd, fmname, fmindex, fmindexi,
                                                    FM_FIX_FMGOLD, buf2 , "",
                                                    CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX),
                                                    CONNECT_getFdid(fd) );

                        //print(" rider_fm:%s ", fmname);
                    }
                }
            }

            return;
        }

        // 学习 Lv 120
        if( newwin == 8 )	{

            int charImg;
            // int i, petindex, bFind = 0;


            charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER);
            if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) >= 120 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你已经学会高级班了呀。\n不需要再学了。",
                                                    buf, sizeof(buf)));
                return;
            }
            else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 80 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你必须先学过中级班才能来高级班唷。",
                                                    buf, sizeof(buf)));
                return;
            }

            if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold )
            {
                char buf2[512];

                sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物高级班需要%d石币", w.takegold);
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( buf2, buf, sizeof(buf)));
                return;
            }
            CHAR_DelGold( talkerindex, w.takegold );

            CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 120 );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE );

            //sprintf( buf, "R|L|1" );
            //lssproto_FM_send( fd, buf );
            lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                              WINDOW_BUTTONTYPE_OK, -1, -1,
                              makeEscapeString( "\n\n恭喜你!你已经完成骑乘高级班了。\n可以骑乘 Lv120 以下的宠物,\n请小心骑乘喔!",
                                                buf, sizeof(buf)));

            // 家族收入
            {
                int fmindex, fmindexi, village, i;
                char fmname[256], token[256], buf2[64];

                sprintf( buf2, "%d", w.takegold/5 );
                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);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 6, token, sizeof(token));
                        strcpy(fmname, token);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 8, token, sizeof(token));
                        fmindexi = atoi(token);
                        saacproto_ACFixFMData_send( acfd, fmname, fmindex, fmindexi,
                                                    FM_FIX_FMGOLD, buf2 , "",
                                                    CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX),
                                                    CONNECT_getFdid(fd) );

                        //print(" rider_fm:%s ", fmname);
                    }
                }
            }

            return;
        }

        // 学习  Lv All
        if( newwin == 9 )	{

            int charImg;
            // int petindex, i, bFind = 0;

            charImg = CHAR_getInt( talkerindex, CHAR_BASEBASEIMAGENUMBER);
            if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) > 199 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你已经学会特级班了呀。\n不需要再学了。",
                                                    buf, sizeof(buf)));
                return;
            }
            else if( CHAR_getInt( talkerindex, CHAR_LEARNRIDE ) < 120 )
            {
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( "\n\n你必须先学过高级班才能来特级班唷。",
                                                    buf, sizeof(buf)));
                return;
            }

            if( CHAR_getInt( talkerindex, CHAR_GOLD ) < w.takegold )
            {
                char buf2[512];

                sprintf( buf2, "\n很抱歉喔!你的学费不足!\n学习骑乘宠物特级班需要%d石币", w.takegold);
                lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                                  WINDOW_BUTTONTYPE_OK, -1, -1,
                                  makeEscapeString( buf2, buf, sizeof(buf)));
                return;
            }
            CHAR_DelGold( talkerindex, w.takegold );

            CHAR_setInt( talkerindex, CHAR_LEARNRIDE, 200 );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD );
            CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_LEARNRIDE );

            //sprintf( buf, "R|L|1" );
            //lssproto_FM_send( fd, buf );
            lssproto_WN_send( fd, WINDOW_MESSAGETYPE_MESSAGE,
                              WINDOW_BUTTONTYPE_OK, -1, -1,
                              makeEscapeString( "\n\n恭喜你!你已经完成骑乘特级班了。\n可以骑乘所有等级的宠物,\n请小心骑乘喔!",
                                                buf, sizeof(buf)));

            // 家族收入
            {
                int fmindex, fmindexi, village, i;
                char fmname[256], token[256], buf2[64];

                sprintf( buf2, "%d", w.takegold/5 );
                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);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 6, token, sizeof(token));
                        strcpy(fmname, token);
                        getStringFromIndexWithDelim(fmpointlist.pointlistarray[i], "|", 8, token, sizeof(token));
                        fmindexi = atoi(token);
                        saacproto_ACFixFMData_send( acfd, fmname, fmindex, fmindexi,
                                                    FM_FIX_FMGOLD, buf2 , "",
                                                    CHAR_getWorkInt(meindex, CHAR_WORKFMCHARINDEX),
                                                    CONNECT_getFdid(fd) );

                        //print(" rider_fm:%s ", fmname);
                    }
                }
            }

            return;
        }

        // 说明 , 列表
        if( newwin == 5 )
        {

            lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SHOWRIDEPET,
                              WINDOW_BUTTONTYPE_OK, -1, -1,
                              "" );
            return;

        }

        if( !NPC_Riderman_readData( meindex, newwin, FALSE) ) {
            print( "riderman:readdata error\n");
            return;
        }

        //fd = getfdFromCharaIndex( talkerindex);
        if( fd != -1 ) {
            lssproto_WN_send( fd, w.windowtype,
                              w.buttontype,
                              w.windowno+100,
                              CHAR_getWorkInt( meindex, CHAR_WORKOBJINDEX),
                              makeEscapeString( w.message, buf, sizeof(buf)));
        }



    }
}
コード例 #18
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;

}
コード例 #19
0
ファイル: npc_newnpcman.c プロジェクト: BlueKarl/gmsv
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);
}
コード例 #20
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;
}
コード例 #21
0
ファイル: npc_bus.c プロジェクト: ChowZenki/SMO-Sa-Source
BOOL NPC_BusCheckJoinParty( int meindex, int charaindex, BOOL msgflg)
{
    //int		fd;
	char	argstr1[NPC_UTIL_GETARGSTR_BUFSIZE];
	char *argstr;
	int		ret;
	argstr = NPC_Util_GetArgStr( meindex, argstr1, sizeof( argstr1));
	/* £±¥°¥ê¥Ã¥É°Ê  ¤Î¤ß */
	if( !NPC_Util_charIsInFrontOfChar( charaindex, meindex, 1 )) return FALSE; 
	/*     ¾è¼Ö¤Ïµñ  ¤¹¤ë */
	if( CHAR_getWorkInt( meindex, NPC_WORK_MODE) != 0 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GETTINGON);
		return FALSE;
	}
	/* ¤Ñ¡¼¤Æ¤£¤À¤Ã¤¿¤é¤À¤á */
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE ) != CHAR_PARTY_NONE) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_NOTPARTY);
		return FALSE;
	}
	/* ¥Ñ¡¼  ¥£¤Î¿Í¿ô¤ò¥Á¥§¥Ã¥¯¤¹¤ë */
	if( CHAR_getEmptyPartyArray( meindex) == -1 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_OVERPARTY);
		return FALSE;
	}
	/* ¥¢¥¤  ¥à¤Î¥Á¥§¥Ã¥¯¤ò¤¹¤ë(¶Ø»ß¥¢¥¤  ¥à) */
	if( !NPC_BusCheckDeniedItem( meindex, charaindex, argstr)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_DENIEDITEM);
		return FALSE;
	}
#ifdef _ITEM_CHECKWARES
	if( CHAR_CheckInItemForWares( charaindex, 0) == FALSE )	{
		CHAR_talkToCli( charaindex, -1, "µLªkÄâ±a³fª«¤W¨®¡C", CHAR_COLORYELLOW);
		return FALSE;
	}
#endif
	/* ¥¢¥¤  ¥à¤Î¥Á¥§¥Ã¥¯¤ò¤¹¤ë(  Í×¥¢¥¤  ¥à) */
	if( !NPC_BusCheckAllowItem( meindex, charaindex, FALSE)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_ALLOWITEM);
		return FALSE;
	}
	/* ¥ì¥Ù¥ë¤Î¥Á¥§¥Ã¥¯¤ò¤¹¤ë */
	if( !NPC_BusCheckLevel( meindex, charaindex, argstr)) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_LEVEL);
		return FALSE;
	}
	/* ¥¤¥Ù¥ó¥È  ¤«¥Á¥§¥Ã¥¯¤¹¤ë */
//	if( CHAR_getInt( charaindex, CHAR_NOWEVENT) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT2) != 0 ||
//		CHAR_getInt( charaindex, CHAR_NOWEVENT3) != 0 )
//	{
//		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_EVENT);
//		return FALSE;
//	}
	/* ¸æ¶â¤Î¥Á¥§¥Ã¥¯¤ò¤¹¤ë  ¶³¶â¤ò¼è¤ë¤Î¤Ç¡f  ½ª¥Á¥§¥Ã¥¯¤Ë¤¹¤ë¤³¤È¡ª   */
	ret = NPC_BusCheckStone( meindex, charaindex, argstr);
	if( ret == -1 ) {
		if( msgflg) NPC_BusSendMsg( meindex, charaindex, NPC_BUS_MSG_GOLD);
		return FALSE;
	}
	if( ret != 0 ) {
		char msgbuf[128];
		/* ¸æ¶â¤ò¤È¤ë */
		CHAR_setInt( charaindex, CHAR_GOLD, 
					CHAR_getInt( charaindex, CHAR_GOLD) - ret);
		/* Á÷¿® */
		CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_GOLD);
		snprintf( msgbuf, sizeof( msgbuf), "¤ä¥I¤F%d Stone¡I", ret);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORYELLOW);
	}
	/* ¥Ñ¡¼  ¥£¤Ë  ¤ë */
	//CHAR_JoinParty_Main( charaindex, meindex);
	
	//fd = getfdFromCharaIndex( charaindex );
	
	//lssproto_PR_send( fd, 1, 1);
	return TRUE;
}
コード例 #22
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;
}
コード例 #23
0
/*-------------------------------------------
¶³¶â  ¤Ã¤Æ¤ë¤«¥Á¥§¥Ã¥¯
°ú¿ô
meindex¡z¡z¡z      ¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
talker¡z¡z¡z¡z¥­¥ã¥é¥¯¥¿¡¼¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
---------------------------------------------*/
BOOL NPC_WindowMoneyCheck(int meindex,int talker,int mode)
{
	int cost=0;
	int level;
	
	level=CHAR_getWorkInt(meindex,CHAR_WORK_LEVEL);
	
	if(mode==1){
		if(level <= CHAR_getInt(talker,CHAR_LV)){
			/*---¶³¶â¤ò³ä¤ê½Ð¤¹---*/
			cost=NPC_WindowCostCheck(meindex,talker);
			/*--¸½ºß¤Ï²¾ÀßÄê---*/
			/*---¶³¶â¤¬Â­¤ê¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯---*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			
			}
			CHAR_DelGold( talker, cost);
		}
	}
	if(mode==2){
		if(level <= CHAR_getInt(talker,CHAR_LV)){
			/*---¶³¶â¤ò³ä¤ê½Ð¤¹---*/
			cost=NPC_WindowCostCheckMp(meindex,talker);
	
			/*--¸½ºß¤Ï²¾ÀßÄê---*/
			/*---¶³¶â¤¬Â­¤ê¤ë¤«¤É¤¦¤«¤Î¥Á¥§¥Ã¥¯---*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			}
			CHAR_DelGold( talker, cost);
		}
	}

	if(mode==3){
		if(level <= CHAR_getInt(talker,CHAR_LV)){

			/*--ÂÑµ×  ¤Î¶³¶â¤Î·×»»--*/
			if( CHAR_getInt(talker,CHAR_HP) <CHAR_getWorkInt( talker, CHAR_WORKMAXHP))
			{
				cost=NPC_WindowCostCheck(meindex,talker);
			}

			/*--µ¤  ¤Î¶³¶â¤Î·×»»--*/
			if( CHAR_getInt(talker,CHAR_MP) < CHAR_getWorkInt( talker, CHAR_WORKMAXMP))
			{
				cost=cost+NPC_WindowCostCheckMp(meindex,talker);
			}
		
			/*--²¾ÀßÄê--*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			}
		
			/*---¶³¶â¤ò¸º¤é¤¹---*/
			CHAR_DelGold( talker, cost);
		}
		
	}
	
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD);

	return TRUE;

}
コード例 #24
0
ファイル: npc_welfare2.c プロジェクト: BlueKarl/gmsv
void NPC_WelfareWindowTalked2( int meindex, int talkerindex, 
		int seqno, int select, char *data)
{
	int skill, i, j;
	int skillID = -1, skillid = -1;
	int ENDEV = -1, NOWEV = -1;
	char buf[64];
	char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
	char msg[512];
	int fd = getfdFromCharaIndex( talkerindex );
	double rate= 1.0;
	int skillarray;
	CHAR_HaveSkill* hskill;
	char err_msg[128] = {0};

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

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

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "ENDEV:", msg, sizeof( msg)) != NULL){
		ENDEV=atof(msg);
	}

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "NOWEV:", msg, sizeof( msg)) != NULL){
		NOWEV=atof(msg);
	}

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "err_msg:", err_msg, sizeof( msg)) == NULL){
		print("GetArgStrErr");
		return;		
	}

	if( ENDEV > 0 ){
		if( NPC_EventCheckFlg( talkerindex, ENDEV ) != TRUE ){
			CHAR_talkToCli( talkerindex, -1, err_msg, CHAR_COLORYELLOW);
			return;
		}
	}else if( NOWEV > 0 ){
		if( NPC_EventCheckFlg( talkerindex, NOWEV ) != TRUE ){
			CHAR_talkToCli( talkerindex, -1, err_msg, CHAR_COLORYELLOW);	
			return;
		}
	}

	makeStringFromEscaped( data);
	getStringFromIndexWithDelim(data,"|",1,buf,sizeof(buf));
	skill=atoi(buf);
	
	// 技能id
	skillid = CHAR_getCharSkill( talkerindex, skill - 1 );	
	skillID = skillid;

	if(skillID <= 0) 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);
	}

	// 不扣钱
	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);

	skillarray = PROFESSION_SKILL_getskillArray( skillID );

	// 检查是否有不能删除的技能
	for( i=0; i<CHAR_SKILLMAXHAVE; i++ ){
		int limit = -1, skillid = -1, skillarray_temp = -1;

		// 技能ID
		skillid = CHAR_getCharSkill( talkerindex, i);
		if( skillid <= 0 ) continue;
	
		skillarray_temp = PROFESSION_SKILL_getskillArray( skillid );

		for( j=0; j<4; j++){
			limit = PROFESSION_SKILL_getInt( skillarray_temp, PROFESSION_SKILL_LIMIT1+j*2 );

			if( limit > 0 && limit == skillID ){
				char token[256] = {0};

				sprintf( token, "需先遗忘%s,才可删除此技能", PROFESSION_SKILL_getChar( skillarray_temp, PROFESSION_SKILL_NAME ) );
				CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW);
				return;
			}
		}
	}

	// 遗忘技能
	{

		int skill_level = -1;
		int count = 0;
		int skill_id[CHAR_SKILLMAXHAVE] = {0};
		int skill_temp[CHAR_SKILLMAXHAVE] = {0};
		
		// 取熟练度
		for( i=0; i<CHAR_SKILLMAXHAVE; i++ ){
			int skillid = -1;

			// 技能ID
			skillid = CHAR_getCharSkill( talkerindex, i);

			// 不储存需遗忘的技能
			if( skillid <= 0 || skillid == skillID ) continue;


			// 技能等级
			hskill = CHAR_getCharHaveSkill( talkerindex, i );
			skill_level = SKILL_getInt( &hskill->skill, SKILL_LEVEL);
			
			skill_id[count] = skillid;
			skill_temp[count] = skill_level;
			count++;
		}

		// 删除所有技能
		CHAR_CHAT_DEBUG_delsk( talkerindex, "all" );

		// 还原技能
		for( i=0; i<count; i++ ){
			PROFESSION_SKILL_ADDSK( talkerindex, skill_id[i], skill_temp[i] );
		}

		CHAR_sendStatusString( talkerindex , "S");
		NPC_Welfare_selectWindow2( meindex, talkerindex,0,-1);
		
	}

	// 传送讯息
	{
		char token[256];
		int next_profession_skill_point = 0;
		
		next_profession_skill_point = CHAR_getInt( talkerindex, PROFESSION_SKILL_POINT ) + 1;			
		CHAR_setInt( talkerindex, PROFESSION_SKILL_POINT, next_profession_skill_point );
		
		memset(token, -1, sizeof(token) );
		sprintf( token, "您遗忘了 %s,剩馀学习点数增加一点"
				,PROFESSION_SKILL_getChar( skillarray, PROFESSION_SKILL_NAME ) );

		CHAR_talkToCli( talkerindex, -1, token, CHAR_COLORYELLOW);
    
		CHAR_sendCToArroundCharacter( CHAR_getWorkInt( talkerindex , CHAR_WORKOBJINDEX ));
	}

}             
コード例 #25
0
ファイル: char_party.c プロジェクト: ChowZenki/SMO-Sa-Source
/*------------------------------------------------------------
 * ¥Ñ¡¼  ¥£¤Ë  ¤í¤¦¤È¤¹¤ë¡e
 ------------------------------------------------------------*/
BOOL CHAR_JoinParty( int charaindex )
{

	int     result = -1;
	int     x,y;
	OBJECT  object;
	int     found = FALSE;
	int     fd;
	int		cnt;
	int	i;
	fd = getfdFromCharaIndex( charaindex );
	if( fd == -1 ) {
		print( "%s : %d err\n", __FILE__, __LINE__);
		return FALSE;
	}
        /* ¼«Ê¬¤¬¥Ñ¡¼  ¥£ÁȤó¤Ç¤¿¤éÂÌ   */
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) {
		lssproto_PR_send( fd, 1, FALSE);
		return FALSE;
	}
	/*   ¤ÎÁ°¤ÎºÂ  ¤ò  ¤ë */
	CHAR_getCoordinationDir( CHAR_getInt( charaindex, CHAR_DIR ) ,
							 CHAR_getInt( charaindex , CHAR_X ),
							 CHAR_getInt( charaindex , CHAR_Y ) ,
							 1 , &x , &y );

	/* ½é´ü²½¤¹¤ë */
	for( i = 0; i < CONNECT_WINDOWBUFSIZE; i ++ ) {
        CONNECT_setJoinpartycharaindex(fd,i,-1);
    }
	cnt = 0;

	/*¼«Ê¬¤Î  ¤ÎÁ°¤Î¥­¥ã¥é¤ò¼è  ¤¹¤ë */
	for( object = MAP_getTopObj( CHAR_getInt( charaindex, CHAR_FLOOR),x,y) ;
		 object ;
		 object = NEXT_OBJECT(object ) )
	{
		int toindex;
		int parray;
		int objindex = GET_OBJINDEX(object);
		int targetindex = -1;
		/* ¥­¥ã¥é¥¯¥¿¡¼¤¸¤ã¤Ê¤¤ */
		if( OBJECT_getType( objindex) != OBJTYPE_CHARA) continue;
		toindex = OBJECT_getIndex( objindex);
	
                // shan begin
                if( CHAR_getInt(charaindex, CHAR_FMINDEX) > 0 && CHAR_getInt(toindex, CHAR_FMINDEX) >0){
                    for( i = 0; i < FAMILY_FMPKFLOOR; i++){
                        if( fmpkflnum[i].fl == CHAR_getInt( charaindex, CHAR_FLOOR) )
                            if( CHAR_getInt(charaindex, CHAR_FMINDEX) != CHAR_getInt(toindex, CHAR_FMINDEX) ){
                                lssproto_PR_send( fd, 1, FALSE);
                                return FALSE;
                            }
                    }
                }
                // shan end
	
		/* ¥×¥ì¥¤¥ä¡¼¤Î»þ */
		if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){
			found = TRUE;
			/* Áê¼ê¤¬»Ò¤À¤Ã¤¿¤é¿Æ¤ò°ú¤ÃÄ¥¤ê½Ð¤¹ */
			if( CHAR_getWorkInt( toindex, CHAR_WORKPARTYMODE) == CHAR_PARTY_CLIENT ) {
				targetindex = CHAR_getWorkInt( toindex, CHAR_WORKPARTYINDEX1);
				if( !CHAR_CHECKINDEX( targetindex) ) {
					print( " %s:%d err\n", __FILE__, __LINE__);
					continue;
				}
				if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS) {
					continue;
				}
			}
			else {
				targetindex = toindex;
			}
			/*   ¿Æ¤È  £±¬¤°Ê  ¤Ë¤¤¤ë¤« */
			if( NPC_Util_CharDistance( charaindex, targetindex ) > 1) {
				continue;
			}

			/* Àï    ¤Ï¤Ç¤Ê¤¤»ö¡e*/
			if( CHAR_getWorkInt( targetindex, CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE ){
				continue;
			}
			/* Ãç´Öµö²Ä¥â¡¼¥É¤« */
			if( !CHAR_getFlg( targetindex, CHAR_ISPARTY) ) continue;

#ifdef _ANGEL_SUMMON
			if( CHAR_getWorkInt( targetindex, CHAR_WORKANGELMODE) == TRUE) {
				CHAR_talkToCli( charaindex, -1, "¨ÏªÌ¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW);
				continue;
			}
#endif
#ifdef _ESCAPE_RESET // ¨Ï¥Î´cÄ_°k¶]«áx¤ÀÄÁ¤º¤£¥i»P¤H²Õ¶¤
			if( getStayEncount( getfdFromCharaIndex(targetindex) ) ) {
				//print(" ´cÄ_¤¤²Õ¶¤ ");
				if( time(NULL) - CHAR_getWorkInt( targetindex, CHAR_WORKLASTESCAPE) < 5*60 ) {
					//print(" ´cÄ_°k¶]«á²Õ¶¤ ");
					CHAR_talkToCli( charaindex, -1, "¦¹¤H¼È®É¤£¥i¥H·í»â¶¤¡C", CHAR_COLORYELLOW);
					continue;
				}
			}
#endif
		}
		/* ¥Þ¥ó¥â¥¹¥Ð¥¹¤¬¤¤¤ë»þ¤Ï¡f¿Í´Ö¤è¤êÍ¥À褹¤ë¡e */
		else if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) {
			targetindex = toindex;
			cnt = 0;
			if( !NPC_BusCheckJoinParty( toindex, charaindex, TRUE)) {
				/* ¾ò·ï¤ò  ¤¿¤µ¤Ê¤«¤Ã¤¿¡eÃç´Ö  ¤ë¤Î¤Ï½ª¤ï¤ë¡e¿Í´Ö¤Î½è  ¤â¤·¤Ê¤¤¡e
				 * ¤ä¤ä¤³¤·¤¤¤Î¤Ç¡e
				 */
				break;
			}
			{	// Arminius 7.10 Airplane
			  int busimg=CHAR_getInt(toindex, CHAR_BASEIMAGENUMBER);
		          if ((busimg!=100355) && (busimg!=100461)) {
		            CHAR_setInt(charaindex,CHAR_BASEIMAGENUMBER,busimg);
			    CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex ,
				CHAR_WORKOBJINDEX ));
				// Robin debug 01/11/21
				if( CHAR_getInt( charaindex, CHAR_RIDEPET) != -1 ) {
					CHAR_setInt( charaindex, CHAR_RIDEPET, -1);
					CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_RIDEPET);
				}
			/*
			    CHAR_sendPMEToArroundCharacterFLXY(charaindex,
			        CHAR_getInt( charaindex, CHAR_FLOOR),
			        CHAR_getInt( charaindex, CHAR_X),
			        CHAR_getInt( charaindex, CHAR_Y),
			        0,1,CHAR_getInt( charaindex, CHAR_PETMAILEFFECT)
			        );
			*/
		          }
		        }
		}
		/* ¥×¥ì¥¤¥ä¡¼Ëô¤Ï¥Þ¥ó¥â¥¹¥Ð¥¹°Ê³°¤Ï  »ë¤¹¤ë */
		else {
			continue;
		}
		/* Áê¼ê¥Ñ¡¼  ¥£¤Î¿Í¿ô¤Ï    ¤«¡ª */
		parray = CHAR_getEmptyPartyArray( targetindex) ;
		if( parray == -1 ) continue;

		/* ¤³¤³¤Þ¤Ç¤¯¤ì¤Ð     */
        CONNECT_setJoinpartycharaindex( fd,cnt,toindex);
		cnt++;
		if( cnt == CONNECT_WINDOWBUFSIZE ) break;
		
		/* ¥Þ¥ó¥â¥¹¥Ð¥¹  ¸«¤·¤À¤¤¡f¥ë¡¼¥×¤ò  ¤±¤ë¡e */
		if( CHAR_getInt( targetindex, CHAR_WHICHTYPE) == CHAR_TYPEBUS ) break;

	}
	if( cnt == 0 ) {
		if( found == TRUE) {
			CHAR_talkToCli( charaindex, -1, "µLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
		}
		result = FALSE;
	}else if( cnt == 1 ) {
#ifdef _DEATH_CONTEND
		int toindex = CONNECT_getJoinpartycharaindex( fd, 0);
		if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){
		}else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) ||
			CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){

			CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
			result = FALSE;
		}else{
#endif
			CHAR_JoinParty_Main( charaindex, CONNECT_getJoinpartycharaindex(fd,0));
			result = TRUE;
#ifdef _DEATH_CONTEND
		}
#endif
	}else {
		int		strlength;
		char	msgbuf[1024];
		char	escapebuf[2048];
#ifdef _DEATH_CONTEND
		int toindex = CONNECT_getJoinpartycharaindex( fd, 0);
		if(CHAR_getInt(toindex,CHAR_PKLISTTEAMNUM) == -1 && CHAR_getInt(charaindex,CHAR_PKLISTTEAMNUM) == -1){
		}else if( CHAR_getInt( charaindex, CHAR_PKLISTLEADER ) > 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) < 0 ||
			CHAR_getInt( toindex, CHAR_PKLISTTEAMNUM) != CHAR_getInt( charaindex, CHAR_PKLISTTEAMNUM) ||
			CHAR_getInt(toindex,CHAR_WHICHTYPE) != CHAR_TYPEPLAYER){

			CHAR_talkToCli( charaindex, -1, "¶¤¥î¤£¦P¡AµLªk¥[¤J¹Î¶¤¡C", CHAR_COLORYELLOW);
			result = FALSE;
		}
#endif
		strcpy( msgbuf, "1\n©M½Ö²Õ¦¨¹Î¶¤©O¡H\n");
		strlength = strlen( msgbuf);
		for( i = 0;
             CONNECT_getJoinpartycharaindex( fd,i ) != -1
			&& i< CONNECT_WINDOWBUFSIZE;
			i ++ ){
			char	*a = CHAR_getChar(
                CONNECT_getJoinpartycharaindex(fd,i) , CHAR_NAME);
			char	buf[256];
			snprintf( buf, sizeof( buf),"%s\n", a);
			if( strlength + strlen( buf) > arraysizeof( msgbuf)){
				print( "%s:%dµøµ¡°T®§buffer¤£¨¬¡C\n",
						__FILE__,__LINE__);
				break;
			}
			strcpy( &msgbuf[strlength], buf);
			strlength += strlen(buf);
		}
		lssproto_WN_send( fd, WINDOW_MESSAGETYPE_SELECT,
						WINDOW_BUTTONTYPE_CANCEL,
						CHAR_WINDOWTYPE_SELECTPARTY,
						-1,
					makeEscapeString( msgbuf, escapebuf, sizeof(escapebuf)));


	}

	if( result != -1 ) {
		lssproto_PR_send( fd, 1, result);
	}
	return result;
}
コード例 #26
0
BOOL NPC_DepotItem_gettItem( int meindex, int talkerindex, int num)
{
	int emptyindex;
	int itemindex;

	if( !CHAR_CheckDepotItem( talkerindex) ) return FALSE;

	if( (emptyindex=CHAR_findEmptyItemBox( talkerindex)) == -1 ) return FALSE;
	itemindex = CHAR_getDepotItemIndex( talkerindex, num);
	if( !ITEM_CHECKINDEX( itemindex) )return FALSE;
#ifdef _JZ_CF_DELPETITEM
	int ID1,ID2,j;
	ID1 = ITEM_getInt( itemindex, ITEM_ID);
	for( j=0;j<5;j++ ) {
		ID2 = getDelItem(j);
		if(ID2 == 0)break;
		if( ID1 == ID2){
			CHAR_setDepotItemIndex( talkerindex, num, -1);
			LogItem(CHAR_getChar( talkerindex, CHAR_NAME ), //人物名
							CHAR_getChar( talkerindex, CHAR_CDKEY ), //帳號
#ifdef _add_item_log_name  // WON ADD 在item的log中增加item名稱
							itemindex,
#else
      				ITEM_getInt( itemindex, ITEM_ID ),
#endif
							"poolitemshop(CF設置清除物品)",
							CHAR_getInt( talkerindex,CHAR_FLOOR),
							CHAR_getInt( talkerindex,CHAR_X ),
 	     				CHAR_getInt( talkerindex,CHAR_Y ),
           		ITEM_getChar( itemindex, ITEM_UNIQUECODE),
							ITEM_getChar( itemindex, ITEM_NAME),
							ITEM_getInt( itemindex, ITEM_ID)
							);
			CHAR_talkToCli( talkerindex, -1, "系統清除你倉庫裡的道具", CHAR_COLORWHITE );
			return TRUE;
		}
	}
#endif
	CHAR_setDepotItemIndex( talkerindex, num, -1);
	CHAR_setItemIndex( talkerindex, emptyindex, itemindex);
	CHAR_sendItemDataOne( talkerindex, emptyindex);
	
	CHAR_send_P_StatusString( talkerindex, CHAR_P_STRING_GOLD);

	LogItem(
		CHAR_getChar( talkerindex, CHAR_NAME ),
		CHAR_getChar( talkerindex, CHAR_CDKEY ),
#ifdef _add_item_log_name
		itemindex,
#else
		ITEM_getInt( itemindex, ITEM_ID),
#endif
		"Depot(取出道具)",
		CHAR_getInt( talkerindex,CHAR_FLOOR),
		CHAR_getInt( talkerindex,CHAR_X ),
 		CHAR_getInt( talkerindex,CHAR_Y ),
		ITEM_getChar( itemindex, ITEM_UNIQUECODE),
		ITEM_getChar( itemindex, ITEM_NAME),
		ITEM_getInt( itemindex, ITEM_ID) );

	{
		int i, cnt=0;
		int work[CHAR_MAXDEPOTITEMHAVE];
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			work[i] = -1;
		}
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			itemindex = CHAR_getDepotItemIndex( talkerindex, i);
			if( !ITEM_CHECKINDEX( itemindex)) continue;
			work[ cnt++] = itemindex;
		}
		for( i = 0; i < CHAR_MAXDEPOTITEMHAVE; i ++ ) {
			CHAR_setDepotItemIndex( talkerindex, i, work[i]);
		}
	}


	return TRUE;
}
コード例 #27
0
ファイル: npc_windowhealer.c プロジェクト: Nurarihyo/smo-sa
/*-------------------------------------------
雲嗯  勻化月井民尼永弁
婁醒
meindex』』』      及奶件犯永弁旦
talker』』』』平乓仿弁正□及奶件犯永弁旦
---------------------------------------------*/
BOOL NPC_WindowMoneyCheck(int meindex,int talker,int mode)
{
	int cost=0;
	int level;
	
	level=CHAR_getWorkInt(meindex,CHAR_WORK_LEVEL);
	
	if(mode==1){
		if(level <= CHAR_getInt(talker,CHAR_LV)){
			/*---雲嗯毛喃曰請允---*/
			cost=NPC_WindowCostCheck(meindex,talker);
			/*--蜇箕反移澀爛---*/
			/*---雲嗯互簫曰月井升丹井及民尼永弁---*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			
			}
			CHAR_DelGold( talker, cost);
		}
	}
	if(mode==2){
		if(level <= CHAR_getInt(talker,CHAR_LV)){
			/*---雲嗯毛喃曰請允---*/
			cost=NPC_WindowCostCheckMp(meindex,talker);
	
			/*--蜇箕反移澀爛---*/
			/*---雲嗯互簫曰月井升丹井及民尼永弁---*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			}
			CHAR_DelGold( talker, cost);
		}
	}

	if(mode==3){
		if(level <= CHAR_getInt(talker,CHAR_LV)){

			/*--覲菁  及雲嗯及煌遙--*/
			if( CHAR_getInt(talker,CHAR_HP) <CHAR_getWorkInt( talker, CHAR_WORKMAXHP))
			{
				cost=NPC_WindowCostCheck(meindex,talker);
			}

			/*--竣  及雲嗯及煌遙--*/
			if( CHAR_getInt(talker,CHAR_MP) < CHAR_getWorkInt( talker, CHAR_WORKMAXMP))
			{
				cost=cost+NPC_WindowCostCheckMp(meindex,talker);
			}
		
			/*--移澀爛--*/
			if(CHAR_getInt(talker,CHAR_GOLD) < cost){
				return FALSE;
			}
		
			/*---雲嗯毛蛹日允---*/
			CHAR_DelGold( talker, cost);
		}
		
	}
	
	CHAR_send_P_StatusString(talker,CHAR_P_STRING_GOLD);

	return TRUE;

}
コード例 #28
0
ファイル: magic.c プロジェクト: beijunyi/longzoro-sa
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;
}
コード例 #29
0
void NPC_WarpManWindowTalked( int meindex, int talkerindex, 
								int seqno, int select, char *data)
{
	char npcarg[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
	char buf[NPC_UTIL_GETARGSTR_BUFSIZE - 1024 * 20];
#ifdef _NEW_WARPMAN
	BOOL checkp=TRUE;
	char buf1[1024];
	int talkNo = 1;
	BOOL tenflg=FALSE;
#else
	int fl,x,y;
#endif
	char buff2[256];
	int fd = getfdFromCharaIndex( talkerindex );
	if( NPC_Util_CharDistance( talkerindex, meindex ) > 2)
		return;
	if(NPC_Util_GetArgStr( meindex, npcarg, sizeof(npcarg))==NULL){
		print("GetArgStrErr");
		return ;
	}
	if( CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT) < 1 )	{
		CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
		return;
	}

#ifdef _NEW_WARPMAN
	if( seqno == NEW_WARPMAN )    {
		int eqnum=0;
		eqnum = CHAR_getWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT);
		sprintf(buf1,"%s", "NOFREE");
		if( eqnum >= 0 )	{
			sprintf(buf1,"TALKEVENT%d", eqnum);
		}
		CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, 0);
		while( getStringFromIndexWithDelim( npcarg,"OVER",talkNo,buf,sizeof( buf)) != FALSE){
			if( strstr(buf, buf1) != NULL)	{
				strcpy( npcarg , buf);
				tenflg = TRUE;
				break;
			}
			talkNo++;
		}
		if( tenflg == FALSE )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
			return;
		}
	}else {
#endif    
		if( select != WINDOW_BUTTONTYPE_YES )	{
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
			return;
		}
		    if(NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE){
			    NPC_ERR_DiSP( meindex, talkerindex, 1);
			    return;
			}
#ifdef _NEW_WARPMAN	
	}
#else
	NPC_Util_GetStrFromStrWithDelim( npcarg, "WARP", buf, sizeof( buf));
	GetRand_WarpPoint( buf, &fl, &x, &y );
#endif

#ifdef _NEW_WARPMAN	
  switch( seqno)	{
  case WARP_MAN:
	if( select != WINDOW_BUTTONTYPE_YES )
		return;
	    if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE ){
		    NPC_ERR_DiSP( meindex, talkerindex, 1);
		    return;
		}		
#else
	if( select != WINDOW_BUTTONTYPE_YES) return;
	    if( NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE)
		    return;
#endif

#ifdef _NEW_WARPMAN
  break;
  case NEW_WARPMAN:
		if( select != WINDOW_BUTTONTYPE_YES ){
			CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
			if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CancelMsg", buff2, sizeof( buff2) ) != NULL)	{
				CHAR_talkToCli( talkerindex, meindex, buff2, CHAR_COLORYELLOW);
			}
			return;
		}
	  checkp=TRUE;
	  if( NPC_Util_GetStrFromStrWithDelim( npcarg, "CHECKPARTY", buff2, sizeof( buff2) ) != NULL)	{
		  if( strstr( buff2, "FALSE") != NULL )	{
			checkp = FALSE;
		}
	  }
	  if( checkp==TRUE && NPC_PARTY_CHAECK( meindex, talkerindex) == FALSE )	{
		      NPC_ERR_DiSP( meindex, talkerindex, 1);
		      CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
		      return;
	  }		
  break;
  case NEW_WARPMAN_END:
	  return;
  break;
  }
#endif

	if( Action_RunDoEventAction( meindex, talkerindex, npcarg) == FALSE ){
		CHAR_setWorkInt( talkerindex, CHAR_WORKSHOPRELEVANT, -1);
		return;
	}

		CHAR_complianceParameter( talkerindex );
		CHAR_send_P_StatusString( talkerindex ,
						CHAR_P_STRING_ATK|CHAR_P_STRING_DEF|
						CHAR_P_STRING_CHARM|CHAR_P_STRING_QUICK|
						CHAR_P_STRING_WATER|CHAR_P_STRING_FIRE|
						CHAR_P_STRING_WIND|CHAR_P_STRING_EARTH
						);
		if( CHAR_getWorkInt( CONNECT_getCharaindex(fd), CHAR_WORKBATTLEMODE) != BATTLE_CHARMODE_NONE){
	            return ;
		}
		if(CHAR_getWorkInt( talkerindex , CHAR_WORKSHOPRELEVANTTRD) <= 0){
				CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE );
#ifdef _NEW_WARPMAN	
				NPC_WarpMsg( meindex, talkerindex, npcarg);
#else
				if( fl == 0 && x == 0 && y == 0 )		{
				}else	{
					CHAR_warpToSpecificPoint(talkerindex, fl, x,y);
				}
#endif
		}else	{
			if(CHAR_getInt(talkerindex,CHAR_GOLD) <
	                  CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD)){
				NPC_ERR_DiSP( meindex, talkerindex, 2);
				return ;
			}
			CHAR_DelGold( talkerindex, CHAR_getWorkInt(talkerindex,CHAR_WORKSHOPRELEVANTTRD ));

				CHAR_setWorkInt( talkerindex, CHAR_WORKWARPCHECK, FALSE );
#ifdef _NEW_WARPMAN	
				NPC_WarpMsg( meindex, talkerindex, npcarg);
#else
				if( fl == 0 && x == 0 && y == 0 )		{
				}else	{
                        CHAR_warpToSpecificPoint(talkerindex, fl, x,y);
				}
#endif

		}
#ifdef _NEW_WARPMAN
		NPC_NpcWarpMsg( meindex, talkerindex, npcarg);
#else
	}
コード例 #30
0
ファイル: magic.c プロジェクト: Nurarihyo/smo-sa
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;
}