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

📄 skill.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
					{
						case 0 :	sprintf( temp, lan->OutputMessage(2,182) ); break;
						case 1 :	sprintf( temp, lan->OutputMessage(2,183) );					break;
						default: 	sprintf( temp, lan->OutputMessage(2,184) );							break;
					}
					strcpy( Hero->szChatMessage, temp );
					Hero->ChatDelay = 70;
			}break;	
		}				
  }
	AgainSkill( p->u.server_skill_result.skillno );
}
			
void RecvSkillResultFail( t_server_skill_result_fail *p )
{
	ItemAttr item;
	char temp[ FILENAME_MAX];
	
	StopDoingSkillCursor( Hero );
	
	InsertMagic( Hero, Hero, 250, (rand()%2) + 5, Hero->x, Hero->y, 0, 0);
	PlayListAutoSounds( 2409, 0, 0, 0 );
	
	SkillSettingClear();

/*	switch ( p->why )
	{
		default : 
			{
*/				GameStatusOutput( 1 );	
				if(p->why!=0)
				{
					AddCurrentStatusMessage( 255,255 ,0,  lan->OutputMessage(2,abs(p->why)));//020526 lsw
				}
/*			}
			break;
	}
*/

	skill_fail(p->skillno);

	switch( p->skillno )
	{
	case 21 :	sprintf( temp, lan->OutputMessage(2,405) );
				strcpy( Hero->szChatMessage, temp );
				Hero->ChatDelay = 70;
				AddSkillGauge( SkillNo, 0, 0, 999 );
			break;	

	case 1	:		
	case 25 :		
	case 35 : 	switch( rand()%3)
				{
					case 0 :	sprintf( temp, lan->OutputMessage(2,186) ); break;
					case 1 :	sprintf( temp, lan->OutputMessage(2,187) );	break;
					default: 	sprintf( temp, lan->OutputMessage(2,188) );	break;
				}	
				strcpy( Hero->szChatMessage, temp );
				Hero->ChatDelay = 70;
				SkillSettingClear();
			break;		

	default :	switch( rand()%3 )
				{
				case 0 : 
				case 1 : sprintf( temp, lan->OutputMessage(2,189) );			break;
				case 2 : sprintf( temp, lan->OutputMessage(2,190) );			break;
				}
				strcpy( Hero->szChatMessage, temp );
				Hero->ChatDelay = 70;	
	
				memset( &item, 0, sizeof( ItemAttr ) );
				QuickItemAttr[6]= item;
	
				SkillSettingClear();

		break;
	}
	
	AgainSkill( p->skillno );
}	
	
extern DWORD g_skillmaketime;
void RecvSkillItemMakeResult( t_server_skill_itemmake_result *p )
{									
	ItemAttr item = p->item;	
	
	// 250 己傍.. 
	InsertMagic( Hero, Hero, 250, (rand()%4) + 1, 0,0,Hero->x,	Hero->y, 0,0 );
	PlayListAutoSounds( 2408, 0, 0, 0 );
	CursorNo( 1 );

	QuickItemAttr[6]= item;
	
	nItemOther = MN_ITEM_MAKE_OK;
	
	CItem *t = ItemUnit( item.item_no/1000, item.item_no%1000 );
	if( !t ) return ;
	AddCurrentStatusMessage( 255,255 ,0,  lan->OutputMessage(2,224), t->GetItemHanName(),p->TryItemCount ,p->MakeItemCount );			// 0721 YGI

	if( p->TryItemCount > 1)
	{
	//011025 lsw >
		g_skillmaketime = timeGetTime() + (p->TryItemCount-1)*1500;
	//011025 lsw <
	}
	SkillSettingClear();
}

static DWORD SkillResultFromOtherTime;	// 惯积茄 矫埃.
static int	SkillResultFromOtherDelay;	// 割檬第俊 Message甫 免仿且鳖..
static char SkillResultFromOther_Msg[ MAX_PATH]; // 免仿且 Message..


// 扁贱搬苞甫 Delay饶俊 免仿茄促. 
// 泅力绰 1俺父 扁撅茄促. 
void RecvSkillResultFromOther( t_server_skill_result_toother *tp )
{
	LPCHARACTER ch = ReturnCharacterPoint( tp->id );	// 
	if( ch == NULL ) return;

	switch( tp->skillno )
	{
	case 19 : // stealing
		switch( tp->result )
		{
		case FALSE :
			{
				SkillResultFromOtherTime = g_curr_time;
				SkillResultFromOtherDelay= 5;
				sprintf( SkillResultFromOther_Msg, lan->OutputMessage(2,192), ch->name );
			}break;
		
		case 1 :
			{
				SkillResultFromOtherTime = g_curr_time;
				SkillResultFromOtherDelay= 5;
				sprintf( SkillResultFromOther_Msg, lan->OutputMessage(2,193), ch->name );
			}break;
		}
		break;
	}
}

// 老沥矫埃捞 瘤唱搁 扁撅秦敌 Message甫 免仿茄促. 
void CheckTime_SkillMsg( void )
{
	if( SkillResultFromOtherTime == 0 ) return;

	if( g_curr_time - SkillResultFromOtherTime > SkillResultFromOtherDelay )
	{
		AddCurrentStatusMessage( 255,0,0, SkillResultFromOther_Msg );
		SkillResultFromOtherTime = 0;
	}
}

	
	
extern int before_skill_no;
int SelectSkill( int skillno )
{
	before_skill_no = skillno;			// 官肺 傈窜拌 胶懦阑 历厘秦 滴绊 乐绰促.		// 001120
	if( SkillStatus == SKILL_OFF )
	{
	}
	else 
	{
		//1006 zhh
		return 1;
	}

  if (Hero->nCurrentAction==17) 
	{
		AddCurrentStatusMessage( 255,255,0,lan->OutputMessage(0,343));
		return 1;			// LTS SITDOWN
	}

	//1004 zhh
	if(AmIEquitSkillTool(skillno)==0)
		return(1);

	SkillIcon		= &skill_spr[ skillno];
	SkillStatus		= SKILL_ON;
	SkillNo			= skillno;

	CursorNo( SkillTable[ SkillNo].Curser1 );

	switch(skill[SkillNo].series) //010222 lsw
	{
		case 0:
			AddCurrentStatusMessage( 255,100,255, lan->OutputMessage(2,35) );//郴 扁贱 荤侩 霖厚钦聪促.			
		break;

		case 1:

			AddCurrentStatusMessage( 255,100,255, lan->OutputMessage(2,36) );//郴 努贰胶扁贱 荤侩 霖厚钦聪促.			
		break;
	}


	switch( SkillNo )//  畴啊促啊 鞘夸茄 扁贱俊 措茄 檬扁拳甫 茄促. 
	{
		//  俺埃..
	case 21	://Reclaim
	case 23	://Cultivate
	case 24	://Havest
	case 26	://Mining
	case 32	://Cutting
	case 36	://Digging
			break;

	case 65	: // Snooping
				AddCurrentStatusMessage( 255, 100, 100, lan->OutputMessage(4,100) );//lsw
			break;
	}			
																		
//	CursorSpriteNo( 879 );
	return 0;								
}											
int CheckSkill( void )
{		
	int x,y;
	int dis;
	int mx, my;				
				
	if( IsDead( Hero ) ) return 0;
				
	if( SkillStatus == SKILL_OFF )							return 0;

	static DWORD time = timeGetTime();
	if( SkillStatus == SKILL_ING )
	{
		if( timeGetTime() - time < PACKET_SEND_MINIMUM_TIME*2 ) return 0;		// 010815 YGI
		time = timeGetTime();
	}
	else
	{
		time = timeGetTime();
	}
				
	//1004 zhh
	if(AmIEquitSkillTool(SkillNo)==0)
		return(1);

	if( SkillNo >= MAX_SKILL_ ){ SkillStatus = SKILL_OFF;	return 0;	}
	int ret = false;
				
	if( Moy - Mapy > GAME_SCREEN_YSIZE ) return 0;
				
	x = Hero->x;
	y = Hero->y;
	//010204 lsw

				
	if( Hero->peacests == 1 ) 
	{
		AddCurrentStatusMessage( 255,100,255, lan->OutputMessage(2,194) );
		SetBattlePeace( PEACE_MODE );
	}			
					
	//  呈公 钢府 乐栏搁 弊镑栏肺 捞悼茄促. 
	dis = (Mox-x)*(Mox-x)+(Moy-y)*(Moy-y);  
	
	//1017 zhh
	if( (SkillNo==28 || SkillNo==30) && dis<64*64*8 )
		dis=10;
	
	if( dis > 64 * 64 ) 
	{			
		if( ReturnXYNearPosition( &x, &y, &mx, &my, 64, Hero, Mox, Moy ))
		{		
			Hero->destx = mx, Hero->desty = my;
			if ( PathBuild( Hero ) )
			{	
				if( SysInfo.notconectserver )
				{
					if ( Hero->nCurrentAction != Hero->basicWalk )
					{
						Hero->moveFlag = TRUE;
						Hero->gox = x;
						Hero->goy = y;
						Hero->movetype = 0;
						Hero->nCurrentAction	= Hero->basicWalk;
						Hero->nCurrentFrame		= 0;
					}
				}
				else 
				{
					Hero->moveFlag = FALSE;
					Hero->movetype = 0;
					Hero->gox = x;
					Hero->goy = y;
					SendMoveData( Hero );
				}
			}	
			else
			{	
				ChangeDirection( &Hero->todir, Hero->x, Hero->y, x, y );
			}		
		}		
		else	
		{
			//1024 zhh
			AddCurrentStatusMessage( 0,155,255, lan->OutputMessage(2,195) );
		//	AddCurrentStatusMessage( 0,155,255, "呈公 钢绢 扁贱阑 镜荐 绝嚼聪促." );
			PlayListAutoSounds( 82,0,0,0 ); // 捞悼角菩.
			return 1;
		}		
	}
	

	int targettype = SkillTable[ SkillNo].Howto;
	int target_id = 0;
	int target_item_no = 0;
	char TargetName[31] = {0,};//020531 lsw
	switch( targettype )
	{
	case SKILLTARGETTYPE_TABLE_ :	return 0;
	case SKILLTARGETTYPE_ITEM_	:	if( CursorCheckedItem == NULL ) 
									{
										//1024 zhh
										AddCurrentStatusMessage( 125,100,255, lan->OutputMessage(2,196));
									//	AddCurrentStatusMessage( 125,100,255, "扁贱俊 荤侩瞪 Item阑 努腐窍技夸 .");
										return 0; 
									}
									target_id = CursorCheckedItem->server_id; 
									target_item_no = CursorCheckedItem->no;

									//1005 zhh
									Skill_CursorCheckedItem = CursorCheckedItem;
				break;
	case SKILLTARGETTYPE_CHAR_	:	if( g_GameInfo.lpcharacter == NULL ) 
									{
										//1024 zhh
										AddCurrentStatusMessage( 125,100,255, lan->OutputMessage(2,197) );
									//	AddCurrentStatusMessage( 125,100,255, "扁贱阑 吧 某腐磐甫 努腐窍技夸." );
										return 0;
									}
									target_id = g_GameInfo.lpcharacter->id;
									memcpy(TargetName, g_GameInfo.lpcharacter->name,30);//020531 lsw
				break;

	case SKILLTARGETTYPE_MAP_	:	target_id = 0;   
				
				break;

	case SKILLTARGETTYPE_HERO_	:	if(	g_GameInfo.lpcharacter != Hero ) 
									{
										//1024 zhh
										AddCurrentStatusMessage( 125,100,255, lan->OutputMessage(2,198) );
									//	AddCurrentStatusMessage( 125,100,255, "磊脚俊霸父 荤侩且 荐 乐绰 扁贱涝聪促." );
										return 0;
									}
									target_id = Hero->id; 
				break;

	case SKILLTARGETTYPE_MAP_WITH_ITEM_:  
									if( SkillStatus != SKILL_READY ) 
									{
										return 0;
									}
									SendSkillInfo( SkillNo, Mox, Moy, targettype, SkillItemNo, SkillItemPOS );
				break;
	}
	
	switch( SkillNo )
	{
	case 19  :	if( Hero->id == target_id ) 
				{
					//1024 zhh
					AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,201) );
				//	AddCurrentStatusMessage( 255,255,255, "扁贱甫 磊脚俊霸 荤侩窍看嚼聪促. 寸脚篮 角荐窍咯 芒乔秦 钦聪促." );
					return 1;
				}
				if( target_id < 10000 || g_GameInfo.lpcharacter->eventnpc )//soto-Steal荐沥. 阁胶磐俊辑父 啊瓷窍促.
				{
					//1024 zhh
					AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,202) );
				//	AddCurrentStatusMessage( 255,255,255, "壬摹扁 扁贱篮 Player俊霸父 荤侩且 荐 乐嚼聪促." );
					return 1;
				}
				SendSkillInfo( SkillNo, Mox, Moy, targettype, target_id, target_item_no, TargetName);//020531 lsw
		break;

		// Harvest..
	case 24 :	{
					if( CursorCheckedItem == NULL ) break;

					CItem *t = ItemUnit( CursorCheckedItem->no/1000, CursorCheckedItem->no%1000 );	
					if( t )
					if( t->GetItemKind() == IK_SEED )
					{
						SendSkillInfo( SkillNo, Mox, Moy, targettype, CursorCheckedItem->server_id );
						return 1;	
					}
				}
		break;		
					
	case 28 :   //	超矫.. 
				if( TileMap[ Mox/TILE_SIZE][Moy/ TILE_SIZE].attr_river == 0 ) 
				{	
					//1024 zhh	
					AddCurrentStatusMessage( 255,155,155,lan->OutputMessage(2,203), SkillTable[SkillNo].Skill_Minute );
				//	AddCurrentStatusMessage( 255,155,155,"捞镑篮 绊扁啊 绝绰镑栏肺 '%s'扁贱阑 荤侩且荐 绝嚼聪促.", SkillTable[SkillNo].Skill_Minute );
					goto SKILL_FAIL_;
				}	
				else
				{
					//SendSkillGauge( Mox, Moy, SkillNo );
					SendSkillInfo( SkillNo, Mox, Moy, targettype, target_id );
				}
		break;		
						
	default :	SendSkillInfo( SkillNo, Mox, Moy, targettype, target_id ,target_item_no,TargetName);//020531 lsw
			return 1;	
	}
					
	return ret;		
					
SKILL_FAIL_ :

	return 0;//Skill
}		

typedef struct tagDETECTTILE{	
	short x, y;
	short type;
	WORD color;
	short delay;

	struct tagDETECTTILE *prev, *next;
}DETECTTILE, *LPDETECTTILE;


LPDETECTTILE g_DetectTile;


void DeleteDetectTile( LPDETECTTILE tt )
{		
	LPDETECTTILE  t = g_DetectTile;
			
	while( t != NULL )
	{		
		if( t == tt )
		{	
			if( t == g_DetectTile )
			{	
				t = g_DetectTile->next;
				MemFree( g_DetectTile );

				g_DetectTile = t;
				if( t != NULL )	g_DetectTile->prev = NULL;
				return;
			}
			else 
			{
				if ( t->prev != NULL )
					t->prev->next = t->next;

				if( t->next != NULL )
					t->next->prev = t->prev;

   				MemFree( t );
				return;
			}
		}
		t = t->next;
	}		
}		


LPDETECTTILE AddDetectTile( int type, int x, int y, WORD color )
{			
	LPDETECTTILE temp = NULL, t;
	MemAlloc( temp, sizeof( DETECTTILE ));
			
	temp->delay		= 80;
	temp->type		= type;
	temp->x			= x * TILE_SIZE + 16 ;
	temp->y			= y * TILE_SIZE + 16 ;
	temp->color		= color;
	temp->prev		= NULL;
	temp->next		= NULL;
				
	if( g_DetectTile == NULL )
	{		
		g_DetectTile			= temp;
	}		
	else	
	{		
		t					= g_DetectTile;
		g_DetectTile		= temp;
		g_DetectTile->next	= t;
		t->prev				= g_DetectTile;
	}												
												
	return g_DetectTile;								
}														
void OutputDetectTile( void )							
{											
	LPDETECTTILE t, temp;										
	LPORDERTABLE o;								
												
	t = g_DetectTile;										
	while( t != NULL )									
	{									
		t->delay --;									
		if( t->delay <= 0 ) { temp = t->next; DeleteDetectTile( t ); t = temp; continue; }
														
		if( BoxAndDotCrash( Mapx, Mapy, GAME_SCREEN_XSIZE, GAME_SCREEN_YSIZE, t->x, t->y ) )
		{															
			o = &g_OrderInfo.order[ g_OrderInfo.count ];
														
			o->wType		= SPRITETYPE_DETECT_TILE;
			o->x			= t->x;
			o->y			= t->y;
			o->height		= 0;
			o->offset		= t->y;
			o->lpvData		= (LPVOID)t;
			o->show			= 1;
			o->sort			= 1;
			g_OrderInfo.count++;
		}										
		t = t->next;
	}		
}			
	
	
/////////////
/////////////
/////////////			Number Animation.....
/////////////			Number Animation.....
/////////////			Number Animation.....
/////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
	
	
	
//	拳搁惑窜俊 柳青 惑炔阑 汲疙茄促. 
void GameStatusOutput( int no )
{
	static char text[ FILENAME_MAX];
	char temp[ FILENAME_MAX];

//	static int oldno = -1;
	char *token;
	int tno;
	FILE *fp;

⌨️ 快捷键说明

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