Exemplo n.º 1
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;
}
Exemplo n.º 2
0
void NPC_DepotItem_MakeDepotString( int meindex, int talkerindex, char *retstring,int retstringlen)
{
	int		i;
	int		itemindex;
	int		pos = 0;
	char	buff[1024];

	retstring[0] = '\0';
	for( i = 0; i < /*60*/CHAR_MAXDEPOTITEMHAVE; i ++ ) {
		int poolflg = FALSE;
		itemindex = CHAR_getDepotItemIndex( talkerindex, i);
		if( !ITEM_CHECKINDEX( itemindex)) continue;
		snprintf( buff, sizeof( buff),
			"%s|%d|%d|%d|%d|%s|",
			ITEM_getChar( itemindex, ITEM_SECRETNAME),
			poolflg,
			ITEM_getInt( itemindex, ITEM_LEVEL),
			ITEM_getInt( itemindex, ITEM_COST),
			ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
			ITEM_getChar( itemindex, ITEM_EFFECTSTRING)
			);
		if( pos +strlen( buff)>= retstringlen) {
			fprint( "buffer over err\n");
			break;
		}
		strcpy( &retstring[pos], buff);
		pos += strlen( buff);
	}

}
Exemplo n.º 3
0
BOOL NPC_PAItemShop_BuyDo( int meindex, int toindex, char *npcarg, int select)
{
	int ret=-1, ti;
	int itemindex = NPC_PAItemShop_GetItem( select, &ret);
	int cost;
	char token[256];

	if( !ITEM_CHECKINDEX( itemindex) ){
		return FALSE;
	}

	cost=ITEM_getInt( itemindex, ITEM_COST);
	if( CHAR_DelGold( toindex, cost) == 0 ) return FALSE;

	//匯整資料
	saacproto_ACItemAuction_send( acfd, ITEM_getChar( itemindex, ITEM_NAME), "TEST嘿嘿嘿",
		ITEM_getInt( itemindex, ITEM_ID), ret,AUCTION_DEL);

	ti = CHAR_addItemSpecificItemIndex( toindex, itemindex);
	if( !CHAR_CHECKITEMINDEX( toindex, ti) ){
		ITEM_endExistItemsOne( itemindex);
		print ("\n ret error!!");
		return FALSE;
	}
	CHAR_sendItemDataOne( toindex, ti);
	sprintf( token,"拿到%s",ITEM_getChar( itemindex, ITEM_NAME));
	CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);

	return TRUE;
}
Exemplo n.º 4
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;
}
Exemplo n.º 5
0
static void NPC_PoolItemShop_MakeItemString_Draw( int meindex, int talkerindex, 
								char *retstring,int retstringlen)
{
	int		i;
	int		itemindex;
	int		pos = 0;
	char	buff[1024];
		
	retstring[0] = '\0';
	for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) {
		itemindex = CHAR_getPoolItemIndex( talkerindex, i);
		if( ITEM_CHECKINDEX( itemindex)) {
			int poolflg = FALSE;
			snprintf( buff, sizeof( buff),
						"%s|%d|%d|%d|%d|%s|",
						ITEM_getChar( itemindex, ITEM_SECRETNAME),
						poolflg,
						ITEM_getInt( itemindex, ITEM_LEVEL),
						ITEM_getInt( itemindex, ITEM_COST),
						ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER),
						ITEM_getChar( itemindex, ITEM_EFFECTSTRING)
						);
			if( pos +strlen( buff)>= retstringlen) {
				fprint( "buffer over err\n");
				break;
			}
			strcpy( &retstring[pos], buff);
			pos += strlen( buff);
		}
	}
}
Exemplo n.º 6
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);
		}
	}
}
Exemplo n.º 7
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;
}
Exemplo n.º 8
0
void ITEM_contract( int charaindex, int toindex, int haveitemindex)
{
	int itemindex;
	int conindex;
	char data[2048+1024];
	
	if( !CHAR_CHECKINDEX( charaindex ) )  return;

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

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

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

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

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

}
Exemplo n.º 9
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;
}
Exemplo n.º 10
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;
}
Exemplo n.º 11
0
static BOOL NPC_PoolItemShop_DrawItem( int meindex, int talkerindex, int num)
{
	int emptyindex;
	int itemindex;
	int i;
	int cnt;
	int work[CHAR_MAXPOOLITEMHAVE];

	emptyindex = CHAR_findEmptyItemBox( talkerindex);
	if( emptyindex == -1 ) return FALSE;
	
	itemindex = CHAR_getPoolItemIndex( talkerindex, num);
	if( !ITEM_CHECKINDEX( itemindex)) {
		fprint( "err\n");
		return FALSE;
	}
	CHAR_setItemIndex( talkerindex, emptyindex, itemindex);
	CHAR_setPoolItemIndex( talkerindex, num, -1);
	CHAR_sendItemDataOne( talkerindex, emptyindex);
	for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) {
		work[i] = -1;
	}
	cnt = 0;
	for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) {
		itemindex = CHAR_getPoolItemIndex( talkerindex, i);
		if( ITEM_CHECKINDEX( itemindex)) {
			work[ cnt++] = itemindex;
		}
	}
	for( i = 0; i < CHAR_MAXPOOLITEMHAVE; i ++ ) {
		CHAR_setPoolItemIndex( talkerindex, i, work[i]);
	}
	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
		"draw(領取道具)",
		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;
}
Exemplo n.º 12
0
BOOL CHECK_ITEMEQUIT( int toindex)
{
	int i, itemindex;
	char token[256];

	for (i = CHAR_STARTITEMARRAY; i < CHAR_MAXITEMHAVE; i ++) {
		itemindex = CHAR_getItemIndex( toindex, i);
		if( ITEM_getInt( itemindex, ITEM_ID) == 19646 ){
			CHAR_DelItem( toindex, i);
			itemindex = -1;
			itemindex = ITEM_makeItemAndRegist( 1292);
			if( !ITEM_CHECKINDEX( itemindex) ){
			}else{
				int ret = CHAR_addItemSpecificItemIndex( toindex, itemindex);
				if( ret < 0 || ret >= CHAR_MAXITEMHAVE ) {
					ITEM_endExistItemsOne( itemindex);
					continue;
				}
				sprintf( token,"Äõ½%s", ITEM_getChar( itemindex, ITEM_NAME));
				CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW );
				CHAR_sendItemDataOne( toindex, ret);
				continue;
			}
		}
		if( ITEM_getInt( itemindex, ITEM_ID) == 1292 &&
			ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){

			ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0);
			ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0);
			sprintf(token,"ÐÞÕý%sË𻵶È", ITEM_getChar( itemindex, ITEM_NAME));
			CHAR_sendItemDataOne( toindex, i);
			CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
		}
	}	

	// ¼Ä·Åµê
	for (i = 0; i < CHAR_MAXPOOLITEMHAVE; i++) {
		if( ITEM_getInt( itemindex, ITEM_ID) == 1292 &&
			ITEM_getInt( itemindex, ITEM_MAXDAMAGECRUSHE) > 0 ){

			ITEM_setInt( itemindex, ITEM_MAXDAMAGECRUSHE, 0);
			ITEM_setInt( itemindex, ITEM_DAMAGECRUSHE, 0);
			sprintf(token,"ÐÞÕý¼Ä·ÅµêÖÐ%sË𻵶È", ITEM_getChar( itemindex, ITEM_NAME));
			CHAR_talkToCli( toindex, -1, token, CHAR_COLORYELLOW);
		}
	}

	return TRUE;
}
Exemplo n.º 13
0
int NPC_Lua_NLG_GiveItem(lua_State *_NLL)
{
	CheckEx2(_NLL, 2, 3);
	CheckIndexNull(_NLL, 1);
	int TM_Index = (int)lua_tointeger(_NLL, 1);
	int TM_ItemId = (int)lua_tointeger(_NLL, 2);
	int TM_Num = 1;
	int TM_ItemIndex = -1;
	int TM_Int = -1;
	int TM_Count = 0;

	if(lua_gettop(_NLL) == 3)
	{
		TM_Num = (int)lua_tointeger(_NLL, 3);
	}
	int i = 0;
	for(i = 0; i < TM_Num; i++)
	{
		TM_Int = NPC_GiveItem( TM_Index, TM_ItemId);
		if(TM_Int < 0)
		{
			break;
		}
		TM_ItemIndex = TM_Int;
		TM_Count++;
	}
	if(TM_Count > 0)
	{
		char TM_Buff[128];
		snprintf(TM_Buff, sizeof(TM_Buff), "获得 %d 个 %s。", TM_Count, ITEM_getChar( TM_ItemIndex, ITEM_NAME));
		CHAR_talkToCli( TM_Index, -1, TM_Buff, CHAR_COLORYELLOW);
	}
	LRetInt(_NLL, TM_Count);
}
Exemplo n.º 14
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 );

}
Exemplo 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 );

}
Exemplo n.º 16
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;
}
Exemplo 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 );


}
Exemplo 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 );


}
Exemplo n.º 19
0
void ITEM_useMagic_Battle( int charaindex, int toNo, int haveitemindex )
{
	int itemindex,itemmaxuse;
    char *arg=NULL;
    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if(!ITEM_CHECKINDEX(itemindex)) return;
	arg = ITEM_getChar( itemindex, ITEM_ARGUMENT );

	CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo );
	CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_JYUJYUTU );
	CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, atoi(arg) );
	CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, 0 );
	CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK );

	MAGIC_DirectUse(
				charaindex,
				CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ),
				CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ),
				CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 )
	);

	itemmaxuse = ITEM_getInt( itemindex, ITEM_DAMAGEBREAK);
	if( itemmaxuse > 0 )
	    ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, itemmaxuse-1 );
    else{
		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);
	}
}
Exemplo 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);

}
Exemplo n.º 21
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);

}
Exemplo n.º 22
0
void NPC_PAGetItemList( char *argstr, char *token, int sizes)
{
	int i=1, ret=-1;
	char token2[NPC_UTIL_GETARGSTR_BUFSIZE];
	for( i=0; i<MAXAUCTIONs; i++)	{
		int itemindex = -1, cost=0, graNo=0;
		itemindex = NPC_PAItemShop_GetItem( i, &ret);
		if( !ITEM_CHECKINDEX( itemindex) ){
			break;
		}
		cost = ITEM_getInt( itemindex, ITEM_COST);
		graNo = ITEM_getInt( itemindex, ITEM_BASEIMAGENUMBER);

		sprintf( token2, "%s|0|%d|%d|%d|%s|",
			ITEM_getChar( itemindex, ITEM_SECRETNAME), 0/*pAuctionItem[i].level*/, cost,
			graNo, ITEM_getChar(itemindex, ITEM_EFFECTSTRING));
		strncat( token, token2, sizeof(token2));
	}
}
Exemplo n.º 23
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;
}
Exemplo n.º 24
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;
		}
	}
}
Exemplo n.º 25
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 );

}
Exemplo n.º 26
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 );

}
Exemplo n.º 27
0
void NPC_DepotItem_CheckRepeat_Del( int charaindex, int ti, int itemindex)
{
	char token[256];
	sprintf( token, "倉庫道具%s,編碼重複!(系統清除)",
					ITEM_getChar( itemindex, ITEM_NAME));
	CHAR_talkToCli( charaindex, -1, token, CHAR_COLORYELLOW);
	LogItem(
			CHAR_getChar( charaindex, CHAR_NAME ),
			CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name
			itemindex,
#else
			ITEM_getInt( itemindex, ITEM_ID),
#endif
			"repeat(倉庫道具重複)",
			0, 0, 0,
			ITEM_getChar( itemindex, ITEM_UNIQUECODE),
			ITEM_getChar( itemindex, ITEM_NAME),
			ITEM_getInt( itemindex, ITEM_ID) );

	CHAR_setDepotItemIndex( charaindex, ti, -1);
	ITEM_endExistItemsOne( itemindex);
}
Exemplo n.º 28
0
void NPC_DepotItem_CheckRepeat( int talkerindex)
{
	int i, j, cnt=0, itemindex, itemindex1;

	for( i=0; i<(CHAR_MAXDEPOTITEMHAVE-1); i++){
		itemindex = CHAR_getDepotItemIndex( talkerindex, i);
		if( !ITEM_CHECKINDEX( itemindex)) continue;
		cnt=0;
		for( j=(i+1); j<CHAR_MAXDEPOTITEMHAVE; j++ ){
			itemindex1 = CHAR_getDepotItemIndex( talkerindex, j);
			if( itemindex==itemindex1) continue;
			if( !ITEM_CHECKINDEX( itemindex1)) continue;
			if( !strcmp( ITEM_getChar( itemindex, ITEM_UNIQUECODE),
				ITEM_getChar( itemindex1, ITEM_UNIQUECODE) ) ){
				NPC_DepotItem_CheckRepeat_Del( talkerindex, j, itemindex1);
				cnt++;
			}
		}
		if( cnt != 0 ){
			NPC_DepotItem_CheckRepeat_Del( talkerindex, i, itemindex);
		}
	}
}
Exemplo n.º 29
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" );
        }
    }

}
Exemplo n.º 30
0
BOOL NPC_PAItemShop_SellDo( int meindex, int toindex, char *npcarg, int select)
{
	int itemindex = CHAR_getItemIndex( toindex , select );
	if( ITEM_CHECKINDEX( itemindex) ){
		int cost = ITEM_getInt( itemindex, ITEM_COST);
		saacproto_ACItemAuction_send( acfd, ITEM_getChar( itemindex, ITEM_NAME), "TEST嘿嘿嘿",
			ITEM_getInt( itemindex, ITEM_ID), 0/*ret*/,AUCTION_ADD);
		CHAR_DelItem( toindex, select);
		CHAR_AddGold( toindex, cost);	
	}else	{
		CHAR_talkToCli( toindex, -1, "沒有這樣物品!", CHAR_COLORYELLOW);
		return FALSE;
	}
	return TRUE;
}