751743019
4级·生命之泉
4级·生命之泉
  • UID20114
  • 注册日期2011-12-21
  • 最后登录2014-07-26
  • 粉丝1
  • 关注0
  • 发帖数42
  • QQ
  • 铜币75枚
  • 威望0点
  • 银元188个
阅读:2947回复:2

【源码修改】修改穿洞功能

楼主#
更多 发布于:2014-05-02 08:54

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
}
751743019
4级·生命之泉
4级·生命之泉
  • UID20114
  • 注册日期2011-12-21
  • 最后登录2014-07-26
  • 粉丝1
  • 关注0
  • 发帖数42
  • QQ
  • 铜币75枚
  • 威望0点
  • 银元188个
沙发#
发布于:2014-05-02 08:56

图片:bbb.jpg

慜慜
2级·斗气风暴
2级·斗气风暴
  • UID42159
  • 注册日期2014-09-02
  • 最后登录2014-12-31
  • 粉丝1
  • 关注0
  • 发帖数55
  • QQ
  • 铜币33枚
  • 威望0点
  • 银元8个
板凳#
发布于:2014-12-24 10:05
                 学习了  
游客

返回顶部