From 97a7c0c23865bb2df8399c586a16f1a5b279c691 Mon Sep 17 00:00:00 2001 From: LightCat Date: Tue, 21 Aug 2018 20:32:35 +0200 Subject: [PATCH 1/6] Ammo <= 5 --- src/hacks/NavBot.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 8079f98f..39975ffe 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -66,9 +66,9 @@ bool HasLowAmmo() { IClientEntity *weapon = g_IEntityList->GetClientEntity(eid); if (weapon and - re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon) and - re::C_TFWeaponBase::UsesPrimaryAmmo(weapon) and - not re::C_TFWeaponBase::HasPrimaryAmmo(weapon)) + re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon) && + re::C_TFWeaponBase::UsesPrimaryAmmo(weapon) && + (!re::C_TFWeaponBase::HasPrimaryAmmo(weapon) || NET_INT(weapon, netvar.m_iAmmo + 4) <= 5)) return true; } } From 67797f379c5073555712feeaf5bc6eabd9d6d0df Mon Sep 17 00:00:00 2001 From: LightCat Date: Tue, 21 Aug 2018 20:45:21 +0200 Subject: [PATCH 2/6] Ammo check fix pls --- src/hacks/NavBot.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 39975ffe..f82e181e 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -58,6 +58,8 @@ bool HasLowAmmo() { int *weapon_list = (int *) ((unsigned) (RAW_ENT(LOCAL_E)) + netvar.hMyWeapons); + if (g_pLocalPlayer->holding_sniper_rifle && NET_INT(LOCAL_W, netvar.m_iAmmo + 4) <= 5) + return true; for (int i = 0; weapon_list[i]; i++) { int handle = weapon_list[i]; @@ -68,7 +70,7 @@ bool HasLowAmmo() if (weapon and re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon) && re::C_TFWeaponBase::UsesPrimaryAmmo(weapon) && - (!re::C_TFWeaponBase::HasPrimaryAmmo(weapon) || NET_INT(weapon, netvar.m_iAmmo + 4) <= 5)) + !re::C_TFWeaponBase::HasPrimaryAmmo(weapon)) return true; } } From 4a8f96353641e49cd300eac4cf128ae5d4a3042f Mon Sep 17 00:00:00 2001 From: LightCat Date: Tue, 21 Aug 2018 20:50:19 +0200 Subject: [PATCH 3/6] this is so sad --- src/hacks/NavBot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index f82e181e..28ed0a1a 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -58,7 +58,7 @@ bool HasLowAmmo() { int *weapon_list = (int *) ((unsigned) (RAW_ENT(LOCAL_E)) + netvar.hMyWeapons); - if (g_pLocalPlayer->holding_sniper_rifle && NET_INT(LOCAL_W, netvar.m_iAmmo + 4) <= 5) + if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_W, netvar.m_iAmmo + 4) <= 5) return true; for (int i = 0; weapon_list[i]; i++) { From f0ee53b3d6f986617bf789ec7a67f587a55fc686 Mon Sep 17 00:00:00 2001 From: LightCat Date: Tue, 21 Aug 2018 21:02:29 +0200 Subject: [PATCH 4/6] fixix --- src/hacks/NavBot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 28ed0a1a..dd1589f3 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -58,7 +58,7 @@ bool HasLowAmmo() { int *weapon_list = (int *) ((unsigned) (RAW_ENT(LOCAL_E)) + netvar.hMyWeapons); - if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_W, netvar.m_iAmmo + 4) <= 5) + if (g_pLocalPlayer->holding_sniper_rifle && CE_INT(LOCAL_E, netvar.m_iAmmo + 4) <= 5) return true; for (int i = 0; weapon_list[i]; i++) { From 546702cb63a36f6586c0ff6ee1968c1893f1c125 Mon Sep 17 00:00:00 2001 From: LightCat Date: Wed, 22 Aug 2018 13:01:20 +0200 Subject: [PATCH 5/6] sniper spot changes --- src/hacks/NavBot.cpp | 81 +++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index dd1589f3..e52999e6 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -187,10 +187,14 @@ void Init() sniper_spots.size(), preferred_sniper_spots.size(), nest_spots.size()); } +// I doubtwe'd use more than 128 Sniper spots +std::array priority_spots; void initonce() { for (int i = 0; i < afkTicks.size(); i++) afkTicks[i].update(); + for (auto &e :priority_spots) + e = 0; cdr.update(); cd2.update(); cd3.update(); @@ -291,6 +295,43 @@ int GetClosestBuilding() } return BestBuilding; } + +void NavToSniperSpot(int priority) +{ + Vector random_spot; + if (!sniper_spots.size() && !preferred_sniper_spots.size()) + return; + auto snip_spot = preferred_sniper_spots.size() + ? preferred_sniper_spots + : sniper_spots; + int best_spot = -1; + float maxscr = FLT_MAX; + int lowest_priority = 9999; + for (int i = 0; i < snip_spot.size();i++) + { + if ((priority_spots[i] < lowest_priority)) + lowest_priority = priority_spots[i]; + } + for (int i = 0; i < snip_spot.size();i++) + { + if ((priority_spots[i] > lowest_priority)) + continue; + float scr = snip_spot[i].DistTo(g_pLocalPlayer->v_Eye); + if (scr < maxscr) + { + maxscr = scr; + best_spot = i; + } + } + + if (best_spot == -1) + return; + random_spot = snip_spot.at(best_spot); + if (random_spot.z) + nav::NavTo(random_spot, false, true, priority); + priority_spots[best_spot]++; + return; +} int follow_target = 0; void CreateMove() { @@ -327,38 +368,18 @@ void CreateMove() if (!spy_mode && !heavy_mode && !engi_mode) { cd3.update(); - Vector random_spot; if (cd2.test_and_set(5000)) Init(); - if (!sniper_spots.size() && !preferred_sniper_spots.size()) - return; - auto snip_spot = preferred_sniper_spots.size() - ? preferred_sniper_spots - : sniper_spots; - int rng = rand() % snip_spot.size(); - random_spot = snip_spot.at(rng); - if (random_spot.z) - nav::NavTo(random_spot, true, true); - return; + NavToSniperSpot(5); } else if (!engi_mode) { CachedEntity *tar = NearestEnemy(); if (CE_BAD(tar) && last_tar == -1 && nav::ReadyForCommands) { - Vector random_spot; if (cd2.test_and_set(5000)) Init(); - if (!sniper_spots.size() && !preferred_sniper_spots.size()) - return; - auto snip_spot = preferred_sniper_spots.size() - ? preferred_sniper_spots - : sniper_spots; - int rng = rand() % snip_spot.size(); - random_spot = snip_spot.at(rng); - if (random_spot.z) - nav::NavTo(random_spot, false); - return; + NavToSniperSpot(5); } if (CE_GOOD(tar)) { @@ -414,7 +435,7 @@ void CreateMove() } } // If Near The best spot and ready for commands - if (best_spot.DistTo(LOCAL_E->m_vecOrigin()) < 300.0f && + if (best_spot.DistTo(LOCAL_E->m_vecOrigin()) < 200.0f && (nav::ReadyForCommands || nav::priority == 1)) { // Get the closest Building @@ -469,7 +490,7 @@ void CreateMove() fClampAngle(angles); current_user_cmd->viewangles = angles; current_user_cmd->buttons |= IN_ATTACK; - g_pLocalPlayer->bUseSilentAngles = false; + g_pLocalPlayer->bUseSilentAngles = true; return; } } @@ -487,19 +508,9 @@ void CreateMove() // Ammo is dormant, go and find it! else if (sniper_spots.size() && nav::ReadyForCommands) { - Vector random_spot; if (cd2.test_and_set(5000)) Init(); - if (!sniper_spots.size() && - !preferred_sniper_spots.size()) - return; - auto snip_spot = preferred_sniper_spots.size() - ? preferred_sniper_spots - : sniper_spots; - int rng = rand() % snip_spot.size(); - random_spot = snip_spot.at(rng); - if (random_spot.z) - nav::NavTo(random_spot, false, false, 1); + NavToSniperSpot(1); return; } } From c31313d81d35abc50b9494e956eba18b5366fe27 Mon Sep 17 00:00:00 2001 From: LightCat Date: Wed, 22 Aug 2018 19:17:52 +0200 Subject: [PATCH 6/6] Comp bypass:tm: --- include/reclasses/CTFPartyClient.hpp | 12 +++++++++++- include/reclasses/reclasses.hpp | 1 + src/hack.cpp | 11 +++++++++++ src/hacks/NavBot.cpp | 2 -- src/reclasses/CTFPartyClient.cpp | 11 +++++++++++ 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/include/reclasses/CTFPartyClient.hpp b/include/reclasses/CTFPartyClient.hpp index b901eb30..b8d97be7 100644 --- a/include/reclasses/CTFPartyClient.hpp +++ b/include/reclasses/CTFPartyClient.hpp @@ -6,7 +6,7 @@ */ #pragma once - +#include "reclasses.hpp" namespace re { @@ -26,4 +26,14 @@ public: int BRequestJoinPlayer(CSteamID steamid); static bool BInQueue(CTFPartyClient *this_); }; + class ITFMatchGroupDescription + { + public: + char pad0[4]; + int m_iID; + char pad1[63]; + bool m_bForceCompetitiveSettings; + }; + + ITFMatchGroupDescription* GetMatchGroupDescription(int& idx); } // namespace re diff --git a/include/reclasses/reclasses.hpp b/include/reclasses/reclasses.hpp index 45e15514..320dd084 100755 --- a/include/reclasses/reclasses.hpp +++ b/include/reclasses/reclasses.hpp @@ -10,6 +10,7 @@ #include "common.hpp" #include "C_BaseEntity.hpp" +#include "ITFGroupMatchCriteria.hpp" #include "CTFPlayerShared.hpp" #include "C_BasePlayer.hpp" #include "C_BaseCombatWeapon.hpp" diff --git a/src/hack.cpp b/src/hack.cpp index 988edbc2..7784697d 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -403,6 +403,17 @@ free(logname);*/ logging::Info("Initializer stack done"); hack::initialized = true; + for (int i = 0; i < 12; i++) + { + re::ITFMatchGroupDescription* desc = re::GetMatchGroupDescription(i); + if (!desc || desc->m_iID > 9) //ID's over 9 are invalid + continue; + if (desc->m_bForceCompetitiveSettings) + { + desc->m_bForceCompetitiveSettings = false; + logging::Info("Bypassed force competitive cvars!"); + } + } } void hack::Think() diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index e52999e6..997148c3 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -48,9 +48,7 @@ void checkAFK() if (CE_BAD(entity)) continue; if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(60.0f)) - { afkTicks[i].update(); - } } } diff --git a/src/reclasses/CTFPartyClient.cpp b/src/reclasses/CTFPartyClient.cpp index a326101b..7d3fa76a 100755 --- a/src/reclasses/CTFPartyClient.cpp +++ b/src/reclasses/CTFPartyClient.cpp @@ -119,3 +119,14 @@ int re::CTFPartyClient::BRequestJoinPlayer(CSteamID steamid) BRequestJoinPlayer_t(addr); return BRequestJoinPlayer_fn(this, steamid, false); } +re::ITFMatchGroupDescription * +re::GetMatchGroupDescription(int &idx) +{ + typedef re::ITFMatchGroupDescription *( + *GetMatchGroupDescription_t)(int&); + static uintptr_t addr = gSignatures.GetClientSignature("55 89 E5 8B 45 08 8B 00 83 F8 FF"); + static GetMatchGroupDescription_t GetMatchGroupDescription_fn = + GetMatchGroupDescription_t(addr); + + return GetMatchGroupDescription_fn(idx); +}