CatVar stuff......

This commit is contained in:
nullifiedcat 2017-01-31 18:51:47 +03:00
parent eef689b01b
commit d6a991562d
8 changed files with 86 additions and 65 deletions

View File

@ -10,18 +10,27 @@
#include "common.h"
#include "sdk.h"
CatEnum::CatEnum(const char** values, int size, int min) {
m_Values = values;
m_iMin = min;
m_iMax = min + size - 1;
m_iLength = size;
CatVar::CatVar(CatVar_t type, std::string name, std::string defaults, std::string short_description, ICatEnum* enum_type, float minv, float maxv, std::string long_description) {
m_Type = type;
m_pConVar = CreateConVar(name.c_str(), defaults.c_str(), short_description.c_str());
m_EnumType = enum_type;
m_flMinValue = minv;
m_flMaxValue = maxv;
SetDescription(long_description);
}
const char* CatEnum::Name(int value) {
CatEnum::CatEnum(std::vector<std::string> values, int min) {
m_values = values;
m_iMin = min;
m_iMax = min + values.size() - 1;
m_iLength = values.size();
}
std::string CatEnum::Name(int value) {
if (value - m_iMin >= 0 && value - m_iMin <= m_iMax) {
return m_Values[value - m_iMin];
return m_values.at(value - Minimum());
}
return (const char*)0;
return "unknown";
}
int CatEnum::Maximum() {
@ -44,7 +53,7 @@ void CatVar::Increment(int factor) {
m_pConVar->SetValue(!m_pConVar->GetInt());
} break;
case CatVar_t::CV_INT:
m_pConVar->SetValue(m_pConVar->GetInt() + factor * m_iStep);
m_pConVar->SetValue(m_pConVar->GetInt() + factor * m_fStep);
break;
case CatVar_t::CV_FLOAT:
m_pConVar->SetValue(m_pConVar->GetFloat() + (float)factor * m_fStep);
@ -67,7 +76,7 @@ void CatVar::Decrement(int factor) {
m_pConVar->SetValue((int)!m_pConVar->GetInt());
break;
case CatVar_t::CV_INT:
m_pConVar->SetValue(m_pConVar->GetInt() - factor * m_iStep);
m_pConVar->SetValue(m_pConVar->GetInt() - factor * m_fStep);
break;
case CatVar_t::CV_FLOAT:
m_pConVar->SetValue(m_pConVar->GetFloat() - (float)factor * m_fStep);

View File

@ -10,8 +10,16 @@
class ConVar;
#define CREATE_CV(type, name, defaults, description) \
new CatVar(CreateConVar(CON_PREFIX name, defaults, description), type);
#include "beforecheaders.h"
#include <string>
#include <vector>
#include "aftercheaders.h"
//#define CREATE_CV(type, name, defaults, description) \
// new CatVar(CreateConVar(CON_PREFIX name, defaults, description), type);
//#define CREATE_CV_DESC(type, name, defaults, description, detailed) \
// new CatVar(CreateConVar(CON_PREFIX name, defaults, description), type, detailed);
enum CatVar_t {
CV_SWITCH,
@ -24,18 +32,18 @@ enum CatVar_t {
class ICatEnum {
public:
inline virtual ~ICatEnum() {}
virtual const char* Name(int value) = 0;
virtual std::string Name(int value) = 0;
virtual int Minimum() = 0;
virtual int Maximum() = 0;
};
class CatEnum : public ICatEnum {
public:
CatEnum(const char** values, int size, int min = 0);
virtual const char* Name(int value);
CatEnum(std::vector<std::string> values, int min = 0);
virtual std::string Name(int value);
virtual int Maximum();
virtual int Minimum();
const char** m_Values;
std::vector<std::string> m_values;
int m_iMin;
int m_iMax;
int m_iLength;
@ -43,11 +51,14 @@ public:
class CatVar {
public:
inline CatVar(ConVar* var, CatVar_t type) { m_iStep = 1; m_fStep = 0.5f; m_pConVar = var; m_Type = type; }
inline CatVar(ConVar* var, ICatEnum* catenum) { m_pConVar = var; m_Type = CatVar_t::CV_ENUM; m_EnumType = catenum; }
CatVar(CatVar_t type, std::string name, std::string defaults, std::string short_description, ICatEnum* enum_type = 0, float min = 0.0f, float max = 1.0f, std::string long_description = "no description");
//inline CatVar(ConVar* var, CatVar_t type, std::string desc = "") { m_fStep = 1; m_fStep = 0.5f; m_pConVar = var; m_Type = type; SetDescription(desc); }
//inline CatVar(ConVar* var, ICatEnum* catenum, std::string desc = "") { m_pConVar = var; m_Type = CatVar_t::CV_ENUM; m_EnumType = catenum; SetDescription(desc); }
inline CatVar_t GetType() { return m_Type; }
inline ICatEnum* GetEnum() { return 0; }
inline ConVar* GetConVar() { return m_pConVar; }
inline void SetDescription(std::string description) { m_strDescription = description; }
inline std::string Description() { return m_strDescription; }
bool GetBool();
int GetInt();
@ -57,12 +68,13 @@ public:
void Increment(int factor = 1);
void Decrement(int factor = 1);
inline void SetStep(int step) { m_iStep = step; }
inline void SetStep(float step) { m_fStep = step; }
int m_iStep;
float m_flMaxValue;
float m_flMinValue;
float m_fStep;
std::string m_strDescription;
ICatEnum* m_EnumType;
CatVar_t m_Type;
ConVar* m_pConVar;

View File

@ -47,7 +47,6 @@ void RootWindow::Setup() {
g_pGUI->m_pTooltip = new CTooltip();
AddChild(g_pGUI->m_pTooltip);
CBaseWindow* ws = new CBaseWindow("splitwindow");
AddChild(ws);
ws->SetPositionMode(ABSOLUTE);
TitleBar* wst = new TitleBar(ws, "Window Layout Test");
ws->AddChild(wst);

View File

@ -33,31 +33,45 @@ const char* Aimbot::GetName() {
return "AIMBOT";
}
const char* psza__AimKeyMode[] = { "DISABLED", "AIMKEY", "REVERSE", "TOGGLE" };
const char* psza__Hitbox[] = {
"HEAD", "PELVIS", "SPINE 0", "SPINE 1", "SPINE 2", "SPINE 3", "UPPER ARM L", "LOWER ARM L",
"HAND L", "UPPER ARM R", "LOWER ARM R", "HAND R", "HIP L", "KNEE L", "FOOT L", "HIP R",
"KNEE R", "FOOT R"
};
const char* psza__Priority[] = {
"SMART", "FOV", "DISTANCE", "HEALTH"
};
Aimbot::Aimbot() {
target_systems[0] = new TargetSystemSmart();
target_systems[1] = new TargetSystemFOV();
target_systems[2] = new TargetSystemDistance();
m_bAimKeySwitch = false;
this->v_eAimKeyMode = CREATE_CV(new CatEnum(psza__AimKeyMode, ARRAYSIZE(psza__AimKeyMode)), "aimbot_aimkey_mode", "1", "Aimkey Mode");
this->v_bEnabled = CREATE_CV(CV_SWITCH, "aimbot_enabled", "0", "Enabled");
this->v_eHitbox = CREATE_CV(new CatEnum(psza__Hitbox, ARRAYSIZE(psza__Hitbox)), "aimbot_hitbox", "0", "Hitbox");
this->v_bAutoHitbox = CREATE_CV(CV_SWITCH, "aimbot_autohitbox", "1", "Autohitbox");
this->v_bPrediction = CREATE_CV(CV_SWITCH, "aimbot_prediction", "1", "Latency pred");
this->v_bAutoShoot = CREATE_CV(CV_SWITCH, "aimbot_autoshoot", "1", "Autoshoot");
this->v_bSilent = CREATE_CV(CV_SWITCH, "aimbot_silent", "1", "Silent");
this->v_bZoomedOnly = CREATE_CV(CV_SWITCH, "aimbot_zoomed", "1", "Zoomed Only");
this->v_iAutoShootCharge = CREATE_CV(CV_FLOAT, "aimbot_autoshoot_charge", "0.0", "Autoshoot Charge");
this->v_iMaxRange = CREATE_CV(CV_INT, "aimbot_maxrange", "0", "Max distance");
this->v_eAimKeyMode = CREATE_CV_DESC(
new CatEnum({ "DISABLED", "AIMKEY", "REVERSE", "TOGGLE" }),
"aimbot_aimkey_mode", "1", "Aimkey Mode",
"Disabled: aimbot is always active\nAimkey: aimbot is active when key is down\nReverse: aimbot is disabled when key is down\nToggle: key toggles aimbot");
this->v_bEnabled = CREATE_CV_DESC(
CV_SWITCH, "aimbot_enabled", "0", "Enabled",
"Main aimbot switch");
this->v_eHitbox = CREATE_CV_DESC(
new CatEnum({
"HEAD", "PELVIS", "SPINE 0", "SPINE 1", "SPINE 2", "SPINE 3", "UPPER ARM L", "LOWER ARM L",
"HAND L", "UPPER ARM R", "LOWER ARM R", "HAND R", "HIP L", "KNEE L", "FOOT L", "HIP R",
"KNEE R", "FOOT R" }),
"aimbot_hitbox", "0", "Hitbox",
"Hitbox to aim at.\nIgnored if AutoHitbox is on");
this->v_bAutoHitbox = CREATE_CV_DESC(
CV_SWITCH, "aimbot_autohitbox", "1", "Autohitbox",
"Automatically decide the hitbox to aim at.\nFor example: Sniper rifles and Ambassador always aim at head,\nrocket launchers aim at feet if enemy is standing and at body\nif enemy is midair for easy airshots");
this->v_bPrediction = CREATE_CV_DESC(
CV_SWITCH, "aimbot_interp", "1", "Latency interpolation",
"Enable simple latency interpolation");
this->v_bAutoShoot = CREATE_CV_DESC(
CV_SWITCH, "aimbot_autoshoot", "1", "Autoshoot",
"Shoot automatically when the target is locked");
this->v_bSilent = CREATE_CV_DESC(
CV_SWITCH, "aimbot_silent", "1", "Silent",
"Your screen doesn't get snapped to the point where aimbot aims at");
this->v_bZoomedOnly = CREATE_CV_DESC(
CV_SWITCH, "aimbot_zoomed", "1", "Zoomed Only",
"Don't aim with unzoomed rifles");
/*this->v_iAutoShootCharge = CREATE_CV(
CV_FLOAT, "aimbot_autoshoot_charge", "0.0", "Autoshoot Charge");*/
this->v_iMaxRange = CREATE_CV_DESC(
CV_INT, "aimbot_maxrange", "0", "Max distance",
"Max range for aimbot\n900-1100 range is efficient for scout/widowmaker engineer");
this->v_bRespectCloak = CREATE_CV(CV_SWITCH, "aimbot_respect_cloak", "1", "Respect cloak");
this->v_bCharge = CREATE_CV(CV_SWITCH, "aimbot_charge", "0", "Wait for charge");
this->v_bEnabledAttacking = CREATE_CV(CV_SWITCH, "aimbot_enable_attack_only", "0", "Active when attacking");
@ -71,7 +85,7 @@ Aimbot::Aimbot() {
this->v_fAutoShootHuntsmanCharge = CREATE_CV(CV_FLOAT, "aimbot_huntsman_charge", "0.5", "Huntsman charge");
this->v_fSmoothValue = CREATE_CV(CV_FLOAT, "aimbot_smooth_value", "0.2", "Smooth value");
this->v_eAimKey = CREATE_CV(CV_INT, "aimbot_aimkey", "0", "Aimkey");
this->v_ePriorityMode = CREATE_CV(new CatEnum(psza__Priority, ARRAYSIZE(psza__Priority)), "aimbot_prioritymode", "0", "Priority mode");
this->v_ePriorityMode = CREATE_CV(new CatEnum({ "SMART", "FOV", "DISTANCE", "HEALTH" }), "aimbot_prioritymode", "0", "Priority mode");
v_bAimBuildings = CREATE_CV(CV_SWITCH, "aimbot_buildings", "1", "Aim @ Buildings");
v_bActiveOnlyWhenCanShoot = CREATE_CV(CV_SWITCH, "aimbot_only_when_can_shoot", "1", "Active when can shoot");
v_fSmoothAutoshootTreshold = CREATE_CV(CV_FLOAT, "aimbot_smooth_autoshoot_treshold", "0.01", "Smooth autoshoot");
@ -440,12 +454,7 @@ bool Aimbot::Aim(CachedEntity* entity, CUserCmd* cmd) {
if (!smoothed && this->v_bAutoShoot->GetBool()) {
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
if (g_pLocalPlayer->bZoomed) {
if (this->v_iAutoShootCharge->GetBool()) {
float bdmg = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargedDamage);
if (bdmg < this->v_iAutoShootCharge->GetFloat()) return true;
} else {
if (!CanHeadshot()) return true;
}
if (!CanHeadshot()) return true;
}
}
if (g_pLocalPlayer->weapon()->m_iClassID != ClassID::CTFCompoundBow) {

View File

@ -61,7 +61,7 @@ public:
CatVar* v_bAutoShoot;
CatVar* v_bSilent;
CatVar* v_bZoomedOnly;
CatVar* v_iAutoShootCharge;
//CatVar* v_iAutoShootCharge;
CatVar* v_fAutoShootHuntsmanCharge;
CatVar* v_iMaxRange;
CatVar* v_bRespectCloak;

View File

@ -16,17 +16,13 @@ const char* AntiAim::GetName() {
return "ANTI-AIM";
}
const char* psza__YawMode[] = { "KEEP", "STATIC", "RANDOM", "SPIN" };
const char* psza__PitchMode[] = { "KEEP", "STATIC", "RANDOM" };
AntiAim::AntiAim() {
this->v_bEnabled = CREATE_CV(CV_SWITCH, "aa_enabled", "0", "Enable");
this->v_flPitch = CREATE_CV(CV_FLOAT, "aa_pitch", "-89.0", "Pitch");
this->v_flYaw = CREATE_CV(CV_FLOAT, "aa_yaw", "0.0", "Yaw");
this->v_flSpinSpeed = CREATE_CV(CV_FLOAT, "aa_spin", "10.0", "Spin speed");
this->v_PitchMode = CREATE_CV(new CatEnum(psza__PitchMode, ARRAYSIZE(psza__PitchMode)), "aa_pitch_mode", "1", "Pitch mode");
this->v_YawMode = CREATE_CV(new CatEnum(psza__YawMode, ARRAYSIZE(psza__YawMode)), "aa_yaw_mode", "3", "Yaw mode");
this->v_PitchMode = CREATE_CV(new CatEnum({ "KEEP", "STATIC", "RANDOM", "SPIN" }), "aa_pitch_mode", "1", "Pitch mode");
this->v_YawMode = CREATE_CV(new CatEnum({ "KEEP", "STATIC", "RANDOM" }), "aa_yaw_mode", "3", "Yaw mode");
}
float yaw = -180;

View File

@ -35,8 +35,6 @@ void ESP::PaintTraverse(void*, unsigned int, bool, bool) {
}
}
const char* psza__ProjectileESP[] = { "OFF", "ALL", "CRIT" };
ESP::ESP() {
this->v_bSeeLocal = CREATE_CV(CV_SWITCH, "esp_local", "1", "Local ESP in thirdperson");
this->v_bEnabled = CREATE_CV(CV_SWITCH, "esp_enabled", "0", "ESP");
@ -60,7 +58,7 @@ ESP::ESP() {
v_bShowHealthNumbers = CREATE_CV(CV_SWITCH, "esp_health_num", "1", "Health in numbers");
v_bShowMoney = CREATE_CV(CV_SWITCH, "esp_money", "1", "MvM money");
v_bShowRedMoney = CREATE_CV(CV_SWITCH, "esp_money_red", "1", "Red MvM money");
CatEnum* proj = new CatEnum(psza__ProjectileESP, ARRAYSIZE(psza__ProjectileESP));
CatEnum* proj = new CatEnum({ "OFF", "ALL", "CRIT" });
this->v_iShowRockets = CREATE_CV(proj, "esp_proj_rockets", "1", "Rockets");
this->v_iShowArrows = CREATE_CV(proj, "esp_proj_arrows", "1", "Arrows");
this->v_iShowStickies = CREATE_CV(proj, "esp_proj_stickies", "1", "Stickies");

View File

@ -20,12 +20,6 @@ Vector eye;
trace_t* enemy_trace;
trace::FilterDefault* filter;
const char* psza__HitboxT[] = {
"ANY", "HEAD", "PELVIS", "SPINE 0", "SPINE 1", "SPINE 2", "SPINE 3", "UPPER ARM L", "LOWER ARM L",
"HAND L", "UPPER ARM R", "LOWER ARM R", "HAND R", "HIP L", "KNEE L", "FOOT L", "HIP R",
"KNEE R", "FOOT R"
};
Triggerbot::Triggerbot() {
filter = new trace::FilterDefault();
enemy_trace = new trace_t();
@ -34,7 +28,11 @@ Triggerbot::Triggerbot() {
this->v_bFinishingHit = CREATE_CV(CV_SWITCH, "trigger_finish", "1", "Noscope weak enemies");
this->v_bIgnoreCloak = CREATE_CV(CV_SWITCH, "trigger_cloak", "0", "Ignore cloak");
this->v_bZoomedOnly = CREATE_CV(CV_SWITCH, "trigger_zoomed", "1", "Zoomed only");
this->v_iHitbox = CREATE_CV(new CatEnum(psza__HitboxT, ARRAYSIZE(psza__HitboxT), -1), "trigger_hitbox", "-1", "Hitbox");
this->v_iHitbox = CREATE_CV(new CatEnum({
"ANY", "HEAD", "PELVIS", "SPINE 0", "SPINE 1", "SPINE 2", "SPINE 3", "UPPER ARM L", "LOWER ARM L",
"HAND L", "UPPER ARM R", "LOWER ARM R", "HAND R", "HIP L", "KNEE L", "FOOT L", "HIP R",
"KNEE R", "FOOT R"
}, -1), "trigger_hitbox", "-1", "Hitbox");
this->v_iMinRange = CREATE_CV(CV_INT, "trigger_range", "0", "Max range");
this->v_bBuildings = CREATE_CV(CV_SWITCH, "trigger_buildings", "1", "Trigger @ Buildings");
this->v_bIgnoreVaccinator = CREATE_CV(CV_SWITCH, "trigger_respect_vaccinator", "1", "Don't shoot at vaccinated enemies");