Esempio n. 1
0
ItemAttr GenerateItem( const int item_no, DWORD dur)
{
	ItemAttr item = {0, };
	CItem *t = ItemUnit( item_no );
	if( !t ) {return item;}
	if(!t->GetItemImage() || !t->GetObjectNumber()){return item;}//오브젝트 이미지 넘버 없으면 지워짐

	item.item_no = item_no;
	
	if( !dur ) 
	{
		item.attr[IATTR_DURATION] = CreateItemDuration( item_no/1000 , item_no%1000 );
	}
	else
	{
		if( t->GetRbutton() == DIVIDE_ITEM ) 
		{
			item.attr[IATTR_DURATION] = dur;
		}
		else 
		{
			item.attr[IATTR_DURATION] = MAKELONG( dur, dur );
		}
	}
	item.attr[IATTR_LIMIT] = g_curr_time;

	return item;
}
DWORD CreateItemDuration( int type, int itemno )
{
	static int bonus = 0;
	
	CItem *t;

	t = ItemUnit( type, itemno );
	if( t == NULL ) return 0;

	DWORD basic_dur;

	if( t->GetRbutton() == DIVIDE_ITEM ) basic_dur = t->GetDuration();
	else basic_dur = MAKELONG( t->GetDuration(), t->GetDuration() );

	return basic_dur;
}
int GetWeight( ItemAttr item )
{
	int type, num;
	getItemIndex( item.item_no, type, num );

	CItem *t = ItemUnit( type, num );
	if( !t ) return 0;

	int weight = t->GetWeight();

	if( t->GetRbutton() == DIVIDE_ITEM )
	{
		int dur = t->GetItemDuration();
		if( dur > 0 ) 
			weight *= item.attr[IATTR_MUCH] / dur;
		else weight *= item.attr[IATTR_MUCH];
	}

	return weight;
}