Advertisement
keybode

dota 2 stuff

May 16th, 2014
657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.52 KB | None | 0 0
  1. // SDK.h
  2. #ifndef SDK_H
  3. #define SDK_H
  4.  
  5. #include "Math.h"
  6. #include "WinCustom.h"
  7. #include "CRC32.h"
  8.  
  9. #include "dt_recv.h"
  10.  
  11. typedef void* (*CreateInterfaceFn)( const char*, int* );
  12.  
  13. #undef CreateFont
  14.  
  15. class CBaseEntity;
  16. class CBaseWeapon;
  17.  
  18. class CGlobalVarsBase
  19. {
  20. public:
  21.     float   realtime;
  22.     int     framecount;
  23.     float   absoluteframetime;
  24.     float   curtime;
  25.     float   frametime;
  26.     int     maxClients;
  27.     int     tickcount;
  28.     float   interval_per_tick;
  29.     float   interpolation_amount;
  30.     int     simTicksThisFrame;
  31.     int     network_protocol;
  32. };
  33.  
  34. class ClientClass
  35. {
  36. public:
  37.     unsigned char   __pad0[ 0x8 ];
  38.  
  39.     const char*     m_pNetworkName;
  40.     RecvTable*      m_pRecvTable;
  41.     ClientClass*    m_pNext;
  42.     int             m_iClassID;
  43. };
  44.  
  45. class IBaseClientDLL
  46. {
  47. public:
  48.     ClientClass* GetAllClasses ()
  49.     {
  50.         typedef ClientClass* (__thiscall* GetAllClassesFn)( void* );
  51.         return GetMethod< GetAllClassesFn > ( this, 7 )( this );
  52.     }
  53. };
  54.  
  55. class IClientEntityList
  56. {
  57. public:
  58.     CBaseEntity* GetClientEntity ( int nIndex )
  59.     {
  60.         typedef CBaseEntity* (__thiscall* GetClientEntityFn)( void*, int );
  61.         return GetMethod< GetClientEntityFn > ( this, 3 )( this, nIndex );
  62.     }
  63.  
  64.     CBaseEntity* GetClientEntityFromHandle ( int nHandle )
  65.     {
  66.         typedef CBaseEntity* (__thiscall* GetClientEntityFromHandleFn)( void*, int );
  67.         return GetMethod< GetClientEntityFromHandleFn > ( this, 4 )( this, nHandle );
  68.     }
  69.  
  70.     int GetHighestEntityIndex ()
  71.     {
  72.         typedef int (__thiscall* GetHighestEntityIndexFn)( void* );
  73.         return GetMethod< GetHighestEntityIndexFn > ( this, 6 )( this );
  74.     }
  75. };
  76.  
  77. class IVEngineClient
  78. {
  79. public:
  80.     void GetScreenSize ( int& width, int& height )
  81.     {
  82.         typedef void (__thiscall* GetScreenSizeFn)( void*, int&, int& );
  83.         GetMethod< GetScreenSizeFn > ( this, 5 )( this, width, height );
  84.     }
  85.  
  86.     int GetLocalPlayer ()
  87.     {
  88.         typedef int (__thiscall* GetLocalPlayerFn)( void* );
  89.         return GetMethod< GetLocalPlayerFn > ( this, 12 )( this );
  90.     }
  91.  
  92.     void GetViewAngles ( QAngle& va )
  93.     {
  94.         typedef void (__thiscall* GetViewAnglesFn)( void*, QAngle& );
  95.         GetMethod< GetViewAnglesFn > ( this, 19 )( this, va );
  96.     }
  97.  
  98.     void SetViewAngles( QAngle& va )
  99.     {
  100.         typedef void (__thiscall* SetViewAnglesFn)( void*, QAngle& );
  101.         GetMethod< SetViewAnglesFn > ( this, 20 )( this, va );
  102.     }
  103.  
  104.     int GetMaxClients ( void )
  105.     {
  106.         typedef int (__thiscall* GetMaxClientsFn)( void* );
  107.         return GetMethod< GetMaxClientsFn > ( this, 21 )( this );
  108.     }
  109.  
  110.     const VMatrix& WorldToScreenMatrix ( uintptr_t engine )
  111.     {
  112.         uintptr_t dwMatrix = (((0x1C8 * *(int*)(engine + 0x72B608)) + *(uintptr_t*)(engine + 0x72B5FC)) - 0x44);
  113.         return *(VMatrix*)dwMatrix;
  114.     }
  115. };
  116.  
  117. class IVDebugOverlay
  118. {
  119. public:
  120.     int ScreenPosition ( const Vector& point, Vector& screen )
  121.     {
  122.         typedef int (__thiscall* ScreenPositionFn)( void*, const Vector&, Vector& );
  123.         return GetMethod< ScreenPositionFn > ( this, 13 )( this, point, screen );
  124.     }
  125. };
  126.  
  127. #endif // SDK_H
  128.  
  129. // Entity.h
  130. #ifndef ENTITY_H
  131. #define ENTITY_H
  132.  
  133. #include "SDK.h"
  134.  
  135. class CDotaAbility
  136. {
  137. public:
  138.     float GetCooldown ( void );
  139. };
  140.  
  141. class CBaseEntity
  142. {
  143. public:
  144.     bool            IsIllusion ( void );
  145.     bool            IsDormant ( void );
  146.  
  147.     int         GetHealth ( void );
  148.     int         GetMaxHealth ( void );
  149.     int         GetIndex ( void );
  150.     int         GetTeamNum ( void );
  151.  
  152.     float           GetMana ( void );
  153.     float           GetMaxMana ( void );
  154.  
  155.     Vector          GetOrigin ( void );
  156.  
  157.     ClientClass*        GetClientClass ( void );
  158.     CDotaAbility*       GetUltAbility ( void );
  159.  
  160.     void            GetRenderBounds ( Vector& min, Vector& max );
  161. };
  162.  
  163. #endif // ENTITY_H
  164.  
  165. // Entity.cpp
  166. #include "Entity.h"
  167. #include "HL2.h"
  168.  
  169. float CDotaAbility::GetCooldown ( void )
  170. {
  171.     return *(float*)( this + HL2::NetVar::Ability::m_fCooldown );
  172. }
  173.  
  174. bool CBaseEntity::IsIllusion ( void )
  175. {
  176.     return (bool)( *(uintptr_t*)( this + HL2::NetVar::Entity::m_hReplicatingOtherHeroModel ) );
  177. }
  178.  
  179. bool CBaseEntity::IsDormant ( void )
  180. {
  181.     void* pNetworkable = (void*)( this + 0x8 );
  182.     typedef bool (__thiscall* IsDormantFn)( void* );
  183.     return GetMethod< IsDormantFn > ( pNetworkable, 8 )( pNetworkable );
  184. }
  185.  
  186. int CBaseEntity::GetHealth ( void )
  187. {
  188.     return *(int*)( this + HL2::NetVar::Entity::m_iHealth );
  189. }
  190.  
  191. int CBaseEntity::GetMaxHealth ( void )
  192. {
  193.     return *(int*)( this + HL2::NetVar::Entity::m_iMaxHealth );
  194. }
  195.  
  196. int CBaseEntity::GetIndex ( void )
  197. {
  198.     void* pNetworkable = (void*)( this + 0x8 );
  199.     typedef bool (__thiscall* GetIndexFn)( void* );
  200.     return GetMethod< GetIndexFn > ( pNetworkable, 9 )( pNetworkable );
  201. }
  202.  
  203. int CBaseEntity::GetTeamNum ( void )
  204. {
  205.     typedef int (__thiscall* GetTeamNumFn)( void* );
  206.     return GetMethod< GetTeamNumFn > ( this, 89 )( this );
  207. }
  208.  
  209. float CBaseEntity::GetMana ( void )
  210. {
  211.     return *(float*)( this + HL2::NetVar::Entity::m_flMana );
  212. }
  213.  
  214. float CBaseEntity::GetMaxMana ( void )
  215. {
  216.     return *(float*)( this + HL2::NetVar::Entity::m_flMaxMana );
  217. }
  218.  
  219. Vector CBaseEntity::GetOrigin ( void )
  220. {
  221.     typedef Vector& (__thiscall* GetOriginFn)( void* );
  222.     return GetMethod< GetOriginFn > ( this, 11 )( this );
  223. }
  224.  
  225. ClientClass* CBaseEntity::GetClientClass ( void )
  226. {
  227.     void* pNetworkable = (void*)( this + 0x8 );
  228.     typedef ClientClass* (__thiscall* GetClientClassFn)( void* );
  229.     return GetMethod< GetClientClassFn > ( pNetworkable, 2 )( pNetworkable );
  230. }
  231.  
  232. CDotaAbility* CBaseEntity::GetUltAbility ( void )
  233. {
  234.     int handle = *(int*)( this + HL2::NetVar::Entity::m_hAbilities + 5 * 4 );
  235.  
  236.     if ( handle )
  237.         return (CDotaAbility*)HL2::m_pEntList->GetClientEntityFromHandle ( handle );
  238.  
  239.     handle = *(int*)( this + HL2::NetVar::Entity::m_hAbilities + 4 * 4 );
  240.  
  241.     if ( handle )
  242.         return (CDotaAbility*)HL2::m_pEntList->GetClientEntityFromHandle ( handle );
  243.  
  244.     handle = *(int*)( this + HL2::NetVar::Entity::m_hAbilities + 3 * 4 );
  245.  
  246.     if ( handle )
  247.         return (CDotaAbility*)HL2::m_pEntList->GetClientEntityFromHandle ( handle );
  248.  
  249.     return 0;
  250. }
  251.  
  252. void CBaseEntity::GetRenderBounds ( Vector& min, Vector& max )
  253. {
  254.     void* pRenderable = (void*)( this + 0x4 );
  255.     typedef void (__thiscall* GetRenderBoundsFn)( void*, Vector&, Vector& );
  256.     GetMethod< GetRenderBoundsFn > ( this, 20 )( this, min, max );
  257. }
  258.  
  259. // netvars
  260. Entity::m_iHealth = GetNetVar ( "DT_DOTA_BaseNPC", "m_iHealth", 0 );
  261. Entity::m_iMaxHealth = GetNetVar ( "DT_DOTA_BaseNPC", "m_iMaxHealth", 0 );
  262. Entity::m_flMana = GetNetVar ( "DT_DOTA_BaseNPC", "m_flMana", 0 );
  263. Entity::m_flMaxMana = GetNetVar ( "DT_DOTA_BaseNPC", "m_flMaxMana", 0 );
  264. Entity::m_hReplicatingOtherHeroModel = GetNetVar ( "DT_DOTA_BaseNPC_Hero", "m_hReplicatingOtherHeroModel", 0 );
  265. Entity::m_hAbilities = GetNetVar ( "DT_DOTA_BaseNPC", "m_hAbilities", 0 );
  266.  
  267. Ability::m_fCooldown = GetNetVar ( "DT_DOTABaseAbility", "m_fCooldown", 0 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement