Esempio n. 1
0
/*
 * キャラクターがもっているアイテムを1個抹消する。そのアイテムは
 * アイテムIDで指定する。アイテム表を前から検索していって、
 * 最初にヒットしたやつを削除する。
 * 
 * int charindex : キャラクタのindex
 * int itemid : アイテムのID . itemset.txt に記述されている。
 * BOOL net:    ネットワークをするかどうか。TRUEだとする。
 *
 * アイテムをもっていて削除できたら TRUE , 削除できなかったらFALSE
 */
BOOL NPC_Util_RemoveItemByID( int charindex, int itemid, BOOL net )
{
    int i;

    for(i=0;i<CHAR_MAXITEMHAVE;i++){
        int ii = CHAR_getItemIndex( charindex , i);
        if( ITEM_CHECKINDEX(ii)
            && ITEM_getInt( ii, ITEM_ID ) == itemid){
            /* キャラクタがもっているアイテムを*/
            CHAR_setItemIndex( charindex , i , -1 );
            /*
             * そのアイテムを世界から消去する。
             * つまりアイテム表から抹消する
             */
            ITEM_endExistItemsOne( ii );
            /*  両手持ち武器    */
            if( ii == CHAR_ARM1 && CHAR_getItemIndex(charindex,CHAR_ARM2)
                == -2 )
                CHAR_setItemIndex(charindex,CHAR_ARM2,-1);

            if(net)CHAR_sendStatusString( charindex, "I");
            return TRUE;
        }
    }
    return FALSE;
}
Esempio n. 2
0
/*
 * TK¤ÇÁ÷¤ë¤¿¤á¤Î  »ú  ¤ò¤Ä¤¯¤ë¡e
 */
static void NPC_SimpleShopGetEscapedItemString( int shopindex,
                                                int cliindex, char *str )
{
    int i, cost, cl, imageno, itemindex;
    char *itemname;
    char tmp[1024];
    char escapedname[256];
//    char *oli; /* oli means onelineinfo */

    str[0] = '\0';

    /* ¤Þ¤ºÅ¹¤Î  ¤Á  ¤Î¥ê¥¹¥È */
    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( shopindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            itemname = ITEM_getChar( itemindex, ITEM_SECRETNAME );
            makeEscapeString( itemname, escapedname, sizeof(escapedname));
            cost = ITEM_getInt( itemindex, ITEM_COST );
            /* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ  ¤ï¤ë¡e */
            cost *= NPC_Util_buyRate(cliindex);
            cl = ITEM_getInt( itemindex, ITEM_LEVEL );
            imageno = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER );
            //oli =  ITEM_getMemo( itemindex );
#if 0
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|%s",
                      escapedname, cost, cl, imageno, oli );
#endif
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|",
                      escapedname, cost, cl, imageno );
            strcat( str, tmp );
        }
    }

    /* ±­¤Ë¡bµÒ¤Î  ¤Á  ¤Î¥ê¥¹¥È */
    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( cliindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            cost = ITEM_getInt( itemindex, ITEM_COST );
            /* ¶â³Û¤ÎÄ´À°¡eMERCHANTLEVEL¤Ë¤è¤Ã¤Æ  ¤ï¤ë¡e */
            cost *=NPC_Util_sellRate(cliindex);
            snprintf( tmp, sizeof(tmp), "|%d", cost );
            strcat( str, tmp );
        }else{
            /* ¥¢¥¤  ¥à¤ò  ¤Ã¤Æ¤Ê¤¤¾ì½ê¤Ë¤Ï0¤ò¤¤¤ì¤ë     */
            strcat( str, "|0" );
        }
    }

}
Esempio n. 3
0
int NPC_PAGetMyLimtItem(int talker, char *argstr, char* token, int sizes)
{
	char token2[NPC_UTIL_GETARGSTR_LINEMAX];
	int i=1;

	int itemindex;
	int flg=0;
	flg = 0;
	for( i=CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE ; i++ ){

		itemindex = CHAR_getItemIndex( talker , i );
		if( ITEM_CHECKINDEX( itemindex) ){
//==
			char escapedname[256];
			char *eff;
			char name[256];
			int cost = ITEM_getInt( itemindex, ITEM_COST);
			//int rate = 1;
			//cost = (int)(cost * rate);
			strcpy( escapedname, ITEM_getChar( itemindex, ITEM_SECRETNAME));
			makeEscapeString( escapedname, name, sizeof( name));
			eff=ITEM_getChar(itemindex, ITEM_EFFECTSTRING);
			makeEscapeString( eff, escapedname, sizeof(escapedname));
			sprintf(token2,"%s|%d|%d|%d|%s|%d|",
					name, flg, cost, ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
					escapedname, i
			);
//==
			strncat( token, token2, sizeof( token2));
		}
	}
	return 1;
}
Esempio n. 4
0
//»¹Ô­ÌúǹÈþ¶Ñµþ
void NPC_reCheckItemPilenum( int meindex, int toindex)
{
	int i, itemindex;
	for( i=0; i<CHAR_MAXITEMHAVE; i++){
		itemindex = CHAR_getItemIndex( toindex , i );
		if( !ITEM_CHECKINDEX( itemindex) ) continue;//ITEM_USEPILENUMS
		if( ITEM_getInt( itemindex, ITEM_ID) != 20284 ) continue;
		if( ITEM_getInt( itemindex, ITEM_CANBEPILE) != 1 ) continue;

		if( ITEM_getInt( itemindex, ITEM_USEPILENUMS) > 1 ){
			int itemID, pilenum=1, newindex;
			itemID = ITEM_getInt( itemindex, ITEM_ID);
			if( !ITEM_CHECKITEMTABLE( itemID) ) continue;
			pilenum = ITEM_getInt( itemindex, ITEM_USEPILENUMS);
			while( pilenum > 1 ){
				int ti = CHAR_findEmptyItemBox( toindex);
				if( ti == -1 ){
					CHAR_sendItemDataOne( toindex, i);
					CHAR_talkToCli( toindex, -1, "µÀ¾ßÀ¸Î»ÒÑÂú¡£", CHAR_COLORYELLOW);
					return;
				}
				newindex = ITEM_makeItemAndRegist( itemID);
				if( !ITEM_CHECKINDEX( newindex) ) break;
				CHAR_setItemIndex( toindex , ti, newindex);
				CHAR_sendItemDataOne( toindex, ti);
				pilenum--;
				ITEM_setInt( itemindex, ITEM_USEPILENUMS, pilenum);
			}
			if( ITEM_getInt( itemindex, ITEM_CANBEPILE) != ITEMTBL_getInt( itemID, ITEM_CANBEPILE) )
				ITEM_setInt( itemindex, ITEM_CANBEPILE, ITEMTBL_getInt( itemID, ITEM_CANBEPILE) );
			CHAR_sendItemDataOne( toindex, i);
		}
	}
	CHAR_talkToCli( toindex, -1, "ÌúǹÈþ´¦ÀíÍê±Ï¡£", CHAR_COLORYELLOW);
}
void ITEM_contract( int charaindex, int toindex, int haveitemindex)
{
	int itemindex;
	int conindex;
	char data[2048+1024];
	
	if( !CHAR_CHECKINDEX( charaindex ) )  return;

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

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

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

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

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

}
Esempio n. 6
0
int BATTLE_ItemUseDelete(
	int charaindex,
	int haveitemindex
)
{
	int itemindex;

    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0;
	{
		LogItem(
			CHAR_getChar( charaindex, CHAR_NAME ),
			CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name  // WON ADD ¦bitemªºlog¤¤¼W¥[item¦WºÙ
			itemindex,
#else
       		ITEM_getInt( itemindex, ITEM_ID ),
#endif
			"BattleUse(¾Ô°«¤¤¨Ï¥Î±¼ªº¹D¨ã)",
	       	CHAR_getInt( charaindex,CHAR_FLOOR),
			CHAR_getInt( charaindex,CHAR_X ),
        	CHAR_getInt( charaindex,CHAR_Y ),
			ITEM_getChar( itemindex, ITEM_UNIQUECODE),
					ITEM_getChar( itemindex, ITEM_NAME),
					ITEM_getInt( itemindex, ITEM_ID)
		);
	}
	CHAR_DelItemMess( charaindex, haveitemindex, 0);

	return 0;
}
Esempio n. 7
0
/**************************************
 * ϶�ý�ľ��ʧ��  ةë  �Ȼ����¾�������������
 *   �Ȼ������շֻ�
 **************************************/
static BOOL NPC_BusCheckDeniedItem( int meindex, int charaindex, char *argstr)
{
	char	buf[1024];
	BOOL	found = TRUE;

	if( NPC_Util_GetStrFromStrWithDelim( argstr, "denieditem", buf, sizeof( buf))
		!= NULL ) 
	{
		int	i;
		int ret;
		for( i = 1; ; i ++) {
			int itemid;
			char buf2[64];
			int j;
			ret = getStringFromIndexWithDelim( buf, ",", i, buf2, sizeof(buf2));
			if( ret == FALSE ) break;
			itemid = atoi( buf2);
			for( j = 0; j < CHAR_MAXITEMHAVE; j ++) {
				int itemindex = CHAR_getItemIndex( charaindex, j);
				if( ITEM_CHECKINDEX( itemindex)) {
					if( ITEM_getInt( itemindex, ITEM_ID) == itemid) {
						found = FALSE;
						break;
					}
				}
			}
		}
	}
	return found;
}
Esempio n. 8
0
static BOOL NPC_SimpleShopProcessBuyMsg(char *msg, int shopindex,
                                        int playerindex )
{
    int shopwindowindex, itemtableindex,itemind;
    int price, tmpgold;
    char buf[64];

    if(!CHAR_CHECKINDEX(shopindex)||!CHAR_CHECKINDEX(playerindex))
        return -1;

    if( !getStringFromIndexWithDelim( msg,"|",4,buf,sizeof(buf) )){
        return -1;
    }
    shopwindowindex = atoi(buf);
    itemtableindex=NPC_ShopWindowIndexToItemTableIndex( shopindex, shopwindowindex );
    itemind = CHAR_getItemIndex(shopindex,itemtableindex );
    if( ! ITEM_CHECKINDEX(itemind) ) return -1;
    price = ITEM_getInt( itemind, ITEM_COST )
        * NPC_Util_buyRate(playerindex);

    tmpgold = CHAR_getInt(playerindex,CHAR_GOLD);
    if( tmpgold < price ){
        return -2;
    }

    if( ! NPC_Util_moveItemToChar(playerindex,itemind,TRUE ) ){
        return -3;
    }
	CHAR_AddGold( playerindex, price );

    CHAR_sendStatusString( playerindex , "P");
    return 1;
}
Esempio n. 9
0
int BATTLE_ItemUseDelete(
	int charaindex,
	int haveitemindex
)
{
	int itemindex;

    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0;
	{
		LogItem(
			CHAR_getChar( charaindex, CHAR_NAME ),
			CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name  // WON ADD ��item��log������item����
			itemindex,
#else
       		ITEM_getInt( itemindex, ITEM_ID ),
#endif
			"BattleUse(ս����ʹ�õ��ĵ���)",
	       	CHAR_getInt( charaindex,CHAR_FLOOR),
			CHAR_getInt( charaindex,CHAR_X ),
        	CHAR_getInt( charaindex,CHAR_Y ),
			ITEM_getChar( itemindex, ITEM_UNIQUECODE),
					ITEM_getChar( itemindex, ITEM_NAME),
					ITEM_getInt( itemindex, ITEM_ID)
		);
	}
	CHAR_DelItemMess( charaindex, haveitemindex, 0);

	return 0;
}
Esempio n. 10
0
//--------------------------------------------------------------
//  ¥Õ¥£¡¼¥ë¥É°À­  ¹¹¥¢¥¤  ¥à¤ò»È¤Ã¤¿¾ì¹ç¤Î½è  
//--------------------------------------------------------------
// Àï    ¤Î¾ì¹ç
void ITEM_useFieldChange_Battle(
	int charaindex, 	// »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
	int toNo, 			// »È¤ï¤ì¤ë¿Í¤Î  ¹æ
	int haveitemindex 	// »È¤¦¿Í¤Î¥¢¥¤  ¥à¤Î    ¹æ
)
{
	int itemindex;
	char *pArg;

	// ¥¢¥¤  ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- ¤³¤³¤«¤é½è   -----------
	// ¥Ñ¥é¥á¡¼¥¿¤ò¼è  
	pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	// ¥Ñ¥é¥á¡¼¥¿  ¤¤¤Î¤Ç¼º  
	if( pArg == NULL )return ;

	BATTLE_FieldAttChange( charaindex, pArg );

	// Àï    ¤Ë¥¢¥¤  ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦ÄÌ½è  
	BATTLE_ItemUseDelete( charaindex, haveitemindex );

}
Esempio n. 11
0
static void NPC_PoolItemShop_MakeItemString_Pool( int meindex, int talkerindex, 
								char *retstring,int retstringlen)
{
	int		i;
	int		itemindex;
	int		pos = 0;
	char	buff[1024];
		
	retstring[0] = '\0';
	for( i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++ ) {
		itemindex = CHAR_getItemIndex( talkerindex, i);
		if( ITEM_CHECKINDEX( itemindex)) {
			int poolflg = FALSE;
			if( ITEM_getInt( itemindex, ITEM_DROPATLOGOUT) || 
				ITEM_getInt( itemindex, ITEM_VANISHATDROP) ||
				!ITEM_getInt( itemindex, ITEM_CANPETMAIL)){
				poolflg = TRUE;
			}
			snprintf( buff, sizeof( buff), 
						"%s|%d|%d|%d|%s|%d|",
						ITEM_getChar( itemindex, ITEM_SECRETNAME),
						poolflg,CHAR_getWorkInt( meindex, NPC_WORK_COST),
						ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
						ITEM_getChar( itemindex, ITEM_EFFECTSTRING),
						i + 1 );
			if( pos +strlen( buff)>= retstringlen) {
				fprint( "buffer over err\n");
				break;
			}
			strcpy( &retstring[pos], buff);
			pos += strlen( buff);
		}
	}
}
Esempio n. 12
0
BOOL NPCEnemy_WarpManReduce(int meindex,int talker,char *buf)
{

	char buf2[512];
	char buf3[256];
	int id=0;
	int i;
	int itemindex;
	int itemno;
	int kosuu;
	int cnt=0;
	
	getStringFromIndexWithDelim(buf,"=",2,buf2,sizeof(buf2));
	getStringFromIndexWithDelim(buf2,"*",1,buf3,sizeof(buf3));
	itemno = atoi(buf3);
	getStringFromIndexWithDelim(buf2,"*",2,buf3,sizeof(buf3));
	kosuu = atoi(buf3);
	
	for( i=0 ; i < CHAR_MAXITEMHAVE;i++ ){
		itemindex=CHAR_getItemIndex( talker , i );
		if( ITEM_CHECKINDEX(itemindex) ){
			id=ITEM_getInt(itemindex ,ITEM_ID );
			if(itemno==id){
				cnt++;
				if(cnt==kosuu){
					return TRUE;
				}
			}
		}
	}

	return FALSE;

}
Esempio n. 13
0
BOOL NPC_QuizItemFullCheck(int meindex,int talker)
{
    int i;
    int itemindex;
    char argstr[NPC_UTIL_GETARGSTR_BUFSIZE];
    char buf2[32];


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

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

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

        } else {
            return TRUE;
        }
    }


    return FALSE;

}
Esempio n. 14
0
//--------------------------------------------------------------
//  ����  ��ʧ��  ةë��������������
//--------------------------------------------------------------
// ��    ������
void ITEM_useAttReverse_Battle(
	int charaindex, 	// �������м��̼������͵�
	int toNo, 			// ����ľ���м�  į
	int haveitemindex 	// �����м�ʧ��  ة��    į
)
{
	int itemindex, battleindex, attackNo;


	// ʧ��  ة��ؤ�¾�������
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- �������   -----------
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	// �幻
	BATTLE_MultiAttReverse( battleindex, attackNo, toNo,
		SPR_item3, SPR_kyu );

	// ��    ��ʧ��  ة����������������ɧ��
	BATTLE_ItemUseDelete( charaindex, haveitemindex );


}
Esempio n. 15
0
//--------------------------------------------------------------
//  ��ū����������  ��ʧ��  ةë��������������
//--------------------------------------------------------------
// ��    ������
void ITEM_useFieldChange_Battle(
	int charaindex, 	// �������м��̼������͵�
	int toNo, 			// ����ľ���м�  į
	int haveitemindex 	// �����м�ʧ��  ة��    į
)
{
	int itemindex;
	char *pArg;

	// ʧ��  ة��ؤ�¾�������
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- �������   -----------
	// �ɷ¶�����ë��
	pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	// �ɷ¶�����  �м�ƥ��
	if( pArg == NULL )return ;

	BATTLE_FieldAttChange( charaindex, pArg );

	// ��    ��ʧ��  ة����������������ɧ��
	BATTLE_ItemUseDelete( charaindex, haveitemindex );

}
Esempio n. 16
0
//--------------------------------------------------------------
//  °À­  ž¥¢¥¤  ¥à¤ò»È¤Ã¤¿¾ì¹ç¤Î½è  
//--------------------------------------------------------------
// Àï    ¤Î¾ì¹ç
void ITEM_useAttReverse_Battle(
	int charaindex, 	// »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
	int toNo, 			// »È¤ï¤ì¤ë¿Í¤Î  ¹æ
	int haveitemindex 	// »È¤¦¿Í¤Î¥¢¥¤  ¥à¤Î    ¹æ
)
{
	int itemindex, battleindex, attackNo;


	// ¥¢¥¤  ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- ¤³¤³¤«¤é½è   -----------
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	// Á´°÷
	BATTLE_MultiAttReverse( battleindex, attackNo, toNo,
		SPR_item3, SPR_kyu );

	// Àï    ¤Ë¥¢¥¤  ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦ÄÌ½è  
	BATTLE_ItemUseDelete( charaindex, haveitemindex );


}
Esempio n. 17
0
//--------------------------------------------------------------
//  �ɷ¶�����  ��ʧ��  ةë��������������
//--------------------------------------------------------------
// ��    ������
void ITEM_useParamChange_Battle(
	int charaindex, 	// �������м��̼������͵�
	int toNo, 			// ����ľ���м�  į
	int haveitemindex 	// �����м�ʧ��  ة��    į
)
{
	int i;
	int battleindex, attackNo,itemindex;
	int pow, par = 0;
	int kind = -1;
	char *pszP = NULL, *arg;

	// ʧ��  ة��ؤ�¾�������
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	// �ɷ¶�����ë��
	arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	pszP = arg;
	// ����
	for( ;kind == -1 && pszP[0] != 0; pszP++ ){
		for( i = 1; i < BATTLE_MD_END; i ++ ){
			// ���������������
			if( strncmp( pszP, aszParamChange[i], 2 ) == 0 ){
				kind = i;
				pszP +=2;
				break;
			}
		}
	}
	// ���ئ�м�ƥ��
	if( kind == -1 ) return ;


	if( strstr( pszP, "%" ) ){	// ���������ѻ�ң
		par = 1;
	}

	if( sscanf( pszP, "%d", &pow ) != 1 ){
		// �Ϻ��̼���ؤ���¾�
		pow = 30;
	}

	//------- �������   -----------
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	// �幻
	BATTLE_MultiParamChange( battleindex, attackNo, toNo,
		kind, pow, par, SPR_item3, SPR_hoshi );


	// ��    ��ʧ��  ة����������������ɧ��
	BATTLE_ItemUseDelete( charaindex, haveitemindex );


}
Esempio n. 18
0
//--------------------------------------------------------------
//  ¥Ñ¥é¥á¡¼¥¿  ¹¹¥¢¥¤  ¥à¤ò»È¤Ã¤¿¾ì¹ç¤Î½è  
//--------------------------------------------------------------
// Àï    ¤Î¾ì¹ç
void ITEM_useParamChange_Battle(
	int charaindex, 	// »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
	int toNo, 			// »È¤ï¤ì¤ë¿Í¤Î  ¹æ
	int haveitemindex 	// »È¤¦¿Í¤Î¥¢¥¤  ¥à¤Î    ¹æ
)
{
	int i;
	int battleindex, attackNo,itemindex;
	int pow, par = 0;
	int kind = -1;
	char *pszP = NULL, *arg;

	// ¥¢¥¤  ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	// ¥Ñ¥é¥á¡¼¥¿¤ò¼è  
	arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	pszP = arg;
	// ¸ú²Ì¤ò¼è  
	for( ;kind == -1 && pszP[0] != 0; pszP++ ){
		for( i = 1; i < BATTLE_MD_END; i ++ ){
			// ¸ú²Ì¥Ô¥Ã¥¿¥ê¤«¡ª
			if( strncmp( pszP, aszParamChange[i], 2 ) == 0 ){
				kind = i;
				pszP +=2;
				break;
			}
		}
	}
	// ¸ú²Ì¤Ê¤¤¤Î¤Ç¼º  
	if( kind == -1 ) return ;


	if( strstr( pszP, "%" ) ){	// ¤³¤Î¾ì¹ç¤Ï¡ó·×»»
		par = 1;
	}

	if( sscanf( pszP, "%d", &pow ) != 1 ){
		// ²¿¥Ý¥¤¥ó¥È¤¢¹²¤ë¤«
		pow = 30;
	}

	//------- ¤³¤³¤«¤é½è   -----------
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	// Á´°÷
	BATTLE_MultiParamChange( battleindex, attackNo, toNo,
		kind, pow, par, SPR_item3, SPR_hoshi );


	// Àï    ¤Ë¥¢¥¤  ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦ÄÌ½è  
	BATTLE_ItemUseDelete( charaindex, haveitemindex );


}
Esempio n. 19
0
void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex)
{
	int itemindex,power,vtime;
	//,pindex
	char *p = NULL, *arg;
	char szBuffer[1024]="";

	itemindex = CHAR_getItemIndex(charaindex,haveitemindex);

	// Àˬdª««~
	if(!ITEM_CHECKINDEX(itemindex)) return;
	arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	if( (p = strstr( arg, "¼W" )) != NULL ){
        sscanf( p+2, "%d", &power );
	}
	if( (p = strstr( arg, "¤À" )) != NULL ){
		sscanf( p+2, "%d", &vtime );
	}
	if( p == NULL )return;
#ifdef _ITEM_ADDEXP2 // ´¼ªG®É¶¡¥i¥H²Ö¥[
	{
		int point;
		point = CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXP)
					* (int)(CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME)/60);
		if( point >= 72000) {
			CHAR_talkToCli( charaindex, -1, "´¼¼z¤§ªG²Ö­p®É¶¡¤Î®ÄªG¤w¹F¤W­­¡C", CHAR_COLORYELLOW);
			return;
		}
		point += (power * vtime);
		point = min( point, 72000);
		vtime = (int)(point / power);
#ifdef _LOG_OTHER
		sprintf( szBuffer, "¨Ï¥Î´¼¼z¤§ªG %d\t²Ö¿n®ÄªG= ¤À¼Æ%d ¯à¤O%d¢H ®É¶¡%d¤À ",
				ITEM_getInt( itemindex, ITEM_ID ), point, power, vtime);
		LogOther( 
			CHAR_getChar( charaindex, CHAR_CDKEY),
			CHAR_getChar( charaindex, CHAR_NAME),
			szBuffer );
#endif
		//CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power);
		//CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 );

		//sprintf(szBuffer, "´ú¸Õ°T®§¡G¥Ø«e¤À¼Æ%d ®É¶¡%d¬í¡C", point, vtime*60);
		//CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORRED);
	}
#endif
	CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXP, power);
	CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME,vtime*60 );

	//²M°£¹D¨ã
	BATTLE_ItemUseDelete(charaindex,haveitemindex);
	//sprintf(szBuffer, "¾Ç²ß¸gÅ窺¯à¤O´£¤É¤F%d¢H", power);
	sprintf(szBuffer, "¾Ç²ß¸gÅ窺¯à¤O´£¤É¤F%d¢H¡A®É®Ä³Ñ¾l%d¤ÀÄÁ¡C", power, vtime);
	CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW);

}
Esempio n. 20
0
void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex)
{
	int itemindex,power,vtime;
	//,pindex
	char *p = NULL, *arg;
	char szBuffer[1024]="";

	itemindex = CHAR_getItemIndex(charaindex,haveitemindex);

	// �����Ʒ
	if(!ITEM_CHECKINDEX(itemindex)) return;
	arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	if( (p = strstr( arg, "��" )) != NULL ){
        sscanf( p+2, "%d", &power );
	}
	if( (p = strstr( arg, "��" )) != NULL ){
		sscanf( p+2, "%d", &vtime );
	}
	if( p == NULL )return;
#ifdef _ITEM_ADDEXP2 // �ǹ�ʱ������ۼ�
	{
		int point;
		point = CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXP)
					* (int)(CHAR_getWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME)/60);
		if( point >= 72000) {
			CHAR_talkToCli( charaindex, -1, "�ǻ�֮���ۼ�ʱ�估Ч���Ѵ����ޡ�", CHAR_COLORYELLOW);
			return;
		}
		point += (power * vtime);
		point = min( point, 72000);
		vtime = (int)(point / power);
#ifdef _LOG_OTHER
		sprintf( szBuffer, "ʹ���ǻ�֮�� %d\t�ۻ�Ч��= ����%d ����%d�� ʱ��%d�� ",
				ITEM_getInt( itemindex, ITEM_ID ), point, power, vtime);
		LogOther(
			CHAR_getChar( charaindex, CHAR_CDKEY),
			CHAR_getChar( charaindex, CHAR_NAME),
			szBuffer );
#endif
		//CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power);
		//CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 );

		//sprintf(szBuffer, "����ѶϢ��Ŀǰ����%d ʱ��%d�롣", point, vtime*60);
		//CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORRED);
	}
#endif
	CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXP, power);
	CHAR_setWorkInt( charaindex, CHAR_WORKITEM_ADDEXPTIME,vtime*60 );

	//�������
	BATTLE_ItemUseDelete(charaindex,haveitemindex);
	//sprintf(szBuffer, "ѧϰ���������������%d��", power);
	sprintf(szBuffer, "ѧϰ���������������%d����ʱЧʣ��%d���ӡ�", power, vtime);
	CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW);

}
Esempio n. 21
0
int NPC_Util_countHaveItem( int meindex , int itemid )
{
    int i, count=0, itemindex;
    if( !CHAR_CHECKINDEX(meindex))return -1;
     for( i=0 ; i<CHAR_MAXITEMHAVE ; i++ ){
        itemindex = CHAR_getItemIndex( meindex , i );
        if( !ITEM_CHECKINDEX( itemindex)) continue;
		if( ITEM_getInt( meindex, ITEM_ID) == itemid ) count++;
    }
    return count;
}
Esempio n. 22
0
int MAGIC_GetArrayNo( int charaindex, int haveitemindex)
{
	int		itemindex;
	int		magicid;
	itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( !ITEM_CHECKINDEX( itemindex) ) return FALSE;

	magicid = ITEM_getInt( itemindex, ITEM_MAGICID);

	return magicid;
}
Esempio n. 23
0
static void NPC_SimpleShopSetLeakLevel( int meindex )
{
    int i, itemindex;

    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex(meindex,i);
        if( ITEM_CHECKINDEX(itemindex)){
            ITEM_setInt(itemindex,ITEM_LEAKLEVEL, 1 );
        }
    }
}
Esempio n. 24
0
static BOOL NPC_SimpleShopProcessSellMsg(char *msg, int shopindex,
                                         int playerindex )
{
    int sellwindowindex, itemtableindex,itemind, id;
    int price, tmpgold;
    char buf[64];
    if(!CHAR_CHECKINDEX(shopindex)||!CHAR_CHECKINDEX(playerindex))
        return -1;
    if( !getStringFromIndexWithDelim( msg,"|",4,buf,sizeof(buf) )){
        return -1;
    }
    sellwindowindex = atoi(buf);
    itemtableindex = sellwindowindex + CHAR_STARTITEMARRAY;
    itemind = CHAR_getItemIndex(playerindex,itemtableindex );
    if( ! ITEM_CHECKINDEX(itemind) ) return -1;

    price = ITEM_getInt( itemind, ITEM_COST );

    if( price <= 0 || price > NPC_SIMPLESHOPMAXBUYPRICE ){
        return -2;
    }
    price *= NPC_Util_sellRate(playerindex);

	CHAR_AddGold( playerindex, price );

	CHAR_sendStatusString( playerindex , "P");

    id = ITEM_getInt(itemind,ITEM_ID);
	{
		LogItem(
			CHAR_getChar( playerindex, CHAR_NAME ), /* ƽÅÒ·Â   */
			CHAR_getChar( playerindex, CHAR_CDKEY ),
#ifdef _add_item_log_name  // WON ADD ÔÚitemµÄlogÖÐÔö¼ÓitemÃû³Æ
			itemind,
#else
       		ITEM_getInt( itemind, ITEM_ID ),  /* ʧÄÌ  Ø©  į */
#endif
			"Sell",
			CHAR_getInt( playerindex,CHAR_FLOOR),
			CHAR_getInt( playerindex,CHAR_X ),
 	      	CHAR_getInt( playerindex,CHAR_Y ),
	        ITEM_getChar( itemind, ITEM_UNIQUECODE),
			ITEM_getChar( itemind, ITEM_NAME),
			ITEM_getInt( itemind, ITEM_ID)
		);
	}

    if( ! NPC_Util_moveItemToChar( shopindex,itemind,TRUE ) ){
        return -1;
    }
    NPC_Util_RemoveItemByID(shopindex,id,FALSE);
    return 1;
}
Esempio n. 25
0
static void NPC_SimpleShopGetEscapedItemString( int shopindex,
                                                int cliindex, char *str )
{
    int i, cost, cl, imageno, itemindex;
    char *itemname;
    char tmp[1024];
    char escapedname[256];
//    char *oli; /* oli means onelineinfo */

    str[0] = '\0';

    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( shopindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            itemname = ITEM_getChar( itemindex, ITEM_SECRETNAME );
            makeEscapeString( itemname, escapedname, sizeof(escapedname));
            cost = ITEM_getInt( itemindex, ITEM_COST );
            cost *= NPC_Util_buyRate(cliindex);
            cl = ITEM_getInt( itemindex, ITEM_LEVEL );
            imageno = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER );
            //oli =  ITEM_getMemo( itemindex );
            snprintf( tmp, sizeof(tmp), "|%s|%d|%d|%d|",
                      escapedname, cost, cl, imageno );
            strcat( str, tmp );
        }
    }

    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        itemindex=CHAR_getItemIndex( cliindex , i );
        if( ITEM_CHECKINDEX(itemindex) ){
            cost = ITEM_getInt( itemindex, ITEM_COST );
            cost *=NPC_Util_sellRate(cliindex);
            snprintf( tmp, sizeof(tmp), "|%d", cost );
            strcat( str, tmp );
        }else{
            strcat( str, "|0" );
        }
    }

}
Esempio n. 26
0
int MAGIC_DirectUse(
	int charaindex,
	int magicid,
	int toindex,
	int itemnum
)
{
	MAGIC_CALLFUNC func;
	int mp, ret, marray;
	int itemindex=-1;
#ifdef _MAGIC_NOCAST//沉默狀態無法施法
    if( CHAR_getWorkInt( charaindex, CHAR_WORKNOCAST ) > 0 ){
		CHAR_talkToCli(charaindex, -1, "沉默中無法吟唱咒術", CHAR_COLORYELLOW);
		return FALSE;
	}
#endif

	if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){
		itemindex = CHAR_getItemIndex( charaindex, itemnum);
		if( !ITEM_CHECKINDEX( itemindex) ){
			print("ANDY err MAGIC_DirectUse() itemindex:%d !\n", itemindex);
			return FALSE;
		}
	}else{
		itemindex = itemnum;
	}

	marray = MAGIC_getMagicArray( magicid );
	func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME ) );
	if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP )) < 0 ){
	}
        // shan add begin
        if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){
            // 光精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){
                if( (marray >=0 && marray <=31) )
                    mp *= MP_RATE;
            }
            // 暗精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){
                if( marray >=32 && marray <=81 )
                    mp *= MP_RATE;
            }
        }
	if( func ) {
		ret = func( charaindex, toindex, marray, mp );
	}
	else {
		ret = FALSE;
	}
	return ret;
}
Esempio n. 27
0
void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex )
{
	int i;
	int battleindex, attackNo,itemindex;
	char *arg;
	char buf[256];

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

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

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

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

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

			if( NPC_Util_GetStrFromStrWithDelim( arg, ImList[i].fun, buf, sizeof( buf)) == NULL )continue;
			kind = ImList[i].intfun;
			if( getStringFromIndexWithDelim( buf,"x", 1, buf1, sizeof( buf1)) == FALSE ) continue;
			powers = atoi( buf1);
			if( getStringFromIndexWithDelim( buf,"x", 2, buf1, sizeof( buf1)) == FALSE ) continue;
			rounds = atoi( buf1);
			HealedEffect = SPR_hoshi;
			BATTLE_ImprecateRecovery(
				battleindex, attackNo, toNo, kind, powers,
				rounds, SPR_item3, HealedEffect );
			CHAR_setItemIndex(charaindex, haveitemindex ,-1);
			CHAR_sendItemDataOne( charaindex, haveitemindex);
			ITEM_endExistItemsOne( itemindex );
			break;
		}
	}
}
Esempio n. 28
0
static int NPC_SimpleShopGetItemNum( int meindex )
{
    int counter, i;

    counter = 0;
    for( i=CHAR_STARTITEMARRAY;i<CHAR_MAXITEMHAVE;i++ ){
        if( ITEM_CHECKINDEX( CHAR_getItemIndex(meindex,i) ) ){
            counter++;
        }
    }
    return counter;

}
Esempio n. 29
0
//--------------------------------------------------------------
//  ��姾�������ë��������������
//--------------------------------------------------------------
// ��    ������
void ITEM_useRessurect(
	int charaindex, 	// �������м��̼������͵�
	int toNo, 			// ����ľ���м�  į
	int haveitemindex 	// �����м�ʧ��  ة��    į
)
{
	int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
	char *pszP = NULL;


	// ʧ��  ة��ؤ�¾�������
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- �������   -----------
	pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	if( strstr( pszP, "%" ) ){	// ���������ѻ�ң
		par = 1;
	}

	if( sscanf( pszP, "%d", &pow ) != 1 ){
		// �Ϻ��̼����������¾���
		pow = 0;	// �߼��������������
	}

	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	if( pow <= 0 ){
		ReceveEffect = SPR_fukkatu3;
	}else
	if( pow <= 100 ){
		ReceveEffect = SPR_fukkatu1;
	}else
	if( pow <= 300 ){
		ReceveEffect = SPR_fukkatu2;
	}else{
		ReceveEffect = SPR_fukkatu3;
	}

	// �幻
	BATTLE_MultiRessurect( battleindex, attackNo, toNo,
		pow, par, SPR_item3, ReceveEffect );


	// ��    ��ʧ��  ة����������������ɧ��
	BATTLE_ItemUseDelete( charaindex, haveitemindex );

}
Esempio n. 30
0
//--------------------------------------------------------------
//  µ¤À䤫¤éÉü³è¤ò»È¤Ã¤¿¾ì¹ç¤Î½è  
//--------------------------------------------------------------
// Àï    ¤Î¾ì¹ç
void ITEM_useRessurect(
	int charaindex, 	// »È¤Ã¤¿¿Í¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹
	int toNo, 			// »È¤ï¤ì¤ë¿Í¤Î  ¹æ
	int haveitemindex 	// »È¤¦¿Í¤Î¥¢¥¤  ¥à¤Î    ¹æ
)
{
	int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
	char *pszP = NULL;


	// ¥¢¥¤  ¥à¤¬¤¢¤ë¤«¤É¤¦¤«
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;

	//------- ¤³¤³¤«¤é½è   -----------
	pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT );

	if( strstr( pszP, "%" ) ){	// ¤³¤Î¾ì¹ç¤Ï¡ó·×»»
		par = 1;
	}

	if( sscanf( pszP, "%d", &pow ) != 1 ){
		// ²¿¥Ý¥¤¥ó¥È²óÉü¤¹¤ë¤«¡ª
		pow = 0;	// £°¤Î¾ì¹ç¤Ï´°Á´²óÉü
	}

	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );

	attackNo = BATTLE_Index2No( battleindex, charaindex );

	if( pow <= 0 ){
		ReceveEffect = SPR_fukkatu3;
	}else
	if( pow <= 100 ){
		ReceveEffect = SPR_fukkatu1;
	}else
	if( pow <= 300 ){
		ReceveEffect = SPR_fukkatu2;
	}else{
		ReceveEffect = SPR_fukkatu3;
	}

	// Á´°÷
	BATTLE_MultiRessurect( battleindex, attackNo, toNo,
		pow, par, SPR_item3, ReceveEffect );


	// Àï    ¤Ë¥¢¥¤  ¥à¤¬¾Ã¤¨¤¿¾ì¹ç¤Î¶¦ÄÌ½è  
	BATTLE_ItemUseDelete( charaindex, haveitemindex );

}