This commit is contained in:
nullifiedcat 2018-07-29 13:12:59 +03:00
parent bf6c8d8fdc
commit 56ce98a821
14 changed files with 98 additions and 75 deletions

View File

@ -10,6 +10,7 @@
namespace hacks::shared::autojoin namespace hacks::shared::autojoin
{ {
void Update(); void resetQueueTimer();
void UpdateSearch(); void update();
void updateSearch();
} }

View File

@ -57,4 +57,7 @@ extern circular_buf sequences;
extern int ticks; extern int ticks;
extern BacktrackData headPositions[32][66]; extern BacktrackData headPositions[32][66];
extern BestTickData sorted_ticks[66]; extern BestTickData sorted_ticks[66];
bool isBacktrackEnabled();
float getLatency();
} }

View File

@ -72,7 +72,7 @@ IgnoreReason shouldTarget(CachedEntity *entity)
{ {
if (hoovy && IsHoovy(entity)) if (hoovy && IsHoovy(entity))
return IgnoreReason::IS_HOOVY; return IgnoreReason::IS_HOOVY;
if (settings::taunting && HasCondition<TFCond_Taunting>(entity)) if (taunting && HasCondition<TFCond_Taunting>(entity))
return IgnoreReason::IS_TAUNTING; return IgnoreReason::IS_TAUNTING;
return shouldTargetSteamId(entity->player_info.friendsID); return shouldTargetSteamId(entity->player_info.friendsID);

View File

@ -59,5 +59,5 @@ void logging::Info(const char *fmt, ...)
void logging::Shutdown() void logging::Shutdown()
{ {
fclose(logging::handle); fclose(logging::handle);
logging::handle = nullptr logging::handle = nullptr;
} }

View File

@ -383,14 +383,13 @@ free(logname);*/
#endif /* TEXTMODE */ #endif /* TEXTMODE */
#if not LAGBOT_MODE #if not LAGBOT_MODE
hacks::shared::anticheat::Init(); hacks::shared::anticheat::Init();
hacks::tf2::healarrow::Init();
#endif #endif
#if ENABLE_VISUALS #if ENABLE_VISUALS
#ifndef FEATURE_FIDGET_SPINNER_ENABLED #ifndef FEATURE_FIDGET_SPINNER_ENABLED
InitSpinner(); InitSpinner();
logging::Info("Initialized Fidget Spinner"); logging::Info("Initialized Fidget Spinner");
#endif #endif
hacks::shared::spam::Init(); hacks::shared::spam::init();
backpacktf::init(); backpacktf::init();
logging::Info("Initialized Backpack.TF integration"); logging::Info("Initialized Backpack.TF integration");
#endif #endif

View File

@ -91,7 +91,7 @@ AimbotCalculatedData_s calculated_data_array[2048]{};
#define IsMelee GetWeaponMode() == weapon_melee #define IsMelee GetWeaponMode() == weapon_melee
bool BacktrackAimbot() bool BacktrackAimbot()
{ {
if (!hacks::shared::backtrack::enable || !backtrackAimbot) if (!hacks::shared::backtrack::isBacktrackEnabled() || !backtrackAimbot)
return false; return false;
if (aimkey && !aimkey.isKeyDown()) if (aimkey && !aimkey.isKeyDown())
return false; return false;
@ -100,14 +100,14 @@ bool BacktrackAimbot()
return false; return false;
if (zoomed_only && !g_pLocalPlayer->bZoomed && if (zoomed_only && !g_pLocalPlayer->bZoomed &&
!(g_pUserCmd->buttons & IN_ATTACK)) !(current_user_cmd->buttons & IN_ATTACK))
return false; return false;
int iBestTarget = hacks::shared::backtrack::iBestTarget; int iBestTarget = hacks::shared::backtrack::iBestTarget;
if (iBestTarget == -1) if (iBestTarget == -1)
return true; return true;
int tickcnt = 0; int tickcnt = 0;
int tickus = (float(hacks::shared::backtrack::latency) > 800.0f || float(hacks::shared::backtrack::latency) < 200.0f) ? 12 : 24; int tickus = (float(hacks::shared::backtrack::getLatency()) > 800.0f || float(hacks::shared::backtrack::getLatency()) < 200.0f) ? 12 : 24;
for (auto i : hacks::shared::backtrack::headPositions[iBestTarget]) for (auto i : hacks::shared::backtrack::headPositions[iBestTarget])
{ {
bool good_tick = false; bool good_tick = false;
@ -133,7 +133,7 @@ bool BacktrackAimbot()
float &simtime = CE_FLOAT(tar, netvar.m_flSimulationTime); float &simtime = CE_FLOAT(tar, netvar.m_flSimulationTime);
angles.y = i.viewangles; angles.y = i.viewangles;
simtime = i.simtime; simtime = i.simtime;
g_pUserCmd->tick_count = i.tickcount; current_user_cmd->tick_count = i.tickcount;
Vector tr = (i.hitboxpos - g_pLocalPlayer->v_Eye); Vector tr = (i.hitboxpos - g_pLocalPlayer->v_Eye);
Vector angles2; Vector angles2;
VectorAngles(tr, angles2); VectorAngles(tr, angles2);
@ -147,9 +147,9 @@ bool BacktrackAimbot()
if (!slow_aim) if (!slow_aim)
slow_can_shoot = true; slow_can_shoot = true;
// Set angles // Set angles
g_pUserCmd->viewangles = angles2; current_user_cmd->viewangles = angles2;
if (autoshoot && slow_can_shoot) if (autoshoot && slow_can_shoot)
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
return true; return true;
} }
return true; return true;
@ -158,7 +158,7 @@ bool BacktrackAimbot()
void CreateMove() void CreateMove()
{ {
PROF_SECTION(PT_aimbot_cm); PROF_SECTION(PT_aimbot_cm);
if (!enabled) if (!enable)
return; return;
// Auto-Unzoom // Auto-Unzoom
@ -167,7 +167,7 @@ void CreateMove()
if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed && if (g_pLocalPlayer->holding_sniper_rifle && g_pLocalPlayer->bZoomed &&
zoomTime.check(3000)) zoomTime.check(3000))
{ {
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
} }
// We do this as we need to pass whether the aimkey allows aiming to both // We do this as we need to pass whether the aimkey allows aiming to both
@ -188,7 +188,7 @@ void CreateMove()
zoomTime.update(); zoomTime.update();
if (not g_pLocalPlayer->bZoomed) if (not g_pLocalPlayer->bZoomed)
{ {
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
} }
} }
@ -250,7 +250,7 @@ void CreateMove()
currently_charging_huntsman = true; currently_charging_huntsman = true;
// Huntsman was released // Huntsman was released
if (!(g_pUserCmd->buttons & IN_ATTACK) && if (!(current_user_cmd->buttons & IN_ATTACK) &&
currently_charging_huntsman) currently_charging_huntsman)
{ {
currently_charging_huntsman = false; currently_charging_huntsman = false;
@ -275,7 +275,7 @@ void CreateMove()
currently_charging_pipe = true; currently_charging_pipe = true;
// Grenade was released // Grenade was released
if (!(g_pUserCmd->buttons & IN_ATTACK) && currently_charging_pipe) if (!(current_user_cmd->buttons & IN_ATTACK) && currently_charging_pipe)
{ {
currently_charging_pipe = false; currently_charging_pipe = false;
Aim(target_entity); Aim(target_entity);
@ -302,8 +302,6 @@ void CreateMove()
DoAutoshoot(); DoAutoshoot();
Aim(target_entity); Aim(target_entity);
} }
return;
} }
// The first check to see if the player should aim in the first place // The first check to see if the player should aim in the first place
@ -312,7 +310,7 @@ bool ShouldAim()
// Checks should be in order: cheap -> expensive // Checks should be in order: cheap -> expensive
// Check for +use // Check for +use
if (g_pUserCmd->buttons & IN_USE) if (current_user_cmd->buttons & IN_USE)
return false; return false;
// Check if using action slot item // Check if using action slot item
if (g_pLocalPlayer->using_action_slot_item) if (g_pLocalPlayer->using_action_slot_item)
@ -329,7 +327,7 @@ bool ShouldAim()
// If zoomed only is on, check if zoomed // If zoomed only is on, check if zoomed
if (zoomed_only && g_pLocalPlayer->holding_sniper_rifle) if (zoomed_only && g_pLocalPlayer->holding_sniper_rifle)
{ {
if (!g_pLocalPlayer->bZoomed && !(g_pUserCmd->buttons & IN_ATTACK)) if (!g_pLocalPlayer->bZoomed && !(current_user_cmd->buttons & IN_ATTACK))
return false; return false;
} }
// Is taunting? // Is taunting?
@ -364,7 +362,7 @@ bool ShouldAim()
// Check if player is zooming // Check if player is zooming
if (g_pLocalPlayer->bZoomed) if (g_pLocalPlayer->bZoomed)
{ {
if (!(g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2))) if (!(current_user_cmd->buttons & (IN_ATTACK | IN_ATTACK2)))
{ {
if (!CanHeadshot()) if (!CanHeadshot())
return false; return false;
@ -386,9 +384,9 @@ bool ShouldAim()
} }
if (auto_spin_up) if (auto_spin_up)
{ {
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
if (!(g_pUserCmd->buttons & (IN_ATTACK2 | IN_ATTACK))) if (!(current_user_cmd->buttons & (IN_ATTACK2 | IN_ATTACK)))
{ {
return false; return false;
} }
@ -779,7 +777,7 @@ void Aim(CachedEntity *entity)
DoSlowAim(angles); DoSlowAim(angles);
// Set angles // Set angles
g_pUserCmd->viewangles = angles; current_user_cmd->viewangles = angles;
if (silent && !slow_aim) if (silent && !slow_aim)
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
@ -811,14 +809,14 @@ void DoAutoshoot()
(float) huntsman_autoshoot) && (float) huntsman_autoshoot) &&
begancharge) begancharge)
{ {
g_pUserCmd->buttons &= ~IN_ATTACK; current_user_cmd->buttons &= ~IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(3); hacks::shared::antiaim::SetSafeSpace(3);
begancharge = false; begancharge = false;
// Pull string if charge isnt enough // Pull string if charge isnt enough
} }
else else
{ {
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
begancharge = true; begancharge = true;
} }
return; return;
@ -833,14 +831,14 @@ void DoAutoshoot()
// Release Sticky if > chargetime // Release Sticky if > chargetime
if ((chargetime >= (float) sticky_autoshoot) && begansticky > 3) if ((chargetime >= (float) sticky_autoshoot) && begansticky > 3)
{ {
g_pUserCmd->buttons &= ~IN_ATTACK; current_user_cmd->buttons &= ~IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(3); hacks::shared::antiaim::SetSafeSpace(3);
begansticky = 0; begansticky = 0;
} }
// Else just keep charging // Else just keep charging
else else
{ {
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
begansticky++; begansticky++;
} }
return; return;
@ -887,10 +885,8 @@ void DoAutoshoot()
attack = false; attack = false;
if (attack) if (attack)
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
hacks::shared::antiaim::SetSafeSpace(1); hacks::shared::antiaim::SetSafeSpace(1);
return;
} }
// Grab a vector for a specific ent // Grab a vector for a specific ent
@ -1132,32 +1128,35 @@ bool VischeckPredictedEntity(CachedEntity *entity)
return cd.visible; return cd.visible;
} }
static float slow_change_dist_p = 0;
static float slow_change_dist_y = 0;
// A helper function to find a user angle that isnt directly on the target // A helper function to find a user angle that isnt directly on the target
// angle, effectively slowing the aiming process // angle, effectively slowing the aiming process
void DoSlowAim(Vector &input_angle) void DoSlowAim(Vector &input_angle)
{ {
static float slow_change_dist_p = 0;
static float slow_change_dist_y = 0; auto viewangles = current_user_cmd->viewangles;
// Yaw // Yaw
if (g_pUserCmd->viewangles.y != input_angle.y) if (viewangles.y != input_angle.y)
{ {
// Check if input angle and user angle are on opposing sides of yaw so // Check if input angle and user angle are on opposing sides of yaw so
// we can correct for that // we can correct for that
bool slow_opposing = false; bool slow_opposing = false;
if (input_angle.y < -90 && g_pUserCmd->viewangles.y > 90 || if (input_angle.y < -90 && viewangles.y > 90 ||
input_angle.y > 90 && g_pUserCmd->viewangles.y < -90) input_angle.y > 90 && viewangles.y < -90)
slow_opposing = true; slow_opposing = true;
// Direction // Direction
bool slow_dir = false; bool slow_dir = false;
if (slow_opposing) if (slow_opposing)
{ {
if (input_angle.y > 90 && g_pUserCmd->viewangles.y < -90) if (input_angle.y > 90 && viewangles.y < -90)
slow_dir = true; slow_dir = true;
} }
else if (g_pUserCmd->viewangles.y > input_angle.y) else if (viewangles.y > input_angle.y)
slow_dir = true; slow_dir = true;
// Speed, check if opposing. We dont get a new distance due to the // Speed, check if opposing. We dont get a new distance due to the
@ -1165,28 +1164,28 @@ void DoSlowAim(Vector &input_angle)
// our last one. // our last one.
if (!slow_opposing) if (!slow_opposing)
slow_change_dist_y = slow_change_dist_y =
std::abs(g_pUserCmd->viewangles.y - input_angle.y) / std::abs(viewangles.y - input_angle.y) /
(int) slow_aim; (int) slow_aim;
// Move in the direction of the input angle // Move in the direction of the input angle
if (slow_dir) if (slow_dir)
input_angle.y = g_pUserCmd->viewangles.y - slow_change_dist_y; input_angle.y = viewangles.y - slow_change_dist_y;
else else
input_angle.y = g_pUserCmd->viewangles.y + slow_change_dist_y; input_angle.y = viewangles.y + slow_change_dist_y;
} }
// Pitch // Pitch
if (g_pUserCmd->viewangles.x != input_angle.x) if (viewangles.x != input_angle.x)
{ {
// Get speed // Get speed
slow_change_dist_p = slow_change_dist_p =
std::abs(g_pUserCmd->viewangles.x - input_angle.x) / (int) slow_aim; std::abs(viewangles.x - input_angle.x) / (int) slow_aim;
// Move in the direction of the input angle // Move in the direction of the input angle
if (g_pUserCmd->viewangles.x > input_angle.x) if (viewangles.x > input_angle.x)
input_angle.x = g_pUserCmd->viewangles.x - slow_change_dist_p; input_angle.x = viewangles.x - slow_change_dist_p;
else else
input_angle.x = g_pUserCmd->viewangles.x + slow_change_dist_p; input_angle.x = viewangles.x + slow_change_dist_p;
} }
// 0.17 is a good amount in general // 0.17 is a good amount in general

View File

@ -6,6 +6,8 @@
*/ */
#include <settings/Int.hpp> #include <settings/Int.hpp>
#include <hacks/AutoJoin.hpp>
#include "common.hpp" #include "common.hpp"
#include "hack.hpp" #include "hack.hpp"
@ -32,13 +34,13 @@ bool UnassignedTeam()
bool UnassignedClass() bool UnassignedClass()
{ {
return g_pLocalPlayer->clazz != int(preferred_class); return g_pLocalPlayer->clazz != *autojoin_class;
} }
Timer autoqueue_timer{}; static Timer autoqueue_timer{};
Timer queuetime{}; static Timer queuetime{};
Timer req_timer{}; static Timer req_timer{};
void UpdateSearch() void updateSearch()
{ {
// segfaults for no reason // segfaults for no reason
/*static bool calld = false; /*static bool calld = false;
@ -84,7 +86,7 @@ void UpdateSearch()
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem(); re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient();
if (g_pUserCmd && gc && gc->BConnectedToMatchServer(false) && if (current_user_cmd && gc && gc->BConnectedToMatchServer(false) &&
gc->BHaveLiveMatch()) gc->BHaveLiveMatch())
tfmm::queue_leave(); tfmm::queue_leave();
if (gc && !gc->BConnectedToMatchServer(false) && if (gc && !gc->BConnectedToMatchServer(false) &&
@ -106,11 +108,10 @@ void UpdateSearch()
#endif #endif
} }
Timer timer{}; void update()
void Update()
{ {
#if !LAGBOT_MODE #if !LAGBOT_MODE
if (timer.test_and_set(500)) if (autoqueue_timer.test_and_set(500))
{ {
if (autojoin_team and UnassignedTeam()) if (autojoin_team and UnassignedTeam())
{ {
@ -126,4 +127,10 @@ void Update()
} }
#endif #endif
} }
void autojoin::resetQueueTimer()
{
queuetime.update();
}
} }

View File

@ -10,6 +10,8 @@
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#include <glez/draw.hpp> #include <glez/draw.hpp>
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
#include <hacks/Backtrack.hpp>
static settings::Bool enable{ "backtrack.enable", "false" }; static settings::Bool enable{ "backtrack.enable", "false" };
static settings::Bool draw_bt{ "backtrack.draw", "false" }; static settings::Bool draw_bt{ "backtrack.draw", "false" };
@ -297,4 +299,14 @@ bool shouldBacktrack()
} }
return false; return false;
} }
bool isBacktrackEnabled()
{
return *enable;
}
float getLatency()
{
return *latency;
}
} }

View File

@ -22,6 +22,7 @@ static settings::Int micspam_on{ "cat-bot.micspam.interval-on", "3" };
static settings::Int micspam_off{ "cat-bot.micspam.interval-off", "60" }; static settings::Int micspam_off{ "cat-bot.micspam.interval-off", "60" };
static settings::Bool auto_crouch{ "cat-bot.auto-crouch", "true" }; static settings::Bool auto_crouch{ "cat-bot.auto-crouch", "true" };
static settings::Bool random_votekicks{ "cat-bot.votekicks", "false" };
namespace hacks::shared::catbot namespace hacks::shared::catbot
{ {
@ -129,9 +130,9 @@ void update_catbot_list()
class CatBotEventListener : public IGameEventListener2 class CatBotEventListener : public IGameEventListener2
{ {
virtual void FireGameEvent(IGameEvent *event) void FireGameEvent(IGameEvent *event) override
{ {
if (!enabled) if (!enable)
return; return;
int killer_id = int killer_id =
@ -152,9 +153,9 @@ CatBotEventListener &listener()
return object; return object;
} }
Timer timer_votekicks{}; static Timer timer_votekicks{};
Timer timer_catbot_list{}; static Timer timer_catbot_list{};
Timer timer_abandon{}; static Timer timer_abandon{};
int count_bots{ 0 }; int count_bots{ 0 };
@ -254,11 +255,11 @@ void smart_crouch()
crouch = false; crouch = false;
} }
if (crouch) if (crouch)
g_pUserCmd->buttons |= IN_DUCK; current_user_cmd->buttons |= IN_DUCK;
} }
void update() void update()
{ {
if (!enabled) if (!enable)
return; return;
if (g_Settings.bInvalid) if (g_Settings.bInvalid)
@ -269,10 +270,10 @@ void update()
if (micspam) if (micspam)
{ {
if (micspam_on && micspam_on_timer.test_and_set(int(micspam_on) * 1000)) if (micspam_on && micspam_on_timer.test_and_set(*micspam_on * 1000))
g_IEngine->ExecuteClientCmd("+voicerecord"); g_IEngine->ExecuteClientCmd("+voicerecord");
if (micspam_off && if (micspam_off &&
micspam_off_timer.test_and_set(int(micspam_off) * 1000)) micspam_off_timer.test_and_set(*micspam_off * 1000))
g_IEngine->ExecuteClientCmd("-voicerecord"); g_IEngine->ExecuteClientCmd("-voicerecord");
} }
@ -295,7 +296,7 @@ void update()
else else
continue; continue;
player_info_s info; player_info_s info{};
if (!g_IEngine->GetPlayerInfo(i, &info)) if (!g_IEngine->GetPlayerInfo(i, &info))
continue; continue;

View File

@ -20,7 +20,6 @@ static settings::Bool teamname_spam{ "spam.teamname","0" };
namespace hacks::shared::spam namespace hacks::shared::spam
{ {
static CatCommand reload("spam_reload", "Reload spam file", Reload);
static int last_index; static int last_index;
@ -380,9 +379,9 @@ void createMove()
} }
} }
void reload() void reloadSpamFile()
{ {
file.Load(std::string(filename.GetString())); file.Load(*filename);
} }
bool isActive() bool isActive()
@ -429,3 +428,5 @@ const std::vector<std::string> builtin_lithium = {
"GOT ROLLED BY LITHIUM? HEY, THAT MEANS IT'S TIME TO GET LITHIUMCHEAT!!" "GOT ROLLED BY LITHIUM? HEY, THAT MEANS IT'S TIME TO GET LITHIUMCHEAT!!"
}; };
} }
static CatCommand reload("spam_reload", "Reload spam file", hacks::shared::spam::reloadSpamFile);

View File

@ -104,8 +104,8 @@ void WalkTo(const Vector &vector)
// Calculate how to get to a vector // Calculate how to get to a vector
auto result = ComputeMove(LOCAL_E->m_vecOrigin(), vector); auto result = ComputeMove(LOCAL_E->m_vecOrigin(), vector);
// Push our move to usercmd // Push our move to usercmd
g_pUserCmd->forwardmove = result.first; current_user_cmd->forwardmove = result.first;
g_pUserCmd->sidemove = result.second; current_user_cmd->sidemove = result.second;
} }
// Function to get the corner location that a vischeck to an entity is possible // Function to get the corner location that a vischeck to an entity is possible

View File

@ -56,7 +56,7 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
} }
} }
#endif #endif
hacks::shared::autojoin::UpdateSearch(); hacks::shared::autojoin::updateSearch();
if (!hack::command_stack().empty()) if (!hack::command_stack().empty())
{ {
PROF_SECTION(PT_command_stack); PROF_SECTION(PT_command_stack);

View File

@ -35,7 +35,7 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
logging::Info("Already connected!"); logging::Info("Already connected!");
return; return;
} }
peer = new peer_t(std::string(server_name.GetString()), false, false); peer = new peer_t(*server_name, false, false);
try try
{ {
peer->Connect(); peer->Connect();

View File

@ -35,10 +35,10 @@ void queue_start()
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
if (client) if (client)
{ {
if (queue == 7) if (*queue == 7)
client->LoadSavedCasualCriteria(); client->LoadSavedCasualCriteria();
client->RequestQueueForMatch((int) queue); client->RequestQueueForMatch((int) queue);
hacks::shared::autojoin::queuetime.update(); hacks::shared::autojoin::resetQueueTimer();
} }
else else
logging::Info("queue_start: CTFPartyClient == null!"); logging::Info("queue_start: CTFPartyClient == null!");