FINISH refactor. Now it's time to find that MemLeak.
This commit is contained in:
parent
16d1d8979f
commit
a32ed831e7
@ -30,4 +30,35 @@
|
||||
#define CON_NAME "cat"
|
||||
#define CON_PREFIX CON_NAME "_"
|
||||
|
||||
#define DEBUG_SEGV false
|
||||
|
||||
#if DEBUG_SEGV == true
|
||||
|
||||
#define SEGV_BEGIN \
|
||||
try {
|
||||
|
||||
#define SEGV_END \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! %s in %s:%d", __func__, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define SEGV_END_INFO(x) \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! (%s)", x); \
|
||||
}
|
||||
|
||||
#define SAFE_CALL(x) \
|
||||
SEGV_BEGIN \
|
||||
x; \
|
||||
SEGV_END_INFO(#x)
|
||||
|
||||
#else
|
||||
|
||||
#define SEGV_BEGIN
|
||||
#define SEGV_END
|
||||
#define SEGV_END_INFO(x)
|
||||
#define SAFE_CALL(x) x
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* COMMON_H_ */
|
||||
|
@ -135,12 +135,12 @@ void colors::Init() {
|
||||
Color colors::EntityB(CachedEntity* ent) {
|
||||
using namespace colors;
|
||||
Color result = Transparent(black);
|
||||
if (IsPlayer(ent->m_pEntity) || IsBuilding(ent->m_pEntity)) {
|
||||
if (ent->m_Type == ENTITY_PLAYER || ent->m_Type == ENTITY_BUILDING) {
|
||||
if (ent->m_iTeam == TEAM_BLU) result = blu_b;
|
||||
else if (ent->m_iTeam == TEAM_RED) result = red_b;
|
||||
|
||||
if (IsPlayer(ent->m_pEntity)) {
|
||||
if (GetRelation(ent->m_pEntity) == relation::DEVELOPER) result = Transparent(black, 0.6f);
|
||||
if (ent->m_Type == ENTITY_PLAYER) {
|
||||
if (GetRelation(ent) == relation::DEVELOPER) result = Transparent(black, 0.6f);
|
||||
}
|
||||
|
||||
if (!ent->m_bIsVisible) result = Transparent(result, 0.833f);
|
||||
@ -152,14 +152,14 @@ Color colors::EntityF(CachedEntity* ent) {
|
||||
using namespace colors;
|
||||
Color result = white;
|
||||
if (ent->m_iClassID == ClassID::CBaseAnimating) {
|
||||
item_type type = GetItemType(ent->m_pEntity);
|
||||
item_type type = GetItemType(ent);
|
||||
if (type != item_null) {
|
||||
if (type >= item_medkit_small && type <= item_medkit_large) {
|
||||
result = green;
|
||||
} else if (type >= item_ammo_small && type <= item_ammo_large) {
|
||||
// White.
|
||||
} else if (type >= item_mp_strength && type <= item_mp_crit) {
|
||||
int skin = ent->m_pEntity->GetSkin();
|
||||
int skin = RAW_ENT(ent)->GetSkin();
|
||||
if (skin == 1) {
|
||||
result = red;
|
||||
} else if (skin == 2) {
|
||||
@ -174,7 +174,7 @@ Color colors::EntityF(CachedEntity* ent) {
|
||||
result = green; // TODO currency pack (red)
|
||||
}
|
||||
|
||||
if (IsProjectile(ent->m_pEntity)) {
|
||||
if (ent->m_Type == ENTITY_PROJECTILE) {
|
||||
if (ent->m_iTeam == TEAM_BLU) result = blu;
|
||||
else if (ent->m_iTeam == TEAM_RED) result = red;
|
||||
if (ent->m_bCritProjectile) {
|
||||
@ -183,11 +183,11 @@ Color colors::EntityF(CachedEntity* ent) {
|
||||
}
|
||||
}
|
||||
|
||||
if (IsPlayer(ent->m_pEntity) || IsBuilding(ent->m_pEntity)) {
|
||||
if (ent->m_Type == ENTITY_PLAYER || ent->m_Type == ENTITY_BUILDING) {
|
||||
if (ent->m_iTeam == TEAM_BLU) result = blu;
|
||||
else if (ent->m_iTeam == TEAM_RED) result = red;
|
||||
if (IsPlayer(ent->m_pEntity)) {
|
||||
if (IsPlayerInvulnerable(ent->m_pEntity)) {
|
||||
if (ent->m_Type == ENTITY_PLAYER) {
|
||||
if (IsPlayerInvulnerable(ent)) {
|
||||
if (ent->m_iTeam == TEAM_BLU) result = blu_u;
|
||||
else if (ent->m_iTeam == TEAM_RED) result = red_u;
|
||||
}
|
||||
@ -195,7 +195,7 @@ Color colors::EntityF(CachedEntity* ent) {
|
||||
if (ent->m_iTeam == TEAM_BLU) result = blu_v;
|
||||
else if (ent->m_iTeam == TEAM_RED) result = red_v;
|
||||
}
|
||||
switch (GetRelation(ent->m_pEntity)) {
|
||||
switch (GetRelation(ent)) {
|
||||
case FRIEND:
|
||||
result = green; break;
|
||||
case RAGE:
|
||||
@ -303,7 +303,7 @@ void draw::DrawString(int x, int y, Color color, Color background, bool center,
|
||||
}
|
||||
draw::GetStringLength((char*)text, l, h);
|
||||
Color clr = background;
|
||||
clr._color[3] = (unsigned char)180;
|
||||
clr[3] = (unsigned char)180;
|
||||
draw::DrawRect(x, y + 1, l + 2, h - 4, clr);
|
||||
draw::DrawString(draw::font_handle, x, y, color, string);
|
||||
}
|
||||
@ -320,12 +320,12 @@ void draw::DrawString(int x, int y, Color color, const char* text, ...) {
|
||||
draw::DrawString(draw::font_handle, x, y, color, string);
|
||||
}
|
||||
|
||||
bool draw::EntityCenterToScreen(IClientEntity* entity, Vector& out) {
|
||||
bool draw::EntityCenterToScreen(CachedEntity* entity, Vector& out) {
|
||||
if (!entity) return false;
|
||||
Vector world;
|
||||
Vector min, max;
|
||||
entity->GetRenderBounds(min, max);
|
||||
world = entity->GetAbsOrigin();
|
||||
RAW_ENT(entity)->GetRenderBounds(min, max);
|
||||
world = entity->m_vecOrigin;
|
||||
world.z += (min.z + max.z) / 2;
|
||||
Vector scr;
|
||||
bool succ = draw::WorldToScreen(world, scr);
|
||||
|
@ -74,7 +74,7 @@ void DrawString(int x, int y, Color color, Color background, bool center, const
|
||||
void DrawString(int x, int y, Color color, const char* text, ...);
|
||||
void DrawRect(int x, int y, int w, int h, Color color);
|
||||
bool WorldToScreen(Vector &origin, Vector &screen);
|
||||
bool EntityCenterToScreen(IClientEntity* entity, Vector& out);
|
||||
bool EntityCenterToScreen(CachedEntity* entity, Vector& out);
|
||||
void OutlineRect(int x, int y, int w, int h, Color color);
|
||||
void GetStringLength(char* string, int& length, int& height);
|
||||
|
||||
|
@ -32,6 +32,8 @@ IClientEntity* CachedEntity::InternalEntity() {
|
||||
}
|
||||
|
||||
void CachedEntity::Update(int idx) {
|
||||
SEGV_BEGIN
|
||||
|
||||
m_ESPOrigin.Zero();
|
||||
m_nESPStrings = 0;
|
||||
m_IDX = idx;
|
||||
@ -72,7 +74,7 @@ void CachedEntity::Update(int idx) {
|
||||
}
|
||||
|
||||
m_vecOrigin = m_pEntity->GetAbsOrigin();
|
||||
if (g_pLocalPlayer->entity) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
m_flDistance = (g_pLocalPlayer->v_Origin.DistTo(m_vecOrigin));
|
||||
}
|
||||
m_bAlivePlayer = false;
|
||||
@ -85,11 +87,11 @@ void CachedEntity::Update(int idx) {
|
||||
|
||||
if (m_Type == EntityType::ENTITY_PLAYER) {
|
||||
m_bAlivePlayer = !(NET_BYTE(m_pEntity, netvar.iLifeState));
|
||||
player_info_s* info = new player_info_s;
|
||||
interfaces::engineClient->GetPlayerInfo(m_IDX, info);
|
||||
m_pPlayerInfo = new player_info_s;
|
||||
interfaces::engineClient->GetPlayerInfo(m_IDX, m_pPlayerInfo);
|
||||
m_iTeam = CE_INT(this, netvar.iTeamNum); // TODO
|
||||
m_bEnemy = (m_iTeam != g_pLocalPlayer->team);
|
||||
m_bIsVisible = (IsEntityVisible(this, 0) || this(m_pEntity, 4));
|
||||
SAFE_CALL(m_bIsVisible = (IsEntityVisible(this, 0) || IsEntityVisible(this, 4)));
|
||||
m_iHealth = CE_INT(this, netvar.iHealth);
|
||||
m_iMaxHealth = g_pPlayerResource->GetMaxHealth(this);
|
||||
if (m_bIsVisible) {
|
||||
@ -100,7 +102,7 @@ void CachedEntity::Update(int idx) {
|
||||
m_lLastSeen++;
|
||||
}
|
||||
}
|
||||
if (m_iClassID == ClassID::CObjectSentrygun || m_iClassID == ClassID::CObjectDispenser || m_iClassID == ClassID::CObjectTeleporter) {
|
||||
if (m_Type == EntityType::ENTITY_BUILDING) {
|
||||
m_iTeam = CE_INT(this, netvar.iTeamNum); // TODO
|
||||
m_bEnemy = (m_iTeam != g_pLocalPlayer->team);
|
||||
m_bIsVisible = (IsEntityVisible(this, 0));
|
||||
@ -114,6 +116,8 @@ void CachedEntity::Update(int idx) {
|
||||
m_lLastSeen++;
|
||||
}
|
||||
}
|
||||
|
||||
SEGV_END_INFO(strfmt("Updating entity %i", m_IDX))
|
||||
}
|
||||
|
||||
void CachedEntity::AddESPString(Color color, Color background, const char* fmt, ...) {
|
||||
@ -155,10 +159,9 @@ ESPStringCompound CachedEntity::GetESPString(int idx) {
|
||||
}
|
||||
|
||||
matrix3x4_t* CachedEntity::GetBones() {
|
||||
if (!m_bBonesSetup) {
|
||||
if (!m_Bones) m_Bones = new matrix3x4_t[128]();
|
||||
m_pEntity->SetupBones(m_Bones, 128, 0x100, interfaces::gvars->curtime);
|
||||
m_bBonesSetup = true;
|
||||
if (!m_bBonesSetup || !m_Bones) {
|
||||
m_Bones = new matrix3x4_t[128];
|
||||
m_bBonesSetup = m_pEntity->SetupBones(m_Bones, 128, 0x100, 0); // interfaces::gvars->curtime
|
||||
}
|
||||
return m_Bones;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
struct matrix3x4_t;
|
||||
|
||||
#define ENTITY_CACHE_PROFILER true
|
||||
#define ENTITY_CACHE_PROFILER false
|
||||
|
||||
class IClientEntity;
|
||||
class Color;
|
||||
@ -34,7 +34,10 @@ struct player_info_s;
|
||||
#define CE_GOOD(entity) (entity && entity->m_pEntity && !entity->m_pEntity->IsDormant())
|
||||
#define CE_BAD(entity) (!CE_GOOD(entity))
|
||||
|
||||
#define PROXY_ENTITY true
|
||||
#define IDX_GOOD(idx) (idx >= 0 && idx < HIGHEST_ENTITY)
|
||||
#define IDX_BAD(idx) !IDX_GOOD(idx)
|
||||
|
||||
#define PROXY_ENTITY false
|
||||
|
||||
#if PROXY_ENTITY == true
|
||||
#define RAW_ENT(ce) ce->InternalEntity()
|
||||
@ -57,6 +60,8 @@ struct player_info_s;
|
||||
|
||||
#define END_ENTITY_ITERATING }
|
||||
|
||||
#define HIGHEST_ENTITY gEntityCache.m_nMax
|
||||
#define ENTITY(idx) gEntityCache.GetEntity(idx)
|
||||
|
||||
class CachedEntity {
|
||||
public:
|
||||
|
@ -11,7 +11,7 @@
|
||||
void ThirdpersonCallback(IConVar* var, const char* pOldValue, float flOldValue) {
|
||||
if (g_Settings.bThirdperson && !g_Settings.bThirdperson->GetBool()) {
|
||||
if (g_pLocalPlayer && g_pLocalPlayer->entity)
|
||||
NET_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 0;
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@ void GlobalSettings::Init() {
|
||||
this->bShowLogo = CREATE_CV(CV_SWITCH, "logo", "1", "Show logo");
|
||||
this->bShowAntiAim = CREATE_CV(CV_SWITCH, "thirdperson_angles", "1", "Real angles in thirdperson");
|
||||
this->bThirdperson = CREATE_CV(CV_SWITCH, "thirdperson", "0", "Thirdperson");
|
||||
this->bNoVisuals = CREATE_CV(CV_SWITCH, "novisuals", "0", "Disable visuals");
|
||||
this->bThirdperson->m_pConVar->InstallChangeCallback(ThirdpersonCallback);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
ConVar* sDisconnectMsg;
|
||||
CatVar* bShowAntiAim;
|
||||
CatVar* bThirdperson;
|
||||
CatVar* bNoVisuals;
|
||||
};
|
||||
|
||||
extern GlobalSettings g_Settings;
|
||||
|
@ -71,6 +71,7 @@ bool hack::invalidated = true;
|
||||
void hack::Hk_OverrideView(void* thisptr, CViewSetup* setup) {
|
||||
SEGV_BEGIN;
|
||||
((OverrideView_t*)hooks::hkClientMode->GetMethod(hooks::offOverrideView))(thisptr, setup);
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
if (g_Settings.flForceFOV && g_Settings.flForceFOV->GetBool()) {
|
||||
setup->fov = g_Settings.flForceFOV->GetFloat();
|
||||
}
|
||||
@ -86,6 +87,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
|
||||
SEGV_BEGIN;
|
||||
SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||
if (g_phFollowBot->v_bEnabled->GetBool()) {
|
||||
ipc_client_seg* seg_g = g_phFollowBot->m_pIPC->GetClientSegment(0);
|
||||
@ -110,6 +112,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
}
|
||||
|
||||
if (g_Settings.bNoVisuals->GetBool()) return;
|
||||
|
||||
if (!draw::width || !draw::height) {
|
||||
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
|
||||
@ -135,15 +138,17 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
for (IHack* i_hack : hack::hacks) {
|
||||
//PROF_BEGIN();
|
||||
i_hack->PaintTraverse(p, vp, fr, ar);
|
||||
SEGV_BEGIN
|
||||
i_hack->PaintTraverse(p, vp, fr, ar);
|
||||
SEGV_END_INFO(strfmt("PaintTraverse: hack %s", i_hack->GetName()))
|
||||
//PROF_END(strfmt("%s PaintTraverse", i_hack->GetName()));
|
||||
}
|
||||
Vector screen;
|
||||
for (int i = 0; i < gEntityCache.m_nMax && i < HIGHEST_ENTITY; i++) {
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ce = gEntityCache.GetEntity(i);
|
||||
if (!CheckCE(ce)) continue;
|
||||
if (CE_BAD(ce)) continue;
|
||||
if (ce->m_ESPOrigin.IsZero(1.0f))
|
||||
if (!draw::EntityCenterToScreen(ce->m_pEntity, screen)) continue;
|
||||
if (!draw::EntityCenterToScreen(ce, screen)) continue;
|
||||
for (int j = 0; j < ce->m_nESPStrings; j++) {
|
||||
ESPStringCompound str = ce->GetESPString(j);
|
||||
//logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String);
|
||||
@ -189,7 +194,7 @@ bool Hk_SendNetMsg(void* thisptr, INetMessage& msg, bool bForceReliable = false,
|
||||
SEGV_BEGIN;
|
||||
|
||||
//logging::Info("Sending NetMsg! %i", msg.GetType());
|
||||
if (g_phAirstuck->v_bStuck->GetBool()) {
|
||||
if (g_phAirstuck->v_bStuck->GetBool() && g_Settings.bHackEnabled->GetBool()) {
|
||||
switch (msg.GetType()) {
|
||||
case net_NOP:
|
||||
case net_SignonState:
|
||||
@ -221,6 +226,9 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SEGV_BEGIN;
|
||||
|
||||
bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
|
||||
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return ret;
|
||||
|
||||
if (!interfaces::engineClient->IsInGame()) {
|
||||
hack::invalidated = true;
|
||||
return true;
|
||||
@ -240,15 +248,18 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
//logging::Info("canpacket: %i", ch->CanPacket());
|
||||
//if (!cmd) return ret;
|
||||
|
||||
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
float curtime_old = interfaces::gvars->curtime;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
bool time_replaced = false;
|
||||
float curtime_old;
|
||||
if (CE_GOOD(g_pLocalPlayer->entity) && false) {
|
||||
float servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick;
|
||||
curtime_old = interfaces::gvars->curtime;
|
||||
interfaces::gvars->curtime = servertime;
|
||||
time_replaced = true;
|
||||
}
|
||||
SAFE_CALL(gEntityCache.Update());
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
|
||||
SAFE_CALL(CREATE_MOVE(Bunnyhop));
|
||||
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
|
||||
SAFE_CALL(CREATE_MOVE(ESP));
|
||||
@ -264,8 +275,7 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
SAFE_CALL(CREATE_MOVE(Triggerbot));
|
||||
SAFE_CALL(CREATE_MOVE(HuntsmanCompensation));
|
||||
interfaces::gvars->curtime = curtime_old;
|
||||
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
/*for (IHack* i_hack : hack::hacks) {
|
||||
if (!i_hack->CreateMove(thisptr, inputSample, cmd)) {
|
||||
ret = false;
|
||||
@ -277,13 +287,14 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
float speed = sqrt(vsilent.x * vsilent.x + vsilent.y * vsilent.y);
|
||||
Vector ang;
|
||||
VectorAngles(vsilent, ang);
|
||||
float yaw = deg2rad(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
float yaw = DEG2RAD(ang.y - g_pLocalPlayer->v_OrigViewangles.y + cmd->viewangles.y);
|
||||
cmd->forwardmove = cos(yaw) * speed;
|
||||
cmd->sidemove = sin(yaw) * speed;
|
||||
ret = false;
|
||||
}
|
||||
if (cmd)
|
||||
last_angles = cmd->viewangles;
|
||||
|
||||
return ret;
|
||||
|
||||
SEGV_END;
|
||||
@ -295,24 +306,24 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
// Ambassador to festive ambassador changer. simple.
|
||||
if (g_pLocalPlayer->weapon) {
|
||||
int defidx = NET_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex);
|
||||
int defidx = CE_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex);
|
||||
if (defidx == 61) {
|
||||
NET_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex) = 1006;
|
||||
CE_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex) = 1006;
|
||||
}
|
||||
}
|
||||
if (g_Settings.bThirdperson->GetBool() && g_pLocalPlayer->entity) {
|
||||
NET_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 1;
|
||||
}
|
||||
if (stage == 5 && g_Settings.bShowAntiAim->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) {
|
||||
if (g_pLocalPlayer->entity) {
|
||||
NET_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = last_angles.x;
|
||||
NET_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = last_angles.y;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 4) = last_angles.x;
|
||||
CE_FLOAT(g_pLocalPlayer->entity, netvar.deadflag + 8) = last_angles.y;
|
||||
}
|
||||
}
|
||||
((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage);
|
||||
if (stage == 5 && g_Settings.bNoFlinch->GetBool()) {
|
||||
static Vector oldPunchAngles = Vector();
|
||||
Vector punchAngles = NET_VECTOR(g_pLocalPlayer->entity, netvar.vecPunchAngle);
|
||||
Vector punchAngles = CE_VECTOR(g_pLocalPlayer->entity, netvar.vecPunchAngle);
|
||||
QAngle viewAngles;
|
||||
interfaces::engineClient->GetViewAngles(viewAngles);
|
||||
viewAngles -= VectorToQAngle(punchAngles - oldPunchAngles);
|
||||
@ -323,7 +334,7 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) {
|
||||
if (g_Settings.bNoZoom->GetBool()) {
|
||||
if (g_pLocalPlayer->entity) {
|
||||
//g_pLocalPlayer->bWasZoomed = NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed;
|
||||
NET_INT(g_pLocalPlayer->entity, netvar.iCond) = NET_INT(g_pLocalPlayer->entity, netvar.iCond) &~ cond::zoomed;
|
||||
CE_INT(g_pLocalPlayer->entity, netvar.iCond) = CE_INT(g_pLocalPlayer->entity, netvar.iCond) &~ cond::zoomed;
|
||||
}
|
||||
}
|
||||
SEGV_END;
|
||||
@ -409,10 +420,11 @@ void hack::Initialize() {
|
||||
hack::InitHacks();
|
||||
logging::Info("Init global settings");
|
||||
g_Settings.Init();
|
||||
#if ENTITY_CACHE_PROFILER == true
|
||||
if (!g_vEntityCacheProfiling) {
|
||||
g_vEntityCacheProfiling = CREATE_CV(CV_SWITCH, "entity_cache_profiling", "0", "Entity cache profiling");
|
||||
}
|
||||
|
||||
#endif
|
||||
g_pGUI = new GUI();
|
||||
g_pGUI->Setup();
|
||||
EndConVars();
|
||||
|
@ -16,37 +16,6 @@
|
||||
#define CREATE_MOVE(x) \
|
||||
g_ph##x->CreateMove(thisptr, inputSample, cmd)
|
||||
|
||||
#define DEBUG_SEGV true
|
||||
|
||||
#if DEBUG_SEGV == true
|
||||
|
||||
#define SEGV_BEGIN \
|
||||
try {
|
||||
|
||||
#define SEGV_END \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! %s in %s:%d", __func__, __FILE__, __LINE__); \
|
||||
}
|
||||
|
||||
#define SEGV_END_INFO(x) \
|
||||
} catch (...) { \
|
||||
logging::Info("SEGV/FPE occured! (%s)", x); \
|
||||
}
|
||||
|
||||
#define SAFE_CALL(x) \
|
||||
SEGV_BEGIN \
|
||||
x; \
|
||||
SEGV_END_INFO(#x)
|
||||
|
||||
#else
|
||||
|
||||
#define SEGV_BEGIN
|
||||
#define SEGV_END
|
||||
#define SEGV_END_INFO(x)
|
||||
#define SAFE_CALL(x) x
|
||||
|
||||
#endif
|
||||
|
||||
class IHack;
|
||||
class CUserCmd;
|
||||
class CViewSetup;
|
||||
|
@ -146,7 +146,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
}
|
||||
|
||||
if (IsAmbassador(g_pLocalPlayer->weapon)) { // TODO AmbassadorCanHeadshot()
|
||||
if ((interfaces::gvars->curtime - NET_FLOAT(g_pLocalPlayer->weapon, netvar.flLastFireTime)) <= 1.0) {
|
||||
if ((interfaces::gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon, netvar.flLastFireTime)) <= 1.0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -156,16 +156,14 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (this->v_bTriggerMode->GetBool() ) {
|
||||
cmd->buttons = cmd->buttons &~ IN_ATTACK;
|
||||
}
|
||||
IClientEntity* player = g_pLocalPlayer->entity;
|
||||
if (!player) return true;
|
||||
if (player->IsDormant()) return true;
|
||||
|
||||
m_iHitbox = this->v_eHitbox->GetInt();
|
||||
if (this->v_bAutoHitbox->GetBool()) m_iHitbox = 7;
|
||||
if (g_pLocalPlayer->weapon && this->v_bAutoHitbox->GetBool()) {
|
||||
switch (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID) {
|
||||
switch (g_pLocalPlayer->weapon->m_iClassID) {
|
||||
case ClassID::CTFSniperRifle:
|
||||
case ClassID::CTFSniperRifleDecap:
|
||||
if (!CanHeadshot(g_pLocalPlayer->entity)) {
|
||||
if (!CanHeadshot()) {
|
||||
if (this->v_bZoomedOnly->GetBool()) return true;
|
||||
} else {
|
||||
m_iHitbox = 0;
|
||||
@ -189,29 +187,25 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
|
||||
if (this->v_bZoomedOnly->GetBool()) {
|
||||
// TODO IsSniperRifle()
|
||||
if (g_pLocalPlayer->weapon) {
|
||||
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle ||
|
||||
g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifleDecap) {
|
||||
if (!CanHeadshot(g_pLocalPlayer->entity)) return true;
|
||||
}
|
||||
if (g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFSniperRifle ||
|
||||
g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFSniperRifleDecap) {
|
||||
if (!CanHeadshot()) return true;
|
||||
}
|
||||
}
|
||||
if (g_pLocalPlayer->weapon) {
|
||||
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == 210) return true;
|
||||
}
|
||||
|
||||
if (g_pLocalPlayer->weapon->m_iClassID == 210) return true;
|
||||
|
||||
m_bProjectileMode = (GetProjectileData(g_pLocalPlayer->weapon, m_flProjSpeed, m_flProjGravity));
|
||||
// TODO priority modes (FOV, Smart, Distance, etc)
|
||||
IClientEntity* target_highest = 0;
|
||||
CachedEntity* target_highest = 0;
|
||||
float target_highest_score = -256;
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
IClientEntity* ent = ENTITY(i);
|
||||
if (ent == 0) continue;
|
||||
if (!(IsPlayer(ent) || IsBuilding(ent))) continue;
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (ShouldTarget(ent)) {
|
||||
if (GetWeaponMode(player) == weaponmode::weapon_melee || this->v_ePriorityMode->GetInt() == 2) {
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee || this->v_ePriorityMode->GetInt() == 2) {
|
||||
Vector result;
|
||||
if (IsBuilding(ent)) {
|
||||
if (ent->m_Type == ENTITY_BUILDING) {
|
||||
result = GetBuildingPosition(ent);
|
||||
} else {
|
||||
GetHitbox(ent, m_iHitbox, result);
|
||||
@ -232,7 +226,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
} break;
|
||||
case 1: {
|
||||
Vector result;
|
||||
if (IsBuilding(ent)) {
|
||||
if (ent->m_Type == ENTITY_BUILDING) {
|
||||
result = GetBuildingPosition(ent);
|
||||
} else {
|
||||
GetHitbox(ent, m_iHitbox, result);
|
||||
@ -245,10 +239,10 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
} break;
|
||||
case 3: {
|
||||
float scr;
|
||||
if (IsBuilding(ent)) {
|
||||
scr = 450.0f - NET_INT(ent, netvar.iBuildingHealth);
|
||||
if (ent->m_Type == ENTITY_BUILDING) {
|
||||
scr = 450.0f - CE_INT(ent, netvar.iBuildingHealth);
|
||||
} else {
|
||||
scr = 450.0f - NET_INT(ent, netvar.iHealth);
|
||||
scr = 450.0f - CE_INT(ent, netvar.iHealth);
|
||||
}
|
||||
if (scr > target_highest_score) {
|
||||
target_highest_score = scr;
|
||||
@ -260,14 +254,14 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
}
|
||||
}
|
||||
if (target_highest != 0) {
|
||||
this->m_iLastTarget = target_highest->entindex();
|
||||
this->m_iLastTarget = target_highest->m_IDX;
|
||||
Aim(target_highest, cmd);
|
||||
if (g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFMinigun)
|
||||
if (g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFMinigun)
|
||||
m_nMinigunFixTicks = 40;
|
||||
}
|
||||
if (g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFMinigun &&
|
||||
if (g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFMinigun &&
|
||||
target_highest == 0 &&
|
||||
ENTITY(m_iLastTarget) &&
|
||||
IDX_GOOD(m_iLastTarget) &&
|
||||
m_nMinigunFixTicks) {
|
||||
Aim(ENTITY(m_iLastTarget), cmd);
|
||||
}
|
||||
@ -276,55 +270,35 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
|
||||
void Aimbot::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
if (!v_bEnabled->GetBool()) return;
|
||||
if (this->m_iLastTarget == -1) return;
|
||||
IClientEntity* ent = ENTITY(this->m_iLastTarget);
|
||||
if (!ent) return;
|
||||
if (IsPlayer(ent)) {
|
||||
int clazz = NET_INT(ent, netvar.iClass);
|
||||
if (IDX_BAD(m_iLastTarget)) return;
|
||||
CachedEntity* ent = ENTITY(this->m_iLastTarget);
|
||||
if (CE_BAD(ent)) return;
|
||||
if (ent->m_Type == ENTITY_PLAYER) {
|
||||
int clazz = CE_INT(ent, netvar.iClass);
|
||||
if (clazz < 0 || clazz > 9) return;
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(this->m_iLastTarget, &info)) return;
|
||||
AddCenterString(colors::yellow, colors::black, "Prey: %i HP %s (%s)", NET_INT(ent, netvar.iHealth), tfclasses[clazz], info.name);
|
||||
} else if (IsBuilding(ent)) {
|
||||
AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", NET_INT(ent, netvar.iBuildingHealth), NET_INT(ent, netvar.iUpgradeLevel), GetBuildingName(ent));
|
||||
AddCenterString(colors::yellow, colors::black, "Prey: %i HP %s (%s)", CE_INT(ent, netvar.iHealth), tfclasses[clazz], ent->m_pPlayerInfo->name);
|
||||
} else if (ent->m_Type == ENTITY_BUILDING) {
|
||||
AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iUpgradeLevel), GetBuildingName(ent));
|
||||
}
|
||||
}
|
||||
|
||||
bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
//logging::Info("Should target?");
|
||||
if (!entity) return false;
|
||||
if (entity->IsDormant()) return false;
|
||||
if (IsPlayer(entity)) {
|
||||
if (g_Settings.bIgnoreTaunting->GetBool() && (NET_INT(entity, netvar.iCond) & cond::taunting)) return false;
|
||||
if (Developer(entity)) return false;
|
||||
if (gEntityCache.GetEntity(entity->entindex())->m_lSeenTicks < this->v_iSeenDelay->GetInt()) return false;
|
||||
bool Aimbot::ShouldTarget(CachedEntity* entity) {
|
||||
// Just assuming CE is good
|
||||
if (entity->m_Type == ENTITY_PLAYER) {
|
||||
if (g_Settings.bIgnoreTaunting->GetBool() && (CE_INT(entity, netvar.iCond) & cond::taunting)) return false;
|
||||
if (Developer(entity)) return false; // TODO developer relation
|
||||
if (entity->m_lSeenTicks < (unsigned)this->v_iSeenDelay->GetInt()) return false;
|
||||
if (IsPlayerInvulnerable(entity)) return false;
|
||||
int team = NET_INT(entity, netvar.iTeamNum);
|
||||
int local = interfaces::engineClient->GetLocalPlayer();
|
||||
IClientEntity* player = ENTITY(local);
|
||||
char life_state = NET_BYTE(entity, netvar.iLifeState);
|
||||
if (life_state) return false;
|
||||
if (!player) return false;
|
||||
if (!entity->m_bAlivePlayer) return false;
|
||||
if (v_bRespectCloak->GetBool() && IsPlayerInvisible(entity)) return false;
|
||||
int health = NET_INT(entity, netvar.iHealth);
|
||||
/*if (this->v_bCharge->GetBool() && (NET_INT(player, eoffsets.iClass) == 2)) {
|
||||
int rifleHandle = NET_INT(player, eoffsets.hActiveWeapon);
|
||||
IClientEntity* rifle = ENTITY(rifleHandle & 0xFFF);
|
||||
if (!rifle) return false;
|
||||
float bdmg = NET_FLOAT(rifle, eoffsets.flChargedDamage);
|
||||
if (health > 150 && (health > (150 + bdmg) || bdmg < 15.0f)) return false;
|
||||
}*/
|
||||
int team_my = NET_INT(player, netvar.iTeamNum);
|
||||
if (team == team_my) return false;
|
||||
Vector enemy_pos = entity->GetAbsOrigin();
|
||||
Vector my_pos = player->GetAbsOrigin();
|
||||
if (!entity->m_bEnemy) return false;
|
||||
if (v_iMaxRange->GetInt() > 0) {
|
||||
if ((enemy_pos - my_pos).Length() > v_iMaxRange->GetInt()) return false;
|
||||
if (entity->m_flDistance > v_iMaxRange->GetInt()) return false;
|
||||
}
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee) {
|
||||
if ((enemy_pos - my_pos).Length() > 95) return false;
|
||||
if (entity->m_flDistance > 95) return false;
|
||||
}
|
||||
int econd = NET_INT(entity, netvar.iCond1);
|
||||
int econd = CE_INT(entity, netvar.iCond1);
|
||||
if ((econd & cond_ex::vacc_bullet)) return false;
|
||||
if (GetRelation(entity) == relation::FRIEND) return false;
|
||||
Vector resultAim;
|
||||
@ -341,16 +315,15 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
}
|
||||
if (v_fFOV->GetFloat() > 0.0f && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, resultAim) > v_fFOV->GetFloat())) return false;
|
||||
return true;
|
||||
} else if (IsBuilding(entity)) {
|
||||
} else if (entity->m_Type == ENTITY_BUILDING) {
|
||||
if (!v_bAimBuildings->GetBool()) return false;
|
||||
int team = NET_INT(entity, netvar.iTeamNum);
|
||||
int team = CE_INT(entity, netvar.iTeamNum);
|
||||
if (team == g_pLocalPlayer->team) return false;
|
||||
Vector enemy_pos = entity->GetAbsOrigin();
|
||||
if (v_iMaxRange->GetInt() > 0) {
|
||||
if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > v_iMaxRange->GetInt()) return false;
|
||||
if (entity->m_flDistance > v_iMaxRange->GetInt()) return false;
|
||||
}
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee) {
|
||||
if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > 95) return false;
|
||||
if (entity->m_flDistance > 95) return false;
|
||||
}
|
||||
Vector resultAim;
|
||||
// TODO fix proj buildings
|
||||
@ -372,18 +345,19 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
|
||||
// TODO Vector objects
|
||||
bool Aimbot::Aim(CachedEntity* entity, CUserCmd* cmd) {
|
||||
//logging::Info("Aiming!");
|
||||
Vector hit;
|
||||
Vector angles;
|
||||
if (!entity) return false;
|
||||
if (IsPlayer(entity)) {
|
||||
if (entity->m_Type == ENTITY_PLAYER) {
|
||||
//logging::Info("A");
|
||||
GetHitbox(entity, m_iHitbox, hit);
|
||||
//logging::Info("B");
|
||||
if (this->v_bPrediction->GetBool()) SimpleLatencyPrediction(entity, m_iHitbox);
|
||||
//logging::Info("C");
|
||||
} else if (IsBuilding(entity)) {
|
||||
} else if (entity->m_Type == ENTITY_BUILDING) {
|
||||
hit = GetBuildingPosition(entity);
|
||||
}
|
||||
if (v_bProjectileAimbot->GetBool()) {
|
||||
@ -394,7 +368,6 @@ bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
|
||||
}
|
||||
}
|
||||
//logging::Info("ayyming!");
|
||||
IClientEntity* local = ENTITY(interfaces::engineClient->GetLocalPlayer());
|
||||
Vector tr = (hit - g_pLocalPlayer->v_Eye);
|
||||
fVectorAngles(tr, angles);
|
||||
bool smoothed = false;
|
||||
@ -415,17 +388,15 @@ bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
|
||||
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
|
||||
if (g_pLocalPlayer->bZoomed) {
|
||||
if (this->v_iAutoShootCharge->GetBool()) {
|
||||
int rifleHandle = NET_INT(local, netvar.hActiveWeapon);
|
||||
IClientEntity* rifle = ENTITY(rifleHandle & 0xFFF);
|
||||
float bdmg = NET_FLOAT(rifle, netvar.flChargedDamage);
|
||||
float bdmg = CE_FLOAT(g_pLocalPlayer->weapon, netvar.flChargedDamage);
|
||||
if (bdmg < this->v_iAutoShootCharge->GetFloat()) return true;
|
||||
} else {
|
||||
if (!CanHeadshot(g_pLocalPlayer->entity)) return true;
|
||||
if (!CanHeadshot()) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFCompoundBow) {
|
||||
float begincharge = NET_FLOAT(g_pLocalPlayer->weapon, netvar.flChargeBeginTime);
|
||||
if (g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFCompoundBow) {
|
||||
float begincharge = CE_FLOAT(g_pLocalPlayer->weapon, netvar.flChargeBeginTime);
|
||||
float charge = 0;
|
||||
if (begincharge != 0) {
|
||||
charge = interfaces::gvars->curtime - begincharge;
|
||||
|
@ -27,8 +27,8 @@ class Aimbot : public IHack {
|
||||
public:
|
||||
DECLARE_HACK_METHODS();
|
||||
Aimbot();
|
||||
bool ShouldTarget(IClientEntity* entity);
|
||||
bool Aim(IClientEntity* entity, CUserCmd* cmd);
|
||||
bool ShouldTarget(CachedEntity* entity);
|
||||
bool Aim(CachedEntity* entity, CUserCmd* cmd);
|
||||
|
||||
bool m_bProjectileMode;
|
||||
float m_flProjSpeed;
|
||||
|
@ -27,27 +27,12 @@ bool Airstuck::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (cmd->buttons & (IN_ATTACK | IN_ATTACK2)) {
|
||||
return true;
|
||||
}
|
||||
//cmd->tick_count = 0xFFFFF;
|
||||
//INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
//NET_Tick tick;
|
||||
//ch->SendNetMsg((INetMessage*)&tick);
|
||||
//cmd->tick_count = 0xFFFF;
|
||||
//interfaces::cvar->FindVar("net_fakeloss")->SetValue(99);
|
||||
//interfaces::cvar->FindVar("net_fakeloss")->SetValue(100.0f);
|
||||
if (interfaces::gvars->tickcount % 60 == 0) {
|
||||
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
|
||||
//IClient* client = (IClient*)ch->GetMsgHandler();
|
||||
//IServer* server = client->GetServer();
|
||||
//logging::Info("Client: 0x%08x Server: 0x%08x");
|
||||
NET_NOP packet;
|
||||
//logging::Info("NOP sent!");
|
||||
//NET_SignonState packet(6, 1);
|
||||
//logging::Info("Created!");
|
||||
packet.SetNetChannel(ch);
|
||||
packet.SetReliable(false);
|
||||
//logging::Info("Sending!");
|
||||
ch->SendNetMsg(packet);
|
||||
//packet.WriteToBuffer(buffer);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -40,7 +40,7 @@ bool AntiAim::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (cmd->buttons & IN_ATTACK) {
|
||||
if (CanShoot()) return true;
|
||||
}
|
||||
if ((cmd->buttons & IN_ATTACK2) && g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFLunchBox) return true;
|
||||
if ((cmd->buttons & IN_ATTACK2) && g_pLocalPlayer->weapon->m_iClassID == ClassID::CTFLunchBox) return true;
|
||||
if (g_pLocalPlayer->bAttackLastTick) return true;
|
||||
if (GetWeaponMode(g_pLocalPlayer->entity) == weaponmode::weapon_melee) return true;
|
||||
float p = cmd->viewangles.x;
|
||||
|
@ -23,11 +23,11 @@ AntiDisguise::AntiDisguise() {
|
||||
void AntiDisguise::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
if (!v_bEnabled->GetBool()) return;
|
||||
for (int i = 0; i < 64 && i < HIGHEST_ENTITY; i++) {
|
||||
IClientEntity* ent = ENTITY(i);
|
||||
if (!ent) continue;
|
||||
if (ent->GetClientClass()->m_ClassID == ClassID::CTFPlayer) {
|
||||
if (NET_INT(ent, netvar.iClass) == tf_class::tf_spy) {
|
||||
NET_INT(ent, netvar.iCond) = NET_INT(ent, netvar.iCond) &~ cond::disguised;
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (ent->m_Type == ENTITY_PLAYER) {
|
||||
if (CE_INT(ent, netvar.iClass) == tf_class::tf_spy) {
|
||||
CE_INT(ent, netvar.iCond) = CE_INT(ent, netvar.iCond) &~ cond::disguised;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ int AutoHeal::GetBestHealingTarget() {
|
||||
|
||||
int AutoHeal::GetHealingPriority(int idx) {
|
||||
if (!CanHeal(idx)) return -1;
|
||||
IClientEntity* ent = ENTITY(idx);
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
int priority = 0;
|
||||
int health = NET_INT(ent, netvar.iHealth);
|
||||
int health = CE_INT(ent, netvar.iHealth);
|
||||
int maxhealth = g_pPlayerResource->GetMaxHealth(ent);
|
||||
int maxbuffedhealth = maxhealth * 1.5;
|
||||
int maxoverheal = maxbuffedhealth - maxhealth;
|
||||
@ -51,13 +51,14 @@ int AutoHeal::GetHealingPriority(int idx) {
|
||||
}
|
||||
|
||||
bool AutoHeal::CanHeal(int idx) {
|
||||
IClientEntity* ent = ENTITY(idx);
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
if (!ent) return false;
|
||||
if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) return false;
|
||||
if (ent->m_Type != ENTITY_PLAYER) return false;
|
||||
if (interfaces::engineClient->GetLocalPlayer() == idx) return false;
|
||||
if (NET_BYTE(ent, netvar.iLifeState)) return false;
|
||||
if (g_pLocalPlayer->team != NET_INT(ent, netvar.iTeamNum)) return false;
|
||||
if (g_pLocalPlayer->v_Origin.DistToSqr(ent->GetAbsOrigin()) > 420 * 420) return false;
|
||||
if (!ent->m_bAlivePlayer) return false;
|
||||
if (ent->m_bEnemy) return false;
|
||||
if (ent->m_flDistance > 420) return false;
|
||||
// TODO visible any hitbox
|
||||
if (!IsEntityVisible(ent, 7)) return false;
|
||||
if (IsPlayerInvisible(ent)) return false;
|
||||
return true;
|
||||
@ -82,7 +83,7 @@ bool AutoHeal::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
m_iNewTarget = 1;
|
||||
}
|
||||
if (m_iCurrentHealingTarget == -1) return true;
|
||||
IClientEntity* target = ENTITY(m_iCurrentHealingTarget);
|
||||
CachedEntity* target = ENTITY(m_iCurrentHealingTarget);
|
||||
Vector out;
|
||||
GetHitbox(target, 7, out);
|
||||
AimAt(g_pLocalPlayer->v_Eye, out, cmd);
|
||||
|
@ -49,8 +49,8 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
CachedEntity* closest = 0;
|
||||
float closest_dist = 0.0f;
|
||||
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
CachedEntity* ent = gEntityCache.GetEntity(i);
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (!ShouldReflect(ent)) continue;
|
||||
//if (ent->Var<Vector>(eoffsets.vVelocity).IsZero(1.0f)) continue;
|
||||
|
@ -10,8 +10,6 @@
|
||||
|
||||
#include "IHack.h"
|
||||
|
||||
class IClientEntity;
|
||||
|
||||
class AutoReflect : public IHack {
|
||||
public:
|
||||
DECLARE_HACK_METHODS();
|
||||
|
@ -25,8 +25,8 @@ AutoSticky::AutoSticky() {
|
||||
}
|
||||
|
||||
bool AutoSticky::ShouldDetonate(CachedEntity* bomb) {
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
CachedEntity* ent = gEntityCache.GetEntity(i);
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (ent->m_Type != ENTITY_PLAYER && (ent->m_Type != ENTITY_BUILDING || !this->v_bBuildings->GetBool())) continue;
|
||||
if (ent->m_iTeam == CE_INT(bomb, netvar.iTeamNum)) continue;
|
||||
@ -39,8 +39,8 @@ bool AutoSticky::ShouldDetonate(CachedEntity* bomb) {
|
||||
bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (!this->v_bEnabled->GetBool()) return true;
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) return true;
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
CachedEntity* ent = gEntityCache.GetEntity(i);
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) continue;
|
||||
if (CE_INT(ent, netvar.iPipeType) != 1) continue;
|
||||
|
@ -24,7 +24,7 @@ bool AutoStrafe::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (!v_bEnabled->GetBool()) return true;
|
||||
if (g_pLocalPlayer->entity && !g_pLocalPlayer->life_state) {
|
||||
// TODO FL_ONGROUND
|
||||
if (NET_INT(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0)) return true;
|
||||
if (CE_INT(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0)) return true;
|
||||
if (abs(cmd->mousedx) > 1) {
|
||||
cmd->sidemove = (cmd->mousedx) < 0.0f ? -450.0f : 450.0f;
|
||||
}
|
||||
|
@ -26,15 +26,12 @@ bool bDoubleJumpFix = false;
|
||||
|
||||
bool Bunnyhop::CreateMove(void* thisptr, float sampling, CUserCmd* cmd) {
|
||||
if (!this->v_bEnabled->GetBool()) return true;
|
||||
int player = interfaces::engineClient->GetLocalPlayer();
|
||||
IClientEntity* entity = ENTITY(player);
|
||||
int cond3 = NET_INT(entity, netvar.iCond3);
|
||||
if (cond3 & cond_ex3::grappling) return true;
|
||||
int flags = NET_INT(entity, netvar.iFlags);
|
||||
if (g_pLocalPlayer->cond_3 & cond_ex3::grappling) return true;
|
||||
int flags = CE_INT(g_pLocalPlayer->entity, netvar.iFlags);
|
||||
|
||||
if (v_bAutoJump->GetBool()) {
|
||||
Vector vel = NET_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity);
|
||||
if (sqrt((vel.x * vel.x + vel.y * vel.y)) > v_iAutoJumpSpeed->GetInt()) {
|
||||
Vector vel = CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity);
|
||||
if ((vel.x * vel.x + vel.y * vel.y) > SQR(v_iAutoJumpSpeed->GetInt())) {
|
||||
cmd->buttons |= IN_JUMP;
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ const char* classes[] = {
|
||||
};
|
||||
|
||||
void ESP::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
ProcessEntityPT(gEntityCache.GetEntity(i));
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
ProcessEntityPT(ENTITY(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,11 +71,11 @@ ESP::ESP() {
|
||||
#define ESP_HEIGHT 14
|
||||
|
||||
void ESP::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax) {
|
||||
if (!CheckCE(ent)) return;
|
||||
bool cloak = ent->m_iClassID == ClassID::CTFPlayer && IsPlayerInvisible(ent->m_pEntity);//(CE_INT(ent, netvar.iCond) & cond::cloaked);
|
||||
if (CE_BAD(ent)) return;
|
||||
bool cloak = ent->m_iClassID == ClassID::CTFPlayer && IsPlayerInvisible(ent);//(CE_INT(ent, netvar.iCond) & cond::cloaked);
|
||||
Vector min, max;
|
||||
ent->m_pEntity->GetRenderBounds(min, max);
|
||||
Vector origin = ent->m_pEntity->GetAbsOrigin();
|
||||
RAW_ENT(ent)->GetRenderBounds(min, max);
|
||||
Vector origin = ent->m_vecOrigin;
|
||||
Vector so;
|
||||
draw::WorldToScreen(origin, so);
|
||||
//if (!a) return;
|
||||
@ -117,28 +117,26 @@ void ESP::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeig
|
||||
void ESP::ProcessEntityPT(CachedEntity* ent) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (!this->v_bBox->GetBool()) return;
|
||||
if (!CheckCE(ent)) return;
|
||||
if (CE_BAD(ent)) return;
|
||||
if (!(this->v_bSeeLocal->GetBool() && interfaces::iinput->CAM_IsThirdPerson()) &&
|
||||
ent->m_IDX == interfaces::engineClient->GetLocalPlayer()) return;
|
||||
Color fg = colors::EntityF(ent);
|
||||
switch (ent->m_iClassID) {
|
||||
case ClassID::CTFPlayer: {
|
||||
bool cloak = IsPlayerInvisible(ent->m_pEntity);//CE_INT(ent, netvar.iCond) & cond::cloaked;
|
||||
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent->m_pEntity)) {
|
||||
switch (ent->m_Type) {
|
||||
case ENTITY_PLAYER: {
|
||||
bool cloak = IsPlayerInvisible(ent);//CE_INT(ent, netvar.iCond) & cond::cloaked;
|
||||
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent)) {
|
||||
if (cloak) return;
|
||||
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !GetRelation(ent->m_pEntity)) break;
|
||||
if (!ent->m_bEnemy && !v_bTeammates->GetBool() && !GetRelation(ent)) break;
|
||||
if (!ent->m_bAlivePlayer) break;
|
||||
|
||||
DrawBox(ent, fg, 3.0f, -15.0f, true, CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth);
|
||||
break;
|
||||
}
|
||||
case ClassID::CObjectSentrygun:
|
||||
case ClassID::CObjectDispenser:
|
||||
case ClassID::CObjectTeleporter: {
|
||||
case ENTITY_BUILDING: {
|
||||
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
|
||||
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
|
||||
return;
|
||||
@ -153,13 +151,13 @@ void ESP::ProcessEntityPT(CachedEntity* ent) {
|
||||
|
||||
void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
if (!this->v_bEnabled->GetBool()) return;
|
||||
if (!CheckCE(ent)) return;
|
||||
if (CE_BAD(ent)) return;
|
||||
|
||||
Color color = colors::EntityF(ent);
|
||||
Color bgclr = colors::EntityB(ent);
|
||||
|
||||
if (v_bEntityESP->GetBool()) {
|
||||
ent->AddESPString(color, bgclr, "%s [%i]", ent->m_pEntity->GetClientClass()->m_pNetworkName, ent->m_iClassID);
|
||||
ent->AddESPString(color, bgclr, "%s [%i]", RAW_ENT(ent)->GetClientClass()->m_pNetworkName, ent->m_iClassID);
|
||||
if (v_bShowEntityID->GetBool()) {
|
||||
ent->AddESPString(color, bgclr, "%i", ent->m_IDX);
|
||||
}
|
||||
@ -245,7 +243,7 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
} break;
|
||||
case ClassID::CBaseAnimating: {
|
||||
if (!this->v_bItemESP->GetBool()) break;
|
||||
item_type type = GetItemType(ent->m_pEntity);
|
||||
item_type type = GetItemType(ent);
|
||||
if (type == item_type::item_null) break;
|
||||
bool shown = false;
|
||||
if (type >= item_medkit_small && type <= item_medkit_large && this->v_bShowHealthPacks->GetBool()) {
|
||||
@ -271,12 +269,12 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
int pcond = CE_INT(ent, netvar.iCond);
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(ent->m_IDX, &info)) return;
|
||||
powerup_type power = GetPowerupOnPlayer(ent->m_pEntity);
|
||||
powerup_type power = GetPowerupOnPlayer(ent);
|
||||
// If target is enemy, always show powerups, if player is teammate, show powerups
|
||||
// only if bTeammatePowerup or bTeammates is true
|
||||
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent->m_pEntity)) {
|
||||
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent)) {
|
||||
//if (pcond & cond::cloaked) return;
|
||||
if (IsPlayerInvisible(ent->m_pEntity)) return;
|
||||
if (IsPlayerInvisible(ent)) return;
|
||||
if (ent->m_lLastSeen > (unsigned)v_iLegitSeenTicks->GetInt()) {
|
||||
return;
|
||||
}
|
||||
@ -284,7 +282,7 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
if (power >= 0 && (ent->m_bEnemy || this->v_bTeammatePowerup->GetBool() || this->v_bTeammates->GetBool())) {
|
||||
ent->AddESPString(color, bgclr, "HAS [%s]", powerups[power]);
|
||||
}
|
||||
if (ent->m_bEnemy || v_bTeammates->GetBool() || GetRelation(ent->m_pEntity)) {
|
||||
if (ent->m_bEnemy || v_bTeammates->GetBool() || GetRelation(ent)) {
|
||||
ent->AddESPString(color, bgclr, "%s", info.name);
|
||||
if (v_bShowFriendID->GetBool()) {
|
||||
ent->AddESPString(color, bgclr, "%lu", info.friendsID);
|
||||
@ -297,7 +295,7 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
if (pcond & cond::cloaked) {
|
||||
ent->AddESPString(color, bgclr, "CLOAKED");
|
||||
}
|
||||
if (IsPlayerInvulnerable(ent->m_pEntity)) {
|
||||
if (IsPlayerInvulnerable(ent)) {
|
||||
ent->AddESPString(color, bgclr, "INVULNERABLE");
|
||||
}
|
||||
if (CE_INT(ent, netvar.iCond1) & cond_ex::vacc_bullet) {
|
||||
@ -306,7 +304,7 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
if (CE_INT(ent, netvar.iCond1) & cond_ex::vacc_pbullet) {
|
||||
ent->AddESPString(color, bgclr, "VACCINATOR PASSIVE");
|
||||
}
|
||||
if (IsPlayerCritBoosted(ent->m_pEntity)) {
|
||||
if (IsPlayerCritBoosted(ent)) {
|
||||
ent->AddESPString(color, bgclr, "CRIT BOOSTED");
|
||||
}
|
||||
if (this->v_bShowDistance) {
|
||||
@ -339,8 +337,9 @@ void ESP::ProcessEntity(CachedEntity* ent) {
|
||||
}
|
||||
|
||||
bool ESP::CreateMove(void*, float, CUserCmd*) {
|
||||
for (int i = 0; i < gEntityCache.m_nMax; i++) {
|
||||
ProcessEntity(gEntityCache.GetEntity(i));
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_GOOD(ent)) { ProcessEntity(ent); }
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
@ -30,10 +30,10 @@ bool FollowBot::ShouldPopUber(bool force) {
|
||||
if (health_my < 30) return true;
|
||||
//bool other_bots_have_uber = false;
|
||||
for (int i = 0; i < 64 && i < HIGHEST_ENTITY; i++) {
|
||||
IClientEntity* ent = ENTITY(i);
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (ent == g_pLocalPlayer->entity) continue;
|
||||
if (IsFriendlyBot(ent)) {
|
||||
if (NET_BYTE(ent, netvar.iLifeState)) continue;
|
||||
if (CE_BYTE(ent, netvar.iLifeState)) continue;
|
||||
//IClientEntity* medigun;
|
||||
// TODO
|
||||
}
|
||||
@ -64,7 +64,7 @@ void CC_ResetList(const CCommand& args) {
|
||||
MedicCallListener* g_pListener;
|
||||
|
||||
// TODO
|
||||
void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) {
|
||||
void FollowBot::ProcessEntity(CachedEntity* entity, bool enemy) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,13 +80,13 @@ void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) {
|
||||
*/
|
||||
|
||||
// TODO
|
||||
int FollowBot::ShouldNotTarget(IClientEntity* ent, bool notrace) {
|
||||
if (!ent || ent->IsDormant()) return 1;
|
||||
if (ent->GetClientClass()->m_ClassID != 241) return 2;
|
||||
if (NET_BYTE(ent, netvar.iLifeState)) return 3;
|
||||
bool enemy = NET_INT(ent, netvar.iTeamNum) != g_pLocalPlayer->team;
|
||||
if (enemy) return 4;
|
||||
int FollowBot::ShouldNotTarget(CachedEntity* ent, bool notrace) {
|
||||
if (CE_BAD(ent)) return 1;
|
||||
if (ent->m_Type != ENTITY_PLAYER) return 2;
|
||||
if (!ent->m_bAlivePlayer) return 3;
|
||||
if (ent->m_bEnemy) return 4;
|
||||
|
||||
// TODO temporary! W+m1 bot should be back!
|
||||
if (!this->IsOwner(ent)) {
|
||||
return 7;
|
||||
}
|
||||
@ -103,17 +103,17 @@ int FollowBot::ShouldNotTarget(IClientEntity* ent, bool notrace) {
|
||||
}
|
||||
|
||||
void FollowBot::Tick(CUserCmd* cmd) {
|
||||
if (!g_pLocalPlayer->entity || g_pLocalPlayer->entity->IsDormant()) return;
|
||||
if (CE_BAD(g_pLocalPlayer->entity)) return;
|
||||
if (g_pLocalPlayer->life_state) return;
|
||||
|
||||
IClientEntity* owner_entity = 0;
|
||||
CachedEntity* owner_entity = 0;
|
||||
for (int i = 0; i < 64 && i < HIGHEST_ENTITY; i++) {
|
||||
if (IsOwner(ENTITY(i))) {
|
||||
m_hTargetFollowing = i;
|
||||
owner_entity = ENTITY(i);
|
||||
}
|
||||
}
|
||||
if (!owner_entity) return;
|
||||
if (CE_BAD(owner_entity)) return;
|
||||
if (m_iForceHealTicks && m_iForceHealTicks < 20) {
|
||||
m_iForceHealTicks++;
|
||||
cmd->buttons |= IN_ATTACK;
|
||||
@ -142,18 +142,15 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
if (!owner_entity) break;
|
||||
//bool owner_zoomed = (NET_INT(owner_entity, eoffsets.iCond) & cond::zoomed);
|
||||
//
|
||||
if (IClientEntity* weapon = ENTITY(NET_INT(owner_entity, netvar.hActiveWeapon) & 0xFFF)) {
|
||||
if (weapon) {
|
||||
if (weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle || weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle) {
|
||||
bool bot_zoomed = (NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed);
|
||||
if (!bot_zoomed) {
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
} else {
|
||||
bool bot_zoomed = (NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed);
|
||||
if (bot_zoomed) {
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
CachedEntity* owner_weapon = ENTITY(CE_INT(owner_entity, netvar.hActiveWeapon) & 0xFFF);
|
||||
if (CE_GOOD(owner_weapon)) {
|
||||
if (owner_weapon->m_iClassID == ClassID::CTFSniperRifle || owner_weapon->m_iClassID == ClassID::CTFSniperRifle) {
|
||||
if (!g_pLocalPlayer->bZoomed) {
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
} else {
|
||||
if (g_pLocalPlayer->bZoomed) {
|
||||
cmd->buttons |= IN_ATTACK2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,10 +161,10 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
|
||||
|
||||
if (v_iBotPackage->GetInt() == botpackage::BOT_MEDIC) {
|
||||
IClientEntity* healtr = this->GetBestHealingTarget();
|
||||
m_hTargetHealing = (healtr ? healtr->entindex() : 0);
|
||||
CachedEntity* healtr = this->GetBestHealingTarget();
|
||||
m_hTargetHealing = (healtr ? healtr->m_IDX : 0);
|
||||
if (healtr) {
|
||||
if (NET_INT(healtr, netvar.iHealth) < 35 && !NET_BYTE(healtr, netvar.iLifeState)) {
|
||||
if (CE_INT(healtr, netvar.iHealth) < 35 && !CE_BYTE(healtr, netvar.iLifeState)) {
|
||||
m_iShouldUbercharge = 1;
|
||||
}
|
||||
if (g_pLocalPlayer->health < 35) {
|
||||
@ -179,7 +176,7 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
if (owner_entity && (0 == (g_nTick % 20))) {
|
||||
static bool forward = false;
|
||||
static bool jump = false;
|
||||
if (!jump && NET_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(10.0f) && !(NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed)) {
|
||||
if (!jump && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(10.0f) && !g_pLocalPlayer->bZoomed) {
|
||||
interfaces::engineClient->ExecuteClientCmd("+jump");
|
||||
jump = true;
|
||||
} else if (jump) {
|
||||
@ -200,17 +197,17 @@ void FollowBot::Tick(CUserCmd* cmd) {
|
||||
}
|
||||
|
||||
void FollowBot::ActuallyCreateMove(CUserCmd* cmd) {
|
||||
IClientEntity* tr_follow = ENTITY(this->m_hTargetFollowing);
|
||||
CachedEntity* tr_follow = ENTITY(this->m_hTargetFollowing);
|
||||
QAngle angles = VectorToQAngle(cmd->viewangles);
|
||||
if (tr_follow) {
|
||||
if (CE_GOOD(tr_follow)) {
|
||||
AimAtHitbox(tr_follow, 4, cmd);
|
||||
angles = VectorToQAngle(cmd->viewangles);
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
}
|
||||
|
||||
if (v_iBotPackage->GetInt() == botpackage::BOT_MEDIC) {
|
||||
IClientEntity* tr_heal = ENTITY(this->m_hTargetHealing);
|
||||
if (tr_heal) {
|
||||
CachedEntity* tr_heal = ENTITY(this->m_hTargetHealing);
|
||||
if (CE_GOOD(tr_heal)) {
|
||||
AimAtHitbox(tr_heal, 4, cmd);
|
||||
g_pLocalPlayer->bUseSilentAngles = true;
|
||||
}
|
||||
@ -219,38 +216,34 @@ void FollowBot::ActuallyCreateMove(CUserCmd* cmd) {
|
||||
}
|
||||
|
||||
// TODO optimize, cache or something
|
||||
bool FollowBot::IsOwner(IClientEntity* ent) {
|
||||
if (!ent) return false;
|
||||
if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) return false;
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(ent->entindex(), &info)) return false;
|
||||
return (info.friendsID == this->m_nOwnerID);
|
||||
bool FollowBot::IsOwner(CachedEntity* ent) {
|
||||
if (CE_BAD(ent)) return false;
|
||||
return (ent->m_pPlayerInfo && ent->m_pPlayerInfo->friendsID == this->m_nOwnerID);
|
||||
}
|
||||
|
||||
void FollowBot::ResetBotList() {
|
||||
this->m_nOtherBots = 0;
|
||||
}
|
||||
|
||||
bool FollowBot::IsFriendlyBot(IClientEntity* ent) {
|
||||
if (!ent) return false;
|
||||
if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) return false;
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(ent->entindex(), &info)) return false;
|
||||
bool FollowBot::IsFriendlyBot(CachedEntity* ent) {
|
||||
if (CE_BAD(ent)) return false;
|
||||
if (!ent->m_pPlayerInfo) return false;
|
||||
for (unsigned i = 0; i < this->m_nOtherBots && i < 32; i++) {
|
||||
if (info.friendsID == this->m_OtherBots[i]) return true;
|
||||
if (ent->m_pPlayerInfo->friendsID == this->m_OtherBots[i]) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
IClientEntity* FollowBot::GetBestHealingTarget() {
|
||||
IClientEntity* best = 0;
|
||||
CachedEntity* FollowBot::GetBestHealingTarget() {
|
||||
CachedEntity* best = 0;
|
||||
int best_score = -65536;
|
||||
|
||||
for (int i = 0; i < 64 && i < HIGHEST_ENTITY; i++) {
|
||||
IClientEntity* cur = ENTITY(i);
|
||||
if (cur && cur->GetClientClass()->m_ClassID == ClassID::CTFPlayer) {
|
||||
if (NET_INT(cur, netvar.iTeamNum) != g_pLocalPlayer->team) continue;
|
||||
if (NET_BYTE(cur, netvar.iLifeState)) continue;
|
||||
CachedEntity* cur = ENTITY(i);
|
||||
if (CE_BAD(cur)) continue;
|
||||
if (cur->m_Type == ENTITY_PLAYER) {
|
||||
if (cur->m_bEnemy) continue;
|
||||
if (!cur->m_bAlivePlayer) continue;
|
||||
if (cur == g_pLocalPlayer->entity) continue;
|
||||
int score = this->GetHealingPriority(cur);
|
||||
if (score > best_score && score != 0) {
|
||||
@ -271,22 +264,22 @@ bool FollowBot::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int FollowBot::GetHealingPriority(IClientEntity* ent) {
|
||||
int FollowBot::GetHealingPriority(CachedEntity* ent) {
|
||||
if (!ent) return 0;
|
||||
int result = 0;
|
||||
|
||||
if (NET_BYTE(ent, netvar.iLifeState)) return 0;
|
||||
if (NET_INT(ent, netvar.iTeamNum) != g_pLocalPlayer->team) return 0;
|
||||
if (ent->m_bEnemy) return 0;
|
||||
if (!ent->m_bAlivePlayer) return 0;
|
||||
if (!IsEntityVisible(ent, 4)) return 0;
|
||||
|
||||
int health = NET_INT(ent, netvar.iHealth);
|
||||
int health = CE_INT(ent, netvar.iHealth);
|
||||
int maxhealth = g_pPlayerResource->GetMaxHealth(ent);
|
||||
int maxbuffedhealth = maxhealth * 1.5;
|
||||
int maxoverheal = maxbuffedhealth - maxhealth;
|
||||
int overheal = maxoverheal - (maxbuffedhealth - health);
|
||||
float overhealp = ((float)overheal / (float)maxoverheal);
|
||||
float healthp = ((float)health / (float)maxhealth);
|
||||
if (ent->GetAbsOrigin().DistToSqr(g_pLocalPlayer->v_Eye) > 1000 * 1000) return 0;
|
||||
if (ent->m_flDistance > 1000) return 0;
|
||||
|
||||
if (this->IsFriendlyBot(ent)) {
|
||||
// Friendly bot medics must be constantly at 100%+ hp
|
||||
|
@ -30,16 +30,16 @@ public:
|
||||
DECLARE_HACK_METHODS();
|
||||
FollowBot();
|
||||
~FollowBot();
|
||||
void ProcessEntity(IClientEntity* entity, bool enemy);
|
||||
void ProcessEntity(CachedEntity* entity, bool enemy);
|
||||
void Tick(CUserCmd*);
|
||||
int ShouldNotTarget(IClientEntity* ent, bool notrace);
|
||||
int ShouldNotTarget(CachedEntity* ent, bool notrace);
|
||||
|
||||
bool ShouldPopUber(bool force);
|
||||
void ActuallyCreateMove(CUserCmd*);
|
||||
IClientEntity* GetBestHealingTarget();
|
||||
int GetHealingPriority(IClientEntity* ent);
|
||||
bool IsFriendlyBot(IClientEntity* ent);
|
||||
bool IsOwner(IClientEntity* ent);
|
||||
CachedEntity* GetBestHealingTarget();
|
||||
int GetHealingPriority(CachedEntity* ent);
|
||||
bool IsFriendlyBot(CachedEntity* ent);
|
||||
bool IsOwner(CachedEntity* ent);
|
||||
void ResetBotList();
|
||||
void AddBotID(uint32 id);
|
||||
void SetOwner(uint32 id);
|
||||
|
@ -28,7 +28,7 @@ bool HuntsmanCompensation::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (g_pLocalPlayer->life_state) return true;
|
||||
static trace_t* view_trace = new trace_t();
|
||||
Ray_t ray;
|
||||
trace::g_pFilterDefault->SetSelf(g_pLocalPlayer->entity);
|
||||
trace::g_pFilterDefault->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
Vector forward;
|
||||
float sp, sy, cp, cy;
|
||||
sy = sinf(DEG2RAD(cmd->viewangles[1])); // yaw
|
||||
|
@ -13,6 +13,7 @@ class ConVar;
|
||||
class CatVar;
|
||||
class ConCommand;
|
||||
class CCommand;
|
||||
class CachedEntity;
|
||||
|
||||
typedef unsigned int uint32;
|
||||
|
||||
|
@ -47,7 +47,7 @@ void CC_AddRage(const CCommand& args) {
|
||||
rage[n_rage++] = atoi(args[1]);
|
||||
}
|
||||
|
||||
void DumpRecvTable(IClientEntity* ent, RecvTable* table, int depth, const char* ft) {
|
||||
void DumpRecvTable(CachedEntity* ent, RecvTable* table, int depth, const char* ft) {
|
||||
//bool forcetable = strlen(ft);
|
||||
if (!ft || !strcmp(ft, table->GetName()))
|
||||
logging::Info("==== TABLE: %s", table->GetName());
|
||||
@ -60,19 +60,19 @@ void DumpRecvTable(IClientEntity* ent, RecvTable* table, int depth, const char*
|
||||
if (ft && strcmp(ft, table->GetName())) continue;
|
||||
switch (prop->GetType()) {
|
||||
case SendPropType::DPT_Float:
|
||||
logging::Info("%s [0x%04x] = %f", prop->GetName(), prop->GetOffset(), NET_FLOAT(ent, prop->GetOffset()));
|
||||
logging::Info("%s [0x%04x] = %f", prop->GetName(), prop->GetOffset(), CE_FLOAT(ent, prop->GetOffset()));
|
||||
break;
|
||||
case SendPropType::DPT_Int:
|
||||
logging::Info("%s [0x%04x] = %i", prop->GetName(), prop->GetOffset(), NET_INT(ent, prop->GetOffset()));
|
||||
logging::Info("%s [0x%04x] = %i", prop->GetName(), prop->GetOffset(), CE_INT(ent, prop->GetOffset()));
|
||||
break;
|
||||
case SendPropType::DPT_String:
|
||||
logging::Info("%s [0x%04x] = %s", prop->GetName(), prop->GetOffset(), NET_VAR(ent, prop->GetOffset(), char*));
|
||||
logging::Info("%s [0x%04x] = %s", prop->GetName(), prop->GetOffset(), CE_VAR(ent, prop->GetOffset(), char*));
|
||||
break;
|
||||
case SendPropType::DPT_Vector:
|
||||
logging::Info("%s [0x%04x] = (%f, %f, %f)", prop->GetName(), prop->GetOffset(), NET_FLOAT(ent, prop->GetOffset()), NET_FLOAT(ent, prop->GetOffset() + 4), NET_FLOAT(ent, prop->GetOffset() + 8));
|
||||
logging::Info("%s [0x%04x] = (%f, %f, %f)", prop->GetName(), prop->GetOffset(), CE_FLOAT(ent, prop->GetOffset()), CE_FLOAT(ent, prop->GetOffset() + 4), CE_FLOAT(ent, prop->GetOffset() + 8));
|
||||
break;
|
||||
case SendPropType::DPT_VectorXY:
|
||||
logging::Info("%s [0x%04x] = (%f, %f)", prop->GetName(), prop->GetOffset(), NET_FLOAT(ent, prop->GetOffset()), NET_FLOAT(ent, prop->GetOffset() + 4));
|
||||
logging::Info("%s [0x%04x] = (%f, %f)", prop->GetName(), prop->GetOffset(), CE_FLOAT(ent, prop->GetOffset()), CE_FLOAT(ent, prop->GetOffset() + 4));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -85,10 +85,10 @@ void CC_DumpVars(const CCommand& args) {
|
||||
if (args.ArgC() < 1) return;
|
||||
if (!atoi(args[1])) return;
|
||||
int idx = atoi(args[1]);
|
||||
IClientEntity* ent = ENTITY(idx);
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
if (!ent) return;
|
||||
ClientClass* clz = ent->GetClientClass();
|
||||
logging::Info("Entity %i: %s", ent->entindex(), clz->GetName());
|
||||
ClientClass* clz = RAW_ENT(ent)->GetClientClass();
|
||||
logging::Info("Entity %i: %s", ent->m_IDX, clz->GetName());
|
||||
const char* ft = (args.ArgC() > 1 ? args[2] : "");
|
||||
DumpRecvTable(ent, clz->m_pRecvTable, 0, ft);
|
||||
}
|
||||
@ -100,11 +100,9 @@ void CC_ResetLists(const CCommand& args) {
|
||||
|
||||
void CC_DumpPlayers(const CCommand& args) {
|
||||
for (int i = 0; i < 64 && i < HIGHEST_ENTITY; i++) {
|
||||
IClientEntity* ent = ENTITY(i);
|
||||
if (!ent || ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) continue;
|
||||
player_info_t info;
|
||||
if (!interfaces::engineClient->GetPlayerInfo(i, &info)) continue;
|
||||
logging::Info("[%i] FriendID: %lu ; Name: %s", i, info.friendsID, info.name);
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent) || !ent->m_pPlayerInfo) continue;
|
||||
logging::Info("[%i] FriendID: %lu ; Name: %s", i, ent->m_pPlayerInfo->friendsID, ent->m_pPlayerInfo->name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,8 +206,8 @@ void CC_DisonnectVAC(const CCommand& args) {
|
||||
void CC_DumpAttribs(const CCommand& args) {
|
||||
if (g_pLocalPlayer->weapon) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
logging::Info("%i %f", NET_INT(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12),
|
||||
NET_FLOAT(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12 + 4));
|
||||
logging::Info("%i %f", CE_INT(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12),
|
||||
CE_FLOAT(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12 + 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,7 +243,7 @@ Misc::Misc() {
|
||||
c_Disconnect = CreateConCommand(CON_PREFIX "disconnect", CC_Disconnect, "Disconnect");
|
||||
c_DisconnectVAC = CreateConCommand(CON_PREFIX "disconnect_vac", CC_DisonnectVAC, "Disconnect (VAC)");
|
||||
v_bInfoSpam = CreateConVar(CON_PREFIX "info_spam", "0", "Info spam");
|
||||
v_bFakeCrouch = CreateConVar(CON_PREFIX "fakecrouch", "0", "Fake crouch");
|
||||
v_bFastCrouch = CreateConVar(CON_PREFIX "fakecrouch", "0", "Fast crouch");
|
||||
CreateConCommand(CON_PREFIX "set", CC_SetValue, "Set ConVar value (if third argument is 1 the ^'s will be converted into newlines)");
|
||||
}
|
||||
|
||||
@ -267,8 +265,8 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
//ch->SendNetMsg(*(INetMessage*)&setname);
|
||||
//setname.WriteToBuffer(0);
|
||||
}*/
|
||||
if (v_bFakeCrouch->GetBool()) {
|
||||
if (interfaces::gvars->tickcount % 2 == 0) {
|
||||
if (v_bFastCrouch->GetBool()) {
|
||||
if (interfaces::gvars->tickcount % 4 == 0) {
|
||||
cmd->buttons &= ~IN_DUCK;
|
||||
}
|
||||
}
|
||||
@ -278,7 +276,7 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
lastsay++;
|
||||
} else lastsay = 0;
|
||||
if (v_bInfoSpam->GetBool() && (lastsay == 0)) {
|
||||
IClientEntity* ent = ENTITY(curindex++);
|
||||
/*IClientEntity* ent = ENTITY(curindex++);
|
||||
if (curindex >= 64) curindex = 0;
|
||||
//logging::Info("Making string for %i", curindex);
|
||||
if (!ent || ent->IsDormant()) goto breakif;
|
||||
@ -291,7 +289,7 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
if (str) {
|
||||
interfaces::engineClient->ServerCmd(strfmt("say %s", str));
|
||||
lastsay = 1;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
breakif:
|
||||
return true;
|
||||
@ -306,22 +304,21 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
interfaces::baseClient->IN_DeactivateMouse();
|
||||
}*/
|
||||
|
||||
if (g_pLocalPlayer->weapon) {
|
||||
IClientEntity* weapon = g_pLocalPlayer->weapon;
|
||||
AddSideString(colors::white, colors::black, "Weapon: %s [%i]", weapon->GetClientClass()->GetName(), weapon->GetClientClass()->m_ClassID);
|
||||
AddSideString(colors::white, colors::black, "flNextPrimaryAttack: %f", NET_FLOAT(g_pLocalPlayer->weapon, netvar.flNextPrimaryAttack));
|
||||
AddSideString(colors::white, colors::black, "nTickBase: %f", (float)(NET_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick);
|
||||
if (CE_GOOD(g_pLocalPlayer->weapon)) {
|
||||
AddSideString(colors::white, colors::black, "Weapon: %s [%i]", RAW_ENT(g_pLocalPlayer->weapon)->GetClientClass()->GetName(), g_pLocalPlayer->weapon->m_iClassID);
|
||||
AddSideString(colors::white, colors::black, "flNextPrimaryAttack: %f", CE_FLOAT(g_pLocalPlayer->weapon, netvar.flNextPrimaryAttack));
|
||||
AddSideString(colors::white, colors::black, "nTickBase: %f", (float)(CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick);
|
||||
AddSideString(colors::white, colors::black, "CanShoot: %i", CanShoot());
|
||||
AddSideString(colors::white, colors::black, "Decaps: %i", NET_INT(g_pLocalPlayer->entity, netvar.iDecapitations));
|
||||
AddSideString(colors::white, colors::black, "Damage: %f", NET_FLOAT(g_pLocalPlayer->weapon, netvar.flChargedDamage));
|
||||
AddSideString(colors::white, colors::black, "DefIndex: %i", NET_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex));
|
||||
AddSideString(colors::white, colors::black, "Decaps: %i", CE_INT(g_pLocalPlayer->entity, netvar.iDecapitations));
|
||||
AddSideString(colors::white, colors::black, "Damage: %f", CE_FLOAT(g_pLocalPlayer->weapon, netvar.flChargedDamage));
|
||||
AddSideString(colors::white, colors::black, "DefIndex: %i", CE_INT(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex));
|
||||
AddSideString(colors::white, colors::black, "GlobalVars: 0x%08x", interfaces::gvars);
|
||||
AddSideString(colors::white, colors::black, "realtime: %f", interfaces::gvars->realtime);
|
||||
AddSideString(colors::white, colors::black, "interval_per_tick: %f", interfaces::gvars->interval_per_tick);
|
||||
AddSideString(colors::white, colors::black, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - NET_FLOAT(g_pLocalPlayer->weapon, netvar.flLastFireTime)) > 0.95);
|
||||
AddSideString(colors::white, colors::black, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - CE_FLOAT(g_pLocalPlayer->weapon, netvar.flLastFireTime)) > 0.95);
|
||||
AddSideString(colors::white, colors::black, "WeaponMode: %i", GetWeaponMode(g_pLocalPlayer->entity));
|
||||
AddSideString(colors::white, colors::black, "ToGround: %f", DistanceToGround(g_pLocalPlayer->v_Origin));
|
||||
AddSideString(colors::white, colors::black, "ServerTime: %f", NET_FLOAT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick);
|
||||
AddSideString(colors::white, colors::black, "ServerTime: %f", CE_FLOAT(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick);
|
||||
AddSideString(colors::white, colors::black, "CurTime: %f", interfaces::gvars->curtime);
|
||||
AddSideString(colors::white, colors::black, "FrameCount: %i", interfaces::gvars->framecount);
|
||||
float speed, gravity;
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
ConVar* v_bDebugInfo;
|
||||
ConCommand* c_Name;
|
||||
ConVar* v_bInfoSpam;
|
||||
ConVar* v_bFakeCrouch;
|
||||
ConVar* v_bFastCrouch;
|
||||
ConCommand* c_DumpItemAttributes;
|
||||
ConCommand* c_SayLine;
|
||||
ConCommand* c_Shutdown;
|
||||
|
@ -27,14 +27,12 @@ bool SpyAlert::CreateMove(void*, float, CUserCmd* cmd) {
|
||||
void SpyAlert::PaintTraverse(void*, unsigned int, bool, bool) {
|
||||
if (!v_bEnabled->GetBool()) return;
|
||||
for (int i = 0; i < HIGHEST_ENTITY && i < 64; i++) {
|
||||
IClientEntity* ent = ENTITY(i);
|
||||
if (!ent) continue;
|
||||
if (NET_BYTE(ent, netvar.iLifeState)) continue;
|
||||
if (NET_INT(ent, netvar.iClass) != tf_class::tf_spy) continue;
|
||||
if (NET_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) continue;
|
||||
Vector spypos = ent->GetAbsOrigin();
|
||||
Vector mypos = g_pLocalPlayer->v_Origin;
|
||||
float distance = spypos.DistTo(mypos);
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (CE_BAD(ent)) continue;
|
||||
if (CE_BYTE(ent, netvar.iLifeState)) continue;
|
||||
if (CE_INT(ent, netvar.iClass) != tf_class::tf_spy) continue;
|
||||
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) continue;
|
||||
float distance = ent->m_flDistance;
|
||||
if (distance < this->v_flBackstabDistance->GetFloat()) {
|
||||
AddCenterString(colors::yellow, colors::red, "BACKSTAB WARNING! %im", (int)(distance / 64 * 1.22f));
|
||||
} else if (distance < this->v_flWarningDistance->GetFloat()) {
|
||||
|
@ -46,7 +46,7 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
|
||||
if (!local) return;
|
||||
if (NET_BYTE(local, entityvars.iLifeState)) return;*/
|
||||
Ray_t ray;
|
||||
filter->SetSelf(g_pLocalPlayer->entity);
|
||||
filter->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
eye = g_pLocalPlayer->v_Eye;
|
||||
Vector forward;
|
||||
float sp, sy, cp, cy;
|
||||
@ -62,10 +62,12 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
|
||||
forward = forward * 8192.0f + eye;
|
||||
ray.Init(eye, forward);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, filter, enemy_trace);
|
||||
IClientEntity* entity = (IClientEntity*)(enemy_trace->m_pEnt);
|
||||
if (!entity) return true;
|
||||
IClientEntity* raw_entity = (IClientEntity*)(enemy_trace->m_pEnt);
|
||||
if (!raw_entity) return true;
|
||||
CachedEntity* entity = ENTITY(raw_entity->entindex());
|
||||
|
||||
bool isPlayer = false;
|
||||
switch (entity->GetClientClass()->m_ClassID) {
|
||||
switch (entity->m_iClassID) {
|
||||
case ClassID::CTFPlayer:
|
||||
isPlayer = true;
|
||||
break;
|
||||
@ -79,13 +81,11 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
|
||||
default:
|
||||
return true;
|
||||
};
|
||||
int team = g_pLocalPlayer->team;
|
||||
int eteam = NET_INT(entity, netvar.iTeamNum);
|
||||
if (team == eteam) return true;
|
||||
Vector enemy_pos = entity->GetAbsOrigin();
|
||||
Vector my_pos = g_pLocalPlayer->entity->GetAbsOrigin();
|
||||
if (!entity->m_bEnemy) return true;
|
||||
Vector enemy_pos = entity->m_vecOrigin;
|
||||
Vector my_pos = g_pLocalPlayer->entity->m_vecOrigin;
|
||||
if (v_iMinRange->GetInt() > 0) {
|
||||
if ((enemy_pos - my_pos).Length() > v_iMinRange->GetInt()) return true;
|
||||
if (entity->m_flDistance > v_iMinRange->GetInt()) return true;
|
||||
}
|
||||
if (!isPlayer) {
|
||||
cmd->buttons |= IN_ATTACK;
|
||||
@ -96,7 +96,7 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
|
||||
if (IsPlayerInvulnerable(entity)) return true;
|
||||
if (!this->v_bIgnoreCloak->GetBool() &&
|
||||
(IsPlayerInvisible(entity))) return true;
|
||||
int health = NET_INT(entity, netvar.iHealth);
|
||||
int health = CE_INT(entity, netvar.iHealth);
|
||||
bool bodyshot = false;
|
||||
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
|
||||
// If sniper..
|
||||
@ -105,15 +105,15 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
|
||||
}
|
||||
// If we need charge...
|
||||
if (!bodyshot && this->v_bBodyshot->GetBool()) {
|
||||
float bdmg = NET_FLOAT(g_pLocalPlayer->weapon, netvar.flChargedDamage);
|
||||
if (CanHeadshot(g_pLocalPlayer->entity) && (bdmg) >= health) {
|
||||
float bdmg = CE_FLOAT(g_pLocalPlayer->weapon, netvar.flChargedDamage);
|
||||
if (CanHeadshot() && (bdmg) >= health) {
|
||||
bodyshot = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!bodyshot && (g_pLocalPlayer->clazz == tf_class::tf_sniper) && this->v_bZoomedOnly->GetBool() &&
|
||||
!((g_pLocalPlayer->bZoomed) && CanHeadshot(g_pLocalPlayer->entity))) {
|
||||
!((g_pLocalPlayer->bZoomed) && CanHeadshot())) {
|
||||
return true;
|
||||
}
|
||||
//IClientEntity* weapon;
|
||||
|
@ -67,7 +67,7 @@ ConCommand* CreateConCommand(const char* name, FnCommandCallback_t callback, con
|
||||
|
||||
const char* GetModelPath(CachedEntity* entity) {
|
||||
if (!entity) return "NULL";
|
||||
const model_t* model = entity->m_pEntity->GetModel();
|
||||
const model_t* model = RAW_ENT(entity)->GetModel();
|
||||
return interfaces::model->GetModelName(model);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ const char* GetBuildingName(CachedEntity* ent) {
|
||||
}
|
||||
|
||||
/* Takes CBaseAnimating entity as input */
|
||||
item_type GetItemType(IClientEntity* entity) {
|
||||
item_type GetItemType(CachedEntity* entity) {
|
||||
if (entity == 0) return item_type::item_null;
|
||||
const char* path = GetModelPath(entity); /* SDK function */
|
||||
size_t length = strlen(path);
|
||||
@ -171,7 +171,8 @@ void VectorTransform (const float *in1, const matrix3x4_t& in2, float *out)
|
||||
}
|
||||
|
||||
bool GetHitbox(CachedEntity* entity, int hb, Vector& out) {
|
||||
const model_t* model = entity->m_pEntity->GetModel();
|
||||
if (CE_BAD(entity)) return false;
|
||||
const model_t* model = RAW_ENT(entity)->GetModel();
|
||||
if (!model) return false;
|
||||
studiohdr_t* shdr = interfaces::model->GetStudiomodel(model);
|
||||
if (!shdr) return false;
|
||||
@ -180,15 +181,19 @@ bool GetHitbox(CachedEntity* entity, int hb, Vector& out) {
|
||||
mstudiobbox_t* box = set->pHitbox(hb);
|
||||
if (!box) return false;
|
||||
if (box->bone < 0 || box->bone >= 128) return 5;
|
||||
float *min = new float[3](),
|
||||
*max = new float[3]();
|
||||
VectorTransform(box->bbmin, entity->GetBones()[box->bone], *(Vector*)min);
|
||||
VectorTransform(box->bbmax, entity->GetBones()[box->bone], *(Vector*)max);
|
||||
//float *min = new float[3],
|
||||
// *max = new float[3];
|
||||
Vector min, max;
|
||||
SEGV_BEGIN
|
||||
if (entity->GetBones() == 0) logging::Info("no bones!");
|
||||
VectorTransform(box->bbmin, entity->GetBones()[box->bone], min);
|
||||
VectorTransform(box->bbmax, entity->GetBones()[box->bone], max);
|
||||
SEGV_END_INFO("VectorTransform()-ing with unsafe Vector casting");
|
||||
out.x = (min[0] + max[0]) / 2;
|
||||
out.x = (min[1] + max[1]) / 2;
|
||||
out.x = (min[2] + max[2]) / 2;
|
||||
delete[] min;
|
||||
delete[] max;
|
||||
//delete[] min;
|
||||
//delete[] max;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -263,20 +268,21 @@ bool IsEntityVisible(CachedEntity* entity, int hb) {
|
||||
}
|
||||
trace_t trace_visible;
|
||||
Ray_t ray;
|
||||
IClientEntity* local = ENTITY(interfaces::engineClient->GetLocalPlayer());
|
||||
trace_filter->SetSelf(local);
|
||||
CachedEntity* local = ENTITY(interfaces::engineClient->GetLocalPlayer());
|
||||
trace_filter->SetSelf(RAW_ENT(local));
|
||||
Vector hit;
|
||||
if (hb == -1) {
|
||||
hit = entity->m_vecOrigin;
|
||||
} else {
|
||||
if (!GetHitbox(entity, hb, hit)) {
|
||||
return false;
|
||||
}
|
||||
SAFE_CALL( \
|
||||
if (!GetHitbox(entity, hb, hit)) { \
|
||||
return false; \
|
||||
});
|
||||
}
|
||||
ray.Init(local->GetAbsOrigin() + NET_VECTOR(local, netvar.vViewOffset), hit);
|
||||
ray.Init(local->m_vecOrigin + g_pLocalPlayer->v_ViewOffset, hit);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace_filter, &trace_visible);
|
||||
if (trace_visible.m_pEnt) {
|
||||
return ((IClientEntity*)trace_visible.m_pEnt) == entity->m_pEntity;
|
||||
return ((IClientEntity*)trace_visible.m_pEnt) == RAW_ENT(entity);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -313,10 +319,10 @@ bool IsBuildingVisible(CachedEntity* ent) {
|
||||
}
|
||||
trace_t trace_visible;
|
||||
Ray_t ray;
|
||||
trace_filter->SetSelf(g_pLocalPlayer->entity);
|
||||
trace_filter->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
ray.Init(g_pLocalPlayer->v_Eye, GetBuildingPosition(ent));
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace_filter, &trace_visible);
|
||||
return (IClientEntity*)trace_visible.m_pEnt == ent->m_pEntity;
|
||||
return (IClientEntity*)trace_visible.m_pEnt == RAW_ENT(ent);
|
||||
}
|
||||
|
||||
void fVectorAngles(Vector &forward, Vector &angles) {
|
||||
@ -399,13 +405,13 @@ void Patch(void* address, void* patch, size_t length) {
|
||||
|
||||
bool IsProjectileCrit(CachedEntity* ent) {
|
||||
if (ent->m_bGrenadeProjectile)
|
||||
return NET_BYTE(ent, netvar.Grenade_bCritical);
|
||||
return NET_BYTE(ent, netvar.Rocket_bCritical);
|
||||
return CE_BYTE(ent, netvar.Grenade_bCritical);
|
||||
return CE_BYTE(ent, netvar.Rocket_bCritical);
|
||||
}
|
||||
|
||||
weaponmode GetWeaponMode(CachedEntity* player) {
|
||||
int weapon_handle = CE_INT(player, netvar.hActiveWeapon);
|
||||
CachedEntity* weapon = ENTITY(weapon_handle & 0xFFF);
|
||||
CachedEntity* weapon = (weapon_handle & 0xFFF < HIGHEST_ENTITY ? ENTITY(weapon_handle & 0xFFF) : 0);
|
||||
if (CE_BAD(weapon)) return weaponmode::weapon_invalid;
|
||||
if (IsMeleeWeapon(weapon)) return weaponmode::weapon_melee;
|
||||
switch (weapon->m_iClassID) {
|
||||
@ -451,13 +457,13 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) {
|
||||
break;
|
||||
case ClassID::CTFGrenadeLauncher:
|
||||
// TODO offset (GetProjectileSpeed)
|
||||
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(weapon);
|
||||
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(RAW_ENT(weapon));
|
||||
// TODO Wrong grenade launcher gravity
|
||||
rgrav = 0.5f;
|
||||
break;
|
||||
case ClassID::CTFCompoundBow: {
|
||||
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(weapon);
|
||||
rgrav = ((GetProjectileData*) *(*(const void ***) weapon + 528))(weapon);
|
||||
rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(RAW_ENT(weapon));
|
||||
rgrav = ((GetProjectileData*) *(*(const void ***) weapon + 528))(RAW_ENT(weapon));
|
||||
} break;
|
||||
case ClassID::CTFBat_Wood:
|
||||
rspeed = 3000.0f;
|
||||
@ -511,7 +517,7 @@ bool IsVectorVisible(Vector origin, Vector target) {
|
||||
}
|
||||
trace_t trace_visible;
|
||||
Ray_t ray;
|
||||
vec_filter->SetSelf(g_pLocalPlayer->entity);
|
||||
vec_filter->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
ray.Init(origin, target);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, vec_filter, &trace_visible);
|
||||
float dist2 = origin.DistToSqr(trace_visible.endpos);
|
||||
@ -571,10 +577,6 @@ bool IsAmbassador(CachedEntity* entity) {
|
||||
return (defidx == 61 || defidx == 1006);
|
||||
}
|
||||
|
||||
bool CheckCE(CachedEntity* entity) {
|
||||
return (entity && entity->m_pEntity && !entity->m_pEntity->IsDormant());
|
||||
}
|
||||
|
||||
// F1 c&p
|
||||
Vector CalcAngle(Vector src, Vector dst) {
|
||||
Vector AimAngles;
|
||||
@ -638,12 +640,11 @@ void AimAt(Vector origin, Vector target, CUserCmd* cmd) {
|
||||
cmd->viewangles = angles;
|
||||
}
|
||||
|
||||
/*void AimAtHitbox(IClientEntity* ent, int hitbox, CUserCmd* cmd) {
|
||||
Vector r = ent->GetAbsOrigin();
|
||||
void AimAtHitbox(CachedEntity* ent, int hitbox, CUserCmd* cmd) {
|
||||
Vector r = ent->m_vecOrigin;
|
||||
GetHitbox(ent, hitbox, r);
|
||||
AimAt(g_pLocalPlayer->v_Eye, r, cmd);
|
||||
//logging::Info("Aiming at %f %f %f", r.x, r.y, r.z);
|
||||
}*/
|
||||
}
|
||||
|
||||
bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
|
||||
if (!trace::g_pFilterPenetration) {
|
||||
@ -651,19 +652,18 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
|
||||
}
|
||||
trace_t trace_visible;
|
||||
Ray_t ray;
|
||||
IClientEntity* local = ENTITY(interfaces::engineClient->GetLocalPlayer());
|
||||
trace::g_pFilterPenetration->SetSelf(local);
|
||||
trace::g_pFilterPenetration->SetSelf(RAW_ENT(g_pLocalPlayer->entity));
|
||||
trace::g_pFilterPenetration->Reset();
|
||||
Vector hit;
|
||||
int ret = GetHitbox(entity, hb, hit);
|
||||
if (ret) {
|
||||
return false;
|
||||
}
|
||||
ray.Init(local->GetAbsOrigin() + NET_VECTOR(local, netvar.vViewOffset), hit);
|
||||
ray.Init(g_pLocalPlayer->v_Origin + g_pLocalPlayer->v_ViewOffset, hit);
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterPenetration, &trace_visible);
|
||||
bool s = false;
|
||||
if (trace_visible.m_pEnt) {
|
||||
s = ((IClientEntity*)trace_visible.m_pEnt) == entity;
|
||||
s = ((IClientEntity*)trace_visible.m_pEnt) == RAW_ENT(entity);
|
||||
}
|
||||
if (!s) return false;
|
||||
interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterDefault, &trace_visible);
|
||||
@ -671,7 +671,7 @@ bool IsEntityVisiblePenetration(CachedEntity* entity, int hb) {
|
||||
IClientEntity* ent = (IClientEntity*)trace_visible.m_pEnt;
|
||||
if (ent) {
|
||||
if (ent->GetClientClass()->m_ClassID == ClassID::CTFPlayer) {
|
||||
if (ent == entity) return false;
|
||||
if (ent == RAW_ENT(entity)) return false;
|
||||
if (trace_visible.hitbox >= 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -26,9 +26,6 @@ class Vector;
|
||||
#include "fixsdk.h"
|
||||
#include <tier1/convar.h>
|
||||
|
||||
#define HIGHEST_ENTITY gEntityCache.m_nMax
|
||||
#define ENTITY(idx) gEntityCache.GetEntity(idx)->m_pEntity
|
||||
|
||||
//typedef void ( *FnCommandCallback_t )( const CCommand &command );
|
||||
|
||||
// TODO split this shit
|
||||
@ -79,13 +76,13 @@ bool IsAmbassador(CachedEntity* ent);
|
||||
void Patch(void* address, void* patch, size_t length);
|
||||
|
||||
void AimAt(Vector origin, Vector target, CUserCmd* cmd);
|
||||
void AimAtHitbox(IClientEntity* ent, int hitbox, CUserCmd* cmd);
|
||||
void AimAtHitbox(CachedEntity* ent, int hitbox, CUserCmd* cmd);
|
||||
|
||||
bool IsMeleeWeapon(CachedEntity* ent);
|
||||
bool IsProjectileCrit(CachedEntity* ent);
|
||||
|
||||
QAngle VectorToQAngle(Vector& in);
|
||||
Vector QAngleToVector(QAngle& in);
|
||||
QAngle VectorToQAngle(Vector in);
|
||||
Vector QAngleToVector(QAngle in);
|
||||
|
||||
bool CanHeadshot();
|
||||
bool CanShoot();
|
||||
|
@ -11,16 +11,21 @@
|
||||
void LocalPlayer::Update() {
|
||||
entity_idx = interfaces::engineClient->GetLocalPlayer();
|
||||
entity = ENTITY(entity_idx);
|
||||
team = NET_INT(entity, netvar.iTeamNum);
|
||||
life_state = NET_BYTE(entity, netvar.iLifeState);
|
||||
v_ViewOffset = NET_VECTOR(entity, netvar.vViewOffset);
|
||||
v_Origin = entity->GetAbsOrigin();
|
||||
if (!entity) logging::Info("Local Player is NULL!");
|
||||
if (CE_BAD(entity)) logging::Info("Local Player is BAD CACHED ENTITY!");
|
||||
team = CE_INT(entity, netvar.iTeamNum);
|
||||
life_state = CE_BYTE(entity, netvar.iLifeState);
|
||||
v_ViewOffset = CE_VECTOR(entity, netvar.vViewOffset);
|
||||
v_Origin = entity->m_vecOrigin;
|
||||
v_Eye = v_Origin + v_ViewOffset;
|
||||
cond_0 = NET_INT(entity, netvar.iCond);
|
||||
clazz = NET_INT(entity, netvar.iClass);
|
||||
health = NET_INT(entity, netvar.iHealth);
|
||||
cond_0 = CE_INT(entity, netvar.iCond);
|
||||
cond_1 = CE_INT(entity, netvar.iCond1);
|
||||
cond_2 = CE_INT(entity, netvar.iCond1);
|
||||
cond_3 = CE_INT(entity, netvar.iCond3);
|
||||
clazz = CE_INT(entity, netvar.iClass);
|
||||
health = CE_INT(entity, netvar.iHealth);
|
||||
this->bUseSilentAngles = false;
|
||||
bZoomed = NET_INT(entity, netvar.iFOV) == 20; //!= NET_INT(entity, netvar.iDefaultFOV);
|
||||
bZoomed = CE_INT(entity, netvar.iFOV) == 20; //!= NET_INT(entity, netvar.iDefaultFOV);
|
||||
if (bZoomed) {
|
||||
if (flZoomBegin == 0.0f) flZoomBegin = interfaces::gvars->curtime;
|
||||
} else {
|
||||
@ -28,11 +33,11 @@ void LocalPlayer::Update() {
|
||||
}
|
||||
|
||||
|
||||
int hWeapon = NET_INT(entity, netvar.hActiveWeapon);
|
||||
int hWeapon = CE_INT(entity, netvar.hActiveWeapon);
|
||||
if (hWeapon && (hWeapon & 0xFFF) < HIGHEST_ENTITY) {
|
||||
weapon = ENTITY(hWeapon & 0xFFF);
|
||||
if (weapon)
|
||||
bIsReloading = (NET_INT(weapon, netvar.iReloadMode) == 1);
|
||||
bIsReloading = (CE_INT(weapon, netvar.iReloadMode) == 1);
|
||||
} else {
|
||||
weapon = 0;
|
||||
bIsReloading = false;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "fixsdk.h"
|
||||
#include <mathlib/vector.h>
|
||||
|
||||
class IClientEntity;
|
||||
class CachedEntity;
|
||||
|
||||
class LocalPlayer {
|
||||
public:
|
||||
|
@ -11,7 +11,7 @@ void TFPlayerResource::Update() {
|
||||
m_pEntity = 0;
|
||||
for (int i = 0; i < HIGHEST_ENTITY; i++) {
|
||||
CachedEntity* ent = ENTITY(i);
|
||||
if (ent && ent->m_iClassID == ClassID::CTFPlayerResource) {
|
||||
if (CE_GOOD(ent) && ent->m_iClassID == ClassID::CTFPlayerResource) {
|
||||
m_pEntity = ent;
|
||||
}
|
||||
}
|
||||
@ -21,14 +21,14 @@ int TFPlayerResource::GetMaxHealth(CachedEntity* player) {
|
||||
if (!m_pEntity) return 0;
|
||||
int idx = player->m_IDX;
|
||||
if (idx >= 64 || idx < 0) return 0;
|
||||
return *(int*)((unsigned int)m_pEntity + netvar.iMaxHealth + 4 * idx);
|
||||
return *(int*)((unsigned int)RAW_ENT(m_pEntity) + netvar.iMaxHealth + 4 * idx);
|
||||
}
|
||||
|
||||
int TFPlayerResource::GetMaxBuffedHealth(CachedEntity* player) {
|
||||
if (!m_pEntity) return 0;
|
||||
int idx = player->m_IDX;
|
||||
if (idx >= 64 || idx < 0) return 0;
|
||||
return *(int*)((unsigned int)m_pEntity + netvar.iMaxBuffedHealth + 4 * idx);
|
||||
return *(int*)((unsigned int)RAW_ENT(m_pEntity) + netvar.iMaxBuffedHealth + 4 * idx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,24 +10,24 @@
|
||||
#include "common.h"
|
||||
#include "sdk.h"
|
||||
|
||||
Vector SimpleLatencyPrediction(IClientEntity* ent, int hb) {
|
||||
//logging::Info("Simple prediction!");
|
||||
// TODO there is a Vector() object created each call.
|
||||
|
||||
Vector SimpleLatencyPrediction(CachedEntity* ent, int hb) {
|
||||
if (!ent) return Vector();
|
||||
Vector result;
|
||||
GetHitbox(ent, hb, result);
|
||||
float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
result += NET_VECTOR(ent, netvar.vVelocity) * latency;
|
||||
//logging::Info("Returning!");
|
||||
result += CE_VECTOR(ent, netvar.vVelocity) * latency;
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravitymod) {
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod) {
|
||||
if (!ent) return Vector();
|
||||
Vector result = ent->GetAbsOrigin();
|
||||
Vector result = ent->m_vecOrigin;
|
||||
float dtg = DistanceToGround(result);
|
||||
GetHitbox(ent, hb, result);
|
||||
Vector vel = NET_VECTOR(ent, netvar.vVelocity);
|
||||
Vector vel = CE_VECTOR(ent, netvar.vVelocity);
|
||||
// TODO ProjAim
|
||||
/*float tt = g_pLocalPlayer->v_Eye.DistTo(result) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING) - 0.20;
|
||||
@ -42,7 +42,7 @@ Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravi
|
||||
float ttt = dtt / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) +
|
||||
interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING);
|
||||
float oz = result.z;
|
||||
int flags = NET_INT(ent, netvar.iFlags);
|
||||
int flags = CE_INT(ent, netvar.iFlags);
|
||||
bool ground = (flags & (1 << 0));
|
||||
if (!ground) result.z -= ttt * ttt * 400;
|
||||
result += vel * ttt;
|
||||
|
@ -10,11 +10,11 @@
|
||||
|
||||
#include "enums.h"
|
||||
|
||||
class IClientEntity;
|
||||
class CachedEntity;
|
||||
class Vector;
|
||||
|
||||
Vector SimpleLatencyPrediction(IClientEntity* ent, int hb);
|
||||
Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravitymod);
|
||||
Vector SimpleLatencyPrediction(CachedEntity* ent, int hb);
|
||||
Vector ProjectilePrediction(CachedEntity* ent, int hb, float speed, float gravitymod);
|
||||
|
||||
float DistanceToGround(Vector origin);
|
||||
|
||||
|
Reference in New Issue
Block a user