Y3t1y3t

NetVarManager

Dec 4th, 2014
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.56 KB | None | 0 0
  1. #include "HNetVarManager.h"
  2.  
  3.  
  4. void CNetVarManager::Setup( bool bLog )
  5. {
  6.  
  7.     ofstream log;
  8.     log.open( "C:\\NetVars.txt" , ios_base::app );
  9.  
  10.     while( !g_pClient->GetAllClasses( ) )Sleep( 100 );
  11.  
  12.     for( ClientClass* pClass = g_pClient->GetAllClasses( ); pClass; pClass = pClass->m_pNext )
  13.     {
  14.  
  15.         RecvProp* pProp[ 3 ];
  16.         NetVarTable_t* pTable = new NetVarTable_t( pClass->m_pRecvTable->m_pNetTableName );
  17.  
  18.         if( bLog )log << "> " << pClass->m_pRecvTable->m_pNetTableName << endl;
  19.  
  20.         for( int i = 0; i < pClass->m_pRecvTable->m_nProps; ++i )
  21.         {
  22.  
  23.             pProp[ 0 ] = &pClass->m_pRecvTable->m_pProps[ i ];
  24.             if( isdigit( pProp[ 0 ]->m_pVarName[ 0 ] ) )continue; //sorting shit classes out
  25.  
  26.             if( bLog )log << "-> " << pProp[ 0 ]->m_pVarName << " [ 0x" << hex << pProp[ 0 ]->m_Offset << " ]" << endl;
  27.             pTable->AddNetVar( pProp[ 0 ]->m_pVarName , pProp[ 0 ]->m_Offset );
  28.  
  29.             if( !pProp[ 0 ]->m_pDataTable )continue;
  30.  
  31.             for( int j = 0; j < pProp[ 0 ]->m_pDataTable->m_nProps; ++j )
  32.             {
  33.  
  34.                 pProp[ 1 ] = &pProp[ 0 ]->m_pDataTable->m_pProps[ j ];
  35.                 if( isdigit( pProp[ 1 ]->m_pVarName[ 0 ] ) )continue; //sorting shit classes out
  36.  
  37.                 if( bLog )log << "--> " << pProp[ 1 ]->m_pVarName << " [ 0x" << hex << pProp[ 1 ]->m_Offset << " ]" << endl;
  38.                 pTable->AddNetVar( pProp[ 1 ]->m_pVarName , pProp[ 1 ]->m_Offset );
  39.  
  40.                 if( !pProp[ 1 ]->m_pDataTable )continue;
  41.  
  42.                 for( int k = 0; k < pProp[ 1 ]->m_pDataTable->m_nProps; ++k )
  43.                 {
  44.  
  45.                     pProp[ 2 ] = &pProp[ 1 ]->m_pDataTable->m_pProps[ k ];
  46.                     if( isdigit( pProp[ 2 ]->m_pVarName[ 0 ] ) )continue; //sorting shit classes out
  47.  
  48.                     if( bLog )log << "---> " << pProp[ 2 ]->m_pVarName << " [ 0x" << hex << pProp[ 2 ]->m_Offset << " ]" << endl;
  49.                     pTable->AddNetVar( pProp[ 2 ]->m_pVarName , pProp[ 2 ]->m_Offset );
  50.                 }
  51.             }
  52.         }
  53.         this->AddNetVarTable( pTable );
  54.     }
  55.  
  56.     log.close( );
  57. }
  58.  
  59. vector<NetVarTable_t> pNetVarTableList;
  60. DWORD CNetVarManager::GetNetVarOffset( char* pszTableName , char* pszNetVar )
  61. {
  62.     for( int i = 0; i < pNetVarTableList.size( ); ++i )
  63.     {
  64.  
  65.         if( strcmp( pNetVarTableList[ i ].pszName , pszTableName ) != NULL )continue;
  66.  
  67.         for( int j = 0; j < pNetVarTableList[ i ].pNetVarList.size( ); ++j )
  68.         {
  69.  
  70.             if( !strcmp( pNetVarTableList[ i ].pNetVarList[ j ].pszName , pszNetVar ) )
  71.                 return pNetVarTableList[ i ].pNetVarList[ j ].dwOffset ? pNetVarTableList[ i ].pNetVarList[ j ].dwOffset : NULL;
  72.         }
  73.     }
  74.     return NULL;
  75. }
  76.  
  77. void CNetVarManager::AddNetVarTable( NetVarTable_t* pNetVarTable )
  78. {
  79.  
  80.     pNetVarTableList.push_back( *pNetVarTable );
  81. }
  82. CNetVarManager* g_pNetVarManager;
Advertisement
Add Comment
Please, Sign In to add comment