clquerycharacternamehandler.cpp
来自「dk1游戏的原代码文件,完整.编译系统redhat7.3,mysql 3.23 」· C++ 代码 · 共 125 行
CPP
125 行
//////////////////////////////////////////////////////////////////////////////// Filename : CLQueryCharacterNameHandler.cpp// Written By : Reiot// Description : //////////////////////////////////////////////////////////////////////////////#include "CLQueryCharacterName.h"#ifdef __LOGIN_SERVER__ #include "LoginPlayer.h" #include "DatabaseManager.h" #include "Connection.h" #include "Statement.h" #include "Result.h" #include "Assert.h" #include "GameWorldInfoManager.h" #include "Lpackets/LCQueryResultCharacterName.h"#endifbool isAvailableID(const char* pID);//////////////////////////////////////////////////////////////////////////////// DB 肺何磐 漂沥 敲饭捞绢 酒捞叼甫 茫酒辑 弊 咯何甫 努扼捞攫飘肺 府畔秦霖促.//////////////////////////////////////////////////////////////////////////////void CLQueryCharacterNameHandler::execute (CLQueryCharacterName* pPacket , Player* pPlayer) throw (ProtocolException , Error){ __BEGIN_TRY __BEGIN_DEBUG_EX #ifdef __LOGIN_SERVER__ Assert(pPacket != NULL); Assert(pPlayer != NULL); LoginPlayer* pLoginPlayer = dynamic_cast<LoginPlayer*>(pPlayer); WorldID_t WorldID = pLoginPlayer->getWorldID(); Assert( WorldID <= g_pGameWorldInfoManager->getSize() ); Statement* pStmt = NULL; try { pStmt = g_pDatabaseManager->getConnection( WorldID )->createStatement(); Result* pResult = pStmt->executeQuery( "SELECT Name FROM Slayer WHERE Name = '%s'" , pPacket->getCharacterName().c_str() ); LCQueryResultCharacterName lcQueryResultCharacterName; //cout << "Query Result : " << pPacket->getCharacterName() << " is "; lcQueryResultCharacterName.setCharacterName(pPacket->getCharacterName()); if (pResult->getRowCount() == 0) { lcQueryResultCharacterName.setExist(false); //cout << "not "; } else { lcQueryResultCharacterName.setExist(true); } //-------------------------------------------------------------------------------- // 款康磊客 包访等 捞抚篮 酒囱瘤 八刘茄促. //-------------------------------------------------------------------------------- // by sigi if (!isAvailableID(pPacket->getCharacterName().c_str())) { lcQueryResultCharacterName.setExist(true); } /* string text = pPacket->getCharacterName(); list<string> InvalidTokenList; InvalidTokenList.push_back("包府磊"); InvalidTokenList.push_back("档快固"); InvalidTokenList.push_back("淬寸磊"); InvalidTokenList.push_back("款康"); InvalidTokenList.push_back("扁裙磊"); InvalidTokenList.push_back("俺惯磊"); InvalidTokenList.push_back("抛胶磐"); InvalidTokenList.push_back("流盔"); list<string>::const_iterator itr = InvalidTokenList.begin(); for (; itr != InvalidTokenList.end(); itr++) { if (text.find(*itr) != string::npos) { lcQueryResultCharacterName.setExist(false); } } */ //cout << "exist..." << endl; pLoginPlayer->sendPacket(&lcQueryResultCharacterName); // 孽府啊 咯矾 锅 棵 荐 乐栏骨肺, 咯傈洒 LWFRP 捞促. // 巩力绰 穿焙啊啊 橇肺弊伐阑 楼辑 DOS 傍拜阑 且 荐 乐栏骨肺, // 弥家 矫埃阑 抵具 茄促绰 痢捞促. pLoginPlayer->setPlayerStatus(LPS_WAITING_FOR_CL_GET_PC_LIST); SAFE_DELETE(pStmt); //delete pStmt; // 2002.1.16 by sigi } catch (SQLQueryException & sqe) { SAFE_DELETE(pStmt); throw; } #endif __END_DEBUG_EX __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?