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

📄 maintitle.cpp

📁 墨香最新私服
💻 CPP
📖 第 1 页 / 共 2 页
字号:
						pStc->SetStaticText( pmsg->mat );						
						((cEditBox*)pDlg->GetWindowForID(MT_DYNAMICPWDEDITBOX))->SetFocusEdit( TRUE );
						((cEditBox*)pDlg->GetWindowForID(MT_DYNAMICPWDEDITBOX))->SetEditText( "" );
					}					
				}
				break;
			case MP_USERCONN_USE_DYNAMIC_NACK:
				{
//					WINDOWMGR->MsgBox( MBI_CANTUSEDYNAMIC, MBT_OK, CHATMGR->GetChatMsg( 702 ) );
//					//msgbox
				}
				break;

			case MP_USERCONN_DIST_CONNECTSUCCESS:
				{
					MSGBASE* pmsg = (MSGBASE*)pMsg;
					m_DistAuthKey = pmsg->dwObjectID;
					SetBlock(FALSE);

					m_bInit = TRUE;
				}
				return;
			case MP_USERCONN_LOGIN_ACK:
				{
					MSG_LOGIN_ACK* pmsg = (MSG_LOGIN_ACK*)pMsg;
					strcpy(g_AgentAddr,pmsg->agentip);
					g_AgentPort = pmsg->agentport;
					m_UserIdx = pmsg->userIdx;
					MAINGAME->SetUserLevel( (int)pmsg->cbUserLevel );
#ifdef _GMTOOL_
					if( pmsg->cbUserLevel == eUSERLEVEL_GM || pmsg->cbUserLevel == eUSERLEVEL_PROGRAMMER
						|| pmsg->cbUserLevel == eUSERLEVEL_DEVELOPER )
						GMTOOLMGR->CanUse( TRUE );
#endif
					if(m_UserIdx == 0)
					{
						__asm int 3;
					}
					gUserID = m_UserIdx;

					m_bDisconntinToDist = TRUE;
					
					/*
					if( NETWORK->IsConnected() )
						NETWORK->Disconnect();
					*/
/*
#ifdef TAIWAN_LOCAL
					cDialog* dlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
					if( !dlg ) return;
					dlg->SetDisable( FALSE );
					dlg->GetWindowForID( MT_BTN_DYNAMIC )->SetActive( TRUE );
					((cCheckBox*)dlg->GetWindowForID( MT_BTN_DYNAMIC ))->SetChecked( FALSE );

					dlg->GetWindowForID( MT_STC_DYNAMIC )->SetActive( TRUE );
					dlg->GetWindowForID( MT_STC_COORD )->SetActive( FALSE );
					dlg->GetWindowForID( MT_STC_COORD_MAT )->SetActive( FALSE );

					((cButton*)dlg->GetWindowForID( MT_OKBTN ))->SetText( RESRCMGR->GetMsg(25), RGB_HALF(255,255,255), RGB_HALF(255,255,0), RGB_HALF(255,255,0) ); //login
#endif
*/

					//Send Msg
					SendOutMsg();
				}
				break;
			case MP_USERCONN_SERVER_NOTREADY:
				{
					NoDisconMsg();
					OnLoginError( LOGIN_ERROR_NODISTRIBUTESERVER, 0 );
				}
				break;

			case MP_USERCONN_LOGIN_NACK:
				{
					g_szHeroIDName[0] = 0;
					MSG_DWORD2* pmsg = (MSG_DWORD2*)pMsg;
					OnLoginError(pmsg->dwData1,pmsg->dwData2);
				}
				break;
			case MP_USERCONN_CHARACTERLIST_ACK:
				{
					SEND_CHARSELECT_INFO* pmsg = (SEND_CHARSELECT_INFO*)pMsg;
#ifdef _CRYPTCHECK_ 
					NETWORK->SetKey( pmsg->eninit, pmsg->deinit );
#endif
					//
					if( NETWORK->IsConnected() ) //弊荤捞 秒家甫 喘范阑 荐档 乐促.
						MAINGAME->SetGameState(eGAMESTATE_CHARSELECT, (void *)pmsg, sizeof(SEND_CHARSELECT_INFO));
				}
				return;
			case MP_USERCONN_CHARACTERLIST_NACK:
				{
					// 纳腐沥焊甫 罐绰单 角菩沁嚼聪促.
					cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(5));
					if( pMsgBox )
						pMsgBox->SetAbsXY( 414, 398 );				
				}
				return;
			case MP_USERCONN_AGENT_CONNECTSUCCESS:
				{
					MSGBASE* pmsg = (MSGBASE*)pMsg;
					/*
					NETWORK->SetCheckSum(pmsg->CheckSum);
					
#ifdef _CRYPTCHECK_ 
					NETWORK->SetKey(pmsg->eninit, pmsg->deinit);
#endif
					*/

//					NETWORK->SetKey(pmsg->eninit, pmsg->deinit);
					
					MSG_DWORD2 msg;
					msg.Category = MP_USERCONN;
					msg.Protocol = MP_USERCONN_CHARACTERLIST_SYN;
					msg.dwData1 = m_UserIdx;
					msg.dwData2 = m_DistAuthKey;
					NETWORK->Send(&msg,sizeof(msg));
					
//					cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_NOBTNMSGBOX, MBT_NOBTN, CHATMGR->GetChatMsg( 291 ) );
//					if( pMsgBox )
//						pMsgBox->SetAbsXY( 414, 398 );
				}
				return;
				/*
			case MP_USERCONN_IDPWAUTH_ACK:
				{
					MSGBASE msg;
					msg.Category = MP_USERCONN;
					msg.Protocol = MP_USERCONN_CHARACTERLIST_SYN;
					NETWORK->Send(&msg,sizeof(msg));
					
//					cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_NOBTNMSGBOX, MBT_NOBTN, CHATMGR->GetChatMsg( 291 ) );
//					if( pMsgBox )
//						pMsgBox->SetAbsXY( 414, 398 );		
				}
				return;
			case MP_USERCONN_VERSIONCHK_ACK:
				{
					m_bVersionCheck = TRUE;
				}
				return;
			case MP_USERCONN_VERSIONCHK_NACK:
				{
					m_bVersionCheck = FALSE;
					cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_VERCHKERROR, MBT_OK, CHATMGR->GetChatMsg(9) );
					if( pMsgBox )
						pMsgBox->SetAbsXY( 414, 398 );
					//LOG(EC_VERSION_CHECK_FAILED);
				}
				return;
			case MP_USERCONN_ADDRESSCHK_ACK:
				{
					m_bAddressValidCheck = TRUE;
				}
				return;
			case MP_USERCONN_ADDRESSCHK_NACK:
				{
					m_bAddressValidCheck = FALSE;
					LOG(EC_IPADDRESS_INVALID_FAILED);
				}
				return;
			case MP_USERCONN_IDPWAUTH_NACK:
				{
					MSG_DWORD *pmsg = (MSG_DWORD *)pMsg;
					//LOG(EC_IDPWAUTH_FAILED);
					cEditBox* pEdit = (cEditBox*)WINDOWMGR->GetWindowForIDEx( MT_PWDEDITBOX );
					pEdit->SetFocusEdit( FALSE );
					//KES 030829 皋技瘤 冠胶肺 荐沥
					cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_PASSERROR, MBT_OK, CHATMGR->GetChatMsg(281) );
					if( pMsgBox )
						pMsgBox->SetAbsXY( 414, 398 );
					//id/pw芒 府靛柯府 趣篮 叼胶俊捞喉肺
					//皋矫瘤 冠胶 努腐矫俊 id/pw厚况林绊 器目胶 id俊 林扁
				}
				return;
			case MP_USERCONN_CONNECTSUCCESS:
				MSGCRYPTDATA* pmsg = (MSGCRYPTDATA*)pMsg;
				NETWORK->SetCheckSum(pmsg->CheckSum);
				NETWORK->SetKey(pmsg->eninit, pmsg->deinit);
				#ifdef _CLIENTVERSIONCHK_
				// 滚傈 眉农
				SendInit();
				#endif
				return ;
				*/
			}
		}
		return;
	}
//	LOG(EC_UNKNOWN_PROTOCOL);
}



void CMainTitle::OnLoginError(DWORD errorcode,DWORD dwParam)
{
	//立加吝涝聪促 皋技瘤冠胶 瘤快扁
	cMsgBox* pMsgBox = (cMsgBox*)WINDOWMGR->GetWindowForID( MBI_WAIT_LOGINCHECK );
	if( pMsgBox )
		WINDOWMGR->AddListDestroyWindow( pMsgBox );

	m_bWaitConnectToAgent = FALSE;
	
	ySWITCH(errorcode)
		yCASE(LOGIN_ERROR_INVALID_VERSION)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(9) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
			SendOutMsg();
			NoDisconMsg();

		yCASE(LOGIN_ERROR_OVERLAPPEDLOGIN)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_OVERLAPPEDLOGIN, MBT_YESNO, CHATMGR->GetChatMsg(8) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
		yCASE(LOGIN_ERROR_OVERLAPPEDLOGININOTHERSERVER)
				char serverName[128] = {0,};
				for(int n=0;n<30;++n)
				{
					if(GAMERESRCMNGR->m_ServerList[n].ServerNo == dwParam)
					{
						strcpy(serverName,GAMERESRCMNGR->m_ServerList[n].ServerName);
						break;
					}
				}
				//SEVERLIST* pServerList = GAMERESRCMNGR->m_ServerList;
				cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_OVERLAPPEDLOGININOTHERSERVER, MBT_OK, CHATMGR->GetChatMsg(1),
													serverName, serverName);
				if( pMsgBox )
					pMsgBox->SetAbsXY( 414, 398 );

		yCASE(LOGIN_ERROR_NOAGENTSERVER)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(7) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
			SendOutMsg();
			NoDisconMsg();
			
		yCASE(LOGIN_ERROR_NODISTRIBUTESERVER)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(7) );
//			if( pMsgBox )
//				pMsgBox->SetAbsXY( 414, 398 );
		yCASE(LOGIN_ERROR_INVALIDUSERLEVEL)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(6));
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
			SendOutMsg();
			NoDisconMsg();

		yCASE(LOGIN_ERROR_DISTSERVERISBUSY)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(674));
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
			SendOutMsg();
			NoDisconMsg();

		yCASE(LOGIN_ERROR_WRONGIDPW)
			cEditBox* pEdit = (cEditBox*)WINDOWMGR->GetWindowForIDEx( MT_PWDEDITBOX );
			pEdit->SetFocusEdit( FALSE );
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_PASSERROR, MBT_OK, CHATMGR->GetChatMsg(281) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			//id/pw芒 府靛柯府 趣篮 叼胶俊捞喉肺
			//皋矫瘤 冠胶 努腐矫俊 id/pw厚况林绊 器目胶 id俊 林扁
		yCASE(LOGIN_ERROR_BLOCKUSERLEVEL)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg( 447 ) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );

			SendOutMsg();
			NoDisconMsg();
			
		yCASE(LOGIN_ERROR_INVALID_IP)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_PASSERROR, MBT_OK, CHATMGR->GetChatMsg( 446 ) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
		yCASE(LOGIN_ERROR_DISTCONNET_ERROR)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_DISTCONNECT_ERROR, MBT_OK, CHATMGR->GetChatMsg(453) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );

		yCASE(LOGIN_ERROR_MAXUSER)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(454) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
		yCASE(LOGIN_ERROR_MINOR_INADULTSERVER)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(443) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );

		yCASE(LOGIN_ERROR_SECEDEDACCOUNT)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(672) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
			
			SendOutMsg();
			NoDisconMsg();
			
		yCASE(LOGIN_ERROR_NOT_CLOSEBETAWINNER)
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_LOGINERRORCLOSE, MBT_OK, CHATMGR->GetChatMsg(438) );
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
		
			SendOutMsg();
			NoDisconMsg();
	yENDSWITCH
}

void CMainTitle::OnDisconnect()
{
	if(m_bDisconntinToDist)		//俊捞怜飘肺 立加阑 困茄 谗辫
	{
		if(NETWORK->ConnectToServer(g_AgentAddr, g_AgentPort) == FALSE)
		{
			cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_VERCHKERROR, MBT_OK, CHATMGR->GetChatMsg(7));
			if( pMsgBox )
				pMsgBox->SetAbsXY( 414, 398 );
		}
		NETWORK->SetCurState(this);
		
		m_bDisconntinToDist = FALSE;
	}
	else if( !m_bNoDiconMsg )	//蜡历狼 碍力 立加 谗澜
	{
		OnLoginError(LOGIN_ERROR_DISTCONNET_ERROR, 0);

		//肺弊牢芒 叼胶俊捞喉 眠啊.
		cDialog* pDlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
		if( pDlg )
		{
			pDlg->SetDisable( TRUE );
		}

		NETWORK->ReleaseKey();
	}

	m_bNoDiconMsg = FALSE;
}

void CMainTitle::ConnectToServer( int index )
{
	if( index > -1 )
	{
		m_pServerListDlg->SetDisable( TRUE );
		
		SEVERLIST* pServerList = GAMERESRCMNGR->m_ServerList;
		if( NETWORK->ConnectToServer( pServerList[index].DistributeIP, pServerList[index].DistributePort ) == FALSE )
		{
			OnLoginError( LOGIN_ERROR_NODISTRIBUTESERVER, 0 );
		}

		m_pServerListDlg->SetDisable( FALSE );
		m_pServerListDlg->SetActive( FALSE );
	}
	m_ConnectionServerNo = index;
} 

void CMainTitle::ShowServerList()
{
	m_bServerList = TRUE;

	cDialog* pDlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
	if( pDlg )
	{
		pDlg->SetDisable( FALSE );
		pDlg->SetActive( FALSE );
	}
	pDlg = WINDOWMGR->GetWindowForID(MT_DYNAMICDLG);
	if( pDlg )
	{
		pDlg->SetDisable( FALSE );
		pDlg->SetActive( FALSE );
	}
	m_bDynamicDlg = FALSE;

	if( NETWORK->IsConnected() )
		NETWORK->Disconnect();
	m_bInit = FALSE;
}

void CMainTitle::StartWaitConnectToAgent( BOOL bStart )
{
	m_dwWaitTime			= gCurTime;
	m_bWaitConnectToAgent	= bStart;
}

⌨️ 快捷键说明

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