dddddddddddddddddd

This commit is contained in:
nullifiedcat 2016-11-26 10:04:43 +03:00
parent 633acd528c
commit d0e6715182
36 changed files with 937 additions and 370 deletions

View File

@ -9,6 +9,7 @@
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/uran"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/UranHack/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/uran/Debug"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/uran/TF2"/>
<entry flags="RESOLVED" kind="libraryFile" name="UranHack" srcPrefixMapping="" srcRootPath=""/>
<entry flags="RESOLVED" kind="libraryFile" name="uran" srcPrefixMapping="" srcRootPath=""/>
</externalSetting>
@ -44,7 +45,7 @@
<listOptionValue builtIn="false" value="/home/nullifiedcat/open-steamworks/osw"/>
</option>
<option id="gnu.cpp.compiler.option.other.verbose.1509393088" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.116822749" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<option id="gnu.cpp.compiler.option.preprocessor.def.116822749" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="TF2"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.236333340" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@ -86,8 +87,9 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="followbot|copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="followbot|mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/followbot"/>
</sourceEntries>
</configuration>
</storageModule>
@ -136,8 +138,9 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="hacks|copypasted|mem|sdk" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="followbot|copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="followbot|hacks|copypasted|mem|sdk" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/followbot"/>
</sourceEntries>
</configuration>
</storageModule>
@ -183,7 +186,7 @@
<listOptionValue builtIn="false" value="/home/nullifiedcat/open-steamworks/osw"/>
</option>
<option id="gnu.cpp.compiler.option.other.verbose.1101234728" name="Verbose (-v)" superClass="gnu.cpp.compiler.option.other.verbose" useByScannerDiscovery="false" value="false" valueType="boolean"/>
<option id="gnu.cpp.compiler.option.preprocessor.def.1794184358" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
<option id="gnu.cpp.compiler.option.preprocessor.def.1794184358" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
<listOptionValue builtIn="false" value="GAME_HL2"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1933705519" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@ -225,8 +228,9 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry excluding="followbot|copypasted|mem|sdk|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="followbot|mem" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/followbot"/>
</sourceEntries>
</configuration>
</storageModule>

View File

@ -4,7 +4,6 @@ TRIGGER: Ignore vaccinator
Priority FIX
OPTIMIZE
Buildings aimbot
proper player struct
optimize
@ -13,6 +12,14 @@ Buildings aimbot
no autoshoot disg
amby body
AutoHB amby
CRIT BODYSHOT
NoZoom FIX !!!
Map-Specific navigation markers
Target system respect mannpower powerups
Aimbot charge detection respect powerups
@ -23,6 +30,8 @@ ignore taunt
Followbot medic AI+
RocketBot
Flash uber bots
@ -31,20 +40,15 @@ CritAim
huntsman aim fix
minigun aim fix
ignore SB
no flinch
Bazaar charge
no spy disguise
Bazaar charge FIX
Sapped buildings ESP
AimBest
optimize
Glow Objects
remove magic numbers
no trigger/aim vacc uber
no trigger vacc uber
LINES (trace crshr->enemy)
disg spy aim
SPY ALERT
SEGVCATCH

View File

@ -7,6 +7,7 @@
#include "drawing.h"
#include "interfaces.h"
#include "logging.h"
#include "fixsdk.h"
#include <vgui/ISurface.h>
@ -16,6 +17,74 @@
#include <cassert>
#include <icliententity.h>
int g_nStringsSide = 0;
int g_nStringsCenter = 0;
ESPStringCompound* g_pStringsSide;
ESPStringCompound* g_pStringsCenter;
void InitStrings() {
g_pStringsSide = new ESPStringCompound[32]();
g_pStringsCenter = new ESPStringCompound[32]();
ResetStrings();
}
void ResetStrings() {
g_nStringsSide = 0;
g_nStringsCenter = 0;
}
void AddSideString(Color fg, Color bg, const char* fmt, ...) {
if (g_pStringsSide[g_nStringsSide].m_String) {
delete g_pStringsSide[g_nStringsSide].m_String;
}
char* buffer = new char[1024]();
va_list list;
va_start(list, fmt);
vsprintf(buffer, fmt, list);
va_end(list);
if (g_nStringsSide >= 32) {
logging::Info("Can't attach more than %i strings to an entity", 32);
return;
}
g_pStringsSide[g_nStringsSide].m_Color = fg;
g_pStringsSide[g_nStringsSide].m_Background = bg;
g_pStringsSide[g_nStringsSide].m_String = buffer;
g_nStringsSide++;
}
void DrawStrings() {
int y = 8;
for (int i = 0; i < g_nStringsSide; i++) {
draw::DrawString(8, y, g_pStringsSide[i].m_Color, g_pStringsSide[i].m_Background, false, g_pStringsSide[i].m_String);
y += 14;
}
y = draw::height / 2;
for (int i = 0; i < g_nStringsCenter; i++) {
draw::DrawString(draw::width / 2, y, g_pStringsCenter[i].m_Color, g_pStringsCenter[i].m_Background, false, g_pStringsCenter[i].m_String);
y += 14;
}
}
void AddCenterString(Color fg, Color bg, const char* fmt, ...) {
if (g_pStringsCenter[g_nStringsCenter].m_String) {
delete g_pStringsCenter[g_nStringsCenter].m_String;
}
char* buffer = new char[1024]();
va_list list;
va_start(list, fmt);
vsprintf(buffer, fmt, list);
va_end(list);
if (g_nStringsCenter >= 32) {
logging::Info("Can't attach more than %i strings to an entity", 32);
return;
}
g_pStringsCenter[g_nStringsCenter].m_Color = fg;
g_pStringsCenter[g_nStringsCenter].m_Background = bg;
g_pStringsCenter[g_nStringsCenter].m_String = buffer;
g_nStringsCenter++;
}
// TODO globals
unsigned long draw::font_handle = 0;
unsigned long draw::panel_top = 0;

View File

@ -42,6 +42,17 @@ Color GetTeamBgColor(int team, bool dark);
Color GetHealthColor(int health, int max);
}
void InitStrings();
void ResetStrings();
void AddCenterString(Color fg, Color bg, const char* fmt, ...);
void AddSideString(Color fg, Color bg, const char* fmt, ...);
void DrawStrings();
extern ESPStringCompound* g_pStringsSide;
extern int g_nStringsSide;
extern ESPStringCompound* g_pStringsCenter;
extern int g_nStringsCenter;
namespace draw {
extern unsigned long font_handle;

View File

@ -43,6 +43,9 @@ void EntityVariables::Init() {
this->flReloadPriorNextFire = gNetvars.get_offset("DT_TFWeaponBase", "LocalActiveTFWeaponData", "m_flReloadPriorNextFire");
this->flObservedCritChance = gNetvars.get_offset("DT_TFWeaponBase", "LocalActiveTFWeaponData", "m_flObservedCritChance");
this->nTickBase = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_nTickBase");
this->vecPunchAngle = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_Local", "m_vecPunchAngle");
this->vecPunchAngleVel = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_Local", "m_vecPunchAngleVel");
this->iItemDefinitionIndex = gNetvars.get_offset("DT_EconEntity", "m_AttributeManager", "m_Item", "m_iItemDefinitionIndex");
}
void InitEntityOffsets() {

View File

@ -64,6 +64,11 @@ public:
offset_t nTickBase;
offset_t iDecapitations;
offset_t iMaxBuffedHealth;
offset_t iItemDefinitionIndex;
offset_t vecPunchAngle;
offset_t vecPunchAngleVel;
};
// TODO globals

View File

@ -9,6 +9,7 @@
#define ENUMS_H_
enum cond {
slowed = (1 << 0),
zoomed = (1 << 1),
disguised = (1 << 3),
cloaked = (1 << 4),

View File

@ -0,0 +1,102 @@
/*
* ipcctl.cpp
*
* Created on: Nov 23, 2016
* Author: nullifiedcat
*/
#include "ipcctl.h"
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <signal.h>
#include <ISteamFriends002.h>
#include "../logging.h"
#include "../interfaces.h"
bool ipcctl::Init() {
key = 0x0D34DC47;
logging::Info("sizeof layout: %i", sizeof(ipc_mem_layout));
shmid = shmget(key, sizeof(ipc_mem_layout), 0666 | IPC_CREAT);
if (shmid == -1) {
logging::Info("shmget errored: %i", errno);
return false;
}
mem = (ipc_mem_layout*)shmat(shmid, (void*)0, 0);
if (mem == (ipc_mem_layout*)-1) {
logging::Info("shmat errored: %i", errno);
return false;
}
bot_id = NextBotID();
memset(&mem->segments[bot_id], 0, sizeof(ipc_bot_seg));
mem->segments[bot_id].initialized = true;
mem->segments[bot_id].owner_pid = getpid();
mem->segments[bot_id].command_number = 0;
memcpy(mem->segments[bot_id].name, interfaces::steamFriends->GetPersonaName(), 32);
if (bot_id == -1) return false;
return true;
}
int ipcctl::NextBotID() {
/* Segment 0 is reserved for broadcast commands */
for (int i = 1; i < MAX_SEGS; i++) {
ipc_bot_seg seg = mem->segments[i];
if (seg.initialized) {
logging::Info("Segment %i is owned by `%s`, PID %i", i, seg.name, seg.owner_pid);
if (kill(seg.owner_pid, 0) == -1 && errno == ESRCH) {
logging::Info("Dead process: %i", seg.owner_pid);
return i;
}
if ((time(0) - seg.last_access_time) > ACCESS_TIMEOUT) {
logging::Info("Segment timeout: %i", i);
return i;
}
} else {
return i;
}
}
logging::Info("Ran out of segments for bots.");
return -1;
}
void ipcctl::WriteBotCommand(int bot_id, char* cmd) {
if (bot_id < 0 || bot_id >= MAX_SEGS) return;
char buffer[CMD_LENGTH];
snprintf(buffer, CMD_LENGTH, "%s", cmd);
logging::Info("Executing command `%s`, #CMD %i", cmd, mem->segments[bot_id].command_number);
mem->segments[bot_id].command_number++;
memcpy(mem->segments[bot_id].command_buffer, buffer, sizeof(char) * CMD_LENGTH);
}
ipc_bot_seg* ipcctl::GetBotCommand(int bot_id) {
if (bot_id < 0 || bot_id >= MAX_SEGS) return (ipc_bot_seg*)0;
if (bot_id != 0 && mem->segments[bot_id].owner_pid != getpid()) {
logging::Info("Warning: Shared memory violation! BotID: %i ; PID: %i ; OWNER: %i", bot_id, getpid(), mem->segments[bot_id].owner_pid);
this->bot_id = NextBotID();
if (bot_id == -1) {
logging::Info("FAILED TO ASSIGN NEW BOT ID !!!");
return 0;
}
logging::Info("New BotID: %i", bot_id);
memset(&mem->segments[bot_id], 0, sizeof(ipc_bot_seg));
mem->segments[bot_id].initialized = true;
mem->segments[bot_id].owner_pid = getpid();
mem->segments[bot_id].command_number = 0;
memcpy(mem->segments[bot_id].name, interfaces::steamFriends->GetPersonaName(), 32);
return 0;
}
mem->segments[bot_id].last_access_time = time(0);
return &mem->segments[bot_id];
}
bool ipcctl::Detach() {
if (mem != (ipc_mem_layout*)-1) {
shmdt(mem);
}
return true;
}

View File

@ -0,0 +1,46 @@
/*
* ipcctl.h
*
* Created on: Nov 23, 2016
* Author: nullifiedcat
*/
#ifndef IPCCTL_H_
#define IPCCTL_H_
#include <sys/types.h>
#define MAX_SEGS 16
#define CMD_LENGTH 256
#define ACCESS_TIMEOUT 10000
#define NAME_LENGTH 32
typedef struct ipc_bot_seg {
bool initialized;
time_t last_access_time;
pid_t owner_pid;
unsigned command_number;
char name[NAME_LENGTH];
char command_buffer[CMD_LENGTH];
} ipc_bot_seg;
typedef struct ipc_mem_layout {
/* 0: Global commands; 1-15: Bot-Specific commands */
ipc_bot_seg segments[MAX_SEGS];
} ipc_mem_layout;
class ipcctl {
public:
int key;
int shmid;
ipc_mem_layout* mem;
int bot_id;
bool Init();
void WriteBotCommand(int bot_id, char* cmd);
ipc_bot_seg* GetBotCommand(int bot_id);
int NextBotID();
bool Detach();
};
#endif /* IPCCTL_H_ */

18
uran/src/globals.cpp Normal file
View File

@ -0,0 +1,18 @@
/*
* globals.cpp
*
* Created on: Nov 25, 2016
* Author: nullifiedcat
*/
#include "globals.h"
#include "helpers.h"
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");
}
GlobalSettings g_Settings;

View File

@ -8,5 +8,17 @@
#ifndef GLOBALS_H_
#define GLOBALS_H_
class ConVar;
class GlobalSettings {
public:
void Init();
// TODO
ConVar* flForceFOV;
ConVar* bHackEnabled;
ConVar* bIgnoreTaunting;
};
extern GlobalSettings g_Settings;
#endif /* GLOBALS_H_ */

View File

@ -26,6 +26,7 @@
#include "helpers.h"
#include "hacks/HBunnyhop.h"
#include "hacks/HTrigger.h"
#include "followbot/ipcctl.h"
#include "hacks/AutoReflect.h"
#include "hacks/HEsp.h"
//#include "hacks/HGlow.h"
@ -40,6 +41,8 @@
#include "localplayer.h"
#include "playerresource.h"
#include "profiler.h"
#include <csignal>
#include "fixsdk.h"
@ -55,11 +58,13 @@
#include <vgui/IPanel.h>
#include <convar.h>
#include <Color.h>
#include <view_shared.h>
#include <icvar.h>
#include "copypasted/CSignature.h"
#include "copypasted/Netvar.h"
#include "CDumper.h"
#include "hacks/FollowBot.h"
#include "globals.h"
/*
* Credits to josh33901 aka F1ssi0N for butifel F1Public and Darkstorm 2015 Linux
@ -67,10 +72,24 @@
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
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();
}
}
void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
// TODO move it into PrePT hook
//if (v_bNoZoom->GetBool()) {
//}
((PaintTraverse_t*)hooks::hkPaintTraverse->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar);
if (!draw::width || !draw::height) {
interfaces::engineClient->GetScreenSize(draw::width, draw::height);
@ -89,6 +108,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
}
if (hack::invalidated) return;
if (draw::panel_top == vp) {
ResetStrings();
for (IHack* i_hack : hack::hacks) {
i_hack->PaintTraverse(p, vp, fr, ar);
}
@ -111,6 +131,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
}
}
}
DrawStrings();
}
}
@ -179,12 +200,12 @@ void hack::InitHacks() {
hack::AddHack(g_phAntiDisguise = new AntiDisguise());
hack::AddHack(g_phAutoReflect = new AutoReflect());
hack::AddHack(g_phFollowBot = new FollowBot());
hack::AddHack(g_phMisc = new Misc());
hack::AddHack(g_phQuickscope = new Quickscope());
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() {
@ -209,6 +230,8 @@ void hack::Initialize() {
logging::Info("Adding hacks...");
SetCVarInterface(interfaces::cvar);
hack::InitHacks();
logging::Info("Init global settings");
g_Settings.Init();
ConVar_Register();
logging::Info("Initializing NetVar tree...");
gNetvars.init();
@ -231,15 +254,40 @@ void hack::Initialize() {
}
hooks::hkCreateMove->Init((void*)clientMode, 0);
hooks::hkCreateMove->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove);
logging::Info("Hooking OverrideView...");
hooks::hkCreateMove->HookMethod((void*)&hack::Hk_OverrideView, hooks::offOverrideView);
hooks::hkCreateMove->Apply();
logging::Info("Hooked!");
InitStrings();
logging::Info("Init done!");
}
void hack::Think() {
// Main code goes here...
usleep(1000);
//logging::Info("Hack::Think");
// Fucking TODo
if (g_phFollowBot->v_bEnabled->GetBool()) {
ipc_bot_seg* seg_g = g_phFollowBot->m_pIPC->GetBotCommand(0);
ipc_bot_seg* seg_l = g_phFollowBot->m_pIPC->GetBotCommand(g_phFollowBot->m_pIPC->bot_id);
if (seg_g == 0) {
logging::Info("!!! seg_g == 0 !!!");
}
if (seg_l == 0) {
logging::Info("!!! seg_l == 0 !!!");
}
if (seg_g && seg_g->command_number > g_phFollowBot->last_command_global) {
logging::Info("Executing `%s`", seg_g->command_buffer);
if (g_phFollowBot->last_command_global) interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
g_phFollowBot->last_command_global = seg_g->command_number;
}
if (seg_l && seg_l->command_number > g_phFollowBot->last_command_local) {
logging::Info("Executing `%s`", seg_l->command_buffer);
if (g_phFollowBot->last_command_local) interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
g_phFollowBot->last_command_local = seg_l->command_number;
}
}
usleep(250000);
}
void hack::Shutdown() {

View File

@ -12,6 +12,7 @@
class IHack;
class CUserCmd;
class CViewSetup;
namespace hack {
@ -19,6 +20,7 @@ extern std::vector<IHack*> hacks;
extern bool shutdown;
extern bool invalidated;
void Hk_OverrideView(void*, CViewSetup*);
void Hk_PaintTraverse(void*, unsigned int, bool, bool);
bool Hk_CreateMove(void*, float, CUserCmd*);

View File

@ -12,7 +12,9 @@
#include "../sdk/in_buttons.h"
void AntiAim::Create() {
this->v_bEnabled = CreateConVar("u_antiaim_enabled", "0", "Enable AntiAim");
this->v_bEnabled = CreateConVar("u_aa_enabled", "0", "Enable AntiAim");
this->v_flPitch = CreateConVar("u_aa_pitch", "-89.0", "Pitch");
this->v_flSpinSpeed = CreateConVar("u_aa_spin", "10.0", "Spin speed");
}
float spin = -180;
@ -21,9 +23,9 @@ bool AntiAim::CreateMove(void*, float, CUserCmd* cmd) {
if (!this->v_bEnabled->GetBool()) return true;
if ((cmd->buttons & (IN_ATTACK | IN_ATTACK2 | IN_USE))) return true;
if (g_pLocalPlayer->bAttackLastTick) return true;
spin += 10.0f;
spin += v_flSpinSpeed->GetFloat();
if (spin > 180) spin = -180;
Vector angl = Vector(-60.0, spin, 0);
Vector angl = Vector(v_flPitch->GetFloat(), spin, 0);
fClampAngle(angl);
//angl.z = 180;
cmd->viewangles = angl;

View File

@ -14,6 +14,8 @@ class AntiAim : public IHack {
public:
DECLARE_HACK()
ConVar* v_bEnabled;
ConVar* v_flSpinSpeed;
ConVar* v_flPitch;
};
extern AntiAim* g_phAntiAim;

View File

@ -16,7 +16,7 @@
#include <icliententity.h>
void AntiDisguise::Create() {
v_bEnabled = CreateConVar("u_antidisguise", "0", "Disables spy disguise");
v_bEnabled = CreateConVar("u_antidisguise", "1", "Disables spy disguise");
}
void AntiDisguise::PaintTraverse(void*, unsigned int, bool, bool) {

View File

@ -56,6 +56,7 @@ bool AutoReflect::CreateMove(void*, float, CUserCmd* cmd) {
CachedEntity* ent = gEntityCache.GetEntity(i);
if (!ent || ent->m_bNULL || ent->m_bDormant) continue;
if (!IsReflectableProjectile(ent->m_pEntity)) continue;
//if (ent->Var<Vector>(eoffsets.vVelocity).IsZero(1.0f)) continue;
if (ent->Var<int>(eoffsets.iTeamNum) == g_pLocalPlayer->team) continue;
float dist = ent->m_pEntity->GetAbsOrigin().DistToSqr(g_pLocalPlayer->v_Origin);
if (dist < closest_dist || !closest) {

View File

@ -7,6 +7,8 @@
#include "FollowBot.h"
#include <signal.h>
#include "../interfaces.h"
#include "../entity.h"
#include "../helpers.h"
@ -15,6 +17,7 @@
#include "../usercmd.h"
#include "../playerresource.h"
#include "../sdk/in_buttons.h"
#include "../followbot/ipcctl.h"
#include "../fixsdk.h"
#include <icliententity.h>
@ -23,35 +26,26 @@
#include <cdll_int.h>
#include <igameevents.h>
enum bot_state_t {
IDLE = 0,
FOLLOWING_TEAMMATE,
FOLLOWING_ENEMY,
PILOT_SEARCH,
TARGET_LOST
};
unsigned long g_nTick = 0;
int g_nTargetID = 0;
unsigned long nPilotSearch = 0;
unsigned long SEARCH_TICKS = 250;
bot_state_t g_bState = IDLE;
void SetTarget(IClientEntity* ent) {
if (!ent) {
g_nTargetID = -1;
return;
// TODO
bool FollowBot::ShouldPopUber(bool force) {
int health_my = g_pLocalPlayer->health;
int health_tr = GetEntityValue<int>(interfaces::entityList->GetClientEntity(this->m_hTargetHealing), eoffsets.iHealth);
if (health_my < 30) return true;
bool other_bots_have_uber = false;
for (int i = 0; i < 64 && i < interfaces::entityList->GetHighestEntityIndex(); i++) {
IClientEntity* ent = interfaces::entityList->GetClientEntity(i);
if (ent == g_pLocalPlayer->entity) continue;
if (IsFriendlyBot(ent)) {
if (GetEntityValue<char>(ent, eoffsets.iLifeState)) continue;
IClientEntity* medigun;
// TODO
}
}
g_nTargetID = ent->entindex();
return false;
}
IClientEntity* GetTarget() {
if (g_nTargetID == -1) return 0;
return interfaces::entityList->GetClientEntity(g_nTargetID);
}
int called = 0;
class MedicCallListener : public IGameEventListener2 {
public:
MedicCallListener() {}
@ -74,53 +68,9 @@ void CC_ResetList(const CCommand& args) {
MedicCallListener* g_pListener;
// TODO
void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) {
IClientEntity* target = GetTarget();
if (!target) {
if (!enemy || v_bMediBot->GetBool()) {
if (v_iForceFollow->GetInt() != -1) {
if (v_bForceFollowOnly->GetBool() && (v_iForceFollow->GetInt() != entity->entindex())) {
return;
}
}
}
target = entity;
SetTarget(target);
}
if (enemy && !v_bMediBot->GetBool()) {
if (g_bState == bot_state_t::FOLLOWING_ENEMY) {
if (DistToSqr(entity) <= DistToSqr(target)) {
target = entity;
SetTarget(target);
}
} else {
target = entity;
SetTarget(target);
}
g_bState = bot_state_t::FOLLOWING_ENEMY;
} else {
//if (g_bState == bot_state_t::PILOT_SEARCH) {
//}
if (g_bState == bot_state_t::FOLLOWING_ENEMY) return;
if (GetEntityValue<Vector>(entity, eoffsets.vVelocity).IsZero(1.0f)) return;
if (v_iForceFollow->GetInt() != -1) {
if (entity->entindex() == v_iForceFollow->GetInt()) {
target = entity;
SetTarget(target);
g_bState = bot_state_t::FOLLOWING_TEAMMATE;
} else {
return;
}
}
if (DistToSqr(entity) <= DistToSqr(target)) {
target = entity;
SetTarget(target);
g_bState = bot_state_t::FOLLOWING_TEAMMATE;
}
}
return;
}
/*
@ -134,13 +84,16 @@ void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) {
* shoot
*/
// TODO
int FollowBot::ShouldNotTarget(IClientEntity* ent, bool notrace) {
if (!ent || ent->IsDormant()) return 1;
if (ent->GetClientClass()->m_ClassID != 241) return 2;
if (GetEntityValue<char>(ent, eoffsets.iLifeState)) return 3;
bool enemy = GetEntityValue<int>(ent, eoffsets.iTeamNum) != g_pLocalPlayer->team;
if (enemy) {
if (IsPlayerInvulnerable(ent)) return 4;
if (enemy) return 4;
if (!this->IsOwner(ent)) {
return 7;
}
if (!notrace) {
@ -151,15 +104,6 @@ int FollowBot::ShouldNotTarget(IClientEntity* ent, bool notrace) {
if (!a) return 6;
}
if (v_bMediBot->GetBool()) {
if (!this->IsOwner(ent)) {
return 7;
}
} else {
if (DistToSqr(ent) > (v_iMaxDistance->GetInt() * v_iMaxDistance->GetInt())) return 5;
if (abs(ent->GetAbsOrigin().z - g_pLocalPlayer->v_Origin.z) > v_iMaxDeltaY->GetInt()) return 8;
}
return 0;
}
@ -167,12 +111,22 @@ void FollowBot::Tick(CUserCmd* cmd) {
if (!g_pLocalPlayer->entity || g_pLocalPlayer->entity->IsDormant()) return;
if (g_pLocalPlayer->life_state) return;
IClientEntity* target = GetTarget();
IClientEntity* target_old = target;
IClientEntity* owner_entity = 0;
for (int i = 0; i < 64 && i < interfaces::entityList->GetHighestEntityIndex(); i++) {
if (IsOwner(interfaces::entityList->GetClientEntity(i))) {
m_hTargetFollowing = i;
owner_entity = interfaces::entityList->GetClientEntity(i);
}
}
if (v_bMediBot->GetBool()) {
switch (v_iBotPackage->GetInt()) {
case botpackage::BOT_FOLLOW: {
break;
}
case botpackage::BOT_MEDIC: {
cmd->buttons |= IN_ATTACK;
if ((g_nTick % 20) == 0) {
if ((g_nTick % 100) == 0) {
interfaces::engineClient->ExecuteClientCmd("slot2");
cmd->buttons &= ~IN_ATTACK;
}
@ -183,29 +137,32 @@ void FollowBot::Tick(CUserCmd* cmd) {
} else {
this->m_iShouldUbercharge = 0;
}
if (!target || ShouldNotTarget(target, true)) {
//g_bState = bot_state_t::PILOT_SEARCH;
nPilotSearch++;
} else {
//g_bState = bot_state_t::FOLLOWING_TEAMMATE;
nPilotSearch = 0;
}
// TODO movements with cmd
if (nPilotSearch < SEARCH_TICKS) {
//interfaces::engineClient->ExecuteClientCmd("+forward");
} else {
//interfaces::engineClient->ExecuteClientCmd("-forward");
}
IClientEntity* ptf = 0;
for (int i = 0; i < 64 && i < interfaces::entityList->GetHighestEntityIndex(); i++) {
if (IsOwner(interfaces::entityList->GetClientEntity(i))) {
m_hTargetFollowing = i;
ptf = interfaces::entityList->GetClientEntity(i);
break;
}
case botpackage::BOT_SNIPER: {
if (!owner_entity) break;
//bool owner_zoomed = (GetEntityValue<int>(owner_entity, eoffsets.iCond) & cond::zoomed);
//
if (IClientEntity* weapon = interfaces::entityList->GetClientEntity(GetEntityValue<int>(owner_entity, eoffsets.hActiveWeapon) & 0xFFF)) {
if (weapon) {
if (weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle || weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle) {
bool bot_zoomed = (GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed);
if (!bot_zoomed) {
cmd->buttons |= IN_ATTACK2;
}
} else {
bool bot_zoomed = (GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed);
if (bot_zoomed) {
cmd->buttons |= IN_ATTACK2;
}
}
}
}
break;
}
}
if (v_iBotPackage->GetInt() == botpackage::BOT_MEDIC) {
IClientEntity* healtr = this->GetBestHealingTarget();
m_hTargetHealing = (healtr ? healtr->entindex() : 0);
if (healtr) {
@ -216,136 +173,47 @@ void FollowBot::Tick(CUserCmd* cmd) {
m_iShouldUbercharge = 1;
}
}
}
if (!ptf) return;
if (GetEntityValue<Vector>(g_pLocalPlayer->entity, eoffsets.vVelocity).IsZero(10.0f) && (0 == (g_nTick % 20))) {
if (owner_entity && (0 == (g_nTick % 20))) {
static bool forward = false;
static bool jump = false;
if (!jump && GetEntityValue<Vector>(g_pLocalPlayer->entity, eoffsets.vVelocity).IsZero(10.0f) && !(GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed)) {
interfaces::engineClient->ExecuteClientCmd("+jump");
} else if (0 == (g_nTick % 20)) {
jump = true;
} else if (jump) {
interfaces::engineClient->ExecuteClientCmd("-jump");
jump = false;
}
if (DistToSqr(ptf) < (100 * 100) && (0 == (g_nTick % 20))) {
if (forward && DistToSqr(owner_entity) < (60 * 60)) {
interfaces::engineClient->ExecuteClientCmd("-forward");
} else if (0 == (g_nTick % 20)) {
forward = false;
} else if (!forward) {
interfaces::engineClient->ExecuteClientCmd("+forward");
}
return;
} else {
return;
}
// OLD CODE
/*bool target_lost = (!target || ShouldNotTarget(target, true) || (g_bState != bot_state_t::FOLLOWING_ENEMY && g_bState != bot_state_t::FOLLOWING_TEAMMATE));
if (target_lost && g_bState != bot_state_t::PILOT_SEARCH) logging::Info("Target lost! Target: %i, State: %i, ShouldTarget: %i", target, g_bState, ShouldNotTarget(target, true));
if (target_lost && g_bState == bot_state_t::FOLLOWING_ENEMY) {
g_bState = bot_state_t::PILOT_SEARCH;
nPilotSearch++;
//SetTarget(0);
//target = 0;
}
if (target_lost && (g_bState == bot_state_t::FOLLOWING_TEAMMATE || g_bState == bot_state_t::PILOT_SEARCH)) {
g_bState = bot_state_t::PILOT_SEARCH;
nPilotSearch++;
}
if (!target_lost) {
nPilotSearch = 0;
}
if (nPilotSearch < SEARCH_TICKS) {
interfaces::engineClient->ExecuteClientCmd("+forward");
} else {
interfaces::engineClient->ExecuteClientCmd("-forward");
}
if ((g_nTick % 300 == 0) || target_lost) {
for (int i = 0; i < 64 && i < interfaces::entityList->GetMaxEntities(); i++) {
IClientEntity* ent = interfaces::entityList->GetClientEntity(i);
if (ShouldNotTarget(ent, false)) continue;
bool enemy = GetEntityValue<int>(ent, eoffsets.iTeamNum) != g_pLocalPlayer->team;
ProcessEntity(ent, enemy);
forward = true;
}
}
target = GetTarget();
target_lost = (!target || ShouldNotTarget(target, true) || g_bState == bot_state_t::IDLE || g_bState == bot_state_t::PILOT_SEARCH || g_bState == bot_state_t::TARGET_LOST);
if (target_lost) {
if (target_old != 0) {
if (v_bChat->GetBool()) {
//char* cmd = new char[256];
//sprintf(cmd, "say Target lost!", g_bState);
//interfaces::engineClient->ServerCmd(cmd);
}
else {
//logging::Info("Target lost! State: %i, %i", !!target, !!ShouldTarget(target));
}
}
//if (ShouldTarget(target, true) != 6 && (nPilotSearch < 100)) return;
interfaces::engineClient->ExecuteClientCmd("-attack");
return;
}
if (target != target_old) {
player_info_s info;
interfaces::engineClient->GetPlayerInfo(target->entindex(), &info);
logging::Info("Following %s", info.name);
if (v_bChat->GetBool()) {
char* cmd = new char[256];
if (g_bState == bot_state_t::FOLLOWING_TEAMMATE)
sprintf(cmd, "say Following: %s", info.name);
else
sprintf(cmd, "say Attacking: %s", info.name);
interfaces::engineClient->ServerCmd(cmd);
}
}
if (GetEntityValue<Vector>(g_pLocalPlayer->entity, eoffsets.vVelocity).IsZero(10.0f)) {
interfaces::engineClient->ExecuteClientCmd("+jump");
} else {
interfaces::engineClient->ExecuteClientCmd("-jump");
}
Vector hb;
if (GetHitboxPosition(target, 4, hb)) return;
AimAt(g_pLocalPlayer->v_Eye, hb, cmd);
QAngle angles = VectorToQAngle(cmd->viewangles);
interfaces::engineClient->SetViewAngles(angles);
if (DistToSqr(target) < (200 * 200) && g_bState == bot_state_t::FOLLOWING_TEAMMATE) {
interfaces::engineClient->ExecuteClientCmd("-forward");
}
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");
}*/
return;
}
void FollowBot::ActuallyCreateMove(CUserCmd* cmd) {
IClientEntity* tr_follow = interfaces::entityList->GetClientEntity(this->m_hTargetFollowing);
IClientEntity* tr_heal = interfaces::entityList->GetClientEntity(this->m_hTargetHealing);
QAngle angles = VectorToQAngle(cmd->viewangles);
if (v_bMediBot->GetBool()) {
if (tr_follow) {
AimAtHitbox(tr_follow, 4, cmd);
angles = VectorToQAngle(cmd->viewangles);
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
}
if (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 = interfaces::entityList->GetClientEntity(this->m_hTargetHealing);
if (tr_heal) {
AimAtHitbox(tr_heal, 4, cmd);
g_pLocalPlayer->bUseSilentAngles = true;
}
} else {
return;
}
interfaces::engineClient->SetViewAngles(angles);
}
@ -397,6 +265,19 @@ IClientEntity* FollowBot::GetBestHealingTarget() {
bool FollowBot::CreateMove(void*, float, CUserCmd* cmd) {
if (!v_bEnabled->GetBool()) return true;
/*ipc_bot_seg* seg_g = m_pIPC->GetBotCommand(0);
ipc_bot_seg* seg_l = m_pIPC->GetBotCommand(m_pIPC->bot_id);
if (seg_g->command_number > this->last_command_global) {
interfaces::engineClient->ExecuteClientCmd(seg_g->command_buffer);
this->last_command_global = seg_g->command_number;
}
if (seg_l->command_number > this->last_command_global) {
interfaces::engineClient->ExecuteClientCmd(seg_l->command_buffer);
this->last_command_global = seg_l->command_number;
}*/
Tick(cmd);
g_nTick++;
this->ActuallyCreateMove(cmd);
@ -407,6 +288,10 @@ int FollowBot::GetHealingPriority(IClientEntity* ent) {
if (!ent) return 0;
int result = 0;
if (GetEntityValue<char>(ent, eoffsets.iLifeState)) return 0;
if (GetEntityValue<int>(ent, eoffsets.iTeamNum) != g_pLocalPlayer->team) return 0;
if (!IsEntityVisible(ent, 4)) return 0;
int health = GetEntityValue<int>(ent, eoffsets.iHealth);
int maxhealth = g_pPlayerResource->GetMaxHealth(ent);
int maxbuffedhealth = maxhealth * 1.5;
@ -446,7 +331,7 @@ void FollowBot::SetOwner(uint32 id) {
// TODO
void CC_BotStatus(const CCommand& args) {
logging::Info("Bot Status: %i, ID: %i, Search: %i", g_bState, g_nTargetID, nPilotSearch);
//logging::Info("Bot Status: %i, ID: %i, Search: %i", g_bState, g_nTargetID, nPilotSearch);
}
void CC_AddBotID(const CCommand& args) {
@ -463,28 +348,60 @@ void CC_SetOwner(const CCommand& args) {
g_phFollowBot->m_nOwnerID = id;
}
void CC_BotCommand(const CCommand& args) {
if (args.ArgC() < 2) return;
int bot_id = strtol(args.Arg(1), 0, 0);
if (!bot_id) {
logging::Info("Executing command `%s` on EACH bot.", args.Arg(2));
} else {
logging::Info("Executing command `%s` on bot %i.", args.Arg(2), bot_id);
}
g_phFollowBot->m_pIPC->WriteBotCommand(bot_id, (char*)args.Arg(2));
}
void CC_IPCList(const CCommand& args) {
for (int i = 1; i < MAX_SEGS; i++) {
ipc_bot_seg seg = g_phFollowBot->m_pIPC->mem->segments[i];
if (seg.initialized && (time(0) - seg.last_access_time < ACCESS_TIMEOUT)) {
if (kill(seg.owner_pid, 0) == -1) {
if (errno == ESRCH) continue;
}
logging::Info("[%i]: pid=%i name=`%s`", i, seg.owner_pid, seg.name);
}
}
}
void FollowBot::Create() {
v_bEnabled = CreateConVar("u_bot_enabled", "0", "Enables followbot");
v_iForceFollow = CreateConVar("u_bot_force_follow", "-1", "Force follow by UID");
v_bForceFollowOnly = CreateConVar("u_bot_force_follow_only", "1", "Only follow that player");
v_iMaxDeltaY = CreateConVar("u_bot_max_height", "450", "Max dY");
v_iMaxDistance = CreateConVar("u_bot_aim_distance", "1300", "Distance");
v_iShootDistance = CreateConVar("u_bot_shoot_distance", "800", "Shoot distance");
v_bChat = CreateConVar("u_bot_chat", "0", "Enable chat");
v_bMediBot = CreateConVar("u_bot_medic", "1", "Medic mode");
v_iBotPackage = CreateConVar("u_bot_ai", "1", "AI Package (FOLLOW, MEDIC, SNIPER)");
c_AddBotID = CreateConCommand("u_bot_addbot", CC_AddBotID, "Adds another bot's ID");
c_SetOwner = CreateConCommand("u_bot_owner", CC_SetOwner, "Set followbot owner");
c_ResetList = CreateConCommand("u_bot_reset", CC_ResetList, "Resets bot list");
c_BotCommand = CreateConCommand("u_bot_command", CC_BotCommand, "Sends bot commands");
c_IPCList = CreateConCommand("u_bot_ipclist", CC_IPCList, "Lists IPC status");
m_nOwnerID = 0;
this->last_command_global = 0;
this->last_command_local = 0;
cmd_Status = CreateConCommand("u_bot_status", CC_BotStatus, "Status");
g_pListener = new MedicCallListener();
interfaces::eventManager->AddListener(g_pListener, "player_calledformedic", false);
logging::Info("Creating shared memory for bot");
m_pIPC = new ipcctl();
if (m_pIPC->Init()) {
logging::Info("Successfully allocated shared memory!");
logging::Info("Bot ID: %i", m_pIPC->bot_id);
} else {
logging::Info("Failed to allocate shared memory for bot.");
}
}
void FollowBot::Destroy() {
interfaces::eventManager->RemoveListener(g_pListener);
m_pIPC->Detach();
}
void FollowBot::PaintTraverse(void*, unsigned int, bool, bool) {}

View File

@ -10,6 +10,7 @@
#include "IHack.h"
class ipcctl;
class IClientEntity;
void CC_ResetList(const CCommand& args);
@ -17,6 +18,12 @@ void CC_AddBotID(const CCommand& args);
void CC_BotStatus(const CCommand& args);
void CC_SetOwner(const CCommand& args);
enum botpackage {
BOT_FOLLOW = 0,
BOT_MEDIC,
BOT_SNIPER
};
class FollowBot : public IHack {
public:
void Create();
@ -27,6 +34,7 @@ public:
void Tick(CUserCmd*);
int ShouldNotTarget(IClientEntity* ent, bool notrace);
bool ShouldPopUber(bool force);
void ActuallyCreateMove(CUserCmd*);
IClientEntity* GetBestHealingTarget();
int GetHealingPriority(IClientEntity* ent);
@ -43,21 +51,20 @@ public:
ConCommand* cmd_Status;
ConVar* v_bEnabled;
ConVar* v_iForceFollow;
ConVar* v_bForceFollowOnly;
ConVar* v_iMaxDistance;
ConVar* v_iShootDistance;
ConVar* v_iMaxDeltaY;
ConVar* v_bChat;
int m_iShouldUbercharge;
ConVar* v_bMediBot;
ConVar* v_iBotPackage;
ConCommand* c_AddBotID;
ConCommand* c_SetOwner;
ConCommand* c_ResetList;
ConCommand* c_BotCommand;
ConCommand* c_IPCList;
uint32 m_nOwnerID;
uint32 m_OtherBots[32];
uint32 m_nOtherBots;
ipcctl* m_pIPC;
unsigned last_command_global;
unsigned last_command_local;
};
extern FollowBot* g_phFollowBot;

View File

@ -14,6 +14,7 @@
#include "../trace.h"
#include "../targethelper.h"
#include "../localplayer.h"
#include "../drawing.h"
//typedef int CBaseEntity;
@ -36,11 +37,12 @@ int target_lock;
void HAimbot::Create() {
this->v_bEnabled = CreateConVar("u_aimbot_enabled", "0", "Enables aimbot. EXPERIMENTAL AND TOTALLY NOT LEGIT");
this->v_iHitbox = CreateConVar("u_aimbot_hitbox", "0", "Hitbox");
this->v_bAutoHitbox = CreateConVar("u_aimbot_autohitbox", "1", "Autohitbox");
this->v_bPrediction = CreateConVar("u_aimbot_prediction", "1", "Latency prediction");
this->v_bAutoShoot = CreateConVar("u_aimbot_autoshoot", "1", "Autoshoot");
this->v_bSilent = CreateConVar("u_aimbot_silent", "1", "'Silent' mode");
this->v_bSilent = CreateConVar("u_aimbot_silent", "1", "Silent mode");
this->v_bZoomedOnly = CreateConVar("u_aimbot_zoomed", "1", "Only acitve with zoomed rifle");
this->v_iAutoShootCharge = CreateConVar("u_aimbot_autoshoot_charge", "15.0", "Minimal charge for autoshoot");
this->v_iAutoShootCharge = CreateConVar("u_aimbot_autoshoot_charge", "0.0", "Minimal charge for autoshoot");
this->v_iMinRange = CreateConVar("u_aimbot_minrange", "0", "Minimum range to aim");
this->v_bPriority = CreateConVar("u_aimbot_priority", "1", "Use priority system");
this->v_bRespectCloak = CreateConVar("u_aimbot_respect_cloak", "1", "Will not shoot cloaked spies.");
@ -57,10 +59,20 @@ void HAimbot::Create() {
bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) {
if (!this->v_bEnabled->GetBool()) return true;
this->m_iLastTarget = -1;
if (this->v_bEnabledAttacking->GetBool() && !(cmd->buttons & IN_ATTACK)) {
return true;
}
if (g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFMinigun) {
if (!(g_pLocalPlayer->cond_0 & cond::slowed)) {
return true;
}
if (!(cmd->buttons & IN_ATTACK2)) {
return true;
}
}
if (g_pLocalPlayer->bIsReloading) {
return true;
}
@ -71,24 +83,34 @@ bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) {
IClientEntity* player = g_pLocalPlayer->entity;
if (!player) return true;
if (player->IsDormant()) return true;
if (g_pLocalPlayer->clazz == 2 && this->v_bZoomedOnly->GetBool() &&
!(g_pLocalPlayer->cond_0 & cond::zoomed)) {
return true;
m_iHitbox = this->v_iHitbox->GetInt();
if (this->v_bAutoHitbox->GetBool()) m_iHitbox = 7;
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)) {
if (this->v_bZoomedOnly->GetBool()) return true;
} else {
if (this->v_bAutoHitbox->GetBool()) m_iHitbox = 0;
}
}
}
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) {
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == 210) return true;
} /* Grappling hook */
//logging::Info("Creating move.. aimbot");
/*if (v_bMachinaPenetration->GetBool()) {
if (g_pLocalPlayer->weapon) {
if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle) {
}
}
}*/
}
m_bProjectileMode = (GetProjectileData(g_pLocalPlayer->weapon, m_flProjSpeed, m_bProjArc));
// TODO priority modes (FOV, Smart, Distance, etc)
if (!this->v_bPriority->GetBool()) {
IClientEntity* target_locked = interfaces::entityList->GetClientEntity(target_lock);
if (target_locked != 0) {
@ -101,17 +123,18 @@ bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) {
}
}
IClientEntity* target_highest = 0;
int target_highest_score = 0;
for (int i = 0; i < interfaces::entityList->GetHighestEntityIndex() && i < 64; i++) {
int target_highest_score = -256;
for (int i = 0; i < interfaces::entityList->GetHighestEntityIndex(); i++) {
IClientEntity* ent = interfaces::entityList->GetClientEntity(i);
if (ent == 0) continue;
if (ent->GetClientClass()->m_ClassID != 241) continue; // TODO magic number: player
if (!(IsPlayer(ent) || IsBuilding(ent))) continue;
if (ShouldTarget(ent)) {
//if (v_bDebug->GetBool()) {
//}
if (!this->v_bPriority->GetBool()) {
target_lock = i;
this->m_iLastTarget = target_lock;
if (Aim(ent, cmd)) {
continue;
}
@ -126,6 +149,7 @@ bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) {
}
if (this->v_bPriority->GetBool()) {
if (target_highest != 0) {
this->m_iLastTarget = target_highest->entindex();
Aim(target_highest, cmd);
}
}
@ -133,63 +157,90 @@ bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) {
}
void HAimbot::Destroy() {}
void HAimbot::PaintTraverse(void*, unsigned int, bool, bool) {}
void HAimbot::PaintTraverse(void*, unsigned int, bool, bool) {
if (!v_bEnabled->GetBool()) return;
if (this->m_iLastTarget == -1) return;
IClientEntity* ent = interfaces::entityList->GetClientEntity(this->m_iLastTarget);
if (!ent) return;
if (IsPlayer(ent)) {
int clazz = GetEntityValue<int>(ent, eoffsets.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)", GetEntityValue<int>(ent, eoffsets.iHealth), tfclasses[clazz], info.name);
} else if (IsBuilding(ent)) {
AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", GetEntityValue<int>(ent, eoffsets.iBuildingHealth), GetEntityValue<int>(ent, eoffsets.iUpgradeLevel), GetBuildingType(ent));
}
}
bool HAimbot::ShouldTarget(IClientEntity* entity) {
if (!entity) return false;
if (entity->IsDormant()) return false;
if (IsPlayerInvulnerable(entity)) return false;
int team = GetEntityValue<int>(entity, eoffsets.iTeamNum);
int local = interfaces::engineClient->GetLocalPlayer();
IClientEntity* player = interfaces::entityList->GetClientEntity(local);
char life_state = GetEntityValue<char>(entity, eoffsets.iLifeState);
if (life_state) return false; // TODO magic number: life state
if (!player) return false;
if (v_bRespectCloak->GetBool() && (GetEntityValue<int>(entity, eoffsets.iCond) & cond::cloaked)) return false;
int health = GetEntityValue<int>(entity, eoffsets.iHealth);
if (this->v_bCharge->GetBool() && (GetEntityValue<int>(player, eoffsets.iClass) == 2)) {
int rifleHandle = GetEntityValue<int>(player, eoffsets.hActiveWeapon);
IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF);
if (!rifle) return false;
float bdmg = GetEntityValue<float>(rifle, eoffsets.flChargedDamage);
if (health > 150 && (health > (150 + bdmg) || bdmg < 15.0f)) return false;
}
int team_my = GetEntityValue<int>(player, eoffsets.iTeamNum);
if (team == team_my) return false;
Vector enemy_pos = entity->GetAbsOrigin();
Vector my_pos = player->GetAbsOrigin();
if (v_iMinRange->GetInt() > 0) {
if ((enemy_pos - my_pos).Length() > v_iMinRange->GetInt()) return false;
}
int econd = GetEntityValue<int>(entity, eoffsets.iCond1);
if ((econd & cond_ex::vacc_bullet)) return false;
if (GetRelation(entity) == relation::FRIEND) return false;
Vector resultAim;
if (m_bProjectileMode) {
resultAim = entity->GetAbsOrigin();
if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)v_iHitbox->GetInt(), m_flProjSpeed, m_bProjArc, resultAim)) return false;
} else {
if (v_bMachinaPenetration->GetBool()) {
if (GetHitboxPosition(entity, v_iHitbox->GetInt(), resultAim)) return false;
if (!IsEntityVisiblePenetration(entity, v_iHitbox->GetInt())) return false;
} else {
if (GetHitboxPosition(entity, v_iHitbox->GetInt(), resultAim)) return false;
if (!IsEntityVisible(entity, v_iHitbox->GetInt())) return false;
if (IsPlayer(entity)) {
if (IsPlayerInvulnerable(entity)) return false;
int team = GetEntityValue<int>(entity, eoffsets.iTeamNum);
int local = interfaces::engineClient->GetLocalPlayer();
IClientEntity* player = interfaces::entityList->GetClientEntity(local);
char life_state = GetEntityValue<char>(entity, eoffsets.iLifeState);
if (life_state) return false; // TODO magic number: life state
if (!player) return false;
if (v_bRespectCloak->GetBool() && (GetEntityValue<int>(entity, eoffsets.iCond) & cond::cloaked)) return false;
int health = GetEntityValue<int>(entity, eoffsets.iHealth);
if (this->v_bCharge->GetBool() && (GetEntityValue<int>(player, eoffsets.iClass) == 2)) {
int rifleHandle = GetEntityValue<int>(player, eoffsets.hActiveWeapon);
IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF);
if (!rifle) return false;
float bdmg = GetEntityValue<float>(rifle, eoffsets.flChargedDamage);
if (health > 150 && (health > (150 + bdmg) || bdmg < 15.0f)) return false;
}
}
if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, resultAim) > v_iFOV->GetFloat())) return false;
return true;
/*if (!m_bProjectileMode) {
Vector hbv;
if (GetHitboxPosition(entity, v_iHitbox->GetInt(), hbv)) return false;
if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, hbv) > v_iFOV->GetInt())) return false;
return IsEntityVisible(entity, v_iHitbox->GetInt());
int team_my = GetEntityValue<int>(player, eoffsets.iTeamNum);
if (team == team_my) return false;
Vector enemy_pos = entity->GetAbsOrigin();
Vector my_pos = player->GetAbsOrigin();
if (v_iMinRange->GetInt() > 0) {
if ((enemy_pos - my_pos).Length() > v_iMinRange->GetInt()) return false;
}
int econd = GetEntityValue<int>(entity, eoffsets.iCond1);
if ((econd & cond_ex::vacc_bullet)) return false;
if (GetRelation(entity) == relation::FRIEND) return false;
Vector resultAim;
if (m_bProjectileMode) {
resultAim = entity->GetAbsOrigin();
if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, m_flProjSpeed, m_bProjArc, resultAim)) return false;
} else {
if (v_bMachinaPenetration->GetBool()) {
if (GetHitboxPosition(entity, m_iHitbox, resultAim)) return false;
if (!IsEntityVisiblePenetration(entity, v_iHitbox->GetInt())) return false;
} else {
if (GetHitboxPosition(entity, m_iHitbox, resultAim)) return false;
if (!IsEntityVisible(entity, m_iHitbox)) return false;
}
}
if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, resultAim) > v_iFOV->GetFloat())) return false;
return true;
} else if (IsBuilding(entity)) {
int team = GetEntityValue<int>(entity, eoffsets.iTeamNum);
if (team == g_pLocalPlayer->team) return false;
Vector enemy_pos = entity->GetAbsOrigin();
if (v_iMinRange->GetInt() > 0) {
if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > v_iMinRange->GetInt()) return false;
}
Vector resultAim;
if (m_bProjectileMode) {
resultAim = entity->GetAbsOrigin();
if (!PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, m_flProjSpeed, m_bProjArc, resultAim)) return false;
} else {
//logging::Info("IsVisible?");
if (!IsBuildingVisible(entity)) return false;
}
//logging::Info("IsFOV?");
if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, resultAim) > v_iFOV->GetFloat())) return false;
//logging::Info("Tru");
return true;
} else {
Vector res = entity->GetAbsOrigin();
bool succ = PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)v_iHitbox->GetInt(), m_flProjSpeed, m_bProjArc, res);
if (v_iFOV->GetBool() && (GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, res) > v_iFOV->GetInt())) return false;
return succ;
}*/
return false;
}
return false;
}
void PredictPosition(Vector vec, IClientEntity* ent) {
@ -204,19 +255,21 @@ bool HAimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
Vector hit;
Vector angles;
if (!entity) return false;
GetHitboxPosition(entity, v_iHitbox->GetInt(), hit);
//logging::Info("Predicting.. entity: 0x%08f", entity);
PredictPosition(hit, entity);
if (IsPlayer(entity)) {
GetHitboxPosition(entity, m_iHitbox, hit);
PredictPosition(hit, entity);
} else if (IsBuilding(entity)) {
hit = GetBuildingPosition(entity);
}
if (v_bProjectileAimbot->GetBool()) {
float speed = 0.0f;
bool arc = false;
if (GetProjectileData(g_pLocalPlayer->weapon, speed, arc)) {
if (v_iOverrideProjSpeed->GetBool())
speed = v_iOverrideProjSpeed->GetFloat();
PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)v_iHitbox->GetInt(), speed, arc, hit);
PredictProjectileAim(g_pLocalPlayer->v_Eye, entity, (hitbox)m_iHitbox, speed, arc, hit);
}
}
//logging::Info("Hit: %f %f %f", hit.x, hit.y, hit.z);
IClientEntity* local = interfaces::entityList->GetClientEntity(interfaces::engineClient->GetLocalPlayer());
Vector tr = (hit - g_pLocalPlayer->v_Eye);
fVectorAngles(tr, angles);
@ -224,16 +277,7 @@ bool HAimbot::Aim(IClientEntity* entity, CUserCmd* cmd) {
cmd->viewangles = angles;
if (this->v_bSilent->GetBool()) {
g_pLocalPlayer->bUseSilentAngles = true;
//FixMovement(*cmd, viewangles_old);
/*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;*/
}
//logging::Info("Angles: %f %f %f", angles.x, angles.y, angles.z);
if (this->v_bAutoShoot->GetBool()) {
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
if (g_pLocalPlayer->cond_0 & cond::zoomed) {

View File

@ -24,10 +24,13 @@ public:
bool m_bProjectileMode;
float m_flProjSpeed;
bool m_bProjArc;
int m_iLastTarget;
int m_iHitbox;
ConVar* v_bDebug;
ConVar* v_bEnabled;
ConVar* v_iFOV;
ConVar* v_iHitbox;
ConVar* v_bAutoHitbox;
ConVar* v_bPrediction;
ConVar* v_bAutoShoot;
ConVar* v_bSilent;

View File

@ -135,6 +135,11 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) {
case ClassID::CObjectSentrygun:
case ClassID::CObjectDispenser:
case ClassID::CObjectTeleporter: {
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
return;
}
}
if (ent->Var<int>(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool()) break;
color = colors::GetTeamColor(ent->Var<int>(eoffsets.iTeamNum), false);
DrawBox(ent, color, 1.0f, 0.0f, true, ent->Var<int>(eoffsets.iBuildingHealth), ent->Var<int>(eoffsets.iBuildingMaxHealth));

View File

@ -22,6 +22,8 @@
#include <client_class.h>
#include <icliententitylist.h>
#include <Color.h>
#include <iclient.h>
#include <inetchannel.h>
#include <cdll_int.h>
#include <iconvar.h>
#include <dt_common.h>
@ -162,9 +164,33 @@ void CC_SayInfo(const CCommand& args) {
}
void CC_Disconnect(const CCommand& args) {
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
//logging::Info("userid %i rate %i", interfaces::client->GetUserID(), interfaces::client->GetRate());
//INetChannel* ch = interfaces::client->GetNetChannel();
if (!ch) {
logging::Info("No net channel!");
return;
}
logging::Info("version %i", ch->GetProtocolVersion());
ch->Shutdown(args.ArgS());
}
void CC_DisonnectVAC(const CCommand& args) {
INetChannel* ch = (INetChannel*)interfaces::engineClient->GetNetChannelInfo();
if (!ch) {
logging::Info("No net channel!");
return;
}
//logging::Info("version %i", ch->GetProtocolVersion());
ch->Shutdown("VAC banned from secure server\n");
}
void Misc::Create() {
v_bDbWeaponInfo = CreateConVar("u_misc_debug_weapon", "0", "Debug info: Weapon");
v_bSemiAuto = CreateConVar("u_misc_semiauto", "0", "Force semi-auto");
v_bNoZoom = CreateConVar("u_nozoom", "0", "No-Zoom");
v_bNoFlinch = CreateConVar("u_noflinch", "0", "No-Flinch");
c_SayLine = CreateConCommand("u_say_lines", CC_SayLines, "Uses ^ as a newline character");
c_Shutdown = CreateConCommand("u_shutdown", CC_Shutdown, "Stops the hack");
c_AddFriend = CreateConCommand("u_addfriend", CC_AddFriend, "Adds a friend");
@ -174,10 +200,13 @@ void Misc::Create() {
c_Teamname = CreateConCommand("u_teamname", CC_Teamname, "Team name");
c_Lockee = CreateConCommand("u_lockee", CC_Lockee, "Lock/Unlock commands");
c_Reset = CreateConCommand("u_reset_lists", CC_ResetLists, "Remove all friends and rage");
c_Disconnect = CreateConCommand("u_disconnect", CC_Disconnect, "Disconnect");
c_DisconnectVAC = CreateConCommand("u_disconnect_vac", CC_DisonnectVAC, "Disconnect (VAC)");
}
int sa_switch = 0;
bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
if (v_bSemiAuto->GetBool()) {
if (cmd->buttons & IN_ATTACK) {
@ -189,6 +218,14 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) {
sa_switch = 0;
}
}
if (v_bNoZoom->GetBool()) {
if (g_pLocalPlayer->entity) {
bool zoomed = (g_pLocalPlayer->cond_0 & cond::zoomed);
if (zoomed) {
SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::zoomed);
}
}
}
return true;
}
@ -197,29 +234,47 @@ void Misc::Destroy() {
}
void Misc::PaintTraverse(void*, unsigned int, bool, bool) {
int y = 10;
if (v_bNoZoom->GetBool()) {
if (g_pLocalPlayer->entity) {
bool zoomed = (g_pLocalPlayer->cond_0 & cond::zoomed);
if (zoomed) {
SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::zoomed);
}
}
}
if (v_bNoFlinch->GetBool()) {
static Vector oldPunchAngles = Vector();
Vector punchAngles = GetEntityValue<Vector>(g_pLocalPlayer->entity, eoffsets.vecPunchAngle);
QAngle viewAngles;
interfaces::engineClient->GetViewAngles(viewAngles);
viewAngles -= VectorToQAngle(punchAngles - oldPunchAngles);
oldPunchAngles = punchAngles;
interfaces::engineClient->SetViewAngles(viewAngles);
}
if (!v_bDbWeaponInfo->GetBool())return;
if (!interfaces::input->IsButtonDown(ButtonCode_t::KEY_F)) {
/*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);
y += 14;
draw::DrawString(10, y, draw::white, draw::black, false, "flNextPrimaryAttack: %f", GetEntityValue<float>(g_pLocalPlayer->weapon, eoffsets.flNextPrimaryAttack) + 569);
y += 14;
draw::DrawString(10, y, draw::white, draw::black, false, "nTickBase: %f", (float)(GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.nTickBase)) / 66);
y += 14;
draw::DrawString(10, y, draw::white, draw::black, false, "CanShoot: %i", CanShoot(g_pLocalPlayer->entity));
y += 14;
draw::DrawString(10, y, draw::white, draw::black, false, "Decaps: %i", GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iDecapitations));
y += 14;
draw::DrawString(10, y, draw::white, draw::black, false, "Damage: %f", GetEntityValue<float>(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");
AddSideString(draw::white, draw::black, "Weapon: %s [%i]", weapon->GetClientClass()->GetName(), weapon->GetClientClass()->m_ClassID);
AddSideString(draw::white, draw::black, "flNextPrimaryAttack: %f", GetEntityValue<float>(g_pLocalPlayer->weapon, eoffsets.flNextPrimaryAttack) + 569);
AddSideString(draw::white, draw::black, "nTickBase: %f", (float)(GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.nTickBase)) / 66);
AddSideString(draw::white, draw::black, "CanShoot: %i", CanShoot(g_pLocalPlayer->entity));
AddSideString(draw::white, draw::black, "Decaps: %i", GetEntityValue<int>(g_pLocalPlayer->entity, eoffsets.iDecapitations));
AddSideString(draw::white, draw::black, "Damage: %f", GetEntityValue<float>(g_pLocalPlayer->weapon, eoffsets.flChargedDamage));
AddSideString(draw::white, draw::black, "DefIndex: %i", GetEntityValue<int>(g_pLocalPlayer->weapon, eoffsets.iItemDefinitionIndex));
//AddSideString(draw::white, draw::black, "VecPunchAngle: %f %f %f", pa.x, pa.y, pa.z);
//draw::DrawString(10, y, draw::white, draw::black, false, "VecPunchAngleVel: %f %f %f", pav.x, pav.y, pav.z);
//y += 14;
//AddCenterString(draw::font_handle, interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_X), interfaces::input->GetAnalogValue(AnalogCode_t::MOUSE_Y), draw::white, L"S\u0FD5");
}
}

View File

@ -19,6 +19,9 @@ public:
bool CreateMove(void*, float, CUserCmd*);
void Destroy();
void PaintTraverse(void*, unsigned int, bool, bool);
ConVar* v_bNoFlinch;
ConVar* v_bNoZoom;
ConVar* v_bDbWeaponInfo;
ConVar* v_bSemiAuto;
ConCommand* c_SayLine;
@ -31,6 +34,8 @@ public:
ConCommand* c_Lockee;
ConCommand* c_Info;
ConCommand* c_Reset;
ConCommand* c_Disconnect;
ConCommand* c_DisconnectVAC;
};
extern Misc* g_phMisc;

View File

@ -72,6 +72,21 @@ const char* GetModelPath(IClientEntity* entity) {
return interfaces::model->GetModelName(model);
}
const char* GetBuildingType(IClientEntity* ent) {
if (!ent) return "[NULL]";
switch (ent->GetClientClass()->m_ClassID) {
case ClassID::CObjectSentrygun:
// TODO mini
return "Sentry";
case ClassID::CObjectDispenser:
return "Dispenser";
case ClassID::CObjectTeleporter:
// TODO exit/entr
return "Teleporter";
}
return "[NULL]";
}
/* Takes CBaseAnimating entity as input */
item_type GetItemType(IClientEntity* entity) {
if (entity == 0) return item_type::item_null;
@ -309,6 +324,44 @@ bool IsEntityVisible(IClientEntity* entity, int hb) {
return false;
}
Vector GetBuildingPosition(IClientEntity* ent) {
Vector res = ent->GetAbsOrigin();
switch (ent->GetClientClass()->m_ClassID) {
case ClassID::CObjectDispenser:
res.z += 30;
break;
case ClassID::CObjectTeleporter:
res.z += 8;
break;
case ClassID::CObjectSentrygun:
switch (GetEntityValue<int>(ent, eoffsets.iUpgradeLevel)) {
case 1:
res.z += 30;
break;
case 2:
res.z += 50;
break;
case 3:
res.z += 60;
break;
}
break;
}
return res;
}
bool IsBuildingVisible(IClientEntity* ent) {
if (!trace_filter) {
trace_filter = new trace::FilterDefault();
}
trace_t trace_visible;
Ray_t ray;
trace_filter->SetSelf(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;
}
void fVectorAngles(Vector &forward, Vector &angles) {
float tmp, yaw, pitch;
@ -474,6 +527,21 @@ Vector CalcAngle(Vector src, Vector dst) {
return AimAngles;
}
bool IsBuilding(IClientEntity* ent) {
if (!ent) return false;
switch (ent->GetClientClass()->m_ClassID) {
case ClassID::CObjectSentrygun:
case ClassID::CObjectDispenser:
case ClassID::CObjectTeleporter:
return true;
}
return false;
}
bool IsPlayer(IClientEntity* ent) {
return (ent && ent->GetClientClass()->m_ClassID == ClassID::CTFPlayer);
}
void MakeVector(Vector angle, Vector& vector)
{
float pitch = float(angle[0] * PI / 180);
@ -528,7 +596,7 @@ bool CanHeadshot(IClientEntity* player) {
break;
}
case ClassID::CTFSniperRifleClassic:
return false; // Fuck classic.
return false; // NO!!! IT CANNOT!!! Fuck classic.
}
return false;
}
@ -631,25 +699,25 @@ const char* powerups[] = {
"CRITS"
};
/*const char* classes[] = {
"",
"",
"",
"",
"",
"",
"",
"",
""
};*/
uint32 friends[256];
uint32 rage[256];
int n_friends = 0;
int n_rage = 0;
const char* tfclasses[] = {
"[NULL]",
"Scout",
"Sniper",
"Soldier",
"Demoman",
"Medic",
"Heavy",
"Pyro",
"Spy",
"Engineer"
};
const char* packs[] = {
"+",
"++",

View File

@ -32,6 +32,11 @@ class Vector;
bool IsPlayerCritBoosted(IClientEntity* player);
bool IsPlayerInvulnerable(IClientEntity* player);
bool IsPlayerInvisible(IClientEntity* player);
bool IsBuilding(IClientEntity* ent);
bool IsPlayer(IClientEntity* ent);
const char* GetBuildingType(IClientEntity* ent);
Vector GetBuildingPosition(IClientEntity* ent);
bool IsBuildingVisible(IClientEntity* ent);
//bool SpyIsVisible(IClientEntity* spy);
ConVar* CreateConVar(const char* name, const char* value, const char* help);
ConCommand* CreateConCommand(const char* name, FnCommandCallback_t callback, const char* help);
@ -77,7 +82,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* tfclasses[10];
extern const char* powerups[POWERUP_COUNT];
extern const char* packs[PACK_COUNT];
extern uint32 friends[256];

View File

@ -13,6 +13,7 @@
unsigned int hooks::offCreateMove = 22;
unsigned int hooks::offPaintTraverse = 42;
unsigned int hooks::offOverrideView = 17;
unsigned int hooks::CountMethods(void** vmt) {
unsigned int i = -1;

View File

@ -35,6 +35,7 @@ extern VMTHook* hkCreateMove;
extern unsigned int offPaintTraverse;
extern unsigned int offCreateMove;
extern unsigned int offOverrideView;
}

View File

@ -25,6 +25,7 @@ IBaseClientDLL* interfaces::baseClient = 0;
IEngineTrace* interfaces::trace = 0;
IVModelInfoClient* interfaces::model = 0;
IInputSystem* interfaces::input = 0;
//IClient* interfaces::client = 0;
//ICvar* interfaces::cvar = 0;
void interfaces::CreateInterfaces() {
@ -40,6 +41,7 @@ void interfaces::CreateInterfaces() {
interfaces::trace = reinterpret_cast<IEngineTrace*>(sharedobj::engine->CreateInterface("EngineTraceClient003"));
interfaces::model = reinterpret_cast<IVModelInfoClient*>(sharedobj::engine->CreateInterface("VModelInfoClient006"));
interfaces::input = reinterpret_cast<IInputSystem*>(sharedobj::inputsystem->CreateInterface("InputSystemVersion001"));
//interfaces::client = reinterpret_cast<IClient*>(sharedobj::client->CreateInterface("VClient017"));
HSteamPipe sp = interfaces::steamClient->CreateSteamPipe();
HSteamUser su = interfaces::steamClient->ConnectToGlobalUser(sp);
interfaces::steamFriends = reinterpret_cast<ISteamFriends002*>(interfaces::steamClient->GetISteamFriends(su, sp, "SteamFriends002"));

View File

@ -25,6 +25,7 @@ class ClientModeShared;
class IEngineTrace;
class IVModelInfoClient;
class IInputSystem;
class IClient;
namespace interfaces {
@ -41,6 +42,7 @@ extern IBaseClientDLL* baseClient;
extern IEngineTrace* trace;
extern IVModelInfoClient* model;
extern IInputSystem* input;
//extern IClient* client;
void CreateInterfaces();

View File

@ -26,7 +26,7 @@ void LocalPlayer::Update() {
cond_0 = GetEntityValue<int>(entity, eoffsets.iCond);
clazz = GetEntityValue<int>(entity, eoffsets.iClass);
health = GetEntityValue<int>(entity, eoffsets.iHealth);
this->bUseSilentAngles = false;
int hWeapon = GetEntityValue<int>(entity, eoffsets.hActiveWeapon);

36
uran/src/profiler.cpp Normal file
View File

@ -0,0 +1,36 @@
/*
* profiler.cpp
*
* Created on: Nov 26, 2016
* Author: nullifiedcat
*/
#include "profiler.h"
#include "logging.h"
int g_ProfilerDepth = 0;
char* g_ProfilerSections[MAX_PROFILER_SECTIONS];
time_t g_ProfilerSectionsTime[MAX_PROFILER_SECTIONS];
void BeginSection(char* name) {
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++;
}
void 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]);
g_ProfilerDepth--;
}

28
uran/src/profiler.h Normal file
View File

@ -0,0 +1,28 @@
/*
* profiler.h
*
* Created on: Nov 26, 2016
* Author: nullifiedcat
*/
#ifndef PROFILER_H_
#define PROFILER_H_
#include <time.h>
#define ENABLE_PROFILER true
#define PROFILER_OUTPUT_DEPTH 1
#define MAX_PROFILER_SECTIONS 16
#if ENABLE_PROFILER == true
#define PROF_BEGIN(X) PROFILER_BeginSection(X)
#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);
#endif /* PROFILER_H_ */

View File

@ -12,6 +12,7 @@
#include "fixsdk.h"
#include <icliententity.h>
#include <client_class.h>
/*
* Targeting priorities:
@ -25,6 +26,21 @@
/* Assuming given entity is a valid target range 0 to 100 */
int GetScoreForEntity(IClientEntity* entity) {
if (!entity) return 0;
// TODO
if (IsBuilding(entity)) {
switch (entity->GetClientClass()->m_ClassID) {
case ClassID::CObjectSentrygun:
float distance = (g_pLocalPlayer->v_Origin - entity->GetAbsOrigin()).Length();
// TODO
int total = 1;
if (distance != 0) {
int distance_factor = (4096 / distance) * 4;
total += distance_factor;
}
return 15;
}
return 0;
}
int clazz = GetEntityValue<int>(entity, eoffsets.iClass);
int health = GetEntityValue<int>(entity, eoffsets.iHealth);
float distance = (g_pLocalPlayer->v_Origin - entity->GetAbsOrigin()).Length();

21
uran/src/weaponprefs.cpp Normal file
View File

@ -0,0 +1,21 @@
/*
* weaponprefs.cpp
*
* Created on: Nov 25, 2016
* Author: nullifiedcat
*/
#include "weaponprefs.h"
#include "entity.h"
#include "fixsdk.h"
#include <icliententity.h>
int g_MeleeList[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 37,
};
bool IsMeleeWeapon(int defidx) {
return false;
}

21
uran/src/weaponprefs.h Normal file
View File

@ -0,0 +1,21 @@
/*
* weaponprefs.h
*
* Created on: Nov 25, 2016
* Author: nullifiedcat
*/
#ifndef WEAPONPREFS_H_
#define WEAPONPREFS_H_
/*extern int g_MeleeList[];
bool IsMeleeWeapon(int defidx);
bool IsPistolWeapon(int defidx);
bool IsMinigunWeapon(int defidx);
bool IsShotgunWeapon(int defidx);
bool IsRifleWeapon(int defidx);
bool IsConsumableWeapon(int defidx);
bool IsPDAWeapon(int defidx);*/
#endif /* WEAPONPREFS_H_ */