Merge pull request #526 from BenCat07/master

Big updates
This commit is contained in:
LightCat 2018-07-18 21:36:49 +02:00 committed by GitHub
commit 5d3daee4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 608 additions and 463 deletions

View File

@ -36,7 +36,7 @@ and a lot of useful features, including
# INSTALLATION
## Automatic: (Ubuntu based only, 17.10 and onwards)
## Automatic: (Ubuntu 17.10+/Arch based only)
Run in terminal:
* `wget https://raw.githubusercontent.com/nullworks/One-in-all-cathook-install/master/install-all && bash install-all`

View File

@ -35,18 +35,18 @@ sudo chmod 000 /tmp/dumps # No permissions
FILENAME=$(shuf -n 1 build_names)
# Create directory if it doesn't exist
if [ ! -d "/usr/lib64" ]; then
sudo mkdir /usr/lib64
if [ ! -d "/lib/i386-linux-gnu/" ]; then
sudo mkdir /lib/i386-linux-gnu/
fi
# In case this file exists, get another one. ( checked it works )
while [ -f "/usr/lib64/${FILENAME}" ]; do
while [ -f "/lib/i386-linux-gnu/${FILENAME}" ]; do
FILENAME=$(shuf -n 1 build_names)
done
# echo $FILENAME > build_id # For detaching
sudo cp "bin/libcathook.so" "/usr/lib64/${FILENAME}"
sudo cp "bin/libcathook.so" "/lib/i386-linux-gnu/${FILENAME}"
echo loading "$FILENAME" to "$proc"
@ -56,14 +56,14 @@ sudo killall -19 steamwebhelper
sudo gdb -n -q -batch \
-ex "attach $proc" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"/usr/lib64/$FILENAME\", 1)" \
-ex "call \$dlopen(\"/lib/i386-linux-gnu/$FILENAME\", 1)" \
-ex "call dlerror()" \
-ex 'print (char *) $2' \
-ex "catch syscall exit exit_group" \
-ex "detach" \
-ex "quit"
sudo rm "/usr/lib64/${FILENAME}"
sudo rm "/lib/i386-linux-gnu/${FILENAME}"
sudo killall -18 steamwebhelper
sudo killall -18 steam

View File

@ -1,234 +1,26 @@
ld-2.24.so
ld-linux-x86-64.so
ld-lsb-x86-64.so
libanl-2.24.so
libasm-0.169.so
libasm.so
libatksharpglue-2.so
libbfd-2.26.1-1.fc25.so
libbfd.so
libBrokenLocale-2.24.so
libbuffer.so
libc-2.24.so
libcidn-2.24.so
libclangAnalysis.so
libclangARCMigrate.so
libclangASTMatchers.so
libclangAST.so
libclangBasic.so
libclangCodeGen.so
libclangDriver.so
libclangDynamicASTMatchers.so
libclangEdit.so
libclangFormat.so
libclangFrontend.so
libclangFrontendTool.so
libclangIndex.so
libclangLex.so
libclangParse.so
libclangRewriteFrontend.so
libclangRewrite.so
libclangSema.so
libclangSerialization.so
libclangStaticAnalyzerCheckers.so
libclangStaticAnalyzerCore.so
libclangStaticAnalyzerFrontend.so
libclangToolingCore.so
libclangTooling.so
libclutter-glx-1.0.so
libcmark.so
libcolordcompat.so
libcomps.so
libcppunit.so
libcrypt-nss-2.24.so
libcupscgi.so
libcupsimage.so
libcupsmime.so
libcupsppdc.so
libcups.so
libcurses.so
libcursesw.so
libdb-5.3.so
libdb-5.so
libdb.so
libdevmapper-event-lvm2mirror.so
libdevmapper-event-lvm2raid.so
libdevmapper-event-lvm2snapshot.so
libdevmapper-event-lvm2.so
libdevmapper-event-lvm2thin.so
libdevmapper-event.so
libdevmapper.so
libdl-2.24.so
libdw-0.169.so
libdw.so
libebtc.so
libelf-0.169.so
libelf.so
libevent_core.so
libevent_extra.so
libevent_openssl.so
libevent_pthreads.so
libevent.so
libfdt-1.4.2.so
libfdt.so
libfreebl3.so
libfreeblpriv3.so
libftoa.so
libgcc_s-6.4.1-20170727.so
libgcc_s.so
libgdksharpglue-2.so
libGeneratedSaxParser.so
libgettextlib-0.19.8.1.so
libgettextsrc-0.19.8.1.so
libgladesharpglue-2.so
libglibsharpglue-2.so
libGLX_indirect.so
libgnarl-6.so
libgnat-6.so
libgtksharpglue-2.so
libhawkey.so
libijs-0.35.so
libikvm-native.so
libiscsi.so
libiw.so
libjbig85.so
libjbig.so
libjim.so
libjs.so
libkadm5clnt.so
libkadm5srv.so
liblber.so
libldap_r.so
libldap.so
liblibreofficekitgtk.so
libLLVM-3.9.1.so
libLLVM-3.9.so
liblpsolve55.so
libLTO.so
liblua-5.1.so
liblua-5.3.so
liblua.so
liblvm2app.so
liblvm2cmd.so
libm-2.24.so
libMathMLSolver.so
libmemusage.so
libminilzo.so
libMonoPosixHelper.so
libmozjs-17.0.so
libmozjs-24.so
libmozjs-38.so
libmozjs.so
libmvec-2.24.so
libnetapi.so
libnsl-2.24.so
libnspr4.so
libnss3.so
libnssckbi.so
libnssdbm3.so
libnss_dns-2.24.so
libnss_dns.so
libnss_files-2.24.so
libnss_files.so
libnss_mdns4_minimal.so
libnss_mdns4.so
libnss_mdns6_minimal.so
libnss_mdns6.so
libnss_mdns_minimal.so
libnss_mdns.so
libnss_myhostname.so
libnss_mymachines.so
libnsspem.so
libnss_resolve.so
libnss_sss.so
libnsssysinit.so
libnssutil3.so
libnvidia-compiler.so
libnvidia-eglcore.so
libnvidia-fatbinaryloader.so
libnvidia-glcore.so
libnvidia-glsi.so
libnvidia-gtk2.so
libnvidia-gtk3.so
libnvidia-tls.so
libopcodes-2.26.1-1.fc25.so
libopcodes.so
libOpenCOLLADABaseUtils.so
libOpenCOLLADAFramework.so
libOpenCOLLADASaxFrameworkLoader.so
libOpenCOLLADAStreamWriter.so
libpangosharpglue-2.so
libpasswdqc.so
libpcprofile.so
libplc4.so
libplds4.so
libpng.so
libpthread-2.24.so
libpython3.so
libQt3Support_debug.so
libQtCLucene_debug.so
libqtconfiguration.so
libQtCore_debug.so
libQtDBus_debug.so
libQtDeclarative_debug.so
libQtDesignerComponents_debug.so
libQtDesigner_debug.so
libQtGui_debug.so
libQtHelp_debug.so
libQtMultimedia_debug.so
libQtNetwork_debug.so
libQtOpenGL_debug.so
libQtScript_debug.so
libQtScriptTools_debug.so
libQtSql_debug.so
libQtSvg_debug.so
libQtTest_debug.so
libQtXml_debug.so
libQtXmlPatterns_debug.so
libquvi-0.9-0.9.4.so
libqwt5-qt4.so
libreg.so
librepo.so
libresolv-2.24.so
librhash.so
librt-2.24.so
libsamba-errors.so
libSDL2_image.so
libSDL2.so
libSDL.so
libSegFault.so
libsemanage.so
libslapi.so
libsmbconf.so
libsmbldap.so
libsmime3.so
libsoftokn3.chk
libsoftokn3.so
libsolvext.so
libsolv.so
libssl3.so
libsss_sudo.so
libtcl8.6.so
libtermcap.so
libthread_db-1.0.so
libthrift-0.9.1.so
libthriftqt.so
libthrift.so
libthriftz-0.9.1.so
libthriftz.so
libtk8.6.so
libtxc_dxtn.so
libuniconf.so
libUTF.so
libutil-2.24.so
libvdpau_nvidia.so
libwvbase.so
libwvdbus.so
libwvstreams.so
libwvutils.so
libXaw.so
libxerces-c-3.1.so
LLVMgold.so
LLVMHello.so
p11-kit-proxy.so
p11-kit-trust.so
ld-2.26.3.4so
libbsd.so.0.8.6.1.1
libc-2.26.3.so
libcom_err.so.2.1.1
libcrypt-2.26.1.so
libdl-2.26.1.so
libexpat.so.1.6.5.1
libgcc_s.so.1.1
libgcrypt.so.20.1.8.1
libgpg-error.so.0.22.0.3
libidn.so.11.6.16.5
libkeyutils.so.1.5.7
liblzma.so.5.2.2.3
libm-2.26.4.so
libnsl-2.26.6.so
libpcre.so.3.13.3.5
libpthread-2.26.7.so
libresolv-2.26.3.so
librt-2.26.3.4.so
libselinux.so.1.1.4.1
libsystemd.so.0.19.0.4.2
libtinfo.so.5.9.4.2
libudev.so.1.6.6.4.7
libwrap.so.0.7.6.1.5
libz.so.1.2.1.1.2.4

View File

@ -19,4 +19,5 @@ extern CatCommand follow_steam;
extern unsigned steamid;
void DrawTick();
void WorldTick();
int ClassPriority(CachedEntity *ent);
}

View File

@ -77,7 +77,12 @@ bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos);
bool VisCheckEntFromEnt(CachedEntity *startEnt, CachedEntity *endEnt);
bool VisCheckEntFromEntVector(Vector startVector, CachedEntity *startEnt,
CachedEntity *endEnt);
Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist);
Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
bool checkWalkable);
float vectorMax(Vector i);
Vector vectorAbs(Vector i);
bool canReachVector(Vector loc, Vector dest = {0,0,0});
bool isJumping(Vector vec);
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
@ -85,9 +90,9 @@ float DistToSqr(CachedEntity *entity);
void fClampAngle(Vector &qaAng);
// const char* MakeInfoString(IClientEntity* player);
bool GetProjectileData(CachedEntity *weapon, float &speed, float &gravity);
bool IsVectorVisible(Vector a, Vector b);
bool IsVectorVisible(Vector a, Vector b, bool enviroment_only = false);
bool IsSentryBuster(CachedEntity *ent);
char *strfmt(const char *fmt, ...);
std::unique_ptr<char[]> strfmt(const char *fmt, ...);
// TODO move that to weaponid.h
bool HasWeapon(CachedEntity *ent, int wantedId);
bool IsAmbassador(CachedEntity *ent);

View File

@ -1,15 +1,22 @@
#!/usr/bin/env bash
if [ $EUID == 0 ]; then
echo "This script must not be run as root"
exit
fi
rm ../install-all # remove install file
#
# Install base Dependencies
#
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install build-essential git gcc-multilib g++-multilib software-properties-common gcc-snapshot g++-7-multilib gcc-7 g++-7 libssl-dev:i386 libboost-all-dev libc6-dev:i386 gdb libsdl2-dev libglew-dev:i386 libglew-dev libfreetype6-dev libfreetype6-dev:i386 cmake libpng-dev libssl-dev cmake gcc-multilib g++-multilib -y
if [ -f "/etc/arch-release" ]; then
sudo pacman -S --needed --noconfirm boost cmake make lib32-openssl lib32-libpng gcc gdb lib32-sdl2 lib32-glew freetype2
else
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install build-essential git gcc-multilib g++-multilib software-properties-common gcc-snapshot g++-7-multilib gcc-7 g++-7 libssl-dev:i386 libboost-all-dev libc6-dev:i386 gdb libsdl2-dev libglew-dev:i386 libglew-dev libfreetype6-dev libfreetype6-dev:i386 cmake libpng-dev libssl-dev cmake gcc-multilib g++-multilib -y
fi
#
# Update cathook
#

View File

@ -117,7 +117,8 @@ void runcfg()
continue;
if (i->GetBase() != std::string(i->GetString()))
{
file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n";
file << CON_PREFIX << i->name << " \"" << i->GetString()
<< "\"\n";
}
}
file.close();

View File

@ -19,7 +19,7 @@ void logging::Initialize()
// FIXME other method of naming the file?
passwd *pwd = getpwuid(getuid());
logging::handle =
fopen(strfmt("/tmp/cathook-%s-%d.log", pwd->pw_name, getpid()), "w");
fopen(strfmt("/tmp/cathook-%s-%d.log", pwd->pw_name, getpid()).get(), "w");
}
void logging::Info(const char *fmt, ...)

View File

@ -12,7 +12,7 @@ namespace sharedobj
bool LocateSharedObject(std::string &name, std::string &out_full_path)
{
FILE *proc_maps = fopen(strfmt("/proc/%i/maps", getpid()), "r");
FILE *proc_maps = fopen(strfmt("/proc/%i/maps", getpid()).get(), "r");
if (proc_maps == nullptr)
{
return false;

View File

@ -279,7 +279,7 @@ void crit_err_hdlr(int sig_num, siginfo_t *info, void *ucontext)
// just fprintf to stderr (or do both).
passwd *pwd = getpwuid(getuid());
backtraceFile = fopen(
strfmt("/tmp/cathook-%s-%d-segfault.log", pwd->pw_name, getpid()), "w");
strfmt("/tmp/cathook-%s-%d-segfault.log", pwd->pw_name, getpid()).get(), "w");
if (sig_num == SIGSEGV)
fprintf(backtraceFile, "signal %d (%s), address is %p from %p\n",
@ -321,6 +321,7 @@ void hack::Initialize()
signal(SIGPIPE, SIG_IGN);
installSignal(SIGSEGV);
installSignal(SIGABRT);
installSignal(SIGINT);
time_injected = time(nullptr);
/*passwd *pwd = getpwuid(getuid());
char *logname = strfmt("/tmp/cathook-game-stdout-%s-%u.log", pwd->pw_name,
@ -491,10 +492,6 @@ free(logname);*/
#if ENABLE_VISUALS
InitStrings();
#if ENABLE_GUI
// cat_reloadscheme to load imgui
hack::command_stack().push("cat_reloadscheme");
#endif
#ifndef FEATURE_EFFECTS_DISABLED
if (g_ppScreenSpaceRegistrationHead && g_pScreenSpaceEffects)
{

View File

@ -158,6 +158,8 @@ static CatVar auto_zoom(
"Automatically zoom in if you can see target, useful for followbots");
static CatVar auto_unzoom(CV_SWITCH, "aimbot_auto_unzoom", "0", "Auto Un-zoom",
"Automatically unzoom");
static CatVar backtrackAimbot(CV_SWITCH, "backtrack_aimbot", "0", "Backtrack Aimbot",
"Enable Backtrack Aimbot");
// Current Entity
int target_eid{ 0 };
@ -175,11 +177,13 @@ bool projectileAimbotRequired;
// This array will store calculated projectile/hitscan predictions
// for current frame, to avoid performing them again
AimbotCalculatedData_s calculated_data_array[2048]{};
#define IsMelee GetWeaponMode() == weapon_melee
bool BacktrackAimbot()
{
if (!hacks::shared::backtrack::enable)
if (!hacks::shared::backtrack::enable || !backtrackAimbot)
return false;
if (aimkey && !aimkey.KeyDown())
return false;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || !CanShoot())
return false;
@ -190,57 +194,21 @@ bool BacktrackAimbot()
int iBestTarget = hacks::shared::backtrack::iBestTarget;
if (iBestTarget == -1)
{
float bestscr = 999.0f;
for (int i = 0; i < g_IEngine->GetMaxClients(); i++)
{
if (i == g_pLocalPlayer->entity_idx)
continue;
CachedEntity *it = ENTITY(i);
if (CE_BAD(it) || !it->m_bAlivePlayer() ||
it->m_Type() != ENTITY_PLAYER)
continue;
if (it->m_iTeam() == LOCAL_E->m_iTeam())
continue;
if (!hacks::shared::backtrack::headPositions[iBestTarget][0].hitboxpos.z)
continue;
if (!it->hitboxes.GetHitbox(0))
continue;
if (IsPlayerInvisible(it) && ignore_cloak)
continue;
float scr =
GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye,
it->hitboxes.GetHitbox(0)->center);
if (scr < bestscr)
{
iBestTarget = it->m_IDX;
bestscr = scr;
}
}
if (iBestTarget == -1)
return true;
};
for (int t = 0; t < hacks::shared::backtrack::ticks; ++t)
hacks::shared::backtrack::sorted_ticks[t] =
hacks::shared::backtrack::BestTickData{ hacks::shared::backtrack::headPositions[iBestTarget][t].tickcount, t };
std::sort(hacks::shared::backtrack::sorted_ticks, hacks::shared::backtrack::sorted_ticks + hacks::shared::backtrack::ticks);
return true;
int tickcnt = 0;
for (auto i : hacks::shared::backtrack::headPositions[iBestTarget])
{
bool good_tick = false;
for (int j = 0; j < 12; ++j)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != FLT_MAX)
good_tick = true;
tickcnt++;
if (!i.hitboxpos.z)
continue;
if (!good_tick)
continue;
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, i.hitboxpos))
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, i.hitboxpos, true))
continue;
float scr = abs(g_pLocalPlayer->v_OrigViewangles.y - i.viewangles);
@ -263,9 +231,12 @@ bool BacktrackAimbot()
DoSlowAim(angles2);
else if (silent)
g_pLocalPlayer->bUseSilentAngles = true;
if (!slow_aim)
slow_can_shoot = true;
// Set angles
g_pUserCmd->viewangles = angles2;
g_pUserCmd->buttons |= IN_ATTACK;
if (autoshoot && slow_can_shoot)
g_pUserCmd->buttons |= IN_ATTACK;
return true;
}
return true;
@ -289,19 +260,36 @@ void CreateMove()
}
}
}
// We do this as we need to pass whether the aimkey allows aiming to both
// the find target and aiming system. If we just call the func than toggle
// aimkey would break so we save it to a var to use it twice
bool aimkey_status = UpdateAimkey();
// Refresh our best target
CachedEntity *target_entity = RetrieveBestTarget(aimkey_status);
if (CE_BAD(target_entity) || !foundTarget)
return;
// Auto-zoom
IF_GAME(IsTF())
{
if (auto_zoom)
{
if (g_pLocalPlayer->holding_sniper_rifle)
{
if (not g_pLocalPlayer->bZoomed)
{
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
}
}
// check if we need to run projectile Aimbot code
projectileAimbotRequired = false;
if (projectile_aimbot &&
(g_pLocalPlayer->weapon_mode == weapon_projectile ||
g_pLocalPlayer->weapon_mode == weapon_throwable))
{
projectileAimbotRequired = true;
}
// We do this as we need to pass whether the aimkey allows aiming to both
// the find target and aiming system. If we just call the func than toggle
// aimkey would break so we save it to a var to use it twice
bool aimkey_status = UpdateAimkey();
// Local player check + Aimkey
if (!aimkey_status || !ShouldAim())
@ -319,33 +307,14 @@ void CreateMove()
if (proj_gravity)
cur_proj_grav = float(proj_gravity);
}
if (BacktrackAimbot())
return;
// Refresh our best target
CachedEntity *target_entity = RetrieveBestTarget(aimkey_status);
if (CE_BAD(target_entity) || !foundTarget)
return;
return;
if (!g_IEntityList->GetClientEntity(target_entity->m_IDX))
return;
if (!target_entity->hitboxes.GetHitbox(
calculated_data_array[target_entity->m_IDX].hitbox))
return;
// Auto-zoom
IF_GAME(IsTF())
{
if (auto_zoom)
{
if (g_pLocalPlayer->holding_sniper_rifle)
{
if (not g_pLocalPlayer->bZoomed)
{
g_pUserCmd->buttons |= IN_ATTACK2;
}
}
}
}
#if ENABLE_VISUALS
static effect_chams::EffectChams Effectchams;

View File

@ -15,14 +15,18 @@ CatVar communicate(CV_SWITCH, "identify", "0", "identify",
"Auto identify for other cathook users");
CatVar enabled(CV_SWITCH, "aa_enabled", "0", "Anti-Aim",
"Master AntiAim switch");
static CatVar crouch(CV_SWITCH, "aa_fakecrouch", "0", "Fake Crouch", "Fake crouch");
static CatVar yaw(CV_FLOAT, "aa_yaw", "0.0", "Yaw", "Static yaw (left/right)",
360.0);
static CatVar pitch(CV_FLOAT, "aa_pitch", "-89.0", "Pitch",
"Static pitch (up/down)", -89.0, 89.0);
static CatEnum yaw_mode_enum({ "KEEP", "STATIC", "JITTER", "BIGRANDOM",
"RANDOM", "SPIN", "OFFSETKEEP", "EDGE", "HECK",
"FAKESIDEWAYS", "FAKERIGHT", "FAKELEFT",
"FAKEFUCK" });
static CatEnum yaw_mode_enum({ "KEEP", "STATIC", "JITTER",
"BIGRANDOM", "RANDOM", "SPIN",
"OFFSETKEEP", "EDGE", "HECK",
"FAKEKEEP", "FAKESTATIC", "FAKEJITTER",
"FAKEBIGRANDOM", "FAKERANDOM", "FAKESPIN",
"FAKEOFFSETKEEP", "FAKEEDGE", "FAKEHECK", "FAKESIDEWAYS", "FAKELEFT",
"FAKERIGHT", "FAKEREVERSEEDGE"});
static CatEnum pitch_mode_enum({ "KEEP", "STATIC", "JITTER", "RANDOM", "FLIP",
"FAKEFLIP", "FAKEUP", "FAKEDOWN", "FAKECENTER",
"UP", "DOWN", "HECK" });
@ -47,7 +51,7 @@ static CatVar aaaa_interval_random_high(CV_FLOAT, "aa_aaaa_interval_high", "15",
static CatVar aaaa_interval_random_low(CV_FLOAT, "aa_aaaa_interval_low", "3",
"Interval Floor",
"Lower bound for random AAAA interval");
static CatEnum aaaa_modes_enum({ "(FAKE)UP", "(FAKE)DOWN" });
static CatEnum aaaa_modes_enum({ "(FAKE)UP", "(FAKE)DOWN", "(FAKE)CENTER" });
static CatVar aaaa_mode(aaaa_modes_enum, "aa_aaaa_mode", "0", "Mode",
"Anti-Anti-Anti-Aim Mode");
static CatVar aaaa_flip_key(CV_KEY, "aa_aaaa_flip_key", "0", "Flip key",
@ -69,6 +73,8 @@ float GetAAAAPitch()
return aaaa_stage ? -271 : -89;
case 1:
return aaaa_stage ? 271 : 89;
case 2:
return aaaa_stage ? -180 : 180;
default:
break;
}
@ -382,6 +388,37 @@ float useEdge(float edgeViewAngle)
Timer delay{};
int val = 0;
int value[32] = { 0 };
void FakeCrouch(CUserCmd * cmd)
{
if (!crouch)
return;
if (cmd->buttons & IN_ATTACK)
{
*bSendPackets = true;
return;
}
static bool bDuck = false;
static int waittime = 0;
if (waittime)
{
waittime--;
return;
}
bDuck = !bDuck;
if (bDuck)
{
cmd->buttons |= IN_DUCK;
*bSendPackets = false;
waittime = 15;
}
else{
cmd->buttons &= ~IN_DUCK;
*bSendPackets = true;
}
}
void ProcessUserCmd(CUserCmd *cmd)
{
if (!enabled)
@ -389,7 +426,9 @@ void ProcessUserCmd(CUserCmd *cmd)
if (!ShouldAA(cmd))
return;
static bool angstate = true;
if ((int) yaw_mode >= 9)
static bool keepmode = true;
keepmode = !keepmode;
if ((int) yaw_mode >= 8)
angstate = !angstate;
else
angstate = true;
@ -443,23 +482,102 @@ void ProcessUserCmd(CUserCmd *cmd)
if (findEdge(y))
y = useEdge(y);
break;
case 8:
case 8: // HECK
FuckYaw(y);
clamp = false;
break;
case 9:
case 9: // Fake keep (basically just spam random angles)
if (keepmode && !*bSendPackets)
{
cur_yaw += (float) spin;
if (cur_yaw > 180)
cur_yaw = -180;
if (cur_yaw < -180)
cur_yaw = 180;
y = cur_yaw;
}
else if (!keepmode && !*bSendPackets)
{
if (flip)
y += 90;
else
y -= 90;
break;
flip = !flip;
}
clamp = false;
break;
case 10: // Fake Static
if (*bSendPackets)
y = (float) yaw;
break;
case 11: // Fake jitter
if (*bSendPackets)
{
if (flip)
y += 90;
else
y -= 90;
}
break;
case 12: // Fake bigrandom
if (*bSendPackets)
{
y = RandFloatRange(-65536.0f, 65536.0f);
clamp = false;
}
break;
case 13: // Fake random
if (*bSendPackets)
y = RandFloatRange(-180.0f, 180.0f);
break;
case 14: // Fake spin
if (*bSendPackets)
{
cur_yaw += (float) spin;
if (cur_yaw > 180)
cur_yaw = -180;
if (cur_yaw < -180)
cur_yaw = 180;
y = cur_yaw;
}
break;
case 15: // Fake offsetkeep
if (*bSendPackets)
y += (float) yaw;
break;
case 16: // Fake edge
if (*bSendPackets)
{
// Attemt to find an edge and if found, edge
if (findEdge(y))
y = useEdge(y);
}
break;
case 17: // Fake heck
if (*bSendPackets)
{
FuckYaw(y);
clamp = false;
}
break;
case 18: // Fake sideways
y += *bSendPackets ? 90.0f : -90.0f;
break;
case 10:
y += *bSendPackets ? 0.0f : 90.0f;
case 19: // Fake left
y += !*bSendPackets ? 0.0f : -90.0f;
break;
case 11:
y += *bSendPackets ? 0.0f : -90.0f;
break;
case 12:
if (*bSendPackets)
FuckYaw(y);
case 20: // Fake right
y += !*bSendPackets ? 0.0f : 90.0f;
break;
case 21: // Fake reverse edge
if (*bSendPackets)
{
// Attemt to find an edge and if found, edge
if (findEdge(y))
y = useEdge(y) + 180.0f;
}
break;
default:
break;
}
@ -506,7 +624,8 @@ void ProcessUserCmd(CUserCmd *cmd)
FuckPitch(p);
clamp = false;
}
flip = !flip;
if (*bSendPackets)
flip = !flip;
if (clamp)
fClampAngle(cmd->viewangles);
if (roll)
@ -518,5 +637,6 @@ void ProcessUserCmd(CUserCmd *cmd)
p = GetAAAAPitch();
}
g_pLocalPlayer->bUseSilentAngles = true;
FakeCrouch(cmd);
}
}

View File

@ -71,6 +71,7 @@ void CreateMove()
Vector &angles = NET_VECTOR(tar, netvar.m_angEyeAngles);
float &simtime = NET_FLOAT(tar, netvar.m_flSimulationTime);
angles.y = i.viewangles;
simtime = i.simtime;
g_pUserCmd->tick_count = i.tickcount;
g_pUserCmd->buttons |= IN_ATTACK;
break;

View File

@ -225,6 +225,39 @@ static CatVar auto_vacc_blast_pop_ubers(
CV_INT, "auto_vacc_blast_pop_ubers", "0", "Pop Blast if Ubers >=",
"Only pop an uber if you have >= # Ubercharges in your Vaccinator", 0, 4);
bool IsProjectile(CachedEntity *ent)
{
return (ent->m_iClassID() == CL_CLASS(CTFProjectile_Rocket) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_Flare) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_EnergyBall) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_HealingBolt) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_Arrow) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_SentryRocket) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_Cleaver) ||
ent->m_iClassID() == CL_CLASS(CTFGrenadePipebombProjectile) ||
ent->m_iClassID() == CL_CLASS(CTFProjectile_EnergyRing));
}
int NearbyEntities()
{
int ret = 0;
if (CE_BAD(LOCAL_E))
return ret;
for (int i = 0; i < HIGHEST_ENTITY; i++)
{
CachedEntity *ent = ENTITY(i);
if (CE_BAD(ent))
continue;
if (ent == LOCAL_E)
continue;
if (!ent->m_bAlivePlayer())
continue;
if (ent->m_flDistance() <= 300.0f)
ret++;
}
return ret;
}
int OptimalResistance(CachedEntity *patient, bool *shouldPop)
{
int bd = BlastDangerValue(patient), fd = FireDangerValue(patient),
@ -310,12 +343,17 @@ void DoResistSwitching()
int force_healing_target{ 0 };
static CatCommand heal_steamid(
"autoheal_heal_steamid",
"Heals a player with SteamID (ONCE. Use for easy airstuck med setup)",
"autoheal_heal_steamid", "Heals a player with SteamID",
[](const CCommand &args) {
if (args.ArgC() < 2)
{
logging::Info("Invalid call!");
force_healing_target = 0;
return;
}
if (strtol(args.Arg(1), nullptr, 10) == 0x0)
{
force_healing_target = 0;
return;
}
for (int i = 1; i <= 32 && i < HIGHEST_ENTITY; i++)
@ -351,32 +389,20 @@ bool IsPopped()
bool ShouldChargePlayer(int idx)
{
CachedEntity *target = ENTITY(idx);
const int health = target->m_iHealth();
if (float(pop_uber_percent) > 0)
{
const float pophealth =
target->m_iMaxHealth() * (float(pop_uber_percent) / 100);
if (health < pophealth)
return true;
}
else
{
const float damage_accum_duration =
g_GlobalVars->curtime - data[idx].accum_damage_start;
if (!data[idx].accum_damage_start)
return false;
if (health > 30 && data[idx].accum_damage < 45)
return false;
const float dd =
((float) data[idx].accum_damage / damage_accum_duration);
if (dd > 40)
{
return true;
}
if (health < 30 && data[idx].accum_damage > 10)
return true;
const float damage_accum_duration =
g_GlobalVars->curtime - data[idx].accum_damage_start;
const int health = target->m_iHealth();
if (!data[idx].accum_damage_start)
return false;
if (health > 30 && data[idx].accum_damage < 45)
return false;
const float dd = ((float) data[idx].accum_damage / damage_accum_duration);
if (dd > 40)
{
return true;
}
if (health < 30 && data[idx].accum_damage > 10)
return true;
return false;
}
@ -434,7 +460,6 @@ void CreateMove()
GetHitbox(target, 7, out);
AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd);
g_pUserCmd->buttons |= IN_ATTACK;
force_healing_target = 0;
}
}
if (!enabled)
@ -553,19 +578,20 @@ int HealingPriority(int idx)
int overheal = maxoverheal - (maxbuffedhealth - health);
float overhealp = ((float) overheal / (float) maxoverheal);
float healthp = ((float) health / (float) maxhealth);
priority += hacks::shared::followbot::ClassPriority(ent) * 10;
switch (playerlist::AccessData(ent).state)
{
case playerlist::k_EState::FRIEND:
priority += 70 * (1 - healthp);
priority += 15 * (1 - overhealp);
priority += 5 * (1 - overhealp);
break;
case playerlist::k_EState::IPC:
priority += 100 * (1 - healthp);
priority += 20 * (1 - overhealp);
priority += 10 * (1 - overhealp);
break;
default:
priority += 50 * (1 - healthp);
priority += 10 * (1 - overhealp);
priority += 40 * (1 - healthp);
priority += 3 * (1 - overhealp);
}
#if ENABLE_IPC
if (ipc::peer)
@ -573,7 +599,7 @@ int HealingPriority(int idx)
if (hacks::shared::followbot::followbot &&
hacks::shared::followbot::follow_target == idx)
{
priority *= 3.0f;
priority *= 6.0f;
}
}
#endif

View File

@ -120,7 +120,7 @@ void Update()
{
if (autojoin_team and UnassignedTeam())
{
hack::ExecuteCommand("jointeam auto");
hack::ExecuteCommand("autoteam");
}
else if (preferred_class and UnassignedClass())
{

View File

@ -9,6 +9,7 @@
#include "hacks/Backtrack.hpp"
#include <boost/circular_buffer.hpp>
#include <glez/draw.hpp>
#define IsMelee GetWeaponMode() == weapon_melee
namespace hacks::shared::backtrack
{
@ -105,7 +106,7 @@ void Run()
float bestFov = 99999;
BestTick = 0;
iBestTarget = -1;
bool IsMelee = GetWeaponMode() == weapon_melee;
float prev_distance = 9999;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
@ -157,18 +158,23 @@ void Run()
{
int bestTick = 0;
float tempFOV = 9999;
float bestFOV = 40.0f;
float bestFOV = 180.0f;
float distance, prev_distance_ticks = 9999;
for (int i = 0; i < 12; ++i)
sorted_ticks[i] = BestTickData{INT_MAX, i};
for (int t = 0; t < ticks; ++t)
sorted_ticks[t] =
BestTickData{ headPositions[iBestTarget][t].tickcount, t };
{
if (headPositions[iBestTarget][t].tickcount)
sorted_ticks[t] =
BestTickData{ headPositions[iBestTarget][t].tickcount, t };
}
std::sort(sorted_ticks, sorted_ticks + ticks);
for (int t = 0; t < ticks; ++t)
{
bool good_tick = false;
for (int i = 0; i < 12; ++i)
if (t == sorted_ticks[i].tick)
if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != FLT_MAX)
good_tick = true;
if (!good_tick)
continue;

View File

@ -84,13 +84,61 @@ void checkAFK()
void init()
{
for (int i; i < afkTicks.size(); i++)
for (int i = 0; i < afkTicks.size(); i++)
{
afkTicks[i].update();
}
inited = true;
return;
}
// auto add checked crumbs for the walkbot to follow
void addCrumbs(CachedEntity *target, Vector corner = g_pLocalPlayer->v_Origin)
{
breadcrumbs.clear();
if (g_pLocalPlayer->v_Origin != corner)
{
Vector dist = corner - g_pLocalPlayer->v_Origin;
int maxiterations = floor(corner.DistTo(g_pLocalPlayer->v_Origin)) / 40;
for (int i = 0; i < maxiterations; i++)
{
breadcrumbs.push_back(g_pLocalPlayer->v_Origin + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1));
}
}
Vector dist = target->m_vecOrigin() - corner;
int maxiterations = floor(corner.DistTo(target->m_vecOrigin())) / 40;
for (int i = 0; i < maxiterations; i++)
{
breadcrumbs.push_back(corner + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1));
}
}
int ClassPriority(CachedEntity* ent)
{
switch (g_pPlayerResource->GetClass(ent))
{
if (g_pPlayerResource->GetClass(ent) == tf_spy)
return 0;
case tf_engineer:
return 1;
case tf_medic:
return 2;
case tf_pyro:
return 3;
case tf_scout:
return 4;
case tf_sniper:
return 5;
case tf_demoman:
return 6;
case tf_soldier:
return 7;
case tf_heavy:
return 8;
default:
return 0;
}
}
void WorldTick()
{
if (!followbot)
@ -134,21 +182,21 @@ void WorldTick()
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
continue;
if (i == follow_target)
continue;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
if (steamid != entity->player_info.friendsID) // steamid check
continue;
logging::Info("Success");
if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue;
if (corneractivate)
{
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250); //get the corner location that the future target is visible from
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250, true); //get the corner location that the future target is visible from
if (!indirectOrigin.z) //if we couldn't find it, exit
continue;
breadcrumbs.clear(); //we need to ensure that the breadcrumbs std::vector is empty
breadcrumbs.push_back(indirectOrigin); //add the corner location to the breadcrumb list
addCrumbs(entity, indirectOrigin);
}
else
{
@ -161,11 +209,11 @@ void WorldTick()
}
// If we dont have a follow target from that, we look again for someone
// else who is suitable
if ((!follow_target || change) && roambot)
if ((!follow_target || change || (ClassPriority(ENTITY(follow_target)) < 6 && ENTITY(follow_target)->player_info.friendsID != steamid)) && roambot)
{
// Try to get a new target
auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < HIGHEST_ENTITY; i++)
auto ent_count = followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
for (int i = 0; i < ent_count; i++)
{
auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant
@ -202,23 +250,30 @@ void WorldTick()
follow_target = entity->m_IDX;
if (entity->m_Type() != ENTITY_PLAYER)
continue;
// favor closer entitys
if (follow_target &&
ENTITY(follow_target)->m_flDistance() <
entity->m_flDistance()) // favor closer entitys
{
continue;
}
// check if new target has a higher priority than current target
if (ClassPriority(ENTITY(follow_target)) >= ClassPriority(ENTITY(i)))
continue;
if (corneractivate)
{
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250); //get the corner location that the future target is visible from
Vector indirectOrigin = VischeckWall(LOCAL_E, entity, 250, true); //get the corner location that the future target is visible from
if (!indirectOrigin.z) //if we couldn't find it, exit
continue;
breadcrumbs.clear(); //we need to ensure that the breadcrumbs std::vector is empty
breadcrumbs.push_back(indirectOrigin); //add the corner location to the breadcrumb list
addCrumbs(entity, indirectOrigin);
}
else
{
if (!VisCheckEntFromEnt(LOCAL_E, entity))
continue;
}
if (follow_target &&
ENTITY(follow_target)->m_flDistance() >
entity->m_flDistance()) // favor closer entitys
continue;
// ooooo, a target
follow_target = i;
afkTicks[i].update(); // set afk time to 0
@ -230,8 +285,11 @@ void WorldTick()
CachedEntity *followtar = ENTITY(follow_target);
// wtf is this needed
if (CE_BAD(followtar))
if (CE_BAD(followtar) || !followtar->m_bAlivePlayer())
{
follow_target = 0;
return;
}
// Check if we are following a disguised/spy
if (IsPlayerDisguised(followtar) || IsPlayerInvisible(followtar))
{
@ -248,6 +306,12 @@ void WorldTick()
}
}
// if(!checkPath()) //wip do not merge if you see this
// {
// follow_target = 0;
// return;
// }
// Update timer on new target
static Timer idle_time{};
if (breadcrumbs.empty())
@ -282,7 +346,7 @@ void WorldTick()
}
}
// moved because its worthless otherwise
// Tauntsync
if (sync_taunt && HasCondition<TFCond_Taunting>(followtar) &&
lastTaunt.test_and_set(1000))
{
@ -292,9 +356,10 @@ void WorldTick()
// Follow the crumbs when too far away, or just starting to follow
if (dist_to_target > (float) follow_distance)
{
// Check for idle
if (autojump && idle_time.check(2000))
// Check for jump
if (autojump && (idle_time.check(2000) || isJumping(breadcrumbs[0])))
g_pUserCmd->buttons |= IN_JUMP;
// Check for idle
if (idle_time.test_and_set(5000))
{
follow_target = 0;

View File

@ -18,6 +18,8 @@ void run()
return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
{
if (g_pLocalPlayer->entity_idx == i)
continue;
CachedEntity *pEntity = ENTITY(i);
if (CE_BAD(pEntity) || !pEntity->m_bAlivePlayer())
{

View File

@ -87,7 +87,7 @@ static CatCommand test_chat_print(
if (chat)
{
std::unique_ptr<char> str(
strfmt("\x07%06X[CAT]\x01 %s", 0x4D7942, args.ArgS()));
strfmt("\x07%06X[CAT]\x01 %s", 0x4D7942, args.ArgS()).get());
chat->Printf(str.get());
}
else
@ -549,7 +549,7 @@ void Schema_Reload()
logging::Info("0x%08x 0x%08x", InitSchema, GetItemSchema);
void *itemschema = (void *) ((unsigned) GetItemSchema() + 4);
void *data;
char *path = strfmt("/opt/cathook/data/items_game.txt");
char *path = strfmt("/opt/cathook/data/items_game.txt").get();
FILE *file = fopen(path, "r");
delete[] path;
fseek(file, 0L, SEEK_END);

View File

@ -22,10 +22,16 @@ static CatVar sound_alerts(CV_SWITCH, "spyalert_sound", "1", "Sound Alerts",
"Demoman yells spy when a spy is within distance");
static CatVar sound_alert_interval(CV_FLOAT, "spyalert_interval", "3",
"Alert Interval", "Sound alert interval");
static CatVar voicemenu(CV_SWITCH, "spyalert_voice", "0",
"Voicemenu", "Inform other Players of a nearby Spy using the Voicemenu.");
static CatVar invisible(CV_SWITCH, "spyalert_invisible", "0",
"Detect Invisible", "Detect invisible Spies.");
bool warning_triggered = false;
bool backstab_triggered = false;
float last_say = 0.0f;
Timer lastVoicemenu{};
void Draw()
{
@ -52,7 +58,7 @@ void Draw()
continue;
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team)
continue;
if (IsPlayerInvisible(ent))
if (IsPlayerInvisible(ent) && !invisible)
continue;
distance = ent->m_flDistance();
if (distance < closest_spy_distance || !closest_spy_distance)
@ -80,6 +86,8 @@ void Draw()
}
backstab_triggered = true;
}
if (voicemenu && lastVoicemenu.test_and_set(5000))
g_IEngine->ClientCmd_Unrestricted("voicemenu 1 1");
AddCenterString(format("BACKSTAB WARNING! ",
(int) (closest_spy_distance / 64 * 1.22f),
"m (", spy_count, ")"),
@ -99,6 +107,8 @@ void Draw()
}
warning_triggered = true;
}
if (voicemenu && lastVoicemenu.test_and_set(5000))
g_IEngine->ClientCmd_Unrestricted("voicemenu 1 1");
AddCenterString(format("Incoming spy! ",
(int) (closest_spy_distance / 64 * 1.22f),
"m (", spy_count, ")"),

View File

@ -125,9 +125,9 @@ const std::vector<std::string> builtin_cathook = {
"-> I am charged!",
"-> Not a step back! UBERCHARGE USED!",
"-> My Ubercharge comes to an end!",
"-> I have a bit of ubercharge!",
"-> I have %i%% of ubercharge!",
"-> I have half of the ubercharge!",
"-> Ubercharge almost ready!"
"-> Ubercharge almost ready! (%i%%)"
};
const std::vector<std::string> builtin_nonecore = {
">>> GET READY TO RUMBLE! <<<", ">>> CHEATS ACTIVATED! <<<",

View File

@ -108,21 +108,29 @@ void WalkTo(const Vector &vector)
// Function to get the corner location that a vischeck to an entity is possible
// from
Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist)
Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
bool checkWalkable)
{
int maxiterations = maxdist / 40;
Vector origin = player->m_vecOrigin();
if (VisCheckEntFromEnt(player, target)) // if we can see an entity, we don't
// need to run calculations
return origin;
// if we can see an entity, we don't need to run calculations
if (VisCheckEntFromEnt(player, target))
{
if (!checkWalkable)
return origin;
else if (canReachVector(origin, target->m_vecOrigin()))
return origin;
}
for (int i = 0; i < 4; i++) // for loop for all 4 directions
{
for (int j = 0; j < maxiterations;
j++) // 40 * maxiterations = range in HU
// 40 * maxiterations = range in HU
for (int j = 0; j < maxiterations; j++)
{
Vector virtualOrigin = origin;
switch (i) // what direction to go in
// what direction to go in
switch (i)
{
case 0:
virtualOrigin.x = virtualOrigin.x + 40 * (j + 1);
@ -137,20 +145,161 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist)
virtualOrigin.y = virtualOrigin.y - 40 * (j + 1);
break;
}
if (!IsVectorVisible(origin,
virtualOrigin)) // check if player can see the
// players virtualOrigin
// check if player can see the players virtualOrigin
if (!IsVectorVisible(origin, virtualOrigin, true))
continue;
if (VisCheckEntFromEntVector(
virtualOrigin, player,
target)) // check if the virtualOrigin can see the target
return virtualOrigin; // return the corner position that we know
// can see the target
// check if the virtualOrigin can see the target
if (!VisCheckEntFromEntVector(virtualOrigin, player, target))
continue;
if (!checkWalkable)
return virtualOrigin;
// check if the location is accessible
if (!canReachVector(origin, virtualOrigin))
continue;
if (canReachVector(virtualOrigin, target->m_vecOrigin()))
return virtualOrigin;
}
}
// if we didn't find anything, return an empty Vector
return { 0, 0, 0 };
}
// Returns a vectors max value. For example: {123,-150, 125} = 125
float vectorMax(Vector i)
{
return fmaxf(fmaxf(i.x, i.y), i.z);
}
// Returns a vectors absolute value. For example {123,-150, 125} = {123,150,
// 125}
Vector vectorAbs(Vector i)
{
Vector result = i;
result.x = fabsf(result.x);
result.y = fabsf(result.y);
result.z = fabsf(result.z);
return result;
}
// check to see if we can reach a vector or if it is too high / doesn't leave
// enough space for the player, optional second vector
bool canReachVector(Vector loc, Vector dest)
{
if (!dest.IsZero())
{
Vector dist = dest - loc;
int maxiterations = floor(dest.DistTo(loc)) / 40;
for (int i = 0; i < maxiterations; i++)
{
Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
trace_t trace;
Ray_t ray;
Vector down = vec;
down.z = down.z - 50;
ray.Init(vec, down);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace);
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
return false;
for (int j = 0; j < 4; j++)
{
Vector directionalLoc = vec;
// what direction to check
switch (j)
{
case 0:
directionalLoc.x = directionalLoc.x + 40;
break;
case 1:
directionalLoc.x = directionalLoc.x - 40;
break;
case 2:
directionalLoc.y = directionalLoc.y + 40;
break;
case 3:
directionalLoc.y = directionalLoc.y - 40;
break;
}
trace_t trace2;
Ray_t ray2;
ray2.Init(vec, directionalLoc);
g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player,
&trace2);
// distance of trace < than 26
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
return false;
}
}
}
else
{
// check if the vector is too high above ground
trace_t trace;
Ray_t ray;
Vector down = loc;
down.z = down.z - 50;
ray.Init(loc, down);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// higher to avoid small false positives, player can jump 42 hu according to
// the tf2 wiki
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
return false;
// check if there is enough space arround the vector for a player to fit
// for loop for all 4 directions
for (int i = 0; i < 4; i++)
{
Vector directionalLoc = loc;
// what direction to check
switch (i)
{
case 0:
directionalLoc.x = directionalLoc.x + 40;
break;
case 1:
directionalLoc.x = directionalLoc.x - 40;
break;
case 2:
directionalLoc.y = directionalLoc.y + 40;
break;
case 3:
directionalLoc.y = directionalLoc.y - 40;
break;
}
trace_t trace2;
Ray_t ray2;
ray2.Init(loc, directionalLoc);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace2);
// distance of trace < than 26
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
return false;
}
}
return true;
}
// returns if the player is currently jumping/falling.
bool isJumping(Vector vec)
{
// check if the vector is too high above ground
trace_t trace;
Ray_t ray;
Vector down = vec;
Vector loc = vec;
down.z = down.z - 50;
loc.z = loc.z + 5;
ray.Init(vec, down);
// trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// lower to avoid small false negatives, player can jump 42 hu according to
// the tf2 wiki, higher because loc.z = loc.z + 5;
if (trace.startpos.DistTo(trace.endpos) > 45)
return true;
return false;
}
std::string GetLevelName()
{
@ -827,15 +976,20 @@ netvar.iHealth));
return buf;
}*/
bool IsVectorVisible(Vector origin, Vector target)
bool IsVectorVisible(Vector origin, Vector target, bool enviroment_only)
{
trace_t trace_visible;
Ray_t ray;
trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
ray.Init(origin, target);
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_no_player,
if (!enviroment_only)
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_no_player,
&trace_visible);
else
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace_visible);
return (trace_visible.fraction == 1.0f);
}
@ -1081,14 +1235,14 @@ void PrintChat(const char *fmt, ...)
CHudBaseChat *chat = (CHudBaseChat *) g_CHUD->FindElement("CHudChat");
if (chat)
{
std::unique_ptr<char> buf(new char[1024]);
std::unique_ptr<char[]> buf(new char[1024]);
va_list list;
va_start(list, fmt);
vsprintf(buf.get(), fmt, list);
va_end(list);
std::unique_ptr<char> str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s",
0x5e3252, 0xba3d9a, 0x5e3252,
buf.get()));
buf.get()).get());
// FIXME DEBUG LOG
logging::Info("%s", str.get());
chat->Printf(str.get());
@ -1098,13 +1252,15 @@ void PrintChat(const char *fmt, ...)
}
}
// You are responsible for delete[]'ing the resulting string.
char *strfmt(const char *fmt, ...)
// You shouldn't delete[] this unique_ptr since it
// does it on its own
std::unique_ptr<char[]> strfmt(const char *fmt, ...)
{
char *buf = new char[1024];
//char *buf = new char[1024];
auto buf = std::make_unique<char[]>(1024);
va_list list;
va_start(list, fmt);
vsprintf(buf, fmt, list);
vsprintf(buf.get(), fmt, list);
va_end(list);
return buf;
}

View File

@ -22,7 +22,7 @@ static CatVar chat_filter(CV_STRING, "chat_censor", "", "Censor words",
"said, seperate with commas");
static CatVar chat_filter_enabled(CV_SWITCH, "chat_censor_enabled", "0",
"Enable censor", "Censor Words in chat");
std::string clear = "";
const std::string clear = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
std::string lastfilter{};
std::string lastname{};
@ -177,12 +177,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
break;
if (boost::contains(message2, filter))
{
if (clear == "")
{
for (int i = 0; i < 120; i++)
clear += "\n";
}
*bSendPackets = true;
chat_stack::Say(". " + clear, true);
retrun = true;
@ -210,12 +204,6 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type,
break;
if (boost::contains(message2, filter))
{
if (clear == "")
{
clear = "";
for (int i = 0; i < 120; i++)
clear += "\n";
}
*bSendPackets = true;
chat_stack::Say(". " + clear, true);
retrun = true;

View File

@ -97,20 +97,13 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
hacks::shared::lagexploit::bcalled = false;
#endif
#if ENABLE_VISUALS
typedef bool *(*LoadNamedSkys_Fn)(const char *);
typedef bool (*LoadNamedSkys_Fn)(const char *);
uintptr_t addr = gSignatures.GetEngineSignature(
"55 89 E5 57 31 FF 56 8D B5 ? ? ? ? 53 81 EC 6C 01 00 00");
static LoadNamedSkys_Fn LoadNamedSkys = LoadNamedSkys_Fn(addr);
bool succ;
logging::Info("Going to load the skybox");
#ifdef __clang__
asm("movl %1, %%edi; push skynum[(int) skybox_changer]; call %%edi; mov "
"%%eax, %0; add %%esp, 4h"
: "=r"(succ)
: "r"(LoadNamedSkys));
#else
succ = LoadNamedSkys(skynum[(int) skybox_changer]);
#endif
logging::Info("Loaded Skybox: %s", succ ? "true" : "false");
ConVar *holiday = g_ICvar->FindVar("tf_forced_holiday");

View File

@ -7,6 +7,11 @@
#include "common.hpp"
CatCommand printfov(
"fov_print", "Dump achievements to file (development)", []() {
if (CE_GOOD(LOCAL_E))
logging::Info("%d", CE_INT(LOCAL_E, netvar.iFOV));
});
void LocalPlayer::Update()
{
CachedEntity *wep;
@ -40,7 +45,7 @@ void LocalPlayer::Update()
health = CE_INT(entity, netvar.iHealth);
this->bUseSilentAngles = false;
bZoomed = CE_INT(entity, netvar.iFOV) ==
20; //!= NET_INT(entity, netvar.iDefaultFOV);
20.0f; //!= NET_INT(entity, netvar.iDefaultFOV);
if (bZoomed)
{
if (flZoomBegin == 0.0f)

View File

@ -58,7 +58,7 @@ int re::CTFPartyClient::LoadSavedCasualCriteria()
{
typedef int (*LoadSavedCasualCriteria_t)(re::CTFPartyClient *);
uintptr_t addr = gSignatures.GetClientSignature(
"55 89 E5 83 EC ? 8B 45 ? 8B 50 ? C6 80");
"55 89 E5 8B 45 ? 5D 8B 80 ? ? ? ? C3 66 90 55 89 E5 8B 45 ? 5D 0F B6 80 ? ? ? ? C3 90 55 89 E5 56") - 0x40;
LoadSavedCasualCriteria_t LoadSavedCasualCriteria_fn =
LoadSavedCasualCriteria_t(addr);

View File

@ -16,7 +16,7 @@ SpoofedConVar::SpoofedConVar(ConVar *var) : original(var)
{
int flags = var->m_nFlags;
const char *name = var->m_pszName;
char *s_name = strfmt("q_%s", name);
char *s_name = strfmt("q_%s", name).get();
if (g_ICvar->FindVar(s_name))
return;
var->m_pszName = s_name;

View File

@ -370,7 +370,7 @@ bool CLC_RespondCvarValue::ReadFromBuffer(bf_read &buffer)
const char *CLC_RespondCvarValue::ToString(void) const
{
return strfmt("%s: status: %d, value: %s, cookie: %d", GetName(),
m_eStatusCode, m_szCvarValue, m_iCookie);
m_eStatusCode, m_szCvarValue, m_iCookie).get();
}
bool NET_NOP::WriteToBuffer(bf_write &buffer)
@ -409,12 +409,12 @@ bool NET_SignonState::ReadFromBuffer(bf_read &buffer)
const char *NET_SignonState::ToString(void) const
{
return strfmt("net_SignonState: state %i, count %i", m_nSignonState,
m_nSpawnCount);
m_nSpawnCount).get();
}
const char *CLC_VoiceData::ToString(void) const
{
return strfmt("%s: %i bytes", GetName(), m_nLength);
return strfmt("%s: %i bytes", GetName(), m_nLength).get();
}
bool CLC_VoiceData::WriteToBuffer(bf_write &buffer)
@ -443,7 +443,7 @@ bool CLC_VoiceData::ReadFromBuffer(bf_read &buffer)
const char *CLC_Move::ToString(void) const
{
return strfmt("%s: backup %i, new %i, bytes %i", GetName(), m_nNewCommands,
m_nBackupCommands, Bits2Bytes(m_nLength));
m_nBackupCommands, Bits2Bytes(m_nLength)).get();
}
bool CLC_Move::WriteToBuffer(bf_write &buffer)

View File

@ -79,6 +79,7 @@ void trace::FilterNoPlayer::SetSelf(IClientEntity *self)
bool trace::FilterNoPlayer::ShouldHitEntity(IHandleEntity *handle, int mask)
{
return false;
IClientEntity *entity;
ClientClass *clazz;

View File

@ -112,12 +112,13 @@ ITexture *GetBuffer(int i)
TEXTURE_GROUP_RENDER_TARGET);
else fullframe = g_IMaterialSystemHL->FindTexture(
"_rt_FullFrameFB", TEXTURE_GROUP_RENDER_TARGET);
char *newname = new char[32];
//char *newname = new char[32];
std::unique_ptr<char[]> newname(new char[32]);
std::string name = format("_cathook_buff", i);
strncpy(newname, name.c_str(), 30);
strncpy(newname.get(), name.c_str(), 30);
logging::Info("Creating new buffer %d with size %dx%d %s", i,
fullframe->GetActualWidth(), fullframe->GetActualHeight(),
newname);
newname.get());
int textureFlags = TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT |
TEXTUREFLAGS_EIGHTBITALPHA;
@ -127,7 +128,7 @@ ITexture *GetBuffer(int i)
IF_GAME(IsTF2())
{
texture = g_IMaterialSystem->CreateNamedRenderTargetTextureEx(
newname, fullframe->GetActualWidth(),
newname.get(), fullframe->GetActualWidth(),
fullframe->GetActualHeight(), RT_SIZE_LITERAL,
IMAGE_FORMAT_RGBA8888, MATERIAL_RT_DEPTH_SEPARATE, textureFlags,
renderTargetFlags);
@ -135,12 +136,11 @@ ITexture *GetBuffer(int i)
else
{
texture = g_IMaterialSystemHL->CreateNamedRenderTargetTextureEx(
newname, fullframe->GetActualWidth(),
newname.get(), fullframe->GetActualWidth(),
fullframe->GetActualHeight(), RT_SIZE_LITERAL,
IMAGE_FORMAT_RGBA8888, MATERIAL_RT_DEPTH_SEPARATE, textureFlags,
renderTargetFlags);
}
delete newname;
buffers[i].Init(texture);
}
return buffers[i];

View File

@ -10,7 +10,7 @@
#include <glez/glez.hpp>
#include <glez/draw.hpp>
#include <GL/glew.h>
#include <SDL_video.h>
#include <SDL2/SDL_video.h>
#include <SDLHooks.hpp>
#if EXTERNAL_DRAWING
#include "xoverlay.h"