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

📄 skill.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:

//	if( no == oldno ) goto NEXT_;
//	oldno = no;

	fp = Fopen( "./data/gamestatusexplain.txt", "rt" );
	if( fp == NULL ) return;

	while( !feof( fp ) )
	{
		fgets( temp, FILENAME_MAX, fp );

		token = strtok( temp, "\t\n");
		tno = atoi( token );
		if( tno == no )
		{
			token = strtok( NULL, "\t\n");
			strcpy( text, token );
			fclose(fp);

			if( strchr( text, '%' ) )
			{
				sprintf( temp, text, SkillOutputMessage );
				AddCurrentStatusMessage( 255,0,0, temp );
			}
			else
			{
				AddCurrentStatusMessage( 255,0,0, temp );
			}
			return;
		}
	}
	fclose(fp);
}		
	
// Bomb...								
void SendCMD_FOOT_ON_TRAP_0_ITEM( int server_id )
{				
	t_packet p;	
	p.h.header.type = CMD_FOOT_ON_TRAP_0_ITEM;
  p.u.client_foot_on_trap0.idServer = server_id;
	p.h.header.size = sizeof(t_client_foot_on_trap0 );
	QueuePacket( &p, 1 );
}				

void RecvCMD_STEAL_ON_TRAP( t_server_steal_on_trap	*p )
{						
	LPCHARACTER ch = ReturnCharacterPoint(p->idServer);
	if( ch == NULL ) return;
	int no;

	int t = rand()%4 +1;
	for( int j = 0 ; j < t; j ++)
		InsertMagic( ch, ch, 287,0, ch->x+(rand()%32) - 16, ch->y+ (rand()%32)-16, 0,0 );

	if( ch== Hero ) 
	{
		no = SCharacterData.nCharacterHP - p->nLife;
		SCharacterData.nCharacterHP = p->nLife;
	}
	else 
	{
		no = ch->hp - p->nLife;
		ch->hp = p->nLife;
	}

	AddNumberAni( NUMBER_ANIMATION_TYPE_DOWN_, ch->y+1, ch->x, ch->y, no );

	//1013 zhh
	if( ch->hp > 0 )
	{
		if( ch->sprno <= 1 )
		{
			ch->nCurrentAction = ACTION_ATTACKED;
			ch->nCurrentFrame = 0;
		}
		else
		{
			ch->nCurrentAction = MON1_ATTACKED;
			ch->nCurrentFrame = 0;
		}
	}
}
void RecvCMD_FOOT_ON_TRAP_0_ITEM( t_server_foot_on_trap0 *p )
{						
	LPCHARACTER ch = ReturnCharacterPoint(p->idServer);
	if( ch == NULL ) return;
	LPITEMGROUND i = FindItemList(p->idItem);
	if( i == NULL ) return;
	int no;

	int t = rand()%4 +1;
	for( int j = 0 ; j < t; j ++)
		InsertMagic( ch, ch, 287,0, i->x+(rand()%32) - 16, i->y+ (rand()%32)-16, 0,0 );

	if( ch== Hero ) 
	{
		no = SCharacterData.nCharacterHP - p->nLife;
		SCharacterData.nCharacterHP = p->nLife;
	}
	else 
	{
		no = ch->hp - p->nLife;
		ch->hp = p->nLife;
	}
	no = i->attr[IATTR_DURATION];//021030 lsw
	AddNumberAni( NUMBER_ANIMATION_TYPE_DOWN_, ch->y+1, ch->x, ch->y, no );


	//1013 zhh
	if( ch->hp > 0 )
	{
		if( ch->sprno <= 1 )
		{
			ch->nCurrentAction = ACTION_ATTACKED;
			ch->nCurrentFrame = 0;
		}
		else
		{
			ch->nCurrentAction = MON1_ATTACKED;
			ch->nCurrentFrame = 0;
		}
	}
}				
// Trap...		
void SendCMD_FOOT_ON_TRAP_1_ITEM( int server_id )
{	
	t_packet p;
	p.h.header.type = CMD_FOOT_ON_TRAP_1_ITEM;
  p.u.client_foot_on_trap1.idServer = server_id;
	p.h.header.size = sizeof(t_client_foot_on_trap1 );
	QueuePacket( &p, 1 );
}	

void RecvCMD_FOOT_ON_TRAP_1_ITEM( t_server_foot_on_trap1 *p )
{	
	LPCHARACTER ch = ReturnCharacterPoint(p->idServer);
	if( ch == NULL ) return;
	LPITEMGROUND i = FindItemList(p->idItem);
	if( i == NULL ) return;
	int no;

//	int t = rand()%4 +1;
//	for( int j = 0 ; j < t; j ++)
//		InsertMagic( ch, ch, 208,0, i->x+(rand()%32) - 16, i->y+ (rand()%32)-16, 0,0 );

	InsertMagic( ch, ch, 288,0, i->x+(rand()%32) - 16, i->y+ (rand()%32)-16, 0,0 );
	
	if( ch== Hero ) 
	{
		no = SCharacterData.nCharacterHP - p->nLife;//别牢剧
		SCharacterData.nCharacterHP = p->nLife;
	}
	else 
	{
		no = ch->hp - p->nLife;
		ch->hp = p->nLife;
	}
	
	no = i->attr[IATTR_DURATION];//021030 lsw
	AddNumberAni( NUMBER_ANIMATION_TYPE_DOWN_, ch->y+1, ch->x, ch->y, no );

	if( ch->hp > 0 )
	{
		if( ch->sprno <= 1 )
		{
			ch->nCurrentAction = ACTION_ATTACKED;
			ch->nCurrentFrame = 0;
		}
		else
		{
			ch->nCurrentAction = MON1_ATTACKED;
			ch->nCurrentFrame = 0;
		}
	}
}	
	
void RecvViewtypeChange( t_viewtype_change *p )
{	
	LPCHARACTER	ch = ReturnCharacterPoint( p->server_id );
	if( ch == NULL ) return;
	ch->viewtype = p->viewtype;
	
	switch( ch->viewtype )
	{	
		////////////////// 1220 捞痹绕 ///////////////////////
		case VIEWTYPE_CONFUSION_: break;
		case VIEWTYPE_TREE_		: break;
		case VIEWTYPE_GHOST_	:	
			{
				ch->ghostani = rand()%10 + 15;	
				ch->peacests = 0;

				if( Hero == ch )	// 0711 YGI
				{
					SetBattlePeace( PEACE_MODE );
					SmallMenuClose();
					// 蜡飞老锭 皋春 努府绢
					CSDMainIconClear(); // CSD-TW-030627

					if(Hero->lv <= 20)//付阑肺 混酒唱扁 020627 lsw
					{
						if( MapNumber!=85 && MapNumber!=30)//檬焊磊 荐访家啊 酒聪扼搁 //020827 lsw
						{
							CallSmallMenu(MN_GHOST_TO_ALIVE);
						}
					}
				}

				SettingBasicActionSub( ch );
				ch->nCurrentAction = ch->basicAction;
				
				CharDoAni( ch, ch->direction, ch->basicAction);
				
			}break;

		case VIEWTYPE_CAMELEON_ : 
			break;
	}
}	
	

void RecvViewCharInfo( t_view_char_info *p )
{
	char temp[ FILENAME_MAX];
	int id = 	p->server_id;

	LPCHARACTER ch = ReturnCharacterPoint( id );
	if( ch == NULL ) return;
	
	SkillSettingClear();

	switch( p->type )
	{
		case WIS :	if( ch->name[0])
					{
						//1024 zhh
						AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,204), ch->name, p->data );
						sprintf( temp, lan->OutputMessage(2,205), ch->name, p->data  );
					//	AddCurrentStatusMessage( 255,255,255, "%s狼 瘤驱绰 %d涝聪促. ", ch->name, p->data );
					//	sprintf( temp, "%s狼 瘤庆绰 %d沥档 登摆焙...", ch->name, p->data  );
					}
					else
					{
						//1024 zhh
						AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,206), p->data );
						sprintf( temp, lan->OutputMessage(2,207), p->data  );
					//	AddCurrentStatusMessage( 255,255,255, "舅酒焊聪, 瘤驱绰 %d涝聪促. ", p->data );
					//	sprintf( temp, "瘤庆绰 %d沥档 登摆焙...", p->data  );
					}
					strcpy( Hero->szChatMessage, temp );
					Hero->ChatDelay = 70;
			break;
		case INT_ :	if( ch->name[0])
					{
						//1024 zhh
						AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,208), ch->name, p->data );
						sprintf( temp, lan->OutputMessage(2,209), ch->name, p->data  );
					//	AddCurrentStatusMessage( 255,255,255, "%s狼 瘤瓷绰 %d涝聪促. ", ch->name, p->data );
					//	sprintf( temp, "%s狼 瘤瓷绰 %d沥档 登摆焙...", ch->name, p->data  );
					}
					else
					{
						//1024 zhh
						AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,210), p->data );
						sprintf( temp, lan->OutputMessage(2,211), p->data  );
					//	AddCurrentStatusMessage( 255,255,255, "舅酒焊聪, 瘤瓷绰 %d涝聪促. ", p->data );
					//	sprintf( temp, "瘤瓷绰 %d沥档 登摆焙...", p->data  );
					}
					strcpy( Hero->szChatMessage, temp );
					Hero->ChatDelay = 70;
			break;
			// 磷阑 寸矫 惑炔..
		case 9999:	if( p->killer == NULL )
					{
						NNEXTT_:
						//1024 zhh
						AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,212) );
						sprintf( temp, lan->OutputMessage(2,213) );
					//	AddCurrentStatusMessage( 255,255,255, "磷阑 寸矫狼 惑炔捞 颇厩捞 登瘤 臼嚼聪促. " );
					//	sprintf( temp, "恐 磷菌绰瘤 肋 葛福摆绢." );
					}
					else
					{
						if( p->killer[0] == 0 ) goto NNEXTT_;

						if( ch->name[0] )
						{
							//1024 zhh
							AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,214), ch->name, p->killer );
							sprintf( temp, lan->OutputMessage(2,215), p->killer );
						//	AddCurrentStatusMessage( 255,255,255, "%s篮(绰) %s俊 狼秦 磷烙阑 寸沁嚼聪促.", ch->name, p->killer );
						//	sprintf( temp, "%s俊 寸茄巴 鞍焙.", p->killer );
						}
						else
						{
							//1024 zhh
							AddCurrentStatusMessage( 255,255,255, lan->OutputMessage(2,216), p->killer );
							sprintf( temp, lan->OutputMessage(2,217), p->killer );
						//	AddCurrentStatusMessage( 255,255,255, "%s俊 狼秦 磷烙阑 寸沁嚼聪促.", p->killer );
						//	sprintf( temp, "%s俊 寸茄巴 鞍焙.", p->killer );
						}
					}
					strcpy( Hero->szChatMessage, temp );
					Hero->ChatDelay = 70;
				
			break;
	}
}


//  Skill窍绊 抄第 促矫 滚瓢阑 穿甫鞘夸绝捞 馆汗且荐 乐霸 茄促.
void AgainSkill( int skillno )
{
	switch( skillno )
	{
	case	4 :
	case	5 :
	case	16 :
	case	21 :
	case	23 :
	case	24 :
	case	25 :
	case	26 :
	case	28 :
	case	30 :
	case	32 :
//	case	34 :
	case	35 :
	case	36 :
	case	38 :
	case	39 :
	case	41 :	
		{

					//1004 zhh
					if(AmIEquitSkillTool(skillno)==0)
						break;
					SelectSkill( skillno );
					SkillStatus = SKILL_ON;
					//1007 zhh 扁贱捞 角菩沁阑 版快 酒捞能捞 波瘤绰 巴阑 阜绰促び
					int para = 1;
					if( skill[skillno].series==1 ) para = 0;					
					SkillOn = para;
		}
		break;

		//
	case	22 :	//   父距   酒捞袍捞 巢酒 乐促搁..
		{
					//1004 zhh
					if(AmIEquitSkillTool(skillno)==0)
						break;
					
					SelectSkill( skillno );
					SkillStatus = SKILL_READY;  // SelectSkill() 关俊客具 茄促. 
					//1007 zhh 扁贱捞 角菩沁阑 版快 酒捞能捞 波瘤绰 巴阑 阜绰促び
					int para = 1;
					if( skill[skillno].series==1 ) para = 0;					
					SkillOn = para;
		}
		break;
	}
}




void PutSkillUseItem_skill_use_item( int skillno  )
{
	int c;
	int ino;
	CItem *ii;

	switch( skillno )
	{
		// Sow..
		case 22 :	
		{
			c = 0;
			for( int i= 0 ; i < 3 ; i ++)
				for( int j= 0 ; j < 3 ; j ++)
					for( int k= 0 ; k < 8 ; k ++)
					{
						ino = InvItemAttr[i][j][k].item_no;
						ii = ItemUnit( ino / 1000, ino % 1000 );
						if( ii )
							if( ii->GetItemKind() == IK_SEED )
							{
								skill_use_item[c/10][c%10].item_no = ino;
								SetItemPos( INV, i,j,k, &skill_use_item[c/10][c%10].pos );
								c++;
							}
					}

			//  Quick..
			for( int k= 0 ; k < 5 ; k ++)
			{
				ino = QuickItemAttr[k].item_no;
				ii = ItemUnit( ino / 1000, ino % 1000 );
				if( ii )
				{
					if( ii->GetItemKind() == IK_SEED )
					{
						skill_use_item[c/10][c%10].item_no = ino;
						SetItemPos( QUICK, k, &skill_use_item[c/10][c%10].pos );
						c++;
					}
				}
			}
		}
		break;
	}
}


void DrawSkilltile( void  )
{
	int x, y;
	int skillno = SkillNo;
	int mx = Mox / TILE_SIZE;
	int my = Moy / TILE_SIZE;
	int rx, ry;
	int r;
	int mapx, mapy;
	DWORD		lineColor;
	lpMAPSKILLTABLE	result;

	if( SkillStatus == SKILL_OFF ) return;

	switch( skillno )
	{
	case 21	://Reclaim	
	case 22	://Sow	
	case 23	://Cultivate	
	case 24	://Havest	
					skillno = 1;
					lineColor=RGB16(221,189,140);
					
			break;

	case 25	://Detect Mineral	
	case 26	://Mining	
					skillno = 2;
					lineColor=RGB16(203,185,156);
					
			break;
		
	case 28	://Fish 
	case 30	://Netting	
					skillno = 3;
					lineColor=RGB16(118,100,85);
			break;

	case 32	://Cutting	
	case 33	://Lumbering	
					skillno = 4;
					lineColor=RGB16(197,79,0);
			break;

	case 35	://Detect Herb	
	case 36	://Digging	
					skillno = 5;
					lineColor=RGB16(137,202,157);
			break;

	default : return;
	}

	

	mapy = g_Map.y;
	
	for ( y = 0; y < GAME_SCREEN_YSIZE ; y += TILE_SIZE, mapy ++ )
	{	
		for ( mapx = g_Map.x, x = 0; x < GAME_SCREEN_XSIZE ; x+= TILE_SIZE, mapx ++ )
		{
			result=FindSkill(&Header[(int)(mapx/(int)((g_Map.file.wWidth+7)/8))][(int)(mapy/(int)((g_Map.file.wHeight+7)/8))],mapx,mapy);
			if( result )
			{
				if( result->skillno == skillno  )
				{
					r = result->tile_Range;
					if( BoxAndDotCrash( mapx - r,  mapy - r, r+r, r+r, mx, my ))
					{
						rx=(mapx-r)*TILE_SIZE;
						ry=(mapy-r)*TILE_SIZE;
						r = (r+r)*TILE_SIZE + TILE_SIZE;

						Box( rx-1, ry-1, rx+r+1, ry+r+1, lineColor);
						Box( rx  , ry  , rx+r  , ry+r  , lineColor);
						Box( rx+1, ry+1, rx+r-1, ry+r-1, lineColor);

					
					return;
					}
				}
			}
		}
	}
}	
	
	
	
void DrawSkillGauge( LPSKILLGAUGE n )
{	
	Spr *sp, *g;
	int sx, sy, ex, ey;
	int x,y;
	int gx,gy;

	sp = &spr[ n->type];
	g =  &spr[732];

	x = n->x - Mapx;
	y = n->y - Mapy - 100;

	gx = -g->xl/2;
	gy = g->yl/2;

	sx = x - g->xl/2;
	sy = y - g->yl/2;
	ex = sx + g->xl * n->min / 100;
	ey = sy + g->yl;

	//PutCompressedImage( x, y + 50, g );
	// sx, sy, ex, ey

	switch( n->type )
	{
	case SKILLGAUGE_RESTTIME	: 
		// 荐犬啦					
	case SKILLGAUGE_HAVEST		:
		// 牢傍利犁硅啦				
	case SKILLGAUGE_CULTIVATE	:
		// 炼访档					
	case SKILLGAUGE_TAME		:
		// 配瘤俺埃档				
	case SKILLGAUGE_RECLAIM		:	
		// 颇辆啦					
	case SKILLGAUGE_SOWING		:

		//1018 zhh		
	case SKILLGAUGE_FISHING :

		break;
	}


	

⌨️ 快捷键说明

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