游戏乐悠悠网游开发网

标题: 修改穿洞功能 [打印本页]

作者: mythosdev    时间: 2015-9-22 09:14
标题: 修改穿洞功能
void CWndPiercing::OnDraw( C2DRender* p2DRender )//穿刺  穿洞
{
for( int i=0; i<3; i++ )
{
  if( m_pItemElem && m_pItemElem->GetTexture() )
  {
   m_pItemElem->GetTexture()->Render( p2DRender, m_Rect.TopLeft(), 255 );
   if( m_pItemElem->m_nItemNum > 1 )
   {
    TCHAR szTemp[32];
    _stprintf( szTemp, "%d", m_pItemElem->GetExtra() );//get the number
    p2DRender->TextOut( m_Rect.right-11,  m_Rect.bottom-11 , szTemp, 0xff1010ff );//output number
   }
   //*
    //Display icon
   CRect hitrect = m_Rect;
   CPoint point = GetMousePoint();
   if( m_Rect.PtInRect( point ) )
   {
    CPoint point2 = point;
    ClientToScreen( &point2 );
    ClientToScreen( &hitrect );
     
    g_WndMng.PutToolTip_Item( (CItemBase*)m_pItemElem, point2, &hitrect );
   }
   /**/
  }
}
CWndStatic* pWndFocusStatic = (CWndStatic*)GetDlgItem(WIDC_STATIC9);   
if( m_pItemElem[0] )
{
  int nCost = 0;
  ItemProp* pItemProp = m_pItemElem[0]->GetProp();
  if( pItemProp )
   //显示所需的金币
    nCost = m_pItemElem[0]->GetLimitLevel() * ( 200  + ( m_pItemElem[0]->GetAbilityOption()+1) * 200 );
  char buff[10] = { 0 };
  pWndFocusStatic->SetTitle( itoa( nCost, buff, 10 ) );   
}
else
{
  pWndFocusStatic->SetTitle( "0" );   
}
}
////////////////////////////////////////


void CItemUpgrade::OnPiercingSize( CUser* pUser, DWORD dwId1, DWORD dwId2, DWORD dwId3 )
{
CItemElem* pItemElem0 = pUser->m_Inventory.GetAtId( dwId1 );
CItemElem* pItemElem1 = pUser->m_Inventory.GetAtId( dwId2 );
CItemElem* pItemElem2 = pUser->m_Inventory.GetAtId( dwId3 );
if( IsUsableItem( pItemElem0 ) == FALSE || IsUsableItem( pItemElem1 ) == FALSE )
  return;
if( pUser->m_vtInfo.GetOther() || pUser->m_vtInfo.VendorIsVendor() ) // 芭贰 吝捞搁...
  return;
  
if( pUser->m_Inventory.IsEquip( pItemElem0->m_dwObjId ) )
{
  pUser->AddDefinedText( TID_GAME_EQUIPPUT );
  return;
}
//////////////// 能否被穿洞 ////////////////
if( !pItemElem0->IsPierceAble( NULL_ID, TRUE ) )
{
  pUser->AddDefinedText( TID_PIERCING_POSSIBLE_ITEM );
  return;
}
/////////////////////////检查精炼的所需品 1
#if __VER >= 13
  if( pItemElem1->GetProp()->dwID != II_GEN_MAT_ORICHALCUM01
  && pItemElem1->GetProp()->dwID != II_GEN_MAT_ORICHALCUM01_1 )
{
  pUser->AddDefinedText( TID_SBEVE_NOTUSEITEM );   // 乔绢教俊 鞘夸茄 林荤困啊 酒聪搁 阂啊瓷
  return;
}
#else
if( pItemElem1->GetProp()->dwID != II_GEN_MAT_MOONSTONE
  && pItemElem1->GetProp()->dwID != II_GEN_MAT_MOONSTONE_1 )
{
  pUser->AddDefinedText( TID_SBEVE_NOTUSEITEM );   // 乔绢教俊 鞘夸茄 林荤困啊 酒聪搁 阂啊瓷
  return;
}
#endif //__VAR_D >=4
/////////////////////////检查精炼的所需品 2
if( IsUsableItem( pItemElem2 ) && pItemElem2->m_dwItemId != II_SYS_SYS_SCR_PIEPROT )
{
  pUser->AddDefinedText( TID_SBEVE_NOTUSEITEM );   // 惑侩酒捞袍捞 酒聪搁 阂啊瓷
  return;
}
LogItemInfo aLogItem;
aLogItem.SendName = pUser->GetName();
aLogItem.RecvName = "PIERCING";
aLogItem.WorldId = pUser->GetWorld()->GetID();
int nCost = 100000;
  nCost = pItemElem0->GetLimitLevel() * ( 200  + ( pItemElem0->GetAbilityOption()+1) * 200 );
if( 0 < nCost )
{
  if( pUser->GetGold() < nCost )
  {
   pUser->AddDefinedText( TID_GAME_LACKMONEY , "" );
   return;
  }
  pUser->AddGold( -( nCost ) );
  aLogItem.Gold = pUser->GetGold() + nCost;
  aLogItem.Gold2 = pUser->GetGold();
  aLogItem.Action = "!";
  //aLogItem.ItemName = "SEED";
  _stprintf( aLogItem.szItemName, "%d", II_GOLD_SEED1 );
  aLogItem.itemNumber = nCost;
  g_DPSrvr.OnLogItem( aLogItem );
}
else
{
  return;
}
aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
#if __VER >= 13
int RandUp[41] = { 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
        10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
        10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
        10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
     };
  //Get Refining the number
  WORD GetUp = pItemElem0->GetAbilityOption();
if(pItemElem0->GetAbilityOption() > 9 && pItemElem0->GetAbilityOption() < 50)
{
int i = GetUp - 10;
if( (int)( xRandom( 10000 ) ) > RandUp )
{ // 角菩
  if( pItemElem2 )        // 惑侩拳 酒捞袍阑 荤侩窍看栏搁...
   aLogItem.RecvName = "PIERCING_PROTECTED";
  aLogItem.Action = "!";
  g_DPSrvr.OnLogItem( aLogItem, pItemElem0, pItemElem0->m_nItemNum );
  aLogItem.RecvName = "PIERCING";
  pUser->AddPlaySound( SND_INF_UPGRADEFAIL );
  g_UserMng.AddCreateSfxObj((CMover *)pUser, XI_INT_FAIL, pUser->GetPos().x, pUser->GetPos().y, pUser->GetPos().z);
  if(pItemElem0->GetAbilityOption()>= 1)
  {
   pUser->UpdateItem( (BYTE)pItemElem0->m_dwObjId, UI_AO,  pItemElem0->GetAbilityOption()- 1 );
  }
  pUser->AddDefinedText( TID_UPGRADE_FAIL , "" );//强化失败了
   
  if( pItemElem2 == NULL )        // 如果没有辅助物品的话,穿洞失败后物品删除
   pUser->RemoveItem( (BYTE)( dwId1 ), (short)1 );   
}
else
{ // 己傍   
  pUser->AddPlaySound( SND_INF_UPGRADESUCCESS );
   
  if( pUser->IsMode( TRANSPARENT_MODE ) == 0)
   g_UserMng.AddCreateSfxObj( (CMover *)pUser, XI_INT_SUCCESS, pUser->GetPos().x, pUser->GetPos().y, pUser->GetPos().z);
   pUser->UpdateItem( (BYTE)pItemElem0->m_dwObjId, UI_AO,  pItemElem0->GetAbilityOption()+1 );
   aLogItem.Action = "H";
     pUser->AddDefinedText( TID_UPGRADE_SUCCEEFUL , "" );//穿洞成功
   g_DPSrvr.OnLogItem( aLogItem, pItemElem0, pItemElem0->m_nItemNum );
}
aLogItem.Action = "!";
g_DPSrvr.OnLogItem( aLogItem, pItemElem1, pItemElem1->m_nItemNum );
// 促捞胶客 蜡丰酒捞袍 昏力茄促.
pUser->RemoveItem( (BYTE)( dwId2 ), (short)1 );
if( dwId3 != NULL_ID )
{
  aLogItem.Action = "!";
  if( IsUsableItem( pItemElem2 ) )
  {
   g_DPSrvr.OnLogItem( aLogItem, pItemElem2, pItemElem2->m_nItemNum );
   g_dpDBClient.SendLogSMItemUse( "2", pUser, pItemElem2, pItemElem2->GetProp() );
   pUser->RemoveItem( (BYTE)( dwId3 ), (short)1 );
  }
  else
  {
   g_DPSrvr.OnLogItem( aLogItem, NULL, 0 );
  }
}
}else
  pUser->AddDefinedText( TID_GAME_SMELT_SAFETY_ERROR13 , "" );//运行出错
#else // __VAR_ >=4
//得到下一个等级穿刺的几率
int nPersent = 0;
if( pItemElem1->GetProp()->dwID == II_GEN_MAT_MOONSTONE
  || pItemElem1->GetProp()->dwID == II_GEN_MAT_MOONSTONE_1 )
  nPersent = GetSizeProb( pItemElem0 );
if( nPersent < (int)( xRandom( 10000 ) ) )
{ // 角菩
  if( pItemElem2 )        // 惑侩拳 酒捞袍阑 荤侩窍看栏搁...
   aLogItem.RecvName = "PIERCING_PROTECTED";
  aLogItem.Action = "!";
  g_DPSrvr.OnLogItem( aLogItem, pItemElem0, pItemElem0->m_nItemNum );
  aLogItem.RecvName = "PIERCING";
  pUser->AddPlaySound( SND_INF_UPGRADEFAIL );
  g_UserMng.AddCreateSfxObj((CMover *)pUser, XI_INT_FAIL, pUser->GetPos().x, pUser->GetPos().y, pUser->GetPos().z);
  pUser->AddDefinedText( TID_MMI_PIERCINGFAIL , "" );
   
  if( pItemElem2 == NULL )        // 惑侩拳 酒捞袍阑 荤侩窍瘤 臼疽促搁
   pUser->RemoveItem( (BYTE)( dwId1 ), (short)1 ); // 乔绢教 措惑 酒捞袍篮 昏力等促.   
}
else
{ // 己傍   
  pUser->AddPlaySound( SND_INF_UPGRADESUCCESS );   
  g_UserMng.AddCreateSfxObj((CMover *)pUser, XI_INT_SUCCESS, pUser->GetPos().x, pUser->GetPos().y, pUser->GetPos().z);   
  pUser->UpdateItem( (BYTE)pItemElem0->m_dwObjId, UI_PIERCING_SIZE, pItemElem0->GetPiercingSize() + 1 );
  pUser->AddDefinedText( TID_MMI_PIERCINGSUCCESS , "" );
  aLogItem.Action = "#";
  g_DPSrvr.OnLogItem( aLogItem, pItemElem0, pItemElem0->m_nItemNum );
}
aLogItem.Action = "!";
g_DPSrvr.OnLogItem( aLogItem, pItemElem1, pItemElem1->m_nItemNum );
// 促捞胶客 蜡丰酒捞袍 昏力茄促.
pUser->RemoveItem( (BYTE)( dwId2 ), (short)1 );
if( dwId3 != NULL_ID )
{
  aLogItem.Action = "!";
  if( IsUsableItem( pItemElem2 ) )
  {
   g_DPSrvr.OnLogItem( aLogItem, pItemElem2, pItemElem2->m_nItemNum );
   g_dpDBClient.SendLogSMItemUse( "2", pUser, pItemElem2, pItemElem2->GetProp() );
   pUser->RemoveItem( (BYTE)( dwId3 ), (short)1 );
  }
  else
  {
   g_DPSrvr.OnLogItem( aLogItem, NULL, 0 );
  }
}
#endif //__VAR_D
}

作者: dianpula    时间: 2018-12-22 23:56
       
顶一个,支持




欢迎光临 游戏乐悠悠网游开发网 (http://bbs.yxlyy.club/) Powered by Discuz! X3.2