📄 dlgmonsterheads.cpp
字号:
m_StaHp1.SetWindowText (szInfo);
sprintf (szInfo,"%d/%d",m_Xp1,100);
m_StaXp1.SetWindowText (szInfo);
DWORD nPetExp = g_objHero.GetPetLevelExp(pMonster->GetAmountLimit());
if (nPetExp == 0)
{
int idMsg = 100168;
strcpy(szInfo,(char*)g_objGameDataSet.GetStr(idMsg));
}
else
{
double dRate = (double)pMonster->GetGemAtkType()*100/nPetExp;
sprintf(szInfo,"%0.2f%%",dRate);
}
m_StaExp1.SetWindowText (szInfo);
}
break;
case 1:
{
m_StaName2.SetWindowText (pMonster->GetMonsterName ());
m_Hp2 = pMonster->GetWarGhostExp ();
m_Exp2 = pMonster->GetGemAtkType ();
m_ProgressHp2.ResetValue (0,pMonster->GetMonsterMaxLife ());
m_ProgressExp2.ResetValue (0,g_objHero.GetPetLevelExp(pMonster->GetAmountLimit()));
CPet* pPet = g_objHero.GetPetByItemID (pMonster->GetID ());
if (pPet)
{
m_Xp2 = pPet->GetPotential ();
m_BtnCall2.ChangeImage ("Button572");
m_BtnCall2.EnableWindow ();
if (g_objHero.GetAttachPetId () != pMonster->GetID () && pMonster->GetTypeID ()%10 == 2) //是否二次进化
{
m_BtnAttach2.EnableWindow ();
m_BtnAttach2.ChangeImage("Button571");
}
}
else
{
m_Xp2 = 0;
if (g_objHero.GetAttachPetId () == pMonster->GetID())
{
m_BtnAttach2.ChangeImage("Button573");
m_BtnAttach2.EnableWindow ();
m_BtnCall2.EnableWindow (false);
}
else
{
m_BtnAttach2.EnableWindow (false);
m_BtnCall2.ChangeImage ("Button570");
m_BtnCall2.EnableWindow ();
}
}
if (pMonster->GetWarGhostExp() >0 )
{
if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*3/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()*2/10)
{
if (!m_EffectHead2.TestEffect("baby_d1"))
m_EffectHead2.Add("baby_d1"); //警告光xiao
m_ProgressHp2.SetProgressID("Progress5841"); //浅红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*2/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()/10)
{
m_ProgressHp2.SetProgressID("Progress5842"); //暗红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()/10)
{
if (!m_EffectHead2.TestEffect("baby_d1"))
m_EffectHead2.Add("baby_d1"); //警告光xiao
}
else
{
m_EffectHead2.Clear(); //clear effect
m_ProgressHp2.SetProgressID("Progress584"); //NORMAL
}
}
else
{
m_EffectHead2.Clear(); //clear effect
}
if(!pMonster->IsMonsterDie())
m_ImgHead2.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),true);
else
m_ImgHead2.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),false);
m_ProgressXp2.ResetValue (0, 100);
char szInfo[32]="";
sprintf (szInfo,"%d/%d",m_Hp2,pMonster->GetMonsterMaxLife ());
m_StaHp2.SetWindowText (szInfo);
sprintf (szInfo,"%d/%d",m_Xp2,100);
m_StaXp2.SetWindowText (szInfo);
DWORD nPetExp = g_objHero.GetPetLevelExp(pMonster->GetAmountLimit());
if (nPetExp == 0)
{
int idMsg = 100168;
strcpy(szInfo,(char*)g_objGameDataSet.GetStr(idMsg));
}
else
{
double dRate = (double)pMonster->GetGemAtkType()*100/nPetExp;
sprintf(szInfo,"%0.2f%%",dRate);
}
m_StaExp2.SetWindowText (szInfo);
}
break;
case 2:
{
m_StaName3.SetWindowText (pMonster->GetMonsterName ());
m_Hp3 = pMonster->GetWarGhostExp ();
m_Exp3 = pMonster->GetGemAtkType ();
m_ProgressHp3.ResetValue (0,pMonster->GetMonsterMaxLife ());
m_ProgressExp3.ResetValue (0,g_objHero.GetPetLevelExp(pMonster->GetAmountLimit()));
CPet* pPet = g_objHero.GetPetByItemID (pMonster->GetID ());
if (pPet)
{
m_Xp3 = pPet->GetPotential ();
m_BtnCall3.ChangeImage ("Button572");
m_BtnCall3.EnableWindow ();
if (g_objHero.GetAttachPetId () != pMonster->GetID () && pMonster->GetTypeID ()%10 == 2) //是否二次进化
{
m_BtnAttach3.ChangeImage("Button571");
m_BtnAttach3.EnableWindow ();
}
}
else
{
m_Xp3 = 0;
if (g_objHero.GetAttachPetId () == pMonster->GetID())
{
m_BtnAttach3.EnableWindow ();
m_BtnAttach3.ChangeImage("Button573");
m_BtnCall3.EnableWindow (false);
}
else
{
m_BtnAttach3.EnableWindow (false);
m_BtnCall3.EnableWindow ();
m_BtnCall3.ChangeImage ("Button570");
}
}
if (pMonster->GetWarGhostExp() >0 )
{
if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*3/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()*2/10)
{
if (!m_EffectHead3.TestEffect("baby_d1"))
m_EffectHead3.Add("baby_d1"); //警告光xiao
m_ProgressHp3.SetProgressID("Progress5841"); //浅红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*2/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()/10)
{
m_ProgressHp3.SetProgressID("Progress5842"); //暗红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()/10)
{
if (!m_EffectHead3.TestEffect("baby_d1"))
m_EffectHead3.Add("baby_d1"); //警告光xiao
}
else
{
m_EffectHead3.Clear(); //clear effect
m_ProgressHp3.SetProgressID("Progress584"); //NORMAL
}
}
else
{
m_EffectHead3.Clear(); //clear effect
}
if(!pMonster->IsMonsterDie())
m_ImgHead3.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),true);
else
m_ImgHead3.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),false);
m_ProgressXp3.ResetValue (0, 100);
char szInfo[32]="";
sprintf (szInfo,"%d/%d",m_Hp3,pMonster->GetMonsterMaxLife ());
m_StaHp3.SetWindowText (szInfo);
sprintf (szInfo,"%d/%d",m_Xp3,100);
m_StaXp3.SetWindowText (szInfo);
DWORD nPetExp = g_objHero.GetPetLevelExp(pMonster->GetAmountLimit());
if (nPetExp == 0)
{
int idMsg = 100168;
strcpy(szInfo,(char*)g_objGameDataSet.GetStr(idMsg));
}
else
{
double dRate = (double)pMonster->GetGemAtkType()*100/nPetExp;
sprintf(szInfo,"%0.2f%%",dRate);
}
m_StaExp3.SetWindowText (szInfo);
}
break;
case 3:
{
m_StaName4.SetWindowText (pMonster->GetMonsterName ());
m_Hp4 = pMonster->GetWarGhostExp ();
m_Exp4 = pMonster->GetGemAtkType ();
m_ProgressHp4.ResetValue (0,pMonster->GetMonsterMaxLife ());
m_ProgressExp4.ResetValue (0,g_objHero.GetPetLevelExp(pMonster->GetAmountLimit()));
CPet* pPet = g_objHero.GetPetByItemID (pMonster->GetID ());
if (pPet)
{
m_Xp4 = pPet->GetPotential ();
m_BtnCall4.ChangeImage ("Button572");
m_BtnCall4.EnableWindow ();
if (g_objHero.GetAttachPetId () != pMonster->GetID () && pMonster->GetTypeID ()%10 == 2) //是否二次进化
{
m_BtnAttach4.ChangeImage("Button571");
m_BtnAttach4.EnableWindow ();
}
}
else
{
m_Xp4 = 0;
if (g_objHero.GetAttachPetId () == pMonster->GetID())
{
m_BtnAttach4.EnableWindow ();
m_BtnAttach4.ChangeImage("Button573");
m_BtnCall4.EnableWindow (false);
}
else
{
m_BtnAttach4.EnableWindow (false);
m_BtnCall4.EnableWindow ();
m_BtnCall4.ChangeImage ("Button570");
}
}
if (pMonster->GetWarGhostExp() >0 )
{
if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*3/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()*2/10)
{
if (!m_EffectHead4.TestEffect("baby_d1"))
m_EffectHead4.Add("baby_d1"); //警告光xiao
m_ProgressHp4.SetProgressID("Progress5841"); //浅红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()*2/10
&& pMonster->GetWarGhostExp() > pMonster->GetMonsterMaxLife()/10)
{
m_ProgressHp4.SetProgressID("Progress5842"); //暗红色
}
else if (pMonster->GetWarGhostExp() <= pMonster->GetMonsterMaxLife()/10)
{
if (!m_EffectHead4.TestEffect("baby_d1"))
m_EffectHead4.Add("baby_d1"); //警告光xiao
}
else
{
m_EffectHead4.Clear(); //clear effect
}
}
else
{
m_EffectHead4.Clear(); //clear effect
m_EffectHead4.Add("petdie"); //add pet die effect
}
m_ProgressXp4.ResetValue (0, 100);
if(!pMonster->IsMonsterDie())
m_ImgHead4.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),true);
else
m_ImgHead4.InsertImage (NULL, pMonster->GetID (),pMonster->GetTypeID (),false);
char szInfo[32]="";
sprintf (szInfo,"%d/%d",m_Hp4,pMonster->GetMonsterMaxLife ());
m_StaHp4.SetWindowText (szInfo);
sprintf (szInfo,"%d/%d",m_Xp4,100);
m_StaXp4.SetWindowText (szInfo);
DWORD nPetExp = g_objHero.GetPetLevelExp(pMonster->GetAmountLimit());
if (nPetExp == 0)
{
int idMsg = 100168;
strcpy(szInfo,(char*)g_objGameDataSet.GetStr(idMsg));
}
else
{
double dRate = (double)pMonster->GetGemAtkType()*100/nPetExp;
sprintf(szInfo,"%0.2f%%",dRate);
}
m_StaExp4.SetWindowText (szInfo);
}
break;
default:
break;
}
}
}
}
void CDlgMonsterHeads::AddEffect(char* szEffect, OBJID idPet)
{
CPet* pPet = g_objHero.GetPetByID(idPet);
if (!pPet)
return;
int nAmount = m_setMonsterHead.size ();
if (nAmount <=0)
return;
for(int i=0;i<nAmount;i++)
{
CItem* pMonster = g_objHero.GetItem (m_setMonsterHead[i]);
if (pPet->GetItemID() == pMonster->GetID())
{
switch(i)
{
case 0:
m_EffectHead1.Add(szEffect);
break;
case 1:
m_EffectHead2.Add(szEffect);
break;
case 2:
m_EffectHead3.Add(szEffect);
break;
case 3:
m_EffectHead4.Add(szEffect);
break;
default:
break;
}
}
}
}
int CDlgMonsterHeads::ShowProgressInfo ()
{
POINT mousePnt ;
GetCursorPos ( &mousePnt ) ;
CRect PrgRect[12];
int nAmount = 0;
if(m_ImgHead1.GetImageLoadState ())
{
m_ProgressHp1.GetWindowRect(PrgRect[0]);
m_ProgressXp1.GetWindowRect(PrgRect[1]);
m_ProgressExp1.GetWindowRect (PrgRect[2]);
nAmount +=3;
}
if(m_ImgHead2.GetImageLoadState ())
{
m_ProgressHp2.GetWindowRect(PrgRect[3]);
m_ProgressXp2.GetWindowRect(PrgRect[4]);
m_ProgressExp2.GetWindowRect (PrgRect[5]);
nAmount +=3;
}
if(m_ImgHead3.GetImageLoadState ())
{
m_ProgressHp3.GetWindowRect(PrgRect[6]);
m_ProgressXp3.GetWindowRect(PrgRect[7]);
m_ProgressExp3.GetWindowRect (PrgRect[8]);
nAmount +=3;
}
if(m_ImgHead4.GetImageLoadState ())
{
m_ProgressHp4.GetWindowRect(PrgRect[9]);
m_ProgressXp4.GetWindowRect(PrgRect[10]);
m_ProgressExp4.GetWindowRect (PrgRect[11]);
nAmount +=3;
}
int nIndex = 0;
for(int i=0;i<nAmount;i++)
{
if (PrgRect[i].PtInRect(mousePnt))
{
nIndex = i+1;
break;
}
}
return nIndex;
}
void CDlgMonsterHeads::HideCurMonsterBtns (int nIndex)
{
if (nIndex != 0)
{
m_BtnCall1.EnableWindow (false);
m_BtnAttach1.EnableWindow (false);
m_bHeadClick1 = false;
}
if (nIndex != 1)
{
m_BtnCall2.EnableWindow (false);
m_BtnAttach2.EnableWindow (false);
m_bHeadClick2 = false;
}
if (nIndex != 2)
{
m_BtnCall3.EnableWindow (false);
m_BtnAttach3.EnableWindow (false);
m_bHeadClick3 = false;
}
if (nIndex != 3)
{
m_BtnCall4.EnableWindow (false);
m_BtnAttach4.EnableWindow (false);
m_bHeadClick4 = false;
}
}
void CDlgMonsterHeads::AddCallMonster(OBJID idPet)
{
int i =0 ;
for(i=0;i<4;i++)
{
if (m_setMonsterCall[i] == idPet)
{
return;
}
}
for(i=0;i<4;i++)
{
if (m_setMonsterCall[i] == 0)
{
m_setMonsterCall[i] = idPet;
return;
}
}
}
void CDlgMonsterHeads::DelCallMonster(OBJID idPet)
{
for(int i=0;i<4;i++)
{
if (m_setMonsterCall[i] == idPet)
{
m_setMonsterCall[i] = 0;
return;
}
}
}
void CDlgMonsterHeads::UpdataCallMonster()
{
for(int i=0;i< 4;i++)
{
if (m_setMonsterCall[i] != 0)
{
CItem* pPet = g_objHero.GetItem(m_setMonsterCall[i]);
if (pPet && pPet->GetWarGhostExp() > 0)
continue;
else
m_setMonsterCall[i] = 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -