From 0692a7133b31c5a9f1fc57db1e14ee161efc9248 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sun, 20 Nov 2016 08:30:37 +0300 Subject: [PATCH] asdddddddd --- uran/TODO | 7 +++ uran/src/fixsdk.h | 2 + uran/src/hack.cpp | 34 ++++++----- uran/src/hack.h | 2 + uran/src/hacks/AntiAim.cpp | 10 +--- uran/src/hacks/AntiAim.h | 9 +-- uran/src/hacks/AntiDisguise.cpp | 2 + uran/src/hacks/AntiDisguise.h | 4 +- uran/src/hacks/AutoReflect.cpp | 17 ++++-- uran/src/hacks/AutoReflect.h | 6 +- .../src/hacks/{HPyroBot.cpp => FollowBot.cpp} | 56 ++++++++++++------- uran/src/hacks/{HPyroBot.h => FollowBot.h} | 5 +- uran/src/hacks/HAimbot.cpp | 2 + uran/src/hacks/HAimbot.h | 1 + uran/src/hacks/HBunnyhop.cpp | 1 + uran/src/hacks/HBunnyhop.h | 2 + uran/src/hacks/HEsp.cpp | 3 +- uran/src/hacks/HEsp.h | 2 + uran/src/hacks/HPowerupList.h | 6 +- uran/src/hacks/HTrigger.cpp | 6 +- uran/src/hacks/HTrigger.h | 2 + uran/src/hacks/IHack.h | 3 +- uran/src/hacks/InfoSpam.cpp | 16 ++++++ uran/src/hacks/InfoSpam.h | 25 +++++++++ uran/src/hacks/Misc.cpp | 45 ++++++++++++++- uran/src/hacks/Misc.h | 4 ++ uran/src/hacks/Quickscope.cpp | 2 + uran/src/hacks/Quickscope.h | 4 +- uran/src/hacks/Tracers.cpp | 5 +- uran/src/hacks/Tracers.h | 10 ++-- uran/src/helpers.cpp | 21 +++++++ uran/src/helpers.h | 2 + uran/src/interfaces.cpp | 2 + uran/src/interfaces.h | 2 + uran/src/logging.cpp | 6 +- uran/src/sharedobj.cpp | 20 ++++++- uran/src/sharedobj.h | 1 + 37 files changed, 268 insertions(+), 79 deletions(-) rename uran/src/hacks/{HPyroBot.cpp => FollowBot.cpp} (80%) rename uran/src/hacks/{HPyroBot.h => FollowBot.h} (88%) create mode 100644 uran/src/hacks/InfoSpam.cpp create mode 100644 uran/src/hacks/InfoSpam.h diff --git a/uran/TODO b/uran/TODO index c8cb8e91..58f722aa 100644 --- a/uran/TODO +++ b/uran/TODO @@ -17,6 +17,13 @@ Target system respect mannpower powerups Aimbot charge detection respect powerups tournament_teamname + + +ignore taunt + + +CritTrigger +CritAim huntsman aim fix diff --git a/uran/src/fixsdk.h b/uran/src/fixsdk.h index 56bfb018..4e5aaf09 100644 --- a/uran/src/fixsdk.h +++ b/uran/src/fixsdk.h @@ -13,5 +13,7 @@ #define POSIX 1 #define GNUC 1 #undef min +#define private public +#define protected public #endif /* FIXSDK_H_ */ diff --git a/uran/src/hack.cpp b/uran/src/hack.cpp index ce039509..7ed677de 100644 --- a/uran/src/hack.cpp +++ b/uran/src/hack.cpp @@ -26,9 +26,9 @@ #include "helpers.h" #include "hacks/HBunnyhop.h" #include "hacks/HTrigger.h" +#include "hacks/AutoReflect.h" #include "hacks/HEsp.h" //#include "hacks/HGlow.h" -#include "hacks/HPyroBot.h" #include "hacks/HAimbot.h" #include "hacks/AntiAim.h" #include "hacks/Quickscope.h" @@ -59,6 +59,7 @@ #include "copypasted/CSignature.h" #include "copypasted/Netvar.h" #include "CDumper.h" +#include "hacks/FollowBot.h" /* * Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015 Linux @@ -173,6 +174,19 @@ void hack::AddHack(IHack* hack) { ICvar* g_pCVar = 0; +void hack::InitHacks() { + hack::AddHack(g_phAntiAim = new AntiAim()); + hack::AddHack(g_phAntiDisguise = new AntiDisguise()); + hack::AddHack(g_phAutoReflect = new AutoReflect()); + hack::AddHack(g_phFollowBot = new FollowBot()); + hack::AddHack(g_phAimbot = new HAimbot()); + hack::AddHack(g_phBunnyhop = new HBunnyhop()); + hack::AddHack(g_phEsp = new HEsp()); + hack::AddHack(g_phTrigger = new HTrigger()); + hack::AddHack(g_phMisc = new Misc()); + hack::AddHack(g_phQuickscope = new Quickscope()); +} + void hack::Initialize() { logging::Initialize(); //std::string test = ""; @@ -187,24 +201,14 @@ void hack::Initialize() { interfaces::CreateInterfaces(); logging::Info("Interfaces created!"); logging::Info("APPID: %i", interfaces::engineClient->GetAppID()); - logging::Info("Dumping NetVars..."); - CDumper dumper; - dumper.SaveDump(); + //logging::Info("Dumping NetVars..."); + //CDumper dumper; + //dumper.SaveDump(); logging::Info("Initializing surface..."); draw::Initialize(); logging::Info("Adding hacks..."); SetCVarInterface(interfaces::cvar); - hack::AddHack(new AntiAim()); - logging::Info("Quickscoping"); - hack::AddHack(new Quickscope()); - hack::AddHack(new HBunnyhop()); - hack::AddHack(new Misc()); - hack::AddHack(new HEsp()); - hack::AddHack(new HAimbot()); - hack::AddHack(new AntiDisguise()); - hack::AddHack(new HTrigger()); - //hack::AddHack(new HGlow()); - hack::AddHack(new HPyroBot()); + hack::InitHacks(); ConVar_Register(); logging::Info("Initializing NetVar tree..."); gNetvars.init(); diff --git a/uran/src/hack.h b/uran/src/hack.h index 4c5f0d81..687d0ff4 100644 --- a/uran/src/hack.h +++ b/uran/src/hack.h @@ -28,6 +28,8 @@ void Initialize(); void Think(); void Shutdown(); +void InitHacks(); + } #endif /* HACK_H_ */ diff --git a/uran/src/hacks/AntiAim.cpp b/uran/src/hacks/AntiAim.cpp index 42f12ff2..5a9ef126 100644 --- a/uran/src/hacks/AntiAim.cpp +++ b/uran/src/hacks/AntiAim.cpp @@ -28,16 +28,10 @@ bool AntiAim::CreateMove(void*, float, CUserCmd* cmd) { //angl.z = 180; cmd->viewangles = angl; g_pLocalPlayer->bUseSilentAngles = true; - /*Vector vsilent(cmd->forwardmove, cmd->sidemove, cmd->upmove); - 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); - cmd->forwardmove = cos(yaw) * speed; - cmd->sidemove = sin(yaw) * speed;*/ - //FixMovement(*cmd, g_pLocalPlayer->v_OrigViewangles); return false; } void AntiAim::Destroy() {} void AntiAim::PaintTraverse(void*, unsigned int, bool, bool) {} + +AntiAim* g_phAntiAim = 0; diff --git a/uran/src/hacks/AntiAim.h b/uran/src/hacks/AntiAim.h index 7667ae43..9b25c230 100644 --- a/uran/src/hacks/AntiAim.h +++ b/uran/src/hacks/AntiAim.h @@ -10,15 +10,12 @@ #include "IHack.h" -class ConVar; - class AntiAim : public IHack { public: - void Create(); - void Destroy(); - bool CreateMove(void*, float, CUserCmd*); - void PaintTraverse(void*, unsigned int, bool, bool); + DECLARE_HACK() ConVar* v_bEnabled; }; +extern AntiAim* g_phAntiAim; + #endif /* ANTIAIM_H_ */ diff --git a/uran/src/hacks/AntiDisguise.cpp b/uran/src/hacks/AntiDisguise.cpp index 04d9379d..a686ee48 100644 --- a/uran/src/hacks/AntiDisguise.cpp +++ b/uran/src/hacks/AntiDisguise.cpp @@ -34,3 +34,5 @@ void AntiDisguise::PaintTraverse(void*, unsigned int, bool, bool) { bool AntiDisguise::CreateMove(void*, float, CUserCmd*) {return true;} void AntiDisguise::Destroy() {} + +AntiDisguise* g_phAntiDisguise = 0; diff --git a/uran/src/hacks/AntiDisguise.h b/uran/src/hacks/AntiDisguise.h index a7921f09..9fb89467 100644 --- a/uran/src/hacks/AntiDisguise.h +++ b/uran/src/hacks/AntiDisguise.h @@ -12,8 +12,10 @@ class AntiDisguise : public IHack { public: - DECL_HACK + DECLARE_HACK() ConVar* v_bEnabled; }; +extern AntiDisguise* g_phAntiDisguise; + #endif /* HACKS_ANTIDISGUISE_H_ */ diff --git a/uran/src/hacks/AutoReflect.cpp b/uran/src/hacks/AutoReflect.cpp index db159785..dea86059 100644 --- a/uran/src/hacks/AutoReflect.cpp +++ b/uran/src/hacks/AutoReflect.cpp @@ -10,6 +10,7 @@ #include "../localplayer.h" #include "../entitycache.h" #include "../usercmd.h" +#include "../entity.h" #include "../helpers.h" #include "../sdk/in_buttons.h" @@ -23,19 +24,24 @@ // Hack Methods void AutoReflect::Create() { - + v_bEnabled = CreateConVar("u_reflect_enabled", "0", "Reflectbot enabled"); + v_iReflectDistance = CreateConVar("u_reflect_distance", "300", "Reflectbot distance"); } - +// TODO bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) { if (!v_bEnabled->GetBool()) return true; + if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID != ClassID::CTFFlameThrower) return true; + CachedEntity* closest = 0; float closest_dist = 0.0f; for (int i = 0; i < gEntityCache.m_nMax; i++) { CachedEntity* ent = gEntityCache.GetEntity(i); if (!ent || ent->m_bNULL || ent->m_bDormant) continue; - if (!ent->m_iClassID == ClassID::CTFProjectile_Rocket) continue; + if (ent->m_iClassID != ClassID::CTFProjectile_Rocket && + ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) continue; + if (ent->Var(eoffsets.iTeamNum) == g_pLocalPlayer->team) continue; float dist = ent->m_pEntity->GetAbsOrigin().DistToSqr(g_pLocalPlayer->v_Origin); if (dist < closest_dist || !closest) { closest = ent; @@ -43,13 +49,14 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) { } } - if (closest_dist == 0 || closest_dist > v_iReflectDistance->GetInt()) return true; + if (closest_dist == 0 || closest_dist > v_iReflectDistance->GetInt() * v_iReflectDistance->GetInt()) return true; Vector tr = (closest->m_pEntity->GetAbsOrigin() - g_pLocalPlayer->v_Eye); Vector angles; fVectorAngles(tr, angles); fClampAngle(angles); cmd->viewangles = angles; + g_pLocalPlayer->bUseSilentAngles = true; cmd->buttons |= IN_ATTACK2; return true; @@ -57,3 +64,5 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) { void AutoReflect::PaintTraverse(void*, unsigned int, bool, bool) {} void AutoReflect::Destroy() {} + +AutoReflect* g_phAutoReflect = 0; diff --git a/uran/src/hacks/AutoReflect.h b/uran/src/hacks/AutoReflect.h index a33987f5..5f2b3449 100644 --- a/uran/src/hacks/AutoReflect.h +++ b/uran/src/hacks/AutoReflect.h @@ -10,11 +10,13 @@ #include "IHack.h" -class AutoReflect : IHack { +class AutoReflect : public IHack { public: - DECL_HACK + DECLARE_HACK() ConVar* v_bEnabled; ConVar* v_iReflectDistance; }; +extern AutoReflect* g_phAutoReflect; + #endif /* HACKS_AUTOREFLECT_H_ */ diff --git a/uran/src/hacks/HPyroBot.cpp b/uran/src/hacks/FollowBot.cpp similarity index 80% rename from uran/src/hacks/HPyroBot.cpp rename to uran/src/hacks/FollowBot.cpp index 4e7f97d3..0a9b9846 100644 --- a/uran/src/hacks/HPyroBot.cpp +++ b/uran/src/hacks/FollowBot.cpp @@ -5,7 +5,7 @@ * Author: nullifiedcat */ -#include "HPyroBot.h" +#include "FollowBot.h" #include "../interfaces.h" #include "../entity.h" @@ -19,6 +19,7 @@ #include #include #include +#include enum bot_state_t { IDLE = 0, @@ -47,11 +48,22 @@ IClientEntity* GetTarget() { return interfaces::entityList->GetClientEntity(g_nTargetID); } -void HPyroBot::ProcessEntity(IClientEntity* entity, bool enemy) { +int called = 0; + +class MedicCallListener : public IGameEventListener2 { +public: + MedicCallListener() {} + void FireGameEvent(IGameEvent* pEvent) { + if (strcmp("player_calledformedic", pEvent->GetName())) return; + int id = interfaces::engineClient->GetPlayerForUserID(pEvent->GetInt("userid", -1)); + } +}; + +void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) { IClientEntity* target = GetTarget(); if (!target) { - if (!enemy) { + if (!enemy || v_bMediBot->GetBool()) { if (v_iForceFollow->GetInt() != -1) { if (v_bForceFollowOnly->GetBool() && (v_iForceFollow->GetInt() != entity->entindex())) { return; @@ -62,7 +74,7 @@ void HPyroBot::ProcessEntity(IClientEntity* entity, bool enemy) { SetTarget(target); } - if (enemy) { + if (enemy && !v_bMediBot->GetBool()) { if (g_bState == bot_state_t::FOLLOWING_ENEMY) { if (DistToSqr(entity) <= DistToSqr(target)) { target = entity; @@ -122,7 +134,7 @@ void AimAt(IClientEntity* entity, CUserCmd* cmd) { * shoot */ -int HPyroBot::ShouldTarget(IClientEntity* ent, bool notrace) { +int FollowBot::ShouldTarget(IClientEntity* ent, bool notrace) { if (!ent || ent->IsDormant()) return 1; if (ent->GetClientClass()->m_ClassID != 241) return 2; if (GetEntityValue(ent, eoffsets.iLifeState)) return 3; @@ -143,7 +155,7 @@ int HPyroBot::ShouldTarget(IClientEntity* ent, bool notrace) { return 0; } -void HPyroBot::Tick(CUserCmd* cmd) { +void FollowBot::Tick(CUserCmd* cmd) { if (!g_pLocalPlayer->entity || g_pLocalPlayer->entity->IsDormant()) return; if (g_pLocalPlayer->life_state) return; @@ -231,14 +243,14 @@ void HPyroBot::Tick(CUserCmd* cmd) { interfaces::engineClient->ExecuteClientCmd("-forward"); } - if (DistToSqr(target) < (v_iShootDistance->GetInt() * v_iShootDistance->GetInt()) && g_bState == bot_state_t::FOLLOWING_ENEMY) { + if (DistToSqr(target) < (v_iShootDistance->GetInt() * v_iShootDistance->GetInt()) && (g_bState == bot_state_t::FOLLOWING_ENEMY || v_bMediBot->GetBool())) { interfaces::engineClient->ExecuteClientCmd("+attack"); } else { interfaces::engineClient->ExecuteClientCmd("-attack"); } } -bool HPyroBot::CreateMove(void*, float, CUserCmd* cmd) { +bool FollowBot::CreateMove(void*, float, CUserCmd* cmd) { if (!v_bEnabled->GetBool()) return true; Tick(cmd); g_nTick++; @@ -249,17 +261,21 @@ void CC_Status(const CCommand& args) { logging::Info("W+M1 State: %i, ID: %i, Search: %i", g_bState, g_nTargetID, nPilotSearch); } -void HPyroBot::Create() { - logging::Info("Creating PyroBot"); - v_bEnabled = CreateConVar("u_pyrobot_enabled", "0", "Enables WM1 bot"); - v_iForceFollow = CreateConVar("u_pyrobot_force_follow", "-1", "Force follow a teammate"); - v_bForceFollowOnly = CreateConVar("u_pyrobot_force_follow_only", "1", "only follow force"); - v_iMaxDeltaY = CreateConVar("u_pyrobot_max_height", "450", "Max dY"); - v_iMaxDistance = CreateConVar("u_pyrobot_aim_distance", "1300", "Distance"); - v_iShootDistance = CreateConVar("u_pyrobot_shoot_distance", "800", "Shoot distance"); - v_bChat = CreateConVar("u_pyrobot_chat", "0", "Enable chat"); - cmd_Status = CreateConCommand("u_pyrobot_status", CC_Status, "Status"); +void FollowBot::Create() { + v_bEnabled = CreateConVar("u_follow_enabled", "0", "Enables followbot"); + v_iForceFollow = CreateConVar("u_follow_force_follow", "-1", "Force follow by UID"); + v_bForceFollowOnly = CreateConVar("u_follow_force_follow_only", "1", "Only follow that player"); + v_iMaxDeltaY = CreateConVar("u_follow_max_height", "450", "Max dY"); + v_iMaxDistance = CreateConVar("u_follow_aim_distance", "1300", "Distance"); + v_iShootDistance = CreateConVar("u_follow_shoot_distance", "800", "Shoot distance"); + v_bChat = CreateConVar("u_follow_chat", "0", "Enable chat"); + + v_bMediBot = CreateConVar("u_followbot", "1", "Medic mode"); + + cmd_Status = CreateConCommand("u_followbot_status", CC_Status, "Status"); } -void HPyroBot::Destroy() {} -void HPyroBot::PaintTraverse(void*, unsigned int, bool, bool) {} +void FollowBot::Destroy() {} +void FollowBot::PaintTraverse(void*, unsigned int, bool, bool) {} + +FollowBot* g_phFollowBot = 0; diff --git a/uran/src/hacks/HPyroBot.h b/uran/src/hacks/FollowBot.h similarity index 88% rename from uran/src/hacks/HPyroBot.h rename to uran/src/hacks/FollowBot.h index ddda2291..e34f8a54 100644 --- a/uran/src/hacks/HPyroBot.h +++ b/uran/src/hacks/FollowBot.h @@ -14,7 +14,7 @@ class ConVar; class IClientEntity; class ConCommand; -class HPyroBot : public IHack { +class FollowBot : public IHack { public: void Create(); bool CreateMove(void*, float, CUserCmd*); @@ -30,7 +30,10 @@ public: ConVar* v_iMaxDistance; ConVar* v_iShootDistance; ConVar* v_iMaxDeltaY; + ConVar* v_bMediBot; ConVar* v_bChat; }; +extern FollowBot* g_phFollowBot; + #endif /* HPYROBOT_H_ */ diff --git a/uran/src/hacks/HAimbot.cpp b/uran/src/hacks/HAimbot.cpp index a6a773d4..2825d604 100644 --- a/uran/src/hacks/HAimbot.cpp +++ b/uran/src/hacks/HAimbot.cpp @@ -251,3 +251,5 @@ bool HAimbot::Aim(IClientEntity* entity, CUserCmd* cmd) { } return true; } + +HAimbot* g_phAimbot = 0; diff --git a/uran/src/hacks/HAimbot.h b/uran/src/hacks/HAimbot.h index d758e70d..21017fb4 100644 --- a/uran/src/hacks/HAimbot.h +++ b/uran/src/hacks/HAimbot.h @@ -44,5 +44,6 @@ public: ConVar* v_bMachinaPenetration; }; +extern HAimbot* g_phAimbot; #endif /* HAIMBOT_H_ */ diff --git a/uran/src/hacks/HBunnyhop.cpp b/uran/src/hacks/HBunnyhop.cpp index bd9135be..becd72a3 100644 --- a/uran/src/hacks/HBunnyhop.cpp +++ b/uran/src/hacks/HBunnyhop.cpp @@ -56,4 +56,5 @@ void HBunnyhop::Destroy() { void HBunnyhop::PaintTraverse(void*, unsigned int, bool, bool) {} +HBunnyhop* g_phBunnyhop = 0; diff --git a/uran/src/hacks/HBunnyhop.h b/uran/src/hacks/HBunnyhop.h index 37d4cf93..bc7c90ee 100644 --- a/uran/src/hacks/HBunnyhop.h +++ b/uran/src/hacks/HBunnyhop.h @@ -21,4 +21,6 @@ public: ConVar* v_bEnabled; }; +extern HBunnyhop* g_phBunnyhop; + #endif /* HBUNNYHOP_H_ */ diff --git a/uran/src/hacks/HEsp.cpp b/uran/src/hacks/HEsp.cpp index 22517cfe..f781cd49 100644 --- a/uran/src/hacks/HEsp.cpp +++ b/uran/src/hacks/HEsp.cpp @@ -374,6 +374,5 @@ bool HEsp::CreateMove(void*, float, CUserCmd*) { void HEsp::Destroy() {}; - - +HEsp* g_phEsp; diff --git a/uran/src/hacks/HEsp.h b/uran/src/hacks/HEsp.h index 33ba2010..ec09e868 100644 --- a/uran/src/hacks/HEsp.h +++ b/uran/src/hacks/HEsp.h @@ -46,4 +46,6 @@ public: //ConVar* v_bModelInfo; }; +extern HEsp* g_phEsp; + #endif /* HESP_H_ */ diff --git a/uran/src/hacks/HPowerupList.h b/uran/src/hacks/HPowerupList.h index 55e0b4ad..bc5df4d5 100644 --- a/uran/src/hacks/HPowerupList.h +++ b/uran/src/hacks/HPowerupList.h @@ -10,7 +10,9 @@ #include "IHack.h" -class HPowerupList : public IHack { + +// TODO implement +/*class HPowerupList : public IHack { public: void Create(); void Destroy(); @@ -26,6 +28,6 @@ public: // TODO }; - +*/ #endif /* HPOWERUPLIST_H_ */ diff --git a/uran/src/hacks/HTrigger.cpp b/uran/src/hacks/HTrigger.cpp index 111be770..4384fbab 100644 --- a/uran/src/hacks/HTrigger.cpp +++ b/uran/src/hacks/HTrigger.cpp @@ -112,14 +112,14 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { // If we need charge... if (!bodyshot && this->v_bBodyshot->GetBool()) { float bdmg = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargedDamage); - if (bdmg >= 15.0f && (bdmg) >= health) { + if (CanHeadshot(g_pLocalPlayer->entity) && (bdmg) >= health) { bodyshot = true; } } } if (!bodyshot && (g_pLocalPlayer->clazz == tf_class::tf_sniper) && this->v_bZoomedOnly->GetBool() && - !(g_pLocalPlayer->cond_0 & cond::zoomed)) { + !((g_pLocalPlayer->cond_0 & cond::zoomed) && CanHeadshot(g_pLocalPlayer->entity))) { return true; } //IClientEntity* weapon; @@ -136,3 +136,5 @@ void HTrigger::Destroy() { } void HTrigger::PaintTraverse(void*, unsigned int, bool, bool) {}; + +HTrigger* g_phTrigger = 0; diff --git a/uran/src/hacks/HTrigger.h b/uran/src/hacks/HTrigger.h index c0576d09..b94048e9 100644 --- a/uran/src/hacks/HTrigger.h +++ b/uran/src/hacks/HTrigger.h @@ -28,4 +28,6 @@ public: ConVar* v_bBuildings; }; +extern HTrigger* g_phTrigger; + #endif /* HTRIGGER_H_ */ diff --git a/uran/src/hacks/IHack.h b/uran/src/hacks/IHack.h index 9a702957..8e8fd644 100644 --- a/uran/src/hacks/IHack.h +++ b/uran/src/hacks/IHack.h @@ -11,8 +11,9 @@ class CUserCmd; class ConVar; class ConCommand; +class CCommand; -#define DECL_HACK \ +#define DECLARE_HACK() \ void Create(); \ bool CreateMove(void*, float, CUserCmd*); \ void Destroy(); \ diff --git a/uran/src/hacks/InfoSpam.cpp b/uran/src/hacks/InfoSpam.cpp new file mode 100644 index 00000000..2bd70455 --- /dev/null +++ b/uran/src/hacks/InfoSpam.cpp @@ -0,0 +1,16 @@ +/* + * InfoSpam.cpp + * + * Created on: Nov 19, 2016 + * Author: nullifiedcat + */ + +#include "InfoSpam.h" + +/*void InfoSpam::Create() { + +} + +bool InfoSpam::CreateMove(void*, float, CUserCmd*) { return true; } +void InfoSpam::PaintTraverse(void*, unsigned int, bool, bool) {} +void InfoSpam::Destroy() {}*/ diff --git a/uran/src/hacks/InfoSpam.h b/uran/src/hacks/InfoSpam.h new file mode 100644 index 00000000..83216de4 --- /dev/null +++ b/uran/src/hacks/InfoSpam.h @@ -0,0 +1,25 @@ +/* + * InfoSpam.h + * + * Created on: Nov 19, 2016 + * Author: nullifiedcat + */ + +#ifndef HACKS_INFOSPAM_H_ +#define HACKS_INFOSPAM_H_ + +#include "IHack.h" + +// TODO +/*#include + +void CC_ShowInfo(const CCommand& args); + +class InfoSpam : public IHack { +public: + DECLARE_HACK(); + ConVar* v_bEnabled; + ConCommand* c_ShowInfo; +};*/ + +#endif /* HACKS_INFOSPAM_H_ */ diff --git a/uran/src/hacks/Misc.cpp b/uran/src/hacks/Misc.cpp index 0eddd50d..5025cd84 100644 --- a/uran/src/hacks/Misc.cpp +++ b/uran/src/hacks/Misc.cpp @@ -23,7 +23,9 @@ #include #include #include +#include #include +#include void CC_SayLines(const CCommand& args) { char cmd[256]; @@ -108,8 +110,27 @@ void CC_DumpPlayers(const CCommand& args) { } } +void LockConCommand(const char* name, bool lock) { + ConCommandBase* cmd = interfaces::cvar->FindCommandBase(name); + if (lock) { + cmd->m_nFlags |= FCVAR_CHEAT; + } else { + cmd->m_nFlags &= ~FCVAR_CHEAT; + } +} + +void LockConCommands(bool lock) { + LockConCommand("thirdperson", lock); +} + ConCommandBase* teamname = 0; +void CC_Lockee(const CCommand& args) { + if (args.ArgC() > 1) { + LockConCommands(atoi(args.Arg(1))); + } +} + void CC_Teamname(const CCommand& args) { if (!teamname) { logging::Info("searching"); @@ -128,6 +149,14 @@ void CC_Teamname(const CCommand& args) { logging::Info("B");*/ } +void CC_SayInfo(const CCommand& args) { + int id = atoi(args.Arg(1)); + player_info_t info; + if (!interfaces::engineClient->GetPlayerInfo(id, &info)) return; + char* buf = new char[256]; + +} + void Misc::Create() { v_bDbWeaponInfo = CreateConVar("u_misc_debug_weapon", "0", "Debug info: Weapon"); v_bSemiAuto = CreateConVar("u_misc_semiauto", "0", "Force semi-auto"); @@ -138,6 +167,7 @@ void Misc::Create() { c_DumpVars = CreateConCommand("u_dumpent", CC_DumpVars, "Dumps entity data"); c_DumpPlayers = CreateConCommand("u_dumpplayers", CC_DumpPlayers, "Dumps player data"); c_Teamname = CreateConCommand("u_teamname", CC_Teamname, "Team name"); + c_Lockee = CreateConCommand("u_lockee", CC_Lockee, "Lock/Unlock commands"); } int sa_switch = 0; @@ -162,7 +192,13 @@ void Misc::Destroy() { void Misc::PaintTraverse(void*, unsigned int, bool, bool) { int y = 10; - if (v_bDbWeaponInfo->GetBool()) { + if (!v_bDbWeaponInfo->GetBool())return; + if (!interfaces::input->IsButtonDown(ButtonCode_t::KEY_F)) { + interfaces::baseClient->IN_ActivateMouse(); + } else { + interfaces::baseClient->IN_DeactivateMouse(); + } + if (g_pLocalPlayer->weapon) { IClientEntity* weapon = g_pLocalPlayer->weapon; draw::DrawString(10, y, draw::white, draw::black, false, "Weapon: %s [%i]", weapon->GetClientClass()->GetName(), weapon->GetClientClass()->m_ClassID); @@ -176,6 +212,9 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) { draw::DrawString(10, y, draw::white, draw::black, false, "Decaps: %i", GetEntityValue(g_pLocalPlayer->entity, eoffsets.iDecapitations)); y += 14; draw::DrawString(10, y, draw::white, draw::black, false, "Damage: %f", GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargedDamage)); - } - } + y += 14; + draw::DrawString(draw::font_handle, interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X), interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y), draw::white, L"S\u0FD5"); + } } + +Misc* g_phMisc = 0; diff --git a/uran/src/hacks/Misc.h b/uran/src/hacks/Misc.h index e173596f..6d2d41e3 100644 --- a/uran/src/hacks/Misc.h +++ b/uran/src/hacks/Misc.h @@ -28,6 +28,10 @@ public: ConCommand* c_DumpVars; ConCommand* c_DumpPlayers; ConCommand* c_Teamname; + ConCommand* c_Lockee; + ConCommand* c_Info; }; +extern Misc* g_phMisc; + #endif /* HACKS_MISC_H_ */ diff --git a/uran/src/hacks/Quickscope.cpp b/uran/src/hacks/Quickscope.cpp index 5134e283..e338b674 100644 --- a/uran/src/hacks/Quickscope.cpp +++ b/uran/src/hacks/Quickscope.cpp @@ -41,3 +41,5 @@ bool Quickscope::CreateMove(void*, float, CUserCmd* cmd) { void Quickscope::Destroy() {} void Quickscope::PaintTraverse(void*, unsigned int, bool, bool) { } + +Quickscope* g_phQuickscope = 0; diff --git a/uran/src/hacks/Quickscope.h b/uran/src/hacks/Quickscope.h index cfa5a4c2..fd650a06 100644 --- a/uran/src/hacks/Quickscope.h +++ b/uran/src/hacks/Quickscope.h @@ -12,8 +12,10 @@ class Quickscope : public IHack { public: - DECL_HACK + DECLARE_HACK() ConVar* v_bEnabled; }; +extern Quickscope* g_phQuickscope; + #endif /* HACKS_QUICKSCOPE_H_ */ diff --git a/uran/src/hacks/Tracers.cpp b/uran/src/hacks/Tracers.cpp index 87fb28f7..39bf3e19 100644 --- a/uran/src/hacks/Tracers.cpp +++ b/uran/src/hacks/Tracers.cpp @@ -7,7 +7,8 @@ #include "Tracers.h" -void Tracers::Create() { +//TODO +/*void Tracers::Create() { } @@ -16,4 +17,4 @@ bool Tracers::CreateMove(void*, float, CUserCmd*) { return true; } void Tracers::PaintTraverse(void*, unsigned int, bool, bool) { -} +}*/ diff --git a/uran/src/hacks/Tracers.h b/uran/src/hacks/Tracers.h index b14aaf69..0d54710f 100644 --- a/uran/src/hacks/Tracers.h +++ b/uran/src/hacks/Tracers.h @@ -9,14 +9,12 @@ #define HACKS_TRACERS_H_ #include "IHack.h" - -class ConVar; - -class Tracers : public IHack { +// TODO tracers +/*class Tracers : public IHack { public: - DECL_HACK + DECLARE_HACK() ConVar* v_bEnabled; ConVar* v_bTraceVisible; -}; +};*/ #endif /* HACKS_TRACERS_H_ */ diff --git a/uran/src/helpers.cpp b/uran/src/helpers.cpp index e5aff1ef..9346034e 100644 --- a/uran/src/helpers.cpp +++ b/uran/src/helpers.cpp @@ -603,6 +603,15 @@ bool IsEntityVisiblePenetration(IClientEntity* entity, int hb) { return false; } +char* strfmt(const char* fmt, ...) { + char* buf = new char[1024]; + va_list list; + va_start(list, fmt); + vsprintf(buf, fmt, list); + va_end(list); + return buf; +} + const char* powerups[] = { "STRENGTH", "RESISTANCE", @@ -619,6 +628,18 @@ const char* powerups[] = { "CRITS" }; +/*const char* classes[] = { + "", + "", + "", + "", + "", + "", + "", + "", + "" +};*/ + uint32 friends[256]; uint32 rage[256]; diff --git a/uran/src/helpers.h b/uran/src/helpers.h index b96603ed..63895bdb 100644 --- a/uran/src/helpers.h +++ b/uran/src/helpers.h @@ -52,6 +52,7 @@ bool IsVectorVisible(Vector a, Vector b); bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, Vector& result); relation GetRelation(IClientEntity* ent); bool IsSentryBuster(IClientEntity* ent); +char* strfmt(const char* fmt, ...); bool CanHeadshot(IClientEntity* player); @@ -71,6 +72,7 @@ Vector CalcAngle(Vector src, Vector dst); void MakeVector(Vector ang, Vector& out); float GetFov(Vector ang, Vector src, Vector dst); +//extern const char* classes[9]; extern const char* powerups[POWERUP_COUNT]; extern const char* packs[PACK_COUNT]; extern uint32 friends[256]; diff --git a/uran/src/interfaces.cpp b/uran/src/interfaces.cpp index 9d1e2939..305e0552 100644 --- a/uran/src/interfaces.cpp +++ b/uran/src/interfaces.cpp @@ -24,6 +24,7 @@ IGameEventManager2* interfaces::eventManager = 0; IBaseClientDLL* interfaces::baseClient = 0; IEngineTrace* interfaces::trace = 0; IVModelInfoClient* interfaces::model = 0; +IInputSystem* interfaces::input = 0; //ICvar* interfaces::cvar = 0; void interfaces::CreateInterfaces() { @@ -38,6 +39,7 @@ void interfaces::CreateInterfaces() { interfaces::baseClient = reinterpret_cast(sharedobj::client->CreateInterface("VClient017")); interfaces::trace = reinterpret_cast(sharedobj::engine->CreateInterface("EngineTraceClient003")); interfaces::model = reinterpret_cast(sharedobj::engine->CreateInterface("VModelInfoClient006")); + interfaces::input = reinterpret_cast(sharedobj::inputsystem->CreateInterface("InputSystemVersion001")); HSteamPipe sp = interfaces::steamClient->CreateSteamPipe(); HSteamUser su = interfaces::steamClient->ConnectToGlobalUser(sp); interfaces::steamFriends = reinterpret_cast(interfaces::steamClient->GetISteamFriends(su, sp, "SteamFriends002")); diff --git a/uran/src/interfaces.h b/uran/src/interfaces.h index 98ff8d0a..a299c567 100644 --- a/uran/src/interfaces.h +++ b/uran/src/interfaces.h @@ -24,6 +24,7 @@ class IBaseClientDLL; class ClientModeShared; class IEngineTrace; class IVModelInfoClient; +class IInputSystem; namespace interfaces { @@ -39,6 +40,7 @@ extern IGameEventManager2* eventManager; extern IBaseClientDLL* baseClient; extern IEngineTrace* trace; extern IVModelInfoClient* model; +extern IInputSystem* input; void CreateInterfaces(); diff --git a/uran/src/logging.cpp b/uran/src/logging.cpp index 5ca25284..6c42a18f 100644 --- a/uran/src/logging.cpp +++ b/uran/src/logging.cpp @@ -6,9 +6,11 @@ */ #include "logging.h" +#include "helpers.h" #include #include +#include #include "fixsdk.h" #include @@ -20,7 +22,9 @@ ICvar* cvar; FILE* logging::handle = 0; void logging::Initialize() { - logging::handle = fopen("/tmp/uran.log", "w"); + passwd* pwd = getpwuid(getuid()); + char* user = pwd->pw_name; + logging::handle = fopen(strfmt("/tmp/uran-%s.log", user), "w"); } void logging::Info(const char* fmt, ...) { diff --git a/uran/src/sharedobj.cpp b/uran/src/sharedobj.cpp index 3113d2ba..eb78a53e 100644 --- a/uran/src/sharedobj.cpp +++ b/uran/src/sharedobj.cpp @@ -7,11 +7,13 @@ #include "sharedobj.h" #include "logging.h" +#include "helpers.h" #include #include #include #include +#include // TODO #define STEAM_BASEDIR "/home/nullifiedcat/.local/share/Steam/" @@ -27,9 +29,11 @@ sharedobj::SharedObject* sharedobj::vguimatsurface = 0; sharedobj::SharedObject* sharedobj::vgui2 = 0; sharedobj::SharedObject* sharedobj::vstdlib = 0; sharedobj::SharedObject* sharedobj::tier0 = 0; +sharedobj::SharedObject* sharedobj::inputsystem = 0; sharedobj::SharedObject::SharedObject(const char* path, bool factory) { this->path = path; + logging::Info("Loading SharedObject: %s", path); while (!(lmap = (link_map*)dlopen(path, RTLD_NOLOAD))) { sleep(1); if (0 != dlerror()) { @@ -63,12 +67,24 @@ void* sharedobj::SharedObject::CreateInterface(const char* name) { } void sharedobj::LoadAllSharedObjects() { - sharedobj::client = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/tf/bin/client.so", true); + passwd* pwd = getpwuid(getuid()); + char* user = pwd->pw_name; + sharedobj::client = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/tf/bin/client.so", user), true); + sharedobj::engine = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/engine.so", user), true); + sharedobj::steamclient = new SharedObject(strfmt("/home/%s/.local/share/Steam/linux32/steamclient.so", user), true); + sharedobj::tier0 = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libtier0.so", user), false); + sharedobj::vgui2 = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/vgui2.so", user), true); + sharedobj::vguimatsurface = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/vguimatsurface.so", user), true); + sharedobj::vstdlib = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/libvstdlib.so", user), true); + sharedobj::inputsystem = new SharedObject(strfmt("/home/%s/.local/share/Steam/steamapps/common/Team Fortress 2/bin/inputsystem.so", user), true); + /*sharedobj::client = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/tf/bin/client.so", true); sharedobj::engine = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/engine.so", true); - sharedobj::steamclient = new SharedObject(STEAM_BASEDIR "linux32/steamclient.so", true); + //sharedobj::steamclient = new SharedObject(STEAM_BASEDIR "linux32/steamclient.so", true); + sharedobj::steamclient = new SharedObject("/home/steam-0/.local/share/Steam/linux32/steamclient.so", true); sharedobj::tier0 = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/libtier0.so", false); sharedobj::vgui2 = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/vgui2.so", true); sharedobj::vguimatsurface = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/vguimatsurface.so", true); sharedobj::vstdlib = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/libvstdlib.so", true); + sharedobj::inputsystem = new SharedObject(STEAM_BASEDIR "steamapps/common/Team Fortress 2/bin/inputsystem.so", true);*/ } diff --git a/uran/src/sharedobj.h b/uran/src/sharedobj.h index af1b0c3a..156f5d7f 100644 --- a/uran/src/sharedobj.h +++ b/uran/src/sharedobj.h @@ -30,6 +30,7 @@ extern SharedObject* vguimatsurface; extern SharedObject* vgui2; extern SharedObject* vstdlib; extern SharedObject* tier0; +extern SharedObject* inputsystem; void LoadAllSharedObjects();