void MMatchServer::OnAsyncCreateChar(MAsyncJob* pJobResult)
{
	MAsyncDBJob_CreateChar* pJob = (MAsyncDBJob_CreateChar*)pJobResult;

	if (pJob->GetResult() != MASYNC_RESULT_SUCCEED) {
		char szTime[128]="";
		_strtime(szTime);

		mlog("[%s] Async DB Query(CreateChar) Failed\n", szTime);
		return;
	}		

	MMatchObject* pObj = GetObject(pJob->GetUID());
	if (pObj == NULL) return;

	// Make Result
	MCommand* pNewCmd = CreateCommand(MC_MATCH_RESPONSE_CREATE_CHAR, MUID(0,0));
	pNewCmd->AddParameter(new MCommandParameterInt(pJob->GetDBResult()));			// result
	pNewCmd->AddParameter(new MCommandParameterString(pJob->GetCharName()));	// 만들어진 캐릭터 이름

	RouteToListener( pObj, pNewCmd );
}
Пример #2
0
void MMatchServer::OnAdminTerminal(const MUID& uidAdmin, const char* szText)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (pObj == NULL) return;

	// 관리자 권한을 가진 사람이 아니면 연결을 끊는다.
	if (!IsAdminGrade(pObj))
	{
//		DisconnectObject(uidAdmin);		
		return;
	}

	char szOut[32768]; szOut[0] = 0;

	if (m_Admin.Execute(uidAdmin, szText))
	{
		MCommand* pNew = CreateCommand(MC_ADMIN_TERMINAL, MUID(0,0));
		pNew->AddParameter(new MCmdParamUID(MUID(0,0)));
		pNew->AddParameter(new MCmdParamStr(szOut));
		RouteToListener(pObj, pNew);
	}
}
void MMatchServer::OnAsyncGetAccountCharList(MAsyncJob* pJobResult)
{
	MAsyncDBJob_GetAccountCharList* pJob = (MAsyncDBJob_GetAccountCharList*)pJobResult;

	if (pJob->GetResult() != MASYNC_RESULT_SUCCEED) {
		char szTime[128]="";
		_strtime(szTime);

		mlog("[%s] Async DB Query(ResponseAccountCharList) Failed\n", szTime);
		return;
	}		

	MMatchObject* pObj = GetObject(pJob->GetUID());
	if (pObj == NULL) 
		return;

	const int					nCharCount		= pJob->GetCharCount();
	const MTD_AccountCharInfo * pCharList		= pJob->GetCharList();
	MTD_AccountCharInfo*		pTransCharInfo	= NULL;
	int							nCharMaxLevel	= 0;

	MCommand* pNewCmd = CreateCommand(MC_MATCH_RESPONSE_ACCOUNT_CHARLIST, MUID(0,0));
	void* pCharArray = MMakeBlobArray(sizeof(MTD_AccountCharInfo), nCharCount);

	for (int i = 0; i < nCharCount; i++)
	{
		pTransCharInfo = (MTD_AccountCharInfo*)MGetBlobArrayElement(pCharArray, i);
		memcpy(pTransCharInfo, &pCharList[i], sizeof(MTD_AccountCharInfo));

		nCharMaxLevel = max(nCharMaxLevel, pTransCharInfo->nLevel);
	}

	pObj->CheckNewbie( nCharMaxLevel );

	pNewCmd->AddParameter(new MCommandParameterBlob(pCharArray, MGetBlobArraySize(pCharArray)));
	MEraseBlobArray(pCharArray);
    
	RouteToListener( pObj, pNewCmd );
}