📄 dlgmonster.cpp
字号:
//exp
DWORD nPetExp = g_objHero.GetPetLevelExp(pMonster->GetAmountLimit());
if (nPetExp == 0)
{
int idMsg = 100168;
strcpy(pText,(char*)g_objGameDataSet.GetStr(idMsg));
}
else
{
double dRate = (double)pMonster->GetGemAtkType()*100/nPetExp;
sprintf(pText,"%0.2f%%",dRate);
}
m_StaExp.SetWindowText(pText);
//life
sprintf(pText,"%d/%d",pMonster->GetWarGhostExp(),pMonster->GetMonsterMaxLife ());
m_StaHp.SetWindowText(pText);
if (!pMonster->IsMonsterDie())
m_ImgMonster.InsertImage(NULL,pMonster->GetID(),pMonster->GetTypeID(),true);
else
m_ImgMonster.InsertImage(NULL,pMonster->GetID(),pMonster->GetTypeID(),false);
//potential
itoa(pMonster->GetAddition(),pText,10);
m_StaPotential.SetWindowText(pText);
//grow
itoa(pMonster->GetMonsterGrow(),pText,10);
m_StaGrow.SetWindowText(pText);
//atk
sprintf(pText,"%d/%d",pMonster->GetMonsterMinAtk(),pMonster->GetMonsterMaxAtk());
m_StaFight.SetWindowText(pText);
//def
itoa(pMonster->GetMonsterDef(),pText,10);
m_StaFightDef.SetWindowText(pText);
//magic
sprintf(pText,"%d/%d",pMonster->GetMonsterMagicMinAtk(),pMonster->GetMonsterMagicMaxAtk());
m_StaMagic.SetWindowText(pText);
//Magicdef
itoa(pMonster->GetMonsterMagicDef(),pText,10);
m_StaMagicDef.SetWindowText(pText);
//dex
itoa(pMonster->GetDexterity(),pText,10);
m_StaSmart.SetWindowText(pText);
m_iCurMonster = mode;
if (CheckMonster())
m_CallChk.SetCheckValue(1);
else
m_CallChk.SetCheckValue(0);
}
void CDlgMonster::SetEggGrid()
{
//Clear Egg Grid
m_EggsGri.RemoveIcon(0,0,TRUE);
//GET eggs from Egg package
int nAmount = g_objHero.GetItemAmount(PACKAGE_EGG);
for(int i=0 ;i < nAmount ; i++)
{
CItem *pEgg = g_objHero.GetItemByIndex(i,PACKAGE_EGG);
if (pEgg != NULL)
{
int nIndex = m_EggsGri.InsertIcon( 1, 1, i, ICON_TYPE_ITEM ) ;
m_EggsGri.SetIconRealID(nIndex, pEgg->GetID());
}
}
}
void CDlgMonster::SetMonsterList()
{
m_EditMonster1.SetWindowText("");
m_EditMonster1.EnableWindow(false);
m_EditMonster2.SetWindowText("");
m_EditMonster2.EnableWindow(false);
m_EditMonster3.SetWindowText("");
m_EditMonster3.EnableWindow(false);
m_EditMonster4.SetWindowText("");
m_EditMonster4.EnableWindow(false);
m_StaExp.SetWindowText("");
m_StaFight.SetWindowText("");
m_StaFightDef.SetWindowText("");
m_StaGrow.SetWindowText("");
m_StaHp.SetWindowText("");
m_StaLevel.SetWindowText("");
m_StaMagic.SetWindowText("");
m_StaMagicDef.SetWindowText("");
m_StaMaster.SetWindowText("");
m_StaPotential.SetWindowText("");
m_StaSmart.SetWindowText("");
m_ImgMonster.RemoveImage();
m_MagicBtn.EnableWindow (false);
m_BtnRename.EnableWindow(false);
m_DropBtn.EnableWindow (false);
m_CallChk.EnableWindow (false);
m_ChkCallOut.EnableWindow(false);
int nAmount = g_objHero.GetItemAmount(PACKAGE_PET);
BOOL bFind = false;
for(int i=0;i<nAmount; i++)
{
CItem *pMonster = g_objHero.GetItemByIndex(i,PACKAGE_PET);
if (pMonster != NULL)
{
switch(i)
{
case 0:
{
m_EditMonster1.SetWindowText(pMonster->GetMonsterName());
}
break;
case 1:
{
m_EditMonster2.SetWindowText(pMonster->GetMonsterName());
}
break;
case 2:
{
m_EditMonster3.SetWindowText(pMonster->GetMonsterName());
}
break;
case 3:
{
m_EditMonster4.SetWindowText(pMonster->GetMonsterName());
}
break;
default:
break;
}
}
if (m_iCurMonster == i)
{
CDlgMonster::SetCurMonster(m_iCurMonster);
bFind = true;
}
}
if (!bFind)
{
m_iCurMonster = 0;
CDlgMonster::SetCurMonster(m_iCurMonster);
}
}
void CDlgMonster::OnBtnDrop()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/Monster_Drop.wav" ) ;
if (g_objHero.GetItemAmount(PACKAGE_PET)<=0)
{
return;
}
if (g_objHero.IsDead())
{
g_objGameMsg.AddMsg((char*)g_objGameDataSet.GetStr(10694));//"亡灵状态无法对幻兽进行任何操作!"
return;
}
CDlgMonster::GetParent()->PostMessage(WM_MY_MESSAGE,ON_MONSTER_DROP);
}
void CDlgMonster::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if ( g_bPickUp)
CDlgMonster::GetParent()->PostMessage(WM_MY_MESSAGE,ON_ICON_DROP,DLG_MONSTER);
else
{
int nAmount = g_objHero.GetItemAmount(PACKAGE_PET);
for(int i=0;i<nAmount;i++)
{
if (m_PrgMonstName[i].PtInRect(point))
{
if(i==m_iCurMonster)
CDlgMonster::GetParent()->PostMessage(WM_MY_MESSAGE,ON_ICON_PICKUP,DLG_MONSTER);
else
{
CDlgMonster::SetCurMonster(i);
if (m_DlgMonsterSkill.m_bShow)
m_DlgMonsterSkill.EnableWindow(false);
}
break;
}
}
}
CDialog::OnLButtonDown(nFlags, point);
}
void CDlgMonster::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDblClk(nFlags, point);
}
void CDlgMonster::ResetMonsterDlg()
{
m_iCurMonster = 0;
m_IdCurCallMonster.clear ();
m_CallChk.SetCheckValue(0);
}
BOOL CDlgMonster::CheckMonster()
{
CItem* pMonster = g_objHero.GetItemByIndex(m_iCurMonster,PACKAGE_PET);
if (pMonster != NULL)
{
for(int i=0;i<m_IdCurCallMonster.size ();i++)
if(m_IdCurCallMonster[i] == pMonster->GetID())
return TRUE;
}
return FALSE;
}
void CDlgMonster::DropMonster()
{
if (g_objHero.GetItemAmount(PACKAGE_PET)<=0)
{
return;
}
if (g_objHero.IsDead())
{
g_objGameMsg.AddMsg((char*)g_objGameDataSet.GetStr(10694));//"亡灵状态无法对幻兽进行任何操作!"
return;
}
CItem *pMonster = g_objHero.GetItemByIndex(m_iCurMonster,PACKAGE_PET);
if (pMonster)
{
CMyPos pPos;
g_objHero.GetPos(pPos);
g_objHero.DropItem(pMonster->GetID(),pPos.x, pPos.y);
}
}
OBJID CDlgMonster::GetCurMonsterID()
{
return m_CurMonsterID;
}
void CDlgMonster::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (g_bPickUp)
CDlgMonster::GetParent()->PostMessage(WM_MY_MESSAGE,ON_ICON_DROP,DLG_ALL);
CDialog::OnRButtonDown(nFlags, point);
}
void CDlgMonster::ResetMonstStatus()
{
int nAmount = m_IdCurCallMonster.size ();
for(int i=nAmount -1;i >=0;i--)
{
CItem* pMonster = g_objHero.GetItem (m_IdCurCallMonster[i]);
if (pMonster == NULL)
{
m_IdCurCallMonster.erase (m_IdCurCallMonster.begin ()+i);
}
}
}
void CDlgMonster::OnBtnMagic()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/Dlg_ok.wav" ) ;
if (m_DlgMonsterSkill.m_bShow)
{
m_DlgMonsterSkill.EnableWindow (false);
}
else
{
m_DlgMonsterSkill.EnableWindow ();
m_DlgMonsterSkill.SetMonsterID (m_iCurMonster);
}
}
void CDlgMonster::MoveButtons(BOOL bCall)
{
CRect rect;
CDlgMonster::GetWindowRect (rect);
if (bCall)
{
m_MagicBtn.EnableWindow (true);
m_BtnRename.MoveWindow (184,148,32,48,false);
m_BtnRename.ReInit (rect.left,rect.top);
m_DropBtn.MoveWindow (234,148,32,48,false);
m_DropBtn.ReInit (rect.left,rect.top);
}
else
{
m_MagicBtn.EnableWindow (false);
m_BtnRename.MoveWindow (134,148,32,48,false);
m_BtnRename.ReInit (rect.left,rect.top);
m_DropBtn.MoveWindow (184,148,32,48,false);
m_DropBtn.ReInit (rect.left,rect.top);
}
}
void CDlgMonster::OnBtnRename()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/Dlg_ok.wav" ) ;
if(m_EditName.IsWindowEnabled())
{
CItem* pPet = g_objHero.GetItemByIndex(m_iCurMonster, PACKAGE_PET);
if(pPet)
{
char szMsg[128] ="";
sprintf(szMsg, (char*)g_objGameDataSet.GetStr(10724), pPet->GetMonsterName());
g_objGameMsg.AddMsg( szMsg ); //放弃改名!
}
m_EditName.EnableWindow(false);
m_BtnRenameOk.EnableWindow(false);
m_BtnRenameCancel.EnableWindow(false);
}
else
{
m_EditName.EnableWindow();
m_BtnRenameOk.EnableWindow();
m_BtnRenameCancel.EnableWindow();
m_EditName.SetWindowText("");
m_EditName.SetFocus();
g_objGameMsg.AddMsg ((char*)g_objGameDataSet.GetStr (10728));
}
}
void CDlgMonster::OnBtnCallout()
{
// TODO: Add your control notification handler code here
if (g_objHero.IsDead () )
return;
CItem *pMonster = g_objHero.GetItemByIndex(m_iCurMonster,PACKAGE_PET);
if (pMonster)
{
if (g_objHero.GetPetByItemID(pMonster->GetID()))
{
DXPlaySound ( "Sound/Monster_Recede.wav" ) ;
g_objHero.KillEudenmon(pMonster->GetID());
CDlgMonster::GetParent()->PostMessage (WM_MY_MESSAGE,ON_MONSTER_KILL, pMonster->GetID());
}
else
{
if (pMonster->GetAmountLimit() >= g_objHero.GetLev() + 10)
{
g_objGameMsg.AddMsg((char*)g_objGameDataSet.GetStr(10808)); //10808=幻兽等级太高,您暂时无法召唤!
return;
}
// if (pMonster->GetWarGhostExp() > 0)
{
DXPlaySound ( "Sound/Monster_Out.wav" ) ;
g_objHero.CallEudenmon (pMonster->GetID());
CDlgMonster::GetParent()->PostMessage (WM_MY_MESSAGE,ON_MONSTER_CALL, pMonster->GetID());
}
// else
// g_objGameMsg.AddMsg((char*)g_objGameDataSet.GetStr(10729));
}
}
}
void CDlgMonster::OnBtnRenamecancel()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/button_cancel.wav" ) ;
if (m_EditName.IsWindowEnabled())
{
CItem* pPet = g_objHero.GetItemByIndex(m_iCurMonster, PACKAGE_PET);
if(pPet)
{
char szMsg[128] ="";
sprintf(szMsg, (char*)g_objGameDataSet.GetStr(10724), pPet->GetMonsterName());
g_objGameMsg.AddMsg( szMsg ); //放弃改名!
}
m_EditName.EnableWindow(false);
m_BtnRenameOk.EnableWindow(false);
m_BtnRenameCancel.EnableWindow(false);
}
}
void CDlgMonster::OnBtnRenameok()
{
// TODO: Add your control notification handler code here
DXPlaySound ( "Sound/button_confirm.wav" ) ;
char szName[_MAX_NAMESIZE] = "";
m_EditName.GetWindowText(szName,_MAX_NAMESIZE);
if(!StringCheck(szName))
{
g_objGameMsg.AddMsg( (char*)g_objGameDataSet.GetStr(10802) ); //名字不合法,不能有空格!
return;
}
CItem* pPet = g_objHero.GetItemByIndex(m_iCurMonster, PACKAGE_PET);
if(pPet)
{
g_objHero.RenameEudenmon(pPet->GetID(),szName);
}
m_EditName.EnableWindow(false);
m_BtnRenameOk.EnableWindow(false);
m_BtnRenameCancel.EnableWindow(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -