飞飞迷 > 源码修改 > 阻止崩溃包导致游戏异常

阻止崩溃包导致游戏异常

来源:飞飞迷 发布时间:2015-07-05 浏览:

打开上的worldserver文件夹下的DPServer.cpp。

搜索代码:
ar >> dwData >> objid >> nPart;
if( nPart >= MAX_HUMAN_PARTS )
  return;
后添加:

代码:
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
//Crash packet
if ( nPart > 30 || dwData < 0 ) {
   Error( "CDPSrvr::OnDoUseItem : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d]",
      pUser->m_idPlayer, pUser->GetName(), dwData, objid, nPart );
  return;
}
再次搜索
代码:
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
购买崩溃:
你需要找到两处
搜索:

代码:
ar >> cTab >> nId >> nNum >> dwItemId;
if( cTab >= MAX_VENDOR_INVENTORY_TAB || nNum < 1 )
  return;
后添加:

代码:
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );
//CRASH
if( cTab > 3 || cTab < 0 || nId < 0 || nNum <= 0 || nNum > 9999 || dwItemId < 0 ) {
  Error( "CDPSrvr::OnBuyItem : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
      pUser->m_idPlayer, pUser->GetName(), cTab, nId, nNum, dwItemId );
  return;
}
注释这个
代码:
CUser* pUser = g_UserMng.GetUser( dpidCache, dpidUser );

物品包崩溃:
搜索:

代码:
  ar >> nPocket1 >> nItem >> nNum >> nPocket2;

  if( nPocket1 == nPocket2 )
   return;
后添加:

代码:
  //DUPE CODE
  if( nNum <= 0 ) {
   Error( "CDPSrvr::OnMoveItemOnPocket : Dupe Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
      pUser->m_idPlayer, pUser->GetName(), nPocket1, nItem, nNum, nPocket2 );
   return;
  }

  //CRASH
  if( nItem < 0 || nPocket2 > 2 || nPocket1 < -1 || nPocket1 > 52 ) {
   Error( "CDPSrvr::OnMoveItemOnPocket : Crash Try -> [Player ID: %07d], [Player Name: %s], [Packet used: %d,%d,%d,%d]",
      pUser->m_idPlayer, pUser->GetName(), nPocket1, nItem, nNum, nPocket2 );
   return;
  }

相关推荐

历史版本

  • V19.飞你莫属
  • 11-11-24V18.翱翔重生
  • 11-04-13V17.龙的逆袭
  • 10-12-13V16.神采飞扬
  • 10-04-16V15.羽化飞天
  • 09-11-04V14.翼之降临