Files
Client/Server/AdminTool/AdminToolClient/ModifyCharNameDlg.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code:
- Client: Game client source (moved to Client/Client/)
- Server: Game server source
- GameTools: Development tools
- CryptoSource: Encryption utilities
- database: Database scripts
- Script: Game scripts
- rylCoder_16.02.2008_src: Legacy coder tools
- GMFont, Game: Additional resources

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:17:20 +09:00

140 lines
3.5 KiB
C++

// ModifyCharNameDlg.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "AdminToolClient.h"
#include "ModifyCharNameDlg.h"
#include "UserCharTreeView.h"
#include "GlobalFunctions.h"
#include "CharacterDoc.h"
#include "PacketManager.h"
#include "WindowMgr.h"
// CModifyCharNameDlg 대화 상자입니다.
IMPLEMENT_DYNAMIC(CModifyCharNameDlg, CDialog)
CModifyCharNameDlg::CModifyCharNameDlg(CWnd* pParent /*=NULL*/)
: CDialog(CModifyCharNameDlg::IDD, pParent)
{
m_lpParent = pParent;
INSERT_WINDOW(IDD_MODIFYCHARNAMEDLG, this);
}
CModifyCharNameDlg::~CModifyCharNameDlg()
{
ERASE_WINDOW(IDD_MODIFYCHARNAMEDLG);
}
void CModifyCharNameDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CModifyCharNameDlg, CDialog)
ON_BN_CLICKED(IDC_MODIFY_CHARNAME, OnBnClickedModifyName)
END_MESSAGE_MAP()
// CModifyCharNameDlg 메시지 처리기입니다.
BOOL CModifyCharNameDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CUserCharTreeView* lpTreeView = static_cast<CUserCharTreeView*>(m_lpParent);
if(NULL != lpTreeView)
{
CTreeCtrl* lpTree = static_cast<CTreeCtrl*>(lpTreeView->GetDlgItem(IDC_CHARTREE));
if(NULL != lpTree)
{
HTREEITEM hItem = lpTree->GetSelectedItem();
CString strItemText = lpTree->GetItemText(hItem);
TCHAR szName[20], szTmp[256];
_stscanf(strItemText, _T("%s %s"), szTmp, szName);
SetDlgItemText(IDC_CURRENT_CHARNAME, szName);
}
}
SetWindowText(GetLocalString("IDD_MODIFYCHARNAMEDLG"));
SetUIString(this->m_hWnd, IDC_NAMEMODIFY_01, "IDC_NAMEMODIFY_01");
SetUIString(this->m_hWnd, IDC_NAMEMODIFY_02, "IDC_NAMEMODIFY_02");
SetUIString(this->m_hWnd, IDC_NAMEMODIFY_03, "IDC_NAMEMODIFY_03");
SetUIString(this->m_hWnd, IDC_OVERLAP_TEST, "IDC_OVERLAP_TEST");
SetUIString(this->m_hWnd, IDC_MODIFY_CHARNAME, "IDC_MODIFY_CHARNAME");
return TRUE;
}
void CModifyCharNameDlg::OnBnClickedModifyName()
{
CString strName;
GetDlgItemText(IDC_CURRENT_CHARNAME, strName);
CUserCharTreeView* lpTreeView = static_cast<CUserCharTreeView*>(m_lpParent);
CTreeCtrl* lpTree = static_cast<CTreeCtrl*>(lpTreeView->GetDlgItem(IDC_CHARTREE));
if(NULL != lpTree)
{
HTREEITEM hItem, hParentItem, hPParentItem;
hItem = lpTree->GetSelectedItem(); // 캐릭터 노드
hParentItem = lpTree->GetParentItem(hItem); // 서버 노드
hPParentItem = lpTree->GetParentItem(hParentItem); // UID 노드
if((NULL != hItem) && (NULL != hParentItem) && (NULL != hPParentItem))
{
CString strSrvName = lpTree->GetItemText(hParentItem);
CString strUID = lpTree->GetItemText(hPParentItem);
CString strCID = lpTree->GetItemText(hItem);
unsigned long dwServerGroup = 0;
TCHAR szTmp[100];
unsigned long dwUID, dwCID;
CString strCharacterName;
if(CCharacterDoc::GetInstance().GetServerIndex(strSrvName, dwServerGroup))
{
_stscanf(strUID, _T("%d %s"), &dwUID, szTmp);
_stscanf(strCID, _T("%d %s"), &dwCID, szTmp);
GetDlgItemText(IDC_NEW_CHARNAME, strCharacterName);
if(20 > strCharacterName.GetLength())
{
// 캐릭터명 변경
CPacketMgr::GetInstance()->SendPktChangeName(
dwUID, dwCID, dwServerGroup, lpTreeView->m_dwWndKey, strCharacterName.GetBuffer());
}
else
{
Report(GetLocalString("MSG_0108"), CAUTION);
}
}
}
}
}
BOOL CModifyCharNameDlg::PreTranslateMessage(MSG* pMsg)
{
if((WM_KEYDOWN == pMsg->message) && (VK_RETURN == pMsg->wParam))
{
if(pMsg->hwnd == GetDlgItem(IDC_NEW_CHARNAME)->m_hWnd)
{
OnBnClickedModifyName();
}
}
return CDialog::PreTranslateMessage(pMsg);
}
void CModifyCharNameDlg::OnOK()
{
//CDialog::OnOK();
}