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>
This commit is contained in:
917
GameTools/WORLDCREATOR/PageGCMDSSlots.cpp
Normal file
917
GameTools/WORLDCREATOR/PageGCMDSSlots.cpp
Normal file
@@ -0,0 +1,917 @@
|
||||
// PageGCMDSSlots.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "worldcreator.h"
|
||||
#include "PageGCMDSSlots.h"
|
||||
|
||||
#include "DlgSkelpart.h"
|
||||
#include "DlgOutfitSlot.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPageGCMDSSlots property page
|
||||
|
||||
IMPLEMENT_DYNCREATE(CPageGCMDSSlots, CPropertyPage)
|
||||
|
||||
CPageGCMDSSlots::CPageGCMDSSlots() : CPropertyPage(CPageGCMDSSlots::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CPageGCMDSSlots)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_rpGCMDS = NULL;
|
||||
m_pCurListCtrl = NULL;
|
||||
}
|
||||
|
||||
CPageGCMDSSlots::~CPageGCMDSSlots()
|
||||
{
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CPropertyPage::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CPageGCMDSSlots)
|
||||
DDX_Control(pDX, IDC_LIST_ATTACHMENTSLOT, m_ctrlAttachmentSlot);
|
||||
DDX_Control(pDX, IDC_LIST_OUTFITSLOT, m_ctrlOutfitSlot);
|
||||
DDX_Control(pDX, IDC_LIST_STATICSLOT, m_ctrlStaticSlot);
|
||||
DDX_Control(pDX, IDC_LIST_SKELPART, m_ctrlSkelpart);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CPageGCMDSSlots, CPropertyPage)
|
||||
//{{AFX_MSG_MAP(CPageGCMDSSlots)
|
||||
ON_WM_CONTEXTMENU()
|
||||
ON_COMMAND(ID_MENUITEM_ADDITEM, OnMenuitemAdditem)
|
||||
ON_COMMAND(ID_MENUITEM_EDITITEM, OnMenuitemEdititem)
|
||||
ON_COMMAND(ID_MENUITEM_DELETEITEM, OnMenuitemDeleteitem)
|
||||
ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST_STATICSLOT, OnEndlabeleditListStaticslot)
|
||||
ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST_ATTACHMENTSLOT, OnEndlabeleditListAttachmentslot)
|
||||
ON_COMMAND(ID_MENUITEM_MOVEUP, OnMenuitemMoveup)
|
||||
ON_COMMAND(ID_MENUITEM_MOVEDOWN, OnMenuitemMovedown)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CPageGCMDSSlots message handlers
|
||||
|
||||
void CPageGCMDSSlots::UpdateDataByGCMDS( CZ3DGCMDS* pGCMDS )
|
||||
{
|
||||
m_rpGCMDS = pGCMDS;
|
||||
|
||||
if( NULL == m_rpGCMDS )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateSkelpart();
|
||||
UpdateOutfitSlot();
|
||||
UpdateStaticSlot();
|
||||
UpdateAttachmentSlot();
|
||||
}
|
||||
|
||||
BOOL CPageGCMDSSlots::OnInitDialog()
|
||||
{
|
||||
CPropertyPage::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
DWORD dwExtStyle;
|
||||
|
||||
dwExtStyle = m_ctrlSkelpart.GetExtendedStyle();
|
||||
dwExtStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
|
||||
m_ctrlSkelpart.SetExtendedStyle( dwExtStyle );
|
||||
m_ctrlSkelpart.InsertColumn( 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD>", LVCFMT_LEFT, 90 );
|
||||
m_ctrlSkelpart.InsertColumn( 1, "index", LVCFMT_LEFT, 55 );
|
||||
|
||||
dwExtStyle = m_ctrlOutfitSlot.GetExtendedStyle();
|
||||
dwExtStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
|
||||
m_ctrlOutfitSlot.SetExtendedStyle( dwExtStyle );
|
||||
m_ctrlOutfitSlot.InsertColumn( 0, "", LVCFMT_LEFT, 20 );
|
||||
m_ctrlOutfitSlot.InsertColumn( 1, "Slot <20≯<EFBFBD>", LVCFMT_LEFT, 80 );
|
||||
m_ctrlOutfitSlot.InsertColumn( 2, "Layer", LVCFMT_LEFT, 45 );
|
||||
|
||||
dwExtStyle = m_ctrlStaticSlot.GetExtendedStyle();
|
||||
dwExtStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
|
||||
m_ctrlStaticSlot.SetExtendedStyle( dwExtStyle );
|
||||
m_ctrlStaticSlot.InsertColumn( 0, "Slot <20≯<EFBFBD>", LVCFMT_LEFT, 90 );
|
||||
|
||||
dwExtStyle = m_ctrlAttachmentSlot.GetExtendedStyle();
|
||||
dwExtStyle |= LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES;
|
||||
m_ctrlAttachmentSlot.SetExtendedStyle( dwExtStyle );
|
||||
m_ctrlAttachmentSlot.InsertColumn( 0, "Slot <20≯<EFBFBD>", LVCFMT_LEFT, 90 );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::UpdateSkelpart()
|
||||
{
|
||||
std::map<Z3DTOK, long>* pmap;
|
||||
std::map<Z3DTOK, long>::iterator it;
|
||||
int i;
|
||||
char szTmp[100];
|
||||
|
||||
m_ctrlSkelpart.DeleteAllItems();
|
||||
|
||||
m_rpGCMDS->RetrieveSkelpartList( pmap );
|
||||
for( it = pmap->begin(), i = 0; it != pmap->end(); ++it, ++i )
|
||||
{
|
||||
m_ctrlSkelpart.InsertItem( i, g_TokSkeletonPartName.GetString(it->first) );
|
||||
m_ctrlSkelpart.SetItemText( i, 1, itoa(it->second, szTmp, 10) );
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::UpdateOutfitSlot()
|
||||
{
|
||||
std::vector<Z3DTOK>* pvecOutfitSlot;
|
||||
std::vector<long>* pvecOutfitSlotLayerCount;
|
||||
int i;
|
||||
char szTmp[100];
|
||||
|
||||
m_ctrlOutfitSlot.DeleteAllItems();
|
||||
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecOutfitSlot, pvecOutfitSlotLayerCount );
|
||||
for( i = 0; i < pvecOutfitSlot->size(); ++i )
|
||||
{
|
||||
m_ctrlOutfitSlot.InsertItem( i, itoa(i, szTmp, 10) );
|
||||
m_ctrlOutfitSlot.SetItemText( i, 1, g_TokSlotName.GetString((*pvecOutfitSlot)[i]) );
|
||||
m_ctrlOutfitSlot.SetItemText( i, 2, itoa((*pvecOutfitSlotLayerCount)[i], szTmp, 10) );
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::UpdateStaticSlot()
|
||||
{
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
int i;
|
||||
|
||||
m_ctrlStaticSlot.DeleteAllItems();
|
||||
|
||||
m_rpGCMDS->RetrieveStaticSlot( pvec );
|
||||
for( i = 0; i < pvec->size(); ++i )
|
||||
{
|
||||
m_ctrlStaticSlot.InsertItem( i, g_TokSlotName.GetString( (*pvec)[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::UpdateAttachmentSlot()
|
||||
{
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
int i;
|
||||
|
||||
m_ctrlAttachmentSlot.DeleteAllItems();
|
||||
|
||||
m_rpGCMDS->RetrieveAttachmentSlot( pvec );
|
||||
for( i = 0; i < pvec->size(); ++i )
|
||||
{
|
||||
m_ctrlAttachmentSlot.InsertItem( i, g_TokSlotName.GetString( (*pvec)[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnContextMenu(CWnd* pWnd, CPoint point)
|
||||
{
|
||||
// TODO: Add your message handler code here
|
||||
if( m_ctrlSkelpart.GetSafeHwnd() == pWnd->GetSafeHwnd() )
|
||||
{
|
||||
m_pCurListCtrl = &m_ctrlSkelpart;
|
||||
}
|
||||
else if( m_ctrlOutfitSlot.GetSafeHwnd() == pWnd->GetSafeHwnd() )
|
||||
{
|
||||
m_pCurListCtrl = &m_ctrlOutfitSlot;
|
||||
}
|
||||
else if( m_ctrlStaticSlot.GetSafeHwnd() == pWnd->GetSafeHwnd() )
|
||||
{
|
||||
m_pCurListCtrl = &m_ctrlStaticSlot;
|
||||
}
|
||||
else if( m_ctrlAttachmentSlot.GetSafeHwnd() == pWnd->GetSafeHwnd() )
|
||||
{
|
||||
m_pCurListCtrl = &m_ctrlAttachmentSlot;
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_pCurListCtrl = NULL;
|
||||
CPropertyPage::OnContextMenu( pWnd, point );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CMenu menuTmp;
|
||||
CMenu* pContextMenu;
|
||||
|
||||
menuTmp.LoadMenu( IDR_MENU_GCMDS );
|
||||
if( &m_ctrlOutfitSlot == m_pCurListCtrl )
|
||||
{
|
||||
pContextMenu = menuTmp.GetSubMenu( 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pContextMenu = menuTmp.GetSubMenu( 1 );
|
||||
}
|
||||
|
||||
CPoint ptClient;
|
||||
UINT uFlags;
|
||||
ptClient = point;
|
||||
m_pCurListCtrl->ScreenToClient( &ptClient );
|
||||
int nHit = m_pCurListCtrl->HitTest( ptClient, &uFlags );
|
||||
if( -1 == nHit )
|
||||
{
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_ADDITEM, MF_ENABLED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_EDITITEM, MF_GRAYED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_DELETEITEM, MF_GRAYED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_MOVEUP, MF_GRAYED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_MOVEDOWN, MF_GRAYED );
|
||||
}
|
||||
else
|
||||
{
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_ADDITEM, MF_ENABLED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_EDITITEM, MF_ENABLED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_DELETEITEM, MF_ENABLED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_MOVEUP, MF_ENABLED );
|
||||
pContextMenu->EnableMenuItem( ID_MENUITEM_MOVEDOWN, MF_ENABLED );
|
||||
}
|
||||
|
||||
pContextMenu->TrackPopupMenu( TPM_LEFTALIGN, point.x, point.y, this, NULL );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnMenuitemAdditem()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
if( NULL == m_pCurListCtrl )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_ctrlSkelpart.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
AddSkelpartItem();
|
||||
}
|
||||
else if( m_ctrlOutfitSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
AddOutiftSlotItem();
|
||||
}
|
||||
else if( m_ctrlStaticSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
AddStaticSlotItem();
|
||||
}
|
||||
else if( m_ctrlAttachmentSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
AddAttachmentSlotItem();
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnMenuitemEdititem()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
if( NULL == m_pCurListCtrl )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_ctrlSkelpart.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
EditSkelpartItem();
|
||||
}
|
||||
else if( m_ctrlOutfitSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
EditOutfitSlotItem();
|
||||
}
|
||||
else if( m_ctrlStaticSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
EditStaticSlotItem();
|
||||
}
|
||||
else if( m_ctrlAttachmentSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
EditAttachmentSlotItem();
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnMenuitemDeleteitem()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
if( NULL == m_pCurListCtrl )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_ctrlSkelpart.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
DeleteSkelpartItem();
|
||||
}
|
||||
else if( m_ctrlOutfitSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
DeleteOutfitSlotItem();
|
||||
}
|
||||
else if( m_ctrlStaticSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
DeleteStaticSlotItem();
|
||||
}
|
||||
else if( m_ctrlAttachmentSlot.GetSafeHwnd() == m_pCurListCtrl->GetSafeHwnd() )
|
||||
{
|
||||
DeleteAttachmentSlotItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPageGCMDSSlots::AddSkelpartItem()
|
||||
{
|
||||
CDlgSkelpart dlg;
|
||||
std::map<Z3DTOK, long>* pmap;
|
||||
std::map<Z3DTOK, long>::iterator it;
|
||||
|
||||
m_rpGCMDS->RetrieveSkelpartList( pmap );
|
||||
|
||||
dlg.SetupDialog( "", m_rpGCMDS, -1 );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( IDOK != dlg.DoModal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( CString("") == dlg.m_strSkelpartName )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( -1 == dlg.m_nSkelpartIndex )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool bDuplicated = false;
|
||||
for( it = pmap->begin(); it != pmap->end(); ++it )
|
||||
{
|
||||
if( 0 == stricmp( dlg.m_strSkelpartName,
|
||||
g_TokSkeletonPartName.GetString( it->first ) ) )
|
||||
{
|
||||
bDuplicated = true;
|
||||
}
|
||||
}
|
||||
if( bDuplicated )
|
||||
{
|
||||
CString strTemp = dlg.m_strSkelpartName + " <20>ߺ<EFBFBD>";
|
||||
MessageBox( strTemp, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..", MB_ICONERROR|MB_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Z3DTOK tok = g_TokSkeletonPartName.Add( dlg.m_strSkelpartName );
|
||||
(*pmap)[tok] = dlg.m_nSkelpartIndex;
|
||||
|
||||
UpdateSkelpart();
|
||||
LVFINDINFO lvfi;
|
||||
lvfi.flags = LVFI_STRING;
|
||||
lvfi.psz = dlg.m_strSkelpartName.LockBuffer();
|
||||
int nIdx = m_ctrlSkelpart.FindItem( &lvfi, -1 );
|
||||
dlg.m_strSkelpartName.UnlockBuffer();
|
||||
m_ctrlSkelpart.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlSkelpart.SetItemState( nIdx, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::EditSkelpartItem()
|
||||
{
|
||||
CDlgSkelpart dlg;
|
||||
std::map<Z3DTOK, long>* pmap;
|
||||
std::map<Z3DTOK, long>::iterator it, itCurrent;
|
||||
|
||||
POSITION pos = m_ctrlSkelpart.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
m_rpGCMDS->RetrieveSkelpartList( pmap );
|
||||
|
||||
char szTmp[300];
|
||||
m_ctrlSkelpart.GetItemText( nIdx, 1, szTmp, 300 );
|
||||
int nSkelIndex = atoi( szTmp );
|
||||
m_ctrlSkelpart.GetItemText( nIdx, 0, szTmp, 300 );
|
||||
|
||||
itCurrent = pmap->find( g_TokSkeletonPartName.GetTOK(szTmp) );
|
||||
if( itCurrent == pmap->end() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dlg.SetupDialog( szTmp, m_rpGCMDS, nSkelIndex );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( IDOK != dlg.DoModal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( CString("") == dlg.m_strSkelpartName )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( -1 == dlg.m_nSkelpartIndex )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool bDuplicated = false;
|
||||
for( it = pmap->begin(); it != pmap->end(); ++it )
|
||||
{
|
||||
if( it != itCurrent )
|
||||
{
|
||||
if( 0 == stricmp( dlg.m_strSkelpartName,
|
||||
g_TokSkeletonPartName.GetString( it->first ) ) )
|
||||
{
|
||||
bDuplicated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( bDuplicated )
|
||||
{
|
||||
CString strTemp = dlg.m_strSkelpartName + " <20>ߺ<EFBFBD>";
|
||||
MessageBox( strTemp, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>..", MB_ICONERROR|MB_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( 0 == stricmp( dlg.m_strSkelpartName,
|
||||
g_TokSkeletonPartName.GetString(itCurrent->first) ) )
|
||||
{
|
||||
if( dlg.m_nSkelpartIndex == itCurrent->second )
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
itCurrent->second = dlg.m_nSkelpartIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pmap->erase(itCurrent);
|
||||
Z3DTOK tok = g_TokSkeletonPartName.Add( dlg.m_strSkelpartName );
|
||||
(*pmap)[tok] = dlg.m_nSkelpartIndex;
|
||||
}
|
||||
|
||||
UpdateSkelpart();
|
||||
LVFINDINFO lvfi;
|
||||
lvfi.flags = LVFI_STRING;
|
||||
lvfi.psz = dlg.m_strSkelpartName.LockBuffer();
|
||||
nIdx = m_ctrlSkelpart.FindItem( &lvfi, -1 );
|
||||
dlg.m_strSkelpartName.UnlockBuffer();
|
||||
m_ctrlSkelpart.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlSkelpart.SetItemState( nIdx, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
|
||||
|
||||
void CPageGCMDSSlots::DeleteSkelpartItem()
|
||||
{
|
||||
CDlgSkelpart dlg;
|
||||
std::map<Z3DTOK, long>* pmap;
|
||||
std::map<Z3DTOK, long>::iterator it;
|
||||
|
||||
POSITION pos = m_ctrlSkelpart.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
m_rpGCMDS->RetrieveSkelpartList( pmap );
|
||||
|
||||
CString strTemp = m_ctrlSkelpart.GetItemText(nIdx, 0)+CString(" <20><> <20><><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>?");
|
||||
if( IDCANCEL ==
|
||||
MessageBox( strTemp, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONQUESTION|MB_OKCANCEL ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
it = pmap->find( g_TokSkeletonPartName.GetTOK(
|
||||
m_ctrlSkelpart.GetItemText(nIdx, 0) ) );
|
||||
if( it == pmap->end() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
pmap->erase(it);
|
||||
UpdateSkelpart();
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::AddOutiftSlotItem()
|
||||
{
|
||||
CDlgOutfitSlot dlg;
|
||||
std::vector<Z3DTOK>* pvecSlot;
|
||||
std::vector<long>* pvecLayer;
|
||||
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecSlot, pvecLayer );
|
||||
dlg.SetupDialog( "", 1 );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( IDOK != dlg.DoModal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool bDuplicated = false;
|
||||
for( int i = 0; i < pvecSlot->size(); ++i )
|
||||
{
|
||||
if( 0 == stricmp( dlg.m_strOutfitSlotName,
|
||||
g_TokSlotName.GetString((*pvecSlot)[i]) ) )
|
||||
{
|
||||
bDuplicated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( bDuplicated )
|
||||
{
|
||||
MessageBox( "<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD> Outfit slot <20≯<EFBFBD><CCB8><EFBFBD> <20>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONERROR|MB_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( CString("") == dlg.m_strOutfitSlotName )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pvecSlot->push_back( g_TokSlotName.Add(dlg.m_strOutfitSlotName) );
|
||||
pvecLayer->push_back( dlg.m_nLayerCount+1 );
|
||||
|
||||
UpdateOutfitSlot();
|
||||
int nIdx = m_ctrlOutfitSlot.GetItemCount()-1;
|
||||
m_ctrlOutfitSlot.EnsureVisible(nIdx, FALSE);
|
||||
m_ctrlOutfitSlot.SetItemState( nIdx, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::EditOutfitSlotItem()
|
||||
{
|
||||
CDlgOutfitSlot dlg;
|
||||
std::vector<Z3DTOK>* pvecSlot;
|
||||
std::vector<long>* pvecLayer;
|
||||
|
||||
POSITION pos = m_ctrlOutfitSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
m_ctrlOutfitSlot.EnsureVisible( nIdx, FALSE );
|
||||
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecSlot, pvecLayer );
|
||||
dlg.SetupDialog( (*pvecSlot)[nIdx], (*pvecLayer)[nIdx] );
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
if( IDOK != dlg.DoModal() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool bDuplicated = false;
|
||||
for( int i = 0; i < pvecSlot->size(); ++i )
|
||||
{
|
||||
if( nIdx != i )
|
||||
{
|
||||
if( 0 == stricmp( dlg.m_strOutfitSlotName,
|
||||
g_TokSlotName.GetString((*pvecSlot)[i]) ) )
|
||||
{
|
||||
bDuplicated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( bDuplicated )
|
||||
{
|
||||
MessageBox( "<EFBFBD>ߺ<EFBFBD><EFBFBD><EFBFBD> Outfit slot <20≯<EFBFBD><CCB8><EFBFBD> <20>ֱ<EFBFBD><D6B1><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONERROR|MB_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( CString("") == dlg.m_strOutfitSlotName )
|
||||
{
|
||||
MessageBox( "Outfit slot <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONERROR|MB_OK );
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(*pvecSlot)[nIdx] = g_TokSlotName.Add(dlg.m_strOutfitSlotName);
|
||||
(*pvecLayer)[nIdx] = dlg.m_nLayerCount+1;
|
||||
|
||||
UpdateOutfitSlot();
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::DeleteOutfitSlotItem()
|
||||
{
|
||||
if( IDOK == MessageBox( "<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>?", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONQUESTION|MB_OKCANCEL ) )
|
||||
{
|
||||
POSITION pos = m_ctrlOutfitSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
std::vector<Z3DTOK>* pvecSlot;
|
||||
std::vector<Z3DTOK>::iterator itSlot;
|
||||
std::vector<long>* pvecLayer;
|
||||
std::vector<long>::iterator itLayer;
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecSlot, pvecLayer );
|
||||
|
||||
itSlot = pvecSlot->begin() + nIdx;
|
||||
pvecSlot->erase(itSlot);
|
||||
|
||||
itLayer = pvecLayer->begin() + nIdx;
|
||||
pvecLayer->erase(itLayer);
|
||||
|
||||
UpdateOutfitSlot();
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::AddStaticSlotItem()
|
||||
{
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
|
||||
m_rpGCMDS->RetrieveStaticSlot(pvec);
|
||||
pvec->push_back(NULL_TOK);
|
||||
int nIdx = m_ctrlStaticSlot.GetItemCount();
|
||||
m_ctrlStaticSlot.InsertItem( nIdx, "" );
|
||||
m_ctrlStaticSlot.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlStaticSlot.EditLabel( nIdx );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::EditStaticSlotItem()
|
||||
{
|
||||
POSITION pos = m_ctrlStaticSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
m_ctrlStaticSlot.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlStaticSlot.EditLabel( nIdx );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::DeleteStaticSlotItem()
|
||||
{
|
||||
if( IDOK == MessageBox( "<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>?", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONQUESTION|MB_OKCANCEL ) )
|
||||
{
|
||||
POSITION pos = m_ctrlStaticSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
std::vector<Z3DTOK>::iterator it;
|
||||
m_rpGCMDS->RetrieveStaticSlot(pvec);
|
||||
it = pvec->begin() + nIdx;
|
||||
pvec->erase(it);
|
||||
|
||||
m_ctrlStaticSlot.DeleteItem(nIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::AddAttachmentSlotItem()
|
||||
{
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
|
||||
m_rpGCMDS->RetrieveAttachmentSlot(pvec);
|
||||
pvec->push_back(NULL_TOK);
|
||||
int nIdx = m_ctrlAttachmentSlot.GetItemCount();
|
||||
m_ctrlAttachmentSlot.InsertItem( nIdx, "" );
|
||||
m_ctrlAttachmentSlot.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlAttachmentSlot.EditLabel( nIdx );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::EditAttachmentSlotItem()
|
||||
{
|
||||
POSITION pos = m_ctrlAttachmentSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
m_ctrlAttachmentSlot.EnsureVisible( nIdx, FALSE );
|
||||
m_ctrlAttachmentSlot.EditLabel( nIdx );
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::DeleteAttachmentSlotItem()
|
||||
{
|
||||
if( IDOK == MessageBox( "<EFBFBD><EFBFBD>¥<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>?", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", MB_ICONQUESTION|MB_OKCANCEL ) )
|
||||
{
|
||||
POSITION pos = m_ctrlAttachmentSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
m_rpGCMDS->RetrieveAttachmentSlot(pvec);
|
||||
for( int i = nIdx; i < (pvec->size()-1); ++i )
|
||||
{
|
||||
(*pvec)[i] = (*pvec)[i+1];
|
||||
}
|
||||
pvec->resize( pvec->size()-1 );
|
||||
|
||||
m_ctrlAttachmentSlot.DeleteItem(nIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnEndlabeleditListStaticslot(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
// <20><> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
int nIdx = pDispInfo->item.iItem;
|
||||
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
m_rpGCMDS->RetrieveStaticSlot( pvec );
|
||||
|
||||
if(
|
||||
(
|
||||
( NULL == pDispInfo->item.pszText ) &&
|
||||
( CString("") == m_ctrlStaticSlot.GetItemText( nIdx, 0 ) )
|
||||
) ||
|
||||
(
|
||||
( NULL != pDispInfo->item.pszText ) &&
|
||||
( '\0' == *(pDispInfo->item.pszText) )
|
||||
)
|
||||
)
|
||||
{
|
||||
std::vector<Z3DTOK>::iterator it;
|
||||
it = pvec->begin() + nIdx;
|
||||
pvec->erase(it);
|
||||
|
||||
m_ctrlStaticSlot.DeleteItem(nIdx);
|
||||
*pResult = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if( pDispInfo->item.mask & LVIF_TEXT )
|
||||
{
|
||||
// <20>ߺ<EFBFBD>Ȯ<EFBFBD><C8AE>
|
||||
bool bDuplicated = false;
|
||||
for( int i = 0; i < pvec->size(); ++i )
|
||||
{
|
||||
if( i != nIdx )
|
||||
{
|
||||
if( g_TokSlotName.GetTOK(pDispInfo->item.pszText) == (*pvec)[i] )
|
||||
{
|
||||
bDuplicated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( bDuplicated )
|
||||
{
|
||||
MessageBox( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> Slot<6F><74> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>", NULL, MB_ICONERROR|MB_OK );
|
||||
m_ctrlStaticSlot.PostMessage( LVM_EDITLABEL, nIdx, 0L );
|
||||
return;
|
||||
}
|
||||
|
||||
(*pvec)[nIdx] = g_TokSlotName.Add(pDispInfo->item.pszText);
|
||||
m_ctrlStaticSlot.SetItemText( nIdx, 0, g_TokSlotName.GetString((*pvec)[nIdx]) );
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnEndlabeleditListAttachmentslot(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
// <20><> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ؼ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
int nIdx = pDispInfo->item.iItem;
|
||||
|
||||
std::vector<Z3DTOK>* pvec;
|
||||
m_rpGCMDS->RetrieveAttachmentSlot( pvec );
|
||||
|
||||
if(
|
||||
(
|
||||
( NULL == pDispInfo->item.pszText ) &&
|
||||
( CString("") == m_ctrlAttachmentSlot.GetItemText( nIdx, 0 ) )
|
||||
) ||
|
||||
(
|
||||
( NULL != pDispInfo->item.pszText ) &&
|
||||
( '\0' == *(pDispInfo->item.pszText) )
|
||||
)
|
||||
)
|
||||
{
|
||||
std::vector<Z3DTOK>::iterator it;
|
||||
it = pvec->begin() + nIdx;
|
||||
pvec->erase(it);
|
||||
|
||||
m_ctrlAttachmentSlot.DeleteItem(nIdx);
|
||||
*pResult = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if( pDispInfo->item.mask & LVIF_TEXT )
|
||||
{
|
||||
// <20>ߺ<EFBFBD>Ȯ<EFBFBD><C8AE>
|
||||
bool bDuplicated = false;
|
||||
for( int i = 0; i < pvec->size(); ++i )
|
||||
{
|
||||
if( i != nIdx )
|
||||
{
|
||||
if( g_TokSlotName.GetTOK(pDispInfo->item.pszText) == (*pvec)[i] )
|
||||
{
|
||||
bDuplicated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( bDuplicated )
|
||||
{
|
||||
MessageBox( "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> Slot<6F><74> <20><><EFBFBD><EFBFBD><EFBFBD>մϴ<D5B4>", NULL, MB_ICONERROR|MB_OK );
|
||||
m_ctrlAttachmentSlot.PostMessage( LVM_EDITLABEL, nIdx, 0L );
|
||||
return;
|
||||
}
|
||||
|
||||
(*pvec)[nIdx] = g_TokSlotName.Add(pDispInfo->item.pszText);
|
||||
m_ctrlAttachmentSlot.SetItemText( nIdx, 0, g_TokSlotName.GetString((*pvec)[nIdx]) );
|
||||
}
|
||||
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnMenuitemMoveup()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
std::vector<Z3DTOK>* pvecSlot;
|
||||
std::vector<long>* pvecLayer;
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecSlot, pvecLayer );
|
||||
|
||||
POSITION pos = m_ctrlOutfitSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
if( 0 == nIdx )
|
||||
{
|
||||
return; // first item
|
||||
}
|
||||
|
||||
std::swap( (*pvecSlot)[nIdx], (*pvecSlot)[nIdx-1] );
|
||||
std::swap( (*pvecLayer)[nIdx], (*pvecLayer)[nIdx-1] );
|
||||
|
||||
UpdateOutfitSlot();
|
||||
m_ctrlOutfitSlot.SetItemState( nIdx-1, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED);
|
||||
}
|
||||
|
||||
void CPageGCMDSSlots::OnMenuitemMovedown()
|
||||
{
|
||||
// TODO: Add your command handler code here
|
||||
std::vector<Z3DTOK>* pvecSlot;
|
||||
std::vector<long>* pvecLayer;
|
||||
m_rpGCMDS->RetrieveOutfitSlot( pvecSlot, pvecLayer );
|
||||
|
||||
POSITION pos = m_ctrlOutfitSlot.GetFirstSelectedItemPosition();
|
||||
if( NULL == pos )
|
||||
{
|
||||
return;
|
||||
}
|
||||
int nIdx = (int)pos - 1;
|
||||
|
||||
if( pvecSlot->size()-1 == nIdx )
|
||||
{
|
||||
return; // last item
|
||||
}
|
||||
|
||||
std::swap( (*pvecSlot)[nIdx], (*pvecSlot)[nIdx+1] );
|
||||
std::swap( (*pvecLayer)[nIdx], (*pvecLayer)[nIdx+1] );
|
||||
|
||||
UpdateOutfitSlot();
|
||||
m_ctrlOutfitSlot.SetItemState( nIdx+1, LVIS_SELECTED | LVIS_FOCUSED,
|
||||
LVIS_SELECTED | LVIS_FOCUSED);
|
||||
}
|
||||
Reference in New Issue
Block a user