Beispiel #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;
}
void CheckItem( short int cn ) // 잘못된 아이템을 가지고 있는지 
{
	bool fResendItem = false;
	CHARLIST *ch = &connections[cn].chrlst;
	if( !ch ) return;

	int a, b, c;
	for( a=0; a<3; a++ )
		for( b=0; b<3; b++ )
			for( c=0; c<8; c++ )
				if( ch->inv[a][b][c].item_no )
				{
					ItemAttr *item = &ch->inv[a][b][c];
					CheckAutoDivideMoney( item, cn ) ;

					int type, num;
					getItemIndex( item->item_no, type, num );
					CItem *t = ItemUnit(type, num);
					if( !t ) 
					{
						memset( item, 0, sizeof( ItemAttr ) );
						continue;
					}
					if( !t->GetItemImage() || !t->GetObjectNumber() ) 
					{
						memset( item, 0, sizeof( ItemAttr ) );
						continue;
					}
				}

	for( c=0; c<8; c++ )
		if( ch->equip[c].item_no )
		{
			ItemAttr *item = &ch->equip[c];
			int type, num;
			getItemIndex( item->item_no, type, num );
			CItem *t = ItemUnit(type, num);
			if( !t ) 
			{
				memset( item, 0, sizeof( ItemAttr ) );
				continue;
			}
			if( !t->GetItemImage() || !t->GetObjectNumber() ) 
			{
				memset( item, 0, sizeof( ItemAttr ) );
				continue;
			}
		}

	for( c=0; c<7; c++ )
		if( ch->quick[c].item_no )
		{
			if(c >= 5)continue;//soto-030514 심볼 아이템은 체크 하지 않는다.

			ItemAttr *item = &ch->quick[c];
			int type, num;
			getItemIndex( item->item_no, type, num );
			CItem *t = ItemUnit(type, num);
			if( !t ) 
			{
				memset( item, 0, sizeof( ItemAttr ) );
				continue;
			}
			if( !t->GetItemImage() || !t->GetObjectNumber() ) 
			{
				memset( item, 0, sizeof( ItemAttr ) );
				continue;
			}
		}
		
	return;
}