Ejemplo n.º 1
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;
}
Ejemplo n.º 2
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);
		}
	}
}