Autostuff

This commit is contained in:
nullifiedcat 2018-07-29 13:39:30 +03:00
parent 56ce98a821
commit f8ec03e1ec
20 changed files with 162 additions and 178 deletions

View File

@ -54,10 +54,10 @@ struct CIncomingSequence
}; };
typedef boost::circular_buffer_space_optimized<CIncomingSequence> circular_buf; typedef boost::circular_buffer_space_optimized<CIncomingSequence> circular_buf;
extern circular_buf sequences; extern circular_buf sequences;
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(); bool isBacktrackEnabled();
float getLatency(); float getLatency();
int getTicks();
} }

View File

@ -10,12 +10,11 @@
namespace hacks::shared::followbot namespace hacks::shared::followbot
{ {
// Followed entity, externed for highlight color
extern int follow_target;
extern bool followcart;
extern CatCommand follow_steam;
extern unsigned steamid;
void DrawTick(); void DrawTick();
void WorldTick(); void WorldTick();
int ClassPriority(CachedEntity *ent); int ClassPriority(CachedEntity *ent);
bool isEnabled();
int getTarget();
} }

View File

@ -9,20 +9,12 @@
#include "common.hpp" #include "common.hpp"
class CatCommand;
class KillSayEventListener : public IGameEventListener2
{
virtual void FireGameEvent(IGameEvent *event);
};
namespace hacks::shared::killsay namespace hacks::shared::killsay
{ {
void Init(); void init();
void Shutdown(); void shutdown();
void Reload(); void reload();
std::string ComposeKillSay(IGameEvent *event);
extern const std::vector<std::string> builtin_default; extern const std::vector<std::string> builtin_default;
extern const std::vector<std::string> builtin_nonecore_offensive; extern const std::vector<std::string> builtin_nonecore_offensive;

View File

@ -10,8 +10,10 @@
namespace tfmm namespace tfmm
{ {
void queue_start(); void startQueue();
void queue_leave(); void leaveQueue();
void dcandabandon(); void disconnectAndAbandon();
void abandon(); void abandon();
int getQueue();
} }

View File

@ -12,7 +12,6 @@ class bf_read;
namespace votelogger namespace votelogger
{ {
void user_message(bf_read &buffer, int type); void dispatchUserMessage(bf_read &buffer, int type);
extern Timer antikick;
extern bool active;
} }

View File

@ -101,7 +101,7 @@ void CreateMove()
{ {
noaa = true; noaa = true;
pitchdown->SetValue(180); pitchdown->SetValue(180);
g_pUserCmd->viewangles.x = 140.0f; current_user_cmd->viewangles.x = 140.0f;
if (silent) if (silent)
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
if (sayno) if (sayno)

View File

@ -64,7 +64,7 @@ bool CanBackstab(CachedEntity *tar, Vector Local_ang)
} }
void CreateMove() void CreateMove()
{ {
if (!enabled) if (!enable)
return; return;
if (!CE_GOOD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || !CE_GOOD(LOCAL_W)) if (!CE_GOOD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || !CE_GOOD(LOCAL_W))
return; return;
@ -85,7 +85,7 @@ void CreateMove()
if (CE_GOOD(target) && target != LOCAL_E && if (CE_GOOD(target) && target != LOCAL_E &&
target->m_iTeam() != LOCAL_E->m_iTeam() && target->m_bAlivePlayer() && target->m_iTeam() != LOCAL_E->m_iTeam() && target->m_bAlivePlayer() &&
target->m_Type() == ENTITY_PLAYER && target->m_Type() == ENTITY_PLAYER &&
!hacks::shared::backtrack::enable && !hacks::shared::backtrack::isBacktrackEnabled() &&
CanBackstab(target, g_pLocalPlayer->v_OrigViewangles)) CanBackstab(target, g_pLocalPlayer->v_OrigViewangles))
{ {
float swingrange = float swingrange =
@ -97,9 +97,9 @@ void CreateMove()
if ((min1.x <= max2.x && max1.x >= min2.x) && if ((min1.x <= max2.x && max1.x >= min2.x) &&
(min1.y <= max2.y && max1.y >= min2.y) && (min1.y <= max2.y && max1.y >= min2.y) &&
(min1.z <= max2.z && max1.z >= min2.z)) (min1.z <= max2.z && max1.z >= min2.z))
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
} }
else if (!hacks::shared::backtrack::enable) else if (!hacks::shared::backtrack::isBacktrackEnabled())
{ {
CachedEntity *tar = nullptr; CachedEntity *tar = nullptr;
float bestscr = 9999.9f; float bestscr = 9999.9f;
@ -143,8 +143,8 @@ void CreateMove()
eyeang.y = i; eyeang.y = i;
if (CanBackstab(tar, eyeang)) if (CanBackstab(tar, eyeang))
{ {
g_pUserCmd->viewangles.y = eyeang.y; current_user_cmd->viewangles.y = eyeang.y;
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
if (silent) if (silent)
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
} }
@ -153,13 +153,13 @@ void CreateMove()
} }
else else
{ {
if (!hacks::shared::backtrack::enable) if (!hacks::shared::backtrack::isBacktrackEnabled())
return; return;
if (hacks::shared::backtrack::iBestTarget == -1) if (hacks::shared::backtrack::iBestTarget == -1)
return; return;
int iBestTarget = hacks::shared::backtrack::iBestTarget; int iBestTarget = hacks::shared::backtrack::iBestTarget;
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;
@ -188,8 +188,8 @@ void CreateMove()
NET_FLOAT(RAW_ENT(tar), netvar.m_flSimulationTime); NET_FLOAT(RAW_ENT(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;
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
break; break;
} }
} }

View File

@ -4,6 +4,7 @@
* Created on: Apr 12, 2018 * Created on: Apr 12, 2018
* Author: bencat07 * Author: bencat07
*/ */
#include <settings/Bool.hpp>
#include "common.hpp" #include "common.hpp"
static settings::Bool enable{ "auto-deadringer.enable", "0" }; static settings::Bool enable{ "auto-deadringer.enable", "0" };
@ -58,7 +59,7 @@ void CreateMove()
return; return;
if (CE_INT(LOCAL_E, netvar.iHealth) < (int) trigger_health && if (CE_INT(LOCAL_E, netvar.iHealth) < (int) trigger_health &&
NearbyEntities() > 1) NearbyEntities() > 1)
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
for (int i = 0; i < HIGHEST_ENTITY; i++) for (int i = 0; i < HIGHEST_ENTITY; i++)
{ {
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
@ -71,9 +72,9 @@ void CreateMove()
if (ent->m_Type() != ENTITY_PROJECTILE) if (ent->m_Type() != ENTITY_PROJECTILE)
continue; continue;
if (ent->m_bCritProjectile() && ent->m_flDistance() <= 1000.0f) if (ent->m_bCritProjectile() && ent->m_flDistance() <= 1000.0f)
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
if (ent->m_flDistance() < 300.0f) if (ent->m_flDistance() < 300.0f)
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
} }
} }

View File

@ -120,7 +120,7 @@ void CreateMove()
if (VisCheckEntFromEnt(flare, target)) if (VisCheckEntFromEnt(flare, target))
{ {
// Detonate // Detonate
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
return; return;
} }

View File

@ -285,7 +285,7 @@ void DoResistSwitching()
vaccinator_change_stage = 0; vaccinator_change_stage = 0;
return; return;
} }
if (g_pUserCmd->buttons & IN_RELOAD) if (current_user_cmd->buttons & IN_RELOAD)
{ {
vaccinator_change_ticks = 8; vaccinator_change_ticks = 8;
return; return;
@ -294,7 +294,7 @@ void DoResistSwitching()
{ {
if (vaccinator_change_ticks <= 0) if (vaccinator_change_ticks <= 0)
{ {
g_pUserCmd->buttons |= IN_RELOAD; current_user_cmd->buttons |= IN_RELOAD;
vaccinator_change_stage--; vaccinator_change_stage--;
vaccinator_change_ticks = 8; vaccinator_change_ticks = 8;
} }
@ -406,10 +406,10 @@ void CreateMove()
} }
if (pop && CurrentResistance() == my_opt) if (pop && CurrentResistance() == my_opt)
{ {
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
} }
if (!force_healing_target && !enabled) if (!force_healing_target && !enable)
return; return;
if (GetWeaponMode() != weapon_medigun) if (GetWeaponMode() != weapon_medigun)
return; return;
@ -420,11 +420,11 @@ void CreateMove()
{ {
Vector out; Vector out;
GetHitbox(target, 7, out); GetHitbox(target, 7, out);
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); AimAt(g_pLocalPlayer->v_Eye, out, current_user_cmd);
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
} }
} }
if (!enabled) if (!enable)
return; return;
UpdateData(); UpdateData();
int old_target = m_iCurrentHealingTarget; int old_target = m_iCurrentHealingTarget;
@ -444,11 +444,11 @@ void CreateMove()
Vector out; Vector out;
GetHitbox(target, 7, out); GetHitbox(target, 7, out);
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); AimAt(g_pLocalPlayer->v_Eye, out, current_user_cmd);
if (silent) if (silent)
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
if (!m_iNewTarget && (g_GlobalVars->tickcount % 300)) if (!m_iNewTarget && (g_GlobalVars->tickcount % 300))
g_pUserCmd->buttons |= IN_ATTACK; current_user_cmd->buttons |= IN_ATTACK;
/*if (m_iNewTarget || !(g_GlobalVars->tickcount % 300)) { /*if (m_iNewTarget || !(g_GlobalVars->tickcount % 300)) {
if (silent) g_pLocalPlayer->bUseSilentAngles = true; if (silent) g_pLocalPlayer->bUseSilentAngles = true;
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd);
@ -461,15 +461,14 @@ void CreateMove()
SetResistance(opt); SetResistance(opt);
if (pop && CurrentResistance() == opt) if (pop && CurrentResistance() == opt)
{ {
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
} }
else else
{ {
if (pop_uber_auto && ShouldPop()) if (pop_uber_auto && ShouldPop())
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
} }
return;
} }
std::vector<patient_data_s> data(32); std::vector<patient_data_s> data(32);
@ -558,18 +557,18 @@ int HealingPriority(int idx)
#if ENABLE_IPC #if ENABLE_IPC
if (ipc::peer) if (ipc::peer)
{ {
if (hacks::shared::followbot::followbot && if (hacks::shared::followbot::isEnabled() &&
hacks::shared::followbot::follow_target == idx) hacks::shared::followbot::getTarget() == idx)
{ {
priority *= 6.0f; priority *= 6.0f;
} }
} }
#endif #endif
player_info_s info; /* player_info_s info;
g_IEngine->GetPlayerInfo(idx, &info); g_IEngine->GetPlayerInfo(idx, &info);
info.name[31] = 0; info.name[31] = 0;
if (strcasestr(info.name, ignore.GetString())) if (strcasestr(info.name, ignore.GetString()))
priority = 0.0f; priority = 0.0f;*/
return priority; return priority;
} }

View File

@ -88,15 +88,15 @@ void updateSearch()
re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *pc = re::CTFPartyClient::GTFPartyClient();
if (current_user_cmd && gc && gc->BConnectedToMatchServer(false) && if (current_user_cmd && gc && gc->BConnectedToMatchServer(false) &&
gc->BHaveLiveMatch()) gc->BHaveLiveMatch())
tfmm::queue_leave(); tfmm::leaveQueue();
if (gc && !gc->BConnectedToMatchServer(false) && if (gc && !gc->BConnectedToMatchServer(false) &&
queuetime.test_and_set(10 * 1000 * 60) && !gc->BHaveLiveMatch()) queuetime.test_and_set(10 * 1000 * 60) && !gc->BHaveLiveMatch())
tfmm::queue_leave(); tfmm::leaveQueue();
if (gc && !gc->BConnectedToMatchServer(false) && !gc->BHaveLiveMatch()) if (gc && !gc->BConnectedToMatchServer(false) && !gc->BHaveLiveMatch())
if (!(pc && pc->BInQueueForMatchGroup(int(tfmm::queue)))) if (!(pc && pc->BInQueueForMatchGroup(tfmm::getQueue())))
{ {
logging::Info("Starting queue"); logging::Info("Starting queue");
tfmm::queue_start(); tfmm::startQueue();
} }
#if LAGBOT_MODE #if LAGBOT_MODE
if (req_timer.test_and_set(1800000)) if (req_timer.test_and_set(1800000))
@ -128,7 +128,7 @@ void update()
#endif #endif
} }
void autojoin::resetQueueTimer() void resetQueueTimer()
{ {
queuetime.update(); queuetime.update();
} }

View File

@ -45,7 +45,7 @@ void CreateMove()
return; return;
// If user settings allow, return if local player is in attack // If user settings allow, return if local player is in attack
if (idle_only && (g_pUserCmd->buttons & IN_ATTACK)) if (idle_only && (current_user_cmd->buttons & IN_ATTACK))
return; return;
// Create some book-keeping vars // Create some book-keeping vars
@ -121,16 +121,13 @@ void CreateMove()
if (!legit) if (!legit)
{ {
// Aim at predicted projectile // Aim at predicted projectile
AimAt(g_pLocalPlayer->v_Eye, closest_vec, g_pUserCmd); AimAt(g_pLocalPlayer->v_Eye, closest_vec, current_user_cmd);
// Use silent angles // Use silent angles
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
} }
// Airblast // Airblast
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
// Function is finished, return
return;
} }
// Function to determine whether an ent is good to reflect // Function to determine whether an ent is good to reflect
@ -196,7 +193,7 @@ void Draw()
if (fov_draw) if (fov_draw)
{ {
// It cant use fovs greater than 180, so we check for that // It cant use fovs greater than 180, so we check for that
if (float(fov) > 0.0f && float(fov) < 180) if (*fov > 0.0f && *fov < 180)
{ {
// Dont show ring while player is dead // Dont show ring while player is dead
if (LOCAL_E->m_bAlivePlayer()) if (LOCAL_E->m_bAlivePlayer())

View File

@ -83,7 +83,7 @@ bool IsTarget(CachedEntity *ent)
} }
else if (ent->m_Type() == ENTITY_BUILDING) else if (ent->m_Type() == ENTITY_BUILDING)
{ {
return buildings; return *buildings;
} }
// Target isnt a good type // Target isnt a good type
@ -148,12 +148,12 @@ void CreateMove()
{ {
// Aim at bomb // Aim at bomb
AimAt(g_pLocalPlayer->v_Eye, bomb->m_vecOrigin(), AimAt(g_pLocalPlayer->v_Eye, bomb->m_vecOrigin(),
g_pUserCmd); current_user_cmd);
// Use silent // Use silent
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
// Detonate // Detonate
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
// Return as its a waste to check anymore, we detonated // Return as its a waste to check anymore, we detonated
// and all the rest of the stickys are gone // and all the rest of the stickys are gone
@ -166,12 +166,12 @@ void CreateMove()
{ {
// Aim at bomb // Aim at bomb
AimAt(g_pLocalPlayer->v_Eye, bomb->m_vecOrigin(), AimAt(g_pLocalPlayer->v_Eye, bomb->m_vecOrigin(),
g_pUserCmd); current_user_cmd);
// Use silent // Use silent
g_pLocalPlayer->bUseSilentAngles = true; g_pLocalPlayer->bUseSilentAngles = true;
// Detonate // Detonate
g_pUserCmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
// Return as its a waste to check anymore, we detonated // Return as its a waste to check anymore, we detonated
// and all the rest of the stickys are gone // and all the rest of the stickys are gone
@ -181,7 +181,5 @@ void CreateMove()
} }
} }
} }
// End of function, just return
return;
} }
} }

View File

@ -15,9 +15,9 @@
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" };
static settings::Float latency{ "backtrack.latency", "false" }; static settings::Int latency{ "backtrack.latency", "0" };
static settings::Float mindistance{ "backtrack.min-distance", "false" }; static settings::Float mindistance{ "backtrack.min-distance", "60" };
static settings::Int slots{ "backtrack.slots", "false" }; static settings::Int slots{ "backtrack.slots", "0" };
namespace hacks::shared::backtrack namespace hacks::shared::backtrack
{ {
@ -61,8 +61,6 @@ void AddLatencyToNetchan(INetChannel *ch, float Latency)
} }
} }
} }
bool installed = false;
int ticks = 12;
void Init() void Init()
{ {
for (int i = 0; i < 32; i++) for (int i = 0; i < 32; i++)
@ -71,14 +69,6 @@ void Init()
BacktrackData{ 0, { 0, 0, 0 }, { 0, 0, 0 }, BacktrackData{ 0, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, 0, { 0, 0, 0 }, { 0, 0, 0 }, 0,
0, { 0, 0, 0 } }; 0, { 0, 0, 0 } };
if (!installed)
{
latency.InstallChangeCallback(
[](IConVar *var, const char *pszOldValue, float flOldValue) {
ticks = max(min(int((float) latency) / 15, 65), 12);
});
installed = true;
}
} }
int BestTick = 0; int BestTick = 0;
@ -98,7 +88,7 @@ void Run()
} }
shouldDrawBt = true; shouldDrawBt = true;
CUserCmd *cmd = g_pUserCmd; CUserCmd *cmd = current_user_cmd;
float bestFov = 99999; float bestFov = 99999;
BestTick = 0; BestTick = 0;
iBestTarget = -1; iBestTarget = -1;
@ -135,7 +125,7 @@ void Run()
Vector hitbox_spine = pEntity->hitboxes.GetHitbox(3)->center; Vector hitbox_spine = pEntity->hitboxes.GetHitbox(3)->center;
Vector ent_orig = pEntity->InternalEntity()->GetAbsOrigin(); Vector ent_orig = pEntity->InternalEntity()->GetAbsOrigin();
auto hdr = g_IModelInfo->GetStudiomodel(RAW_ENT(pEntity)->GetModel()); auto hdr = g_IModelInfo->GetStudiomodel(RAW_ENT(pEntity)->GetModel());
headPositions[i][cmd->command_number % ticks] = headPositions[i][cmd->command_number % getTicks()] =
BacktrackData{ cmd->tick_count, hitboxpos, min, max, BacktrackData{ cmd->tick_count, hitboxpos, min, max,
hitbox_spine, viewangles, simtime, ent_orig }; hitbox_spine, viewangles, simtime, ent_orig };
float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles, float FOVDistance = GetFov(g_pLocalPlayer->v_OrigViewangles,
@ -159,17 +149,17 @@ void Run()
float bestFOV = 180.0f; float bestFOV = 180.0f;
float distance, prev_distance_ticks = 9999; float distance, prev_distance_ticks = 9999;
for (int i = 0; i < ticks; ++i) for (int i = 0; i < getTicks(); ++i)
sorted_ticks[i] = BestTickData{ INT_MAX, i }; sorted_ticks[i] = BestTickData{ INT_MAX, i };
for (int t = 0; t < ticks; ++t) for (int t = 0; t < getTicks(); ++t)
{ {
if (headPositions[iBestTarget][t].tickcount) if (headPositions[iBestTarget][t].tickcount)
sorted_ticks[t] = sorted_ticks[t] =
BestTickData{ headPositions[iBestTarget][t].tickcount, t }; BestTickData{ headPositions[iBestTarget][t].tickcount, t };
} }
std::sort(sorted_ticks, sorted_ticks + ticks); std::sort(sorted_ticks, sorted_ticks + getTicks());
int tickus = (float(latency) > 800.0f || float(latency) < 200.0f) ? 12 : 24; int tickus = (*latency > 800 || *latency < 200) ? 12 : 24;
for (int t = 0; t < ticks; ++t) for (int t = 0; t < getTicks(); ++t)
{ {
bool good_tick = false; bool good_tick = false;
@ -224,10 +214,10 @@ void Draw()
return; return;
if (!shouldDrawBt) if (!shouldDrawBt)
return; return;
int tickus = (float(latency) > 800.0f || float(latency) < 200.0f) ? 12 : 24; int tickus = (*latency > 800 || *latency < 200.0f) ? 12 : 24;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++) for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{ {
for (int j = 0; j < ticks; j++) for (int j = 0; j < getTicks(); j++)
{ {
bool good_tick = false; bool good_tick = false;
@ -309,4 +299,9 @@ float getLatency()
{ {
return *latency; return *latency;
} }
int getTicks()
{
return max(min(*latency / 15, 65), 12);
}
} }

View File

@ -24,17 +24,15 @@ void CreateMove()
// Check user settings if bhop is enabled // Check user settings if bhop is enabled
if (!enable) if (!enable)
return; return;
if (!g_pUserCmd)
return;
// Check if there is usercommands // Check if there is usercommands
if (!g_pUserCmd->command_number) if (!current_user_cmd->command_number)
return; return;
// var for "if on ground" from the flags netvar // var for "if on ground" from the flags netvar
bool ground = CE_INT(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0); bool ground = CE_INT(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0);
// Var for if the player is pressing jump // Var for if the player is pressing jump
bool jump = (g_pUserCmd->buttons & IN_JUMP); bool jump = (current_user_cmd->buttons & IN_JUMP);
// Check if player is not on the ground and player is holding their jump key // Check if player is not on the ground and player is holding their jump key
if (!ground && jump) if (!ground && jump)
@ -44,15 +42,12 @@ void CreateMove()
// the ground or lets go of jump // the ground or lets go of jump
if (ticks_last_jump++ >= 9) if (ticks_last_jump++ >= 9)
{ {
g_pUserCmd->buttons = g_pUserCmd->buttons & ~IN_JUMP; current_user_cmd->buttons = current_user_cmd->buttons & ~IN_JUMP;
} }
} }
// If the players jump cmd has been used, then we reset our var // If the players jump cmd has been used, then we reset our var
if (!jump) if (!jump)
ticks_last_jump = 0; ticks_last_jump = 0;
// Finish the function with return
return;
} }
} }

View File

@ -11,18 +11,18 @@
#include <glez/draw.hpp> #include <glez/draw.hpp>
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
static settings::Bool followbot{ "follow-bot.enable", "false" }; static settings::Bool enable{ "follow-bot.enable", "false" };
static settings::Bool roambot{ "follow-bot.roaming", "false" }; static settings::Bool roambot{ "follow-bot.roaming", "false" };
static settings::Bool draw_crumb{ "follow-bot.draw-crumbs", "false" }; static settings::Bool draw_crumb{ "follow-bot.draw-crumbs", "false" };
static settings::Bool follow_distance{ "follow-bot.distance", "175" }; static settings::Float follow_distance{ "follow-bot.distance", "175" };
static settings::Bool follow_activation{ "follow-bot.max-range", "1000" }; static settings::Float follow_activation{ "follow-bot.max-range", "1000" };
static settings::Bool mimic_slot{ "follow-bot.mimic-slot", "false" }; static settings::Bool mimic_slot{ "follow-bot.mimic-slot", "false" };
static settings::Bool always_medigun{ "follow-bot.always-medigun", "false" }; static settings::Bool always_medigun{ "follow-bot.always-medigun", "false" };
static settings::Bool sync_taunt{ "follow-bot.taunt-sync", "false" }; static settings::Bool sync_taunt{ "follow-bot.taunt-sync", "false" };
static settings::Bool change{ "follow-bot.change-roaming-target", "false" }; static settings::Bool change{ "follow-bot.change-roaming-target", "false" };
static settings::Bool autojump{ "follow-bot.jump-if-stuck", "true" }; static settings::Bool autojump{ "follow-bot.jump-if-stuck", "true" };
static settings::Bool afk{ "follow-bot.switch-afk", "true" }; static settings::Bool afk{ "follow-bot.switch-afk", "true" };
static settings::Bool afktime{ "follow-bot.afk-time", "15000" }; static settings::Int afktime{ "follow-bot.afk-time", "15000" };
static settings::Bool corneractivate{ "follow-bot.corners", "true" }; static settings::Bool corneractivate{ "follow-bot.corners", "true" };
namespace hacks::shared::followbot namespace hacks::shared::followbot
@ -44,6 +44,8 @@ CatCommand follow_steam("fb_steam", "Follow Steam Id",
static std::vector<Vector> breadcrumbs; static std::vector<Vector> breadcrumbs;
static const int crumb_limit = 64; // limit static const int crumb_limit = 64; // limit
static bool followcart{ false };
// Followed entity, externed for highlight color // Followed entity, externed for highlight color
int follow_target = 0; int follow_target = 0;
static bool inited; static bool inited;
@ -167,7 +169,7 @@ Timer waittime{};
int lastent = 0; int lastent = 0;
void WorldTick() void WorldTick()
{ {
if (!followbot) if (!enable)
{ {
follow_target = 0; follow_target = 0;
return; return;
@ -220,7 +222,7 @@ void WorldTick()
if (corneractivate) if (corneractivate)
{ {
Vector indirectOrigin = VischeckCorner( Vector indirectOrigin = VischeckCorner(
LOCAL_E, entity, float(follow_activation) / 2, LOCAL_E, entity, *follow_activation / 2,
true); // get the corner location that the true); // get the corner location that the
// future target is visible from // future target is visible from
std::pair<Vector, Vector> corners; std::pair<Vector, Vector> corners;
@ -285,7 +287,8 @@ void WorldTick()
continue; continue;
const model_t *model = const model_t *model =
ENTITY(follow_target)->InternalEntity()->GetModel(); ENTITY(follow_target)->InternalEntity()->GetModel();
if (followcart && model && // FIXME follow cart/point
/*if (followcart && model &&
(lagexploit::pointarr[0] || lagexploit::pointarr[1] || (lagexploit::pointarr[0] || lagexploit::pointarr[1] ||
lagexploit::pointarr[2] || lagexploit::pointarr[3] || lagexploit::pointarr[2] || lagexploit::pointarr[3] ||
lagexploit::pointarr[4]) && lagexploit::pointarr[4]) &&
@ -294,7 +297,7 @@ void WorldTick()
model == lagexploit::pointarr[2] || model == lagexploit::pointarr[2] ||
model == lagexploit::pointarr[3] || model == lagexploit::pointarr[3] ||
model == lagexploit::pointarr[4])) model == lagexploit::pointarr[4]))
follow_target = entity->m_IDX; follow_target = entity->m_IDX;*/
if (entity->m_Type() != ENTITY_PLAYER) if (entity->m_Type() != ENTITY_PLAYER)
continue; continue;
// favor closer entitys // favor closer entitys
@ -530,6 +533,16 @@ void DrawTick()
#endif #endif
} }
int getTarget()
{
return follow_target;
}
bool isEnabled()
{
return *enable;
}
#if ENABLE_IPC #if ENABLE_IPC
static CatCommand static CatCommand
follow_me("fb_follow_me", "IPC connected bots will follow you", []() { follow_me("fb_follow_me", "IPC connected bots will follow you", []() {

View File

@ -12,11 +12,14 @@
static settings::Int killsay_mode{ "killsay.mode", "0" }; static settings::Int killsay_mode{ "killsay.mode", "0" };
static settings::String filename{ "killsay.file", "killsays.txt" }; static settings::String filename{ "killsay.file", "killsays.txt" };
static CatCommand reload_command("killsay_reload", "Reload killsays", []() {
hacks::shared::killsay::reload();
});
namespace hacks::shared::killsay namespace hacks::shared::killsay
{ {
static CatCommand reload("killsay_reload", "Reload killsays", Reload);
const std::string tf_classes_killsay[] = { "class", "scout", "sniper", const std::string tf_classes_killsay[] = { "class", "scout", "sniper",
"soldier", "demoman", "medic", "soldier", "demoman", "medic",
"heavy", "pyro", "spy", "heavy", "pyro", "spy",
@ -79,30 +82,37 @@ std::string ComposeKillSay(IGameEvent *event)
return msg; return msg;
} }
KillSayEventListener &getListener()
class KillSayEventListener : public IGameEventListener2
{ {
static KillSayEventListener listener; void FireGameEvent(IGameEvent *event) override
return listener; {
if (!killsay_mode)
return;
std::string message = hacks::shared::killsay::ComposeKillSay(event);
if (message.size())
{
chat_stack::Say(message, false);
}
}
};
static KillSayEventListener listener{};
void reload()
{
file.Load(*filename);
} }
void Reload() void init()
{ {
file.Load(std::string(filename.GetString())); g_IEventManager2->AddListener(&listener, (const char *) "player_death",
}
void Init()
{
g_IEventManager2->AddListener(&getListener(), (const char *) "player_death",
false); false);
filename.InstallChangeCallback(
[](IConVar *var, const char *pszOV, float flOV) {
file.TryLoad(std::string(filename.GetString()));
});
} }
void Shutdown() void shutdown()
{ {
g_IEventManager2->RemoveListener(&getListener()); g_IEventManager2->RemoveListener(&listener);
} }
// Thanks HellJustFroze for linking me http://daviseford.com/shittalk/ // Thanks HellJustFroze for linking me http://daviseford.com/shittalk/
@ -153,13 +163,5 @@ const std::vector<std::string> builtin_nonecore_mlg = {
}; };
} }
void KillSayEventListener::FireGameEvent(IGameEvent *event)
{
if (!hacks::shared::killsay::killsay_mode)
return;
std::string message = hacks::shared::killsay::ComposeKillSay(event);
if (message.size())
{
chat_stack::Say(message, false);
}
}

View File

@ -79,7 +79,7 @@ CatCommand
void CreateMove() void CreateMove()
{ {
#if not LAGBOT_MODE #if !LAGBOT_MODE
// Crithack // Crithack
static IClientEntity *localplayer, *weapon, *last_weapon = nullptr; static IClientEntity *localplayer, *weapon, *last_weapon = nullptr;
static int tries, cmdn, md5seed, rseed, c, b; static int tries, cmdn, md5seed, rseed, c, b;

View File

@ -9,12 +9,18 @@
#include "common.hpp" #include "common.hpp"
#include "hacks/AutoJoin.hpp" #include "hacks/AutoJoin.hpp"
settings::Int queue{ "autoqueue.mode", "7" };
CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue", CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue",
[]() { tfmm::queue_start(); }); []() { tfmm::startQueue(); });
CatCommand cmd_abandon("mm_abandon", "Abandon match", CatCommand cmd_abandon("mm_abandon", "Abandon match",
[]() { tfmm::abandon(); }); []() { tfmm::abandon(); });
CatCommand abandoncmd("disconnect_and_abandon", "Disconnect and abandon",
[]() { tfmm::disconnectAndAbandon(); });
CatCommand get_state("mm_state", "Get party state", []() { CatCommand get_state("mm_state", "Get party state", []() {
re::CTFParty *party = re::CTFParty::GetParty(); re::CTFParty *party = re::CTFParty::GetParty();
if (!party) if (!party)
@ -25,12 +31,15 @@ CatCommand get_state("mm_state", "Get party state", []() {
logging::Info("State: %d", re::CTFParty::state_(party)); logging::Info("State: %d", re::CTFParty::state_(party));
}); });
settings::Int queue{ "autoqueue_mode", "7" };
namespace tfmm namespace tfmm
{ {
void queue_start() int getQueue()
{
return *queue;
}
void startQueue()
{ {
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
if (client) if (client)
@ -43,7 +52,7 @@ void queue_start()
else else
logging::Info("queue_start: CTFPartyClient == null!"); logging::Info("queue_start: CTFPartyClient == null!");
} }
void queue_leave() void leaveQueue()
{ {
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
if (client) if (client)
@ -51,9 +60,8 @@ void queue_leave()
else else
logging::Info("queue_start: CTFPartyClient == null!"); logging::Info("queue_start: CTFPartyClient == null!");
} }
Timer abandont{};
void dcandabandon() void disconnectAndAbandon()
{ {
re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient(); re::CTFPartyClient *client = re::CTFPartyClient::GTFPartyClient();
re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem(); re::CTFGCClientSystem *gc = re::CTFGCClientSystem::GTFGCClientSystem();
@ -63,20 +71,13 @@ void dcandabandon()
{ {
logging::Info("your party client is gay!"); logging::Info("your party client is gay!");
if (gc) if (gc)
queue_leave(); leaveQueue();
else else
logging::Info("your gc is gay!"); logging::Info("your gc is gay!");
} }
if (gc && client) if (gc && client)
while (1) leaveQueue();
if (abandont.test_and_set(4000))
{
queue_leave();
break;
}
} }
CatCommand abandoncmd("disconnect_and_abandon", "Disconnect and abandon",
[]() { dcandabandon(); });
void abandon() void abandon()
{ {

View File

@ -9,24 +9,15 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
static settings::Bool enable{ "vote-log.enable", "false" }; static settings::Bool requeue{ "hack.requeue-on-kick", "false" };
static settings::Bool requeue{ "vote-log.requeue", "false" };
namespace votelogger namespace votelogger
{ {
Timer antikick{}; static bool was_local_player{ false };
bool active = false;
const std::string tf_classes[] = { "class", "scout", "sniper", "soldier", void dispatchUserMessage(bf_read &buffer, int type)
"demoman", "medic", "heavy", "pyro",
"spy", "engineer" };
void user_message(bf_read &buffer, int type)
{ {
bool islocalplayer = false;
if (!enable)
return;
switch (type) switch (type)
{ {
case 45: case 45:
@ -34,27 +25,25 @@ void user_message(bf_read &buffer, int type)
break; break;
case 46: case 46:
{ {
islocalplayer = false; was_local_player = false;
unsigned char caller = buffer.ReadByte(); auto caller = (unsigned char)buffer.ReadByte();
// unknown // unknown
buffer.ReadByte(); buffer.ReadByte();
char reason[64]; char reason[64];
char name[64]; char name[64];
buffer.ReadString(reason, 64, false, nullptr); buffer.ReadString(reason, 64, false, nullptr);
buffer.ReadString(name, 64, false, nullptr); buffer.ReadString(name, 64, false, nullptr);
unsigned char eid = buffer.ReadByte(); auto eid = (unsigned char)buffer.ReadByte();
buffer.Seek(0); buffer.Seek(0);
eid >>= 1; eid >>= 1;
unsigned steamID = 0; unsigned steamID = 0;
player_info_s info; player_info_s info{};
if (g_IEngine->GetPlayerInfo(eid, &info)) if (g_IEngine->GetPlayerInfo(eid, &info))
steamID = info.friendsID; steamID = info.friendsID;
if (eid == LOCAL_E->m_IDX || if (eid == LOCAL_E->m_IDX)
playerlist::AccessData(steamID).state ==
playerlist::k_EState::FRIEND)
{ {
islocalplayer = true; was_local_player = true;
} }
logging::Info("Vote called to kick %s [U:1:%u] for %s", name, steamID, logging::Info("Vote called to kick %s [U:1:%u] for %s", name, steamID,
@ -63,8 +52,8 @@ void user_message(bf_read &buffer, int type)
} }
case 47: case 47:
logging::Info("Vote passed"); logging::Info("Vote passed");
if (islocalplayer && requeue) if (was_local_player && requeue)
tfmm::queue_start(); tfmm::startQueue();
break; break;
case 48: case 48:
logging::Info("Vote failed"); logging::Info("Vote failed");
@ -72,6 +61,8 @@ void user_message(bf_read &buffer, int type)
case 49: case 49:
logging::Info("VoteSetup?"); logging::Info("VoteSetup?");
break; break;
default:
break;
} }
} }
} }