Esempio n. 1
0
/*void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				
				}
			}
		}


	
	}
}*/
void OffTradeLogin(int aIndex,LPBYTE aRecv)
{
	PMSG_IDPASS *lpMsg = (PMSG_IDPASS*)aRecv;

	char AccountID[11];
	AccountID[10] = 0;
	memcpy(AccountID,lpMsg->Id,sizeof(lpMsg->Id));
	BuxConvert(AccountID,10);

	for(int i = OBJECT_MIN; i<OBJECT_MAX;i++)
	{
		OBJECTSTRUCT *lpObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);

		if(lpObj->Connected == 3)
		{
			if(!strcmp(AccountID,lpObj->AccountID))
			{
				if(OfflineShop[i].IsOffTrade == 1)
				{
					GJPUserClose(lpObj->AccountID);
					g_Console.ConsoleOutput(4,"[OFFTRADE][%s][%s] Close Offline Shop",lpObj->AccountID,lpObj->Name);
					//LogAdder ("OFFTRADE","Close Offline Shop",i);
					gObjDel(i);
					OfflineShop[i].IsOffTrade = 0;
					//SQL.OffTradeOff(aIndex);
				}
			}
		}
	}
}
Esempio n. 2
0
void JGGetCharacterInfo(LPSDHP_DBCHARINFOREQUEST lpMsg,int aIndex)
{
	SDHP_DBCHAR_INFORESULT pResult;

	PHeadSetW((LPBYTE)&pResult, 0x06, sizeof(pResult));

	char szAccountID[MAX_IDSTRING+1]={0};
	char szName[MAX_IDSTRING+1]={0};
	BuxConvert(lpMsg->Name, 10);

	memcpy(szAccountID, lpMsg->AccountID, MAX_IDSTRING);
	memcpy(szName, lpMsg->Name, MAX_IDSTRING);

	memcpy(pResult.AccountID, szAccountID, MAX_IDSTRING);
	memcpy(pResult.Name, szName, MAX_IDSTRING);

	pResult.Number = lpMsg->Number;

	pResult.result = GetCharacterInfo(szAccountID,szName,&pResult);

	if( pResult.result )
	{
		PartyMatchUpdateServerInfo(gSObj[aIndex].ServerCode, szName);
		
		UpdateGameIDC(szAccountID, szName);
	}

	DataSend(aIndex,(LPBYTE)&pResult,sizeof(pResult));

	if(pResult.result == TRUE)
	{
		SDHP_SKILLKEYDATA_SEND pSkillData = {0};

		pSkillData.h.c = PMHC_BYTE;
		pSkillData.h.size = sizeof( pSkillData );
		pSkillData.h.headcode = 0x60;

		memcpy(pSkillData.Name, szName, MAX_IDSTRING);
		pSkillData.aIndex = lpMsg->Number;

		GetOptionData(szName,&pSkillData);

		DataSend(aIndex,(LPBYTE)&pSkillData,pSkillData.h.size);

		MUBOT_SETTINGS_SEND pMuBot = {0};
		pMuBot.h.c = PMHC_WORD;
		pMuBot.h.sizeH = SET_NUMBERH(sizeof(pMuBot));
		pMuBot.h.sizeL = SET_NUMBERL(sizeof(pMuBot));
		pMuBot.h.headcode = 0x61;

		strcpy(pMuBot.szName,szName);
		pMuBot.aIndex = lpMsg->Number;
		GetMuBotData(szName,&pMuBot);
		DataSend(aIndex,(LPBYTE)&pMuBot,sizeof(pMuBot));
	}
}
Esempio n. 3
0
void CSVersionHttpRecv(LPPMSG_VERSION lpMsg,int aIndex)
{
    ////LogAddC(3,"RECV VERSION[%d.%02d.%02d]",lpMsg->Version1,lpMsg->Version2,lpMsg->Version3);
    ////LogAddC(3,"HTTP VERSION[%d.%02d.%02d]",HttpServer.Version1,HttpServer.Version2,HttpServer.Version3);

    if( lpMsg->Version1 == FtpServer.Version1 &&
            lpMsg->Version2 == FtpServer.Version2 &&
            lpMsg->Version3 == FtpServer.Version3 )
    {
        PMSG_CONNECTRESULT	pMsg;

        pMsg.h.c		= PMHC_BYTE;
        pMsg.h.headcode = 0x02;
        pMsg.h.size		= sizeof(pMsg);
        pMsg.result		= 0;

        IoSend(aIndex, (LPBYTE)&pMsg, pMsg.h.size);
        return;
    }

    PMSG_FILESERVERINFO pMsg;
    pMsg.h.c = PMHC_BYTE;
    pMsg.h.headcode = 0x06;
    pMsg.h.size = sizeof(pMsg);

    pMsg.Version[0] = HttpServer.Version1;
    pMsg.Version[1] = HttpServer.Version2;
    pMsg.Version[2] = HttpServer.Version3;

    strcpy(pMsg.IpAddress,HttpServer.Adress);
    strcpy(pMsg.Id,"");
    strcpy(pMsg.Pass,"");
    strcpy(pMsg.Folder,HttpServer.VersionFileName);

    pMsg.Port = 0;

    BuxConvert(pMsg.IpAddress, 100);
    BuxConvert(pMsg.Id,   20);
    BuxConvert(pMsg.Pass, 20);
    BuxConvert(pMsg.Folder,  20);

    IoSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Esempio n. 4
0
void ConnectEx::SendGame(int UserIndex)
{
	/*if(		g_License.GetLicenseID() != Customer::Zeon
		&&	g_License.GetLicenseID() != Customer::Refinery
		&&	g_License.GetLicenseID() != Customer::Bereznuk
		&&	g_License.GetLicenseID() != Customer::Reedlan
		&&	g_License.GetLicenseID() != Customer::MUAngel
		&&	g_License.GetLicenseID() != Customer::MUAngel2
		&&	g_License.GetLicenseID() != Customer::White
		&&	g_License.GetLicenseID() != Customer::White2 
		&&  g_License.GetLicenseID() != Customer::drynea 
		&&  g_License.GetLicenseID() != Customer::virnet )
	{
		return;
	}*/
	// ----
	gObj[UserIndex].m_ConnectEx = false;
	DataServerGetCharListRequest(UserIndex);
	// ----
	if ( !PacketCheckTime2(&gObj[UserIndex]))
	{
		return;
	}
	// ----
	if ( !gObjIsAccontConnect(UserIndex, gObj[UserIndex].AccountID))
	{
		return;
	}
	// ----
	if ( gObj[UserIndex].Connected == PLAYER_PLAYING )
	{
		return;
	}
	// ----
	gObj[UserIndex].bEnableDelCharacter = FALSE;
	// ----
	char _name[MAX_ACCOUNT_LEN+1];
	SDHP_DBCHARINFOREQUEST pCRequest;
	// ----
	PHeadSetB((LPBYTE)&pCRequest, 0x06, sizeof(pCRequest));
	memset(_name, 0, MAX_ACCOUNT_LEN);
	memcpy(_name, gObj[UserIndex].Name, MAX_ACCOUNT_LEN);
	BuxConvert(_name, MAX_ACCOUNT_LEN);
	memcpy(pCRequest.Name, _name, MAX_ACCOUNT_LEN);
	strcpy(pCRequest.AccountID, gObj[UserIndex].AccountID);
	pCRequest.Number = UserIndex;
	// ----
	cDBSMng.Send((char*)&pCRequest, pCRequest.h.size);
}
Esempio n. 5
0
void CFileServerInfoMake()
{
	PMSG_FILESERVERINFO	pMsg={0};
	PHeadSetB((LPBYTE)&pMsg, 1, sizeof(pMsg));

	pMsg.Version[0] = serverManager.ClientV2;
	pMsg.Version[1] = serverManager.ClientV3;
	//pMsg.Version[2] = serverManager.ClientV3;

	// FTP
	strcpy( pMsg.IpAddress,	serverManager.FTP.Address );
	strcpy( pMsg.FtpId,		serverManager.FTP.ID );
	strcpy( pMsg.FtpPass,	serverManager.FTP.Password );\
	strcpy( pMsg.Folder,	serverManager.FTP.Folder );
	
	pMsg.Port = serverManager.FTP.Port;

	BuxConvert(pMsg.IpAddress, 100);
	BuxConvert(pMsg.FtpId,   20);
	BuxConvert(pMsg.FtpPass, 20);
	BuxConvert(pMsg.Folder,  20);

	memcpy( serverManager.szFileServerInfoSendBuffer, (char*)&pMsg, sizeof(pMsg) );
	serverManager.nFileServerInfoBufferLen = sizeof( pMsg );
	
	// HTTP
	pMsg.h.headcode = 0x04;
	strcpy( pMsg.IpAddress,	serverManager.http.Address );
	strcpy( pMsg.FtpId,		serverManager.http.ID );
	strcpy( pMsg.FtpPass,	serverManager.http.Password );
	strcpy( pMsg.Folder,	serverManager.http.Folder );	
	pMsg.Port = serverManager.http.Port;

	BuxConvert(pMsg.IpAddress, 100);
	BuxConvert(pMsg.FtpId,   20);
	BuxConvert(pMsg.FtpPass, 20);
	BuxConvert(pMsg.Folder,  20);

	memcpy( serverManager.szHTTPFileServerInfoSendBuffer, (char*)&pMsg, sizeof(pMsg) );
	serverManager.nHTTPFileServerInfoBufferLen = sizeof( pMsg );
}
Esempio n. 6
0
//========================================================================================================================
void CSPJoinIdPassRequest(LPBYTE aRecv,int aIndex)
{
	char id[11];
	int isOff = 0;

	PMSG_IDPASS *lpMsg = (PMSG_IDPASS *)aRecv;

	id[10]=0;
	memcpy(id, lpMsg->Id, sizeof(lpMsg->Id));
	BuxConvert(id, MAX_ACCOUNT_LEN);

	for(int i=OBJECT_MIN;i<OBJECT_MAX;i++)
	{	
		OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(i);
		if(gObj->Connected == 3)
		{
			if(_tcsstr(gObj->AccountID, id))
			{	
				if(OfflineShop[i].IsOffTrade != 0)
				{	
					OfflineShop[i].IsOffTrade = 1;
					ObjGameClose(i);
					CloseClient(i);
					isOff=1;
					
				}
			//	Log.outError("Already here[%d]",i);
			}
		}
	}


	if(isOff)
	{	
		OfflineLogin[aIndex].aRecv = aRecv;
		OfflineLogin[aIndex].aIndex = aIndex;
		_beginthread( Login_Timer, 0, NULL  );
	}
	else
	{
		GCSPJoinIdPassRequest(lpMsg,aIndex);
	}
}
Esempio n. 7
0
void ConnectEx::SendGame(int UserIndex)
{
	
	// ----
	gObj[UserIndex].m_ConnectEx = false;
	DataServerGetCharListRequest(UserIndex);
	// ----
	if ( !PacketCheckTime2(&gObj[UserIndex]))
	{
		return;
	}
	// ----
	if ( !gObjIsAccontConnect(UserIndex, gObj[UserIndex].AccountID))
	{
		return;
	}
	// ----
	if ( gObj[UserIndex].Connected == PLAYER_PLAYING )
	{
		return;
	}
	// ----
	gObj[UserIndex].bEnableDelCharacter = FALSE;
	// ----
	char _name[MAX_ACCOUNT_LEN+1];
	SDHP_DBCHARINFOREQUEST pCRequest;
	// ----
	PHeadSetB((LPBYTE)&pCRequest, 0x06, sizeof(pCRequest));
	memset(_name, 0, MAX_ACCOUNT_LEN);
	memcpy(_name, gObj[UserIndex].Name, MAX_ACCOUNT_LEN);
	BuxConvert(_name, MAX_ACCOUNT_LEN);
	memcpy(pCRequest.Name, _name, MAX_ACCOUNT_LEN);
	strcpy(pCRequest.AccountID, gObj[UserIndex].AccountID);
	pCRequest.Number = UserIndex;
	// ----
	cDBSMng.Send((char*)&pCRequest, pCRequest.h.size);
}
Esempio n. 8
0
void JGAnsMapSvrAuth(PMSG_ANS_MAPSVRAUTH * lpMsg)
{
	if ( !OBJMAX_RANGE(lpMsg->iIndex))
	{
		LogAddC(2, "[MapServerMng] Packet Error JG [0x7B] - Index out of bound : %d",
			lpMsg->iIndex);
		
		return;
	}

	LPOBJ lpObj = &gObj[lpMsg->iIndex];
	memcpy(lpObj->Name, lpMsg->szCharName, MAX_ACCOUNT_LEN);


	if ( lpObj->m_bMapSvrMoveReq == false )
	{
		LogAddC(2, "[MapServerMng] MapSvr MoveReq Error JG [0x7B] - No Request [%s] (%d)",
			lpObj->AccountID, lpObj->m_Index);

		gObjDel(lpMsg->iIndex);
		return;
	}

	BOOL bAuthOK = FALSE;
	int iSendResult = 0;
	char szId[11];
	char szJN[21] = "";
	int iIndex = lpMsg->iIndex;
	SDHP_DBCHARINFOREQUEST pMsg;
	char szName[11];

	memset(szId, 0, sizeof(szId));
	memcpy(szId, lpMsg->szAccountID, MAX_ACCOUNT_LEN);
	memcpy(szJN, lpMsg->cJoominNumber, sizeof(lpMsg->cJoominNumber));
	
	switch ( lpMsg->iResult )
	{
		case 0:
			iSendResult = 0;
			bAuthOK = FALSE;

			if ( !gObjSetAccountLogin(iIndex, szId, lpMsg->iUserNumber, lpMsg->iDBNumber, szJN))
			{
				GJPAccountFail(iIndex, szId, lpMsg->iDBNumber, lpMsg->iUserNumber);
				lpMsg->iResult = 4;
			}
			else
			{
				LogAddTD(lMsg.Get(MSGGET(1, 211)), gObj[iIndex].Ip_addr, szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
				iSendResult = 1;
				bAuthOK = TRUE;
			}

			if ( lpMsg->iUserNumber == 0 && lpMsg->iDBNumber == 0 )
			{
				LogAddTD(lMsg.Get(MSGGET(1, 212)), szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
			}

			switch ( lpMsg->btBlockCode )
			{
				case 70:	// 0x46
					gObj[iIndex].m_cAccountItemBlock = 1;
					break;
			}
			break;

		default:
			iSendResult = 0;
			bAuthOK = FALSE;
			break;
	}

	GCAnsMapSvrAuth(iIndex, iSendResult);

	if ( bAuthOK == FALSE )
	{
		LogAddC(2, "[MapServerMng] [%s][%s] JG [0x7B] - Join Result Failed : RST:%d, BLK:%c",
			szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);
		gObjDel(lpMsg->iIndex);

		return;
	}
	
	gObj[iIndex].m_sPrevMapSvrCode = lpMsg->wPrevMapSvrCode;
	gObj[iIndex].m_sDestMapNumber  = lpMsg->wMapNumber;
	gObj[iIndex].m_btDestX = lpMsg->btX;
	gObj[iIndex].m_btDestY = lpMsg->btY;
	gObj[iIndex].bEnableDelCharacter = FALSE;

#if (ENABLETEST_ARCA == 1)
	if( g_ArcaBattle.IsArcaBattleServer() )
    {
          g_ArcaBattle.SendArcaBattlePlayInfo(gObj[iIndex], 1);
          g_ArcaBattle.SendArcaBattleCurrentState(gObj[iIndex]);
    }
#endif

	PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
	memset(szName, 0, sizeof(szName));
	memcpy(szName, lpMsg->szCharName, MAX_ACCOUNT_LEN);
	BuxConvert(szName, MAX_ACCOUNT_LEN);
	memcpy(pMsg.Name, szName, MAX_ACCOUNT_LEN);
	strcpy(pMsg.AccountID, lpMsg->szAccountID);
	pMsg.Number = lpObj->m_Index;

	cDBSMng.Send((PCHAR)&pMsg, pMsg.h.size);

	LogAddTD("[MapServerMng] [%s][%s] JG [0x7B] - Join Result OK : RST:%d, BLK:%c",
		szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);

}
Esempio n. 9
0
void ConnectEx::SendLogin(int UserIndex, CONNECTEX_LOGIN * Data)
{
	/*if(		g_License.GetLicenseID() != Customer::Zeon
		&&	g_License.GetLicenseID() != Customer::Refinery
		&&	g_License.GetLicenseID() != Customer::Bereznuk
		&&	g_License.GetLicenseID() != Customer::Reedlan
		&&	g_License.GetLicenseID() != Customer::MUAngel
		&&	g_License.GetLicenseID() != Customer::MUAngel2 
		&&	g_License.GetLicenseID() != Customer::White
		&&	g_License.GetLicenseID() != Customer::White2 
		&&  g_License.GetLicenseID() != Customer::drynea 
		&&  g_License.GetLicenseID() != Customer::virnet )
	{
		return;
	}*/
	// ----
	BuxConvert(Data->AccountID, MAX_ACCOUNT_LEN);
	BuxConvert(Data->Password, MAX_ACCOUNT_LEN);
	// ----
	char id[11];
	id[10]=0;
	memcpy(id, Data->AccountID, sizeof(Data->AccountID));
	BuxConvert(id, MAX_ACCOUNT_LEN);
	// ----
	GJPUserClose(id); //Force connection
	// ----
	if( bCanConnectMember == TRUE )
	{
		if( ConMember.IsMember(id) == FALSE )
		{
			GCJoinResult(JS_ONLY_VIP_MEMBERS, UserIndex);
			return;
		}
	}
	// ----
	LPOBJ lpObj = &gObj[UserIndex];
	// ----
	if( gObj[UserIndex].Connected != PLAYER_CONNECTED )
	{
		LogAdd(lMsg.Get(MSGGET(1, 218)), UserIndex, id);
		CloseClient(UserIndex);
		return;
	}
	// ----
	if( gObj[UserIndex].LoginMsgSnd != FALSE )
	{
		if( gObj[UserIndex].LoginMsgSnd == TRUE )
		{
			LogAdd(lMsg.Get(MSGGET(1, 219)), UserIndex, id, gObj[UserIndex].Ip_addr );
		}
		else
		{
			LogAdd("error : %d %s %d", gObj[UserIndex].LoginMsgSnd, __FILE__, __LINE__);
		}

		return;
	}
	// ----
	if( lpObj->Connected >= PLAYER_LOGGED )
	{
		return;
	}
	// ----
	SDHP_IDPASS spMsg;
	// ----
	PHeadSetB((LPBYTE)&spMsg, 0x01, sizeof(spMsg));
	spMsg.Number = UserIndex;
	memcpy(spMsg.Id, Data->AccountID, sizeof(spMsg.Id));
	memcpy(spMsg.Pass, Data->Password, sizeof(spMsg.Pass));
	strcpy(spMsg.IpAddress, gObj[UserIndex].Ip_addr);
	gObj[UserIndex].CheckTick = Data->TickCount;
	gObj[UserIndex].CheckTick2 = GetTickCount();
	gObj[UserIndex].ConnectCheckTime = GetTickCount();
	gObj[UserIndex].CheckSpeedHack = true;
	gObj[UserIndex].LoginMsgSnd = 1;
	gObj[UserIndex].LoginMsgCount = 1;
	gObj[UserIndex].AccountID[MAX_ACCOUNT_LEN] = 0;
	gObj[UserIndex].Name[MAX_ACCOUNT_LEN] = 0;
	memcpy(gObj[UserIndex].AccountID, id, MAX_ACCOUNT_LEN);
	memcpy(gObj[UserIndex].Name, Data->Name, MAX_ACCOUNT_LEN);
	gObj[UserIndex].m_cAccountItemBlock = 0;
	gObj[UserIndex].m_ConnectEx = true;
	gObj[UserIndex].ukn_30 = 0;
	// ----
	wsJServerCli.DataSend((char*)&spMsg, spMsg.h.size);
	LogAddTD("join send : (%d)%s", UserIndex, gObj[UserIndex].AccountID);
	lpObj->m_bMapSvrMoveReq = false;
	lpObj->m_sPrevMapSvrCode = -1; 
	lpObj->m_sDestMapNumber = -1;
	lpObj->m_btDestX = 0;
	lpObj->m_btDestY = 0;
}
Esempio n. 10
0
void GJJoinIdPassRequest(LPSDHP_IDPASS lpMsgIdPass,int aIndex )
{
	char szId[MAX_IDSTRING+1];
#if (S6EP2 == 1 || EX700==1)
	char szPass[20+1];
#else
	char szPass[MAX_IDSTRING+1];
#endif
	char szIpAddress[17];
	char szJoominNumber[21]="";
	BYTE result=0x01;
	int  sbOfs=0;
	int  vNumber=0;
	int  UserNumber=-1;
	int  DBNumber;	
	SDHP_IDPASSRESULT	spResult;

	memset(szId,   0, sizeof(szId));
	memset(szPass, 0, sizeof(szPass));
	memset(szIpAddress, 0, sizeof(szIpAddress));

	memcpy(szId,lpMsgIdPass->Id,MAX_IDSTRING);
	memcpy(szPass,lpMsgIdPass->Pass,20);


	BuxConvert(szId, MAX_IDSTRING);
	BuxConvert(szPass, 20);

	char Block='0';

	if( SQLSyntexCheck(szId) == FALSE || SQLSyntexCheck(szPass) == FALSE || SpaceSyntexCheck(szId) == FALSE)
	{
		result = 0x02;
	}
	else
	{

		EnterCriticalSection(&g_JSData.m_critJoinUser);

		int nRet = IsUser(szId,szPass,szJoominNumber,Block,DBNumber);

		if( nRet == 0 )
		{
			result = 0;
		}

		if(gObjSearchUser(szId) == -1)
		{
			if( nRet == 1 && Block > '0' )
			{
				if( Block == 'A' )
				{
					result=0x0E;
				}
				else if( Block == 'B' )
				{
					result=0x0F;
				}
				else result=0x05;
			}
			else if(nRet == 1)
			{
				UserNumber = gObjAdd(szId,szPass,DBNumber,aIndex,lpMsgIdPass->IpAddress,lpMsgIdPass->Number);

				if(UserNumber < 0)
				{
					result = 0x04;
				}
				else
				{
					gObj[UserNumber].bloc_code = Block;
					memcpy(gObj[UserNumber].JoomingNumber,szJoominNumber,20);
					g_Window.ServerLogAdd(ST_JOINSERVER,"[ %s ] User login",szId);
				}
			}
			else if(nRet == 0)
			{
				result = 0x00;
			}
			else
			{
				result = 0x02;
			}
		}
		else
		{
			if( result == 0 )
			{
				result = 0x03;
			}
			else
			{
				result = 0x06;
			}

			g_Window.ServerLogAdd(ST_JOINSERVER,"[ %s ] [ERROR] User Connected login",szId);
		}

		LeaveCriticalSection(&g_JSData.m_critJoinUser);
	}

	spResult.h.size     = sizeof( spResult );
	spResult.h.c		= PMHC_BYTE;
	spResult.h.headcode = 0x01;
	spResult.result     = result;
	spResult.Number     = lpMsgIdPass->Number;
	spResult.UserNumber = UserNumber;
	spResult.DBNumber   = DBNumber;

	memcpy(spResult.JoominNumber, szJoominNumber, 20);
	memcpy(spResult.Id, szId, MAX_IDSTRING);

	DataSend(aIndex,(LPBYTE)&spResult,spResult.h.size);
}
Esempio n. 11
0
void JGAnsMapSvrAuth(PMSG_ANS_MAPSVRAUTH * lpMsg)
{
    if ( !OBJMAX_RANGE(lpMsg->iIndex))
    {
        LogAdd( "[MapServerMng] Packet Error JG [0x7B] - Index out of bound : %d",
                lpMsg->iIndex);

        return;
    }

    LPOBJ lpObj = &gObj[lpMsg->iIndex];
    memcpy(lpObj->Name, lpMsg->szCharName, MAX_ACCOUNT_LEN);


    if ( lpObj->m_bMapSvrMoveReq == false )
    {
        LogAdd( "[MapServerMng] MapSvr MoveReq Error JG [0x7B] - No Request [%s] (%d)",
                lpObj->AccountID, lpObj->m_Index);

        gObjDel(lpMsg->iIndex);
        return;
    }

    BOOL bAuthOK = FALSE;
    int iSendResult = 0;
    char szId[11];
    char szJN[14] = "";
    int iIndex = lpMsg->iIndex;
    SDHP_DBCHARINFOREQUEST pMsg;
    char szName[11];

    memset(szId, 0, sizeof(szId));
    memcpy(szId, lpMsg->szAccountID, MAX_ACCOUNT_LEN);
    memcpy(szJN, lpMsg->cJoominNumber, sizeof(lpMsg->cJoominNumber));

    switch ( lpMsg->iResult )
    {
    case 0:
        iSendResult = 0;
        bAuthOK = FALSE;

        if ( !gObjSetAccountLogin(iIndex, szId, lpMsg->iUserNumber, lpMsg->iDBNumber, szJN))
        {
            GJPAccountFail(iIndex, szId, lpMsg->iDBNumber, lpMsg->iUserNumber);
            lpMsg->iResult = 4;
        }
        else
        {
            LogAdd("***0467*** login     : (%s)[%s] number:%d/ db:%d", gObj[iIndex].Ip_addr, szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
            iSendResult = 1;
            bAuthOK = TRUE;
        }

        if ( lpMsg->iUserNumber == 0 && lpMsg->iDBNumber == 0 )
        {
            LogAdd("Both user number and DB number are 0 (%s) %d %d", szId, lpMsg->iUserNumber, lpMsg->iDBNumber);
        }

        switch ( lpMsg->btBlockCode )
        {
        case 70:	// 0x46
            gObj[iIndex].m_cAccountItemBlock = 1;
            break;
        }
        break;

    default:
        iSendResult = 0;
        bAuthOK = FALSE;
        break;
    }

    GCAnsMapSvrAuth(iIndex, iSendResult);

    if ( bAuthOK == FALSE )
    {
        LogAdd( "[MapServerMng] [%s][%s] JG [0x7B] - Join Result Failed : RST:%d, BLK:%c",
                szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);
        gObjDel(lpMsg->iIndex);

        return;
    }

    gObj[iIndex].m_sPrevMapSvrCode = lpMsg->wPrevMapSvrCode;
    gObj[iIndex].m_sDestMapNumber  = lpMsg->wMapNumber;
    gObj[iIndex].m_btDestX = lpMsg->btX;
    gObj[iIndex].m_btDestY = lpMsg->btY;
    gObj[iIndex].bEnableDelCharacter = FALSE;

    PHeadSetB((LPBYTE)&pMsg, 0x06, sizeof(pMsg));
    memset(szName, 0, sizeof(szName));
    memcpy(szName, lpMsg->szCharName, MAX_ACCOUNT_LEN);
    BuxConvert(szName, MAX_ACCOUNT_LEN);
    memcpy(pMsg.Name, szName, MAX_ACCOUNT_LEN);
    strcpy_s(pMsg.AccountID, sizeof(pMsg.AccountID), lpMsg->szAccountID);
    pMsg.Number = lpObj->m_Index;

    wsDataServerCli.DataSend((PCHAR)&pMsg, pMsg.h.size);

    LogAdd("[MapServerMng] [%s][%s] JG [0x7B] - Join Result OK : RST:%d, BLK:%c",
           szId, lpMsg->szCharName, lpMsg->iResult, lpMsg->btBlockCode);

}