📄 itemdlg.cpp
字号:
}
EnableRadio(FALSE);
}
else
{
m_nCheckValue = 0;
m_rdWeapon.SetCheck(BST_CHECKED);
SetItemExTypeCombo();
}
EnableOptionControl(m_bOption);
}
void CItemDlg::EnableOptionControl(BOOL bEnable)
{
if( bEnable )
m_chExData.SetCheck(BST_CHECKED);
else
m_chExData.SetCheck(BST_UNCHECKED);
m_listExBasic.EnableWindow(bEnable);
m_listExAttr.EnableWindow(bEnable);
}
void CItemDlg::SetItemExTypeCombo(WORD wDef)
{
m_cbExType.ResetContent();
CString str1;
CString str2;
switch(m_nCheckValue)
{
case 0: // 公扁幅
{
str1 = "Sword|Glove|Broad Sword|Spear|Bow|Throwing Star|";
str2.Format("%d|%d|%d|%d|%d|%d|", WP_GUM, WP_GWUN, WP_DO, WP_CHANG, WP_GUNG, WP_AMGI);
}
break;
case 1: // 规绢备幅
{
str1 = "Cloth|Hat|Shoes|";
str2.Format("%d|%d|%d|", eEQUIP_ITEM_DRESS, eEQUIP_ITEM_HAT, eEQUIP_ITEM_SHOES);
}
break;
case 2: // 厩技荤府幅
{
str1 = "Armlet|Cloak|Belt|Neckles|Ring|";
str2.Format("%d|%d|%d|%d|%d|",eEQUIP_ITEM_ARMLET,eEQUIP_ITEM_CAPE,eEQUIP_ITEM_BELT,eEQUIP_ITEM_NECKLACE,eEQUIP_ITEM_RING);
}
break;
case 3: // 扁鸥
{
str1 = "Potion|Books|GradeUp|Etc|";
str2.Format("%d|%d|%d|%d|", eYOUNGYAK_ITEM, eMUGONG_ITEM, eEXTRA_ITEM_UPGRADE, eEXTRA_ITEM);
}
break;
default:
{
ASSERT(0);
}
return;
}
int i,i2, j, j2, nIndex;
i=0; j=0;
while ( (i2=str1.Find('|',i)) != -1 )
{
j2=str2.Find('|',j);
nIndex = m_cbExType.AddString(str1.Mid(i,i2-i));
m_cbExType.SetItemData( nIndex, atoi(str2.Mid(j, j2-j)) );
i=i2+1;
j=j2+1;
}
m_cbExType.SetCurSel(wDef);
SetItemCombo(m_cbExType.GetItemData(wDef));
}
void CItemDlg::SetItemCombo(DWORD type)
{
CYHHashTable<ITEM_INFO>* pItemInfoList = GAMERESRCMNGR->GetItemInfo();
ITEM_INFO * pItemInfo = NULL;
int i = 0;
m_BasicList[emBasic_Idx]->ClearItemsEx();
if( m_nCheckValue == 0 )
{
pItemInfoList->SetPositionHead();
while(pItemInfo = pItemInfoList->GetData())
{
if( pItemInfo->ItemKind == eEQUIP_ITEM_WEAPON && pItemInfo->WeaponType == type )
{
if( m_Field == eIF_WEAR && pItemInfo->LimitLevel > m_wLevel )
continue;
m_BasicList[emBasic_Idx]->m_cmbItemsEx[i] = pItemInfo->ItemIdx;
++i;
}
}
}
else if( m_nCheckValue == 3 && type != eYOUNGYAK_ITEM )
{
pItemInfoList->SetPositionHead();
while(pItemInfo = pItemInfoList->GetData())
{
if( pItemInfo->ItemKind & type || pItemInfo->ItemKind & eCHANGE_ITEM )
{
m_BasicList[emBasic_Idx]->m_cmbItemsEx[i] = pItemInfo->ItemIdx;
++i;
}
}
}
else
{
pItemInfoList->SetPositionHead();
while(pItemInfo = pItemInfoList->GetData())
{
if( pItemInfo->ItemKind == type )
{
if( (m_nCheckValue == 1 || m_nCheckValue == 2) &&
m_Field == eIF_WEAR && pItemInfo->LimitLevel > m_wLevel )
continue;
m_BasicList[emBasic_Idx]->m_cmbItemsEx[i] = pItemInfo->ItemIdx;
++i;
}
}
}
}
void CItemDlg::EnableRadio(BOOL bEnable)
{
(GetDlgItem(IDC_RADIO_WEAPON))->EnableWindow(bEnable);
(GetDlgItem(IDC_RADIO_DEFFEN))->EnableWindow(bEnable);
(GetDlgItem(IDC_RADIO_ACCESSORY))->EnableWindow(bEnable);
(GetDlgItem(IDC_RADIO_ETC))->EnableWindow(bEnable);
}
void CItemDlg::OnRadioAccessory()
{
// TODO: Add your control notification handler code here
m_nCheckValue = 2;
SetItemExTypeCombo();
}
void CItemDlg::OnRadioDeffen()
{
// TODO: Add your control notification handler code here
m_nCheckValue = 1;
SetItemExTypeCombo();
}
void CItemDlg::OnRadioEtc()
{
// TODO: Add your control notification handler code here
m_nCheckValue = 3;
SetItemExTypeCombo();
}
void CItemDlg::OnRadioWeapon()
{
// TODO: Add your control notification handler code here
m_nCheckValue = 0;
SetItemExTypeCombo();
}
void CItemDlg::OnSelchangeComboExtype()
{
// TODO: Add your control notification handler code here
int nCurSel = m_cbExType.GetCurSel();
if( nCurSel == -1 ) return;
SetItemCombo(m_cbExType.GetItemData(nCurSel));
}
void CItemDlg::OnCheckExdata()
{
// TODO: Addyour control notification handler code here
WORD ItemIdx = GAMERESRCMNGR->GetItemIdx_ByItemName( (m_BasicList[emBasic_Idx]->m_curValue).GetBuffer(0) );
if( ItemIdx == 0 || GAMERESRCMNGR->IsDupItem(ItemIdx) )
{
m_bOption = FALSE;
MessageBox("Can't Edit Option!!");
}
else
{
if( m_chExData.GetCheck() == BST_CHECKED )
m_bOption = TRUE;
else
m_bOption = FALSE;
}
EnableOptionControl(m_bOption);
}
LRESULT CItemDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
if( message == WM_CHANGEDATA )
{
CPropertyItem* pItem = (CPropertyItem*)wParam;
if( pItem == m_BasicList[emBasic_Idx] )
{
WORD wItemIdx = GAMERESRCMNGR->GetItemIdx_ByItemName( pItem->m_curValue.GetBuffer(0) );
if( wItemIdx == 0 )
{
ASSERT(0);
return 0;
}
if( GAMERESRCMNGR->IsDupItem(wItemIdx) )
{
m_BasicList[emBasic_Durability]->m_nItemType = PIT_COMBO;
m_BasicList[emBasic_Durability]->m_curValue = "1";
m_bOption = FALSE;
EnableOptionControl(m_bOption);
}
else
{
m_BasicList[emBasic_Durability]->m_nItemType = PIT_NONE;
m_BasicList[emBasic_Durability]->m_curValue = "0";
}
m_Item.wIconIdx = wItemIdx;
}
}
return CDialog::DefWindowProc(message, wParam, lParam);
}
void CItemDlg::OnButtonEdit()
{
// TODO: Add your control notification handler code here
//////////////////////////////
// 扁夯 单捞磐甫 啊廉柯促.
BOOL bDup;
if( m_Item.wIconIdx == 0 )
{
EndDialog(eMR_Cancel);
return;
}
m_Item.wIconIdx = GAMERESRCMNGR->GetItemIdx_ByItemName((m_BasicList[emBasic_Idx]->m_curValue).GetBuffer(0));
if( m_Item.wIconIdx == 0 )
{
ASSERT(0);
EndDialog(eMR_Cancel);
return;
}
if( bDup = GAMERESRCMNGR->IsDupItem(m_Item.wIconIdx) )
m_Item.Durability = atoi(((m_BasicList[emBasic_Durability]->m_curValue).GetBuffer(0)));
else
m_Item.Durability = 0;
////////////////////////////////////////////
////////////////////////////////////////////
// 可记 酒捞袍 捞扼搁..
if( m_bOption && !bDup )
{
// 可记 扁夯
m_ItemOption.dwOptionIdx = atoi(((m_BasicExList[emBasicEx_OptionIdx]->m_curValue).GetBuffer(0)));
m_ItemOption.dwItemDBIdx = atoi(((m_BasicList[emBasicEx_ItemDBIdx]->m_curValue).GetBuffer(0)));
m_ItemOption.GenGol = atoi(((m_BasicExList[emBasicEx_GenGol]->m_curValue).GetBuffer(0)));
m_ItemOption.MinChub = atoi(((m_BasicExList[emBasicEx_MinChub]->m_curValue).GetBuffer(0)));
m_ItemOption.CheRyuk = atoi(((m_BasicExList[emBasicEx_CheRyuk]->m_curValue).GetBuffer(0)));
m_ItemOption.SimMek = atoi(((m_BasicExList[emBasicEx_SimMek]->m_curValue).GetBuffer(0)));
m_ItemOption.Life = atoi(((m_BasicExList[emBasicEx_Life]->m_curValue).GetBuffer(0)));
m_ItemOption.NaeRyuk = atoi(((m_BasicExList[emBasicEx_NaeRyuk]->m_curValue).GetBuffer(0)));
m_ItemOption.Shield = atoi(((m_BasicExList[emBasicEx_Shield]->m_curValue).GetBuffer(0)));
m_ItemOption.PhyAttack = atoi(((m_BasicExList[emBasicEx_PhyAttack]->m_curValue).GetBuffer(0)));
m_ItemOption.CriticalPercent = atoi(((m_BasicExList[emBasicEx_CriticalPercent]->m_curValue).GetBuffer(0)));
m_ItemOption.PhyDefense = atoi(((m_BasicExList[emBasicEx_PhyDefense]->m_curValue).GetBuffer(0)));
// 可记 加己
m_ItemOption.AttrAttack.SetElement_Val(ATTR_FIRE, (FLOAT)atof(((m_AttrList[emAttr_AFireElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrAttack.SetElement_Val(ATTR_WATER, (FLOAT)atof(((m_AttrList[emAttr_AWaterElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrAttack.SetElement_Val(ATTR_TREE, (FLOAT)atof(((m_AttrList[emAttr_ATreeElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrAttack.SetElement_Val(ATTR_IRON, (FLOAT)atof(((m_AttrList[emAttr_AGoldElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrAttack.SetElement_Val(ATTR_EARTH, (FLOAT)atof(((m_AttrList[emAttr_AEarthElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrAttack.SetElement_Val(ATTR_NOATTR, (FLOAT)atof(((m_AttrList[emAttr_ANoneElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_FIRE, (FLOAT)atof(((m_AttrList[emAttr_DFireElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_WATER, (FLOAT)atof(((m_AttrList[emAttr_DWaterElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_TREE, (FLOAT)atof(((m_AttrList[emAttr_DTreeElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_IRON, (FLOAT)atof(((m_AttrList[emAttr_DGoldElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_EARTH, (FLOAT)atof(((m_AttrList[emAttr_DEarthElement]->m_curValue).GetBuffer(0))));
m_ItemOption.AttrRegist.SetElement_Val(ATTR_NOATTR, (FLOAT)atof(((m_AttrList[emAttr_DNoneElement]->m_curValue).GetBuffer(0))));
/*
m_ItemOption.AttrAttack.SetElement_Val(ATTR_FIRE, (FLOAT)atof(((m_AttrList[emAttr_AFireElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrAttack.SetElement_Val(ATTR_WATER, (FLOAT)atof(((m_AttrList[emAttr_AWaterElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrAttack.SetElement_Val(ATTR_TREE, (FLOAT)atof(((m_AttrList[emAttr_ATreeElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrAttack.SetElement_Val(ATTR_IRON, (FLOAT)atof(((m_AttrList[emAttr_AGoldElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrAttack.SetElement_Val(ATTR_EARTH, (FLOAT)atof(((m_AttrList[emAttr_AEarthElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrAttack.SetElement_Val(ATTR_NOATTR, (FLOAT)atof(((m_AttrList[emAttr_ANoneElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_FIRE, (FLOAT)atof(((m_AttrList[emAttr_DFireElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_WATER, (FLOAT)atof(((m_AttrList[emAttr_DWaterElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_TREE, (FLOAT)atof(((m_AttrList[emAttr_DTreeElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_IRON, (FLOAT)atof(((m_AttrList[emAttr_DGoldElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_EARTH, (FLOAT)atof(((m_AttrList[emAttr_DEarthElement]->m_curValue).GetBuffer(0))) / 100.0f);
m_ItemOption.AttrRegist.SetElement_Val(ATTR_NOATTR, (FLOAT)atof(((m_AttrList[emAttr_DNoneElement]->m_curValue).GetBuffer(0))) / 100.0f);
*/
if( !IsValiedOption() )
{
memset(&m_ItemOption, 0, sizeof(ITEM_OPTION_INFO));
m_bOption = FALSE;
}
}
else
memset(&m_ItemOption, 0, sizeof(ITEM_OPTION_INFO));
if( m_bOption )
m_Item.Durability = 9999;
m_Item.QuickPosition = 0;
EndDialog(eMR_Edit);
////////////////////////////////////////////
}
void CItemDlg::OnButtonDel()
{
// TODO: Add your control notification handler code here
memset(&m_Item, 0, sizeof(ITEMBASE));
memset(&m_ItemOption, 0, sizeof(ITEM_OPTION_INFO));
EndDialog(eMR_Delete);
}
void CItemDlg::OnOK()
{
}
void CItemDlg::OnCancel()
{
EndDialog(eMR_Cancel);
}
BOOL CItemDlg::IsValiedOption()
{
if( m_ItemOption.GenGol
|| m_ItemOption.MinChub
|| m_ItemOption.CheRyuk
|| m_ItemOption.SimMek
|| m_ItemOption.Life
|| m_ItemOption.NaeRyuk
|| m_ItemOption.Shield
|| m_ItemOption.PhyAttack
|| m_ItemOption.CriticalPercent
|| m_ItemOption.PhyDefense
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_FIRE)
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_WATER)
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_TREE)
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_IRON)
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_EARTH)
|| m_ItemOption.AttrAttack.GetElement_Val(ATTR_NOATTR)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_FIRE)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_WATER)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_TREE)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_IRON)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_EARTH)
|| m_ItemOption.AttrRegist.GetElement_Val(ATTR_NOATTR) )
return TRUE;
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -