diff --git a/include/hacks/MiscAimbot.hpp b/include/hacks/MiscAimbot.hpp new file mode 100644 index 00000000..dc338c9a --- /dev/null +++ b/include/hacks/MiscAimbot.hpp @@ -0,0 +1,6 @@ +#pragma once +#include "common.hpp" +namespace hacks::tf2::misc_aimbot +{ +std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range = 600.0f); +} diff --git a/include/reclasses/CTFPlayerShared.hpp b/include/reclasses/CTFPlayerShared.hpp index ead0a616..dff0587c 100644 --- a/include/reclasses/CTFPlayerShared.hpp +++ b/include/reclasses/CTFPlayerShared.hpp @@ -41,5 +41,10 @@ public: static CalculateChargeCap_t CalculateChargeCap_fn = CalculateChargeCap_t(signature); return CalculateChargeCap_fn(self); } + // Get Charge meter (for demoknight things) + inline static float GetChargeMeter(CTFPlayerShared *self) + { + return *(float *) (((uintptr_t) self) + 0x204); + } }; } // namespace re diff --git a/src/hacks/KillfeedColor.cpp b/src/hacks/KillfeedColor.cpp index 37aaa98a..9185751b 100644 --- a/src/hacks/KillfeedColor.cpp +++ b/src/hacks/KillfeedColor.cpp @@ -142,6 +142,11 @@ mov [esp], ecx DONT_SMASH_SMACK(138); DONT_SMASH_SMACK(154); + for (auto &i : color_patches) + i.Patch(); + for (auto &i : no_stack_smash) + i.Patch(); + EC::Register( EC::Shutdown, []() { diff --git a/src/hacks/MiscAimbot.cpp b/src/hacks/MiscAimbot.cpp index f7476a07..fc2ecaa2 100644 --- a/src/hacks/MiscAimbot.cpp +++ b/src/hacks/MiscAimbot.cpp @@ -8,6 +8,7 @@ #include "settings/Key.hpp" #include "PlayerTools.hpp" #include "hacks/Trigger.hpp" +#include "MiscAimbot.hpp" namespace hacks::tf2::misc_aimbot { @@ -19,7 +20,7 @@ float sandwich_speed = 350.0f; float grav = 0.25f; int prevent = -1; -std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check) +std::pair FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check, float range) { CachedEntity *bestent = nullptr; float bestscr = FLT_MAX; @@ -47,8 +48,16 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f) continue; float scr = ent->m_flDistance(); + // Demoknight if (fov_check) + { + if (scr >= range) + continue; scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin()); + // Don't turn too harshly + if (scr >= 140.0f) + continue; + } if (g_pPlayerResource->GetClass(ent) == tf_medic) scr *= 0.5f; if (scr < bestscr) @@ -82,8 +91,16 @@ std::pair FindBestEnt(bool teammate, bool Predict, bool if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f) continue; float scr = ent->m_flDistance(); + // Demoknight if (fov_check) + { + if (scr >= range) + continue; scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin()); + // Don't turn too harshly + if (scr >= 140.0f) + continue; + } if (g_pPlayerResource->GetClass(ent) == tf_medic) scr *= 0.5f; if (scr < bestscr) diff --git a/src/hacks/Warp.cpp b/src/hacks/Warp.cpp index ecb290e4..82a85355 100644 --- a/src/hacks/Warp.cpp +++ b/src/hacks/Warp.cpp @@ -9,6 +9,7 @@ #if ENABLE_VISUALS #include "drawing.hpp" #endif +#include "MiscAimbot.hpp" namespace hacks::tf2::warp { @@ -157,6 +158,8 @@ void CreateMove() { if (!enabled) return; + if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()) + return; warp_override = 0; if (!warp_key.isKeyDown() && !was_hurt) { @@ -221,11 +224,33 @@ void CreateMove() { case ATTACK: { - // Force a crit - criticals::force_crit_this_tick = true; - current_user_cmd->buttons |= IN_ATTACK; - current_state = CHARGE; - should_warp = false; + // Get charge meter (0 - 100 range) + float charge_meter = re::CTFPlayerShared::GetChargeMeter(re::CTFPlayerShared::GetPlayerShared(RAW_ENT(LOCAL_E))); + + // If our charge meter is full + if (charge_meter == 100.0f) + { + // Shield is 750 HU/s with no acceleration at all, convert to HU/tick + float range = 750.0f * g_GlobalVars->interval_per_tick; + // Then multiply by our warp ticks to get actual range + range *= warp_amount; + // Now add a bit of melee range aswell + range += 100.0f; + + // Find an entity meeting the shield aim criteria in range + std::pair result = hacks::tf2::misc_aimbot::FindBestEnt(false, false, true, true, range); + + // We found a good entity within range + if (result.first) + { + // Force a crit + criticals::force_crit_this_tick = true; + current_user_cmd->buttons |= IN_ATTACK; + current_state = CHARGE; + } + } + should_warp = false; + break; } case CHARGE: