1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
#pragma once
#include "vector.hpp"
#include "VFunc.h"
#include "dt_common.h"
#include "dt_recv.h"
#include "search.h"
#include "util.hpp"
#include "ClientClass.h"
using matrix3x4 = float[ 3 ][ 4 ];
class bf_read;
class ICollideable;
class IClientNetworkable;
class IClientRenderable;
class IClientThinkable;
class IClientEntity;
class IClientAlphaProperty;
class IClientUnknown {
public:
virtual ICollideable* GetCollideable( ) = 0;
virtual IClientNetworkable* GetClientNetworkable( ) = 0;
virtual IClientRenderable* GetClientRenderable( ) = 0;
virtual IClientEntity* GetIClientEntity( ) = 0;
virtual IClientEntity* GetBaseEntity( ) = 0;
virtual IClientThinkable* GetClientThinkable( ) = 0;
//virtual IClientModelRenderable* GetClientModelRenderable() = 0;
virtual IClientAlphaProperty* GetClientAlphaProperty( ) = 0;
};
class IClientNetworkable {
public:
virtual IClientUnknown* GetIClientUnknown( ) = 0;
virtual void Release( ) = 0;
virtual client_class_t* GetClientClass( ) = 0;
virtual void NotifyShouldTransmit( int state ) = 0;
virtual void OnPreDataChanged( int updateType ) = 0;
virtual void OnDataChanged( int updateType ) = 0;
virtual void PreDataUpdate( int updateType ) = 0;
virtual void PostDataUpdate( int updateType ) = 0;
virtual void OnDataUnchangedInPVS( void ) = 0;
virtual bool IsDormant( void ) = 0;
virtual int EntIndex( void ) const = 0;
virtual void ReceiveMessage( int classID, bf_read& msg ) = 0;
virtual void* GetDataTableBasePtr( ) = 0;
virtual void SetDestroyedOnRecreateEntities( void ) = 0;
};
class IClientEntity {
public:
void* get_client_renderable( ) {
return reinterpret_cast< void* >( this + 0x4 );
}
IClientNetworkable* get_client_networkable( ) {
return reinterpret_cast< IClientNetworkable* >( this + 0x8 );
}
public:
uintptr_t get_ehandle( ) {
return call_vfunc< uintptr_t( __thiscall* )( void* ) >( this, 1 )( this );
}
bool setup_bones( matrix3x4* bonetoworld, int maxbones, long bonemask, float curtime ) {
return call_vfunc< bool( __thiscall* )( void*, matrix3x4*, int, long, float ) >( get_client_renderable( ), 16 )( get_client_renderable( ), bonetoworld, maxbones, bonemask, curtime );
}
int DrawModel( int flags, uint8_t alpha ) {
using fn = int( __thiscall* )( void*, int, uint8_t );
return util::get_vfunc< fn >( this->get_client_renderable( ), 9 )( this->get_client_renderable( ), flags, alpha );
}
vec3_t& get_render_origin( ) {
using fn = vec3_t & ( __thiscall* )( void* );
return util::get_vfunc< fn >( this, 10 )( this );
}
vec3_t& get_abs_origin( ) {
return call_vfunc< vec3_t&( __thiscall* )( void* ) >( this, 9 )( this );
}
vec3_t& get_abs_angles( ) {
return call_vfunc< vec3_t&( __thiscall* )( void* ) >( this, 10 )( this );
}
void* get_model( ) {
return call_vfunc< void*( __thiscall* )( void* ) >( get_client_renderable( ), 9 )( get_client_renderable( ) );
}
client_class_t* get_client_class( ) {
return call_vfunc< client_class_t*( __thiscall* )( void* ) >( get_client_networkable( ), 2 )( get_client_networkable( ) );
}
bool is_dormant( ) {
return call_vfunc< bool( __thiscall * )( void * ) >( get_client_networkable( ), 8 )( get_client_networkable( ) );
}
int index( ) {
return call_vfunc< int( __thiscall* )( void* ) >( get_client_networkable( ), 9 )( get_client_networkable( ) );
}
void update_glow_effect( ) {
//static auto fn = pattern::first_code_match< void( __thiscall* )( void* ) >( GetModuleHandleA( "client.dll" ), "8B 06 8D 4D F4 57 51 8D 4D F8", -0x2c );
//if ( fn ) fn( this );
return call_vfunc< void( __thiscall* )( void* ) >( this, 226 )( this );
}
void destroy_glow_effect( ) {
//static auto fn_offset = pattern::first_code_match< intptr_t >( GetModuleHandleA( "client.dll" ), "E8 ? ? ? ? 8B 9F ? ? ? ? 85 DB 74 3D 8B 33" );
//static auto fn = reinterpret_cast< void( __thiscall* )( void* ) >( fn_offset + 5 + *( intptr_t* )( fn_offset + 1 ) );
//if ( fn ) fn( this );
return call_vfunc< void( __thiscall* )( void* ) >( this, 227 )( this );
}
client_class_t* GetClientClass( ) {
using fn = client_class_t* ( __thiscall* )( void* );
return util::get_vfunc< fn >( get_client_networkable( ), 2 )( this );
/*
try {
return get_client_networkable( )->GetClientClass( );
}
catch( ... ) {
return 0;
}*/
}
public:
template< typename T = uintptr_t >
__forceinline T& get( std::ptrdiff_t offset = 0 ) {
return( *reinterpret_cast< T* >( ( uintptr_t )this + offset ) );
}
template< std::ptrdiff_t offset, typename T = uintptr_t >
__forceinline T& get( ) {
return( *reinterpret_cast< T* >( ( uintptr_t )this + offset ) );
}
template< typename T = uintptr_t >
__forceinline T at( std::ptrdiff_t offset = 0 ) {
return( reinterpret_cast< T >( uintptr_t( this ) + offset ) );
}
template< std::ptrdiff_t offset, typename T = uintptr_t >
__forceinline T at( ) {
return( reinterpret_cast< T >( uintptr_t( this ) + offset ) );
}
template < typename t >
t* as( ) {
return reinterpret_cast< t* >( this );
}
};
|