diff --git a/data/menu/nullifiedcat/aimbot.xml b/data/menu/nullifiedcat/aimbot.xml index 1eb15795..fff51745 100755 --- a/data/menu/nullifiedcat/aimbot.xml +++ b/data/menu/nullifiedcat/aimbot.xml @@ -62,8 +62,10 @@ @@ -78,7 +80,7 @@ - + @@ -96,7 +98,7 @@ - + diff --git a/data/menu/nullifiedcat/catbot.xml b/data/menu/nullifiedcat/catbot.xml index dec78153..b0de2d0c 100755 --- a/data/menu/nullifiedcat/catbot.xml +++ b/data/menu/nullifiedcat/catbot.xml @@ -64,12 +64,13 @@ - + + + - - + diff --git a/include/hacks/NavBot.hpp b/include/hacks/NavBot.hpp index bb1cd5e5..f8a97754 100644 --- a/include/hacks/NavBot.hpp +++ b/include/hacks/NavBot.hpp @@ -20,5 +20,6 @@ void Jump(); // Path bool NavToSniperSpot(int priority); bool NavToNearestEnemy(); +bool NavToBacktrackTick(int priority); } // namespace hacks::shared::NavBot diff --git a/include/visual/EffectChams.hpp b/include/visual/EffectChams.hpp index 25aba678..ab9f4148 100644 --- a/include/visual/EffectChams.hpp +++ b/include/visual/EffectChams.hpp @@ -18,20 +18,27 @@ class EffectChams : public IScreenSpaceEffect { public: virtual void Init(); - inline virtual void Shutdown(){}; + inline virtual void Shutdown() + { + mat_unlit.Shutdown(); + mat_unlit_z.Shutdown(); + mat_lit.Shutdown(); + mat_lit_z.Shutdown(); + init = false; + } - inline virtual void SetParameters(KeyValues *params){}; + inline virtual void SetParameters(KeyValues *params){} virtual void Render(int x, int y, int w, int h); inline virtual void Enable(bool bEnable) { enabled = bEnable; - }; + } inline virtual bool IsEnabled() { return enabled; - }; + } void SetEntityColor(CachedEntity *ent, rgba_t color); rgba_t ChamsColor(IClientEntity *entity); diff --git a/include/visual/EffectGlow.hpp b/include/visual/EffectGlow.hpp index f9bec227..a1d24760 100644 --- a/include/visual/EffectGlow.hpp +++ b/include/visual/EffectGlow.hpp @@ -17,20 +17,28 @@ class EffectGlow : public IScreenSpaceEffect { public: virtual void Init(); - inline virtual void Shutdown(){}; + inline virtual void Shutdown(){ + mat_unlit.Shutdown(); + mat_unlit_z.Shutdown(); + mat_blit.Shutdown(); + mat_unlit.Shutdown(); + mat_unlit_z.Shutdown(); + mat_blur_x.Shutdown(); + mat_blur_y.Shutdown(); + } - inline virtual void SetParameters(KeyValues *params){}; + inline virtual void SetParameters(KeyValues *params){} virtual void Render(int x, int y, int w, int h); inline virtual void Enable(bool bEnable) { enabled = bEnable; - }; + } inline virtual bool IsEnabled() { return enabled; - }; + } void StartStenciling(); void EndStenciling(); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index b6e1c1af..f969cdc1 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -118,7 +118,7 @@ void CreateMove() current_user_cmd->buttons |= IN_ATTACK2; if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun)) - if (auto_spin_up && !zoomTime.check(3000)) + if (auto_spin_up && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0 && !zoomTime.check(1000)) current_user_cmd->buttons |= IN_ATTACK2; // We do this as we need to pass whether the aimkey allows aiming to both @@ -401,9 +401,16 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state) case 1: // Fov Priority scr = 360.0f - calculated_data_array[ent->m_IDX].fov; break; - case 3: // Health Priority + case 3: // Health Priority (Lowest) scr = 450.0f - ent->m_iHealth(); break; + case 4: // Distance Priority (Furthest Away) + scr = calculated_data_array[i].aim_position.DistTo( + g_pLocalPlayer->v_Eye); + break; + case 6: // Health Priority (Highest) + scr = ent->m_iHealth(); + break; default: break; } diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index 8f61604d..989cd35e 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -374,6 +374,8 @@ bool ShouldChargePlayer(int idx) const float damage_accum_duration = g_GlobalVars->curtime - data[idx].accum_damage_start; const int health = target->m_iHealth(); + if (health > g_pPlayerResource->GetMaxHealth(target)) + return false; if (!data[idx].accum_damage_start) return false; if (health > 30 && data[idx].accum_damage < 45) diff --git a/src/hacks/Backtrack.cpp b/src/hacks/Backtrack.cpp index 9debf59c..e8f31490 100644 --- a/src/hacks/Backtrack.cpp +++ b/src/hacks/Backtrack.cpp @@ -13,6 +13,7 @@ #include #endif #include +#include "PlayerTools.hpp" #include static settings::Bool enable{ "backtrack.enable", "false" }; @@ -124,6 +125,8 @@ void Run() continue; if (!pEntity->hitboxes.GetHitbox(0)) continue; + if (HasCondition(pEntity)) + continue; float _viewangles = CE_VECTOR(pEntity, netvar.m_angEyeAngles).y; float viewangles = (_viewangles > 180) ? _viewangles - 360 : _viewangles; diff --git a/src/hacks/CatBot.cpp b/src/hacks/CatBot.cpp index 1e35f67a..f91a8eb1 100644 --- a/src/hacks/CatBot.cpp +++ b/src/hacks/CatBot.cpp @@ -257,7 +257,7 @@ void smart_crouch() if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER || ent->m_iTeam() == LOCAL_E->m_iTeam() || !(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) || - player_tools::shouldTargetSteamId(ent->player_info.friendsID) != + player_tools::shouldTarget(ent) != player_tools::IgnoreReason::DO_NOT_IGNORE || should_ignore_player(ent)) continue; diff --git a/src/hacks/NavBot.cpp b/src/hacks/NavBot.cpp index 7e2e0276..2c6badaf 100644 --- a/src/hacks/NavBot.cpp +++ b/src/hacks/NavBot.cpp @@ -1,5 +1,6 @@ #include "common.hpp" #include "NavBot.hpp" +#include "Backtrack.hpp" #include "PlayerTools.hpp" #include "navparser.hpp" #include "settings/Bool.hpp" @@ -77,7 +78,7 @@ void Init(bool from_LevelInit) } static HookedFunction - CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 10, []() { + CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 18, []() { // Master Switch if (!*enable) @@ -119,8 +120,9 @@ static HookedFunction // Stop pathing for ammo/Health if problem resolved if ((!HasLowAmmo() && nav::curr_priority == 6) || ( nav::curr_priority == 7 && !HasLowHealth())) nav::clearInstructions(); + // If Zoning enabled then zone enemy - if (stay_near && nav_to_nearest_enemy_cooldown.test_and_set(100)) + if (stay_near && nav_to_nearest_enemy_cooldown.test_and_set(100) && !*spy_mode) NavToNearestEnemy(); // Prevent path spam on sniper bots @@ -129,8 +131,13 @@ static HookedFunction if (sniper_mode) NavToSniperSpot(5); else if ((*heavy_mode || scout_mode) && nav_to_nearest_enemy_cooldown.test_and_set(100)) + { if (!NavToNearestEnemy() && non_sniper_sniper_nav_cooldown.test_and_set(10000)) NavToSniperSpot(5); + } + else if (*spy_mode && nav_to_nearest_enemy_cooldown.test_and_set(100)) + if (!NavToBacktrackTick(5) && non_sniper_sniper_nav_cooldown.test_and_set(10000)) + NavToSniperSpot(5); } if (*pick_optimal_slot) UpdateSlot(); @@ -326,6 +333,36 @@ Vector GetClosestValidByDist(CachedEntity *ent, float mindist, float maxdist, bo return cached_vector; } +void UpdateSlot() +{ + if (!slot_timer.test_and_set(1000)) + return; + if (CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && !g_pLocalPlayer->life_state) + { + IClientEntity *weapon = RAW_ENT(LOCAL_W); + // IsBaseCombatWeapon() + if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon)) + { + int slot = re::C_BaseCombatWeapon::GetSlot(weapon); + int newslot = 1; + if (*spy_mode) + newslot = 3; + if (slot != newslot - 1) + g_IEngine->ClientCmd_Unrestricted( + format("slot", newslot).c_str()); + } + } +} + +void Jump() +{ + CachedEntity *ent = nearestEnemy(); + if (CE_BAD(ent)) + return; + if (ent->m_flDistance() < *jump_trigger && jump_cooldown.test_and_set(200)) + current_user_cmd->buttons |= IN_JUMP; +} + // Navigation bool NavToSniperSpot(int priority) { @@ -430,34 +467,52 @@ bool NavToNearestEnemy() return false; } -void UpdateSlot() -{ - if (!slot_timer.test_and_set(1000)) - return; - if (CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && !g_pLocalPlayer->life_state) - { - IClientEntity *weapon = RAW_ENT(LOCAL_W); - // IsBaseCombatWeapon() - if (re::C_BaseCombatWeapon::IsBaseCombatWeapon(weapon)) - { - int slot = re::C_BaseCombatWeapon::GetSlot(weapon); - int newslot = 1; - if (*spy_mode) - newslot = 3; - if (slot != newslot - 1) - g_IEngine->ClientCmd_Unrestricted( - format("slot", newslot).c_str()); - } - } -} - -void Jump() +bool NavToBacktrackTick(int priority) { CachedEntity *ent = nearestEnemy(); if (CE_BAD(ent)) - return; - if (ent->m_flDistance() < *jump_trigger && jump_cooldown.test_and_set(200)) - current_user_cmd->buttons |= IN_JUMP; + return false; + // Health and ammo are more important + if (nav::curr_priority == 6 || nav::curr_priority == 7) + return false; + // Just backtrack data + auto unsorted_ticks = hacks::shared::backtrack:: + headPositions[ent->m_IDX]; + // Vector needed for later + std::vector + sorted_ticks; + + // Only use good ticks + for (int i = 0; i < 66; i++) + { + if (hacks::shared::backtrack::ValidTick( + unsorted_ticks[i], ent)) + sorted_ticks.push_back(unsorted_ticks[i]); + } + // Nav to Ent origin if everything falls flat + if (sorted_ticks.empty()) + { + if (nav::navTo(ent->m_vecOrigin(), 5, false, false)) + return true; + return false; + } + // Sort by tickcount + std::sort( + sorted_ticks.begin(), sorted_ticks.end(), + [](const hacks::shared::backtrack::BacktrackData + &a, + const hacks::shared::backtrack::BacktrackData + &b) { + return a.tickcount > b.tickcount; + }); + + // Get the 5th tick and path to it, better than pathing to the last tick since the bot may just lag behind and never reach it + if (!sorted_ticks[5].tickcount || + !nav::navTo(sorted_ticks[5].entorigin, priority, false, + false)) + if (!nav::navTo(ent->m_vecOrigin(), priority, false)) + return false; + return true; } } // namespace hacks::shared::NavBot diff --git a/src/visual/EffectChams.cpp b/src/visual/EffectChams.cpp index 6eeab5d5..9b7fe0be 100644 --- a/src/visual/EffectChams.cpp +++ b/src/visual/EffectChams.cpp @@ -32,7 +32,10 @@ static settings::Bool disco_chams{ "chams.disco", "false" }; namespace effect_chams { - +CatCommand fix_black_chams("fix_black_chams", "Fix Black Chams", [](){ + effect_chams::g_EffectChams.Shutdown(); + effect_chams::g_EffectChams.Init(); +}); void EffectChams::Init() { logging::Info("Init EffectChams..."); @@ -79,7 +82,7 @@ void EffectChams::EndRenderChams() CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); g_IVModelRender->ForcedMaterialOverride(nullptr); } -static rgba_t data[32] = {}; +static rgba_t data[32] = {colors::empty}; void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color) { if (ent->m_IDX > 31 || ent->m_IDX < 0) @@ -151,10 +154,11 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity) } return disco; } - if (data[entity->entindex()]) + if (data[entity->entindex()] != colors::empty) { - data[entity->entindex()] = {}; - return data[entity->entindex()]; + auto toret = data[entity->entindex()]; + data[entity->entindex()] = colors::empty; + return toret; } if (CE_BAD(ent)) return colors::white; @@ -327,7 +331,6 @@ void EffectChams::RenderChams(IClientEntity *entity) } } } - void EffectChams::Render(int x, int y, int w, int h) { PROF_SECTION(DRAW_chams); @@ -351,7 +354,6 @@ void EffectChams::Render(int x, int y, int w, int h) } EndRenderChams(); } - EffectChams g_EffectChams; CScreenSpaceEffectRegistration *g_pEffectChams = nullptr; } // namespace effect_chams diff --git a/src/visual/EffectGlow.cpp b/src/visual/EffectGlow.cpp index d80e1839..b157a750 100644 --- a/src/visual/EffectGlow.cpp +++ b/src/visual/EffectGlow.cpp @@ -138,6 +138,11 @@ static ShaderStencilState_t SS_SolidInvisible{}; static ShaderStencilState_t SS_Null{}; static ShaderStencilState_t SS_Drawing{}; +CatCommand fix_black_glow("fix_black_glow", "Fix Black Glow", [](){ + effect_glow::g_EffectGlow.Shutdown(); + effect_glow::g_EffectGlow.Init(); +}); + void EffectGlow::Init() { logging::Info("Init Glow...");