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

📄 op_chr_status.cpp

📁 国内著名网络游戏dragon的服务端完整源码 内附完整数据库结构
💻 CPP
📖 第 1 页 / 共 3 页
字号:
			{
				SetItemEmpty( ch, 6141);
				SetItemEmpty( ch, 6224);
			}
			SetItemEmpty( ch, 8066 );
			SetItemEmpty( ch, 8008 );
			SetItemEmpty( ch, 8014 );
			break;
		}
	case THIEF	://如果是盗贼
		{
			for( i=0; i<5; i++ )
			{
				SetItemEmpty( ch,  10032 );
			}
			ItemAttr *item = SearchInv( ch );
			*item = GenerateItem( 7001, 1000);
			
			item = SearchInv( ch );
			*item = GenerateItem( 7002, 1000);
			SetItemEmpty( ch, 8066 );
			break;
		}
	case ARCHER	://如果是弓手
		{
			for( i=0; i<5; i++ )
			{
				SetItemEmpty( ch,  10033 );
			}
			SetItemEmpty( ch,  6028 );
			SetItemEmpty( ch,  6029 );
			SetItemEmpty( ch,  8008 );
			ItemAttr *item = SearchInv( ch );
			*item = GenerateItem( 7005, 1000);
			item = SearchInv( ch );
			*item = GenerateItem( 7045, 1000);
			break;
		}
	case WIZARD	://如果是巫师
		{
			for( i=0; i<3; i++ )
			{
				SetItemEmpty( ch,  4002 );
			}
			SetItemEmpty( ch,  6024);				// 001219_2 YGI
			SetItemEmpty( ch,  6046);
			SetItemEmpty( ch,  8101);
			SetItemEmpty( ch,  8120);
			ch->Ws[1] = true;
			ch->Ws[2] = true;
			ch->Ws[30] = true;
			break;
		}
	case PRIEST	://如果是祭祀
		{
			for( i=0; i<2; i++ )
			{
				SetItemEmpty( ch,  4001 );
			}
			SetItemEmpty( ch,  6024 );			// 001219_2 YGI
			SetItemEmpty( ch,  6046 );
			SetItemEmpty( ch,  8103 );
			SetItemEmpty( ch,  8120 );
			ch->Ps[1] = true;
			ch->Ps[12] = true;
			ch->Ps[27] = true;
			break;
		}
	}
	ch->Money = 400;//初始化的钱为400
	if( ch->Spell == WIZARD_SPELL )
	{
		SetItemEmpty( ch,  10025 );				// 付过氓
	}													// 001215 YGI -----------------------------------------
	SetMySkill( ch );
	
	//  Client阑 困茄 Data
	ch->SprNo			=	ch->Gender;
	ch->SprType			=	0;	
	
	ch->Direction		=	DIRECTION_SAME;
	ch->IDWhoImAttacked	=	0;	// 唱甫 模仇捞 穿备衬..
	ch->nCurrentAction	=	0;
	
	ch->BankMoney		=	0;
	
	
	ch->MoveSx			=	134;
	ch->MoveSy			=	 60;
	ch->MoveGox = ch->X	=	ch->MoveSx * TILE_SIZE + 16;
	ch->MoveGoy = ch->Y	=	ch->MoveSy * TILE_SIZE + 16;	
	ch->MovePathCount	=	0;
	ch->MoveLength		=	0;
	ch->MoveType		=	0;
	memset( ch->MoveDirTbl, 0 , MAX_DIR_TABLE );
	
	// 弥檬狼 Skill Exp 利侩 
	for( i = 0 ; i <  45 ; i ++)	ch->skillexp[i] = 5;
	
	//< CSD-011006
	/*
	calcNewAbility(ch) ;
	ch->Hp		= ch->HpMax ;
	ch->Mana	= ch->ManaMax ;
	ch->HungryMax= getMaxHungry (ch) ;
	ch->Hungry= ch->HungryMax;
	*/
	const int nCon = ch->Con/5;
	ch->HpMax	= ch->Hp = (86 + (111 + (nCon - 1)*(15 + nCon)))*2;
	ch->ManaMax	= ch->Mana = int((ch->wsps)*5.3);		// 0910 YGI
	ch->HungryMax = ch->Hungry = (ch->Con*20 + ch->Level*100 + 3000)/100;
	//> CSD-011006
	
	ch->social_status	= 100;	// 脚盒 : 乞刮.
	ch->fame			= 0;
	ch->fame_pk			= 0;	// 010915 LTS		//Fame_PK -> NWCharacter肺 背眉 DB俊绰 角力肺 NWCharacter狼 蔼捞 甸绢癌聪促.		
	memset(&ch->NWCharacter,0,sizeof(DWORD));	// 010915 LTS
	ch->viewtype		= 0;
	ch->reserved_point	= 0;
	
	//< CSD-011006
	memset(ch->aStepInfo, 1, sizeof(ch->aStepInfo));//傈捧胶懦 檬扁俊 -1 登绢 乐绰 滚弊.
	//> CSD-011006
	
	ch->openhouse = -1; // 弥檬俊 笼观俊辑 矫累窍骨肺  摧囚乐绰巴栏肺 矫累秦具瘤...
}


// 霸烙辑滚俊辑 荤侩.....
void UserAddBasicData(  t_connection c[], int i, t_server_user_add *p )
{
	CHARLIST *ch = &c[i].chrlst;
	
	p->server_id	= i;
	
	memcpy(p->name, c[i].name, NM_LENGTH);
	
	//	p->killpc		= (char) ch->killpc;
	p->spr_no		= (unsigned char)ch->SprNo;
	p->spell		= (char )ch->Spell;
	p->face			= (char )ch->Face;
	
	p->body_r		= (unsigned char)ch->BodyR;
	p->body_g		= (unsigned char)ch->BodyG;
	p->body_b		= (unsigned char)ch->BodyB;
	p->cloth_r		= (unsigned char)ch->ClothR;
	p->cloth_g		= (unsigned char)ch->ClothG;
	p->cloth_b		= (unsigned char)ch->ClothB;
	
	p->equip[0]		= ch->accessory[0];
	p->equip[1]		= ch->accessory[1];
	p->equip[2]		= ch->accessory[2];
	p->equip[3]		= ch->accessory[3];
	
	p->peacests		= ch->Peacests;
	
	p->hp			= ch->Hp;
	
	p->x			= ch->MoveSx * TILE_SIZE + 16;
	p->y			= ch->MoveSy * TILE_SIZE + 16;
	
	p->viewtype		= ch->viewtype;
	
#ifdef _GAME_SERVER_
	p->fame_pk		= IsHePK( ch->server_id );
#endif
}	


// 努扼捞攫飘啊 立加且锭, 扁夯沥焊甫 努扼捞攫飘肺 焊郴霖促
void PutPacketCharDB( t_connection c[], int cn, t_packet *packet )
{	
	t_server_user_db_data *p;
	
	CHARLIST *ch = &c[cn].chrlst;
	p = &packet->u.server_user_db_data;
	
	p->lev				= ch->Level;
	p->exp				= ch->Exp;
	
	p->Attr[0]			= ch->Gender;
	p->Attr[1]			= ch->Face;
	p->Attr[2]			= ch->nGuildCode; // CSD-030324
	p->Attr[3]			= ch->Class;
	p->Attr[4]			= ch->Spell;
	p->Attr[5]			= ch->Tactics;
	
	p->Avility[STR ]	= ch->Str;		// 1118
	p->Avility[CON ]	= ch->Con;
	p->Avility[DEX ]	= ch->Dex;
	p->Avility[WIS ]	= ch->Wis;
	p->Avility[INT ]	= ch->Int;
	p->Avility[MOVP]	= ch->MoveP;
	p->Avility[CHA ]	= ch->Char;
	p->Avility[ENDU]	= ch->Endu;
	p->Avility[MOR ]	= ch->Moral;
	p->Avility[LUCK]	= ch->Luck;
	p->Avility[WSPS]	= ch->wsps;
	
	p->money			= ch->Money;
	//< CSD-010907	
	/*
	p->hp				= ch->Hp;
	p->hpmax			= ch->HpMax;
	p->mp				= ch->Mana;
	p->mpmax			= ch->ManaMax;
	p->hungry			= ch->Hungry;
	p->hungrymax		= ch->HungryMax;
	*/
	p->nLife	= ch->Hp;
	p->nMaxHp = ch->HpMax;
	p->nMana = ch->Mana;
	p->nMaxMp = ch->ManaMax;
	p->nHungry	= ch->Hungry;
	p->nMaxHungry = ch->HungryMax;
	//> CSD-010907
	p->condition		= ch->Condition;
	
	
	p->sprno			= ch->SprNo;
	p->x				= ch->X;
	p->y				= ch->Y;
	
	p->acc_equip1		= ch->accessory[0] ;
	p->acc_equip2		= ch->accessory[1] ;
	p->acc_equip3		= ch->accessory[2] ;
	p->acc_equip4		= ch->accessory[3] ;
	
	
	
	/*	
	short int		Str   ;				//  塞
	short int		Con   ;				//  扒碍
	short int		Dex   ;				//	刮酶己
	short int		Wis   ;				//	瘤驱
	short int		Int   ;				//	瘤瓷
	short int		MoveP ;				//	捞悼仿
	short int		Char  ;				//	概仿
	short int		Endu  ;				//  历氢仿
	short int		Health;				//	眉仿
	short int		Moral ;				//	荤扁
	short int		Luck  ;				//	青款
	short int		wsps  ;
	
	*/	
	/*	
	p->nCharacterData[GENDER]		= ch->Gender   ;
	p->nCharacterData[FACE]			= ch->Face   ;
	p->nCharacterData[ARIGENENT]		= ch->   ;
	p->nCharacterData[CLASS]			= ch->Wis   ;
	p->nCharacterData[SPELL]			= ch->Int   ;
	p->nCharacterData[TACTICS_MAN]	= ch->MoveP ;
	p->nCharacterData[TACTICS_WOMAN] = ch->Ch]			= ch->Endu  ;
	*/								
	ch->MoveSx = ch->X / TILE_SIZE;
	ch->MoveSy = ch->Y / TILE_SIZE;
	
	memcpy(p->mapname, ch->MapName, 20);
	
	//	 p->peacests		= (unsigned char)ch->Peacests;		// 0410  荤侩窍瘤 臼澜...
	p->sight			=				 ch->Sight;
	
	p->bodyr			= (unsigned char)ch->BodyR;
	p->bodyg			= (unsigned char)ch->BodyG;
	p->bodyb			= (unsigned char)ch->BodyB;
	
	p->clothr			= (unsigned char)ch->ClothR;
	p->clothg			= (unsigned char)ch->ClothG;
	p->clothb			= (unsigned char)ch->ClothB;
	
	p->Age				= (unsigned char)ch->Age;			// 1118
	
	p->openhouse		= ch->openhouse;
	p->reserved_point	= ch->reserved_point;				// 1221
	
	p->viewtype			= ch->viewtype;
	
	p->social_status	= ch->social_status;
	memcpy( &p->nation, &ch->name_status, sizeof( DWORD));				// 1004 YGI
	p->fame				= ch->fame;
	p->nk3				= ch->nk[ N_VYSEUS];
	p->nk4				= ch->nk[ N_ZYPERN];
	p->nk6				= ch->nk[ N_YILSE];
	p->NWCharacter		= ch->NWCharacter;			// 010915 LTS
	//< CSD-011006
	memcpy(p->aStepInfo, ch->aStepInfo, sizeof(p->aStepInfo));
	//< CSD-011006
}	

/*#define CMD_CHAR_INFO_MAGIC				5004
typedef struct char_info_magic{	
unsigned char magic[ 200 ];
}t_char_info_magic;

  #define CMD_CHAR_INFO_SKILL				5003
  
	typedef struct char_info_skill{	
	unsigned char skill[ 200 ];
	}t_char_info_skill;
	*/
	
	
	void SendItemInventory( int count, t_connection c[], int cn )		//1218
	{
		int i = count /3,j=count %3;
		
		t_packet packet;
		packet.h.header.type = CMD_CHR_ITEM_INFO_0;
		packet.h.header.size = sizeof(t_chr_item_info0 );
		
		packet.u.chr_item_info0.ar0 = i;
		packet.u.chr_item_info0.ar1 = j;
		memcpy( (unsigned char *)packet.u.chr_item_info0.inv, 
			(unsigned char *)c[ cn].chrlst.inv[i][j],	sizeof( ItemAttr ) * 8 );
		
		QueuePacket( c, cn, &packet, 1);
	}
	
	// 8俺..
	void SendItemEquip( t_connection c[], int cn )
	{
		t_packet packet;
		
		packet.h.header.type = CMD_CHR_ITEM_INFO_1;
		{
			memcpy( (unsigned char *)packet.u.chr_item_info1.equip, 
				(unsigned char *)c[ cn].chrlst.equip,	sizeof( ItemAttr ) * 8 );
		}
		packet.h.header.size = sizeof(t_chr_item_info1 );
		QueuePacket( c, cn, &packet, 1);
	}
	
	void SendItemQuick( t_connection c[], int cn )
	{
		t_packet packet;
		
		packet.h.header.type = CMD_CHR_ITEM_INFO_2;
		{
			memcpy( (unsigned char *)packet.u.chr_item_info2.quick, 
				(unsigned char *)c[ cn].chrlst.quick,	sizeof( ItemAttr ) * 6 );
		}
		packet.h.header.size = sizeof(t_chr_item_info2 );
		QueuePacket( c, cn, &packet, 1);
	}
	/*#define CMD_CHAR_INFO_MAGIC				5004
	typedef struct char_info_magic{	
	unsigned char magic[ 200 ];
	}t_char_info_magic;
	
	  #define CMD_CHAR_INFO_SKILL				5003
	  
		typedef struct char_info_skill{	
		unsigned char skill[ 200 ];
		}t_char_info_skill;
	*/
	
	void SendCharInfoMagic( t_connection c[], int cn )
	{
		t_packet packet;
		
		packet.h.header.type = CMD_CHAR_INFO_MAGIC;
		{
			if( c[cn].chrlst.Spell == 0 ) // Wizard Spell..
				memcpy( packet.u.char_info_magic.magic, c[ cn].chrlst.Ws, 200 );
			else 
				memcpy( packet.u.char_info_magic.magic, c[ cn].chrlst.Ps, 200 );
		}
		packet.h.header.size = sizeof( t_char_info_magic );
		QueuePacket( c, cn, &packet, 1);
	}
	
	void SendCharInfoSkill( t_connection c[], int cn )
	{
		t_packet packet;
		
		packet.h.header.type = CMD_CHAR_INFO_SKILL;
		{
			memcpy( packet.u.char_info_skill.skill, c[ cn].chrlst.Skill, 200 );
		}
		packet.h.header.size = sizeof( t_char_info_skill);
		QueuePacket( c, cn, &packet, 1);
	}
	
	
	
	void SendCharInfotac_skillEXP( t_connection c[], int cn )
	{
		t_packet packet;
		
		packet.h.header.type = CMD_CHAR_INFO_TAC_SKILL_EXP;
		{
			memcpy( packet.u.char_info_tac_skillexp.tac_skillEXP, c[ cn].chrlst.tac_skillEXP, 13 * sizeof( DWORD ) );
		}
		packet.h.header.size = sizeof( t_char_info_tac_skillexp );
		QueuePacket( c, cn, &packet, 1);
	}
	
	
	void SendCharInfoBasic( int cn, short int kind, DWORD data )
	{
		t_packet packet;
		
		/*	if( cn == 0 || cn == 1 )
		{
		FILE *fp;
		fp = fopen( "SendCharInfoBasic俊 01捞 甸绢吭促.txt", "at+" );
		if( fp )
		{
		fprintf( fp, "%d  %d \n", kind, data );
		fclose(fp);
		}
		}

⌨️ 快捷键说明

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