Advertisement
Absol

Untitled

Sep 16th, 2016
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 82.84 KB | None | 0 0
  1. #define DEBUG
  2. #pragma region Headers
  3. #define _WIN32_WINNT 0x0501
  4. #define WINVER 0x0501
  5. #define NTDDI_VERSION 0x05010000
  6. //#define BOTDEBUG
  7. #define WIN32_LEAN_AND_MEAN
  8. #include <stdexcept>
  9. #include <Windows.h>
  10. #include <string>
  11. #include <vector>
  12. #include <sstream>
  13. #include <algorithm>
  14. #include <time.h>
  15. #include <thread>  
  16. #include <TlHelp32.h>
  17. #include <exception>
  18. #define _USE_MATH_DEFINES
  19. #include <math.h>
  20. #pragma endregion
  21.  
  22. //#define BOTDEBUG
  23. void PrintDebugInfo( const char * debuginfo );
  24.  
  25. #ifdef BOTDEBUG
  26. #include <tlhelp32.h>
  27. void DebugStr( const char* szDllPath );
  28. #endif
  29.  
  30. DWORD __stdcall temptechiesthread( LPVOID );
  31. // Game.dll address
  32. int GameDll = 0;
  33. int _W3XGlobalClass;
  34.  
  35. int UseWarnIsBadReadPtr = 1;
  36. BOOL DebugActive = FALSE;
  37.  
  38. int techiesaddr = 0;
  39. std::vector<int> unitstoselect;
  40.  
  41. time_t LatestTime = time( NULL );
  42.  
  43. int latestunit = 0;
  44.  
  45. int latestunitclass = 0;
  46.  
  47. DWORD latestvalue1 = 0;
  48. DWORD latestvalue2 = 0;
  49.  
  50. char TechiesCrash[ 150 ];
  51.  
  52. BOOL ExpertModeEnabled = FALSE;
  53. BOOL Enable3DPoint = FALSE;
  54. BOOL StealthMode = FALSE;
  55.  
  56. int CATCH( unsigned int code, struct _EXCEPTION_POINTERS *ep )
  57. {
  58.     return ExceptionContinueExecution;
  59. }
  60.  
  61. BOOL IsOkayPtr( void *ptr, unsigned int size = 4 )
  62. {
  63.     if ( UseWarnIsBadReadPtr == 1 )
  64.     {
  65.         BOOL returnvalue = FALSE;
  66.         returnvalue = IsBadReadPtr( ptr, size ) == 0;
  67.         if ( !returnvalue )
  68.         {
  69.  
  70. #ifdef BOTDEBUG
  71.             PrintDebugInfo( "ErrorErrorError1" );
  72. #endif
  73.         }
  74.         return returnvalue;
  75.     }
  76.     else if ( UseWarnIsBadReadPtr == 2 )
  77.     {
  78.         MEMORY_BASIC_INFORMATION mbi;
  79.         if ( VirtualQuery( ptr, &mbi, sizeof( MEMORY_BASIC_INFORMATION ) ) == 0 )
  80.         {
  81.  
  82. #ifdef BOTDEBUG
  83.             PrintDebugInfo( "ErrorErrorError2" );
  84. #endif
  85.             return FALSE;
  86.         }
  87.  
  88.         if ( ( int ) ptr + size > ( int ) mbi.BaseAddress + mbi.RegionSize )
  89.         {
  90.  
  91. #ifdef BOTDEBUG
  92.             PrintDebugInfo( "ErrorErrorError2" );
  93. #endif
  94.             return FALSE;
  95.         }
  96.  
  97.  
  98.         if ( ( int ) ptr < ( int ) mbi.BaseAddress )
  99.         {
  100.  
  101. #ifdef BOTDEBUG
  102.             PrintDebugInfo( "ErrorErrorError2" );
  103. #endif
  104.             return FALSE;
  105.         }
  106.  
  107.  
  108.         if ( mbi.State != MEM_COMMIT )
  109.         {
  110.  
  111. #ifdef BOTDEBUG
  112.             PrintDebugInfo( "ErrorErrorError2" );
  113. #endif
  114.             return FALSE;
  115.         }
  116.  
  117.  
  118.         if ( mbi.Protect != PAGE_READWRITE &&  mbi.Protect != PAGE_WRITECOPY && mbi.Protect != PAGE_READONLY )
  119.         {
  120.  
  121. #ifdef BOTDEBUG
  122.             PrintDebugInfo( "ErrorErrorError2" );
  123. #endif
  124.             return FALSE;
  125.         }
  126.  
  127.         return TRUE;
  128.     }
  129.     else
  130.         return TRUE;
  131. }
  132.  
  133. union DWFP
  134. {
  135.     DWORD dw;
  136.     float fl;
  137. };
  138.  
  139.  
  140. struct DebugStruct
  141. {
  142.     int addr;
  143.     int procid;
  144. };
  145.  
  146.  
  147. void PrintDebugInfo( const char * debuginfo )
  148. {
  149. #ifdef BOTDEBUG
  150.     if ( !DebugActive )
  151.         return;
  152.     DebugStr( debuginfo );
  153. #endif
  154.     sprintf_s( TechiesCrash, sizeof( TechiesCrash ), "%s", debuginfo );
  155. }
  156.  
  157.  
  158. #ifdef BOTDEBUG
  159.  
  160. int currentid = 0;
  161. char dedata[ 50 ][ 256 ];
  162. void * xxaddr;
  163.  
  164.  
  165. void DebugStr( const char* szDllPath )
  166. {
  167.     if ( !DebugActive )
  168.         return;
  169.  
  170.  
  171.     if ( currentid < 50 )
  172.     {
  173.         CopyMemory( dedata[ currentid ], szDllPath, strlen( szDllPath ) + 1 );
  174.         currentid++;
  175.     }
  176.     else
  177.     {
  178.         for ( int i = 0; i < 49; i++ )
  179.         {
  180.             CopyMemory( dedata[ i ], dedata[ i + 1 ], 256 );
  181.         }
  182.         CopyMemory( dedata[ 49 ], szDllPath, strlen( szDllPath ) + 1 );
  183.     }
  184. }
  185.  
  186.  
  187.  
  188. char * laststringinfo = new char[ 256 ];
  189.  
  190.  
  191. void PrintDebugInfo2( const char * debuginfo, int data )
  192. {
  193.     if ( !DebugActive )
  194.         return;
  195.     sprintf_s( laststringinfo, 256, "%s:%X", debuginfo, data );
  196.     DebugStr( laststringinfo );
  197. }
  198.  
  199. void InitDebug( )
  200. {
  201.     xxaddr = &dedata;
  202.     FILE * f = NULL;
  203.     if ( fopen_s( &f, "debug.bin", "wb" ) == NOERROR )
  204.     {
  205.         fwrite( &xxaddr, 4, 1, f );
  206.         fclose( f );
  207.     }
  208. }
  209.  
  210.  
  211. #endif
  212.  
  213. #define IsKeyPressed(CODE) (GetAsyncKeyState(CODE) & 0x8000) > 0
  214.  
  215.  
  216. BOOL IsGame( ) // my offset + public
  217. {
  218.     if ( GameDll <= 0 )
  219.         return FALSE;
  220.  
  221.     return *( int* ) ( GameDll + 0xAB7E98 ) > 0 && ( *( int* ) ( GameDll + 0xACF678 ) > 0 || *( int* ) ( GameDll + 0xAB62A4 ) > 0 )/* && !IsLagScreen( )*/;
  222. }
  223.  
  224. LPVOID TlsValue;
  225. DWORD TlsIndex;
  226. DWORD _W3XTlsIndex;
  227.  
  228. DWORD GetIndex( )
  229. {
  230.     return *( DWORD* ) ( _W3XTlsIndex );
  231. }
  232.  
  233. DWORD GetW3TlsForIndex( DWORD index )
  234. {
  235.     DWORD pid = GetCurrentProcessId( );
  236.     THREADENTRY32 te32;
  237.     HANDLE hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, pid );
  238.     te32.dwSize = sizeof( THREADENTRY32 );
  239.  
  240.     if ( Thread32First( hSnap, &te32 ) )
  241.     {
  242.         do
  243.         {
  244.             if ( te32.th32OwnerProcessID == pid )
  245.             {
  246.                 HANDLE hThread = OpenThread( THREAD_ALL_ACCESS, FALSE, te32.th32ThreadID );
  247.                 CONTEXT ctx = { CONTEXT_SEGMENTS };
  248.                 LDT_ENTRY ldt;
  249.                 GetThreadContext( hThread, &ctx );
  250.                 GetThreadSelectorEntry( hThread, ctx.SegFs, &ldt );
  251.                 DWORD dwThreadBase = ldt.BaseLow | ( ldt.HighWord.Bytes.BaseMid <<
  252.                                                      16 ) | ( ldt.HighWord.Bytes.BaseHi << 24 );
  253.                 CloseHandle( hThread );
  254.                 if ( dwThreadBase == NULL )
  255.                     continue;
  256.                 DWORD* dwTLS = *( DWORD** ) ( dwThreadBase + 0xE10 + 4 * index );
  257.                 if ( dwTLS == NULL )
  258.                     continue;
  259.                 return ( DWORD ) dwTLS;
  260.             }
  261.         }
  262.         while ( Thread32Next( hSnap, &te32 ) );
  263.     }
  264.  
  265.     return NULL;
  266. }
  267.  
  268. void SetTlsForMe( )
  269. {
  270.     TlsIndex = GetIndex( );
  271.     LPVOID tls = ( LPVOID ) GetW3TlsForIndex( TlsIndex );
  272.     TlsValue = tls;
  273. }
  274.  
  275.  
  276. void TextPrint( char *szText, float fDuration )
  277. {
  278.     if ( !IsGame( ) )
  279.         return;
  280.     if ( StealthMode )
  281.         return;
  282. #ifdef BOTDEBUG
  283.     PrintDebugInfo( "PrintText" );
  284. #endif
  285.     UINT32 dwDuration = *( ( UINT32 * ) &fDuration );
  286.     int GAME_GlobalClass = GameDll + 0xAB4F80;
  287.     int GAME_PrintToScreen = GameDll + 0x2F8E40;
  288.     __asm
  289.     {
  290.         PUSH    0xFFFFFFFF;
  291.         PUSH    dwDuration;
  292.         PUSH    szText;
  293.         PUSH    0x0;
  294.         PUSH    0x0;
  295.         MOV     ECX, [ GAME_GlobalClass ];
  296.         MOV     ECX, [ ECX ];
  297.         CALL    GAME_PrintToScreen;
  298.     }
  299. }
  300.  
  301. void TextPrint2( char* text, float StayUpTime )
  302. {
  303.     int GAME_GlobalClass = GameDll + 0xAB4F80;
  304.     int GAME_PrintToScreen = GameDll + 0x2F3CF0;
  305.  
  306.     __asm
  307.     {
  308.         PUSH 0xFFFED312;
  309.         PUSH StayUpTime;
  310.         PUSH text;
  311.         MOV     ECX, [ GAME_GlobalClass ];
  312.         MOV     ECX, [ ECX ];
  313.         MOV EAX, GAME_PrintToScreen;
  314.         CALL EAX;
  315.     }
  316. }
  317.  
  318. time_t lastaccess = 0;
  319.  
  320. void TextPrintUnspammed( char *szText )
  321. {
  322.     if ( !IsGame( ) )
  323.         return;
  324.     if ( StealthMode )
  325.         return;
  326.     time_t nextaccess = time( 0 );
  327.  
  328.     if ( !ExpertModeEnabled )
  329.         nextaccess += 1;
  330.  
  331.     if ( nextaccess > lastaccess + 1 )
  332.     {
  333.         float fDuration = 1.3f;
  334.         if ( !ExpertModeEnabled )
  335.             fDuration += 0.7f;
  336.         lastaccess = nextaccess;
  337. #ifdef BOTDEBUG
  338.         PrintDebugInfo( "PrintText" );
  339. #endif
  340.         UINT32 dwDuration = *( ( UINT32 * ) &fDuration );
  341.         int GAME_GlobalClass = GameDll + 0xAB4F80;
  342.         int GAME_PrintToScreen = GameDll + 0x2F8E40;
  343.         __asm
  344.         {
  345.             PUSH    0xFFFFFFFF
  346.                 PUSH    dwDuration
  347.                 PUSH    szText
  348.                 PUSH    0x0
  349.                 PUSH    0x0
  350.                 MOV     ECX, [ GAME_GlobalClass ]
  351.                 MOV     ECX, [ ECX ]
  352.                 CALL    GAME_PrintToScreen
  353.         }
  354.     }
  355. }
  356.  
  357. // Pure code: Get unit count and units array
  358. int * GetUnitCountAndUnitArray( int ** unitarray )
  359. {
  360. #ifdef BOTDEBUG
  361.     PrintDebugInfo( "GetUnitArray" );
  362. #endif
  363.     int GlobalClassOffset = *( int* ) ( GameDll + 0xAB4F80 );
  364.     if ( GlobalClassOffset )
  365.     {
  366.  
  367.         int UnitsOffset1 = *( int* ) ( GlobalClassOffset + 0x3BC );
  368.         int  *  UnitsCount = ( int * ) ( UnitsOffset1 + 0x604 );
  369.         if ( *( int* ) UnitsCount > 0 && UnitsOffset1 > 0 )
  370.         {
  371.             if ( IsOkayPtr( ( void* ) ( UnitsOffset1 + 0x608 ) ) )
  372.             {
  373. #ifdef BOTDEBUG
  374.                 PrintDebugInfo( "OkayUnitArray" );
  375. #endif
  376.                 *unitarray = ( int * ) *( int* ) ( UnitsOffset1 + 0x608 );
  377.                 return UnitsCount;
  378.             }
  379.             else
  380.             {
  381.                 return 0;
  382.             }
  383.         }
  384.     }
  385.     return 0;
  386. }
  387.  
  388.  
  389.  
  390. int JMPADDR;
  391.  
  392. __declspec( naked ) void __fastcall sub_6F424B80( void *a1, int unused, int a2, int a3, int a4, int a5, int a6 )
  393. {
  394.     JMPADDR = GameDll + 0x424B80;
  395.     __asm
  396.     {
  397.         JMP JMPADDR;
  398.     }
  399. }
  400.  
  401. __declspec( naked ) signed int __fastcall sub_6F424CE0( int a1, int unused, int a2, int a3, int a4, int a5 )
  402. {
  403.     JMPADDR = GameDll + 0x424CE0;
  404.     __asm
  405.     {
  406.         JMP JMPADDR;
  407.     }
  408. }
  409.  
  410. __declspec( naked ) int __fastcall sub_6F425490( int a1, int unused, int a2 )
  411. {
  412.     JMPADDR = GameDll + 0x425490;
  413.     __asm
  414.     {
  415.         JMP JMPADDR;
  416.     }
  417. }
  418.  
  419. __declspec( naked ) int __fastcall sub_6F332700( void *a1, int unused )
  420. {
  421.     JMPADDR = GameDll + 0x332700;
  422.     __asm
  423.     {
  424.         JMP JMPADDR;
  425.     }
  426. }
  427.  
  428. __declspec( naked ) int __fastcall sub_6F03FA30( UINT a1, UINT a2 )
  429. {
  430.     JMPADDR = GameDll + 0x3FA30;
  431.     __asm
  432.     {
  433.         JMP JMPADDR;
  434.     }
  435. }
  436.  
  437. typedef int( __fastcall * sub_6F26EC20 )( int unitaddr, int unused, unsigned int SLOTID );
  438. sub_6F26EC20 GetItemInSlot;
  439.  
  440. //
  441. typedef void *( __fastcall * sub_6F0787D0 )( int unitaddr, int unused, int classid, int a3, int a4, int a5, int a6 );
  442. sub_6F0787D0 GetAbility;
  443.  
  444. unsigned int cooldownflag = 0x200;
  445. unsigned int xavaiableflag = 0x8000;
  446.  
  447.  
  448.  
  449. /*
  450.  
  451. sub_6F339DD0my: (a1):d0028 (a2):c0114e4 (a3):-411.262 (a4):-347.085 (a5):bfdc104 (a6):4 (a7):4
  452. //ETH - I0LT
  453.  
  454. sub_6F339DD0my: (a1):d0029 (a2):c010a3c (a3):-443.463 (a4):-383.475 (a5):bfdc104 (a6):100004 (a7):4
  455. //ORCH - I012
  456.  
  457. sub_6F339CC0my: (a1):d002a (a2):c010f14 (a3):-499.668 (a4):-494.432 (a5):1100002 (a6):4
  458. //HUETA - I0O3
  459. */
  460.  
  461.  
  462. BOOL IsAbilityCooldown( int unitaddr, int id )
  463. {
  464.     void * abiladdr = GetAbility( unitaddr, 0, id, 0, 1, 1, 1 );
  465.     if ( abiladdr == nullptr || abiladdr <= 0 || !IsOkayPtr( ( void * ) abiladdr ) )
  466.         return -1;
  467.  
  468.     int avilityflag = ( int ) abiladdr + 32;
  469.     if ( IsOkayPtr( ( void* ) avilityflag ) )
  470.     {
  471.         unsigned int  state = *( unsigned int  * ) ( avilityflag );
  472.         return state & cooldownflag;
  473.     }
  474.     else
  475.         return -1;
  476.  
  477. }
  478.  
  479. BOOL IsAbilityHidden( int unitaddr, int id )
  480. {
  481.     void * abiladdr = GetAbility( unitaddr, 0, id, 0, 1, 1, 1 );
  482.     if ( abiladdr == nullptr || abiladdr <= 0 || !IsOkayPtr( ( void * ) abiladdr ) )
  483.         return -1;
  484.  
  485.     int avilityflag = ( int ) abiladdr + 32;
  486.     if ( IsOkayPtr( ( void* ) avilityflag ) )
  487.     {
  488.         unsigned int  state = *( unsigned int  * ) ( avilityflag );
  489.         return state & xavaiableflag;
  490.     }
  491.     else
  492.         return -1;
  493. }
  494.  
  495. void PrintCooldownFlag( int unitaddr, int id )
  496. {
  497.     void * abiladdr = GetAbility( unitaddr, 0, id, 0, 1, 1, 1 );
  498.     if ( abiladdr == nullptr || abiladdr <= 0 || !IsOkayPtr( ( void * ) abiladdr ) )
  499.         return;
  500.  
  501.     int abilleveladdr = ( int ) abiladdr + 4;
  502.     if ( IsOkayPtr( ( void* ) abilleveladdr ) )
  503.     {
  504.         int xid = id;
  505.         char cc1 = *( char* ) ( ( int ) ( &xid ) );
  506.         char cc2 = *( char* ) ( ( int ) ( &xid ) + 1 );
  507.         char cc3 = *( char* ) ( ( int ) ( &xid ) + 2 );
  508.         char cc4 = *( char* ) ( ( int ) ( &xid ) + 3 );
  509.         char cc5[ ] = { cc4, cc3, cc2, cc1, '\0' };
  510.         unsigned int  state = *( unsigned int  * ) ( abilleveladdr );
  511.         char * printdate = new char[ 100 ];
  512.         memset( printdate, 0, 100 );
  513.         sprintf_s( printdate, 100, "%s->%X->%X", cc5, state, abiladdr );
  514.         TextPrint( printdate, 2.0f );
  515.         Sleep( 500 );
  516.         delete[ ]printdate;
  517.     }
  518. }
  519.  
  520.  
  521. void * GetGlobalPlayerData( )
  522. {
  523.     if ( *( int * ) ( 0xAB65F4 + GameDll ) > 0 )
  524.     {
  525.         if ( IsOkayPtr( ( void* ) ( 0xAB65F4 + GameDll ) ) )
  526.             return ( void * ) *( int* ) ( 0xAB65F4 + GameDll );
  527.         else
  528.             return nullptr;
  529.     }
  530.     else
  531.         return nullptr;
  532. }
  533.  
  534. int GetPlayerByNumber( int number )
  535. {
  536. #ifdef BOTDEBUG
  537.     PrintDebugInfo( "GetPlayerByNumber" );
  538. #endif
  539.     void * arg1 = GetGlobalPlayerData( );
  540.     int result = -1;
  541.     if ( number >= 0 && number <= 12 && arg1 != nullptr && arg1 )
  542.     {
  543.         result = ( int ) arg1 + ( number * 4 ) + 0x58;
  544.  
  545.         if ( IsOkayPtr( ( void* ) result ) )
  546.         {
  547.             result = *( int* ) result;
  548.         }
  549.         /*__asm
  550.         {
  551.         mov ecx , arg1;
  552.         mov eax , number;
  553.         mov eax , [ ecx + eax * 4 + 0x58 ];
  554.         mov result , eax;
  555.         }*/
  556.     }
  557.     return result;
  558. }
  559.  
  560. int GetLocalPlayerNumber( )
  561. {
  562. #ifdef BOTDEBUG
  563.     PrintDebugInfo( "LocalPlayerNumber" );
  564. #endif
  565.     void * gldata = GetGlobalPlayerData( );
  566.     if ( gldata != nullptr && gldata )
  567.     {
  568.         int playerslotaddr = ( int ) gldata + 0x28;
  569.         if ( IsOkayPtr( ( void* ) playerslotaddr ) )
  570.             return ( int ) *( short * ) ( playerslotaddr );
  571.         else
  572.             return -2;
  573.     }
  574.     else
  575.         return -2;
  576. }
  577.  
  578.  
  579. int GetLocalPlayer( )
  580. {
  581.     return GetPlayerByNumber( GetLocalPlayerNumber( ) );
  582. }
  583.  
  584. BOOL DisableWindowActiveCheck = TRUE;
  585.  
  586. BOOL IsWindowActive( BOOL SkipNoCheck = FALSE )
  587. {
  588.     if ( DisableWindowActiveCheck && !SkipNoCheck )
  589.         return DisableWindowActiveCheck;
  590.  
  591.     return *( BOOL* ) ( GameDll + 0xA9E7A4 );
  592. }
  593.  
  594. UINT GetUnitOwnerSlot( int unitaddr )
  595. {
  596.     if ( IsOkayPtr( ( void* ) ( unitaddr + 88 ) ) )
  597.         return *( int* ) ( unitaddr + 88 );
  598.     return -1;
  599. }
  600.  
  601. BOOL IsPlayerEnemy( int unitaddr )
  602. {
  603.     int teamplayer1 = GetLocalPlayerNumber( ) > 5 ? 1 : 2;
  604.     int teamplayer2 = GetUnitOwnerSlot( unitaddr ) > 5 ? 1 : 2;
  605. #ifdef BOTDEBUG
  606.     PrintDebugInfo( "EndGetPlayerEnemy" );
  607. #endif
  608.     return teamplayer1 != teamplayer2;
  609. }
  610.  
  611. BOOL IsUnitDead( int unitaddr )
  612. {
  613.     unsigned int isdolbany = *( unsigned int* ) ( unitaddr + 0x5C );
  614.     BOOL UnitNotDead = ( ( isdolbany & 0x100u ) == 0 );
  615.     return UnitNotDead == FALSE;
  616. }
  617.  
  618. void GetMousePosition( float * x, float * y, float * z )
  619. {
  620. #ifdef BOTDEBUG
  621.     PrintDebugInfo( "Mouse info" );
  622. #endif
  623.     int globalclass = *( int* ) _W3XGlobalClass;
  624.  
  625.     int offset1 = globalclass + 0x3BC;
  626.  
  627.     if ( globalclass > 0 )
  628.     {
  629.  
  630.  
  631.         if ( IsOkayPtr( ( void* ) offset1 ) )
  632.         {
  633.             offset1 = *( int * ) offset1;
  634.             if ( IsOkayPtr( ( void* ) offset1 ) )
  635.             {
  636.                 *x = *( float* ) ( offset1 + 0x310 );
  637.                 *y = *( float* ) ( offset1 + 0x310 + 4 );
  638.                 *z = *( float* ) ( offset1 + 0x310 + 4 + 4 );
  639.             }
  640.             else
  641.             {
  642.                 *x = 0.0f;
  643.                 *y = 0.0f;
  644.                 *z = 0.0f;
  645.             }
  646.         }
  647.         else
  648.         {
  649.             *x = 0.0f;
  650.             *y = 0.0f;
  651.             *z = 0.0f;
  652.         }
  653.  
  654.     }
  655. }
  656.  
  657. int GetSelectedOwnedUnit( )
  658. {
  659.  
  660.     int plr = GetLocalPlayer( );
  661.     if ( plr != -1 && plr )
  662.     {
  663.  
  664.         int unitaddr = 0; // = *(int*)((*(int*)plr+0x34)+0x1e0);
  665.  
  666.         __asm
  667.         {
  668.             MOV EAX, plr;
  669.             MOV ECX, DWORD PTR DS : [ EAX + 0x34 ];
  670.             MOV EAX, DWORD PTR DS : [ ECX + 0x1E0 ];
  671.             MOV unitaddr, EAX;
  672.         }
  673.  
  674.  
  675.         if ( unitaddr > 0 )
  676.         {
  677.             if ( GetUnitOwnerSlot( unitaddr ) == GetLocalPlayerNumber( ) )
  678.             {
  679. #ifdef BOTDEBUG
  680.                 PrintDebugInfo( "SelectOwningUnit" );
  681. #endif
  682.                 return unitaddr;
  683.             }
  684.         }
  685. #ifdef BOTDEBUG
  686.         PrintDebugInfo( "No owned unit" );
  687. #endif
  688.     }
  689.     return NULL;
  690. }
  691.  
  692.  
  693. /*
  694. BOOL IsButtonCooldown( DWORD buttonid )
  695. {
  696. if ( v22 )
  697. v11 = sub_6F420B40( v6 , a3 , v17 , a5 );
  698. else
  699. v11 = sub_6F420A80( ( void * ) v6 , a3 , v17 , a5 );
  700.  
  701.  
  702. }
  703. */
  704.  
  705. #define BTN_TECHIES_SUICIDE 0xD0048
  706. #define BTN_TINI_TOSS 0xD0278
  707. #define BTN_TRAXES_FORCE 0xD02BD
  708. #define BTN_VENG_SWAP 0xD026B
  709.  
  710. BOOL IsBtnCooldown1( int buttonid )
  711. {
  712.  
  713. }
  714.  
  715.  
  716. BOOL IsBtnCooldown2( int buttonid )
  717. {
  718.  
  719. }
  720.  
  721.  
  722.  
  723.  
  724. /*
  725. BOOL IsSuicideCooldown( int btnid )
  726. {
  727. return GetBtnCooldown( BTN_TECHIES_SUICIDE , 1 );
  728. }
  729. */
  730.  
  731.  
  732. int GetUnitItemCODE( int unit_or_item_addr )
  733. {
  734. #ifdef BOTDEBUG
  735.     PrintDebugInfo( "GetUnitItemCODE" );
  736. #endif
  737.     return *( int* ) ( unit_or_item_addr + 0x30 );
  738. }
  739.  
  740. typedef int( __fastcall * sub_6F32C880 )( int unit_item_code, int unused );
  741. sub_6F32C880 GetTypeInfo = NULL;
  742.  
  743.  
  744. char * GetUnitName( int unitaddr )
  745. {
  746.     int unitcode = GetUnitItemCODE( unitaddr );
  747.     if ( unitcode > 0 )
  748.     {
  749.  
  750.         int v3 = GetTypeInfo( unitcode, 0 );
  751.         int v4, v5;
  752.         if ( v3 && ( v4 = *( int * ) ( v3 + 40 ) ) != 0 )
  753.         {
  754.             v5 = v4 - 1;
  755.             if ( v5 >= ( unsigned int ) 0 )
  756.                 v5 = 0;
  757.             return ( char * ) *( int * ) ( *( int * ) ( v3 + 44 ) + 4 * v5 );
  758.         }
  759.         else
  760.         {
  761.             return "Default string";
  762.         }
  763.     }
  764.     return "Default String";
  765. }
  766.  
  767. void PrintClassAddress( int unitaddr )
  768. {
  769.     int unitcode = GetUnitItemCODE( unitaddr );
  770.     if ( unitcode > 0 )
  771.     {
  772.         int v3 = GetTypeInfo( unitcode, 0 );
  773.         char * printdada = new char[ 200 ];
  774.         sprintf_s( printdada, 200, "ClassAddr:%X", v3 );
  775.         TextPrint( printdada, 15.0f );
  776.  
  777.     }
  778.  
  779. }
  780.  
  781.  
  782. void SetUnitColor( int unitaddr, UINT color )
  783. {
  784.     int unitdata = *( int* ) ( unitaddr + 0x28 );
  785.     if ( unitdata > 0 )
  786.     {
  787.         *( UINT* ) ( unitdata + 0x328 ) = color;
  788.         *( UINT* ) ( unitdata + 0x320 ) = 0;
  789.         *( UINT* ) ( unitdata + 0x316 ) = 0;
  790.         if ( !( *( UINT* ) ( unitdata + 0x312 ) & 0x800 ) )
  791.         {
  792.             *( UINT* ) ( unitdata + 0x312 ) = *( UINT* ) ( unitdata + 0x316 ) | 0x800;
  793.         }
  794.  
  795.     }
  796. }
  797.  
  798. BOOL IsClassEqual( int unit_or_item_addr, char * classid )
  799. {
  800. #ifdef BOTDEBUG
  801.     PrintDebugInfo( "UnitCLass" );
  802. #endif
  803.     char unitclass[ 5 ];
  804.     memset( unitclass, 0, 5 );
  805.  
  806.     if ( IsOkayPtr( ( void* ) ( unit_or_item_addr + 0x30 ) ) )
  807.     {
  808.         *( BYTE* ) &unitclass[ 0 ] = *( BYTE* ) ( unit_or_item_addr + 0x30 + 3 );
  809.         *( BYTE* ) &unitclass[ 1 ] = *( BYTE* ) ( unit_or_item_addr + 0x30 + 2 );
  810.         *( BYTE* ) &unitclass[ 2 ] = *( BYTE* ) ( unit_or_item_addr + 0x30 + 1 );
  811.         *( BYTE* ) &unitclass[ 3 ] = *( BYTE* ) ( unit_or_item_addr + 0x30 + 0 );
  812.         if ( strlen( classid ) == 4 )
  813.         {
  814.             if ( unitclass[ 0 ] == classid[ 0 ] && unitclass[ 1 ] == classid[ 1 ] &&
  815.                  unitclass[ 2 ] == classid[ 2 ] && unitclass[ 3 ] == classid[ 3 ] )
  816.                  return TRUE;
  817.         }
  818.     }
  819.  
  820.     return FALSE;
  821. }
  822.  
  823. struct UnitLocation
  824. {
  825.     float X;
  826.     float Y;
  827.     float Z;
  828. };
  829.  
  830. struct Location
  831. {
  832.     float X;
  833.     float Y;
  834. };
  835.  
  836.  
  837. #define ADDR(X,REG)\
  838.     __asm MOV REG, DWORD PTR DS : [ X ] \
  839.     __asm MOV REG, DWORD PTR DS : [ REG ]
  840.  
  841. void SendMoveAttackCommand( int cmdId, float X, float Y )
  842. {
  843.     int _MoveAttackCmd = GameDll + 0x339DD0;
  844.  
  845.     if ( *( int* ) _W3XGlobalClass > 0 )
  846.     {
  847.         __asm
  848.         {
  849.             ADDR( _W3XGlobalClass, ECX );
  850.             MOV ECX, DWORD PTR DS : [ ECX + 0x1B4 ];
  851.             PUSH 0;
  852.             PUSH 6;
  853.             PUSH 0;
  854.             PUSH Y;
  855.             PUSH X;
  856.             PUSH 0;
  857.             PUSH cmdId;
  858.  
  859.             CALL _MoveAttackCmd;
  860.         }
  861.     }
  862. }
  863.  
  864.  
  865. int GetCMDbyItemSlot( int slot ) // ot 1 do 6
  866. {
  867.  
  868.     return ( 0xd0028 + slot );
  869. }
  870.  
  871.  
  872.  
  873. BOOL IsItemCooldown( int itemaddr )
  874. {
  875. #ifdef BOTDEBUG
  876.     PrintDebugInfo( "CheckItemCooldownv1" );
  877. #endif
  878.     if ( itemaddr == NULL )
  879.         return TRUE;
  880.  
  881.     return !( ( *( UINT* ) ( itemaddr + 32 ) ) & 0x400u );
  882. }
  883.  
  884. int commandjumpaddr;
  885. void  sub_6F339DD0my( int a1, int a2, float a3, float a4, int a5, int a6, int a7 )
  886. {
  887.     commandjumpaddr = GameDll + 0x339DD0;
  888.     if ( *( int* ) _W3XGlobalClass > 0 )
  889.     {
  890.         __asm
  891.         {
  892.  
  893.             PUSH a7;
  894.             PUSH a6;
  895.             PUSH a5;
  896.             PUSH a4;
  897.             ADDR( _W3XGlobalClass, ECX );
  898.             MOV ECX, DWORD PTR DS : [ ECX + 0x1B4 ];
  899.             PUSH a3;
  900.             PUSH a2;
  901.             PUSH a1;
  902.             CALL commandjumpaddr;
  903.         }
  904.     }
  905. }
  906.  
  907.  
  908.  
  909. void  CommandItemTarget( int cmd, int itemaddr, float targetx, float targety, int targetunitaddr, BOOL queue = FALSE )
  910. {
  911. #ifdef BOTDEBUG
  912.     PrintDebugInfo( "UseIt" );
  913. #endif
  914.     sub_6F339DD0my( cmd, itemaddr, targetx, targety, targetunitaddr, 4, queue ? 5 : 4 );
  915. }
  916.  
  917. int CmdWOTaddr;
  918. void  sub_6F339C60my( int a1, int a2, unsigned int a3, unsigned int a4 )
  919. {
  920.     CmdWOTaddr = GameDll + 0x339C60;
  921.     if ( *( int* ) _W3XGlobalClass > 0 )
  922.     {
  923.         __asm
  924.         {
  925.  
  926.             PUSH a4;
  927.             PUSH a3;
  928.             ADDR( _W3XGlobalClass, ECX );
  929.             MOV ECX, DWORD PTR DS : [ ECX + 0x1B4 ];
  930.             PUSH a2;
  931.             PUSH a1;
  932.  
  933.             CALL CmdWOTaddr;
  934.         }
  935.     }
  936. }
  937.  
  938.  
  939. int CmdPointAddr;
  940. void  sub_6F339CC0my( int a1, int a2, float a3, float a4, int a5, int a6 )
  941. {
  942.     CmdPointAddr = GameDll + 0x339CC0;
  943.     if ( *( int* ) _W3XGlobalClass > 0 )
  944.     {
  945.         __asm
  946.         {
  947.  
  948.             PUSH a6;
  949.             PUSH a5;
  950.             PUSH a4;
  951.             ADDR( _W3XGlobalClass, ECX );
  952.             MOV ECX, DWORD PTR DS : [ ECX + 0x1B4 ];
  953.             PUSH a3;
  954.             PUSH a2;
  955.             PUSH a1;
  956.  
  957.             CALL CmdPointAddr;
  958.         }
  959.     }
  960. }
  961.  
  962. void  ItemOrSkillPoint( int cmd, int itemorskilladdr, float x, float y, int a5, BOOL addque = FALSE )
  963. {
  964. #ifdef BOTDEBUG
  965.     PrintDebugInfo( "ItemSkillPOint" );
  966. #endif
  967.     sub_6F339CC0my( cmd, itemorskilladdr, x, y, a5, addque ? 5 : 4 );
  968. }
  969.  
  970. void UseDetonator( )
  971. {
  972. #ifdef BOTDEBUG
  973.     PrintDebugInfo( "Use detonate" );
  974. #endif
  975.     sub_6F339C60my( 0xd024c, 0, 1, 4 );
  976. }
  977.  
  978.  
  979. typedef void( __cdecl *mPingMinimap )( float *x, float *y, float *duration );
  980. mPingMinimap PingMinimap;
  981.  
  982. Location GetNextPoint( float x, float y, float distance, float angle )
  983. {
  984.     Location returnlocation = Location( );
  985.     returnlocation.X = x + distance * cos( angle );
  986.     returnlocation.Y = y + distance * sin( angle );
  987.     return returnlocation;
  988. }
  989.  
  990.  
  991.  
  992. void GetUnitLocation( int unitaddr, float * x, float * y )
  993. {
  994. #ifdef BOTDEBUG
  995.     PrintDebugInfo( "Unit 2d" );
  996. #endif
  997.     *x = *( float* ) ( unitaddr + 0x284 );
  998.     *y = *( float* ) ( unitaddr + 0x288 );
  999. }
  1000.  
  1001. void GetUnitLocation3D( int unitaddr, float * x, float * y, float * z )
  1002. {
  1003. #ifdef BOTDEBUG
  1004.     PrintDebugInfo( "Unit 3d" );
  1005. #endif
  1006.     *x = *( float* ) ( unitaddr + 0x284 );
  1007.     *y = *( float* ) ( unitaddr + 0x288 );
  1008.     *z = *( float* ) ( unitaddr + 0x28C );
  1009. }
  1010.  
  1011. float GetUnitFloatStat( int unitaddr, DWORD statNum )
  1012. {
  1013. #ifdef BOTDEBUG
  1014.     PrintDebugInfo( "UnitFloatState" );
  1015. #endif
  1016.     int _GetFloatStat = GameDll + 0x27AE90;
  1017.     float result = 0;
  1018.     __asm
  1019.     {
  1020.         PUSH statNum;
  1021.         LEA EAX, result
  1022.             PUSH EAX
  1023.             MOV ECX, unitaddr
  1024.             CALL _GetFloatStat
  1025.     }
  1026.     return result;
  1027. }
  1028.  
  1029.  
  1030. float GetUnitHP( int unitaddr )
  1031. {
  1032. #ifdef BOTDEBUG
  1033.     PrintDebugInfo( "Unit hp" );
  1034. #endif
  1035.     return GetUnitFloatStat( unitaddr, 0 );
  1036. }
  1037.  
  1038.  
  1039. float GetUnitMaxHP( int unitaddr )
  1040. {
  1041.     return GetUnitFloatStat( unitaddr, 1 );
  1042. }
  1043.  
  1044. int GetUnitHPPercent( int unitaddr )
  1045. {
  1046.     return ( int ) ( (GetUnitHP( unitaddr ) / GetUnitMaxHP( unitaddr )) * 100.f);
  1047. }
  1048.  
  1049.  
  1050. BOOL IsHero( int unitaddr )
  1051. {
  1052.     if ( IsOkayPtr( ( void* ) ( unitaddr + 48 ) ) )
  1053.     {
  1054.         unsigned int ishero = *( unsigned int* ) ( unitaddr + 48 );
  1055.         ishero = ishero >> 24;
  1056.         ishero = ishero - 64;
  1057.         return ishero < 0x19;
  1058.     }
  1059.     return FALSE;
  1060. }
  1061.  
  1062. float GetUnitTimer( int unitaddr )
  1063. {
  1064.     int unitdataddr = *( int* ) ( unitaddr + 0x28 );
  1065.     if ( unitdataddr <= 0 )
  1066.         return 0.0f;
  1067. #ifdef BOTDEBUG
  1068.     PrintDebugInfo( "CheckBadUnit - ENDCHExCK5" );
  1069. #endif
  1070.     if ( IsOkayPtr( ( void* ) ( unitdataddr + 0xA0 ), 4 ) )
  1071.         return *( float* ) ( unitdataddr + 0xA0 );
  1072.     return 0.0f;
  1073. }
  1074.  
  1075.  
  1076. BOOL IsNotBadUnit( int unitaddr, BOOL onlymemcheck = FALSE )
  1077. {
  1078.  
  1079.     if ( unitaddr > 0 && IsOkayPtr( ( void* ) unitaddr, 0x290 ) )
  1080.     {
  1081.         int xaddr = GameDll + 0x931934;
  1082.         int xaddraddr = ( int ) &xaddr;
  1083.  
  1084.  
  1085.  
  1086.         if ( *( BYTE* ) xaddraddr != *( BYTE* ) unitaddr )
  1087.             return FALSE;
  1088.         else if ( *( BYTE* ) ( xaddraddr + 1 ) != *( BYTE* ) ( unitaddr + 1 ) )
  1089.             return FALSE;
  1090.         else if ( *( BYTE* ) ( xaddraddr + 2 ) != *( BYTE* ) ( unitaddr + 2 ) )
  1091.             return FALSE;
  1092.         else if ( *( BYTE* ) ( xaddraddr + 3 ) != *( BYTE* ) ( unitaddr + 3 ) )
  1093.             return FALSE;
  1094.  
  1095.  
  1096.         if ( !IsOkayPtr( ( void* ) ( unitaddr + 0x5C ) ) )
  1097.         {
  1098.             return FALSE;
  1099.         }
  1100.  
  1101.         if ( onlymemcheck )
  1102.             return TRUE;
  1103.  
  1104.         unsigned int isdolbany = *( unsigned int* ) ( unitaddr + 0x5C );
  1105.  
  1106.         BOOL returnvalue = isdolbany != 0x1001u && !IsUnitDead( unitaddr ) && ( isdolbany & 0x40000000u ) == 0;
  1107. #ifdef BOTDEBUG
  1108.         PrintDebugInfo( "CheckBadUnit - ENDCHECK" );
  1109. #endif
  1110.  
  1111.  
  1112.         if ( returnvalue )
  1113.         {
  1114.             if ( ( *( BYTE * ) ( unitaddr + 32 ) & 2 ) && ( *( BYTE * ) ( unitaddr + 32 ) & 8 ) == 0)
  1115.             {
  1116.                 float unittimer = GetUnitTimer( unitaddr );
  1117.  
  1118.                 if ( unittimer > 2.0 )
  1119.                 {
  1120.                     latestunitclass = GetUnitItemCODE( unitaddr );
  1121.  
  1122.                     latestvalue1 = *( UINT * ) ( unitaddr + 12 );
  1123.                     latestvalue2 = *( UINT* ) ( unitaddr + 16 );
  1124.                     int testval = *( UINT* ) ( unitaddr + 12 ) & *( UINT* ) ( unitaddr + 16 );
  1125.                     if ( testval != -1 && *( UINT* ) ( unitaddr + 12 ) != -1 && *( UINT* ) ( unitaddr + 16 ) != -1 )
  1126.                     {
  1127.                         int valnew = sub_6F03FA30( *( UINT* ) ( unitaddr + 12 ), *( UINT* ) ( unitaddr + 16 ) );
  1128.                         int val2 = 0;
  1129.                         if ( *( UINT * ) ( valnew + 12 ) == 727803756 )
  1130.                             val2 = valnew;
  1131. #ifdef BOTDEBUG
  1132.                         PrintDebugInfo( "CheckBadUnit - ENDCHECK2" );
  1133. #endif
  1134.                         if ( val2 )
  1135.                         {
  1136.                             if ( !*( int * ) ( val2 + 32 ) )
  1137.                             {
  1138.  
  1139.  
  1140. #ifdef BOTDEBUG
  1141.                                 PrintDebugInfo( "CheckBadUnit - ENDCHECK4" );
  1142. #endif
  1143.                                 return TRUE;
  1144.                             }
  1145.                         }
  1146.                     }
  1147.                 }
  1148.             }
  1149.  
  1150.         }
  1151.     }
  1152. #ifdef BOTDEBUG
  1153.     PrintDebugInfo( "CheckBadUnit - BAD UNIT" );
  1154. #endif
  1155.     return FALSE;
  1156. }
  1157.  
  1158. float Distance( float dX0, float dY0, float dX1, float dY1 )
  1159. {
  1160.     return sqrt( ( dX1 - dX0 )*( dX1 - dX0 ) + ( dY1 - dY0 )*( dY1 - dY0 ) );
  1161. }
  1162.  
  1163.  
  1164. float Distance3D( float x1, float y1, float z1, float x2, float y2, float z2 )
  1165. {
  1166.     if ( Enable3DPoint )
  1167.     {
  1168.         double d[ ] = { abs( ( double ) x1 - ( double ) x2 ), abs( ( double ) y1 - ( double ) y2 ), abs( ( double ) z1 - ( double ) z2 ) };
  1169.         if ( d[ 0 ] < d[ 1 ] ) std::swap( d[ 0 ], d[ 1 ] );
  1170.         if ( d[ 0 ] < d[ 2 ] ) std::swap( d[ 0 ], d[ 2 ] );
  1171.         return ( float ) ( d[ 0 ] * sqrt( 1.0 + d[ 1 ] / d[ 0 ] + d[ 2 ] / d[ 0 ] ) );
  1172.     }
  1173.     else
  1174.     {
  1175.         return Distance( x1, y1, x2, y2 );
  1176.     }
  1177. }
  1178.  
  1179. float DistanceBetweenLocs( Location loc1, Location loc2 )
  1180. {
  1181.     return Distance( loc1.X, loc1.Y, loc2.X, loc2.Y );
  1182. }
  1183.  
  1184. Location GiveNextLocationFromLocAndAngle( Location startloc, float distance, float angle )
  1185. {
  1186.     return GetNextPoint( startloc.X, startloc.Y, distance, angle );
  1187. }
  1188.  
  1189. BOOL TechiesFound = FALSE;
  1190.  
  1191.  
  1192. struct BombStruct
  1193. {
  1194.     int unitaddr;
  1195.     float dmg;
  1196.     float range1;
  1197.     float range2;
  1198.     float x;
  1199.     float y;
  1200.     float z;
  1201.     BOOL remote;
  1202. };
  1203.  
  1204.  
  1205.  
  1206. void __cdecl sub_6F3C7910( int xunitaddr )
  1207. {
  1208.     DWORD _UnitSelect = 0x381710 + GameDll;
  1209.  
  1210.     if ( !IsNotBadUnit( xunitaddr ) )
  1211.     {
  1212.         return;
  1213.     }
  1214.  
  1215.     __asm
  1216.     {
  1217.         MOV EAX, DWORD PTR DS : [ _W3XGlobalClass ];
  1218.         MOV EAX, DWORD PTR DS : [ EAX ];
  1219.         MOV ESI, DWORD PTR DS : [ EAX + 0x24C ];
  1220.         PUSH 0;
  1221.         PUSH 0;
  1222.         PUSH 0;
  1223.         PUSH xunitaddr;
  1224.         MOV ECX, ESI;
  1225.         CALL _UnitSelect;
  1226.     }
  1227. }
  1228.  
  1229.  
  1230.  
  1231.  
  1232. int SelectUnit( int xunitaddr )
  1233. {
  1234.     if ( !IsNotBadUnit( xunitaddr ) )
  1235.     {
  1236.         return -1;
  1237.     }
  1238.  
  1239.     if ( *( BYTE * ) ( xunitaddr + 32 ) & 2 )
  1240.     {
  1241.         void * playerseldata = *( void** ) ( GetLocalPlayer( ) + 0x34 );
  1242.         WORD playerslot = GetLocalPlayerNumber( );
  1243.         sub_6F424B80( playerseldata, 0, xunitaddr, playerslot, 0, 1, 1 );
  1244.         sub_6F425490( ( int ) playerseldata, 0, 0 );
  1245.         return sub_6F332700( 0, 0 );
  1246.     }
  1247.  
  1248.     return -1;
  1249. }
  1250.  
  1251.  
  1252. BOOL __cdecl SelectAllUnits( )
  1253. {
  1254.     int myselectedunits = 0;
  1255. #ifdef BOTDEBUG
  1256.     PrintDebugInfo( "Select units" );
  1257. #endif
  1258.  
  1259.     __asm
  1260.     {
  1261.         MOV EDX, GameDll;
  1262.         ADD EDX, 0x3BBAA0;
  1263.         CALL EDX;
  1264.     }
  1265.  
  1266.     Sleep( 10 );
  1267.     if ( !IsGame( ) )
  1268.     {
  1269.         return 0;
  1270.     }
  1271.  
  1272.     while ( unitstoselect.size( ) > 0 && myselectedunits < 11 && SelectUnit( unitstoselect.back( ) ) != -1 )
  1273.     {
  1274.         myselectedunits++;
  1275.         unitstoselect.pop_back( );
  1276.         Sleep( 5 );
  1277.     }
  1278.  
  1279.     Sleep( 10 );
  1280.  
  1281.     if ( !IsGame( ) )
  1282.     {
  1283.         return 0;
  1284.     }
  1285.     return myselectedunits > 0;
  1286. }
  1287.  
  1288.  
  1289. float GetProtectForUnit( int unitaddr )
  1290. {
  1291.     float Armor = 0.0f;
  1292.  
  1293.     if ( IsOkayPtr( ( void* ) ( unitaddr + 0xE0 ) ) )
  1294.     {
  1295.         Armor = *( float* ) ( unitaddr + 0xE0 );
  1296.     }
  1297.  
  1298.     if ( Armor < 0.0f )
  1299.         Armor = ( float ) ( 1.0 - pow( 0.94, -Armor ) );
  1300.     else
  1301.         Armor = ( float ) ( ( 0.06 * Armor ) / ( 1 + 0.06 * Armor ) );
  1302.     return Armor;
  1303. }
  1304.  
  1305. float GetProtectForProtect( float Armor )
  1306. {
  1307.     if ( Armor < 0.0f )
  1308.         Armor = ( float ) ( 1.0 - pow( 0.94, -Armor ) );
  1309.     else
  1310.         Armor = ( float ) ( ( 0.06 * Armor ) / ( 1 + 0.06 * Armor ) );
  1311.     return Armor;
  1312. }
  1313.  
  1314. int GetUnitAbilityLevel( int unitaddr, int id, BOOL checkavaiable = FALSE, BOOL CheckMemAccess = FALSE )
  1315. {
  1316. #ifdef BOTDEBUG
  1317.     PrintDebugInfo( "GetAbilityLevel" );
  1318. #endif
  1319.  
  1320.     if ( CheckMemAccess )
  1321.     if ( !IsNotBadUnit( unitaddr ) )
  1322.         return 0;
  1323.  
  1324.     void * abiladdr = ( void * ) GetAbility( unitaddr, 0, id, 0, 1, 1, 1 );
  1325.     if ( abiladdr == nullptr || abiladdr <= 0 || !IsOkayPtr( ( void * ) abiladdr ) )
  1326.         return 0;
  1327.  
  1328.     int abilleveladdr = ( int ) abiladdr + 80;
  1329.     int abilavaiable = ( int ) abiladdr + 32;
  1330.     if ( checkavaiable )
  1331.     {
  1332.         if ( IsOkayPtr( ( void* ) abilavaiable ) )
  1333.         {
  1334.             unsigned int avaiableflag = *( unsigned int * ) ( abilavaiable );
  1335.             if ( avaiableflag & xavaiableflag )
  1336.                 return 0;
  1337.             if ( IsOkayPtr( ( void* ) abilleveladdr ) )
  1338.                 return *( int * ) ( abilleveladdr ) +1;
  1339.             else
  1340.                 return 0;
  1341.         }
  1342.         else
  1343.             return 0;
  1344.     }
  1345.     else
  1346.     {
  1347.         if ( IsOkayPtr( ( void* ) abilleveladdr ) )
  1348.             return *( int * ) ( abilleveladdr ) +1;
  1349.         else
  1350.             return 0;
  1351.     }
  1352. }
  1353.  
  1354.  
  1355. std::string bufflist;
  1356.  
  1357.  
  1358. float GetDmgForUnit( int unitaddr, float dmg, int dmgtype = 1/* 1 : magical , 2 : physical*/ )
  1359. {
  1360.     bufflist.clear( );
  1361. #ifdef BOTDEBUG
  1362.     PrintDebugInfo( "CheckUnitDmg" );
  1363. #endif
  1364.  
  1365.     // HEROES:
  1366.     // H00Q - HUSKAR
  1367.     // U00F - PUDGE
  1368.     // Edem - MAGINA
  1369.     // EC77 - VIPER
  1370.     //
  1371.     //
  1372.     // ITEMS:
  1373.     // I04P = -15% magical dmg
  1374.     // I0K6 = -30% magical dmg
  1375.     //
  1376.     // SKILS:
  1377.     // A0QQ - HUSKAR 3 skill
  1378.     // A06D - PUDGE 3 skill
  1379.     // A0KY - MAGINE 3 skill
  1380.     // A0MM - VIPER 3 skill
  1381.     //
  1382.     // BUFFS:
  1383.     // B014
  1384.     // B041
  1385.     // B08J
  1386.     // B0FP
  1387.     // B0FQ
  1388.     // A2T4
  1389.     // BNms - 50%
  1390.  
  1391.     if ( !IsNotBadUnit( unitaddr, TRUE ) )
  1392.     {
  1393.         return 0.0f;
  1394.     }
  1395.  
  1396.     if ( GetUnitAbilityLevel( unitaddr, 'B07D', FALSE, TRUE ) ||
  1397.          GetUnitAbilityLevel( unitaddr, 'B08J', FALSE, TRUE ) ||
  1398.          GetUnitAbilityLevel( unitaddr, 'B05S', FALSE, TRUE ) )
  1399.     {
  1400.         bufflist = std::string( "[100% shield]" );
  1401.         return 0.0f;
  1402.     }
  1403.  
  1404.    
  1405.  
  1406.     if (dmgtype == 1 && ( GetUnitAbilityLevel( unitaddr, 'B014', FALSE, TRUE ) ||
  1407.         GetUnitAbilityLevel( unitaddr, 'B041', FALSE, TRUE ) ||
  1408.         GetUnitAbilityLevel( unitaddr, 'B0FP', FALSE, TRUE ) ||
  1409.         GetUnitAbilityLevel( unitaddr, 'A2T4', FALSE, TRUE ) ||
  1410.         GetUnitAbilityLevel( unitaddr, 'B0FQ', FALSE, TRUE )
  1411.        
  1412.         ) )
  1413.     {
  1414.         bufflist = std::string( "[100% magic shield]" );
  1415.         return 0.0f;
  1416.     }
  1417.  
  1418.     if ( dmgtype == 2 && GetUnitAbilityLevel( unitaddr, 'Aetl', FALSE, TRUE ) )
  1419.     {
  1420.         bufflist = std::string( "[100% phys shield]" );
  1421.         return 0.0f;
  1422.     }
  1423.  
  1424.     float outdmg = 0.0f;
  1425.     outdmg -= 15.0f;
  1426.  
  1427.     if ( dmgtype == 1 )
  1428.         outdmg = dmg * ( ( 100.0f - 26.0f ) / 100.0f );
  1429.     else if ( dmgtype == 2 )
  1430.         outdmg = dmg - ( dmg * GetProtectForUnit( unitaddr ) );
  1431.  
  1432.  
  1433.     // Jugger(Nbbc) if skill A05G not exist - 100% protect
  1434.  
  1435.  
  1436.  
  1437.     //H00J H00I
  1438.  
  1439.  
  1440.  
  1441.     if ( dmgtype == 1 && IsClassEqual( unitaddr, "Nbbc" ) )
  1442.     {
  1443.         if ( IsNotBadUnit( unitaddr, TRUE ) && GetUnitAbilityLevel( unitaddr, 'A05G', TRUE ) == 0 )
  1444.         {
  1445.  
  1446.             bufflist += std::string( "[magic 100%]" );
  1447.  
  1448.             return 0.0f;
  1449.         }
  1450.     }
  1451.  
  1452.     if ( dmgtype == 1 && ( IsClassEqual( unitaddr, "H00I" ) || IsClassEqual( unitaddr, "H00J" ) ) )
  1453.     {
  1454.         bufflist += std::string( "[magic 10%]" );
  1455.         outdmg = outdmg * ( ( 100.0f - 10.0f ) / 100.0f );
  1456.     }
  1457.  
  1458.  
  1459.     int medusashield = GetUnitAbilityLevel( unitaddr, 'BNms' );
  1460.     if ( medusashield > 0 )
  1461.     {
  1462.         bufflist += std::string( "[50% shield]" );
  1463.         outdmg = outdmg * ( ( 100.0f - 50.0f ) / 100.0f );
  1464.     }
  1465.  
  1466.  
  1467.     int captainbuff = GetUnitAbilityLevel( unitaddr, 'B09U' );
  1468.     if ( captainbuff > 0 )
  1469.     {
  1470.         bufflist += std::string( "[50% shield]"  );
  1471.         outdmg = outdmg * ( ( 100.0f - 50.0f ) / 100.0f );
  1472.     }
  1473.  
  1474.  
  1475.     int warcrysven = GetUnitAbilityLevel( unitaddr, 'B0BV' );
  1476.     if ( warcrysven > 0 && dmgtype == 2)
  1477.     {
  1478.         float addprotect = GetProtectForProtect( warcrysven * 4.0f );
  1479.         int addprotectp = (int) (100 * addprotect);
  1480.         std::string( "[phys " ) + std::to_string(addprotectp ) + std::string( "%]" );
  1481.         outdmg = dmg - addprotect;
  1482.     }
  1483.  
  1484.    
  1485.  
  1486.     int huskarlvl = GetUnitAbilityLevel( unitaddr, 'A0QQ' );
  1487.     if ( dmgtype == 1 && huskarlvl > 0 )
  1488.     {
  1489.  
  1490.         float dmgprotectlvl = ( float ) huskarlvl + 3.0f;
  1491.         int hppercent = 100 - GetUnitHPPercent( unitaddr );
  1492.         int parts = hppercent / 7 + 1;
  1493.         dmgprotectlvl = dmgprotectlvl * parts;
  1494.  
  1495.         bufflist += std::string( "[magic " ) + std::to_string( (int)dmgprotectlvl ) + std::string( "%]" );
  1496.  
  1497.         outdmg = outdmg * ( ( 100.0f - dmgprotectlvl ) / 100.0f );
  1498.     }
  1499.  
  1500.     int pudgelvl = GetUnitAbilityLevel( unitaddr, 'A06D' );
  1501.     if ( dmgtype == 1 && pudgelvl > 0 )
  1502.     {
  1503.         // 1 lvl = (1*2)+4 = 6
  1504.         // 2 lvl = (2*2)+4 = 8
  1505.         // 3 lvl = (3*2)+4 = 10
  1506.         // 4 lvl = (4*2)+4 = 12
  1507.         float dmgprotect = ( pudgelvl * 2.0f ) + 4.0f;
  1508.         bufflist += std::string( "[magic " ) + std::to_string( dmgprotect ) + std::string( "%]" );
  1509.  
  1510.         outdmg = outdmg * ( ( 100.0f - dmgprotect ) / 100.0f );
  1511.  
  1512.     }
  1513.  
  1514.  
  1515.     int rubiclvl = GetUnitAbilityLevel( unitaddr, 'B0EO' );
  1516.     if ( dmgtype == 1 && pudgelvl > 0 )
  1517.     {
  1518.         // 1 lvl = (1*2)+4 = 6
  1519.         // 2 lvl = (2*2)+4 = 8
  1520.         // 3 lvl = (3*2)+4 = 10
  1521.         // 4 lvl = (4*2)+4 = 12
  1522.         float dmgprotect = rubiclvl * 5.0f ;
  1523.         bufflist += std::string( "[magic " ) + std::to_string( dmgprotect ) + std::string( "%]" );
  1524.  
  1525.         outdmg = outdmg * ( ( 100.0f - dmgprotect ) / 100.0f );
  1526.  
  1527.     }
  1528.  
  1529.  
  1530.    
  1531.  
  1532.     int spectralvl = GetUnitAbilityLevel( unitaddr, 'A0NA' );
  1533.     if ( spectralvl > 0 )
  1534.     {
  1535.         // 1 lvl = (1*4)+6 = 10
  1536.         // 2 lvl = (2*4)+6 = 12
  1537.         // 3 lvl = (3*4)+6 = 16
  1538.         // 4 lvl = (4*4)+6 = 22
  1539.         float dmgprotect = ( spectralvl * 4.0f ) + 6.0f;
  1540.         bufflist += std::string( "[all " ) + std::to_string( dmgprotect ) + std::string( "%]" );
  1541.  
  1542.         outdmg = outdmg * ( ( 100.0f - dmgprotect ) / 100.0f );
  1543.     }
  1544.  
  1545.  
  1546.     int maginalvl = GetUnitAbilityLevel( unitaddr, 'A0KY' );
  1547.     if ( dmgtype == 1 && maginalvl > 0 )
  1548.     {
  1549.         // 1 lvl = (1*8)+18 = 26
  1550.         // 2 lvl = (2*8)+18 = 34
  1551.         // 3 lvl = (3*8)+18 = 42
  1552.         // 4 lvl = (4*8)+18 = 50
  1553.         float dmgprotect = ( maginalvl * 8.0f ) + 18.0f;
  1554.         bufflist += std::string( "[magic " ) + std::to_string( dmgprotect ) + std::string( "%]" );
  1555.         outdmg = outdmg * ( ( 100.0f - dmgprotect ) / 100.0f );
  1556.     }
  1557.  
  1558.     int viperlvl = GetUnitAbilityLevel( unitaddr, 'A0MM' );
  1559.     if ( dmgtype == 1 && viperlvl > 0 )
  1560.     {
  1561.         // 1 lvl = (1*5)+5 = 10
  1562.         // 2 lvl = (2*5)+5 = 15
  1563.         // 3 lvl = (3*5)+5 = 20
  1564.         // 4 lvl = (4*5)+5 = 25
  1565.         float dmgprotect = ( viperlvl * 5.0f ) + 5.0f;
  1566.         bufflist += std::string( "[magic " ) + std::to_string( dmgprotect ) + std::string( "%]" );
  1567.         outdmg = outdmg * ( ( 100.0f - dmgprotect ) / 100.0f );
  1568.     }
  1569.  
  1570.     if ( dmgtype == 1 )
  1571.     {
  1572.         for ( int i = 0; i < 6; i++ )
  1573.         {
  1574.             int nitem = GetItemInSlot( unitaddr, 0, i );
  1575.             if ( nitem )
  1576.             {
  1577.                 if ( IsClassEqual( nitem, "I04P" ) )
  1578.                 {
  1579.                     bufflist += std::string( "[magic 15%]" );
  1580.                     outdmg = outdmg * ( ( 100.0f - 15.0f ) / 100.0f );
  1581.                 }
  1582.                 else if ( IsClassEqual( nitem, "I0K6" ) )
  1583.                 {
  1584.                     bufflist += std::string( "[magic 30%]" );
  1585.                     outdmg = outdmg * ( ( 100.0f - 30.0f ) / 100.0f );
  1586.                 }
  1587.             }
  1588.         }
  1589.  
  1590.  
  1591.         if ( GetUnitAbilityLevel( unitaddr, 'Aetl', FALSE, TRUE ) )
  1592.         {
  1593.             bufflist = std::string( "[+50% magic]" );
  1594.             outdmg = outdmg * 1.5f;
  1595.         }
  1596.  
  1597.     }
  1598.     else if ( dmgtype == 2 )
  1599.     {
  1600.  
  1601.     }
  1602.  
  1603.     if ( !IsNotBadUnit( unitaddr, TRUE ) )
  1604.         return 0.0f;
  1605.  
  1606.     return outdmg;
  1607. }
  1608.  
  1609. char facici[ 50 ];
  1610.  
  1611. float  GetUnitFacing( int unitaddr )
  1612. {
  1613.     int unitdataoffset = *( int* ) ( unitaddr + 0x28 );
  1614.     if ( unitdataoffset > 0 )
  1615.     {
  1616.         double atan2value = atan2( ( double ) *( float* ) ( unitdataoffset + 0x10c ), ( double ) *( float* ) ( unitdataoffset + 0x108 ) ) ;
  1617.         return  ( float ) atan2value;
  1618.     }
  1619.     return 100.0f;
  1620. }
  1621.  
  1622.  
  1623. BOOL __cdecl IsUnitVisibleToPlayer( int unitaddr, int player )
  1624. {
  1625.     if ( player != -1 && player )
  1626.     {
  1627.         __asm
  1628.         {
  1629.             mov esi, unitaddr;
  1630.             mov eax, player;
  1631.             movzx eax, byte ptr[ eax + 0x30 ];
  1632.             mov edx, [ esi ];
  1633.             push 0x04;
  1634.             push 0x00;
  1635.             push eax;
  1636.             mov eax, [ edx + 0x000000FC ];
  1637.             mov ecx, esi;
  1638.             call eax;
  1639.         }
  1640.     }
  1641.     else
  1642.         return FALSE;
  1643. }
  1644.  
  1645.  
  1646. BOOL SelectTechies( )
  1647. {
  1648.     BOOL returnvalue = FALSE;
  1649.     if ( techiesaddr > 0 )
  1650.     {
  1651.         if ( GetSelectedOwnedUnit( ) == techiesaddr )
  1652.             return TRUE;
  1653.  
  1654.         if ( IsNotBadUnit( techiesaddr ) )
  1655.         {
  1656. #ifdef BOTDEBUG
  1657.             PrintDebugInfo( "Techies selected" );
  1658. #endif
  1659.             unitstoselect.clear( );
  1660.             unitstoselect.push_back( techiesaddr );
  1661.             returnvalue = SelectAllUnits( );
  1662.             unitstoselect.clear( );
  1663.         }
  1664.         else
  1665.         {
  1666. #ifdef BOTDEBUG
  1667.             PrintDebugInfo( "Techies not selected 11" );
  1668. #endif
  1669.             if ( !IsNotBadUnit( techiesaddr, techiesaddr ) && !IsHero( techiesaddr ) )
  1670.                 techiesaddr = 0;
  1671.  
  1672.         }
  1673.     }
  1674.  
  1675.     return returnvalue;
  1676. }
  1677.  
  1678.  
  1679. struct TechiesActionStruct
  1680. {
  1681.     int action;
  1682.     int data;
  1683. };
  1684. std::vector<BombStruct> BombList;
  1685.  
  1686. int EnableAutoExplode = 0;
  1687. BOOL EnableDagger = FALSE;
  1688. BOOL FunModeEnabled = FALSE;
  1689.  
  1690. BOOL _Daggercooldown = FALSE;
  1691. BOOL EnableForceStaff = TRUE;
  1692. int TechiesType = -1;
  1693. int TechiesSlot = -1;
  1694.  
  1695. BOOL _Forcecooldown = FALSE;
  1696. int forcestaffcooldown = 0;
  1697. int daggercooldown = 0;
  1698.  
  1699. BOOL IsFirstFun = TRUE;
  1700. char OldTechiesMissile[ 256 ];
  1701. int oldlen = 0;
  1702. char * funtechiesmissile = "Abilities\\Weapons\\BlackKeeperMissile\\BlackKeeperMissile.mdl\x0\xA\x0\xA";
  1703.  
  1704. void TechiesFunMode( BOOL enabled )
  1705. {
  1706.  
  1707.     if ( IsFirstFun )
  1708.     {
  1709.  
  1710.         int ClassAddr = GetTypeInfo( 'H00K', 0 );
  1711.         if ( ClassAddr > 0 )
  1712.         {
  1713.             int offset2 = ClassAddr + 0x44;
  1714.             offset2 = *( int* ) offset2;
  1715.             if ( offset2 > 0 )
  1716.             {
  1717.  
  1718.                 offset2 = *( int* ) offset2;
  1719.                 if ( offset2 > 0 )
  1720.                 {
  1721.                     char * modelname = 0;
  1722.                     IsFirstFun = FALSE;
  1723.                     *( int* ) &modelname = offset2;
  1724.                     sprintf_s( OldTechiesMissile, 256, "%s", modelname );
  1725.                     int strlenold = strlen( OldTechiesMissile );
  1726.                     oldlen = strlenold + 1;
  1727.                     OldTechiesMissile[ strlenold ] = '\x0';
  1728.                     OldTechiesMissile[ strlenold + 1 ] = '\xA';
  1729.                 }
  1730.                 else
  1731.                     return;
  1732.             }
  1733.  
  1734.         }
  1735.     }
  1736.  
  1737.     if ( !IsFirstFun )
  1738.     {
  1739.  
  1740.         if ( enabled )
  1741.         {
  1742.             int ClassAddr = GetTypeInfo( 'H00K', 0 );
  1743.             if ( ClassAddr > 0 )
  1744.             {
  1745.                 int offset2 = ClassAddr + 0x44;
  1746.                 offset2 = *( int* ) offset2;
  1747.                 if ( offset2 )
  1748.                 {
  1749.  
  1750.                     offset2 = *( int* ) offset2;
  1751.                     if ( offset2 )
  1752.                     {
  1753.                         char * modelname = 0;
  1754.                         *( int* ) &modelname = offset2;
  1755.                         CopyMemory( modelname, funtechiesmissile, strlen( funtechiesmissile ) + 2 );
  1756.                     }
  1757.                 }
  1758.             }
  1759.             else
  1760.             {
  1761.                 TextPrint( "Error! Bad class!", 5.0f );
  1762.             }
  1763.         }
  1764.         else
  1765.         {
  1766.             int ClassAddr = GetTypeInfo( 'H00K', 0 );
  1767.             if ( ClassAddr > 0 )
  1768.             {
  1769.                 int offset2 = ClassAddr + 0x44;
  1770.                 offset2 = *( int* ) offset2;
  1771.                 if ( offset2 )
  1772.                 {
  1773.  
  1774.                     offset2 = *( int* ) offset2;
  1775.                     if ( offset2 )
  1776.                     {
  1777.                         char * modelname = 0;
  1778.                         *( int* ) &modelname = offset2;
  1779.                         CopyMemory( modelname, OldTechiesMissile, oldlen );
  1780.                         //modelname[ strlen( modelname ) + 1 ] = '\xA';
  1781.                     }
  1782.                 }
  1783.             }
  1784.             else
  1785.             {
  1786.                 TextPrint( "Error! Bad class!", 5.0f );
  1787.             }
  1788.         }
  1789.     }
  1790. }
  1791.  
  1792.  
  1793. int techiesoldaddr = 0;
  1794. int ownunitaddr = 0;
  1795. BOOL NeedOldTechies = FALSE;
  1796.  
  1797. void SetTechiesNewAddrForAlly( )
  1798. {
  1799.     NeedOldTechies = TRUE;
  1800.     if ( TechiesType == 1 )
  1801.     {
  1802.         if ( ownunitaddr == 0 )
  1803.         {
  1804.             int ownunit = GetSelectedOwnedUnit( );
  1805.             if ( IsNotBadUnit( ownunit ) && IsHero( ownunit ) )
  1806.             {
  1807.                 techiesoldaddr = techiesaddr;
  1808.                 techiesaddr = ownunit;
  1809.                 ownunitaddr = ownunit;
  1810.             }
  1811.         }
  1812.         else if ( !IsNotBadUnit( ownunitaddr, TRUE ) || ( !IsHero( ownunitaddr ) && !IsUnitDead( ownunitaddr ) ) )
  1813.         {
  1814.             ownunitaddr = 0;
  1815.         }
  1816.     }
  1817. }
  1818.  
  1819. void SetOldTechiesAddr( )
  1820. {
  1821.     if ( NeedOldTechies && TechiesType == 1 )
  1822.     {
  1823.         NeedOldTechies = FALSE;
  1824.         if ( techiesoldaddr != 0 )
  1825.             techiesaddr = techiesoldaddr;
  1826.     }
  1827. }
  1828.  
  1829. int TechiesEnemyTimer = 300;
  1830.  
  1831. void JustTechies( )
  1832. {
  1833.     LatestTime = time( NULL );
  1834.     retryall:
  1835.     if ( IsGame( ) )
  1836.     {
  1837. #ifdef BOTDEBUG
  1838.         PrintDebugInfo( "InGame" );
  1839. #endif
  1840.         if ( !IsWindowActive( ) )
  1841.         {
  1842.             while ( !IsWindowActive( ) )
  1843.             {
  1844.                 Sleep( 200 );
  1845.                 LatestTime = time( NULL );
  1846.             }
  1847.             Sleep( 1000 );
  1848.             goto retryall;
  1849.         }
  1850. #ifdef BOTDEBUG
  1851.         PrintDebugInfo( "Window active" );
  1852. #endif
  1853.         LatestTime = time( NULL );
  1854.  
  1855.         if ( !TechiesFound || techiesaddr == 0 || !IsOkayPtr( ( void* ) techiesaddr ) )
  1856.         {
  1857. #ifdef BOTDEBUG
  1858.             PrintDebugInfo( "Find techies!" );
  1859. #endif
  1860.             TechiesFound = FALSE;
  1861.             techiesaddr = 0;
  1862.  
  1863.  
  1864.             int * unitsarray = 0;
  1865.             int * UnitsCount = GetUnitCountAndUnitArray( &unitsarray );
  1866.             //Поиск течиса
  1867.             if ( UnitsCount > 0 && *( int* ) UnitsCount > 0 && unitsarray )
  1868.             {
  1869.  
  1870.                 for ( int i = 0; i < *( int* ) UnitsCount; i++ )
  1871.                 {
  1872.                     if ( i >= *( int* ) UnitsCount )
  1873.                         break;
  1874.                     latestunit = unitsarray[ i ];
  1875.                     if ( unitsarray[ i ] )
  1876.                     {
  1877. #ifdef BOTDEBUG
  1878.                         PrintDebugInfo2( "UnitArrayFound", unitsarray[ i ] );
  1879. #endif
  1880.                         if ( IsNotBadUnit( unitsarray[ i ] ) )
  1881.                         {
  1882. #ifdef BOTDEBUG
  1883.                             PrintDebugInfo( "UnitOkay" );
  1884. #endif
  1885.                             if ( IsHero( unitsarray[ i ] ) > 0 )
  1886.                             {
  1887.                                 if ( IsClassEqual( unitsarray[ i ], "H00K" ) )
  1888.                                 {
  1889.                                     TechiesSlot = GetUnitOwnerSlot( unitsarray[ i ] );
  1890.                                     if ( GetLocalPlayerNumber( ) == TechiesSlot || !IsPlayerEnemy( unitsarray[ i ] ) )
  1891.                                     {
  1892.                                         if ( TechiesType == 0 )
  1893.                                         {
  1894.                                             TextPrint( GetUnitName( unitsarray[ i ] ), 5.0f );
  1895.                                         }
  1896.                                         //PrintClassAddress( unitsarray[ i ] );
  1897. #ifdef BOTDEBUG
  1898.                                         PrintDebugInfo( "ClassEqual" );
  1899. #endif
  1900.                                         techiesaddr = unitsarray[ i ];
  1901.                                         TechiesFound = TRUE;
  1902.                                         if ( GetLocalPlayerNumber( ) == TechiesSlot )
  1903.                                         {
  1904.                                             TechiesType = 0;
  1905. #ifdef BOTDEBUG
  1906.                                             PrintDebugInfo( "FoundTechies" );
  1907. #endif
  1908.  
  1909.                                             if ( TechiesType == 0 )
  1910.                                             {
  1911.                                                 TextPrint( "|cFF00FF00Found!|r", 3.0f );
  1912.                                                 if ( EnableAutoExplode == 1 )
  1913.                                                 {
  1914.                                                     TextPrint( "AutoExplode: |cFFEF2020AutoExplode|r", 3.0f );
  1915.                                                 }
  1916.                                                 else if ( EnableAutoExplode == 0 )
  1917.                                                 {
  1918.                                                     TextPrint( "AutoExplode: |cFF00FF00AutoKill|r ", 3.0f );
  1919.                                                 }
  1920.                                                 else if ( EnableAutoExplode == 2 )
  1921.                                                 {
  1922.                                                     TextPrint( "AutoExplode: |cFFFF0000Disabled|r ", 3.0f );
  1923.                                                 }
  1924.                                                 if ( EnableForceStaff )
  1925.                                                 {
  1926.                                                     TextPrint( "ForceStaff: |cFF00FF00ENABLED|r", 3.0f );
  1927.                                                 }
  1928.                                                 else if ( !EnableForceStaff )
  1929.                                                 {
  1930.                                                     TextPrint( "ForceStaff: |cFFFF0000DISABLED|r", 3.0f );
  1931.                                                 }
  1932.                                                 if ( EnableDagger )
  1933.                                                 {
  1934.                                                     TextPrint( "Dagger: |cFF00FF00ENABLED|r", 3.0f );
  1935.                                                 }
  1936.                                                 else if ( !EnableDagger )
  1937.                                                 {
  1938.                                                     TextPrint( "Dagger: |cFFFF0000DISABLED|r", 3.0f );
  1939.                                                 }
  1940.                                             }
  1941.                                             break;
  1942.                                             /*  float x;
  1943.                                             float y;
  1944.                                             float dur = 3.0f;
  1945.                                             GetUnitLocation3D( techiesaddr , &x , &y );
  1946.                                             PingMinimap( &x , &y , &dur );*/
  1947.                                         }
  1948.                                         else
  1949.                                         {
  1950.                                             if ( !IsPlayerEnemy( unitsarray[ i ] ) )
  1951.                                             {
  1952.                                                 TechiesType = 1;
  1953.                                                 TextPrint( "|cFFFF7C00Found ally techies|r", 3.0f );
  1954.                                                 if ( EnableForceStaff )
  1955.                                                 {
  1956.                                                     TextPrint( "ForceStaff: |cFF00FF00ENABLED|r", 3.0f );
  1957.                                                 }
  1958.                                                 else if ( !EnableForceStaff )
  1959.                                                 {
  1960.                                                     TextPrint( "ForceStaff: |cFFFF0000DISABLED|r", 3.0f );
  1961.                                                 }
  1962.                                                 if ( EnableDagger )
  1963.                                                 {
  1964.                                                     TextPrint( "Dagger: |cFF00FF00ENABLED|r", 3.0f );
  1965.                                                 }
  1966.                                                 else if ( !EnableDagger )
  1967.                                                 {
  1968.                                                     TextPrint( "Dagger: |cFFFF0000DISABLED|r", 3.0f );
  1969.                                                 }
  1970.                                             }
  1971.                                             else
  1972.                                             {
  1973.                                                 TechiesType = 2;
  1974.                                             }
  1975.                                         }
  1976.                                     }
  1977.                                 }
  1978.                             }
  1979.  
  1980.                         }
  1981.                         else if ( !IsNotBadUnit( unitsarray[ i ], TRUE ) )
  1982.                         {
  1983.                             break;
  1984.                         }
  1985.                     }
  1986.  
  1987.                 }
  1988.  
  1989.  
  1990.                 if ( !TechiesFound )
  1991.                 {
  1992.  
  1993.                     techiesaddr = 0;
  1994. #ifdef BOTDEBUG
  1995.                     PrintDebugInfo( "No techies found" );
  1996. #endif
  1997.                     Sleep( 2000 );
  1998.                     return;
  1999.                 }
  2000.             }
  2001.  
  2002.  
  2003.  
  2004.         }
  2005.         else
  2006.         {
  2007.             if ( TechiesSlot != GetUnitOwnerSlot( techiesaddr ) )
  2008.             {
  2009.                 TechiesFound = FALSE;
  2010.                 techiesaddr = 0;
  2011.                 TextPrint( "Techies: |cFF00FF00System reloaded|r", 3.0f );
  2012.             }
  2013.         }
  2014.         LatestTime = time( NULL );
  2015.         if ( TechiesFound )
  2016.         {
  2017.  
  2018. #ifdef BOTDEBUG
  2019.             PrintDebugInfo( "techies found" );
  2020. #endif
  2021.             // Очистить список мин
  2022.             BombList.clear( );
  2023.  
  2024.             // Сохранить список мин
  2025.  
  2026.             if ( TechiesFound )
  2027.             {
  2028. #ifdef BOTDEBUG
  2029.                 PrintDebugInfo( "Find mines" );
  2030. #endif
  2031.  
  2032.                 int * unitsarray = 0;
  2033.                 int * UnitsCount = GetUnitCountAndUnitArray( &unitsarray );
  2034.                 if ( UnitsCount > 0 && *( int* ) UnitsCount > 0 && unitsarray )
  2035.                 {
  2036.  
  2037.                     for ( int i = 0; i < *( int* ) UnitsCount; i++ )
  2038.                     {
  2039.                         if ( i >= *( int* ) UnitsCount )
  2040.                             break;
  2041.                         latestunit = unitsarray[ i ];
  2042. #ifdef BOTDEBUG
  2043.                         PrintDebugInfo2( "UnitFOund", unitsarray[ i ] );
  2044. #endif
  2045.                         if ( /* !IsIgnoreUnit( unitsarray[ i ] ) &&*/ IsNotBadUnit( unitsarray[ i ] ) && !IsHero( unitsarray[ i ] ) && IsHero( unitsarray[ i ] ) != -1 )
  2046.                         {
  2047. #ifdef BOTDEBUG
  2048.                             PrintDebugInfo( "NormalUnit33" );
  2049. #endif
  2050.                             if ( GetLocalPlayerNumber( ) == GetUnitOwnerSlot( unitsarray[ i ] ) )
  2051.                             {
  2052.  
  2053.  
  2054.                                 // 1lvl 1skill = n00O
  2055.  
  2056.                                 // 2lvl 1skill = n00P
  2057.  
  2058.                                 // 3lvl 1skill = n00Q
  2059.  
  2060.                                 // 4lvl 1skill = n00N
  2061.  
  2062.                                 // 1lvl 4skill = o018
  2063.  
  2064.                                 // 2lvl 4skill = o002
  2065.  
  2066.                                 // 3lvl 4skill = o00B
  2067.  
  2068.                                 // 4lvl 4skill = o01B
  2069.  
  2070.  
  2071.  
  2072.                                 if ( IsClassEqual( unitsarray[ i ], "n00O" ) )
  2073.                                 {
  2074.                                     BombStruct tmpstr = BombStruct( );
  2075.                                     tmpstr.unitaddr = unitsarray[ i ];
  2076.                                     tmpstr.dmg = 300.0f;
  2077.                                     tmpstr.range1 = 200.0f;
  2078.                                     tmpstr.range2 = 500.0f;
  2079.                                     tmpstr.remote = FALSE;
  2080.                                     GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2081.                                     /*float durdur = 0.10f;
  2082.                                     PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2083.                                     BombList.push_back( tmpstr );
  2084.                                 }
  2085.  
  2086.  
  2087.                                 if ( IsClassEqual( unitsarray[ i ], "n00P" ) )
  2088.                                 {
  2089.                                     BombStruct tmpstr = BombStruct( );
  2090.                                     tmpstr.unitaddr = unitsarray[ i ];
  2091.                                     tmpstr.dmg = 400.0f;
  2092.                                     tmpstr.range1 = 200.0f;
  2093.                                     tmpstr.range2 = 500.0f;
  2094.                                     tmpstr.remote = FALSE;
  2095.                                     GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2096.                                     /*float durdur = 0.10f;
  2097.                                     PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2098.                                     BombList.push_back( tmpstr );
  2099.                                 }
  2100.  
  2101.                                 if ( IsClassEqual( unitsarray[ i ], "n00Q" ) )
  2102.                                 {
  2103.                                     BombStruct tmpstr = BombStruct( );
  2104.                                     tmpstr.unitaddr = unitsarray[ i ];
  2105.                                     tmpstr.dmg = 500.0f;
  2106.                                     tmpstr.range1 = 200.0f;
  2107.                                     tmpstr.range2 = 500.0f;
  2108.                                     tmpstr.remote = FALSE;
  2109.                                     GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2110.                                     /*float durdur = 0.10f;
  2111.                                     PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2112.                                     BombList.push_back( tmpstr );
  2113.                                 }
  2114.  
  2115.  
  2116.                                 if ( IsClassEqual( unitsarray[ i ], "n00N" ) )
  2117.                                 {
  2118.                                     BombStruct tmpstr = BombStruct( );
  2119.                                     tmpstr.unitaddr = unitsarray[ i ];
  2120.                                     tmpstr.dmg = 600.0f;
  2121.                                     tmpstr.range1 = 200.0f;
  2122.                                     tmpstr.range2 = 500.0f;
  2123.                                     tmpstr.remote = FALSE;
  2124.                                     GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2125.                                     /*float durdur = 0.10f;
  2126.                                     PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2127.                                     BombList.push_back( tmpstr );
  2128.                                 }
  2129.  
  2130.                                 if ( TechiesType == 0 )
  2131.                                 {
  2132.  
  2133.                                     if ( IsClassEqual( unitsarray[ i ], "o018" ) )
  2134.                                     {
  2135.                                         BombStruct tmpstr = BombStruct( );
  2136.                                         tmpstr.unitaddr = unitsarray[ i ];
  2137.                                         tmpstr.dmg = 300.0f;
  2138.                                         tmpstr.range1 = 399.0f;
  2139.                                         tmpstr.range2 = 0.0f;
  2140.                                         tmpstr.remote = TRUE;
  2141.                                         GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2142.                                         /*  float durdur = 0.10f;
  2143.                                         PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2144.                                         BombList.push_back( tmpstr );
  2145.                                     }
  2146.  
  2147.                                     if ( IsClassEqual( unitsarray[ i ], "o002" ) )
  2148.                                     {
  2149.                                         BombStruct tmpstr = BombStruct( );
  2150.                                         tmpstr.unitaddr = unitsarray[ i ];
  2151.                                         tmpstr.dmg = 450.0f;
  2152.                                         tmpstr.range1 = 409.0f;
  2153.                                         tmpstr.range2 = 0.0f;
  2154.                                         tmpstr.remote = TRUE;
  2155.                                         GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2156.                                         /*float durdur = 0.10f;
  2157.                                         PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2158.                                         BombList.push_back( tmpstr );
  2159.                                     }
  2160.  
  2161.                                     if ( IsClassEqual( unitsarray[ i ], "o00B" ) )
  2162.                                     {
  2163.                                         BombStruct tmpstr = BombStruct( );
  2164.                                         tmpstr.unitaddr = unitsarray[ i ];
  2165.                                         tmpstr.dmg = 600.0f;
  2166.                                         tmpstr.range1 = 424.0f;
  2167.                                         tmpstr.range2 = 0.0f;
  2168.                                         tmpstr.remote = TRUE;
  2169.                                         GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2170.                                         /*float durdur = 0.10f;
  2171.                                         PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2172.                                         BombList.push_back( tmpstr );
  2173.                                     }
  2174.  
  2175.                                     if ( IsClassEqual( unitsarray[ i ], "o01B" ) )
  2176.                                     {
  2177.                                         BombStruct tmpstr = BombStruct( );
  2178.                                         tmpstr.unitaddr = unitsarray[ i ];
  2179.                                         tmpstr.dmg = 750.0f;
  2180.                                         tmpstr.range1 = 424.0f;
  2181.                                         tmpstr.range2 = 0.0f;
  2182.                                         tmpstr.remote = TRUE;
  2183.                                         GetUnitLocation3D( unitsarray[ i ], &tmpstr.x, &tmpstr.y, &tmpstr.z );
  2184.                                         /*float durdur = 0.10f;
  2185.                                         PingMinimap( &tmpstr.x , &tmpstr.y , &durdur );*/
  2186.                                         BombList.push_back( tmpstr );
  2187.                                     }
  2188.  
  2189.                                 }
  2190.                             }
  2191.                         }
  2192.                         else if ( !IsNotBadUnit( unitsarray[ i ], TRUE ) )
  2193.                         {
  2194.                             break;
  2195.                         }
  2196.                     }
  2197.                     //Поиск течиса
  2198.  
  2199.  
  2200.                 }
  2201. #ifdef BOTDEBUG
  2202.                 PrintDebugInfo( "End find mines" );
  2203. #endif
  2204.             }
  2205.  
  2206.             if ( TechiesType == 0 )
  2207.             {
  2208.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x31 ) )
  2209.                 {
  2210.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x31 ) )
  2211.                     {
  2212.                         Sleep( 10 );
  2213.                         LatestTime = time( NULL );
  2214.                     }
  2215.                     EnableAutoExplode++;
  2216.  
  2217.                     if ( EnableAutoExplode > 2 )
  2218.                         EnableAutoExplode = 0;
  2219.  
  2220.                     if ( EnableAutoExplode == 1 )
  2221.                     {
  2222.                         TextPrint( "AutoExplode: |cFFEF2020AutoExplode|r", 3.0f );
  2223.                     }
  2224.                     else if ( EnableAutoExplode == 0 )
  2225.                     {
  2226.                         TextPrint( "AutoExplode: |cFF00FF00AutoKill|r ", 3.0f );
  2227.                     }
  2228.                     else if ( EnableAutoExplode == 2 )
  2229.                     {
  2230.                         TextPrint( "AutoExplode: |cFFFF0000Disabled|r ", 3.0f );
  2231.                     }
  2232.                     return;
  2233.                 }
  2234.             }
  2235.  
  2236.             if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x32 ) )
  2237.             {
  2238.                 while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x32 ) )
  2239.                 {
  2240.                     LatestTime = time( NULL );
  2241.                     Sleep( 10 );
  2242.                 }
  2243.                 EnableForceStaff = !EnableForceStaff;
  2244.  
  2245.                 if ( EnableForceStaff )
  2246.                 {
  2247.                     TextPrint( "ForceStaff: |cFF00FF00ENABLED|r", 3.0f );
  2248.                 }
  2249.                 else if ( !EnableForceStaff )
  2250.                 {
  2251.                     TextPrint( "ForceStaff: |cFFFF0000DISABLED|r", 3.0f );
  2252.                 }
  2253.                 return;
  2254.             }
  2255.  
  2256.  
  2257.             if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x33 ) )
  2258.             {
  2259.                 while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x33 ) )
  2260.                 {
  2261.                     LatestTime = time( NULL );
  2262.                     Sleep( 10 );
  2263.                 }
  2264.                 EnableDagger = !EnableDagger;
  2265.  
  2266.                 if ( EnableDagger )
  2267.                 {
  2268.                     TextPrint( "Dagger: |cFF00FF00ENABLED|r", 3.0f );
  2269.                 }
  2270.                 else if ( !EnableDagger )
  2271.                 {
  2272.                     TextPrint( "Dagger: |cFFFF0000DISABLED|r", 3.0f );
  2273.                 }
  2274.                 return;
  2275.             }
  2276.             if ( ExpertModeEnabled )
  2277.             {
  2278.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x34 ) )
  2279.                 {
  2280.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x34 ) )
  2281.                     {
  2282.                         LatestTime = time( NULL );
  2283.                         Sleep( 10 );
  2284.                     }
  2285.  
  2286.                     BOOL tempbool = !StealthMode;
  2287.  
  2288.                     StealthMode = FALSE;
  2289.  
  2290.  
  2291.                     if ( tempbool )
  2292.                     {
  2293.                         TextPrint( "Stealt hMode : |cFF00FF00ENABLED|r", 3.0f );
  2294.                     }
  2295.                     else if ( !tempbool )
  2296.                     {
  2297.                         TextPrint( "Stealth Mode : |cFFFF0000DISABLED|r", 3.0f );
  2298.                     }
  2299.  
  2300.                     StealthMode = tempbool;
  2301.                     return;
  2302.                 }
  2303.  
  2304.             }
  2305.  
  2306.             if ( ExpertModeEnabled )
  2307.             {
  2308.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x35 ) )
  2309.                 {
  2310.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x35 ) )
  2311.                     {
  2312.                         LatestTime = time( NULL );
  2313.                         Sleep( 10 );
  2314.                     }
  2315.                     UseWarnIsBadReadPtr++;
  2316.                     if ( UseWarnIsBadReadPtr > 3 )
  2317.                         UseWarnIsBadReadPtr = 1;
  2318.  
  2319.                     if ( UseWarnIsBadReadPtr == 2 )
  2320.                     {
  2321.                         TextPrint( "[SLOW BUT STABLE]|cFFFFCC00Use VirtualQuery to detect bad memory!|r", 3.0f );
  2322.                     }
  2323.                     else if ( UseWarnIsBadReadPtr == 1 )
  2324.                     {
  2325.                         TextPrint( "[FAST]|cFFFF5B00Use IsBadReadPtr (__try -catch) to detect bad memory!|r", 3.0f );
  2326.                     }
  2327.                     else if ( UseWarnIsBadReadPtr == 3 )
  2328.                     {
  2329.                         TextPrint( "[VERY FAST]|cFFFF0000Disable bad memory detection!|r", 3.0f );
  2330.                     }
  2331.                     return;
  2332.                 }
  2333.             }
  2334.  
  2335.             if ( ExpertModeEnabled )
  2336.             {
  2337.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x36 ) )
  2338.                 {
  2339.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x36 ) )
  2340.                     {
  2341.                         LatestTime = time( NULL );
  2342.                         Sleep( 10 );
  2343.                     }
  2344.                     DisableWindowActiveCheck = !DisableWindowActiveCheck;
  2345.  
  2346.                     if ( !DisableWindowActiveCheck )
  2347.                     {
  2348.                         TextPrint( "Work only when window active : |cFF00FF00ENABLED|r", 3.0f );
  2349.                     }
  2350.                     else if ( DisableWindowActiveCheck )
  2351.                     {
  2352.                         TextPrint( "Work only when window active : |cFFFF0000DISABLED|r", 3.0f );
  2353.                     }
  2354.                     return;
  2355.                 }
  2356.             }
  2357.  
  2358.             if ( ExpertModeEnabled )
  2359.             {
  2360.  
  2361.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x37 ) )
  2362.                 {
  2363.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x37 ) )
  2364.                     {
  2365.                         LatestTime = time( NULL );
  2366.                         Sleep( 10 );
  2367.                     }
  2368.                     Enable3DPoint = !Enable3DPoint;
  2369.  
  2370.                     if ( Enable3DPoint )
  2371.                     {
  2372.                         TextPrint( "3D Point System : |cFF00FF00ENABLED|r", 3.0f );
  2373.                     }
  2374.                     else if ( !Enable3DPoint )
  2375.                     {
  2376.                         TextPrint( "3D Point System : |cFFFF0000DISABLED|r", 3.0f );
  2377.                     }
  2378.                     return;
  2379.                 }
  2380.             }
  2381.  
  2382.             if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x38 ) )
  2383.             {
  2384.                 while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x38 ) )
  2385.                 {
  2386.                     LatestTime = time( NULL );
  2387.                     Sleep( 10 );
  2388.                 }
  2389.                 ExpertModeEnabled = !ExpertModeEnabled;
  2390.  
  2391.                 if ( ExpertModeEnabled )
  2392.                 {
  2393.                     TextPrint( "Expert mode: |cFF00FF00ENABLED|r", 3.0f );
  2394.                 }
  2395.                 else if ( !ExpertModeEnabled )
  2396.                 {
  2397.                     TextPrint( "Expert mode: |cFFFF0000DISABLED|r", 3.0f );
  2398.                 }
  2399.                 return;
  2400.             }
  2401.  
  2402.  
  2403.             if ( ExpertModeEnabled )
  2404.             {
  2405.  
  2406.                 if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x39 ) )
  2407.                 {
  2408.                     while ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x39 ) )
  2409.                     {
  2410.                         LatestTime = time( NULL );
  2411.                         Sleep( 10 );
  2412.                     }
  2413.                     FunModeEnabled = !FunModeEnabled;
  2414.  
  2415.                     if ( FunModeEnabled )
  2416.                     {
  2417.                         TextPrint( "Fun mode: |cFF00FF00ENABLED|r", 3.0f );
  2418.                     }
  2419.                     else if ( !FunModeEnabled )
  2420.                     {
  2421.                         TextPrint( "Fun mode: |cFFFF0000DISABLED|r", 3.0f );
  2422.                     }
  2423.                     TechiesFunMode( FunModeEnabled );
  2424.                     return;
  2425.                 }
  2426.             }
  2427.  
  2428. #ifdef BOTDEBUG
  2429.             if ( IsKeyPressed( 0x58 ) && IsKeyPressed( '-' ) )
  2430.             {
  2431.                 while ( IsKeyPressed( 0x58 ) && IsKeyPressed( '-' ) )
  2432.                 {
  2433.                     LatestTime = time( NULL );
  2434.                     Sleep( 10 );
  2435.                 }
  2436.                 DebugActive = !DebugActive;
  2437.  
  2438.                 if ( DebugActive )
  2439.                 {
  2440.                     InitDebug( );
  2441.                     TextPrint( "Debug system : ENABLED", 3.0f );
  2442.                     TextPrint( "Warning! This can make slow WAR3 playing.", 3.0f );
  2443.                 }
  2444.                 else if ( !DebugActive )
  2445.                 {
  2446.                     TextPrint( "Debug system : DISABLED", 3.0f );
  2447.                 }
  2448.                 return;
  2449.             }
  2450. #endif
  2451.  
  2452.             if ( !IsGame( ) )
  2453.                 return;
  2454.  
  2455.             if ( EnableAutoExplode == 1 && TechiesType == 0 )
  2456.             {
  2457. #ifdef BOTDEBUG
  2458.                 PrintDebugInfo( "Init autoexplode" );
  2459. #endif
  2460.                 int * unitsarray = 0;
  2461.                 int * UnitsCount = GetUnitCountAndUnitArray( &unitsarray );
  2462.  
  2463.                 if ( UnitsCount > 0 && *( int* ) UnitsCount > 0 && unitsarray )
  2464.                 {
  2465.  
  2466.                     for ( int i = 0; i < *( int* ) UnitsCount; i++ )
  2467.                     {
  2468.                         if ( i >= *( int* ) UnitsCount )
  2469.                             break;
  2470.                         latestunit = unitsarray[ i ];
  2471.                         BOOL skipped = FALSE;
  2472.                         goto skip2try;
  2473.  
  2474.                         try2:;
  2475.  
  2476.                         skipped = TRUE;
  2477.                         Sleep( 200 );
  2478.  
  2479.                         if ( !IsGame( ) )
  2480.                             return;
  2481.  
  2482.                         skip2try:;
  2483. #ifdef BOTDEBUG
  2484.                         PrintDebugInfo2( "UnitCOunt333", unitsarray[ i ] );
  2485. #endif
  2486.                         if ( IsNotBadUnit( unitsarray[ i ] ) && IsHero( unitsarray[ i ] ) )
  2487.                         {
  2488. #ifdef BOTDEBUG
  2489.                             PrintDebugInfo( "OkayUnitLOLOLO3" );
  2490. #endif
  2491.                             if ( GetLocalPlayerNumber( ) != GetUnitOwnerSlot( unitsarray[ i ] ) )
  2492.                             {
  2493.                                 if ( IsPlayerEnemy( unitsarray[ i ] ) && IsUnitVisibleToPlayer( unitsarray[ i ], GetLocalPlayer( ) ) && GetDmgForUnit( unitsarray[ i ], 600.0f ) > 0.0f )
  2494.                                 {
  2495.  
  2496.  
  2497.  
  2498. #ifdef BOTDEBUG
  2499.                                     PrintDebugInfo( "Found enemy" );
  2500. #endif
  2501.                                     float unitx = 0.0f, unity = 0.0f, unitz = 0.0f;
  2502.                                     GetUnitLocation3D( unitsarray[ i ], &unitx, &unity, &unitz );
  2503.                                     unitstoselect.clear( );
  2504.                                     for ( unsigned int n = 0; n < BombList.size( ); n++ )
  2505.                                     {
  2506.                                         if ( !BombList[ n ].remote )
  2507.                                             continue;
  2508.  
  2509.                                         if ( Distance3D( unitx, unity, unitz, BombList[ n ].x, BombList[ n ].y, BombList[ n ].z ) < BombList[ n ].range1 )
  2510.                                         {
  2511.                                             unitstoselect.push_back( BombList[ n ].unitaddr );
  2512.                                         }
  2513.                                     }
  2514.  
  2515.                                     if ( unitstoselect.size( ) > 0 )
  2516.                                     {
  2517.                                         if ( !skipped && !ExpertModeEnabled )
  2518.                                         {
  2519.                                             goto try2;
  2520.                                         }
  2521. #ifdef BOTDEBUG
  2522.                                         PrintDebugInfo( "Need explode" );
  2523. #endif
  2524.                                         while ( SelectAllUnits( ) )
  2525.                                         {
  2526.  
  2527. #ifdef BOTDEBUG
  2528.                                             PrintDebugInfo( "Units selected" );
  2529. #endif
  2530.                                             //  Sleep( 5 );
  2531.  
  2532.                                             UseDetonator( );
  2533.                                         }
  2534.  
  2535.                                         //  Sleep( 2 );
  2536.  
  2537. #ifdef BOTDEBUG
  2538.                                         PrintDebugInfo( "Detonator used" );
  2539. #endif
  2540.                                         //  Sleep( 5 );
  2541.                                         unitstoselect.clear( );
  2542.  
  2543.  
  2544.                                         SelectTechies( );
  2545.                                         if ( ExpertModeEnabled )
  2546.                                             Sleep( 20 );
  2547.                                         else
  2548.                                             Sleep( 50 );
  2549.                                         return;
  2550.                                     }
  2551.                                 }
  2552.                             }
  2553.  
  2554.                         }
  2555.                         else if ( !IsNotBadUnit( unitsarray[ i ], TRUE ) )
  2556.                         {
  2557.                             break;
  2558.                         }
  2559.                     }
  2560.  
  2561.  
  2562.  
  2563.                 }
  2564.  
  2565.             }
  2566.             else if ( EnableAutoExplode == 0 && TechiesType == 0 )
  2567.             {
  2568. #ifdef BOTDEBUG
  2569.                 PrintDebugInfo( "Init autokill" );
  2570. #endif
  2571.                 int * unitsarray = 0;
  2572.                 int * UnitsCount = GetUnitCountAndUnitArray( &unitsarray );
  2573.  
  2574.                 if ( UnitsCount > 0 && *( int* ) UnitsCount > 0 && unitsarray )
  2575.                 {
  2576.  
  2577.                     for ( int i = 0; i < *( int* ) UnitsCount; i++ )
  2578.                     {
  2579.                         if ( i >= *( int* ) UnitsCount )
  2580.                             break;
  2581.                         latestunit = unitsarray[ i ];
  2582.                         BOOL skipped = FALSE;
  2583.                         goto skip22try;
  2584.                         try22:;
  2585.                         skipped = TRUE;
  2586.                         Sleep( 200 );
  2587.                         skip22try:;
  2588.                         if ( !IsGame( ) )
  2589.                             return;
  2590.  
  2591. #ifdef BOTDEBUG
  2592.                         PrintDebugInfo( "UnitGetGetCCCC" );
  2593. #endif
  2594.                         if ( IsNotBadUnit( unitsarray[ i ] ) && IsHero( unitsarray[ i ] ) )
  2595.                         {
  2596. #ifdef BOTDEBUG
  2597.                             PrintDebugInfo2( "UnitGetGetCCCC", unitsarray[ i ] );
  2598. #endif
  2599.                             if ( GetLocalPlayerNumber( ) != GetUnitOwnerSlot( unitsarray[ i ] ) )
  2600.                             {
  2601.                                 if ( IsPlayerEnemy( unitsarray[ i ] ) && IsUnitVisibleToPlayer( unitsarray[ i ], GetLocalPlayer( ) ) )
  2602.                                 {
  2603. #ifdef BOTDEBUG
  2604.                                     PrintDebugInfo( "Found emeny" );
  2605. #endif
  2606.                                     float okaydmg = 0.0f;
  2607.                                     float unitx = 0.0f, unity = 0.0f, unitz = 0.0f;
  2608.                                     GetUnitLocation3D( unitsarray[ i ], &unitx, &unity, &unitz );
  2609.                                     /*float durdur = 0.19f;
  2610.                                     PingMinimap( &unitx , &unity , &durdur );*/
  2611.                                     unitstoselect.clear( );
  2612.  
  2613.                                     int BombsFound = 0;
  2614.  
  2615.                                     BOOL xxokaydmg = FALSE;
  2616.  
  2617.                                     for ( unsigned int n = 0; n < BombList.size( ); n++ )
  2618.                                     {
  2619.                                         if ( !BombList[ n ].remote )
  2620.                                             continue;
  2621.  
  2622.                                         if ( Distance3D( unitx, unity, unitz, BombList[ n ].x, BombList[ n ].y, BombList[ n ].z ) < BombList[ n ].range1 )
  2623.                                         {
  2624.                                             BombsFound++;
  2625.                                             unitstoselect.push_back( BombList[ n ].unitaddr );
  2626.                                             okaydmg += GetDmgForUnit( unitsarray[ i ], BombList[ n ].dmg );
  2627.                                             if ( okaydmg > GetUnitHP( unitsarray[ i ] ) )
  2628.                                             {
  2629.                                                 xxokaydmg = TRUE;
  2630.                                                 break;
  2631.                                             }
  2632.                                         }
  2633.                                     }
  2634.  
  2635.                                     if ( unitstoselect.size( ) > 0 )
  2636.                                     {
  2637. #ifdef BOTDEBUG
  2638.                                         PrintDebugInfo( "Need kill 1" );
  2639. #endif
  2640.                                         if ( xxokaydmg )
  2641.                                         {
  2642.  
  2643.  
  2644.                                             char * printdata = new char[ 256 ];
  2645.                                             sprintf_s( printdata, 256, "[AutoKill->OK]: [ %s ]|cFFFFFFFFHP: |r|cFFFF0000%i|r|cFFFFFFFF. DMG: |r|cFFFFCC00%i|r. Count: %i\n%s", GetUnitName( unitsarray[ i ] ), ( int ) GetUnitHP( unitsarray[ i ] ), ( int ) okaydmg, BombsFound, bufflist.size( ) > 0 ? bufflist.c_str( ) : "No buff found" );
  2646.                                             TextPrintUnspammed( printdata );
  2647.                                             delete[ ]printdata;
  2648.  
  2649.                                             if ( !skipped && !ExpertModeEnabled )
  2650.                                             {
  2651.                                                 goto try22;
  2652.                                             }
  2653. #ifdef BOTDEBUG
  2654.                                             PrintDebugInfo( "Need kill 2" );
  2655. #endif
  2656.                                             /*  for ( unsigned int x = 0; x < unitstoselect.size( ); x++ )
  2657.                                             {
  2658.                                             AddUnitToIgnore( unitstoselect[ x ] );
  2659.                                             }*/
  2660. #ifdef BOTDEBUG
  2661.                                             PrintDebugInfo( "SelectUnits" );
  2662. #endif
  2663.                                             while ( SelectAllUnits( ) )
  2664.                                             {
  2665. #ifdef BOTDEBUG
  2666.                                                 PrintDebugInfo( "UnitsSelected" );
  2667. #endif
  2668.                                                 //      Sleep( 5 );
  2669.  
  2670.                                                 UseDetonator( );
  2671.                                             }
  2672.                                             //Sleep( 2 );
  2673.  
  2674. #ifdef BOTDEBUG
  2675.                                             PrintDebugInfo( "Detonate" );
  2676. #endif
  2677.                                             //      Sleep( 5 );
  2678.  
  2679.                                             unitstoselect.clear( );
  2680.  
  2681.  
  2682. #ifdef BOTDEBUG
  2683.                                             PrintDebugInfo( "Select techies" );
  2684. #endif
  2685.                                             SelectTechies( );
  2686.  
  2687.                                             if ( ExpertModeEnabled )
  2688.                                                 Sleep( 30 );
  2689.                                             else
  2690.                                                 Sleep( 50 );
  2691.                                             return;
  2692.                                         }
  2693.                                         else
  2694.                                         {
  2695.                                             char * printdata = new char[ 256 ];
  2696.                                             sprintf_s( printdata, 256, "[AutoKill]: [ %s ]|cFFFFFFFFHP: |r|cFFFF0000%i|r|cFFFFFFFF. DMG: |r|cFFFFCC00%i|r. Count: %i\n%s", GetUnitName( unitsarray[ i ] ), ( int ) GetUnitHP( unitsarray[ i ] ), ( int ) okaydmg, BombsFound, bufflist.size( ) > 0 ? bufflist.c_str( ) : "No buff found" );
  2697.                                             TextPrintUnspammed( printdata );
  2698.                                             delete[ ]printdata;
  2699.                                         }
  2700.  
  2701.                                     }
  2702.                                 }
  2703.                             }
  2704.  
  2705.                         }
  2706.                         else if ( !IsNotBadUnit( unitsarray[ i ], TRUE ) )
  2707.                         {
  2708.                             break;
  2709.                         }
  2710.                     }
  2711.  
  2712.  
  2713.  
  2714.                 }
  2715.  
  2716.             }
  2717.  
  2718.  
  2719.             if ( TechiesType == 1 )
  2720.             {
  2721.                 if ( GetSelectedOwnedUnit( ) > 0 )
  2722.                 {
  2723.                     if ( !IsNotBadUnit( GetSelectedOwnedUnit( ) ) && IsHero( GetSelectedOwnedUnit( ) ) )
  2724.                     {
  2725.                         techiesaddr = GetSelectedOwnedUnit( );
  2726.                     }
  2727.                 }
  2728.  
  2729.             }
  2730.  
  2731.  
  2732.             if ( EnableForceStaff && techiesaddr > 0 && EnableAutoExplode == 0 )
  2733.             {
  2734.                 if ( forcestaffcooldown > 0 )
  2735.                 {
  2736.                     forcestaffcooldown--;
  2737.                 }
  2738.                 if ( daggercooldown > 0 )
  2739.                 {
  2740.                     daggercooldown--;
  2741.                 }
  2742.  
  2743.                 if ( TechiesType == 1 )
  2744.                     SetTechiesNewAddrForAlly( );
  2745. #ifdef BOTDEBUG
  2746.                 PrintDebugInfo( "Init forcestaff" );
  2747. #endif
  2748.                 if ( IsNotBadUnit( techiesaddr ) )
  2749.                 {
  2750. #ifdef BOTDEBUG
  2751.                     PrintDebugInfo( "dbg111" );
  2752. #endif
  2753.                     //SelectAllUnits( unitstoselect , unitstoselect.size( ) );
  2754.                 }
  2755.                 else
  2756.                 {
  2757. #ifdef BOTDEBUG
  2758.                     PrintDebugInfo( "dbg222" );
  2759. #endif
  2760.                     if ( !IsHero( techiesaddr ) && !IsUnitDead( techiesaddr ) )
  2761.                     {
  2762.                         techiesaddr = 0;
  2763.                     }
  2764.                     SetOldTechiesAddr( );
  2765.                     return;
  2766.                 }
  2767.                 /*int selectedunit1 = GetSelectedOwnedUnit( );
  2768.                 if ( selectedunit1 == 0 || ( techiesaddr != selectedunit1 && TechiesType == 0 ) )
  2769.                 {
  2770.                 goto skipforcestaff;
  2771.                 }*/
  2772. #ifdef BOTDEBUG
  2773.                 PrintDebugInfo( "FindForcestaff1" );
  2774. #endif
  2775.  
  2776.  
  2777.                 BOOL ForceStaffFound = FALSE;
  2778.                 int forcestaffitemid = 0;
  2779.                 int itemaddr = 0;
  2780.                 for ( int i = 0; i < 6; i++ )
  2781.                 {
  2782.                     itemaddr = GetItemInSlot( techiesaddr, 0, i );
  2783.                     if ( itemaddr > 0 && IsClassEqual( itemaddr, "I0HI" ) )
  2784.                     {
  2785.                         if ( IsAbilityCooldown( techiesaddr, 'A19M' ) )
  2786.                         {
  2787.                             if ( !_Forcecooldown )
  2788.                             {
  2789.                                 TextPrint( "|cFFFF6700F|r|cFFFE6401o|r|cFFFD6102r|r|cFFFC5E03c|r|cFFFB5A04e|r|cFFFA5705s|r|cFFF95406t|r|cFFF95107a|r|cFFF84E08f|r|cFFF74B09f|r|cFFF6470A |r|cFFF5440Bc|r|cFFF4410Co|r|cFFF33E0Co|r|cFFF23B0Dl|r|cFFF1380Ed|r|cFFF0340Fo|r|cFFEF3110w|r|cFFEE2E11n|r|cFFEE2B12 |r|cFFED2813s|r|cFFEC2514t|r|cFFEB2115a|r|cFFEA1E16r|r|cFFE91B17t|r|cFFE81818.|r", 3.0f );
  2790.                                 _Forcecooldown = TRUE;
  2791.                             }
  2792.                         }
  2793.                         else
  2794.                         {
  2795.                             if ( _Forcecooldown )
  2796.                             {
  2797.                                 _Forcecooldown = FALSE;
  2798.                                 TextPrint( "|cFF21FF00F|r|cFF31FF00o|r|cFF42FF00r|r|cFF52FF00c|r|cFF63FF00e|r|cFF73FF00s|r|cFF84FF00t|r|cFF94FF00a|r|cFFA5FF00f|r|cFFB5FF00f|r|cFFC6FF00 |r|cFFD6FF00co|r|cFFC6FF00o|r|cFFB5FF00l|r|cFFA5FF00d|r|cFF94FF00o|r|cFF84FF00w|r|cFF73FF00n|r|cFF63FF00 |r|cFF52FF00e|r|cFF42FF00n|r|cFF31FF00d|r|cFF21FF00.|r", 3.0f );
  2799.                                 Sleep( 20 );
  2800.                                 if ( !IsGame( ) )
  2801.                                     return;
  2802.                             }
  2803.                             ForceStaffFound = TRUE;
  2804.                             forcestaffitemid = i;
  2805.                         }
  2806.  
  2807.                         break;
  2808.                     }
  2809.                 }
  2810. #ifdef BOTDEBUG
  2811.                 PrintDebugInfo( "FindDagger1" );
  2812. #endif
  2813.                 BOOL DaggerFound = FALSE;
  2814.                 int daggeritemid = 0;
  2815.                 int daggeritemaddr = 0;
  2816.  
  2817.                 if ( !EnableDagger )
  2818.                 {
  2819.  
  2820.                 }
  2821.                 else
  2822.                 {
  2823.                     for ( int i = 0; i < 6; i++ )
  2824.                     {
  2825.                         daggeritemaddr = GetItemInSlot( techiesaddr, 0, i );
  2826.                         if ( daggeritemaddr > 0 && IsClassEqual( daggeritemaddr, "I04H" ) )
  2827.                         {
  2828.  
  2829.                             if ( IsAbilityCooldown( techiesaddr, 'AIbk' ) )
  2830.                             {
  2831.                                 if ( !_Daggercooldown )
  2832.                                 {
  2833.                                     TextPrint( "|cFFFF6700D|r|cFFFE6301a|r|cFFFD5F02g|r|cFFFC5C03g|r|cFFFB5805e|r|cFFFA5406r|r|cFFF85007 |r|cFFF74D08c|r|cFFF64909o|r|cFFF5450Ao|r|cFFF4410Bl|r|cFFF33E0Dd|r|cFFF23A0Eo|r|cFFF1360Fw|r|cFFF03210n|r|cFFEF2F11 |r|cFFED2B12s|r|cFFEC2713t|r|cFFEB2315a|r|cFFEA2016r|r|cFFE91C17t|r|cFFE81818.|r", 3.0f );
  2834.                                     _Daggercooldown = TRUE;
  2835.                                 }
  2836.  
  2837.                             }
  2838.                             else
  2839.                             {
  2840.                                 if ( _Daggercooldown )
  2841.                                 {
  2842.                                     _Daggercooldown = FALSE;
  2843.                                     TextPrint( "|cFF21FF00D|r|cFF35FF00a|r|cFF49FF00g|r|cFF5DFF00g|r|cFF71FF00e|r|cFF86FF00r|r|cFF9AFF00 |r|cFFAEFF00c|r|cFFC2FF00o|r|cFFD6FF00ol|r|cFFC2FF00d|r|cFFAEFF00o|r|cFF9AFF00w|r|cFF86FF00n|r|cFF71FF00 |r|cFF5DFF00e|r|cFF49FF00n|r|cFF35FF00d|r|cFF21FF00.|r", 3.0f );
  2844.                                     Sleep( 20 );
  2845.                                     if ( !IsGame( ) )
  2846.                                         return;
  2847.                                 }
  2848.  
  2849.                                 DaggerFound = TRUE;
  2850.                                 daggeritemid = i;
  2851.                             }
  2852.  
  2853.  
  2854.                             break;
  2855.                         }
  2856.                     }
  2857.                 }
  2858.  
  2859.                 if ( _Forcecooldown )
  2860.                 {
  2861.                     goto skipforcestaff;
  2862.                 }
  2863.  
  2864.                 if ( ForceStaffFound )
  2865.                 {
  2866. #ifdef BOTDEBUG
  2867.                     PrintDebugInfo( "Found force staff" );
  2868. #endif
  2869.                     int * unitsarray = 0;
  2870.                     int * UnitsCount = GetUnitCountAndUnitArray( &unitsarray );
  2871.  
  2872.                     if ( UnitsCount > 0 && *( int* ) UnitsCount > 0 && unitsarray )
  2873.                     {
  2874. #ifdef BOTDEBUG
  2875.                         PrintDebugInfo( "GetUnitarray22" );
  2876. #endif
  2877.                         for ( int i = 0; i < *( int* ) UnitsCount; i++ )
  2878.                         {
  2879.                             if ( i >= *( int* ) UnitsCount )
  2880.                                 break;
  2881.                             latestunit = unitsarray[ i ];
  2882. #ifdef BOTDEBUG
  2883.                             PrintDebugInfo2( "UnitGetdata", unitsarray[ i ] );
  2884. #endif
  2885.  
  2886.                             if ( IsNotBadUnit( unitsarray[ i ] ) )
  2887.                             {
  2888. #ifdef BOTDEBUG
  2889.                                 PrintDebugInfo( "UnitOkka##!!!" );
  2890. #endif
  2891.  
  2892.                                 if ( IsHero( unitsarray[ i ] ) )
  2893.                                 {
  2894.                                     if ( GetLocalPlayerNumber( ) != GetUnitOwnerSlot( unitsarray[ i ] ) )
  2895.                                     {
  2896.                                         if ( IsPlayerEnemy( unitsarray[ i ] ) && IsUnitVisibleToPlayer( unitsarray[ i ], GetLocalPlayer( ) ) )
  2897.                                         {
  2898. #ifdef BOTDEBUG
  2899.                                             PrintDebugInfo( "#555:OK" );
  2900. #endif
  2901.                                             float unitface = GetUnitFacing( unitsarray[ i ] );
  2902.  
  2903.                                             float targetunitx = 0.0f, targetunity = 0.0f, targetunitz = 0.0f;
  2904.                                             GetUnitLocation3D( unitsarray[ i ], &targetunitx, &targetunity, &targetunitz );
  2905.  
  2906.                                             float techiesunitx = 0.0f, techiesunity = 0.0f, techiesunitz = 0.0f;
  2907.                                             GetUnitLocation3D( techiesaddr, &techiesunitx, &techiesunity, &techiesunitz );
  2908.  
  2909.  
  2910.                                             if ( unitface != 100.0f && ( Distance3D( techiesunitx, techiesunity, techiesunitz, targetunitx, targetunity, targetunitz ) < 650.0f || ( DaggerFound && Distance3D( techiesunitx, techiesunity, techiesunitz, targetunitx, targetunity, targetunitz ) < ( 700.0f + 940.0f ) ) ) )
  2911.                                             {
  2912.                                                 if ( DaggerFound && Distance3D( techiesunitx, techiesunity, techiesunitz, targetunitx, targetunity, targetunitz ) < 650.0f )
  2913.                                                 {
  2914.                                                     DaggerFound = FALSE;
  2915.                                                 }
  2916.  
  2917.                                                 Location startenemyloc = Location( );
  2918.                                                 startenemyloc.X = targetunitx;
  2919.                                                 startenemyloc.Y = targetunity;
  2920.                                                 Location endenemyloc = GiveNextLocationFromLocAndAngle( startenemyloc, 500.0f, unitface );
  2921.                                                 float outdmg = 0.0f;
  2922.                                                 float enemyhp = GetUnitHP( unitsarray[ i ] );
  2923.                                                 for ( unsigned int n = 0; n < BombList.size( ); n++ )
  2924.                                                 {
  2925.                                                     /*if ( IsIgnoreUnit( BombList[ n ].unitaddr ) )
  2926.                                                     continue;*/
  2927.                                                     if ( !BombList[ n ].remote )
  2928.                                                     {
  2929.                                                         if ( Distance3D( endenemyloc.X, endenemyloc.Y, BombList[ n ].z, BombList[ n ].x, BombList[ n ].y, BombList[ n ].z ) < BombList[ n ].range1 )
  2930.                                                         {
  2931.                                                             outdmg += GetDmgForUnit( unitsarray[ i ], BombList[ n ].dmg, 2 );
  2932.                                                         }
  2933.                                                     }
  2934.                                                     else if ( TechiesType == 0 )
  2935.                                                     {
  2936.                                                         if ( Distance3D( endenemyloc.X, endenemyloc.Y, BombList[ n ].z, BombList[ n ].x, BombList[ n ].y, BombList[ n ].z ) < ( BombList[ n ].range1 - 20.0f ) )
  2937.                                                         {
  2938.                                                             outdmg += GetDmgForUnit( unitsarray[ i ], BombList[ n ].dmg );
  2939.                                                         }
  2940.                                                     }
  2941.                                                     /*  else if ( Distance3D( endenemyloc.X , endenemyloc.Y , BombList[ n ].z , BombList[ n ].x , BombList[ n ].y , BombList[ n ].z ) < BombList[ n ].range2 )
  2942.                                                     {
  2943.                                                     outdmg += ( BombList[ n ].dmg / 2.0f )* 0.80f;
  2944.  
  2945.                                                     }*/
  2946.                                                     if ( enemyhp < outdmg )
  2947.                                                         break;
  2948.                                                 }
  2949.  
  2950.  
  2951.  
  2952.                                                 if ( enemyhp < outdmg && outdmg > 10.0f )
  2953.                                                 {
  2954.  
  2955.  
  2956. #ifdef BOTDEBUG
  2957.                                                     PrintDebugInfo( "FORCE IT!" );
  2958. #endif
  2959.                                                     if ( SelectTechies( ) )
  2960.                                                     {
  2961.                                                         int scmd = GetCMDbyItemSlot( forcestaffitemid );
  2962.  
  2963.                                                         Sleep( 10 );
  2964.  
  2965.                                                         if ( IsNotBadUnit( unitsarray[ i ] ) && IsGame( ) )
  2966.                                                         {
  2967.                                                             float newunitface = GetUnitFacing( unitsarray[ i ] );
  2968.  
  2969.                                                             if ( newunitface + 0.07 > unitface && newunitface - 0.07 < unitface )
  2970.                                                             {
  2971.  
  2972.                                                                 if ( DaggerFound )
  2973.                                                                 {
  2974.                                                                     int dagcmd = GetCMDbyItemSlot( daggeritemid );
  2975.  
  2976.                                                                     ItemOrSkillPoint( dagcmd, daggeritemaddr, targetunitx + 1.0f, targetunity - 1.01f, 0x100002 );
  2977.  
  2978.                                                                     Sleep( 10 );
  2979.  
  2980.                                                                     if ( !IsGame( ) )
  2981.                                                                     {
  2982.                                                                         return;
  2983.                                                                     }
  2984.  
  2985.                                                                     CommandItemTarget( scmd, itemaddr, targetunitx, targetunity, unitsarray[ i ], TRUE );
  2986.  
  2987.                                                                     daggercooldown = 481;
  2988.                                                                     forcestaffcooldown = 810;
  2989.  
  2990.                                                                 }
  2991.                                                                 else
  2992.                                                                 {
  2993.                                                                     CommandItemTarget( scmd, itemaddr, targetunitx, targetunity, unitsarray[ i ] );
  2994.  
  2995.                                                                     forcestaffcooldown = 810;
  2996.                                                                 }
  2997.                                                             }
  2998.                                                         }
  2999.                                                     }
  3000.                                                     else
  3001.                                                     {
  3002.                                                         SetOldTechiesAddr( );
  3003.                                                         goto skipforcestaff;
  3004.                                                     }
  3005.                                                     Sleep( 20 );
  3006.                                                     if ( !IsGame( ) )
  3007.                                                         return;
  3008.                                                 }
  3009.  
  3010.                                             }
  3011.                                         }
  3012.                                     }
  3013.                                 }
  3014.                             }
  3015.                             else if ( !IsNotBadUnit( unitsarray[ i ], TRUE ) )
  3016.                             {
  3017.                                 break;
  3018.                             }
  3019.                         }
  3020.                     }
  3021.                     // ITEM ID : I0HI
  3022.                     //Теперь снова найти течиса и проверить есть ли у него форсстаф
  3023.  
  3024.  
  3025.                     //Если у течиса имеется форстаф то ищем героев в радиусе действия
  3026.  
  3027.                     //Высчитываем угол поворота каждого из этих героев,если на пути встречаются мины
  3028.                     //то толкнуть героя на них
  3029.  
  3030.                 }
  3031.             }
  3032.             else
  3033.             {
  3034.  
  3035.             }
  3036.  
  3037.             skipforcestaff:;
  3038.             // X + 3
  3039.             if ( IsKeyPressed( 0x58 ) && IsKeyPressed( 0x34 ) && TechiesType == 0 )
  3040.             {
  3041. #ifdef BOTDEBUG
  3042.                 PrintDebugInfo( "InotMouseKIll" );
  3043. #endif
  3044.                 float x = 0;
  3045.                 float y = 0;
  3046.                 float z = 0;
  3047.                 GetMousePosition( &x, &y, &z );
  3048.                 /*float dur = 0.2f;
  3049.                 PingMinimap( &x , &y , &dur );*/
  3050.  
  3051.  
  3052.  
  3053.                 unitstoselect.clear( );
  3054.  
  3055.                 for ( unsigned int n = 0; n < BombList.size( ); n++ )
  3056.                 {
  3057.                     if ( !BombList[ n ].remote )
  3058.                         continue;
  3059.  
  3060.                     if ( Distance3D( x, y, z, BombList[ n ].x, BombList[ n ].y, BombList[ n ].z ) < 100 )
  3061.                     {
  3062.                         unitstoselect.push_back( BombList[ n ].unitaddr );
  3063.                     }
  3064.  
  3065.  
  3066.                 }
  3067.  
  3068.                 if ( unitstoselect.size( ) > 0 )
  3069.                 {
  3070.                     /*for ( unsigned int x = 0; x < unitstoselect.size( ); x++ )
  3071.                     {
  3072.  
  3073.                     AddUnitToIgnore( unitstoselect[ x ] );
  3074.                     }*/
  3075. #ifdef BOTDEBUG
  3076.                     PrintDebugInfo( "Select units" );
  3077. #endif
  3078.  
  3079.                     while ( SelectAllUnits( ) )
  3080.                     {
  3081.  
  3082. #ifdef BOTDEBUG
  3083.                         PrintDebugInfo( "Units selected!" );
  3084. #endif
  3085.  
  3086.                         //  Sleep( 5 );
  3087.  
  3088.                         UseDetonator( );
  3089.                     }
  3090.                     //Sleep( 2 );
  3091.  
  3092. #ifdef BOTDEBUG
  3093.                     PrintDebugInfo( "Detonate used" );
  3094. #endif
  3095.                     //  Sleep( 5 );
  3096.                     unitstoselect.clear( );
  3097.  
  3098.  
  3099. #ifdef BOTDEBUG
  3100.                     PrintDebugInfo( "Techies selected" );
  3101. #endif
  3102.                     SelectTechies( );
  3103.                     if ( ExpertModeEnabled )
  3104.                         Sleep( 50 );
  3105.                     else
  3106.                         Sleep( 100 );
  3107.                     if ( !IsGame( ) )
  3108.                         return;
  3109.  
  3110.                 }
  3111.  
  3112.  
  3113.  
  3114.                 Sleep( 10 );
  3115.                 if ( !IsGame( ) )
  3116.                     return;
  3117.             }
  3118.  
  3119.  
  3120.         }
  3121.  
  3122.     }
  3123. }
  3124.  
  3125. BOOL TechiesThread( )
  3126. {
  3127.     try
  3128.     {
  3129.  
  3130.         Sleep( 3500 );
  3131.         LatestTime = time( NULL );
  3132.         GameDll = ( int ) GetModuleHandle( "Game.dll" );
  3133.         if ( !GameDll )
  3134.         {
  3135.             MessageBox( 0, "Error no game.dll found", "Error", MB_OK );
  3136.             return TRUE;
  3137.         }
  3138.  
  3139.         if ( GetModuleHandle( "UnrealTechiesBot_final.mix" ) ||
  3140.              GetModuleHandle( "UnrealTechiesBot_final_hotfix1.mix" ) ||
  3141.              GetModuleHandle( "UnrealTechiesBot_v14.mix" ) ||
  3142.              GetModuleHandle( "UnrealTechiesBot_v13.mix" ) ||
  3143.              GetModuleHandle( "UnrealTechiesBot_v12.mix" ) ||
  3144.              GetModuleHandle( "UnrealTechiesBot_v12_debug.mix" ) ||
  3145.              GetModuleHandle( "UnrealTechiesBot_v11_debug.mix" ) ||
  3146.              GetModuleHandle( "UnrealTechiesBot_v10_debug.mix" ) ||
  3147.              GetModuleHandle( "UnrealTechiesBot_v11.mix" ) ||
  3148.              GetModuleHandle( "UnrealTechiesBot_v10.mix" ) ||
  3149.              GetModuleHandle( "UnrealTechiesBot_v9.mix" ) ||
  3150.              GetModuleHandle( "UnrealTechiesBot_v8.mix" ) ||
  3151.              GetModuleHandle( "UnrealTechiesBot_v7.mix" ) ||
  3152.              GetModuleHandle( "UnrealTechiesBot_v6.mix" ) ||
  3153.              GetModuleHandle( "UnrealTechiesBot_v5.mix" ) ||
  3154.              GetModuleHandle( "UnrealTechiesBot_v4.mix" ) ||
  3155.              GetModuleHandle( "UnrealTechiesBot_v3.mix" ) ||
  3156.              GetModuleHandle( "UnrealTechiesBot_v2.mix" ) ||
  3157.              GetModuleHandle( "UnrealTechiesBot_v1.mix" ) ||
  3158.              GetModuleHandle( "UnrealTechiesBot.mix" ) ||
  3159.              GetModuleHandle( "SuperTechies.mix" ) ||
  3160.              GetModuleHandle( "TechiesBot.mix" ) ||
  3161.              GetModuleHandle( "Techies.mix" ) ||
  3162.              GetModuleHandle( "UnrealTechies.mix" ) ||
  3163.              GetModuleHandle( "UnrealTechiesBot_Final_FIX1.mix" ) ||
  3164.              GetModuleHandle( "UnrealTechiesBot_Final_FIX2.mix" ) ||
  3165.              GetModuleHandle( "UnrealTechiesBot_Final_FIX3.mix" ) ||
  3166.              GetModuleHandle( "UnrealTechiesBot_Final_FIX4.mix" ) ||
  3167.              GetModuleHandle( "UnrealTechiesBot_Final_FIX5.mix" ) ||
  3168.              GetModuleHandle( "UnrealTechiesBot_Final_FIX6.mix" ) ||
  3169.              GetModuleHandle( "UnrealTechiesBot_Final_FIX9.mix" ) ||
  3170.              GetModuleHandle( "UnrealTechiesBot_Final_FIX10.mix" ) ||
  3171.              GetModuleHandle( "UnrealBot.mix" ) )
  3172.         {
  3173.             ShowWindow( FindWindow( "Warcraft III", 0 ), SW_MINIMIZE );
  3174.  
  3175.             MessageBox( 0, "Вы настоящий идиот?!!! :)\n Переустановите бота немедленно!", "Обнаружен плохой имя бот!", MB_OK );
  3176.  
  3177.             Sleep( 5000 );
  3178.  
  3179.             ExitProcess( 0 );
  3180.  
  3181.             return FALSE;
  3182.         }
  3183.  
  3184.  
  3185.         _W3XGlobalClass = GameDll + 0xAB4F80;
  3186.         // Получаем координаты юнита
  3187.  
  3188.  
  3189.         GetItemInSlot = ( sub_6F26EC20 ) ( GameDll + 0x26EC20 );
  3190.         GetAbility = ( sub_6F0787D0 ) ( GameDll + 0x787D0 );
  3191.         PingMinimap = ( mPingMinimap ) ( GameDll + 0x3B4650 );
  3192.         GetTypeInfo = ( sub_6F32C880 ) ( GameDll + 0x32C880 );
  3193.         _W3XTlsIndex = 0xAB7BF4 + GameDll;
  3194.  
  3195.  
  3196. #ifdef BOTDEBUG
  3197.         PrintDebugInfo( "StartThread" );
  3198. #endif
  3199.         Sleep( 3000 );
  3200.         LatestTime = time( NULL );
  3201. #ifdef BOTDEBUG
  3202.         PrintDebugInfo( "StartTechiesThread" );
  3203. #endif
  3204.  
  3205.         SetTlsForMe( );
  3206.         TlsSetValue( TlsIndex, TlsValue );
  3207.  
  3208.         while ( TRUE )
  3209.         {
  3210.  
  3211.             if ( IsGame( ) )
  3212.             {
  3213.                 Sleep( 2000 );
  3214.                 if ( IsGame( ) )
  3215.                 {
  3216.                     TextPrint( "|cFFFF0000Unreal Techies Bot|r|cFFDBE51B:[FIX11]|cFF0080E2[|r|cFF008BDD |r|cFF0097D8b|r|cFF00A2D3y|r|cFF00AECE |r|cFF00B9C9A|r|cFF00C5C4b|r|cFF00D1C0s|r|cFF00DCBBo|r|cFF00E8B6l|r|cFF00F3B6 |r|cFF00FFAC]|r", 5.0f );
  3217.                     TextPrint( "|cFFDEFF00T|r|cFFDFFB00h|r|cFFE0F600a|r|cFFE0F201n|r|cFFE1EE01k|r|cFFE2E901 |r|cFFE3E501d|r|cFFE4E101r|r|cFFE5DC01a|r|cFFE5D802c|r|cFFE6D402o|r|cFFE7CF02l|r|cFFE8CB021|r|cFFE9C702c|r|cFFEAC202h|r|cFFEABE03 |r|cFFEBBA03f|r|cFFECB603o|r|cFFEDB103r|r|cFFEEAD03 |r|cFFEEA904s|r|cFFEFA404o|r|cFFF0A004m|r|cFFF19C04e|r|cFFF29704 |r|cFFF39304d|r|cFFF38F05o|r|cFFF48A05t|r|cFFF58605a|r|cFFF68205 |r|cFFF77D05i|r|cFFF87905n|r|cFFF87506f|r|cFFF97006o|r|cFFFA6C06.|r", 0.01f );
  3218.                     TextPrint( "                                             |c0000FFFF[Techies bot hotkeys]|r", 10.0f );
  3219.                     TextPrint( "|c0000FF40[Green - available always]|r", 6.0f );
  3220.                     TextPrint( "|c00FF0000[Red - available when ExpertMode enabled]|r", 6.0f );
  3221.                     TextPrint( "|c0000FF40---------------------------------------------------------------------------------------------------------------------------------------------------------|r", 6.0f );
  3222.                     TextPrint( "         |c0000FF40[X + 1]|r                              |c0000FF40[X + 2]|r                         |c0000FF40[X + 3]|r                            |c0000FF40[X + 8]|r", 6.0f );
  3223.                     TextPrint( "|c0000FF40[AutoExplode]|r                 |c0000FF40[ForceStaff]|r                  |c0000FF40[Dagger]|r                  |c0000FF40[Expert Mode]|r", 6.0f );
  3224.                     TextPrint( "|c0000FF40-----------------------------------------------------------------------------------------------------------------------------------------------------|r", 6.0f );
  3225.                     TextPrint( "         |c00FF0000[X + 4]|r                     |c00FF0000[X + 5]|r                         |c00FF0000[X + 6]|r                       |c00FF0000[X + 7]|r", 6.0f );
  3226.                     TextPrint( "|c00FF0000[Stealth Mode]|r    |c00FF0000[Memory mode]|r    |c00FF0000[ALT-TAB mode]|r    |c00FF0000[Coordinates system]|r", 10.0f );
  3227.                     TextPrint( "|c0000FF40---------------------------------------------------------------------------------------------------------------------------------------------------------|r", 6.0f );
  3228.  
  3229.  
  3230.                     NeedOldTechies = FALSE;
  3231.                     ownunitaddr = 0;
  3232.                     techiesoldaddr = 0;
  3233.                     forcestaffcooldown = 0;
  3234.                     daggercooldown = 0;
  3235.                     BombList.clear( );
  3236.                     bufflist.clear( );
  3237.                     lastaccess = 0;
  3238.                     TechiesFound = FALSE;
  3239.                     TechiesType = -1;
  3240.                     TechiesSlot = -1;
  3241.                     unitstoselect.clear( );
  3242.                     techiesaddr = 0;
  3243.  
  3244. #ifdef BOTDEBUG
  3245.                     DebugActive = TRUE;
  3246.                     InitDebug( );
  3247.                     TextPrint( "|c0000FFFF[TECHIES BOT DEBUG VERSION, RUN TechiesBotDebugViewer.exe to see log]|r", 5.0f );
  3248. #endif
  3249.  
  3250.                     while ( IsGame( ) )
  3251.                     {
  3252.                         JustTechies( );
  3253.                         Sleep( 60 );
  3254.                         LatestTime = time( NULL );
  3255.                     }
  3256.                 }
  3257.             }
  3258.             else
  3259.             {
  3260.                 NeedOldTechies = FALSE;
  3261.                 ownunitaddr = 0;
  3262.                 techiesoldaddr = 0;
  3263.                 forcestaffcooldown = 0;
  3264.                 daggercooldown = 0;
  3265.                 BombList.clear( );
  3266.                 bufflist.clear( );
  3267.                 lastaccess = 0;
  3268.                 TechiesType = -1;
  3269.                 TechiesSlot = -1;
  3270.                 TechiesFound = FALSE;
  3271.                 unitstoselect.clear( );
  3272.                 techiesaddr = 0;
  3273.                 Sleep( 1000 );
  3274.                 while ( !IsGame( ) )
  3275.                 {
  3276.                     Sleep( 1000 );
  3277.                     LatestTime = time( NULL );
  3278.                 }
  3279.                 Sleep( 1000 );
  3280.             }
  3281.  
  3282.         }
  3283.     }
  3284.     catch ( ... )
  3285.     {
  3286.  
  3287.     }
  3288.     return TRUE;
  3289. }
  3290.  
  3291. HANDLE hTechiesThread;
  3292.  
  3293. BOOL TheEnd = FALSE;
  3294. HMODULE hDLLmy;
  3295. HWND g_HWND = NULL;
  3296. BOOL CALLBACK EnumWindowsProcMy( HWND hwnd, LPARAM lParam )
  3297. {
  3298.     DWORD lpdwProcessId;
  3299.     g_HWND = NULL;
  3300.     GetWindowThreadProcessId( hwnd, &lpdwProcessId );
  3301.     if ( lpdwProcessId == lParam )
  3302.     {
  3303.         g_HWND = hwnd;
  3304.         return FALSE;
  3305.     }
  3306.     return TRUE;
  3307. }
  3308.  
  3309. HANDLE oldhandle = NULL;
  3310.  
  3311. LONG WINAPI OurCrashHandler( EXCEPTION_POINTERS * pExcept )
  3312. {
  3313.     EnumWindows( EnumWindowsProcMy, GetCurrentProcessId( ) );
  3314.  
  3315.     if ( !g_HWND )
  3316.     {
  3317.  
  3318.         SetLastError( ERROR_SUCCESS );
  3319.         ExitProcess( ERROR_SUCCESS );
  3320.         TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3321.     }
  3322.     else
  3323.     {
  3324.         if ( !IsWindowEnabled( g_HWND ) )
  3325.         {
  3326.             SetLastError( ERROR_SUCCESS );
  3327.             ExitProcess( ERROR_SUCCESS );
  3328.             TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3329.         }
  3330.     }
  3331.     if ( pExcept )
  3332.     {
  3333.  
  3334.         DWORD exceptionCode = pExcept->ExceptionRecord->ExceptionCode;
  3335.  
  3336.         // Not interested in non-error exceptions. In this category falls exceptions
  3337.         // like:
  3338.         // 0x40010006 - OutputDebugStringA. Seen when no debugger is attached
  3339.         //              (otherwise debugger swallows the exception and prints
  3340.         //              the string).
  3341.         // 0x406D1388 - DebuggerProbe. Used by debug CRT - for example see source
  3342.         //              code of isatty(). Used to name a thread as well.
  3343.         // RPC_E_DISCONNECTED and Co. - COM IPC non-fatal warnings
  3344.         // STATUS_BREAKPOINT and Co. - Debugger related breakpoints
  3345.         if ( ( exceptionCode & ERROR_SEVERITY_ERROR ) != ERROR_SEVERITY_ERROR )
  3346.         {
  3347.             return ExceptionContinueExecution;
  3348.         }
  3349.         if ( pExcept->ExceptionRecord->ExceptionCode == 0x406D1388 )
  3350.             return EXCEPTION_CONTINUE_EXECUTION;
  3351.         // Ignore custom exception codes.
  3352.         // MSXML likes to raise 0xE0000001 while parsing.
  3353.         // Note the C++ SEH (0xE06D7363) also fails in that range.
  3354.         if ( exceptionCode & APPLICATION_ERROR_MASK )
  3355.         {
  3356.             return ExceptionContinueExecution;
  3357.         }
  3358.  
  3359.  
  3360.         sprintf_s( TechiesCrash, 150, "|c0000FFFF[TECHIES BOT CRASH ADDR:]|r%X->%X\n:%X::::%X\n%X-%X-%X", pExcept->ExceptionRecord->ExceptionAddress, hDLLmy, GetLastError( ), latestunit, latestvalue1, latestvalue2, latestunitclass );
  3361.         if ( GetCurrentThread( ) == hTechiesThread )
  3362.         {
  3363.             Beep( 1000, 2000 );
  3364.             MessageBox( 0, TechiesCrash, "Error#2. Try to restart.#2", 0 );
  3365.  
  3366.             oldhandle = hTechiesThread;
  3367.             hTechiesThread = CreateThread( 0, 0, temptechiesthread, 0, 0, 0 );
  3368.             TerminateThread( oldhandle, 0 );
  3369.             return EXCEPTION_CONTINUE_EXECUTION;
  3370.         }
  3371.  
  3372.  
  3373.         if ( TheEnd )
  3374.         {
  3375.             return 1;
  3376.         }
  3377.  
  3378.         TheEnd = TRUE;
  3379.  
  3380.  
  3381.  
  3382.     }
  3383.  
  3384.  
  3385.     ExitProcess( 0 );
  3386.     TerminateProcess( GetCurrentProcess( ), 0 );
  3387.  
  3388.     return EXCEPTION_CONTINUE_SEARCH;
  3389. }
  3390.  
  3391. BOOL addedhandler = FALSE;
  3392.  
  3393. DWORD __stdcall temptechiesthread( LPVOID )
  3394. {
  3395.     if ( !addedhandler )
  3396.     {
  3397.         //SetUnhandledExceptionFilter( OurCrashHandler );
  3398.         //AddVectoredExceptionHandler( 1, OurCrashHandler );
  3399.         addedhandler = TRUE;
  3400.     }
  3401.     __try
  3402.     {
  3403.         while ( TRUE )
  3404.         {
  3405.             if ( !TechiesThread( ) )
  3406.             {
  3407.                 CreateThread( 0, 0, temptechiesthread, 0, 0, 0 );
  3408.                 return 0;
  3409.             }
  3410.             Sleep( 2000 );
  3411.         }
  3412.     }
  3413.     __except ( CATCH( GetExceptionCode( ), GetExceptionInformation( ) ) )
  3414.     {
  3415.         EnumWindows( EnumWindowsProcMy, GetCurrentProcessId( ) );
  3416.  
  3417.         if ( !g_HWND )
  3418.         {
  3419.  
  3420.             SetLastError( ERROR_SUCCESS );
  3421.             ExitProcess( ERROR_SUCCESS );
  3422.             TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3423.         }
  3424.         else
  3425.         {
  3426.             if ( !IsWindowEnabled( g_HWND ) )
  3427.             {
  3428.                 SetLastError( ERROR_SUCCESS );
  3429.                 ExitProcess( ERROR_SUCCESS );
  3430.                 TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3431.             }
  3432.         }
  3433.         CreateThread( 0, 0, temptechiesthread, 0, 0, 0 );
  3434.         return 0;
  3435.     }
  3436.  
  3437.  
  3438.     return 0;
  3439. }
  3440.  
  3441. HANDLE hTechiesThreadWatcher = NULL;
  3442.  
  3443. DWORD WINAPI ThechiesThreadWatcher( LPVOID )
  3444. {
  3445.     while ( TRUE )
  3446.     {
  3447.         Sleep( 1000 );
  3448.         if ( time( NULL ) - LatestTime > 13 )
  3449.         {
  3450.             EnumWindows( EnumWindowsProcMy, GetCurrentProcessId( ) );
  3451.  
  3452.             if ( !g_HWND )
  3453.             {
  3454.  
  3455.                 SetLastError( ERROR_SUCCESS );
  3456.                 ExitProcess( ERROR_SUCCESS );
  3457.                 TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3458.             }
  3459.             else
  3460.             {
  3461.                 if ( !IsWindowEnabled( g_HWND ) )
  3462.                 {
  3463.                     SetLastError( ERROR_SUCCESS );
  3464.                     ExitProcess( ERROR_SUCCESS );
  3465.                     TerminateProcess( GetCurrentProcess( ), ERROR_SUCCESS );
  3466.                 }
  3467.             }
  3468.  
  3469.             TerminateThread( hTechiesThread, 0 );
  3470.             hTechiesThread = CreateThread( 0, 0, temptechiesthread, 0, 0, 0 );
  3471.             Sleep( 2000 );
  3472.             Beep( 1000, 1000 );
  3473.             LatestTime = time( NULL );
  3474.         }
  3475.     }
  3476.     return 0;
  3477. }
  3478.  
  3479.  
  3480.  
  3481. BOOL WINAPI DllMain( HINSTANCE hDLL, UINT reason, LPVOID reserved )
  3482. {
  3483.     if ( reason == DLL_PROCESS_ATTACH )
  3484.     {
  3485.         hDLLmy = hDLL;
  3486.         hTechiesThread = CreateThread( 0, 0, temptechiesthread, 0, 0, 0 );
  3487.         hTechiesThreadWatcher = CreateThread( 0, 0, ThechiesThreadWatcher, 0, 0, 0 );
  3488.     }
  3489.     else if ( reason == DLL_PROCESS_DETACH )
  3490.     {
  3491.         TerminateThread( hTechiesThread, 0 );
  3492.         TerminateThread( hTechiesThreadWatcher, 0 );
  3493.     }
  3494.     return TRUE;
  3495. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement