Exemple #1
0
void InitMagicInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MAGIC");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMagicInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMagicInfo < 0) return;

	g_pMagicInfo = new CMagicInfo[g_nNumOfMagicInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MAGIC ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMagicInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				g_pMagicInfo[i].nIndex			= atoi( pRec->Get( "FLD_INDEX" ) );
				
				strcpy(g_pMagicInfo[i].szName, pRec->Get( "FLD_NAME" ) );
				ChangeSpaceToNull(g_pMagicInfo[i].szName);

				g_pMagicInfo[i].sEffectType		= atoi( pRec->Get( "FLD_EFFECTTYPE" ) );
				g_pMagicInfo[i].sEffect			= atoi( pRec->Get( "FLD_EFFECT" ) );
				g_pMagicInfo[i].sSpell			= atoi( pRec->Get( "FLD_SPELL" ) );
				g_pMagicInfo[i].sPower			= atoi( pRec->Get( "FLD_POWER" ) );
				g_pMagicInfo[i].sMaxPower		= atoi( pRec->Get( "FLD_MAXPOWER" ) );
				g_pMagicInfo[i].sDefSpell		= atoi( pRec->Get( "FLD_DEFSPELL" ) );
				g_pMagicInfo[i].sDefPower		= atoi( pRec->Get( "FLD_DEFPOWER" ) );
				g_pMagicInfo[i].sDefMaxPower	= atoi( pRec->Get( "FLD_DEFMAXPOWER" ) );
				g_pMagicInfo[i].sJob			= atoi( pRec->Get( "FLD_JOB" ) );
				g_pMagicInfo[i].sNeed[0]		= atoi( pRec->Get( "FLD_NEEDL1" ) );
				g_pMagicInfo[i].nTrain[0]		= atoi( pRec->Get( "FLD_L1TRAIN" ) );
				g_pMagicInfo[i].sNeed[1]		= atoi( pRec->Get( "FLD_NEEDL2" ) );
				g_pMagicInfo[i].nTrain[1]		= atoi( pRec->Get( "FLD_L2TRAIN" ) );
				g_pMagicInfo[i].sNeed[2]		= atoi( pRec->Get( "FLD_NEEDL3" ) );
				g_pMagicInfo[i].nTrain[2]		= atoi( pRec->Get( "FLD_L3TRAIN" ) );
				g_pMagicInfo[i].sDelay			= atoi( pRec->Get( "FLD_DELAY" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_MAGICDATA, &g_nNumOfMagicInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #2
0
void InitMonsterGenInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MONGEN");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMonGenInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMonGenInfo < 0) return;

	g_pMonGenInfo = new CMonsterGenInfo[g_nNumOfMonGenInfo + 1];

	sprintf( szQuery, "SELECT * FROM TBL_MONGEN ORDER BY FLD_MAPNAME");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMonGenInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pMonGenInfo[i].szMapName, pRec->Get( "FLD_MAPNAME" ) );
				strcpy(g_pMonGenInfo[i].szMonName, pRec->Get( "FLD_MONNAME" ) );
				
				g_pMonGenInfo[i].dwZenTime		= atoi( pRec->Get( "FLD_GENTIME" ) ) * 60000;
				g_pMonGenInfo[i].dwStartTime	= 0;

				g_pMonGenInfo[i].nMonIndex		= atoi( pRec->Get( "FLD_MONINDEX" ) );

				g_pMonGenInfo[i].nCount			= atoi( pRec->Get( "FLD_COUNT" ) );

				g_pMonGenInfo[i].nX				= atoi( pRec->Get( "FLD_X" ) );
				g_pMonGenInfo[i].nY				= atoi( pRec->Get( "FLD_Y" ) );

				g_pMonGenInfo[i].nAreaX			= atoi( pRec->Get( "FLD_AREA_X" ) );
				g_pMonGenInfo[i].nAreaY			= atoi( pRec->Get( "FLD_AREA_Y" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_MONGEN, &g_nNumOfMonGenInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #3
0
void InitStdItemEtcInfo()
{
	char szQuery[1024];

	CRecordset *pRec;
	
	pRec= g_pConnCommon->CreateRecordset();

	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_STDITEM_ETC");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nStdItemEtc = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nStdItemEtc < 0) return;

	g_pStdItemEtc = new CStdItem[g_nStdItemEtc];

	sprintf( szQuery, "SELECT * FROM TBL_STDITEM_ETC ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nStdItemEtc; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pStdItemEtc[i].szName, pRec->Get( "FLD_NAME" ) );

				g_pStdItemEtc[i].wStdMode	= atoi( pRec->Get( "FLD_STDMODE" ) );
				g_pStdItemEtc[i].wShape		= atoi( pRec->Get( "FLD_SHAPE" ) );
				g_pStdItemEtc[i].wWeight	= atoi( pRec->Get( "FLD_WEIGHT" ) );
				g_pStdItemEtc[i].dwLooks	= atoi( pRec->Get( "FLD_LOOKS" ) );
				g_pStdItemEtc[i].wDuraMax	= atoi( pRec->Get( "FLD_VAL1" ) );
				g_pStdItemEtc[i].dwRSource	= atoi( pRec->Get( "FLD_VAL2" ) );
				g_pStdItemEtc[i].dwPrice	= atoi( pRec->Get( "FLD_PRICE" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_STDITEMETC, &g_nStdItemEtc, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #4
0
void InitMonItemInfo()
{
	int			nMonIndex;
	char		szQuery[1024];
	CRecordset *pRec = g_pConnCommon->CreateRecordset();

	sprintf( szQuery, "SELECT * FROM TBL_MONITEM");

	if (pRec->Execute( szQuery ))
	{
		while (pRec->Fetch())
		{
			nMonIndex = atoi( pRec->Get( "FLD_MONSTER" ));

			CMonItem* pMonItem = new CMonItem;

			if (pMonItem)
			{
				pMonItem->m_btItemType	= atoi( pRec->Get( "FLD_TYPE" ));
				pMonItem->m_wItemIndex	= atoi( pRec->Get( "FLD_ITEM" ));
				pMonItem->m_nPoint		= atoi( pRec->Get( "FLD_PROBABLY" ));
				pMonItem->m_wCount		= atoi( pRec->Get( "FLD_COUNT" ));
			
				if (g_pMonRaceInfo && (nMonIndex <= g_nNumOfMonRaceInfo))
					g_pMonRaceInfo[nMonIndex].m_xMonItemList.AddNewNode(pMonItem);
			}
		}	
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #5
0
void LoadCharacterRecords()
{
	InsertLogMsg(IDS_LOADACCOUNTRECORDS);

	CRecordset *pRec = GetDBManager()->CreateRecordset();
	if ( pRec->Execute( "SELECT * FROM TBL_GAMEGATEINFO" ) )
	{
		GAMESERVERINFO *pServerInfo;

		while ( pRec->Fetch() )
		{
			pServerInfo = new GAMESERVERINFO;
			if ( !pServerInfo )
				break;

			pServerInfo->index = atoi( pRec->Get( "FLD_SERVERIDX" ) );
			strcpy( pServerInfo->name, pRec->Get( "FLD_SERVERNAME" ) );
			strcpy( pServerInfo->ip,   pRec->Get( "FLD_SERVERIP" ) );
			pServerInfo->connCnt = 0;

			g_xGameServerList.AddNewNode( pServerInfo );
		}
	}
	GetDBManager()->DestroyRecordset( pRec );
}
Exemple #6
0
void InitMerchantInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MERCHANT");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMurchantInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMurchantInfo < 0) return;

	g_pMerchantInfo = new CMerchantInfo[g_nNumOfMurchantInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MERCHANT ORDER BY FLD_ID");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMurchantInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pMerchantInfo[i].szNPCName, pRec->Get( "FLD_NPCNAME" ) );
				ChangeSpaceToNull(g_pMerchantInfo[i].szNPCName);
				strcpy(g_pMerchantInfo[i].szMapName, pRec->Get( "FLD_MAPNAME" ) );
				ChangeSpaceToNull(g_pMerchantInfo[i].szMapName);

				g_pMerchantInfo[i].nPosX = atoi( pRec->Get( "FLD_POSX" ) );
				g_pMerchantInfo[i].nPosY = atoi( pRec->Get( "FLD_POSY" ) );
				g_pMerchantInfo[i].sFace = atoi( pRec->Get( "FLD_FACE" ) );
				g_pMerchantInfo[i].sBody = atoi( pRec->Get( "FLD_BODY" ) );
				g_pMerchantInfo[i].sGender = atoi( pRec->Get( "FLD_GENDER" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_MERCHANT, &g_nNumOfMurchantInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #7
0
void InitMoveMapEventInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MOVEMAPEVENT");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMoveMapEventInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMoveMapEventInfo < 0) return;

	g_pMoveMapEventInfo = new CMoveMapEventInfo[g_nNumOfMoveMapEventInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MOVEMAPEVENT ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMoveMapEventInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pMoveMapEventInfo[i].szSMapFileName, pRec->Get( "FLD_SMAPFILENAME" ) );
				strcpy(g_pMoveMapEventInfo[i].szDMapFileName, pRec->Get( "FLD_DMAPFILENAME" ) );

				g_pMoveMapEventInfo[i].nSX = atoi( pRec->Get( "FLD_SX" ) );
				g_pMoveMapEventInfo[i].nSY = atoi( pRec->Get( "FLD_SY" ) );
				g_pMoveMapEventInfo[i].nDX = atoi( pRec->Get( "FLD_DX" ) );
				g_pMoveMapEventInfo[i].nDY = atoi( pRec->Get( "FLD_DY" ) );

				g_pMoveMapEventInfo[i].fIsOpen = FALSE;
			}
		}

		InsertLogMsgParam(IDS_FETCH_MOVEMAPEVENT, &g_nNumOfMoveMapEventInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #8
0
CMapInfo* InitMapInfo(int nServerIndex)
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MAPINFO WHERE FLD_SERVERINDEX = %d", nServerIndex );

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMapInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMapInfo < 0) return NULL;

	CMapInfo* pMapInfo = new CMapInfo[g_nNumOfMapInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MAPINFO WHERE FLD_SERVERINDEX = %d", nServerIndex );

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMapInfo; i++)
		{
			if (pRec->Fetch())
			{
				strcpy(pMapInfo[i].szMapFileName, pRec->Get( "FLD_MAPFILENAME" ) );
				ChangeSpaceToNull(pMapInfo[i].szMapFileName);
				strcpy(pMapInfo[i].szMapName, pRec->Get( "FLD_MAPNAME" ) );
				ChangeSpaceToNull(pMapInfo[i].szMapName);

				pMapInfo[i].dwAttribute			= atoi( pRec->Get( "FLD_ATTRIBUTE" ) );

				pMapInfo[i].btMapSeries			= atoi( pRec->Get( "FLD_MAPSERIES" ) );
				pMapInfo[i].btMapSeriesValue	= atoi( pRec->Get( "FLD_MAPSERIESVAL" ) );
			}
		}
	}

	g_pConnCommon->DestroyRecordset( pRec );

	return pMapInfo;
}
UINT WINAPI LoadAccountRecords(LPVOID lpParameter)
{
	InsertLogMsg(IDS_LOADACCOUNTRECORDS);

	CRecordset *pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( "UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=0 WHERE FLD_CERTIFICATION >= 30" );
	GetDBManager()->DestroyRecordset( pRec );
	// ----------------------------------------------------------------------------------------

	GAMESERVERINFO *pServerInfo;

	pRec = GetDBManager()->CreateRecordset();
	if ( pRec->Execute( "SELECT * FROM TBL_SERVERINFO" ) )
	{
		while ( pRec->Fetch() )
		{			
			pServerInfo = new GAMESERVERINFO;
			if ( !pServerInfo )
				break;

			pServerInfo->index = atoi( pRec->Get( "FLD_SERVERIDX" ) );
			strcpy( pServerInfo->name, pRec->Get( "FLD_SERVERNAME" ) );
			strcpy( pServerInfo->ip,   pRec->Get( "FLD_SERVERIP" ) );
			pServerInfo->connCnt = 0;

			g_xGameServerList.AddNewNode( pServerInfo );
		}
	}
	GetDBManager()->DestroyRecordset( pRec );

	char szTmp[64];
	for ( PLISTNODE pNode = g_xGameServerList.GetHead(); pNode; pNode = g_xGameServerList.GetNext( pNode ) )
	{
		pServerInfo = g_xGameServerList.GetData( pNode );
		
		sprintf( szTmp, "%d,%s,", pServerInfo->index, pServerInfo->name );
		strcat( g_szServerList, szTmp );
	}
	// ----------------------------------------------------------------------------------------

	InitServerThreadForMsg();

	if (InitServerSocket(g_gcSock, &g_gcAddr, _IDM_GATECOMMSOCK_MSG, 5500, 1))
		SwitchMenuItem(TRUE);

	return 0L;
}
Exemple #10
0
void InitMonRaceInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MONSTER");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMonRaceInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMonRaceInfo < 0) return;

	g_pMonRaceInfo = new CMonRaceInfo[g_nNumOfMonRaceInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MONSTER ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMonRaceInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				g_pMonRaceInfo[i].nIndex	= i;

				strcpy(g_pMonRaceInfo[i].szMonName, pRec->Get( "FLD_NAME" ) );
				ChangeSpaceToNull(g_pMonRaceInfo[i].szMonName);

				g_pMonRaceInfo[i].nMonRace		= atoi( pRec->Get( "FLD_RACE" ) );
				g_pMonRaceInfo[i].nAppear		= atoi( pRec->Get( "FLD_APPR" ) );

				g_pMonRaceInfo[i].btUndead		= (BYTE)atoi( pRec->Get( "FLD_UNDEAD" ) );
				g_pMonRaceInfo[i].Level			= (BYTE)atoi( pRec->Get( "FLD_LEVEL" ) );

				g_pMonRaceInfo[i].HP			= atoi( pRec->Get( "FLD_HP" ) );
				g_pMonRaceInfo[i].MP			= atoi( pRec->Get( "FLD_MP" ) );

				g_pMonRaceInfo[i].AC			= atoi( pRec->Get( "FLD_AC" ) );
				g_pMonRaceInfo[i].MAC			= atoi( pRec->Get( "FLD_MAC" ) );
				g_pMonRaceInfo[i].DC			=  MAKEWORD((BYTE)atoi( pRec->Get( "FLD_DC" ) ), (BYTE)atoi( pRec->Get( "FLD_MAXDC" ) ));

				g_pMonRaceInfo[i].dwAttackSpeed = atoi( pRec->Get( "FLD_ATTACKSPEED" ) );
				g_pMonRaceInfo[i].dwWalkSpeed	= atoi( pRec->Get( "FLD_WALKSPEED" ) );

				g_pMonRaceInfo[i].Speed			= atoi( pRec->Get( "FLD_SPEED" ) );
				g_pMonRaceInfo[i].Hit			= atoi( pRec->Get( "FLD_HIT" ) );

				g_pMonRaceInfo[i].ViewRange		= (BYTE)atoi( pRec->Get( "FLD_VIEWRANGE" ) );

				g_pMonRaceInfo[i].wRaceIndex	= atoi( pRec->Get( "FLD_RACEINDEX" ) );

				g_pMonRaceInfo[i].Exp			= atoi( pRec->Get( "FLD_EXP" ) );

				g_pMonRaceInfo[i].wEscape		= atoi( pRec->Get( "FLD_ESCAPE" ) );

				g_pMonRaceInfo[i].m_wWater		= MAKEWORD((BYTE)atoi( pRec->Get( "FLD_WATER1" ) ), (BYTE)atoi( pRec->Get( "FLD_WATER2" ) ));
				g_pMonRaceInfo[i].m_wFire		= MAKEWORD((BYTE)atoi( pRec->Get( "FLD_FIRE1" ) ), (BYTE)atoi( pRec->Get( "FLD_FIRE2" ) ));
				g_pMonRaceInfo[i].m_wWind		= MAKEWORD((BYTE)atoi( pRec->Get( "FLD_WIND1" ) ), (BYTE)atoi( pRec->Get( "FLD_WIND2" ) ));
				g_pMonRaceInfo[i].m_wLight		= MAKEWORD((BYTE)atoi( pRec->Get( "FLD_LIGHT1" ) ), (BYTE)atoi( pRec->Get( "FLD_LIGHT2" ) ));
				g_pMonRaceInfo[i].m_wEarth		= MAKEWORD((BYTE)atoi( pRec->Get( "FLD_EARTH1" ) ), (BYTE)atoi( pRec->Get( "FLD_EARTH2" ) ));
			}
		}

		InsertLogMsgParam(IDS_FETCH_MONSTER, &g_nNumOfMonRaceInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );

	InitMonItemInfo();
}
Exemple #11
0
void InitStdItemSpecial()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_STDITEM");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nStdItemSpecial = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nStdItemSpecial < 0) return;

	g_pStdItemSpecial = new CStdItemSpecial[g_nStdItemSpecial];

	sprintf( szQuery, "SELECT * FROM TBL_STDITEM ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nStdItemSpecial; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pStdItemSpecial[i].szName, pRec->Get( "FLD_NAME" ) );

				g_pStdItemSpecial[i].wStdMode		= (SHORT)atoi( pRec->Get( "FLD_STDMODE" ) );
				g_pStdItemSpecial[i].btType			= (BYTE)atoi( pRec->Get( "FLD_TYPE" ) );
				g_pStdItemSpecial[i].wShape			= (SHORT)atoi( pRec->Get( "FLD_SHAPE" ) );
				g_pStdItemSpecial[i].wWeight		= (SHORT)atoi( pRec->Get( "FLD_WEIGHT" ) );
				g_pStdItemSpecial[i].wAniCount		= (SHORT)atoi( pRec->Get( "FLD_ANICOUNT" ) );
				g_pStdItemSpecial[i].wSource		= (SHORT)atoi( pRec->Get( "FLD_SOURCE" ) );
				g_pStdItemSpecial[i].dwLooks		= (LONG)atoi( pRec->Get( "FLD_LOOKS" ) );
				g_pStdItemSpecial[i].wDuraMax		= (WORD)atoi( pRec->Get( "FLD_DURAMAX" ) );
				g_pStdItemSpecial[i].wAC			= (BYTE)atoi( pRec->Get( "FLD_AC" ) );
				g_pStdItemSpecial[i].wAC2			= (BYTE)atoi( pRec->Get( "FLD_AC2" ) );
				g_pStdItemSpecial[i].wMAC			= (BYTE)atoi( pRec->Get( "FLD_MAC" ) );
				g_pStdItemSpecial[i].wMAC2			= (BYTE)atoi( pRec->Get( "FLD_MAC2" ) );
				g_pStdItemSpecial[i].wDC			= (BYTE)atoi( pRec->Get( "FLD_DC" ) );
				g_pStdItemSpecial[i].wDC2			= (BYTE)atoi( pRec->Get( "FLD_DC2" ) );
				g_pStdItemSpecial[i].wMC			= (BYTE)atoi( pRec->Get( "FLD_MC" ) );
				g_pStdItemSpecial[i].wMC2			= (BYTE)atoi( pRec->Get( "FLD_MC2" ) );
				g_pStdItemSpecial[i].wSC			= (BYTE)atoi( pRec->Get( "FLD_SC" ) );
				g_pStdItemSpecial[i].wSC2			= (BYTE)atoi( pRec->Get( "FLD_SC2" ) );
				g_pStdItemSpecial[i].wNeed			= (SHORT)atoi( pRec->Get( "FLD_NEED" ) );
				g_pStdItemSpecial[i].wNeedLevel		= (SHORT)atoi( pRec->Get( "FLD_NEEDLEVEL" ) );
				g_pStdItemSpecial[i].dwPrice		= (LONG)atoi( pRec->Get( "FLD_PRICE" ) );
				g_pStdItemSpecial[i].dwStock		= (LONG)atoi( pRec->Get( "FLD_STOCK" ) );

				g_pStdItemSpecial[i].m_btWater		= (BYTE)atoi( pRec->Get( "FLD_WATER1" ) );
				g_pStdItemSpecial[i].m_btWater2		= (BYTE)atoi( pRec->Get( "FLD_WATER2" ) );
				g_pStdItemSpecial[i].m_btFire		= (BYTE)atoi( pRec->Get( "FLD_FIRE1" ) );
				g_pStdItemSpecial[i].m_btFire2		= (BYTE)atoi( pRec->Get( "FLD_FIRE2" ) );
				g_pStdItemSpecial[i].m_btWind		= (BYTE)atoi( pRec->Get( "FLD_WIND1" ) );
				g_pStdItemSpecial[i].m_btWind2		= (BYTE)atoi( pRec->Get( "FLD_WIND2" ) );
				g_pStdItemSpecial[i].m_btLight		= (BYTE)atoi( pRec->Get( "FLD_LIGHT1" ) );
				g_pStdItemSpecial[i].m_btLight2		= (BYTE)atoi( pRec->Get( "FLD_LIGHT2" ) );
				g_pStdItemSpecial[i].m_btEarth		= (BYTE)atoi( pRec->Get( "FLD_EARTH1" ) );
				g_pStdItemSpecial[i].m_btEarth2		= (BYTE)atoi( pRec->Get( "FLD_EARTH2" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_STDITEMACCESSORY, &g_nStdItemSpecial, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
Exemple #12
0
void CGateInfo::ProcLogin(SOCKET s, char *pszData)
{
    char				szIDPassword[32];
    char				*pszID, *pszPassword;
    char				szEncodePacket[64];
    _TDEFAULTMESSAGE	DefMsg;
    int					nPos;
    char				szQuery[256];

    if (memlen(pszData) - 1 <= 0) return;

    PLISTNODE pListNode = xUserInfoList.GetHead();

    while (pListNode)
    {
        CUserInfo *pUserInfo = xUserInfoList.GetData(pListNode);

        if (pUserInfo->sock == s)
        {
            int nDecodeLen = fnDecode6BitBufA(pszData, szIDPassword, sizeof(szIDPassword));
            szIDPassword[nDecodeLen] = '\0';

            pszID		= &szIDPassword[0];

            if (pszPassword	= (char *)memchr(szIDPassword, '/', sizeof(szIDPassword)))
            {
                *pszPassword = '******';
                pszPassword++;

                sprintf( szQuery, "SELECT * FROM TBL_ACCOUNT WHERE FLD_LOGINID='%s'", pszID );

                CRecordset *pRec = GetDBManager()->CreateRecordset();

                if ( !pRec->Execute( szQuery ) || !pRec->Fetch() )
                    fnMakeDefMessageA( &DefMsg, SM_ID_NOTFOUND, 0, 0, 0, 0 );
                else if ( CompareDBString( pszPassword, pRec->Get( "FLD_PASSWORD" ) ) != 0 )
                    fnMakeDefMessageA( &DefMsg, SM_PASSWD_FAIL, 0, 0, 0, 0 );
                else
                {
                    int nCertCode = atoi( pRec->Get( "FLD_CERTIFICATION" ) );
                    /*
                    			if ( nCertCode > 0 && nCertCode < 30 )
                    				fnMakeDefMessageA(&DefMsg, SM_CERTIFICATION_FAIL, (nCertCode + 1), 0, 0, 0);
                    			else if ( nCertCode >= 30 )
                    				fnMakeDefMessageA(&DefMsg, SM_CERTIFICATION_FAIL, 1, 0, 0, 0);
                    			else*/
                    {
                        char szEncodeServerList[512];
                        char szEncodeAllPacket[1024];

                        fnMakeDefMessageA(&DefMsg, SM_PASSOK_SELECTSERVER, 0, 1, 0, 0);
                        nPos = fnEncodeMessageA(&DefMsg, szEncodePacket, sizeof(szEncodePacket));
                        szEncodePacket[nPos] = '\0';

                        int nPos2 = fnEncode6BitBufA((unsigned char *)g_szServerList, szEncodeServerList, memlen(g_szServerList), sizeof(szEncodeServerList));
                        szEncodeServerList[nPos2] = '\0';

                        memmove(szEncodeAllPacket, szEncodePacket, nPos);
                        memmove(&szEncodeAllPacket[nPos], szEncodeServerList, memlen(szEncodeServerList));

                        SendToGate(s, szEncodeAllPacket);

                        GetDBManager()->DestroyRecordset( pRec );

                        pUserInfo->nCertification = GetCertification();

                        //				pRec = GetDBManager()->CreateRecordset();
                        //				sprintf( szQuery,
                        //					"UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=%d WHERE FLD_LOGINID='%s'",
                        //					GetCertification(), pszID );
                        //				pRec->Execute( szQuery );

                        //				GetDBManager()->DestroyRecordset( pRec );

                        return;
                    }
                }

                GetDBManager()->DestroyRecordset( pRec );

                nPos = fnEncodeMessageA(&DefMsg, szEncodePacket, sizeof(szEncodePacket));
                szEncodePacket[nPos] = '\0';

                SendToGate(s, szEncodePacket);
            }
        }

        pListNode = xUserInfoList.GetNext(pListNode);
    }
}
Exemple #13
0
void CGateInfo::MakeNewCharacter(SOCKET s, _LPTCREATECHR lpTCreateChr)
{
	//ERROR: 1=> Exist Charname, 2=>Wrong Name, 3=>Not enough Space, 4=>Error
	_TDEFAULTMESSAGE	DefaultMsg;
	char				szEncodeMsg[32];
	int					nPos;
	char				szQuery[2048];

	sprintf( szQuery, "SELECT FLD_CHARNAME FROM TBL_CHARACTER WHERE FLD_CHARNAME='%s'", lpTCreateChr->szName );

	CRecordset *pRec = GetDBManager()->CreateRecordset();

	pRec->Execute( szQuery );

	if (pRec->Fetch())
	{
		fnMakeDefMessageA(&DefaultMsg, SM_NEWCHR_FAIL, 0, 1, 0, 0);
		nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
		szEncodeMsg[nPos] = '\0';
		
		SendToGate(s, szEncodeMsg);

		GetDBManager()->DestroyRecordset( pRec );

		return;
	}
	
	GetDBManager()->DestroyRecordset( pRec );

	sprintf( szQuery, "SELECT COUNT(FLD_CHARNAME) AS FLD_COUNT FROM TBL_CHARACTER WHERE FLD_CHARNAME='%s'", lpTCreateChr->szName );

	pRec = GetDBManager()->CreateRecordset();

	if (pRec->Execute( szQuery ) || pRec->Fetch() )
	{
		if (atoi(pRec->Get( "FLD_COUNT" )) >= 3)
		{
			fnMakeDefMessageA(&DefaultMsg, SM_NEWCHR_FAIL, 0, 3, 0, 0);
			nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
			szEncodeMsg[nPos] = '\0';
			
			SendToGate(s, szEncodeMsg);

			GetDBManager()->DestroyRecordset( pRec );

			return;
		}

		GetDBManager()->DestroyRecordset( pRec );

		CTblStartPoint::TABLE *table = GetTblStartPoint()->Get( "4" );

		pRec = GetDBManager()->CreateRecordset();

		// TBL_CHARACTER 테이블 추가

		sprintf(szQuery, "INSERT TBL_CHARACTER ("
						"FLD_LOGINID, FLD_CHARNAME, FLD_JOB, FLD_GENDER, FLD_LEVEL, FLD_DIRECTION, "
						"FLD_ATTACKMODE, FLD_CX, FLD_CY, FLD_MAPNAME, FLD_GOLD, FLD_HAIR, "
						"FLD_DRESS_ID, FLD_WEAPON_ID, FLD_LEFTHAND_ID, FLD_RIGHTHAND_ID, FLD_HELMET_ID, "
						"FLD_NECKLACE_ID, FLD_ARMRINGL_ID, FLD_ARMRINGR_ID, FLD_RINGL_ID, "
						"FLD_RINGR_ID, FLD_EXP) VALUES ( "
						"'%s', '%s', %d, %d, 1, 4, "
						"1, %d, %d, '%s', 0, 0, "
						"'0', '0', '0', '0', '0', "
						"'0', '0', '0', '0', "
						"'0', 0 )",
						lpTCreateChr->szID, lpTCreateChr->szName, lpTCreateChr->btClass, lpTCreateChr->btGender,
						table->posX, table->posY, table->mapName);
		pRec->Execute( szQuery );

		sprintf(szQuery, "INSERT TBL_CHARACTER_GENITEM (FLD_LOGINID, FLD_CHARNAME, FLD_ITEMINDEX) VALUES ('%s', '%s', 'G00080008000')",
							lpTCreateChr->szID, lpTCreateChr->szName);
		pRec->Execute( szQuery );
		
		GetDBManager()->DestroyRecordset( pRec );
		
		_TLOADHUMAN		human;
		_TMAKEITEMRCD	makeItem;
		memset( &human, 0, sizeof( human ) );
		memset( &makeItem, 0, sizeof( makeItem ) );

		strcpy( human.szUserID, lpTCreateChr->szID );
		strcpy( human.szCharName, lpTCreateChr->szName );

		// 평복 추가 (0: 남, 1: 여)
		makeItem.szStdType	= 'B';
		makeItem.nStdIndex	= lpTCreateChr->btGender ? 34 : 33;
		makeItem.nDura		= 5000;
		makeItem.nDuraMax	= 5000;
		MakeNewItem( NULL, &human, &makeItem, 0 );

		// 목검 추가
		makeItem.szStdType	= 'A';
		makeItem.nStdIndex	= 7;
		makeItem.nDura		= 4000;
		makeItem.nDuraMax	= 4000;
		MakeNewItem( NULL, &human, &makeItem, 0 );
		
		fnMakeDefMessageA(&DefaultMsg, SM_NEWCHR_SUCCESS, 0, 0, 0, 0);
		nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
		szEncodeMsg[nPos] = '\0';
		
		SendToGate(s, szEncodeMsg);

		return;
	}

	fnMakeDefMessageA(&DefaultMsg, SM_NEWCHR_FAIL, 0, 4, 0, 0);
	nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
	szEncodeMsg[nPos] = '\0';
	
	SendToGate(s, szEncodeMsg);

	GetDBManager()->DestroyRecordset( pRec );
}
Exemple #14
0
void CGateInfo::QueryCharacter(SOCKET s, char *pszPacket)
{
	_TQUERYCHR			tQueryChr[3];
	char				szDecodeMsg[128];
	int					nCnt = 0;
	char				szQuery[256];

	ZeroMemory(tQueryChr, sizeof(tQueryChr));

	int nPos = fnDecode6BitBufA(pszPacket, szDecodeMsg, sizeof(szDecodeMsg));
	szDecodeMsg[nPos] = '\0';

	char *pszDevide = (char *)memchr(szDecodeMsg, '/', nPos);
	
	if (pszDevide)
	{
		*pszDevide++ = '\0';

		sprintf( szQuery, "SELECT * FROM TBL_CHARACTER WHERE FLD_LOGINID='%s'", pszDevide );

		CRecordset *pRec = GetDBManager()->CreateRecordset();
		
		if (pRec->Execute( szQuery ))
		{
			while (pRec->Fetch() && nCnt < 3)
			{
				tQueryChr[nCnt].btClass	 = atoi( pRec->Get( "FLD_JOB" ) );
				tQueryChr[nCnt].btGender = atoi( pRec->Get( "FLD_GENDER" ) );
				strcpy( tQueryChr[nCnt].szName, pRec->Get( "FLD_CHARNAME" ) );
				ChangeSpaceToNull( tQueryChr[nCnt].szName );

				nCnt++;
			}
		}

		GetDBManager()->DestroyRecordset( pRec );

		_TDEFAULTMESSAGE	DefaultMsg;
		char				szEncodeMsg[32];
		char				szEncodeData[256];
		char				szEncodePacket[256];
		
		if (nCnt > 0 && nCnt < 3)
		{
			fnMakeDefMessageA(&DefaultMsg, SM_QUERYCHR, 0, nCnt, 0, 0);
			nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
			int nPos2 = fnEncode6BitBufA((unsigned char *)tQueryChr, szEncodeData, sizeof(_TQUERYCHR) * nCnt, sizeof(szEncodeData));
			
			memmove(szEncodePacket, szEncodeMsg, nPos);
			memmove(&szEncodePacket[nPos], szEncodeData, nPos2);
			szEncodePacket[nPos + nPos2] = '\0';
				
			SendToGate(s, szEncodePacket);
		}
		else
		{
			fnMakeDefMessageA(&DefaultMsg, SM_QUERYCHR_FAIL, 0, 0, 0, 0);
			nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
			szEncodeMsg[nPos] = '\0';
			
			SendToGate(s, szEncodeMsg);
		}
	}
}