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

📄 cbillingplayer.cpp

📁 天之炼狱1服务器端源文件游戏服务端不完整
💻 CPP
📖 第 1 页 / 共 3 页
字号:
#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Login : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Login : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}#elif defined(__GAME_SERVER__)// send interval validation packetvoid CBillingPlayer::sendIntervalValidation()	throw ( ProtocolException, Error ){	__BEGIN_TRY	CBillingPacketHeader header;	CBillingPacketRequestIntervalValidationBody body;	header.Packet_Type	= CBILLING_PACKET_REQUEST;	header.Method_Code	= CBILLING_METHOD_CODE_INTERVAL_VALIDATION;	header.Session_ID	= 1;	header.Body_Length	= szCBillingPacketRequestIntervalValidationBodyInfo;	header.write( *m_pOutputStream );	body.write( *m_pOutputStream );#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Interval Validation : " << body.Parameter_Value << " min" << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Interval Validation : %s\n%s\n%s", body.Parameter_Value, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}// send login packetvoid CBillingPlayer::sendLogin( GamePlayer* pGamePlayer )	throw ( ProtocolException, Error ){	__BEGIN_TRY	CBillingPacketHeader header;	CBillingPacketRequestLoginBody body;	header.Packet_Type	= CBILLING_PACKET_REQUEST;	header.Method_Code	= CBILLING_METHOD_CODE_LOGIN;	header.Session_ID	= pGamePlayer->increaseSendID();	header.Body_Length	= szCBillingPacketRequestLoginBodyInfo;	strcpy( body.Login_Name, pGamePlayer->getID().c_str() );	strcpy( body.Player_IP, pGamePlayer->getSocket()->getHost().c_str() );	char macstring[20];	const BYTE* macaddress = pGamePlayer->getMacAddress();	sprintf( macstring, "%02X:%02X:%02X:%02X:%02X:%02X", macaddress[0], macaddress[1], macaddress[2], macaddress[3], macaddress[4], macaddress[5] );	strcpy( body.Player_MAC, macstring );	header.write( *m_pOutputStream );	body.write( *m_pOutputStream );#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Login : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Login : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}// send minus point packetvoid CBillingPlayer::sendMinusPoint( GamePlayer* pGamePlayer )	throw ( ProtocolException, Error ){	__BEGIN_TRY	CBillingPacketHeader header;	CBillingPacketRequestMinusPointBody body;	header.Packet_Type	= CBILLING_PACKET_REQUEST;	header.Method_Code	= CBILLING_METHOD_CODE_MINUS_POINT;	header.Session_ID	= pGamePlayer->increaseSendID();	header.Body_Length	= szCBillingPacketRequestMinusPointBodyInfo;	strcpy( body.Login_Name, pGamePlayer->getID().c_str() );	header.write( *m_pOutputStream );	body.write( *m_pOutputStream );#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Minus Point : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Minus Point : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}// send minus minute packetvoid CBillingPlayer::sendMinusMinute( GamePlayer* pGamePlayer )	throw ( ProtocolException, Error ){	__BEGIN_TRY	CBillingPacketHeader header;	CBillingPacketRequestMinusMinuteBody body;	header.Packet_Type	= CBILLING_PACKET_REQUEST;	header.Method_Code	= CBILLING_METHOD_CODE_MINUS_MINUTE;	header.Session_ID	= pGamePlayer->increaseSendID();	header.Body_Length	= szCBillingPacketRequestMinusMinuteBodyInfo;	strcpy( body.Login_Name, pGamePlayer->getID().c_str() );	header.write( *m_pOutputStream );	body.write( *m_pOutputStream );#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Minus Minute : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Minus Minute : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}// send logout packetvoid CBillingPlayer::sendLogout( GamePlayer* pGamePlayer )	throw ( ProtocolException, Error ){	__BEGIN_TRY	CBillingPacketHeader header;	CBillingPacketRequestLogoutBody body;	header.Packet_Type	= CBILLING_PACKET_REQUEST;	header.Method_Code	= CBILLING_METHOD_CODE_LOGOUT;	header.Session_ID	= pGamePlayer->increaseSendID();	header.Body_Length	= szCBillingPacketRequestLogoutBodyInfo;	strcpy( body.Login_Name, pGamePlayer->getID().c_str() );	header.write( *m_pOutputStream );	body.write( *m_pOutputStream );#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Request Logout : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PLAYER, "Request Logout : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}#endifvoid CBillingPlayer::executeError( CBillingPacketHeader& header, CBillingPacketErrorBody& body )	throw ( IOException, Error ){	__BEGIN_TRY#ifdef __LOGIN_SERVER__	__ENTER_CRITICAL_SECTION( (*g_pLoginPlayerManager) )	LoginPlayer* pLoginPlayer = g_pLoginPlayerManager->getPlayer_NOLOCKED( body.Login_Name );	if ( pLoginPlayer != NULL )	{		// 八刘 登菌促绊 眉农茄促. 蜡丰 荤侩磊啊 酒聪骨肺 CLSelectPC 俊辑 漏赴促.		pLoginPlayer->setCBillingVerified();	}	__LEAVE_CRITICAL_SECTION( (*g_pLoginPlayerManager) )#elif defined(__GAME_SERVER__)	// 蜡丰 场车促 漏妨扼~	__ENTER_CRITICAL_SECTION( (*g_pPCFinder) )	Creature* pCreature = g_pPCFinder->getCreatureByID_LOCKED( body.Login_Name );	if ( pCreature != NULL )	{		GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pCreature->getPlayer());		Assert( pGamePlayer != NULL );		pGamePlayer->setPayPlayer( false );	}	__LEAVE_CRITICAL_SECTION( (*g_pPCFinder) )	logPacket( &header, NULL, NULL, NULL, &body );#endif#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Response Error : " << body.Login_Name << endl;	cout << body.Return_Message << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PACKET, "Response Error : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}#ifdef __LOGIN_SERVER__void CBillingPlayer::executeLogin( CBillingPacketHeader& header, CBillingPacketResponseLoginBody& body )	throw ( IOException, Error ){	__BEGIN_TRY	__ENTER_CRITICAL_SECTION( (*g_pLoginPlayerManager) )	try	{		LoginPlayer* pLoginPlayer = g_pLoginPlayerManager->getPlayer_NOLOCKED( body.Login_Name );		if ( pLoginPlayer != NULL )		{			// 八刘 登菌促绊 眉农茄促.			pLoginPlayer->setCBillingVerified();			bool bPayPlayer = ( body.Free_Left_Time + body.Rating_Left_Time > 0 );			// set pay player			pLoginPlayer->setPayPlayer( bPayPlayer );		}	}	catch ( NoSuchElementException& nsee )	{		// ignore	}	__LEAVE_CRITICAL_SECTION( (*g_pLoginPlayerManager) )#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Response Login OK : " << body.Login_Name << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}#elif defined(__GAME_SERVER__)void CBillingPlayer::executeIntervalValidation( CBillingPacketHeader& header, CBillingPacketResponseIntervalValidationBody& body )	throw ( IOException, Error ){	__BEGIN_TRY	if ( atoi(body.Parameter_Value) != g_pCBillingPlayerManager->getMinusIntervalInt() )	{		// 霸烙辑滚客 吝惫 呼傅 辑滚埃俊 minus interval 捞 嘎瘤 臼促. 磷绢具 茄促.		cerr << "-------------------------------------------------------------------------------" << endl;		cerr << "Interval configuration is different between gameserver and china billing server" << endl;		cerr << "gameserver interval : " << g_pCBillingPlayerManager->getMinusIntervalInt() << ", china billing server interval : " << body.Parameter_Value << endl;		cerr << "-------------------------------------------------------------------------------" << endl;		filelog( LOGFILE_CBILLING_ERROR, "Different Interval between gameserver and china billing server\ngameserver interval : %d, china billing server interval : %s", g_pCBillingPlayerManager->getMinusIntervalInt(), body.Parameter_Value );		// 磷绢扼. 孺孺 ばば.		kill( getpid(), 9 );	}#ifdef __COUT_CBILLING_SYSTEM__	cout << "----------------------------------------------------------------" << endl;	cout << "Response Interval Validation : " << body.Parameter_Value << endl;	cout << header.toString().c_str() << endl;	cout << body.toString().c_str() << endl;#endif	filelog( LOGFILE_CBILLING_PACKET, "Response Interval Validation : %s\n%s\n%s", body.Parameter_Value, header.toString().c_str(), body.toString().c_str() );	__END_CATCH}void CBillingPlayer::executeLogin( CBillingPacketHeader& header, CBillingPacketResponseLoginBody& body )	throw ( IOException, Error ){	__BEGIN_TRY	// disconnect if no Left Time	__ENTER_CRITICAL_SECTION( (*g_pPCFinder) )	Creature* pCreature = g_pPCFinder->getCreatureByID_LOCKED( body.Login_Name );	if ( pCreature != NULL )	{		GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pCreature->getPlayer());		if ( pGamePlayer == NULL )		{			g_pPCFinder->unlock();			Assert( false );		}		// 八刘 登菌促绊 眉农茄促.		pGamePlayer->setCBillingVerified();		// set CBillingInfo		pGamePlayer->setCBPlayerType( body.Player_Type );		pGamePlayer->setCBPayType( body.Pay_Type );		if ( pGamePlayer->getCBPlayerType() == CBILLING_PLAYER_TYPE_MONTHLY )		{			VSDateTime endDateTime = VSDateTime::fromYYYYMMDDHHMMSS( body.End_Date_Time );			pGamePlayer->setCBEndDateTime( endDateTime );		}		else if ( pGamePlayer->getCBPlayerType() == CBILLING_PLAYER_TYPE_POINT )		{			pGamePlayer->setCBLeftTime( body.Free_Left_Time + body.Rating_Left_Time );		}		// set false pay player. ZonePlayerManager will disconnect this player.		if ( body.Free_Left_Time + body.Rating_Left_Time == 0 )		{			pGamePlayer->setPayPlayer( false );#ifdef __COUT_CBILLING_SYSTEM__			cout << "----------------------------------------------------------------" << endl;			cout << "Response Login OK : " << body.Login_Name << " has no left time. DISCONNECT" << endl;			cout << header.toString().c_str() << endl;			cout << body.toString().c_str() << endl;#endif			filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s has no left time. DISCONNECT\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );		}		else		{#ifdef __COUT_CBILLING_SYSTEM__			cout << "----------------------------------------------------------------" << endl;			cout << "Response Login OK : " << body.Login_Name << endl;			cout << header.toString().c_str() << endl;			cout << body.toString().c_str() << endl;#endif			filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );		}//		char m[100];//		sprintf( m, "Free Left Point : %d.%d Left Point %d.%d", body.Free_Left_Time / 10, body.Free_Left_Time % 10, body.Rating_Left_Time / 10, body.Rating_Left_Time % 10 );//		GCSystemMessage msg;//		msg.setMessage( m );//		pGamePlayer->sendPacket( &msg );	}	else	{#ifdef __COUT_CBILLING_SYSTEM__		cout << "----------------------------------------------------------------" << endl;		cout << "Response Login OK : " << body.Login_Name << endl;		cout << header.toString().c_str() << endl;		cout << body.toString().c_str() << endl;#endif		filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );	}	__LEAVE_CRITICAL_SECTION( (*g_pPCFinder) )	logPacket( &header, &body, NULL, NULL, NULL );	__END_CATCH}void CBillingPlayer::executeMinusPoint( CBillingPacketHeader& header, CBillingPacketResponseMinusPointBody& body )	throw ( IOException, Error ){	__BEGIN_TRY	__ENTER_CRITICAL_SECTION( (*g_pPCFinder) )	Creature* pCreature = g_pPCFinder->getCreatureByID_LOCKED( body.Login_Name );

⌨️ 快捷键说明

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