本文整理汇总了C++中CRecordset::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ CRecordset::Execute方法的具体用法?C++ CRecordset::Execute怎么用?C++ CRecordset::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRecordset
的用法示例。
在下文中一共展示了CRecordset::Execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitMagicInfo
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 );
}
示例2: InitMonsterGenInfo
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 );
}
示例3: InitStdItemEtcInfo
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 );
}
示例4: InitMonItemInfo
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 );
}
示例5: LoadCharacterRecords
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 );
}
示例6: InitMerchantInfo
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 );
}
示例7: LoadAccountRecords
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;
}
示例8: InitMapInfo
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;
}
示例9: InitMoveMapEventInfo
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 );
}
示例10: MakeNewUser
void CGateInfo::MakeNewUser(char *pszPacket)
{
char szDecodeMsg[256];
char szEncodeMsg[32];
char *pszID, *pszName, *pszPassword;
_TDEFAULTMESSAGE DefMsg;
fnDecodeMessageA(&DefMsg, pszPacket);
if (DefMsg.wIdent == CM_ADDNEWUSER)
{
int nPos = fnDecode6BitBufA((pszPacket + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
szDecodeMsg[nPos] = '\0';
pszID = &szDecodeMsg[0];
pszName = (char *)memchr(szDecodeMsg, '/', memlen(szDecodeMsg) - 1);
*pszName = '\0';
pszName++;
pszPassword = (char *)memchr(pszName, '/', memlen(pszName) - 1);
*pszPassword = '\0';
pszPassword++;
if ((memlen(pszID) - 1) || (memlen(pszName) - 1) || (memlen(pszPassword) - 1))
{
char szQuery[1024];
sprintf( szQuery,
"INSERT TBL_ACCOUNT( FLD_LOGINID, FLD_PASSWORD, FLD_USERNAME, FLD_CERTIFICATION ) "
"VALUES( '%s', '%s', '%s', 0 )",
pszID, pszPassword, pszName );
CRecordset *pRec = GetDBManager()->CreateRecordset();
if ( pRec->Execute( szQuery ) && pRec->GetRowCount() )
fnMakeDefMessageA( &DefMsg, SM_NEWID_SUCCESS, 0, 0, 0, 0 );
else
fnMakeDefMessageA( &DefMsg, SM_NEWID_FAIL, 0, 0, 0, 0 );
GetDBManager()->DestroyRecordset( pRec );
// -----------------------------------------------------------------------------------
}
else
fnMakeDefMessageA(&DefMsg, SM_NEWID_FAIL, 0, 0, 0, 0);
fnEncodeMessageA(&DefMsg, szEncodeMsg, sizeof(szEncodeMsg));
szDecodeMsg[0] = '#';
memmove(&szDecodeMsg[1], szEncodeMsg, DEFBLOCKSIZE);
szDecodeMsg[DEFBLOCKSIZE + 1] = '!';
szDecodeMsg[DEFBLOCKSIZE + 2] = '\0';
send(sock, szDecodeMsg, DEFBLOCKSIZE + 2, 0);
}
}
示例11: DeleteExistCharacter
void CGateInfo::DeleteExistCharacter(SOCKET s, _LPTCREATECHR lpTCreateChr)
{
_TDEFAULTMESSAGE DefaultMsg;
char szEncodeMsg[32];
char szQuery[256];
CRecordset *pRec;
sprintf( szQuery, "DELETE FROM TBL_CHARACTER WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );
pRec = GetDBManager()->CreateRecordset();
pRec->Execute( szQuery );
GetDBManager()->DestroyRecordset( pRec );
sprintf( szQuery, "DELETE FROM TBL_CHARACTER_GENITEM WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );
pRec = GetDBManager()->CreateRecordset();
pRec->Execute( szQuery );
GetDBManager()->DestroyRecordset( pRec );
sprintf( szQuery, "DELETE FROM TBL_CHARACTER_ITEM WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );
pRec = GetDBManager()->CreateRecordset();
pRec->Execute( szQuery );
GetDBManager()->DestroyRecordset( pRec );
sprintf( szQuery, "DELETE FROM TBL_CHARACTER_MAGIC WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );
pRec = GetDBManager()->CreateRecordset();
pRec->Execute( szQuery );
GetDBManager()->DestroyRecordset( pRec );
fnMakeDefMessageA(&DefaultMsg, SM_DELCHR_SUCCESS, 0, 4, 0, 0);
int nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
szEncodeMsg[nPos] = '\0';
SendToGate(s, szEncodeMsg);
}
示例12: ReceiveServerMsg
void CGateInfo::ReceiveServerMsg(char *pszPacket)
{
char *pszPos;
int nCertification;
int nLen = memlen(pszPacket);
if (pszPos = (char *)memchr(pszPacket, '/', nLen))
{
*pszPos++ = '\0';
nCertification = AnsiStrToVal(pszPos);
char szQuery[256];
sprintf( szQuery,
"UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=%d WHERE FLD_LOGINID='%s'",
nCertification, pszPacket );
CRecordset *pRec = GetDBManager()->CreateRecordset();
pRec->Execute( szQuery );
GetDBManager()->DestroyRecordset( pRec );
}
}
示例13: InitMonRaceInfo
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();
}
示例14: ProcLogin
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 = '\0';
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);
}
}
示例15: MakeNewCharacter
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);
//.........这里部分代码省略.........