From da6c50ce51c53e312d7422ced87d5722fcf4aacd Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 26 Nov 2016 20:55:57 +0300 Subject: [PATCH] Before mov --- uran/TODO | 3 ++- uran/src/globals.cpp | 1 + uran/src/globals.h | 1 + uran/src/hack.cpp | 6 ++++-- uran/src/hacks/Airstuck.h | 15 +++++++++++++++ uran/src/hacks/AntiAim.cpp | 4 ++++ uran/src/hacks/AntiDisguise.cpp | 4 ++++ uran/src/hacks/AutoReflect.cpp | 4 ++++ uran/src/hacks/FollowBot.cpp | 4 ++++ uran/src/hacks/FollowBot.h | 5 +---- uran/src/hacks/HAimbot.cpp | 29 ++++++++++++++++++++++++++++- uran/src/hacks/HAimbot.h | 8 ++++---- uran/src/hacks/HBunnyhop.cpp | 4 ++++ uran/src/hacks/HBunnyhop.h | 5 +---- uran/src/hacks/HEsp.cpp | 7 ++++++- uran/src/hacks/HEsp.h | 5 +---- uran/src/hacks/HTrigger.cpp | 4 ++++ uran/src/hacks/HTrigger.h | 5 +---- uran/src/hacks/IHack.h | 2 ++ uran/src/hacks/Misc.cpp | 4 ++++ uran/src/hacks/Misc.h | 5 +---- uran/src/hacks/Quickscope.cpp | 4 ++++ uran/src/profiler.cpp | 18 ++++++++++-------- uran/src/profiler.h | 8 ++++---- 24 files changed, 114 insertions(+), 41 deletions(-) create mode 100644 uran/src/hacks/Airstuck.h diff --git a/uran/TODO b/uran/TODO index 4a02868b..3f68d6c2 100644 --- a/uran/TODO +++ b/uran/TODO @@ -7,13 +7,14 @@ OPTIMIZE proper player struct optimize - buildings aim no autoshoot consumable no autoshoot disg amby body AutoHB amby +Bot Pathfinding + CRIT BODYSHOT NoZoom FIX !!! diff --git a/uran/src/globals.cpp b/uran/src/globals.cpp index c6cc239e..806b8c12 100644 --- a/uran/src/globals.cpp +++ b/uran/src/globals.cpp @@ -13,6 +13,7 @@ void GlobalSettings::Init() { this->bHackEnabled = CreateConVar("u_enabled", "1", "Hack enabled (GLOBAL)"); this->bIgnoreTaunting = CreateConVar("u_ignore_taunting", "1", "Ignore taunting players"); this->flForceFOV = CreateConVar("u_fov", "90", "Forces FOV"); + this->bProfiler = CreateConVar("u_profiler", "0", "Profiler output enabled"); } GlobalSettings g_Settings; diff --git a/uran/src/globals.h b/uran/src/globals.h index fbdfce37..1cfc7c4a 100644 --- a/uran/src/globals.h +++ b/uran/src/globals.h @@ -17,6 +17,7 @@ public: ConVar* flForceFOV; ConVar* bHackEnabled; ConVar* bIgnoreTaunting; + ConVar* bProfiler; }; extern GlobalSettings g_Settings; diff --git a/uran/src/hack.cpp b/uran/src/hack.cpp index 2f153375..177dd4f1 100644 --- a/uran/src/hack.cpp +++ b/uran/src/hack.cpp @@ -77,7 +77,6 @@ typedef void(OverrideView_t)(void*, CViewSetup*); bool hack::invalidated = true; void hack::Hk_OverrideView(void* thisptr, CViewSetup* setup) { - PROF_BEGIN("OverrideView Hook"); ((OverrideView_t*)hooks::hkCreateMove->GetMethod(hooks::offOverrideView))(thisptr, setup); if (g_Settings.flForceFOV && g_Settings.flForceFOV->GetBool()) { setup->fov = g_Settings.flForceFOV->GetFloat(); @@ -110,7 +109,9 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) { if (draw::panel_top == vp) { ResetStrings(); for (IHack* i_hack : hack::hacks) { + //PROF_BEGIN(); i_hack->PaintTraverse(p, vp, fr, ar); + //PROF_END(strfmt("%s PaintTraverse", i_hack->GetName())); } Vector screen; for (int i = 0; i < gEntityCache.m_nMax && i < interfaces::entityList->GetHighestEntityIndex(); i++) { @@ -122,7 +123,6 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) { ESPStringCompound str = ce->GetESPString(j); //logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String); if (!ce->m_ESPOrigin.IsZero(1.0)) { - int sw, sh; draw::DrawString(ce->m_ESPOrigin.x, ce->m_ESPOrigin.y, str.m_Color, str.m_Background, false, str.m_String); ce->m_ESPOrigin.y += 12; } else { @@ -153,10 +153,12 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) { //g_pLocalPlayer->bUseSilentAngles = false; //logging::Info("Inside CreateMove #1"); for (IHack* i_hack : hack::hacks) { + //PROF_BEGIN(); if (!i_hack->CreateMove(thisptr, inputSample, cmd)) { ret = false; //g_pLocalPlayer->bUseSilentAngles = true; } + //PROF_END(strfmt("%s CreateMove", i_hack->GetName())); } hack::invalidated = false; //logging::Info("Inside CreateMove #2"); diff --git a/uran/src/hacks/Airstuck.h b/uran/src/hacks/Airstuck.h new file mode 100644 index 00000000..a547e5a3 --- /dev/null +++ b/uran/src/hacks/Airstuck.h @@ -0,0 +1,15 @@ +/* + * Airstuck.h + * + * Created on: Nov 26, 2016 + * Author: nullifiedcat + */ + +#ifndef HACKS_AIRSTUCK_H_ +#define HACKS_AIRSTUCK_H_ + +class Airstuck : public IHack { + +}; + +#endif /* HACKS_AIRSTUCK_H_ */ diff --git a/uran/src/hacks/AntiAim.cpp b/uran/src/hacks/AntiAim.cpp index 73ef5587..4fbbe24f 100644 --- a/uran/src/hacks/AntiAim.cpp +++ b/uran/src/hacks/AntiAim.cpp @@ -11,6 +11,10 @@ #include "../helpers.h" #include "../sdk/in_buttons.h" +const char* AntiAim::GetName() { + return "ANTI-AIM"; +} + void AntiAim::Create() { this->v_bEnabled = CreateConVar("u_aa_enabled", "0", "Enable AntiAim"); this->v_flPitch = CreateConVar("u_aa_pitch", "-89.0", "Pitch"); diff --git a/uran/src/hacks/AntiDisguise.cpp b/uran/src/hacks/AntiDisguise.cpp index 141309c7..eb82645d 100644 --- a/uran/src/hacks/AntiDisguise.cpp +++ b/uran/src/hacks/AntiDisguise.cpp @@ -15,6 +15,10 @@ #include #include +const char* AntiDisguise::GetName() { + return "ANTI-DISGUISE"; +} + void AntiDisguise::Create() { v_bEnabled = CreateConVar("u_antidisguise", "1", "Disables spy disguise"); } diff --git a/uran/src/hacks/AutoReflect.cpp b/uran/src/hacks/AutoReflect.cpp index f1755cc6..5cd9a7ea 100644 --- a/uran/src/hacks/AutoReflect.cpp +++ b/uran/src/hacks/AutoReflect.cpp @@ -21,6 +21,10 @@ #include #include +const char* AutoReflect::GetName() { + return "AUTO-REFLECT"; +} + bool IsReflectableProjectile(IClientEntity* ent) { if (!ent) return false; switch (ent->GetClientClass()->m_ClassID) { diff --git a/uran/src/hacks/FollowBot.cpp b/uran/src/hacks/FollowBot.cpp index 3f7a2c11..dd1582f5 100644 --- a/uran/src/hacks/FollowBot.cpp +++ b/uran/src/hacks/FollowBot.cpp @@ -28,6 +28,10 @@ unsigned long g_nTick = 0; +const char* FollowBot::GetName() { + return "FOLLOWBOT"; +} + // TODO bool FollowBot::ShouldPopUber(bool force) { int health_my = g_pLocalPlayer->health; diff --git a/uran/src/hacks/FollowBot.h b/uran/src/hacks/FollowBot.h index 14a02b7b..c3e911af 100644 --- a/uran/src/hacks/FollowBot.h +++ b/uran/src/hacks/FollowBot.h @@ -26,10 +26,7 @@ enum botpackage { class FollowBot : public IHack { public: - void Create(); - bool CreateMove(void*, float, CUserCmd*); - void Destroy(); - void PaintTraverse(void*, unsigned int, bool, bool); + DECLARE_HACK(); void ProcessEntity(IClientEntity* entity, bool enemy); void Tick(CUserCmd*); int ShouldNotTarget(IClientEntity* ent, bool notrace); diff --git a/uran/src/hacks/HAimbot.cpp b/uran/src/hacks/HAimbot.cpp index 6b02a06e..df02c143 100644 --- a/uran/src/hacks/HAimbot.cpp +++ b/uran/src/hacks/HAimbot.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "../sdk/in_buttons.h" Vector viewangles_old; @@ -33,6 +34,10 @@ bool fix_silent; int target_lock; +const char* HAimbot::GetName() { + return "AIMBOT"; +} + /* null-safe */ void HAimbot::Create() { this->v_bEnabled = CreateConVar("u_aimbot_enabled", "0", "Enables aimbot. EXPERIMENTAL AND TOTALLY NOT LEGIT"); @@ -54,12 +59,23 @@ void HAimbot::Create() { this->v_bDebug = CreateConVar("u_aimbot_debug", "0", "Aimbot debug"); this->v_iFOV = CreateConVar("u_aimbot_fov", "0", "FOV aimbot (experimental)"); this->v_bMachinaPenetration = CreateConVar("u_aimbot_machina", "0", "Machina penetration aimbot (just for fun)"); + this->v_bSmooth = CreateConVar("u_aimbot_smooth", "0", "Smooth aimbot"); + this->v_fSmoothValue = CreateConVar("u_aimbot_smooth_value", "5.0", "Smooth value"); + this->v_iAimKey = CreateConVar("u_aimbot_aimkey", "0", "Aim Key"); fix_silent = false; } bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) { if (!this->v_bEnabled->GetBool()) return true; this->m_iLastTarget = -1; + if (this->v_iAimKey->GetBool()) { + //bool down = false; + //interfaces::baseClient->IN_IsKeyDown(this->v_iAimKey->GetString(), down); + if (!interfaces::input->IsButtonDown((ButtonCode_t)this->v_iAimKey->GetInt())) { + return true; + } + } + if (this->v_bEnabledAttacking->GetBool() && !(cmd->buttons & IN_ATTACK)) { return true; } @@ -274,11 +290,22 @@ bool HAimbot::Aim(IClientEntity* entity, CUserCmd* cmd) { Vector tr = (hit - g_pLocalPlayer->v_Eye); fVectorAngles(tr, angles); fClampAngle(angles); + bool smoothed = false; + if (this->v_bSmooth->GetBool()) { + Vector da = (angles - g_pLocalPlayer->v_OrigViewangles); + float fact = sqrt(da.x * da.x + da.y * da.y); + if (fact > this->v_fSmoothValue->GetFloat()) { + da.x = da.x / fact; + da.y = da.y / fact; + } + angles = g_pLocalPlayer->v_OrigViewangles + da; + smoothed = true; + } cmd->viewangles = angles; if (this->v_bSilent->GetBool()) { g_pLocalPlayer->bUseSilentAngles = true; } - if (this->v_bAutoShoot->GetBool()) { + if (!smoothed && this->v_bAutoShoot->GetBool()) { if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { if (g_pLocalPlayer->cond_0 & cond::zoomed) { if (this->v_iAutoShootCharge->GetBool()) { diff --git a/uran/src/hacks/HAimbot.h b/uran/src/hacks/HAimbot.h index 4b15394b..97ee215f 100644 --- a/uran/src/hacks/HAimbot.h +++ b/uran/src/hacks/HAimbot.h @@ -15,10 +15,7 @@ class IClientEntity; class HAimbot : public IHack { public: - void Create(); - void Destroy(); - bool CreateMove(void*, float, CUserCmd*); - void PaintTraverse(void*, unsigned int, bool, bool); + DECLARE_HACK(); bool ShouldTarget(IClientEntity* entity); bool Aim(IClientEntity* entity, CUserCmd* cmd); bool m_bProjectileMode; @@ -26,6 +23,9 @@ public: bool m_bProjArc; int m_iLastTarget; int m_iHitbox; + ConVar* v_iAimKey; + ConVar* v_bSmooth; + ConVar* v_fSmoothValue; ConVar* v_bDebug; ConVar* v_bEnabled; ConVar* v_iFOV; diff --git a/uran/src/hacks/HBunnyhop.cpp b/uran/src/hacks/HBunnyhop.cpp index becd72a3..e4bed436 100644 --- a/uran/src/hacks/HBunnyhop.cpp +++ b/uran/src/hacks/HBunnyhop.cpp @@ -20,6 +20,10 @@ #include #include +const char* HBunnyhop::GetName() { + return "BUNNYHOP"; +} + void HBunnyhop::Create() { this->v_bEnabled = CreateConVar("u_bhop_enabled", "1", "Enable/Disable BunnyHop"); } diff --git a/uran/src/hacks/HBunnyhop.h b/uran/src/hacks/HBunnyhop.h index bc7c90ee..df05dcf9 100644 --- a/uran/src/hacks/HBunnyhop.h +++ b/uran/src/hacks/HBunnyhop.h @@ -14,10 +14,7 @@ class ConVar; class HBunnyhop : public IHack { public: - bool CreateMove(void*, float, CUserCmd*); - void PaintTraverse(void*, unsigned int, bool, bool); - void Create(); - void Destroy(); + DECLARE_HACK(); ConVar* v_bEnabled; }; diff --git a/uran/src/hacks/HEsp.cpp b/uran/src/hacks/HEsp.cpp index e6b3b609..4d08da68 100644 --- a/uran/src/hacks/HEsp.cpp +++ b/uran/src/hacks/HEsp.cpp @@ -24,6 +24,10 @@ #include #include +const char* HEsp::GetName() { + return "ESP"; +} + const char* classes[] = { "Scout", "Sniper", @@ -90,10 +94,11 @@ void HEsp::DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHei //draw::DrawString(min(smin.x, smax.x), min(smin.y, smax.y), clr, false, "min"); //draw::DrawString(max(smin.x, smax.x), max(smin.y, smax.y), clr, false, "max"); //draw::DrawString((int)so.x, (int)so.y, draw::white, false, "origin"); - ent->m_ESPOrigin.x = so.x + width / 2 + 3; + ent->m_ESPOrigin.x = so.x + width / 2 + 1; ent->m_ESPOrigin.y = so.y - height; draw::OutlineRect(so.x - width / 2 - 1, so.y - 1 - height, width + 2, height + 2, draw::black); draw::OutlineRect(so.x - width / 2, so.y - height, width, height, clr); + draw::OutlineRect(so.x - width / 2 + 1, so.y + 1 - height, width - 2, height - 2, draw::black); if (healthbar) { Color hp = colors::GetHealthColor(health, healthmax); int hbh = (height) * min((float)health / (float)healthmax, 1.0f); diff --git a/uran/src/hacks/HEsp.h b/uran/src/hacks/HEsp.h index ec09e868..12ec357d 100644 --- a/uran/src/hacks/HEsp.h +++ b/uran/src/hacks/HEsp.h @@ -16,10 +16,7 @@ class CachedEntity; class HEsp : public IHack { public: - bool CreateMove(void*, float, CUserCmd*); - void PaintTraverse(void*, unsigned int, bool, bool); - void Create(); - void Destroy(); + DECLARE_HACK(); void DrawBox(CachedEntity* ent, Color clr, float widthFactor, float addHeight, bool healthbar, int health, int healthmax); void ProcessEntity(CachedEntity* ent); void ProcessEntityPT(CachedEntity* ent); diff --git a/uran/src/hacks/HTrigger.cpp b/uran/src/hacks/HTrigger.cpp index 4384fbab..560d2795 100644 --- a/uran/src/hacks/HTrigger.cpp +++ b/uran/src/hacks/HTrigger.cpp @@ -29,6 +29,10 @@ #include #include +const char* HTrigger::GetName() { + return "TRIGGER"; +} + Vector eye; trace_t* enemy_trace; trace::FilterDefault* filter; diff --git a/uran/src/hacks/HTrigger.h b/uran/src/hacks/HTrigger.h index b94048e9..79e03dcf 100644 --- a/uran/src/hacks/HTrigger.h +++ b/uran/src/hacks/HTrigger.h @@ -14,10 +14,7 @@ class ConVar; class HTrigger : public IHack { public: - bool CreateMove(void*, float, CUserCmd*); - void PaintTraverse(void*, unsigned int, bool, bool); - void Create(); - void Destroy(); + DECLARE_HACK(); ConVar* v_bEnabled; ConVar* v_bIgnoreCloak; ConVar* v_bZoomedOnly; diff --git a/uran/src/hacks/IHack.h b/uran/src/hacks/IHack.h index 0729ddcd..296501ed 100644 --- a/uran/src/hacks/IHack.h +++ b/uran/src/hacks/IHack.h @@ -16,6 +16,7 @@ class CCommand; typedef unsigned int uint32; #define DECLARE_HACK() \ + virtual const char* GetName(); \ void Create(); \ bool CreateMove(void*, float, CUserCmd*); \ void Destroy(); \ @@ -24,6 +25,7 @@ typedef unsigned int uint32; class IHack { public: inline virtual ~IHack() {}; + virtual const char* GetName() = 0; inline virtual void PaintTraverse(void*, unsigned int, bool, bool) {}; inline virtual bool CreateMove(void*, float, CUserCmd*) { return true; }; inline virtual void Create() {}; diff --git a/uran/src/hacks/Misc.cpp b/uran/src/hacks/Misc.cpp index 009b75f9..086f0443 100644 --- a/uran/src/hacks/Misc.cpp +++ b/uran/src/hacks/Misc.cpp @@ -29,6 +29,10 @@ #include #include +const char* Misc::GetName() { + return "MISC"; +} + void CC_SayLines(const CCommand& args) { char cmd[256]; sprintf(cmd, "say %s", args.ArgS()); diff --git a/uran/src/hacks/Misc.h b/uran/src/hacks/Misc.h index 4a898ef5..b8ea3a81 100644 --- a/uran/src/hacks/Misc.h +++ b/uran/src/hacks/Misc.h @@ -15,10 +15,7 @@ class ConCommand; class Misc : public IHack { public: - void Create(); - bool CreateMove(void*, float, CUserCmd*); - void Destroy(); - void PaintTraverse(void*, unsigned int, bool, bool); + DECLARE_HACK(); ConVar* v_bNoFlinch; ConVar* v_bNoZoom; diff --git a/uran/src/hacks/Quickscope.cpp b/uran/src/hacks/Quickscope.cpp index e338b674..aa571ed7 100644 --- a/uran/src/hacks/Quickscope.cpp +++ b/uran/src/hacks/Quickscope.cpp @@ -17,6 +17,10 @@ #include #include +const char* Quickscope::GetName() { + return "QUICKSCOPE"; +} + void Quickscope::Create() { v_bEnabled = CreateConVar("u_quickscope", "1", "Quickscope mode"); } diff --git a/uran/src/profiler.cpp b/uran/src/profiler.cpp index 5f278d45..e3161ca7 100644 --- a/uran/src/profiler.cpp +++ b/uran/src/profiler.cpp @@ -8,29 +8,31 @@ #include "profiler.h" #include "logging.h" +#include "globals.h" + +#include "fixsdk.h" +#include int g_ProfilerDepth = 0; -char* g_ProfilerSections[MAX_PROFILER_SECTIONS]; -time_t g_ProfilerSectionsTime[MAX_PROFILER_SECTIONS]; +time_t g_ProfilerSections[MAX_PROFILER_SECTIONS]; -void BeginSection(char* name) { +void PROFILER_BeginSection() { if (!ENABLE_PROFILER) return; if (g_ProfilerDepth == MAX_PROFILER_SECTIONS - 1) { logging::Info("Max profiler depth reached!"); return; } - g_ProfilerSections[g_ProfilerDepth] = name; - g_ProfilerSectionsTime[g_ProfilerDepth] = time(0); g_ProfilerDepth++; + g_ProfilerSections[g_ProfilerDepth] = time(0); } -void EndSection(char* name) { +void PROFILER_EndSection(char* name) { if (!ENABLE_PROFILER) return; if (g_ProfilerDepth == 0) { logging::Info("Profiler underflow!"); return; } - if (g_ProfilerDepth <= PROFILER_OUTPUT_DEPTH) - logging::Info("[PROF] %s took %lums!", g_ProfilerSections[g_ProfilerDepth], time(0) - g_ProfilerSectionsTime[g_ProfilerDepth]); + if (g_ProfilerDepth <= PROFILER_OUTPUT_DEPTH && g_Settings.bProfiler->GetBool()) + logging::Info("[PROF] %s took %ims!", name, (time(0) - g_ProfilerSections[g_ProfilerDepth])); g_ProfilerDepth--; } diff --git a/uran/src/profiler.h b/uran/src/profiler.h index 96c93c8c..072ec13e 100644 --- a/uran/src/profiler.h +++ b/uran/src/profiler.h @@ -10,19 +10,19 @@ #include -#define ENABLE_PROFILER true +#define ENABLE_PROFILER false #define PROFILER_OUTPUT_DEPTH 1 #define MAX_PROFILER_SECTIONS 16 #if ENABLE_PROFILER == true -#define PROF_BEGIN(X) PROFILER_BeginSection(X) +#define PROF_BEGIN() PROFILER_BeginSection() #define PROF_END(X) PROFILER_EndSection(X) #else #define PROF_BEGIN(X) #define PROF_END(X) #endif -void PROFILER_BeginSection(const char* name); -void PROFILER_EndSection(const char* name); +void PROFILER_BeginSection(); +void PROFILER_EndSection(char* name); #endif /* PROFILER_H_ */