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>
315 lines
8.3 KiB
C++
315 lines
8.3 KiB
C++
// CharEXInfoPage.cpp : 구현 파일입니다.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "AdminToolClient.h"
|
|
#include "CharEXInfoPage.h"
|
|
#include "PacketManager.h"
|
|
#include "CharacterDoc.h"
|
|
#include "NewAreaMatrixDlg.h"
|
|
#include "GlobalFunctions.h"
|
|
|
|
#include <Character/ModifyCharacter.h>
|
|
#include <Network/Packet/PacketStruct/ServerInfo.h>
|
|
#include ".\charexinfopage.h"
|
|
|
|
// CCharEXInfoPage 대화 상자입니다.
|
|
|
|
IMPLEMENT_DYNAMIC(CCharEXInfoPage, CPropertyPage)
|
|
CCharEXInfoPage::CCharEXInfoPage()
|
|
: CPropertyPage(CCharEXInfoPage::IDD)
|
|
, m_lpModifyCharacter(NULL)
|
|
, m_dwDocKey(0)
|
|
, m_fLastPosX(0)
|
|
, m_fLastPosY(0)
|
|
, m_fLastPosZ(0)
|
|
, m_fStorePosX(0)
|
|
, m_fStorePosY(0)
|
|
, m_fStorePosZ(0)
|
|
, m_dwStoreZone(0)
|
|
, m_eState(CCharEXInfoPage::NONE)
|
|
{
|
|
}
|
|
|
|
CCharEXInfoPage::~CCharEXInfoPage()
|
|
{
|
|
}
|
|
|
|
void CCharEXInfoPage::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CPropertyPage::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_AREALIST, m_ctrlAreaList);
|
|
DDX_Text(pDX, IDC_LAST_POS_X, m_fLastPosX);
|
|
DDX_Text(pDX, IDC_LAST_POS_Y, m_fLastPosY);
|
|
DDX_Text(pDX, IDC_LAST_POS_Z, m_fLastPosZ);
|
|
DDX_Text(pDX, IDC_STORE_POS_X, m_fStorePosX);
|
|
DDX_Text(pDX, IDC_STORE_POS_Y, m_fStorePosY);
|
|
DDX_Text(pDX, IDC_STORE_POS_Z, m_fStorePosZ);
|
|
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CCharEXInfoPage, CPropertyPage)
|
|
ON_WM_CTLCOLOR()
|
|
ON_BN_CLICKED(IDC_NEWAREAREG, OnBnClickedNewareareg)
|
|
ON_BN_CLICKED(IDC_POS_UPDATE, OnBnClickedIPosUpdate)
|
|
ON_BN_CLICKED(IDC_REFRESH_AREALIST, OnBnClickedRefreshAreaList)
|
|
ON_WM_CONTEXTMENU()
|
|
ON_COMMAND(ID_GIVE_POS, OnGivePos)
|
|
ON_COMMAND(ID_DEL_POS, OnDelPos)
|
|
ON_COMMAND(ID_UPDATE_POS, OnUpdatePos)
|
|
ON_BN_CLICKED(IDC_NAME_UPDATE_BTN, OnBnClickedNameUpdateBtn)
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CCharEXInfoPage 메시지 처리기입니다.
|
|
|
|
HBRUSH CCharEXInfoPage::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
{
|
|
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
return hbr;
|
|
}
|
|
|
|
BOOL CCharEXInfoPage::OnInitDialog()
|
|
{
|
|
CPropertyPage::OnInitDialog();
|
|
|
|
m_ctrlAreaList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_FLATSB);
|
|
|
|
m_ctrlAreaList.InsertColumn(0, GetLocalString("AREA_NAME"), LVCFMT_LEFT, 120);
|
|
m_ctrlAreaList.InsertColumn(1, _T("ZONE"), LVCFMT_LEFT, 120);
|
|
m_ctrlAreaList.InsertColumn(2, _T("X"), LVCFMT_CENTER, 53);
|
|
m_ctrlAreaList.InsertColumn(3, _T("Z"), LVCFMT_CENTER, 53);
|
|
|
|
CComboBox* lpZoneCb = static_cast<CComboBox*>(GetDlgItem(IDC_ZONE_COMBO));
|
|
|
|
for(int nIndex = 0; nIndex < SERVER_ID::MAX_ZONE_NUM; ++nIndex)
|
|
{
|
|
lpZoneCb->InsertString(nIndex, GetZoneString(nIndex));
|
|
}
|
|
|
|
RefreshZoneList();
|
|
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_01, "IDC_EXPAGE_01");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_02, "IDC_EXPAGE_02");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_03, "IDC_EXPAGE_03");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_04, "IDC_EXPAGE_04");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_05, "IDC_EXPAGE_05");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_06, "IDC_EXPAGE_06");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_07, "IDC_EXPAGE_07");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_08, "IDC_EXPAGE_08");
|
|
SetUIString(this->m_hWnd, IDC_EXPAGE_09, "IDC_EXPAGE_09");
|
|
SetUIString(this->m_hWnd, IDC_POS_UPDATE, "IDC_POS_UPDATE");
|
|
SetUIString(this->m_hWnd, IDC_NEWAREAREG, "IDC_NEWAREAREG");
|
|
SetUIString(this->m_hWnd, IDC_REFRESH_AREALIST, "IDC_REFRESH_AREALIST");
|
|
SetUIString(this->m_hWnd, IDC_NAMECHANGECNT, "ADDED_STRING_080");
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
bool CCharEXInfoPage::SetCharEXInfoPageData(unsigned int dwDocKey, CModifyCharacter* lpModifyCharacter)
|
|
{
|
|
if(0 != dwDocKey && NULL != lpModifyCharacter)
|
|
{
|
|
m_lpModifyCharacter = lpModifyCharacter;
|
|
m_dwDocKey = dwDocKey;
|
|
|
|
GetDlgItem(IDC_POS_UPDATE)->EnableWindow(true);
|
|
GetDlgItem(IDC_REFRESH_AREALIST)->EnableWindow(true);
|
|
GetDlgItem(IDC_NEWAREAREG)->EnableWindow(true);
|
|
GetDlgItem(IDC_NAME_UPDATE_BTN)->EnableWindow(true);
|
|
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
void CCharEXInfoPage::SetCharEXInfoPage(CModifyCharacter* lpModifyCharacter)
|
|
{
|
|
if(NULL != lpModifyCharacter)
|
|
{
|
|
CHAR_POS& pos = m_lpModifyCharacter->GetLastPos();
|
|
|
|
m_fLastPosX = pos.LastPoint.fPointX;
|
|
m_fLastPosY = pos.LastPoint.fPointY;
|
|
m_fLastPosZ = pos.LastPoint.fPointZ;
|
|
|
|
m_fStorePosX = pos.SavePoint.fPointX;
|
|
m_fStorePosY = pos.SavePoint.fPointY;
|
|
m_fStorePosZ = pos.SavePoint.fPointZ;
|
|
|
|
SERVER_ID ServerID;
|
|
|
|
ServerID.dwID = m_lpModifyCharacter->GetServerID();
|
|
m_dwStoreZone = ServerID.GetZone();
|
|
|
|
if(0 != m_dwStoreZone)
|
|
{
|
|
static_cast<CComboBox*>(GetDlgItem(IDC_ZONE_COMBO))->SetCurSel(m_dwStoreZone);
|
|
}
|
|
else
|
|
{
|
|
Report(GetLocalString("MSG_0115"), NOTIFY);
|
|
}
|
|
|
|
SetDlgItemInt(IDC_CHARINFOEX_NAME, (unsigned int)lpModifyCharacter->GetNameChangeChance(), false);
|
|
}
|
|
else
|
|
{
|
|
m_fLastPosX = 0;
|
|
m_fLastPosY = 0;
|
|
m_fLastPosZ = 0;
|
|
|
|
m_fStorePosX = 0;
|
|
m_fStorePosY = 0;
|
|
m_fStorePosZ = 0;
|
|
|
|
static_cast<CComboBox*>(GetDlgItem(IDC_ZONE_COMBO))->SetCurSel(-1);
|
|
}
|
|
|
|
UpdateData(false);
|
|
}
|
|
|
|
void CCharEXInfoPage::OnBnClickedNewareareg()
|
|
{
|
|
m_eState = INSERT;
|
|
|
|
CNewAreaMatrixDlg Dlg(this);
|
|
Dlg.DoModal();
|
|
|
|
m_eState = NONE;
|
|
}
|
|
|
|
void CCharEXInfoPage::OnBnClickedIPosUpdate()
|
|
{
|
|
UpdateData(true);
|
|
|
|
CComboBox* lpZoneCb = static_cast<CComboBox*>(GetDlgItem(IDC_ZONE_COMBO));
|
|
|
|
CPacketMgr::GetInstance()->SendPktChangePos(
|
|
m_lpModifyCharacter->GetServerGroup(), m_dwDocKey, m_lpModifyCharacter->GetUID(),
|
|
m_lpModifyCharacter->GetCID(), (char)lpZoneCb->GetCurSel(), m_fLastPosX, m_fLastPosY, m_fLastPosZ);
|
|
}
|
|
|
|
void CCharEXInfoPage::RefreshZoneList()
|
|
{
|
|
CCharacterDoc& CharDocument = CCharacterDoc::GetInstance();
|
|
CCharacterDoc::ZoneList& ZoneList = CharDocument.GetZoneList();
|
|
|
|
CCharacterDoc::ZoneList::vecZoneList::iterator Pos = ZoneList.ZoneInfo.begin();
|
|
|
|
m_ctrlAreaList.DeleteAllItems();
|
|
|
|
while(Pos != ZoneList.ZoneInfo.end())
|
|
{
|
|
TCHAR szTemporary[100];
|
|
|
|
CCharacterDoc::Zone& zone = (*Pos);
|
|
|
|
m_ctrlAreaList.InsertItem(0,(LPCTSTR)zone.m_szName);
|
|
m_ctrlAreaList.SetItemText(0, 1, (LPCTSTR)GetZoneString(zone.m_Zone));
|
|
_sntprintf(szTemporary, 100, _T("%.1f"), zone.m_fPosX);
|
|
m_ctrlAreaList.SetItemText(0, 2, (LPCTSTR)szTemporary);
|
|
_sntprintf(szTemporary, 100, _T("%.1f"), zone.m_fPosZ);
|
|
m_ctrlAreaList.SetItemText(0, 3, (LPCTSTR)szTemporary);
|
|
|
|
++Pos;
|
|
}
|
|
}
|
|
|
|
void CCharEXInfoPage::OnBnClickedRefreshAreaList()
|
|
{
|
|
RefreshZoneList();
|
|
}
|
|
|
|
void CCharEXInfoPage::OnContextMenu(CWnd* pWnd, CPoint point)
|
|
{
|
|
if((pWnd->GetSafeHwnd() == m_ctrlAreaList.GetSafeHwnd())
|
|
&& (m_ctrlAreaList.GetSelectedCount() == 1))
|
|
{
|
|
CMenu muTemp, *pContextMenu;
|
|
muTemp.LoadMenu(IDR_CONTEXTMENU);
|
|
pContextMenu = muTemp.GetSubMenu(11);
|
|
pContextMenu->ModifyMenu(0, MF_STRING | MF_BYPOSITION, ID_GIVE_POS, GetLocalString("MENU_031"));
|
|
pContextMenu->ModifyMenu(2, MF_STRING | MF_BYPOSITION, ID_UPDATE_POS, GetLocalString("MENU_032"));
|
|
pContextMenu->ModifyMenu(3, MF_STRING | MF_BYPOSITION, ID_DEL_POS, GetLocalString("MENU_033"));
|
|
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
|
|
}
|
|
}
|
|
|
|
void CCharEXInfoPage::OnGivePos()
|
|
{
|
|
CCharacterDoc& CharDocument = CCharacterDoc::GetInstance();
|
|
CCharacterDoc::ZoneList& ZoneList = CharDocument.GetZoneList();
|
|
|
|
CCharacterDoc::ZoneList::vecZoneList::iterator Pos = ZoneList.ZoneInfo.begin();
|
|
|
|
int Idx = m_ctrlAreaList.GetNextItem(-1, LVIS_SELECTED);
|
|
CString strName;
|
|
|
|
if(-1 != Idx)
|
|
{
|
|
strName = m_ctrlAreaList.GetItemText(Idx, 0);
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
while(Pos != ZoneList.ZoneInfo.end())
|
|
{
|
|
CCharacterDoc::Zone& zone = (*Pos);
|
|
|
|
if (!_tcsicmp(strName, zone.m_szName))
|
|
{
|
|
m_fLastPosX = zone.m_fPosX;
|
|
m_fLastPosZ = zone.m_fPosZ;
|
|
m_fLastPosY = 22;
|
|
|
|
static_cast<CComboBox*>(GetDlgItem(IDC_ZONE_COMBO))->SetCurSel(zone.m_Zone - 1);
|
|
break;
|
|
}
|
|
++Pos;
|
|
}
|
|
|
|
UpdateData(false);
|
|
}
|
|
|
|
void CCharEXInfoPage::OnDelPos()
|
|
{
|
|
CCharacterDoc& CharDocument = CCharacterDoc::GetInstance();
|
|
CCharacterDoc::ZoneList& ZoneList = CharDocument.GetZoneList();
|
|
CListCtrl* lpCtrl = static_cast<CListCtrl*>(GetDlgItem(IDC_AREALIST));
|
|
|
|
int iItemCount = lpCtrl->GetNextItem(-1, LVIS_SELECTED);
|
|
TCHAR tmp[256];
|
|
|
|
CString strName = lpCtrl->GetItemText(iItemCount, 0);
|
|
|
|
_sntprintf(tmp, sizeof(tmp), _T("%s"), strName);
|
|
ZoneList.Erase(tmp);
|
|
|
|
RefreshZoneList();
|
|
}
|
|
|
|
void CCharEXInfoPage::OnUpdatePos()
|
|
{
|
|
m_eState = EDIT;
|
|
|
|
CNewAreaMatrixDlg Dlg(this);
|
|
Dlg.DoModal();
|
|
|
|
m_eState = NONE;
|
|
}
|
|
|
|
void CCharEXInfoPage::OnBnClickedNameUpdateBtn()
|
|
{
|
|
unsigned int dwNameChangeChance = GetDlgItemInt(IDC_CHARINFOEX_NAME, 0, false);
|
|
|
|
CPacketMgr::GetInstance()->SendPktNameChangeCount(m_lpModifyCharacter->GetServerGroup(),
|
|
m_lpModifyCharacter->GetCID(), (unsigned char)dwNameChangeChance);
|
|
} |