Exemplo n.º 1
0
void GJSetPlayerS5QuestInfo(cExtraServer * sManager, int aIndex, SDHP_GETPLAYERS5QUEST_INFOSAVE * lpMsg)
{
	char szName[11]={0};
	memcpy(szName, lpMsg->Name, 10);

	if((SQLSyntexCheck(szName) == TRUE)	&&
	   (SpaceSyntexCheck(szName) == TRUE))
	{

		BOOL bRet = sManager->db.ExecQuery("SELECT Name FROM %s.dbo.SCFS5Quest WHERE Name = '%s' and AccountID= '%s'",sManager->m_DBName, lpMsg->Name, lpMsg->AccountID);
		if ( sManager->db.Fetch() == SQL_NO_DATA || bRet == FALSE )
		{
			sManager->db.Close();
			sManager->db.ExecQuery("INSERT INTO %s.dbo.SCFS5Quest (AccountID, Name) VALUES ('%s','%s')",sManager->m_DBName, lpMsg->AccountID, lpMsg->Name);
			sManager->db.Fetch();
		}
		sManager->db.Close();

		char szTemp[10000];
		wsprintf(szTemp, "UPDATE %s.dbo.SCFS5Quest SET SCFS5Quest=? WHERE Name='%s' and AccountID='%s'",sManager->m_DBName, lpMsg->Name, lpMsg->AccountID);
		sManager->db.SetAsBinary(szTemp, (LPBYTE)lpMsg->S5Quest, sizeof(lpMsg->S5Quest));
		sManager->db.Fetch();
		sManager->db.Close();
	}
}
Exemplo n.º 2
0
void GDSetOfficialHelper(cExtraServer * sManager, SDHP_GETPLAYEROFFICIALHELPER_SAVE * lpMsg)
{
	char szName[11]={0};
	memcpy(szName, lpMsg->Name, 10);
	
	if((SQLSyntexCheck(szName) == TRUE)	&&
	   (SpaceSyntexCheck(szName) == TRUE))
	{
		BOOL bRet = sManager->db.ExecQuery("SELECT Name FROM %s.dbo.OfficialHelper WHERE Name = '%s'",sManager->m_DBName, lpMsg->Name);
		if ( sManager->db.Fetch() == SQL_NO_DATA || bRet == FALSE )
		{
			sManager->db.Close();
			sManager->db.ExecQuery("INSERT INTO %s.dbo.OfficialHelper (Name) VALUES ('%s')",sManager->m_DBName, lpMsg->Name);
			sManager->db.Fetch();
			sManager->db.Close();
			char szTemp2[10000];
			wsprintf(szTemp2, "UPDATE %s.dbo.OfficialHelper SET Data=? WHERE Name='%s'",sManager->m_DBName, szName);
			sManager->db.SetAsBinary(szTemp2, (LPBYTE)lpMsg->Data, sizeof(lpMsg->Data));
			sManager->db.Fetch();
		}else
		{
			char szTemp2[10000];
			wsprintf(szTemp2, "UPDATE %s.dbo.OfficialHelper SET Data=? WHERE Name='%s'",sManager->m_DBName, szName);
			sManager->db.SetAsBinary(szTemp2, (LPBYTE)lpMsg->Data, sizeof(lpMsg->Data));
			sManager->db.Fetch();
		}
		sManager->db.Close();
	}
}
Exemplo n.º 3
0
void GDGetPlayerCustomQuests(cExtraServer * sManager, int aIndex, SDHP_GETPLAYEREXTRAINFO * lpMsg)
{
	char Name[11] = {0};
	char AccountID[11] = {0};
	memcpy(Name, lpMsg->Name, 10);

	if((SQLSyntexCheck(Name) == TRUE)	&&
	   (SpaceSyntexCheck(Name) == TRUE))
	{
		SDHP_GETPLAYERCUSTOMQUESTS_SAVE pResult = {0};

		PHeadSetW((LPBYTE)&pResult, SCFExDB_GSRecv_GetPlayerCustomQuestsInfo, sizeof(pResult));
		memcpy(pResult.Name, Name, 10);	
		pResult.aIndex = lpMsg->aIndex;

		char szTemp[256];
		BYTE btTemp[CUSTOMQUEST_BINARY_SIZE]={0xFF};

		wsprintf(szTemp, "SELECT SCFCustomQuest FROM %s.dbo.Character where Name = '%s'",sManager->m_DBName, Name);
		if ( sManager->db.GetAsBinary(szTemp, btTemp) == -1 )
			memset(btTemp, -1, sizeof(btTemp));
		memcpy(pResult.CustomQuest, btTemp, sizeof(pResult.CustomQuest));
		sManager->db.Close();

		sManager->DataSend(aIndex, (LPBYTE)&pResult, sizeof(pResult));
	}	
}
Exemplo n.º 4
0
void GJDeletePlayerQ5Info(cExtraServer * sManager, int aIndex, SDHP_DELETEPLAYERS5QUEST_INFO * pRecv)
{
	char szName[11]={0};
	memcpy(szName, pRecv->Name, 10);

	if((SQLSyntexCheck(szName) == TRUE)	&&
	   (SpaceSyntexCheck(szName) == TRUE))
	{
		sManager->db.ExecQuery("DELETE FROM %s.dbo.SCFS5Quest WHERE Name = '%s' and AccountID= '%s'",
			sManager->m_DBName, pRecv->Name, pRecv->AccountID);
		sManager->db.Fetch();
		sManager->db.Close();
	}
}
Exemplo n.º 5
0
void GDSetPlayerCustomQuests(cExtraServer * sManager, SDHP_GETPLAYERCUSTOMQUESTS_SAVE * lpMsg)
{		
	char szName[11]={0};
	memcpy(szName, lpMsg->Name, 10);
		
	if((SQLSyntexCheck(szName) == TRUE)	&&
	   (SpaceSyntexCheck(szName) == TRUE))
	{
		char szTemp[10000];
		wsprintf(szTemp, "UPDATE %s.dbo.Character SET SCFCustomQuest=? WHERE Name='%s'",sManager->m_DBName, szName);
		sManager->db.SetAsBinary(szTemp, (LPBYTE)lpMsg->CustomQuest, sizeof(lpMsg->CustomQuest));
		sManager->db.Fetch();
		sManager->db.Close();
	}
}
Exemplo n.º 6
0
void GDGetPlayerOfficialHelper(cExtraServer * sManager, int aIndex, SDHP_GETPLAYEREXTRAINFO * lpMsg)
{
	char Name[11] = {0};
	char AccountID[11] = {0};
	memcpy(Name, lpMsg->Name, 10);
	memcpy(AccountID, lpMsg->AccountID, 10);

	if((SQLSyntexCheck(Name) == TRUE)	&&
	   (SpaceSyntexCheck(Name) == TRUE))
	{
		SDHP_GETPLAYEROFFICIALHELPER_SAVE pResultOfficialHelper = {0};
		PHeadSetW((LPBYTE)&pResultOfficialHelper, SCFExDB_GSRecv_GetOfficialHelperData, sizeof(pResultOfficialHelper));
		char szTemp3[256];
		BYTE btTemp3[257]={0};

		memcpy(pResultOfficialHelper.AccountID, AccountID, 10);
		memcpy(pResultOfficialHelper.Name, Name, 10);	
		pResultOfficialHelper.aIndex = lpMsg->aIndex;

		BOOL bRet = sManager->db.ExecQuery("SELECT Name FROM %s.dbo.OfficialHelper WHERE Name = '%s'",sManager->m_DBName, Name);
		if ( sManager->db.Fetch() == SQL_NO_DATA || bRet == FALSE )
		{
			memset(btTemp3, 0, sizeof(btTemp3));
			btTemp3[1] = 1;
			btTemp3[2] = 0x11;
			btTemp3[23] = 0x51;
			btTemp3[24] = 0x15;
			btTemp3[26] = 0x20;
		}else
		{
			sManager->db.Close();
			wsprintf(szTemp3, "SELECT Data FROM %s.dbo.OfficialHelper where Name = '%s'",sManager->m_DBName, Name);
			if ( sManager->db.GetAsBinary(szTemp3, btTemp3) == -1 )
				memset(btTemp3, 0, sizeof(btTemp3));
		}
		memcpy(pResultOfficialHelper.Data, btTemp3, sizeof(pResultOfficialHelper.Data));
		sManager->db.Close();
		sManager->DataSend(aIndex, (LPBYTE)&pResultOfficialHelper, sizeof(pResultOfficialHelper));
	}
}
Exemplo n.º 7
0
void GDGetPlayerS5Quests(cExtraServer * sManager, int aIndex, SDHP_GETPLAYEREXTRAINFO * lpMsg)
{
	char Name[11] = {0};
	char AccountID[11] = {0};
	memcpy(Name, lpMsg->Name, 10);
	memcpy(AccountID, lpMsg->AccountID, 10);

	if((SQLSyntexCheck(Name) == TRUE)	&&
	   (SpaceSyntexCheck(Name) == TRUE))
	{
		SDHP_GETPLAYERS5QUEST_SAVE pResultS5Q = {0};
		PHeadSetW((LPBYTE)&pResultS5Q, SCFExDB_GSRecv_GetPlayerS5QuestInfo, sizeof(pResultS5Q));

		char szTemp2[10000];
		BYTE btTemp2[(sizeof(S5QUEST)*MAX_QUEST_COUNT)]={0};

		memcpy(pResultS5Q.AccountID, AccountID, 10);
		memcpy(pResultS5Q.Name, Name, 10);	
		pResultS5Q.aIndex = lpMsg->aIndex;

		BOOL bRet = sManager->db.ExecQuery("SELECT Name FROM %s.dbo.SCFS5Quest WHERE Name = '%s' and AccountID = '%s'",sManager->m_DBName, Name, AccountID);
		if ( sManager->db.Fetch() == SQL_NO_DATA || bRet == FALSE )
		{
			memset(btTemp2, 0, sizeof(btTemp2));
		} else 
		{
			sManager->db.Close();
			wsprintf(szTemp2, "SELECT SCFS5Quest FROM %s.dbo.SCFS5Quest where Name = '%s' and AccountID = '%s'",sManager->m_DBName, Name, AccountID);
			if ( sManager->db.GetAsBinary(szTemp2, btTemp2) == -1 )
				memset(btTemp2, 0, sizeof(btTemp2));
		}
		memcpy(pResultS5Q.S5Quest, btTemp2, sizeof(pResultS5Q.S5Quest));
		sManager->db.Close();
		sManager->DataSend(aIndex, (LPBYTE)&pResultS5Q, sizeof(pResultS5Q));
	}
}
Exemplo n.º 8
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);
}