static CatVars: autoreflect & autosticky

This commit is contained in:
nullifiedcat 2017-03-17 20:39:02 +03:00
parent afa514f2e8
commit 0ecbcd0dd5
15 changed files with 77 additions and 241 deletions

View File

@ -107,14 +107,14 @@ void CMenuWindow::AddElements() {
ADDCVAR(&hacks::shared::triggerbot::max_range);
if (TF) {
ADDLABEL("AutoSticky");
ADDCVAR(g_phAutoSticky->v_bEnabled);
ADDCVAR(g_phAutoSticky->v_bBuildings);
ADDCVAR(g_phAutoSticky->v_flDetonateDistance);
ADDCVAR(&hacks::tf::autosticky::enabled);
ADDCVAR(&hacks::tf::autosticky::buildings);
ADDCVAR(&hacks::tf::autosticky::distance);
ADDLABEL("AutoReflect");
ADDCVAR(g_phAutoReflect->v_bEnabled);
ADDCVAR(g_phAutoReflect->v_bDisableWhenAttacking);
ADDCVAR(g_phAutoReflect->v_bReflectStickies);
ADDCVAR(g_phAutoReflect->v_iReflectDistance);
ADDCVAR(&hacks::tf::autoreflect::enabled);
ADDCVAR(&hacks::tf::autoreflect::idle_only);
ADDCVAR(&hacks::tf::autoreflect::stickies);
ADDCVAR(&hacks::tf::autoreflect::max_distance);
}
AddTab("misc", "Misc");
tab = GetTab("misc");

View File

@ -56,18 +56,13 @@
bool hack::shutdown = false;
void hack::InitHacks() {
ADD_HACK(AutoStrafe);
if (TF) ADD_HACK(AutoReflect);
//ADD_HACK(FollowBot);
ADD_HACK(Misc);
ADD_HACK(Aimbot);
ADD_HACK(Bunnyhop);
ADD_HACK(ESP);
if (TF) ADD_HACK(AutoSticky);
if (TF2) ADD_HACK(Glow);
ADD_HACK(KillSay);
ADD_HACK(Spam);
if (TF2) ADD_HACK(Noisemaker);
}
ConCommand* hack::c_Cat = 0;
@ -189,16 +184,11 @@ void hack::Shutdown() {
if (hooks::hkNetChannel) hooks::hkNetChannel->Kill();
if (hooks::hkStudioRender) hooks::hkStudioRender->Kill();
ConVar_Unregister();
DELETE_HACK(AutoStrafe);
if (TF) DELETE_HACK(AutoReflect);
//DELETE_HACK(FollowBot);
DELETE_HACK(Misc);
DELETE_HACK(Aimbot);
DELETE_HACK(Bunnyhop);
DELETE_HACK(ESP);
if (TF) DELETE_HACK(AutoSticky);
if (TF) DELETE_HACK(Glow);
DELETE_HACK(KillSay);
if (TF2) DELETE_HACK(Noisemaker);
DELETE_HACK(Spam);
}

View File

@ -10,39 +10,17 @@
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(AutoReflect);
namespace hacks { namespace tf { namespace autoreflect {
bool AutoReflect::ShouldReflect(CachedEntity* ent) {
if (CE_BAD(ent)) return false;
if (ent->m_Type != ENTITY_PROJECTILE) return false;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false;
// If projectile is already deflected, don't deflect it again.
if (CE_INT(ent, (ent->m_bGrenadeProjectile ?
/* NetVar for grenades */ netvar.Grenade_iDeflected :
/* For rockets */ netvar.Rocket_iDeflected))) return false;
if (ent->m_iClassID == g_pClassID->CTFGrenadePipebombProjectile) {
if (CE_INT(ent, netvar.iPipeType) == 1) {
if (!v_bReflectStickies->GetBool()) return false;
}
}
return true;
}
CatVar enabled(CV_SWITCH, "reflect_enabled", "0", "AutoReflect", "Master AutoReflect switch");
CatVar idle_only(CV_SWITCH, "reflect_only_idle", "0", "Only when not shooting", "Don't AutoReflect if you're holding M1");
CatVar stickies(CV_SWITCH, "reflect_stickybombs", "0", "Reflect stickies", "Reflect Stickybombs");
CatVar max_distance(CV_INT, "reflect_distance", "200", "Distance", "Maximum distance to reflect at", true, 300.0f);
// Hack Methods
AutoReflect::AutoReflect() {
v_bEnabled = new CatVar(CV_SWITCH, "reflect_enabled", "0", "Enable", NULL, "Master AutoReflect switch");
v_iReflectDistance = new CatVar(CV_INT, "reflect_distance", "200", "Distance", NULL, "Maximum distance to reflect at", true, 300.0f);
v_bDisableWhenAttacking = new CatVar(CV_SWITCH, "reflect_only_idle", "0", "Only when not shooting", NULL, "Don't AutoReflect if you're holding M1");
v_bReflectStickies = new CatVar(CV_SWITCH, "reflect_stickybombs", "0", "Reflect stickies", NULL, "Reflect Stickybombs");
}
// TODO
void AutoReflect::ProcessUserCmd(CUserCmd* cmd) {
if (!v_bEnabled->GetBool()) return;
if (CE_BAD(g_pLocalPlayer->weapon()) || CE_BAD(g_pLocalPlayer->entity)) return;
if (g_pLocalPlayer->life_state) return;
void CreateMove() {
if (!enabled) return;
if (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFFlameThrower) return;
if (v_bDisableWhenAttacking->GetBool() && (cmd->buttons & IN_ATTACK)) return;
if (idle_only && (g_pUserCmd->buttons & IN_ATTACK)) return;
CachedEntity* closest = 0;
float closest_dist = 0.0f;
@ -58,14 +36,32 @@ void AutoReflect::ProcessUserCmd(CUserCmd* cmd) {
}
}
if (CE_BAD(closest)) return;
if (closest_dist == 0 || closest_dist > SQR(v_iReflectDistance->GetInt())) return;
if (closest_dist == 0 || closest_dist > SQR((int)max_distance)) return;
Vector tr = (closest->m_vecOrigin - g_pLocalPlayer->v_Eye);
Vector angles;
fVectorAngles(tr, angles);
fClampAngle(angles);
cmd->viewangles = angles;
g_pUserCmd->viewangles = angles;
g_pLocalPlayer->bUseSilentAngles = true;
cmd->buttons |= IN_ATTACK2;
g_pUserCmd->buttons |= IN_ATTACK2;
return;
}
bool ShouldReflect(CachedEntity* ent) {
if (CE_BAD(ent)) return false;
if (ent->m_Type != ENTITY_PROJECTILE) return false;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false;
// If projectile is already deflected, don't deflect it again.
if (CE_INT(ent, (ent->m_bGrenadeProjectile ?
/* NetVar for grenades */ netvar.Grenade_iDeflected :
/* For rockets */ netvar.Rocket_iDeflected))) return false;
if (ent->m_iClassID == g_pClassID->CTFGrenadePipebombProjectile) {
if (CE_INT(ent, netvar.iPipeType) == 1) {
if (!stickies) return false;
}
}
return true;
}
}}}

View File

@ -10,19 +10,16 @@
#include "IHack.h"
class AutoReflect : public IHack {
public:
AutoReflect();
namespace hacks { namespace tf { namespace autoreflect {
virtual void ProcessUserCmd(CUserCmd*) override;
extern CatVar enabled;
extern CatVar idle_only;
extern CatVar stickies;
extern CatVar max_distance;
bool ShouldReflect(CachedEntity* ent);
CatVar* v_bEnabled;
CatVar* v_bDisableWhenAttacking;
CatVar* v_bReflectStickies;
CatVar* v_iReflectDistance;
};
void CreateMove();
bool ShouldReflect(CachedEntity* ent);
DECLARE_HACK_SINGLETON(AutoReflect);
}}}
#endif /* HACKS_AUTOREFLECT_H_ */

View File

@ -10,33 +10,26 @@
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(AutoSticky);
namespace hacks { namespace tf { namespace autosticky {
// TODO scottish cyclops
AutoSticky::AutoSticky() {
this->v_flDetonateDistance = new CatVar(CV_INT, "sticky_distance", "200", "Distance", NULL, "Maximum distance to detonate");
this->v_bBuildings = new CatVar(CV_SWITCH, "sticky_buildings", "1", "Detonate buildings", NULL, "Stickies react at buildings");
this->v_bEnabled = new CatVar(CV_SWITCH, "sticky_enabled", "0", "Enable", NULL, "Master AutoSticky switch");
this->v_bScottish = new CatVar(CV_SWITCH, "sticky_scottish", "0", "Scottish", NULL, "Scottish Resistance mode - NOT YET IMPLEMENTED");
}
CatVar enabled(CV_SWITCH, "sticky_enabled", "0", "AutoSticky", NULL, "Master AutoSticky switch");
CatVar buildings(CV_SWITCH, "sticky_buildings", "1", "Detonate buildings", NULL, "Stickies react to buildings");
CatVar distance(CV_INT, "sticky_distance", "200", "Distance", NULL, "Maximum distance to detonate");
bool AutoSticky::ShouldDetonate(CachedEntity* bomb) {
bool ShouldDetonate(CachedEntity* bomb) {
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_Type != ENTITY_PLAYER && (ent->m_Type != ENTITY_BUILDING || !buildings)) continue;
if (ent->m_iTeam == CE_INT(bomb, netvar.iTeamNum)) continue;
if (ent->m_vecOrigin.DistToSqr(bomb->m_vecOrigin) > SQR(this->v_flDetonateDistance->GetFloat())) continue;
if (ent->m_vecOrigin.DistToSqr(bomb->m_vecOrigin) > SQR((float)distance)) continue;
return true;
}
return false;
}
void AutoSticky::ProcessUserCmd(CUserCmd* cmd) {
if (!this->v_bEnabled->GetBool()) return;
if (CE_BAD(g_pLocalPlayer->entity)) return;
if (CE_BAD(g_pLocalPlayer->weapon())) return;
if (g_pLocalPlayer->life_state) return;
void CreateMove() {
if (!enabled) return;
if (g_pLocalPlayer->clazz != tf_demoman) return;
for (int i = 0; i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
@ -45,8 +38,10 @@ void AutoSticky::ProcessUserCmd(CUserCmd* cmd) {
if (CE_INT(ent, netvar.iPipeType) != 1) continue;
if ((CE_INT(ent, netvar.hThrower) & 0xFFF) != g_pLocalPlayer->entity->m_IDX) continue;
if (ShouldDetonate(ent)) {
cmd->buttons |= IN_ATTACK2;
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
return;
}
}}}

View File

@ -10,21 +10,15 @@
#include "IHack.h"
class CachedEntity;
namespace hacks { namespace tf { namespace autosticky {
class AutoSticky : public IHack {
public:
AutoSticky();
extern CatVar enabled;
extern CatVar buildings;
extern CatVar distance;
virtual void ProcessUserCmd(CUserCmd*) override;
bool ShouldDetonate(CachedEntity* bomb);
void CreateMove();
bool ShouldDetonate(CachedEntity* bomb);
CatVar* v_bEnabled;
CatVar* v_bBuildings;
CatVar* v_bScottish;
CatVar* v_flDetonateDistance;
};
DECLARE_HACK_SINGLETON(AutoSticky);
}}}
#endif /* HACKS_AUTOSTICKY_H_ */

View File

@ -1,32 +0,0 @@
/*
* AutoStrafe.cpp
*
* Created on: Nov 26, 2016
* Author: nullifiedcat
*/
#include "AutoStrafe.h"
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(AutoStrafe);
AutoStrafe::AutoStrafe() {
v_bEnabled = new CatVar(CV_SWITCH, "autostrafe", "0", "Enable AutoStrafe", NULL, "AutoStrafe switch. Doesn't work.");
}
void AutoStrafe::ProcessUserCmd(CUserCmd* cmd) {
if (!v_bEnabled->GetBool()) return;
bool sw = false;
if (CE_GOOD(g_pLocalPlayer->entity) && !g_pLocalPlayer->life_state) {
// TODO FL_ONGROUND
if (CE_INT(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0)) return;
cmd->sidemove += (sw) ? -30.0f : 30.0f;
cmd->viewangles.y += sw ? -15.0f : 15.0f;
g_pLocalPlayer->bUseSilentAngles = true;
sw = !sw;
}
return;
}

View File

@ -1,24 +0,0 @@
/*
* AutoStrafe.h
*
* Created on: Nov 26, 2016
* Author: nullifiedcat
*/
#ifndef HACKS_AUTOSTRAFE_H_
#define HACKS_AUTOSTRAFE_H_
#include "IHack.h"
class AutoStrafe : public IHack {
public:
AutoStrafe();
virtual void ProcessUserCmd(CUserCmd*) override;
CatVar* v_bEnabled;
};
DECLARE_HACK_SINGLETON(AutoStrafe);
#endif /* HACKS_AUTOSTRAFE_H_ */

View File

@ -1,37 +0,0 @@
/*
* Glow.cpp
*
* Created on: Jan 16, 2017
* Author: nullifiedcat
*/
#include "Glow.h"
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(Glow);
Glow::Glow() {
v_bEnabled = new CatVar(CV_SWITCH, "glow_enabled", "0", "Glow ESP", NULL, "Simply adds glow to all entities - DO NOT USE!");
m_bEnabledOnce = false;
}
void Glow::ProcessUserCmd(CUserCmd*) {
if (v_bEnabled->GetBool()) m_bEnabledOnce = true;
if (!m_bEnabledOnce) return;
for (int i = 0; i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (!CE_GOOD_NO_DORMANT_CHECK(ent)) continue;
if (ent->m_Type == ENTITY_PLAYER)
CE_BYTE(ent, netvar.bGlowEnabled) = (v_bEnabled->GetBool() && (ent != LOCAL_E) && !ent->m_pEntity->IsDormant() && !CE_BYTE(ent, netvar.iLifeState));
}
return;
}
void Glow::OnLevelInit() {
m_bEnabledOnce = false;
}
void Glow::OnLevelShutdown() {
m_bEnabledOnce = false;
}

View File

@ -1,27 +0,0 @@
/*
* Glow.h
*
* Created on: Jan 16, 2017
* Author: nullifiedcat
*/
#ifndef HACKS_GLOW_H_
#define HACKS_GLOW_H_
#include "IHack.h"
class Glow : public IHack {
public:
Glow();
virtual void ProcessUserCmd(CUserCmd*) override;
virtual void OnLevelInit() override;
virtual void OnLevelShutdown() override;
CatVar* v_bEnabled;
bool m_bEnabledOnce;
};
DECLARE_HACK_SINGLETON(Glow);
#endif /* HACKS_GLOW_H_ */

View File

@ -11,20 +11,18 @@
#include "../common.h"
#include "../sdk.h"
DEFINE_HACK_SINGLETON(Noisemaker);
namespace hacks { namespace tf2 { namespace noisemaker {
Noisemaker::Noisemaker() {
v_bEnabled = new CatVar(CV_SWITCH, "noisemaker", "0", "Noisemaker spam", NULL, "Spams noisemakers really fast");
}
extern CatVar enabled(CV_SWITCH, "noisemaker", "0", "Noisemaker spam", "DOES NOT WORK. Causes SEGV when enabled.");
void Noisemaker::ProcessUserCmd(CUserCmd*) {
void CreateMove() {
/*static uintptr_t sig = gSignatures.GetClientSignature("8B 06 89 34 24 FF 90 DC 02 00 00 84 C0 74 E2 8B 06 89 34 24 FF 90 D4 01 00 00 83 F8 01 7E D2 C7 04 24 20 00 00 00 E8 ? ? ? ? C7 44 24 04 ? ? ? ? 89 C6 89 04 24 E8 ? ? ? ? A1 ? ? ? ? 8B 10 89 04 24 89 74 24 04 FF 92 00 02 00 00");
typedef KeyValues*(KeyValues__operator_new_t)(size_t);
typedef void(KeyValues__KeyValues_t)(KeyValues*, const char*);
static KeyValues__operator_new_t* KeyValues__operator_new = (KeyValues__operator_new_t*)(*(uintptr_t*)(sig + 39) + (sig + 39) + 4);
static KeyValues__KeyValues_t* KeyValues__KeyValues = (KeyValues__KeyValues_t*)(*(uintptr_t*)(sig + 57) + (sig + 57) + 4);
static unsigned engine = (unsigned)(sig + 62);*/
if (v_bEnabled->GetBool()) {
if (enabled) {
//AddCenterString(colors::red, "no noisemaker spam for you noob");
/*//logging::Info("0x%08x 0x%08x", KeyValues__operator_new, KeyValues__KeyValues);
logging::Info("Creating!");
@ -49,3 +47,4 @@ void Noisemaker::ProcessUserCmd(CUserCmd*) {
return;
}
}}}

View File

@ -10,15 +10,12 @@
#include "IHack.h"
class Noisemaker : public IHack {
public:
Noisemaker();
namespace hacks { namespace tf2 { namespace noisemaker {
virtual void ProcessUserCmd(CUserCmd*) override;
extern CatVar enabled;
CatVar* v_bEnabled;
};
void CreateMove();
DECLARE_HACK_SINGLETON(Noisemaker);
}}}
#endif /* HACKS_NOISEMAKER_H_ */

View File

@ -15,14 +15,12 @@
#include "AutoHeal.h"
#include "AutoReflect.h"
#include "AutoSticky.h"
#include "AutoStrafe.h"
#include "Bunnyhop.h"
#include "ESP.h"
#include "FollowBot.h"
#include "Misc.h"
#include "SpyAlert.h"
#include "Trigger.h"
#include "Glow.h"
#include "KillSay.h"
#include "Achievement.h"
#include "Spam.h"

View File

@ -97,18 +97,16 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
// PROF_BEGIN();
//RunEnginePrediction(g_pLocalPlayer->entity, cmd);
SAFE_CALL(HACK_PROCESS_USERCMD(ESP, cmd));
if (!g_pLocalPlayer->life_state) {
if (TF2) SAFE_CALL(HACK_PROCESS_USERCMD(Noisemaker, cmd));
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) {
if (TF2) SAFE_CALL(hacks::tf2::noisemaker::CreateMove());
SAFE_CALL(HACK_PROCESS_USERCMD(Bunnyhop, cmd));
SAFE_CALL(HACK_PROCESS_USERCMD(AutoStrafe, cmd));
SAFE_CALL(HACK_PROCESS_USERCMD(Aimbot, cmd));
SAFE_CALL(hacks::shared::antiaim::ProcessUserCmd(cmd));
if (TF) SAFE_CALL(HACK_PROCESS_USERCMD(AutoSticky, cmd));
if (TF) SAFE_CALL(HACK_PROCESS_USERCMD(AutoReflect, cmd));
if (TF) SAFE_CALL(hacks::tf::autosticky::CreateMove());
if (TF) SAFE_CALL(hacks::tf::autoreflect::CreateMove());
SAFE_CALL(hacks::shared::triggerbot::CreateMove());
if (TF) SAFE_CALL(hacks::tf::autoheal::CreateMove());
}
if (TF) SAFE_CALL(hacks::tf::autoheal::CreateMove());
if (TF2) SAFE_CALL(HACK_PROCESS_USERCMD(Glow, cmd));
//SAFE_CALL(CREATE_MOVE(FollowBot));
SAFE_CALL(HACK_PROCESS_USERCMD(Misc, cmd));
SAFE_CALL(HACK_PROCESS_USERCMD(KillSay, cmd));

View File

@ -132,15 +132,11 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
g_IEngine->ExecuteClientCmd("exec cat_matchexec");
LEVEL_INIT(Aimbot);
hacks::shared::airstuck::Reset();
if (TF) LEVEL_INIT(AutoReflect);
if (TF) LEVEL_INIT(AutoSticky);
LEVEL_INIT(AutoStrafe);
LEVEL_INIT(Bunnyhop);
LEVEL_INIT(ESP);
// LEVEL_SHUTDOWN(FollowBot);
LEVEL_INIT(Misc);
//if (TF) LEVEL_INIT(SpyAlert);
if (TF2) LEVEL_INIT(Glow);
g_pChatStack->Reset();
}
@ -151,14 +147,10 @@ void LevelShutdown_hook(void* thisptr) {
g_Settings.bInvalid = true;
LEVEL_SHUTDOWN(Aimbot);
hacks::shared::airstuck::Reset();
if (TF) LEVEL_SHUTDOWN(AutoReflect);
if (TF) LEVEL_SHUTDOWN(AutoSticky);
LEVEL_SHUTDOWN(AutoStrafe);
LEVEL_SHUTDOWN(Bunnyhop);
LEVEL_SHUTDOWN(ESP);
// LEVEL_SHUTDOWN(FollowBot);
LEVEL_SHUTDOWN(Misc);
if (TF2) LEVEL_SHUTDOWN(Glow);
g_pChatStack->Reset();
}