Exemplo n.º 1
0
void EGUpdateDoubleGoer(LPBYTE aRecv,int aIndex)
{
	LPMSG_DOUBLEGOER_UPDATE_EVENT lpMsg = (LPMSG_DOUBLEGOER_UPDATE_EVENT)aRecv;

	char szName[MAX_IDSTRING+1];
	memcpy(szName,lpMsg->szName,MAX_IDSTRING);
	szName[MAX_IDSTRING] = '\0';

	char szQuery[512];

	wsprintf(szQuery,"SELECT * FROM DG_ROOM WHERE CHAR_NAME = '%s'",szName);

	if( g_EventDB.Exec(szQuery) != FALSE )
	{
		if( g_EventDB.Fetch() == SQL_NO_DATA )
		{
			g_EventDB.Clear();
			wsprintf(szQuery,"INSERT INTO DG_ROOM (CHAR_NAME,NEXT_EVENT) VALUES ('%s',DATEADD(DAY,1,GETDATE()))",szName);
			g_EventDB.Exec(szQuery);
		}
		else
		{
			g_EventDB.Clear();
			wsprintf(szQuery,"UPDATE DG_ROOM SET NEXT_EVENT = DATEADD(DAY,1,GETDATE()) WHERE CHAR_NAME = '%s'",szName);
			g_EventDB.Exec(szQuery);
		}
	}

	g_EventDB.Clear();
}
Exemplo n.º 2
0
void EGAnsPCBangUserConnect(LPBYTE aRecv,int aIndex)
{
	PMSG_PCBANGUSER_CONNECT* lpMsg = (PMSG_PCBANGUSER_CONNECT*)aRecv;

	char szAccountId[MAX_IDSTRING+1];
	szAccountId[MAX_IDSTRING] = '\0';
	memcpy(szAccountId,lpMsg->szAccountID,MAX_IDSTRING);

	char szQuery[256];
	sprintf(szQuery,"SELECT pcbang_id,pcbang_points FROM PCBANG_USER WHERE pcbang_id = '%s'",szAccountId);

	PMSG_PCBANG_USERDATA_GETINFO pMsg ={0};
	PHeadSetB((LPBYTE)&pMsg,0x23,sizeof(pMsg));
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.Points = 0;

	if( g_EventDB.Exec(szQuery) == TRUE )
	{
		if( g_EventDB.Fetch() != SQL_NO_DATA )
		{
			pMsg.Points = g_EventDB.GetInt("pcbang_points");
		}
		else
		{
			g_EventDB.Clear();
			sprintf(szQuery,"INSERT INTO PCBANG_USER (pcbang_id,pcbang_points,reset_date) VALUES ('%s',0,getdate()+7)",szAccountId);
			g_EventDB.Exec(szQuery);
		}
	}

	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 3
0
void EGAnsEventChipInfo(LPMSG_REQ_VIEW_EC_MN lpMsg,int aIndex)
{
	char szQuery[256];
	char szAccountID[MAX_IDSTRING+1] = {0};

	memcpy(szAccountID,lpMsg->szUID, MAX_IDSTRING);

	PMSG_ANS_VIEW_EC_MN pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.headcode = 0x01;
	pMsg.h.size = sizeof( pMsg );

	pMsg.iINDEX = lpMsg->iINDEX;
	strcpy(pMsg.szUID,szAccountID);
	pMsg.szUID[10] = 0;

	sprintf(szQuery,"SELECT EventChips, Check_Code, MuttoNumber FROM T_MU2003_EVENT WHERE AccountID='%s'",szAccountID);

	if(g_EventDB.Exec(szQuery) != TRUE)
	{
		pMsg.bSUCCESS = FALSE;
	}
	else
	{
		if(g_EventDB.Fetch() != SQL_NO_DATA)
		{
			if(g_EventDB.GetInt("Check_Code") != 0)
			{
				pMsg.nEVENT_CHIPS = 0;
			}
			else
			{
				pMsg.nEVENT_CHIPS = g_EventDB.GetInt("EventChips");
			}

			pMsg.iMUTO_NUM = g_EventDB.GetInt("MuttonNumber");
			pMsg.bSUCCESS = TRUE;
		}
		else
		{
			g_EventDB.Clear();
			sprintf(szQuery,"INSERT INTO T_MU2003_EVENT (AccountID) VALUES ('%s')",szAccountID);
			if(g_EventDB.Exec(szQuery) == FALSE)
			{
				pMsg.bSUCCESS = FALSE;
			}
			else
			{
				pMsg.nEVENT_CHIPS = 0;
				pMsg.iMUTO_NUM = 0;
				pMsg.bSUCCESS = TRUE;
			}
		}
	}
	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
}
Exemplo n.º 4
0
void CustomQuestReqInfo(LPMSG_CUSTOMQUEST_REQUSER lpMsg,int aIndex)
{
	char szName[MAX_IDSTRING+1];
	szName[MAX_IDSTRING] = '\0';

	memcpy(szName,lpMsg->szUserName,MAX_IDSTRING);

	PMSG_CUSTOMQUEST_ANSUSER pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.size = sizeof(pMsg);
	pMsg.h.headcode = 0x65;
	pMsg.h.subcode = 0x01;

	pMsg.result = FALSE;
	pMsg.aIndex = lpMsg->aIndex;
	memcpy(pMsg.szUserName,lpMsg->szUserName,MAX_IDSTRING);

	pMsg.QuestGroup = -1;
	pMsg.QuestIndex = -1;
	pMsg.QuestItem[0] = 0;
	pMsg.QuestItem[1] = 0;
	pMsg.QuestItem[2] = 0;

	char szQuery[256];

	sprintf(szQuery,"SELECT QuestGroup,QuestIndex,QuestState,QuestItem_1,QuestItem_2,QuestItem_3 FROM T_CustomQuest WHERE CHAR_NAME = '%s'",szName);

	if( g_MyEventDB.Exec(szQuery) == TRUE )
	{
		if( g_MyEventDB.Fetch() == SQL_NO_DATA )
		{
			g_MyEventDB.Clear();

			sprintf(szQuery,"INSERT INTO T_CustomQuest (CHAR_NAME,QuestGroup,QuestIndex,QuestState,QuestItem_1,QuestItem_2,QuestItem_3) VALUES ('%s',-1,-1,0,0,0,0)",szName);

			if( g_MyEventDB.Exec(szQuery) == TRUE )
			{
				pMsg.result = TRUE;
			}
		}
		else
		{
			pMsg.result = TRUE;

			pMsg.QuestGroup = g_MyEventDB.GetInt("QuestGroup");
			pMsg.QuestIndex = g_MyEventDB.GetInt("QuestIndex");
			pMsg.QuestState = g_MyEventDB.GetInt("QuestState");
			pMsg.QuestItem[0] = g_MyEventDB.GetInt("QuestItem_1");
			pMsg.QuestItem[1] = g_MyEventDB.GetInt("QuestItem_2");
			pMsg.QuestItem[2] = g_MyEventDB.GetInt("QuestItem_3");
		}
	}

	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 5
0
void EGAnsEventStoneInfo(LPMSG_REQ_VIEW_EC_MN lpMsg,int aIndex)
{
	char szQuery[256];
	char szAccount[MAX_IDSTRING+1] = {0};

	memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING);
	PMSG_ANS_VIEW_STONES pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.headcode = 0x05;
	pMsg.h.size = sizeof(pMsg);

	strcpy(pMsg.szUID,szAccount);

	pMsg.iINDEX = lpMsg->iINDEX;
	pMsg.szUID[10] = 0;

	sprintf(szQuery,"SELECT StoneCount, Check_Code FROM T_BLOOD_CASTLE WHERE AccountID='%s'",szAccount);

	pMsg.bSUCCESS = FALSE;

	if(g_EventDB.Exec(szQuery) == TRUE)
	{
		if(g_EventDB.Fetch() != SQL_NO_DATA)
		{
			if(g_EventDB.GetInt("Check_Code") != 0)
			{
				pMsg.iStoneCount = 0;
			}
			else
			{
				pMsg.iStoneCount = g_EventDB.GetInt("StoneCount");
			}
			pMsg.bSUCCESS = TRUE;
		}
		else
		{
			g_EventDB.Clear();

			sprintf(szQuery,"INSERT INTO T_BLOOD_CASTLE (AccountID) VALUES ('%s')",szAccount);

			if(g_EventDB.Exec(szQuery) == TRUE)
			{
				pMsg.bSUCCESS = TRUE;
				pMsg.iStoneCount = 0;
			}
		}
	}

	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
}
Exemplo n.º 6
0
void LoadNoblessInfo(LPMSG_REQ_NOBLESSINFO lpMsg,int aIndex)
{
	char szName[MAX_IDSTRING+1];
	memcpy(szName,lpMsg->szName,MAX_IDSTRING);
	szName[MAX_IDSTRING] = '\0';

	PMSG_ANS_NOBLESSINFO pMsg;
	pMsg.h.c = 0xC1;
	pMsg.h.size = sizeof(pMsg);
	pMsg.h.headcode = 0x66;
	pMsg.h.subcode = 0x10;

	pMsg.aIndex = lpMsg->aIndex;
	memcpy(pMsg.szName,szName,MAX_IDSTRING);

	pMsg.btResult = TRUE;

	char szQuery[512];
	sprintf(szQuery,"SELECT NoblessRank,NoblessPts FROM NoblessInfo WHERE CHAR_NAME = '%s'",
		szName);

	if( !g_MyEventDB.Exec(szQuery) )
	{
		pMsg.btResult = FALSE;
	}
	else
	{
		if( g_MyEventDB.Fetch() == SQL_NO_DATA )
		{
			g_MyEventDB.Clear();

			sprintf(szQuery,"INSERT INTO NoblessInfo (CHAR_NAME,NoblessRank,NoblessPts) VALUES ('%s',0,0)",
				szName);

			g_MyEventDB.Exec(szQuery);

			pMsg.NoblessRank = 0;
			pMsg.NoblessPts = 0;
		}
		else
		{
			pMsg.NoblessRank = g_MyEventDB.GetInt("NoblessRank");
			pMsg.NoblessPts = g_MyEventDB.GetInt("NoblessPts");
		}
	}

	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 7
0
void PartyMatchUpdateStatus(LPSTR szName, BYTE Status)
{
	char szQuery[256];
	sprintf(szQuery,"SELECT * FROM PartyMatching_InfoData WHERE PartyLeader = '%s'", szName);
	g_PartyMatchDB.Exec(szQuery);

	if( g_PartyMatchDB.Fetch() != SQL_NO_DATA )
	{
		g_PartyMatchDB.Clear();
		ZeroMemory(szQuery, sizeof(szQuery));
		sprintf(szQuery,"UPDATE PartyMatching_InfoData SET Status = %d WHERE PartyLeader = '%s'", Status, szName);
		g_PartyMatchDB.Exec(szQuery);
	}
	g_PartyMatchDB.Clear();
}
Exemplo n.º 8
0
void OlympStatsRequest(LPOLP_REQ_STATS lpMsg,int aIndex)
{
	char szName[MAX_IDSTRING+1];
	memcpy(szName,lpMsg->szName,MAX_IDSTRING);
	szName[MAX_IDSTRING] = '\0';

	OLP_ANS_STATS pMsg;
	pMsg.h.c = PMHC_BYTE;
	pMsg.h.headcode = 0x68;
	pMsg.h.size = sizeof(pMsg);
	pMsg.h.subcode = 0x06;

	pMsg.iIndex = lpMsg->iIndex;
	memcpy(pMsg.szName,szName,MAX_IDSTRING);

	pMsg.btResult = FALSE;
	pMsg.iBattles = 0;
	pMsg.iPts = 0;
	

	char szQuery[512];
	sprintf(szQuery,"SELECT BATTLE_COUNT,BATTLE_POINTS FROM OLYMP_USERS WHERE CHAR_NAME = '%s' AND MAP_SVR_GROUP = %d",
		szName,lpMsg->wMapSvrNum);

	if( g_MyEventDB.Exec(szQuery) && g_MyEventDB.Fetch() != SQL_NO_DATA )
	{
		pMsg.btResult = TRUE;
		pMsg.iBattles = g_MyEventDB.GetInt("BATTLE_COUNT");
		pMsg.iPts = g_MyEventDB.GetInt("BATTLE_POINTS");
	}
	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 9
0
void OlympRewardRequest(LPOLP_REQ_REWARD lpMsg,int aIndex)
{
	char szName[MAX_IDSTRING+1];
	memcpy(szName,lpMsg->szName,MAX_IDSTRING);
	szName[MAX_IDSTRING] = '\0';

	OLP_ANS_REWARD pMsg;
	pMsg.h.c = PMHC_BYTE;
	pMsg.h.headcode = 0x68;
	pMsg.h.size = sizeof( pMsg );
	pMsg.h.subcode = 0x05;

	pMsg.iIndex = lpMsg->iIndex;
	memcpy(pMsg.szName,szName,10);

	pMsg.btResult = 0;
	pMsg.btRank = 0;
	pMsg.btReward = 0;

	char szQuery[512];
	sprintf(szQuery,"EXEC WZ_OG_UserReward %d, '%s'",
		lpMsg->wMapSvrNum,szName);

	if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA )
	{
		pMsg.btResult = g_MyEventDB.GetInt("qResult");
		pMsg.btRank = g_MyEventDB.GetInt("USER_RANK");
		pMsg.btReward = g_MyEventDB.GetInt("IS_REWARDED");
	}

	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 10
0
void ReqRegOlymp(LPOLP_REQ_REGFIGHT lpMsg,int aIndex)
{
	char szName[MAX_IDSTRING+1];
	memcpy(szName,lpMsg->szName,MAX_IDSTRING);
	szName[MAX_IDSTRING] = '\0';

	OLP_ANS_REGFIGHT pMsg;
	pMsg.h.c = PMHC_BYTE;
	pMsg.h.size = sizeof( pMsg );
	pMsg.h.headcode = 0x68;
	pMsg.h.subcode = 0x02;
	pMsg.iIndex = lpMsg->iIndex;
	memcpy(pMsg.szName,szName,MAX_IDSTRING);

	pMsg.iBattleCount = 0;
	pMsg.iBattlePts = 0;
	pMsg.btResult = 0;

	char szQuery[512];
	sprintf(szQuery,"EXEC WZ_OG_UserInfo %d, '%s',%d",lpMsg->wMapSvrNum,szName,lpMsg->iClass);

	if( g_MyEventDB.Exec(szQuery) && g_MyEventDB.Fetch() != SQL_NO_DATA )
	{
		pMsg.btResult = TRUE;
		pMsg.iBattleCount = g_MyEventDB.GetInt("BATTLE_COUNT");
		pMsg.iBattlePts = g_MyEventDB.GetInt("BATTLE_POINTS");
		pMsg.iLastRegTime = g_MyEventDB.GetInt("LAST_REG");
	}
	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 11
0
void ReqOlympChangeDate(LPOLP_REQ_SDEDCHANGE lpMsg,int aIndex)
{
	OLP_ANS_SDEDCHANGE pMsg;

	pMsg.h.c = PMHC_BYTE;
	pMsg.h.size = sizeof( pMsg );
	pMsg.h.headcode = 0x68;
	pMsg.h.subcode = 0x01;

	pMsg.iIndex = lpMsg->iIndex;
	pMsg.wMapSvrNum = lpMsg->wMapSvrNum;

	pMsg.wStartYear = lpMsg->wStartYear;
	pMsg.btStartMonth = lpMsg->btStartMonth;
	pMsg.btStartDay = lpMsg->btStartDay;
	pMsg.wEndYear = lpMsg->wEndYear;
	pMsg.btEndMonth = lpMsg->btEndMonth;
	pMsg.btEndDay = lpMsg->btEndDay;

	pMsg.iResult = FALSE;

	char szQuery[512];
	
	sprintf(szQuery,"EXEC WZ_OG_ModifyOlympSchedule %d, '%d-%d-%d 00:00:00', '%d-%d-%d 00:00:00'",
		lpMsg->wMapSvrNum,lpMsg->wStartYear,lpMsg->btStartMonth,lpMsg->btStartDay,
		lpMsg->wEndYear,lpMsg->btEndMonth,lpMsg->btEndDay);

	if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA )
	{
		pMsg.iResult = g_MyEventDB.GetInt("QueryResult");
	}
	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 12
0
void LoadOlympInfo(LOLP_REQ_OLYMPINITDATA lpMsg,int aIndex)
{
	OLP_ANS_OLYMPINITDATA pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.size = sizeof(pMsg);
	pMsg.h.headcode = 0x68;
	pMsg.h.subcode = 0x00;

	pMsg.wMapSvrNum = lpMsg->wMapSvrNum;
	pMsg.iResult = FALSE;


	char szQuery[512];
	sprintf(szQuery,"EXEC WZ_OG_GetOlympTotalInfo %d, %d",
		lpMsg->wMapSvrNum,lpMsg->iOlympEventCycle);

	if( g_MyEventDB.Exec(szQuery) == TRUE && g_MyEventDB.Fetch() != SQL_NO_DATA )
	{
		pMsg.wStartYear = (WORD)g_MyEventDB.GetInt("SYEAR");
		pMsg.btStartMonth = (BYTE)g_MyEventDB.GetInt("SMONTH");
		pMsg.btStartDay = (BYTE)g_MyEventDB.GetInt("SDAY");
		pMsg.wEndYear = (WORD)g_MyEventDB.GetInt("EYEAR");
		pMsg.btEndMonth = (BYTE)g_MyEventDB.GetInt("EMONTH");
		pMsg.btEndDay = (BYTE)g_MyEventDB.GetInt("EDAY");
		pMsg.btFirstCreate = g_MyEventDB.GetInt("FIRST_CREATE");
		pMsg.iResult = TRUE;
	}

	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 13
0
void EGAns2AnivRegSerial(LPMSG_REQ_2ANIV_SERIAL lpMsg,int aIndex)
{
	char szQuery[256];
	char szAccount[MAX_IDSTRING+1] = {0};

	memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING);
	PMSG_ANS_2ANIV_SERIAL pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.headcode = 0x08;
	pMsg.h.size = sizeof( pMsg );

	pMsg.iINDEX = lpMsg->iINDEX;
	strcpy(pMsg.szUID,szAccount);

	sprintf(szQuery,"EXEC SP_REG_SERIAL '%s', '%d', '%s', '%s', '%s'",
		szAccount,lpMsg->iMEMB_GUID,lpMsg->SERIAL1,lpMsg->SERIAL2,lpMsg->SERIAL3);

	pMsg.btIsRegistered = 4;

	if(g_EventDB.Exec(szQuery) && g_EventDB.Fetch() != SQL_NO_DATA)
	{
		pMsg.btIsRegistered = g_EventDB.GetInt("RegResult");
		pMsg.iGiftNumber = g_EventDB.GetInt("F_Register_Section");

		if(pMsg.iGiftNumber == -1)
		{
			pMsg.btIsRegistered = 4;
		}
	}
	g_EventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
}
Exemplo n.º 14
0
void RemoveBill(char* szId)
{
	char szQuery[256];

#ifdef ZTEAMDB
	sprintf(szQuery,"DELETE FROM PremiumData WHERE AccountID = '%s'",szId);
#else
	sprintf(szQuery,"DELETE FROM MEMB_PREMIUM WHERE memb___id = '%s'",szId);
#endif

	g_JoinServerConnectDB.Exec(szQuery);

	int iIndex = gObjSearchUser(szId);

	if(iIndex < 0 || iIndex >= MAX_USEROBJECT)
		return;

	SDHP_BILLKILLUSER pMsg;

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

	strcpy(pMsg.Id,szId);
	pMsg.Number = gObj[iIndex].gaIndex;

	DataSend(gObj[iIndex].GameServerIndex,(LPBYTE)&pMsg,sizeof( pMsg ));

	g_Window.ServerLogAdd(ST_JOINSERVER,"[PREMIUM] Bill end usetime [%s][%d]",szId,gObj[iIndex].gaIndex);
}
Exemplo n.º 15
0
void DGPartyMatchRequestAnswer(PARTYMATCH_GDREQ_REQUESTANSWER* lpData, int aIndex)
{
	char Query[256];
	// ----
	PARTYMATCH_DGANS_REQUESTANSWER lpAnswer = { 0 };
	// ----
	lpAnswer.h.c = PMHC_BYTE;
	lpAnswer.h.headcode = 0xEF;
	lpAnswer.h.subcode = 0x05;
	lpAnswer.h.size = sizeof(PARTYMATCH_DGANS_REQUESTANSWER);
	lpAnswer.UserIndex = lpData->UserIndex;
	memcpy(lpAnswer.Character, lpData->Character, 10);
	lpAnswer.Type = lpData->Type;
	lpAnswer.Result = -1;
	// ----
	if( lpData->Type == 0 )
	{
		sprintf(Query, "DELETE FROM PartyMatching_List WHERE Name = '%s'", lpData->Character);
		// ----
		if( !g_PartyMatchDB.Exec(Query) )
		{
			g_PartyMatchDB.Clear();
			DataSend(aIndex, (LPBYTE)&lpAnswer, sizeof(PARTYMATCH_DGANS_REQUESTANSWER));
			return;
		}
		// ----
		g_PartyMatchDB.Clear();
		lpAnswer.Result = 1;
		DataSend(aIndex, (LPBYTE)&lpAnswer, sizeof(PARTYMATCH_DGANS_REQUESTANSWER));
	}
	// ----
	DataSend(aIndex, (LPBYTE)&lpAnswer, sizeof(PARTYMATCH_DGANS_REQUESTANSWER));
}
Exemplo n.º 16
0
BOOL CArena::SaveToDatabase( void )
{
	CQuery* pQuery = new CQuery;
	if( pQuery->Connect( 3, "Character01", "", "" ) == FALSE )
	{
		pQuery->DisConnect();
		SAFE_DELETE( pQuery );
		return FALSE;
	}
	
	for( map<u_long, ARENAPLAYER>::iterator it = m_mArenaMap.begin(); it != m_mArenaMap.end(); ++it )
	{
		if( it->second.bUpdate == FALSE ) //nothing has changed, please don't Query me!
			continue;

		it->second.bUpdate = FALSE;

		CString strExecUpdate;
		strExecUpdate.Format( "UPDATE dbo.ARENA SET "
			"m_idPlayer = %u, "
			"m_nKill = %u, "
			"m_nDeath = %u, "
			"m_nRow = %u, "
			"m_nJob = %u, "
			"m_nDeathMatchWin = %u, "
			"m_nDeathMatchLose = %u, "
			"m_nDuelWin = %u, "
			"m_nDuelLose = %u, "
			"m_nArenaPoint = %I64u, "
			"m_szName = '%s' "
			"WHERE m_idPlayer = %u",
			it->first,
			it->second.nKill,
			it->second.nDeath,
			it->second.nRow,
			it->second.nJob,
			it->second.nDeathMatchWin,
			it->second.nDeathMatchLose,
			it->second.nDuelWin,
			it->second.nDuelLose,
			it->second.n64ArenaPoint,
			it->second.szName,
			it->first );

			if( pQuery->Exec( strExecUpdate ) == FALSE )
			{
				Error( "---------- Start of Arena Save Error --------" );
				Error( "CArena --> Save Database Player." );
				Error( "User ID:%u --> Kills:%u --> Death:%u ---> Row:%u",
					it->first, it->second.nKill, it->second.nDeath, it->second.nRow );
				Error( "Query: --> %s", strExecUpdate );
				Error( "---------- End of Arena Save Error --------" );
			}
			pQuery->Clear();
	}

	pQuery->DisConnect();
	SAFE_DELETE( pQuery );
	return TRUE;
}
Exemplo n.º 17
0
int PartyMatchRegister(LPMSG_PARTYMATCHING_REG_REQ lpMsg)
{
	char szQuery[256];
	int retCode = -1;

#ifdef ZTEAMDB
	sprintf(szQuery,"EXEC PartyMatching_Register %d, '%s', '%s', '%s', %d, %d, %d, %d, %d, %d",
		lpMsg->ServerCode,lpMsg->szName,lpMsg->szDesc,lpMsg->szPass,
		lpMsg->MinLevel,lpMsg->MaxLevel,lpMsg->MoveReqId,lpMsg->ClassInfo,lpMsg->btAutoAccept, lpMsg->Gens);
#else
	sprintf(szQuery,"EXEC WZ_PM_Register %d, '%s', '%s', '%s', %d, %d, %d, %d, %d",
		lpMsg->ServerCode,lpMsg->szName,lpMsg->szDesc,lpMsg->szPass,
		lpMsg->MinLevel,lpMsg->MaxLevel,lpMsg->MoveReqId,lpMsg->ClassInfo,lpMsg->btAutoAccept);
#endif

	if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA )
	{
		g_PartyMatchDB.Clear();
		return retCode;
	}

	retCode = g_PartyMatchDB.GetInt("RegResult");
	g_PartyMatchDB.Clear();
	return retCode;
}
Exemplo n.º 18
0
void EGAnsEnterDoubleGoer(LPBYTE aRecv,int aIndex)
{
	LPMSG_DOUBLEGOER_REQ_ENTER_EVENT lpMsg = (LPMSG_DOUBLEGOER_REQ_ENTER_EVENT)aRecv;


	PMSG_DOUBLEGOER_ANS_ENTER_EVENT pMsg;

	PHeadSetB((LPBYTE)&pMsg,0x40,sizeof(pMsg));
	pMsg.btPos = lpMsg->btPos;
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.iResult = 0;

	char szQuery[512];

	wsprintf(szQuery,"SELECT DATEDIFF(mi,getdate(),NEXT_EVENT) as LeftHour FROM DG_ROOM WHERE CHAR_NAME = '%s' AND NEXT_EVENT > getdate()",lpMsg->szName);

	if( g_EventDB.Exec(szQuery) != FALSE )
	{
		if( g_EventDB.Fetch() != SQL_NO_DATA )
		{
			pMsg.iResult = g_EventDB.GetInt("LeftHour");
		}
	}
	else
	{
		pMsg.iResult = -1;
	}

	g_EventDB.Clear();


	DataSend(aIndex,(LPBYTE)&pMsg,sizeof(pMsg));
}
Exemplo n.º 19
0
int PartyMatchJoin(LPMSG_PARTYMATCHING_JOIN_REQ lpMsg)
{
	int iResult = 0;
	char szQuery[256];

#ifdef ZTEAMDB
	sprintf(szQuery,"EXEC PartyMatching_JoinRequest %d,%d,'%s','%s','%s',%d,%d,%d",
		lpMsg->RequestType,lpMsg->ServerCode,lpMsg->szPartyLeader,lpMsg->szPassword,
		lpMsg->szName,lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#else
	sprintf(szQuery,"EXEC WZ_PM_JoinRequest %d,%d,'%s','%s','%s',%d,%d,%d",
		lpMsg->RequestType,lpMsg->ServerCode,lpMsg->szPartyLeader,lpMsg->szPassword,
		lpMsg->szName,lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#endif

	if( !g_PartyMatchDB.Exec(szQuery) || g_PartyMatchDB.Fetch() == SQL_NO_DATA )
	{
		g_PartyMatchDB.Clear();
		return -8;
	}

	iResult = g_PartyMatchDB.GetInt("RequestResult");

	g_PartyMatchDB.Clear();
	return iResult;
}
Exemplo n.º 20
0
void EGAnsResetStoneInfo(LPMSG_REQ_RESET_EVENTCHIP lpMsg,int aIndex)
{
	char szQuery[256];
	char szAccount[MAX_IDSTRING+1] = {0};

	memcpy(szAccount,lpMsg->szUID,MAX_IDSTRING);
	PMSG_ANS_RESET_EVENTCHIP pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.headcode = 0x09;
	pMsg.h.size = sizeof(pMsg);

	pMsg.iINDEX = lpMsg->iINDEX;
	strcpy(pMsg.szUID,szAccount);
	pMsg.szUID[10] = 0;

	pMsg.bSUCCESS = FALSE;

	sprintf(szQuery,"UPDATE T_BLOOD_CASTLE SET Check_Code = 2 WHERE AccountID = '%s'",szAccount);

	if(g_EventDB.Exec(szQuery) == TRUE)
	{
		pMsg.bSUCCESS = TRUE;
	}

	g_EventDB.Clear();
	DataSend(aIndex,(LPBYTE)&pMsg,pMsg.h.size);
}
Exemplo n.º 21
0
void EGAnsPCBangUpdateUser(LPBYTE aRecv,int aIndex)
{
	PMSG_PCBANGUSER_SENDINFO* lpMsg = (PMSG_PCBANGUSER_SENDINFO*)aRecv;
	PMSG_PCBANGUSER_SENDINFO pMsg;

	char szAccountId[MAX_IDSTRING+1];

	memcpy(szAccountId,lpMsg->szAccountID,MAX_IDSTRING);
	szAccountId[MAX_IDSTRING] = '\0';

	PHeadSetB((LPBYTE)&pMsg,0x24,sizeof(pMsg));
	pMsg.aIndex = lpMsg->aIndex;
	pMsg.Point = lpMsg->Point;
	pMsg.btResult = 0;

	char szQuery[256];
	sprintf(szQuery,"UPDATE PCBANG_USER SET pcbang_points = %d WHERE pcbang_id = '%s'",
		lpMsg->Point,szAccountId);

	if( g_EventDB.Exec(szQuery) == TRUE )
	{
		pMsg.btResult = TRUE;
	}
	g_EventDB.Clear();

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

}
Exemplo n.º 22
0
void ReqSummonPetInfo(LPBMSG_REQSUMMONINFO lpMsg,int aIndex)
{
char szQuery[256];
char szName[MAX_IDSTRING+1] = {0};

	memcpy(szName,lpMsg->szName,MAX_IDSTRING);

	g_Window.ServerLogAdd(ST_EVENTSERVER,"[SUMMON PET] Data request (%s)",szName);

	PBMSG_ANSSUMMONINFO pMsg;

	pMsg.h.c = 0xC1;
	pMsg.h.size = sizeof( pMsg );
	pMsg.h.headcode = 0x66;
	pMsg.h.subcode = 0;

	pMsg.aIndex = lpMsg->aIndex;
	strcpy(pMsg.szName,szName);

	pMsg.result = FALSE;

	sprintf(szQuery,"SELECT summon_level, summon_exp FROM T_SummonPet_Info WHERE memb__char = '%s'",szName);

	if( g_MyEventDB.Exec(szQuery) == TRUE )
	{
		pMsg.result = TRUE;

		pMsg.Level = 0;
		pMsg.Exp = 0;

		if( g_MyEventDB.Fetch() != SQL_NO_DATA )
		{
			pMsg.Level = g_MyEventDB.GetInt("summon_level");
			pMsg.Exp = g_MyEventDB.GetInt64("summon_exp");
		}
		else
		{
			g_MyEventDB.Clear();

			sprintf(szQuery,"INSERT INTO T_SummonPet_Info (memb__char,summon_level,summon_exp) VALUES ('%s',1,0)",szName);
			g_MyEventDB.Exec(szQuery);
		}
	}
	g_MyEventDB.Clear();

	DataSend(aIndex,(LPBYTE)&pMsg,sizeof( pMsg ));
}
Exemplo n.º 23
0
void OlympResetPeriod(LPOLP_REQ_RESET lpMsg,int aIndex)
{
	char szQuery[512];
	sprintf(szQuery,"EXEC WZ_OG_ResetPeriod	%d",lpMsg->wMapSvrNum);

	g_MyEventDB.Exec(szQuery);
	g_MyEventDB.Clear();
}
Exemplo n.º 24
0
int PartyMatchInfo(LPMSG_PARTYMATCHING_INFO_REQ lpMsg,PARTYMATCH_INFO* pBodyMsg,int& count,int& pages)
{
	char szQuery[256];
	long dwLen = 0;
	int TotalPages = 0;

#ifdef ZTEAMDB
	sprintf(szQuery,"EXEC PartyMatching_GetList ?,%d,%d,'%s',%d,%d,%d",
		lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch,
		lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#else
	sprintf(szQuery,"EXEC WZ_PM_Listinfo ?,%d,%d,'%s',%d,%d,%d",
		lpMsg->RequestPage,lpMsg->ReqType,lpMsg->szSearch,
		lpMsg->Level,lpMsg->Class,lpMsg->Gens);
#endif

	g_PartyMatchDB.BindParameterIntOutput(1,&TotalPages,&dwLen);

	if( !g_PartyMatchDB.Exec(szQuery) )
	{
		g_PartyMatchDB.Clear();
		return -1;
	}

	count = 0;
	int fResult;

	while( (fResult = g_PartyMatchDB.Fetch()) != SQL_NO_DATA && fResult != SQL_ERROR )
	{
		pBodyMsg[count].btPartyCount = g_PartyMatchDB.GetInt("PartyCount");
		pBodyMsg[count].LeaderLevel = g_PartyMatchDB.GetInt("LeaderLevel");
		pBodyMsg[count].LeaderClass = g_PartyMatchDB.GetInt("LeaderClass");
		pBodyMsg[count].LeaderChannel = g_PartyMatchDB.GetInt("LeaderChannel");
		pBodyMsg[count].btClass = g_PartyMatchDB.GetInt("Class");
		pBodyMsg[count].MinLevel = g_PartyMatchDB.GetInt("MinLevel");
		pBodyMsg[count].MaxLevel = g_PartyMatchDB.GetInt("MaxLevel");
		pBodyMsg[count].MoveReqId = g_PartyMatchDB.GetInt("MoveReqId");
		pBodyMsg[count].Gens = g_PartyMatchDB.GetInt("Gens");

		char szTmpPassword[8] = {0};
		g_PartyMatchDB.GetStr("Password",szTmpPassword);
		pBodyMsg[count].btIsPassword = (strlen(szTmpPassword) > 1) ? TRUE : FALSE;

		g_PartyMatchDB.GetStr("PartyLeader",pBodyMsg[count].szLeader);
		g_PartyMatchDB.GetStr("Description",pBodyMsg[count].szDescription);
		count++;
	}

	while( g_PartyMatchDB.MoreResults() != SQL_NO_DATA )
	{

	}

	pages = TotalPages;
	g_PartyMatchDB.Clear();
	return 0;
}
Exemplo n.º 25
0
void CRainbowRaceDBCtrl::LoadRainbowRace( DPID dpId )
{
	CQuery* pQuery = GetQueryObject();
	char szQuery[QUERY_SIZE] = {0,};

	// m_nTimes 정보 가져오기.. 없으면 0
	sprintf( szQuery, "RAINBOWRACE_STR 'S1', '%02d', 0, '0000000', 0", g_appInfo.dwSys );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }

	if( pQuery->Fetch() )
		m_nTimes = pQuery->GetInt( "nTimes" );
	if( m_nTimes == 0 )
	{
		m_nTimes = 1;
		return;
	}

	// 신청자 목록
	vector<DWORD> vec_dwNowPlayerId;
	sprintf( szQuery, "RAINBOWRACE_STR 'S2', '%02d', %d, '0000000', 0", g_appInfo.dwSys, m_nTimes );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }

	while( pQuery->Fetch() )
		vec_dwNowPlayerId.push_back( static_cast<DWORD>( pQuery->GetInt( "m_idPlayer" ) ) );
	
	if( vec_dwNowPlayerId.size() == 0 )		// 현재 신청자가 없으면 다음 회 진행...
		m_nTimes++;

	// 이전 대회 랭킹
	vector<DWORD> vec_dwPrevRanking;
	if( m_nTimes > 1 )	// 현재가 2회 이상일때만..( 1회 이상 진행했을 경우 )
	{
		sprintf( szQuery, "RAINBOWRACE_STR 'S3', '%02d', %d, '0000000', 0", g_appInfo.dwSys, m_nTimes );
		if( pQuery->Exec( szQuery ) == FALSE )
		{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }

		while( pQuery->Fetch() )
			vec_dwPrevRanking.push_back( static_cast<DWORD>( pQuery->GetInt( "m_idPlayer" ) ) );
	}

	CDPTrans::GetInstance()->SendRainbowRaceInfo( vec_dwNowPlayerId, vec_dwPrevRanking, dpId );
}
Exemplo n.º 26
0
void CRainbowRaceDBCtrl::Application( DWORD dwPlayerId )
{
	CQuery* pQuery = GetQueryObject();
	char szQuery[QUERY_SIZE] = {0,};

	// 등록한 신청자를 DB에 저장한다.
	sprintf( szQuery, "RAINBOWRACE_STR 'I1', '%02d', %d, '%07d', 0", g_appInfo.dwSys, m_nTimes, dwPlayerId );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }
}
Exemplo n.º 27
0
void CRainbowRaceDBCtrl::UpdateRanking( DWORD dwPlayerId, int nRanking )
{
	CQuery* pQuery = GetQueryObject();
	char szQuery[QUERY_SIZE] = {0,};

	// 완주한 유저를 랭킹 예약한다.
	sprintf( szQuery, "RAINBOWRACE_STR 'U1', '%02d', %d, '%07d', %d", g_appInfo.dwSys, m_nTimes, dwPlayerId, nRanking );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }
}
Exemplo n.º 28
0
void CRainbowRaceDBCtrl::UpdateWinnersLosers()
{
	CQuery* pQuery = GetQueryObject();
	char szQuery[QUERY_SIZE] = {0,};

	// 랭킹예약자와 완주실패자를 저장한다.
	sprintf( szQuery, "RAINBOWRACE_STR 'U2', '%02d', %d, '0000000', 0", g_appInfo.dwSys, m_nTimes );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }
}
Exemplo n.º 29
0
void CRainbowRaceDBCtrl::FailedUser( DWORD dwPlayerId )
{
	CQuery* pQuery = GetQueryObject();
	char szQuery[QUERY_SIZE] = {0,};

	// 레인보우레이스 시작시 접속안한 유저 실패처리
	sprintf( szQuery, "RAINBOWRACE_STR 'U3', '%02d', %d, '%07d', 0", g_appInfo.dwSys, m_nTimes, dwPlayerId );
	if( pQuery->Exec( szQuery ) == FALSE )
	{ WriteLog( "%s, %d\t%s", __FILE__, __LINE__, szQuery ); return; }
}
Exemplo n.º 30
0
BOOL CArena::AddToDatabase( u_long idPlayer, CString szName, u_int nJob )
{
	CQuery* pQuery = new CQuery;
	if( pQuery->Connect( 3, "Character01", "", "" ) == FALSE )
	{
		pQuery->DisConnect();
		SAFE_DELETE( pQuery );
		return FALSE;
	}

	CString szDatabaseAdd;
	szDatabaseAdd.Format( "INSERT INTO dbo.ARENA values(%u," //idPlayer
		"0,"//nKill
		"0,"//nDeath
		"0,"//nRow
		"%u,"//nJob
		"0,"//nDeathmatchWin
		"0,"//nDeathMatchLose
		"0,"//nDuelWin
		"0,"//nDuelLose
		"0,"//n64ArenaPoint
		"'%s')", /*szName*/
		idPlayer, nJob, szName );
	

	//Error( szDatabaseAdd );

		/*

			ar << it->second.nKill;
		ar << it->second.nDeath;
		ar << it->second.nRow;
		ar << it->second.nJob;
		ar << it->second.nDeathMatchWin;
		ar << it->second.nDeathMatchLose;
		ar << it->second.nDuelWin;
		ar << it->second.nDuelLose;
		ar << it->second.n64ArenaPoint;

		*/

	if( pQuery->Exec( szDatabaseAdd ) == FALSE )
	{
		Error( "------- Start of CArena::AddToDatabase -------" );
		Error( "Error Inserting User. Query ---> %s", szDatabaseAdd );
		Error( "--------- End of CArena::AddToDatabase -------" );
		pQuery->DisConnect();
		SAFE_DELETE( pQuery );
		return FALSE;
	}

	pQuery->DisConnect();
	SAFE_DELETE( pQuery );
	return TRUE;
}