⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 item.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 3 页
字号:
		}	
	}
	else 
	{
		switch( i->type )
		{
		case ITEMTYPE_DOOR : if( i->Anitype == ITEMANIMATION_CLOSED ) { SendItemDoorOpenClose( i, 0 );	break; }
							 if( i->Anitype == ITEMANIMATION_OPENED ) { SendItemDoorOpenClose( i, 1 );	break; }
				break;
							
//		case ITEMTYPE_BOX  : if( i->Anitype == ITEMANIMATION_CLOSED ) Send_CMD_ITEM_BOX_BREAK( i );	break;
//				break;
		}
	}

//	SendOpenDoor( i->server_id );
}		
		
		
		
	
			
		
//	拳搁俊 免仿窍搁辑 付快胶俊 吧赴巴阑 茫绰促.
void DrawItemList( void )
{			
	LPITEMGROUND t = g_Item;
	static int light;
	static int toggle;
	Spr *s;	
	LPORDERTABLE o;
			
	if( toggle ){	++light;	if( light >= 12 )	toggle = !toggle;	}
	else		{	--light;	if( light <= 0 )	toggle = !toggle;	}
			
			
			
	PathCollisionLineCount = 0; //   辨瘉扁俊 荤侩瞪 酒捞袍狼 面倒扼牢阑 PathCollisionLine[ MAX_ITEM_COLLISION ]俊 葛酒 初绰促.
			
	CursorCheckedItem = NULL;
	while( t != NULL )
	{		
		s = t->spr[t->curframe/2];
		if( s == NULL ) { goto NEXT_; }
			
		if( BoxAndBoxCrash( t->x - s->ox + t->offx, t->y - s->oy + t->offy, s->xl, s->yl, Mapx, Mapy, GAME_SCREEN_XSIZE, GAME_SCREEN_YSIZE ) )
		{	
			o = &g_OrderInfo.order[ g_OrderInfo.count ];
			o->rgb			= 0; // 付快胶俊 狼秦 Check登菌促. 
			
			if( (t->attr[ IATTR_ATTR] & IA2_BOX) && (t->attr[ IATTR_ATTR] & IA2_OPENED ) ) { goto NEXT_OPENED_BOX_; }
			if( t->attr[ IATTR_ATTR] & IA2_TRAPED0 || t->attr[ IATTR_ATTR] & IA2_TRAPED1) 
			{	
				// 父距 见败廉 乐绰 气藕捞唱 担阑 茫阑 锭俊绰 item捞 努腐登绢具 茄促. 
				if( SkillStatus && (SkillNo == 16 || SkillNo == 18 || SkillNo == 5 || SkillNo == 6 ))
				{
					//1019 zhh	//6	Remove Traps //5	Find Traps	//16	Detect Bomb	//18	Remove Bomb										
					if( (CanViewBomb(Hero) && SkillNo == 18 ) || (CanViewTrap(Hero) && SkillNo == 6 ) )//020320 lsw
					{						
					//	CursorCheckedItem = t;
					//	if(o->rgb		!= 1)	o->rgb		= 1;						
					//	if(o->alpha		!= light)	o->alpha	= light;
						goto zoung_;
					}
					//1019 zhh //咯扁鳖瘤
				}
				goto NEXT_OPENED_BOX_; 
			}
zoung_:

			if( g_MouseItemType == 0 ) 
//			if( t->host == Hero->id || t->host == 100000000 ) // 郴波芭唱 林牢捞 绝绰版快.
			{
				int x = t->x-s->ox+t->offx;
				int y = t->y-s->oy+t->offy;

				if( Hero->viewtype == VIEWTYPE_GHOST_ 
					|| !IsDead( Hero ) 
					|| Hero->viewtype == VIEWTYPE_OBSERVE_)
				if( ( (Hero->x-x)*(Hero->x-x) + (Hero->y-y)*(Hero->y-y) < 30000 
					&& !(t->attr[ IATTR_ATTR] & IA2_BOX )) || (t->attr[ IATTR_ATTR] & IA2_BOX ) ) // Box扼搁 酒公府 钢府 乐绢档 急琶瞪荐 乐促. 
				if( ( Hero->viewtype == VIEWTYPE_GHOST_ && ( t->attr[ IATTR_ATTR] & IA2_DOOR ) ) 
					|| Hero->viewtype != VIEWTYPE_GHOST_ )// Ghost惑怕俊辑绰 Item吝 巩父 凯荐 乐促. 
				if( BoxAndDotCrash( x, y, s->xl, s->yl, Mox, Moy ) )
				if( CursorCheckedItem == NULL )
				if( (Hero->canviewitem && (t->attr[ IATTR_ATTR] & IA2_HIDE) ) 
					|| !(t->attr[ IATTR_ATTR] & IA2_HIDE) )
				{
						//if( Distance( Mox, Moy, Hero->x, Hero->y ) < 10000 )
					{	//if( (t->attr[ IATTR_ATTR] & IA2_BOX) == 0 ) 
						CursorCheckedItem = t;
					}
					o->rgb		= 1;
					o->alpha	= light;
					
				}	
			}

NEXT_OPENED_BOX_:

			if( t->attr[ IATTR_ATTR] & IA2_FIRE )	OutputLight( t->x, t->y, 10 );


				
			o->wType		= SPRITETYPE_ITEM; //t->Sorttype;
			o->x			= t->x;
			o->y			= t->y;
			o->height		= 0;
			o->offset		= t->y;
			o->lpvData		= (LPVOID)t;
			o->sort			= 1;
			o->show			= 1;
			
			g_OrderInfo.count++;


			if(  t->type == ITEMTYPE_DOOR )
				if( t->Anitype == ITEMANIMATION_CLOSED ) 
				{
					PathCollisionLine[ PathCollisionLineCount].sx = t->dsx[0];
					PathCollisionLine[ PathCollisionLineCount].sy = t->dsy[0];
					PathCollisionLine[ PathCollisionLineCount].dx = t->ddx[0];
					PathCollisionLine[ PathCollisionLineCount].dy = t->ddy[0];
					PathCollisionLineCount++;
				}
		}			
		else	
		{		
			//	父距俊 AREA观俊 乐促搁 DeleteItemList( t->server_id )龋免秦 滚赴促.
		}		
			
		switch( t->Anitype )
		{	
		case ITEMANIMATION_NO : 
			break;
		case ITEMANIMATION_REPEAT	:	t->curframe ++;
										if( t->curframe / 2 >= t->framecount ) t->curframe = 0;
			break;
		case ITEMANIMATION_RETURN	:	if( t->anitoggle )
										{
											t->curframe ++;
											if( t->curframe / 2 >= t->framecount ) { t->curframe--; t->anitoggle = !t->anitoggle; }
										}
										else 
										{
											t->curframe --;
											if( t->curframe / 2 < 0 ) { t->curframe++; t->anitoggle = !t->anitoggle; }
										}
			break;
		case ITEMANIMATION_OPENNING	:	t->curframe ++;
			 							if( t->curframe /2 >= t->framecount ) { t->curframe = (t->framecount*2) -1; t->Anitype = ITEMANIMATION_OPENED; }
			break;
		case ITEMANIMATION_OPENED	:	t->curframe = (t->framecount*2) -1;
			break;
		case ITEMANIMATION_CLOSING	:	t->curframe --;
			 							if( t->curframe < 0  ) { t->curframe = 0; t->Anitype = ITEMANIMATION_CLOSED; }
			break;
		case ITEMANIMATION_CLOSED	:	t->curframe = 0;
			break;


		case ITEMANIMATION_FARM0	:	t->curframe = 0; break;
		case ITEMANIMATION_FARM1	:	t->curframe = 2; break;
		case ITEMANIMATION_FARM2	:	t->curframe = 4; break;
		case ITEMANIMATION_FARM3	:	t->curframe = 6; break;
		case ITEMANIMATION_FARM4	:	t->curframe = 8; break;
		case ITEMANIMATION_FARM5	:	t->curframe = 10; break;
		case ITEMANIMATION_FARM6	:	t->curframe = 12; break;
		case ITEMANIMATION_FARM7	:	t->curframe = 14; break;

		case ITEMANIMATION_ACTIVE :		// 020701 YGI
		case ITEMANIMATION_FIRE		:	t->curframe ++;
										if( t->curframe / 2 >= t->framecount ) t->curframe = 2;
				break;		
		}	 
NEXT_:        
             
		t = t->next;
	}		 	
	if( CursorCheckedItem )
	{		 
//		PutCompressedImageFX( CursorCheckedItem->x - Mapx, CursorCheckedItem->y-Mapy, &spr[ 415], light, 2 );
	}		 
}			 
////////////////////////////////////////////////////////////////////////////
			 

//  酒捞袍阑 笼绰促.
//  笼菌栏搁 1甫 府畔.
int CheckEventWith_Item( void )
{			  
	if( g_StartMenuOn == TRUE )  return 0;
	if( IsMouseOnMenu() ) return 0;

	int x, y;
	CHARACTER t;
	if( CursorCheckedItem != NULL )
	{		  
		if( SkillStatus == SKILL_OFF )
		if( !(CursorCheckedItem->attr[2] & IA2_NOTMOVE) &&
			CursorCheckedItem->getable )
		{
			if( (TileMap[ Hero->x / TILE_SIZE][ Hero->y / TILE_SIZE].attr_inside ==
				TileMap[ CursorCheckedItem->x / TILE_SIZE][ CursorCheckedItem->y / TILE_SIZE].attr_inside ) )	//  角郴俊 乐芭唱 角寇俊 乐绢具 拱扒阑 凛芭唱 滚副荐 乐促. 
			if( Distance( CursorCheckedItem->x, CursorCheckedItem->y, Hero->x, Hero->y ) < 10000 )
			{	  
				SendTakeItem( CursorCheckedItem->server_id );              
				return 1;
			}			
			else 
			{	
				x = Hero->x;	y = Hero->y;
				int mx, my;

				if( ReturnXYNearPosition( &x, &y, &mx, &my, 64, Hero, CursorCheckedItem->x, CursorCheckedItem->y ) )
				{
					memcpy( &t, Hero, sizeof( CHARACTER ) );
					t.moveFlag = TRUE;
					t.movetype = 0;
					t.gox = x;
					t.goy = y;
					t.destx = mx, t.desty = my;
					if( PathBuild( &t )) 
					{	
						t.moveFlag = FALSE;
						t.gox = x;
						t.goy = y;
						SendMoveData( &t );
					}		
				}		
			}			
		}					
		else				
		{	  
			switch( CursorCheckedItem->type ) 
			{ 
			case ITEMTYPE_COLOSSUS_STONE  :
			case ITEMTYPE_BOX  :	return 0;
//			  			DoHeroAttackBox( int x, int y )
				break;
              
			case ITEMTYPE_DOOR :	
			  			ToggleItemAnimation( CursorCheckedItem );
			  	break;
			} 
		}	  
		return 1;
	}		  
			  
	return 0; 
}			




void DrawObjectItem_SealStone( void )
{
	if( tool_ViewAllCharacter == false ) return;
	if( tool_SkillTool_ITEM_SEAL == false ) return;


	return;



	int i;
	int mxl, myl;
	int px, py;

	mxl = g_Map.file.wWidth  *TILE_SIZE;
	myl = g_Map.file.wHeight *TILE_SIZE;

	for( i = 0 ; i < TotalMapObject ; i ++)
	{
		if( Mo[ i].objectoritem == ITEMTYPE_SEAL_NOR ||
			Mo[ i].objectoritem == ITEMTYPE_SEAL_SPC )
		{
			px = Mo[i].x * RADARXL / mxl;
			py = Mo[i].y * RADARYL / myl;

			Hcolor( 255,255,100 );
			Hprint2( px, py, g_DestBackBuf, lan->OutputMessage(9,10), Mo[ i].dum );//010215 lsw
		}
	}


	return;

	/*

	LPITEMGROUND t = g_Item;
	int mxl, myl;
	int px, py;
	WORD color;
	int sxl, syl;
	static int tog;
	int smx, smy, smxl, smyl;
			
	mxl = g_Map.file.wWidth  * TILE_SIZE;
	myl = g_Map.file.wHeight * TILE_SIZE;
	
	while( t != NULL )
	{		
		if( (t->attr[ IATTR_ATTR] & IA2_SEAL_NOR ) || (t->attr[ IATTR_ATTR] & IA2_SEAL_SPC ) ) 
		{	
			px = t->x * TILE_SIZE * RADARXL / mxl;
			py = t->y * TILE_SIZE * RADARYL / myl;
			Hcolor( 255,255,100 );
			Hprint2( px, py, g_DestBackBuf, "搬%d", t->attr[ IATTR_SEAL_STONE_NO] );
		}
             
		t = t->next;
	}		 	
	*/
}



void CheckTrap( void )
{			
	int x, y;
	static int mx, my;
			
	x = Hero->x;
	y = Hero->y;
	if( mx == x / TILE_SIZE && my == y/ TILE_SIZE ) return ;
	mx = x/ TILE_SIZE, my = y / TILE_SIZE;
			
	LPITEMGROUND  t = g_Item;
			
	while( t != NULL )
	{		
		if( ( t->attr[IATTR_ATTR] & IA2_TRAPED0 ) || 
			( t->attr[IATTR_ATTR] & IA2_TRAPED1 ) )
		if( BoxAndDotCrash( t->x - 16, t->y - 16, TILE_SIZE, TILE_SIZE, x, y ) )
		{	
			if( t->attr[IATTR_ATTR] & IA2_TRAPED0 ) 
			{
				SendCMD_FOOT_ON_TRAP_0_ITEM( t->server_id );
			}
			else if( t->attr[IATTR_ATTR] & IA2_TRAPED1 )
			{
				SendCMD_FOOT_ON_TRAP_1_ITEM( t->server_id );
			}
			
			return;
		}	
			
		t = t->next;
	}		
			
	return;	
}			
			
//extern int aItemInventory[3][3][8];
extern ItemAttr  InvItemAttr[3][3][8];
			
void RecvGiveItem( t_server_give_item *p )
{			
	InvItemAttr[p->p1][p->p2][p->p3]   = p->item;

	//Hero->stolen = true;
}			

	 
void Send_CMD_JUST_ATTACK_ANIMATION( LPITEMGROUND i )
{	
	t_packet p;
	
	p.h.header.type = CMD_JUST_ATTACK_ANIMATION;
		p.u.client_just_attack_animation.item_id = i->server_id;
	p.h.header.size = sizeof( t_client_just_attack_animation );
	
	QueuePacket( &p, 1 );
}


void Send_CMD_ITEM_BOX_BREAK( LPITEMGROUND i )
{	
	t_packet p;
	
	p.h.header.type = CMD_ITEM_BOX_BREAK;
	{
		p.u.client_item_box_break.item_id = i->server_id;
	}
	p.h.header.size = sizeof( t_client_item_box_break );
	
	QueuePacket( &p, 1 );
}	
	
void Recv_CMD_ITEM_BOX_BREAK( t_server_item_box_break *p )
{	
	int ani;
	LPITEMGROUND i = FindItemList( p->item_id );
	if( i == NULL ) return;
	LPCHARACTER ch = ReturnCharacterPoint( p->server_id );
	if( ch == NULL ) return;

	//if( ch != Hero ) 
	{
		ch->nAttackedType	= SPRITETYPE_ITEM;
		ch->lpAttacked		= (VOID *)i;

		ani = AttackAction( ch );

		if( ani == ch->nCurrentAction )	return;
		else  ch->nCurrentAction = ani;
		ChangeDirection( &ch->direction, ch->x, ch->y, i->x, i->y );
		ch->todir = ch->direction;
		ch->nCurrentFrame = 0;
	}

	ch->boxitembreaktype = p->type;
}

void Send_CMD_ITEM_BOX_BREAK_RESULT( int item_id )
{
	t_packet p;

	p.h.header.type = CMD_ITEM_BOX_BREAK_RESULT;
		p.u.client_item_box_break_result.item_id = item_id;
	p.h.header.size = sizeof( t_client_item_box_break_result );

	QueuePacket( &p, 1 );
}

void Send_CMD_ITEM_BOX_MAGIC_BREAK( int item_id )
{
	t_packet p;

	p.h.header.type = CMD_ITEM_BOX_MAGIC_BREAK;
		p.u.client_item_box_magic_break.item_id = item_id;
	p.h.header.size = sizeof( t_client_item_box_magic_break );

	QueuePacket( &p, 1 );
}
void Recv_CMD_ITEM_BOX_MAGIC_BREAK_RESULT( t_server_item_box_magic_break_result *p )
{
	LPITEMGROUND i = FindItemList( p->item_id );
	if( i == NULL ) return;

	if( p->type == 0 ) //  气颇..
	{
		InsertMagic( Hero, Hero, 208,0, i->x, i->y, 0,0 );

	}
	else 
	{

	}
}

void InitItemAttrs()
{
	memset(InvItemAttr		,0,sizeof(ItemAttr)*3*3*8);
	memset(EquipItemAttr	,0,sizeof(ItemAttr)*8);
	memset(QuickItemAttr	,0,sizeof(ItemAttr)*7);
	memset(BankItemAttr		,0,sizeof(ItemAttr)*5*3*6);
	memset(&HandItemAttr	,0,sizeof(ItemAttr));
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -