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

📄 counseler.cpp

📁 网络游戏龙族 完整的登陆器 C++ 源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
#include "stdafx.h"
#include <Stdio.h>
#include <Process.h>
#include "resource.h"
#include "dragon.h"
#include "math.h"

#include "gameproc.h"
#include "network.h"
#include "map.h"
#include "char.h"
//#include "FPS.h"
#include "object.h"

#include "Hong_Sprite.h"
#include "Hong_Light.h"
#include "Hong_Sub.h"

#include "Hangul.h"
//#include "Menudef.h"
#include "Menu.h"
#include "MenuStartSet.h"
#include "DirectSound.h"
#include "Effect.h"
#include "LineCommand.h"
#include "Tool.h"
#include "ItemTable.h"
#include "Midi.h"
#include "MouseCursor.h"
#include "SkillTool.h"
#include "Skill.h"
#include "House.h"
#include "CharDataTable.h"
#include "Item.h"
#include "SmallMenu.h"
#include "Path.h"
#include "chat.h"
#include "TextOutMgr.h"


#define __COUNSELER_CPP__
#include "Counseler.h"



extern void SettingDestPoint( int x, int y );



void SendBlockAttack( void )
{	

#ifdef _DEBUG

	char temp[MAX_PATH];
	if( !g_block_attack )
	{
		sprintf( temp, lan->OutputMessage(7,2)   );//010215 lsw
	}
	else 
	{
		sprintf( temp, lan->OutputMessage(7,3)   ); //010215 lsw
	}

	if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )//010215 lsw
	{	

	}
	else return;

	
	g_block_attack = ! g_block_attack;

	t_packet p;

	if( g_block_attack )
		p.h.header.type = CMD_BLOCK_ATTACK_START;	// 傍拜阑 阂瓷栏肺 父电促. 
	else  
		p.h.header.type = CMD_BLOCK_ATTACK_END;		// 傍拜阑 啊瓷窍霸 茄促. 

	p.h.header.size = 0;

	QueuePacket( &p, 1 );


#endif
}	

void SendBlockMagic( void )
{
#ifdef _DEBUG
	char temp[MAX_PATH];
	if( !g_block_magic )
	{
		sprintf( temp, lan->OutputMessage(7,4)   );//010215 lsw
	}
	else 
	{
		sprintf( temp, lan->OutputMessage(7,5)   );//010215 lsw
	}

	if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )//010215 lsw
	{	

	}
	else return;
	
	
	g_block_magic = ! g_block_magic;

	t_packet p;
	if( g_block_magic )
		p.h.header.type = CMD_BLOCK_MAGIC_START;	// 捞悼阑  阂瓷栏肺 父电促. 
	else  
		p.h.header.type = CMD_BLOCK_MAGIC_END;	// 捞悼阑 啊瓷窍霸 茄促. 

	p.h.header.size = 0;

	QueuePacket( &p, 1 );

#endif
}

void SendBlockSkill(void)//020821 lsw
{
#ifdef _DEBUG
	char temp[MAX_PATH];
	if( !g_block_move )
	{
		sprintf(temp,lan->OutputMessage(7,250));//010215 lsw
	}
	else 
	{
		sprintf(temp,lan->OutputMessage(7,251));//010215 lsw
	}

	if( YesOrNo(temp, lan->OutputMessage(8,1) ) == IDYES )//010215 lsw
	{	

	}
	else return;
	
	g_block_skill = ! g_block_skill;

	t_packet p;
	if( g_block_skill )
	{
		p.h.header.type = CMD_BLOCK_SKILL_START;	// 捞悼阑  阂瓷栏肺 父电促. 
	}
	else  
	{
		p.h.header.type = CMD_BLOCK_SKILL_END;	// 捞悼阑 啊瓷窍霸 茄促. 
	}	
	p.h.header.size = 0;
	QueuePacket( &p, 1 );
#endif
}

void SendBlockMove( void )
{
#ifdef _DEBUG
	char temp[MAX_PATH];
	if( !g_block_move )
	{
		sprintf( temp, lan->OutputMessage(7,6)  );//010215 lsw
	}
	else 
	{
		sprintf( temp, lan->OutputMessage(7,7)   );//010215 lsw
	}

	if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )//010215 lsw
	{	

	}
	else return;
	
	g_block_move = ! g_block_move;

	t_packet p;
	if( g_block_move )
		p.h.header.type = CMD_BLOCK_MOVE_START;	// 捞悼阑  阂瓷栏肺 父电促. 
	else  
		p.h.header.type = CMD_BLOCK_MOVE_END;	// 捞悼阑 啊瓷窍霸 茄促. 

	p.h.header.size = 0;

	QueuePacket( &p, 1 );
#endif
}

void SendBlockGiveLife( void )
{
#ifdef _DEBUG
	char temp[MAX_PATH];
	if( !g_block_GiveLife )
	{
		sprintf( temp, lan->OutputMessage(7,8)  );//010215 lsw
	}
	else 
	{
		sprintf( temp, lan->OutputMessage(7,9) );//010215 lsw
	}

	if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )//010215 //010215 lsw
	{	

	}
	else return;

	g_block_GiveLife = ! g_block_GiveLife;


	t_packet p;
	if( g_block_GiveLife )
		p.h.header.type = CMD_BLOCK_GIVE_LIFE_START;	// 捞悼阑  阂瓷栏肺 父电促. 
	else  
		p.h.header.type = CMD_BLOCK_GIVE_LIFE_END;	// 捞悼阑 啊瓷窍霸 茄促. 

	p.h.header.size = 0;

	QueuePacket( &p, 1 );
#endif
}

void ViewCounselerStatus( void )
{
#ifdef _DEBUG
	if( GetSysInfo( SI_GAME_MAKE_MODE ) ) 
	{	
		::HprintBold( 10, 130+0, (g_block_attack)?	RGB( 255, 0, 100 ):RGB( 0, 255, 100 ),0, lan->OutputMessage(7, (g_block_attack)? 11:12) );
		::HprintBold( 10, 130+15, (g_block_magic)?	RGB( 255, 0, 100 ):RGB( 0, 255, 100 ),0, lan->OutputMessage(7, (g_block_magic)?	 13:14) );
		::HprintBold( 10, 130+30, (g_block_move )?	RGB( 255, 0, 100 ):RGB( 0, 255, 100 ),0, lan->OutputMessage(7, (g_block_move )?	 15:16) );
		::HprintBold( 10, 130+45, (g_block_skill)?	RGB( 255, 0, 100 ):RGB( 0, 255, 100 ),0, lan->OutputMessage(7, (g_block_skill)?	 252:253) );
	}

	if( g_absolute_logout ){ HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,17) ); }//010215 lsw
	if( g_make_ghost      ){ HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,18) ); }//010215 lsw
	if( g_give_life		  ){ HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,19) ); }//010215 lsw
	if( g_absolute_move )  { HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,20) ); }//010215 lsw
	if( g_absolute_move_dk){ HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,21) ); }//010215 lsw
	if( AbsoluteMoveFlag)  { HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,22) ); }//010215 lsw
	if( AbsoluteMoveDKFlag){ HprintBold( 280,25, RGB( 0, 255, 100 ), 0, lan->OutputMessage(7,23) ); }//010215 lsw
#endif
}

bool CounselerSelectChar( void )
{
#ifdef _DEBUG

	t_packet p;
	if( AbsoluteMoveFlag )
	{
		AbsoluteMoveFlag = false;

		int mx = Mox / TILE_SIZE;
		int my = Moy / TILE_SIZE;
		CHARACTER t;
			
		memcpy( &t, lpAbsoluteMoveCh, sizeof( CHARACTER ) );
		t.moveFlag = TRUE;
		t.movetype = 0;
		t.gox = Mox;
		t.goy = Moy;
		t.destx = mx, t.desty = my;
		if ( PathBuild( &t ) )
		{	
			SettingDestPoint( Mox, Moy );
			
			t.moveFlag = FALSE;
			t.gox = Mox;
			t.goy = Moy;

			t.movetype += 100;
			SendMoveData( &t );	
			t.movetype -= 100;
		}		

		return true;
	}

	if( AbsoluteMoveDKFlag )
	{
		AbsoluteMoveDKFlag = false;

		int mx = Mox / TILE_SIZE;
		int my = Moy / TILE_SIZE;
    t_packet p;
    memset(&p, 0, sizeof(t_packet));
    p.h.header.type = CMD_ABSOLUTE_MOVE_DUNGEON_KEEPER;
		p.h.header.size = sizeof( t_server_magic_position );
		p.u.angra.server_magic_position.idTarget = WORD(lpAbsoluteMoveCh->id);
		p.u.angra.server_magic_position.nX = mx;
		p.u.angra.server_magic_position.nY = my;
		QueuePacket(&p,1);						// LTS LOCALWAR
		return true;
	}

	switch( g_GameInfo.nSelectedSpriteType )
	{
		case SPRITETYPE_ON_THE_CEILING_CHAR	:
		case SPRITETYPE_MONSTER				:
		case SPRITETYPE_NPC					:
		case SPRITETYPE_CHARACTER			:	 break;

		default : return false;
	}

	if( g_GameInfo.lpcharacter == NULL ) return false;
//	if( g_GameInfo.lpcharacter == Hero ) return false;
		
		
	LPCHARACTER ch = g_GameInfo.lpcharacter;
			
			
	char temp[ MAX_PATH];
			
	if( g_absolute_logout ) 
	{		
		sprintf( temp, lan->OutputMessage(7,24), ch->name );//010215 lsw
		if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )//010215 lsw
		{	
			p.h.header.type = CMD_ABSOLUTE_LOGOUT;
			p.u.absolute_logout.id = ch->id;
			p.h.header.size = sizeof( t_absolute_logout );
			QueuePacket( &p, 1 );
			return true;
		}	


	}		
	if( g_make_ghost )
	{
		sprintf( temp, lan->OutputMessage(7,25), ch->name );//010215 lsw
		if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )
		{
			p.h.header.type = CMD_MAKE_GHOST;
			p.u.make_ghost.id = ch->id;
			p.h.header.size = sizeof( t_make_ghost );
			QueuePacket( &p, 1 );
			//acer7
			char *type = "GIVE_LIFE";
			CallServer( CMD_USE_GM_TOOL, type, strlen( type ) );

			return true;
		}
	}
	if( g_give_life )
	{
		sprintf( temp, lan->OutputMessage(7,26), ch->name );//010215 lsw
		if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )
		{
			p.h.header.type = CMD_GIVE_LIFE;
			p.u.make_ghost.id = ch->id;
			p.h.header.size = sizeof( t_give_life );
			QueuePacket( &p, 1 );
			return true;
		}
	}	
		
	if( g_absolute_move )	//  碍力肺 捞悼矫懦荐 乐促. 
	{	
		sprintf( temp, lan->OutputMessage(7,27), ch->name );//010215 lsw
		if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )
		{
			lpAbsoluteMoveCh = ch;
			AbsoluteMoveFlag = true;
			g_absolute_move = false;
			return true;
		}
	}
	
	if( g_absolute_move_dk )	//  碍力肺 捞悼矫懦荐 乐促. 
	{	
		sprintf( temp, lan->OutputMessage(7,28), ch->name );//010215 lsw
		if( YesOrNo(  temp, lan->OutputMessage(8,1) ) == IDYES )
		{
			lpAbsoluteMoveCh = ch;
			AbsoluteMoveDKFlag = true;
			g_absolute_move_dk = false;
			return true;
		}
	}
#endif
	return false;
}		
	
//// 檬焊磊甫 困茄 傍瘤荤亲阑 焊辰促. (努扼捞攫飘俊辑父 贸府茄促.)
		
#define BEGINER_BBS_START		0
#define BEGINER_BBS_END			20
				
#define BEGINER_BBS_INTERVAL	10 // sec
				
int  BeginerBBS_start;
int  BeginerBBS_count;
int  BeginerBBS_x;
	
char BeginerBBS[ FILENAME_MAX];
	
void Check_Beginer_BBS( void )
{	
	static DWORD time;
	int i;
	char temp[FILENAME_MAX];
	
	if( SCharacterData.nLevel > 5 )  return;
	
	if( g_curr_time - time > BEGINER_BBS_INTERVAL )
	{
		time = g_curr_time;
	}
	else return;
	
	FILE *fp;
	fp = Fopen( "./data/beginer.txt", "rt" );
	if( fp == NULL ) return;
	
	for( i = 0 ; i < BeginerBBS_count ; i ++)
	{
		if( fgets( temp, FILENAME_MAX, fp ) == NULL ) 
		{ 
			fclose(fp); 
			BeginerBBS_count = BEGINER_BBS_START;
			return; 
		}
	}

	BeginerBBS_start = BEGINER_BBS_INTERVAL;
	BeginerBBS_x	 = 10;
	EatRearWhiteChar( temp );
	strcpy( BeginerBBS, temp );		
	BeginerBBS_count ++;
	if( BeginerBBS_count >= BEGINER_BBS_END ) BeginerBBS_count = BEGINER_BBS_START;

	fclose(fp);									
}	
	
void Display_Beginer_BBS( void )
{	
	static DWORD time;															

	return;
																								
	if( BeginerBBS_start <= 0 ) return;										
																					
	if( g_curr_time != time )										
	{																
		time = g_curr_time;													
		BeginerBBS_start--;											
	}														
																
	static int x;										
																		
	switch( BeginerBBS_start )										
	{															
		case 1 : BeginerBBS_x -= 20;		break;
	}										

	


//	Getcolor( &r,&g,&b );									
//	Hcolor( 0,255,255 );							
	HprintBoldcolor( BeginerBBS_x+1, 2+1, 20, BeginerBBS );
	HprintBoldcolor( BeginerBBS_x, 2, 100,BeginerBBS );
//	Hcolor( r,g,b );
}		
		
		
		
		
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
		

						
int ViewTipsCount = 0;	
						
						

char Tips[ TIPS_LINE][ FILENAME_MAX];
						
int ViewTipsLoad( int n )
{						
	static int t;		
	FILE  *fp;			
	int		i;			
	char s[FILENAME_MAX];
	char f[FILENAME_MAX];
					
	if( n < 0 ) return 0;
	if( Hero == NULL ) return 0;

	switch( SCharacterData.nCharacterData[CLASS] )
	{
		case WARRIOR	:	sprintf( f, "./data/warrior_tip%d.txt"	, Hero->name_status.nation );			break;
		case THIEF		:	sprintf( f, "./data/thief_tip%d.txt"	, Hero->name_status.nation );			break;
		case ARCHER		:	sprintf( f, "./data/archer_tip%d.txt"	, Hero->name_status.nation );			break;
		case WIZARD		:	sprintf( f, "./data/wizard_tip%d.txt"	, Hero->name_status.nation );			break;
		case PRIEST		:	sprintf( f, "./data/priest_tip%d.txt"	, Hero->name_status.nation );			break;
		default			:	return 0;
	}

	fp = Fopen( f, "rt" );
	if( fp == NULL )return 0 ;
	int count = 0;		
	while( 1 )			
	{					
		if( fgets( s, FILENAME_MAX, fp ) == NULL ) { fclose(fp); return -1; }
		
		if( *s == ':' ) 
		{
			if( count == n ) break;
			count ++;
		}
	}						
	
	for( i = 0 ; i<  TIPS_LINE  ; i ++) Tips[i][0] = 0;
	for( i = 0 ; i < TIPS_LINE  ; i ++)
	{						
		if( fgets( s, FILENAME_MAX, fp ) == NULL ) { fclose(fp); return -1; }
		if( *s == ':' )  { break; }
		EatRearWhiteChar( s );
		strcpy( Tips[i], s );
	}								
										
	fclose(fp);						
	
	return 1;
}		
	
void ViewTipsPrev( void )
{	
	ViewTipsCount --;
	if( ViewTipsLoad( ViewTipsCount ) )
	{
		PlayListAutoSounds( 64, 0, 0, 0 );
	}
	else ViewTipsCount = 0;
}	
	
void ViewTipsNext( void )
{	
	ViewTipsCount ++;

⌨️ 快捷键说明

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