forked from metin2/server
revert name change removal
This commit is contained in:
parent
254f6f6664
commit
cf66bb3310
|
@ -2063,7 +2063,64 @@ teleport_area:
|
|||
// 3: 이미 같은 이름이 사용중
|
||||
// 4: 성공
|
||||
// 5: 해당 기능 지원하지 않음
|
||||
lua_pushnumber(L, 5);
|
||||
|
||||
LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
|
||||
|
||||
if ( ch->GetNewName().size() != 0 )
|
||||
{
|
||||
lua_pushnumber(L, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( lua_isstring(L, 1) != true )
|
||||
{
|
||||
lua_pushnumber(L, 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char * szName = lua_tostring(L, 1);
|
||||
|
||||
if ( check_name(szName) == false )
|
||||
{
|
||||
lua_pushnumber(L, 2);
|
||||
return 1;
|
||||
}
|
||||
|
||||
char szQuery[1024];
|
||||
snprintf(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM player%s WHERE name='%s'", get_table_postfix(), szName);
|
||||
std::unique_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery));
|
||||
|
||||
if ( pmsg->Get()->uiNumRows > 0 )
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(pmsg->Get()->pSQLResult);
|
||||
|
||||
int count = 0;
|
||||
str_to_number(count, row[0]);
|
||||
|
||||
// 이미 해당 이름을 가진 캐릭터가 있음
|
||||
if ( count != 0 )
|
||||
{
|
||||
lua_pushnumber(L, 3);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD pid = ch->GetPlayerID();
|
||||
db_clientdesc->DBPacketHeader(HEADER_GD_FLUSH_CACHE, 0, sizeof(DWORD));
|
||||
db_clientdesc->Packet(&pid, sizeof(DWORD));
|
||||
|
||||
/* delete messenger list */
|
||||
MessengerManager::instance().RemoveAllList(ch->GetName());
|
||||
|
||||
/* change_name_log */
|
||||
LogManager::instance().ChangeNameLog(pid, ch->GetName(), szName, ch->GetDesc()->GetHostName());
|
||||
|
||||
snprintf(szQuery, sizeof(szQuery), "UPDATE player%s SET name='%s' WHERE id=%u", get_table_postfix(), szName, pid);
|
||||
SQLMsg * msg = DBManager::instance().DirectQuery(szQuery);
|
||||
M2_DELETE(msg);
|
||||
|
||||
ch->SetNewName(szName);
|
||||
lua_pushnumber(L, 4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue