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

}
예제 #3
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);
		}
	}
}
예제 #4
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;
}