Merge remote-tracking branch 'origin/experimental' into experimental

This commit is contained in:
TotallyNotElite 2018-10-28 15:50:38 +01:00
commit 72a1318299
12 changed files with 145 additions and 52 deletions

View File

@ -62,8 +62,10 @@
<Select target="aimbot.priority-mode"> <Select target="aimbot.priority-mode">
<Option name="Smart" value="0"/> <Option name="Smart" value="0"/>
<Option name="FOV" value="1"/> <Option name="FOV" value="1"/>
<Option name="Distance" value="2"/> <Option name="Distance (Closest)" value="2"/>
<Option name="Health" value="3"/> <Option name="Distance (Highest)" value="4"/>
<Option name="Health (Lowest)" value="3"/>
<Option name="Health (Highest)" value="5"/>
</Select> </Select>
</LabeledObject> </LabeledObject>
<AutoVariable width="fill" target="aimbot.target.max-range" label="Max Range" min="0" max="4096"/> <AutoVariable width="fill" target="aimbot.target.max-range" label="Max Range" min="0" max="4096"/>
@ -78,7 +80,7 @@
<AutoVariable width="fill" target="aimbot.slow" label="Slow Aimbot"/> <AutoVariable width="fill" target="aimbot.slow" label="Slow Aimbot"/>
</List> </List>
</Box> </Box>
<Box padding="12 6 6 6" width="content" height="content" name="Target Options" x="380"> <Box padding="12 6 6 6" width="content" height="content" name="Target Options" x="400">
<List width="150"> <List width="150">
<AutoVariable width="fill" target="aimbot.target.sentry" label="Sentry guns"/> <AutoVariable width="fill" target="aimbot.target.sentry" label="Sentry guns"/>
<AutoVariable width="fill" target="aimbot.target.stickybomb" label="Stickybombs"/> <AutoVariable width="fill" target="aimbot.target.stickybomb" label="Stickybombs"/>
@ -96,7 +98,7 @@
<AutoVariable width="fill" target="aimbot.target.other-buildings" label="Other buildings"/> <AutoVariable width="fill" target="aimbot.target.other-buildings" label="Other buildings"/>
</List> </List>
</Box> </Box>
<Box padding="12 6 6 6" width="content" height="content" name="Backtrack" y="140" x="380"> <Box padding="12 6 6 6" width="content" height="content" name="Backtrack" y="140" x="400">
<List width="150"> <List width="150">
<AutoVariable width="fill" target="backtrack.enable" label="Enable Backtrack"/> <AutoVariable width="fill" target="backtrack.enable" label="Enable Backtrack"/>
<AutoVariable width="fill" target="backtrack.draw" label="Draw Backtrack"/> <AutoVariable width="fill" target="backtrack.draw" label="Draw Backtrack"/>

View File

@ -64,12 +64,13 @@
<List width="170"> <List width="170">
<AutoVariable width="fill" target="misc.pathing" label="Enable Pathing"/> <AutoVariable width="fill" target="misc.pathing" label="Enable Pathing"/>
<AutoVariable width="fill" target="misc.pathing.draw" label="Draw Path"/> <AutoVariable width="fill" target="misc.pathing.draw" label="Draw Path"/>
<AutoVariable width="fill" target="navbot.enable" label="Enable NavBot"/> <AutoVariable width="fill" target="navbot.enable" label="Master Switch"/>
<AutoVariable width="fill" target="navbot.sniper-mode" label="Enable Sniper Mode"/>
<AutoVariable width="fill" target="navbot.scout-mode" label="Enable Scout Mode"/>
<AutoVariable width="fill" target="navbot.spy-mode" label="Enable Spy Mode"/> <AutoVariable width="fill" target="navbot.spy-mode" label="Enable Spy Mode"/>
<AutoVariable width="fill" target="navbot.heavy-mode" label="Enable Heavy Mode"/> <AutoVariable width="fill" target="navbot.heavy-mode" label="Enable Heavy Mode"/>
<AutoVariable width="fill" target="navbot.engi-mode" label="Enable Engie Mode"/> <AutoVariable width="fill" target="navbot.engi-mode" label="Enable Engie Mode"/>
<AutoVariable width="fill" target="navbot.primary-only" label="Best Weapon only"/> <AutoVariable width="fill" target="navbot.best-slot" label="Best Weapon only"/>
<AutoVariable width="fill" target="navbot.random-jumps" label="Randomly Jump"/>
<AutoVariable width="fill" target="navbot.jump-distance" label="Jump Distance"/> <AutoVariable width="fill" target="navbot.jump-distance" label="Jump Distance"/>
<AutoVariable width="fill" target="navbot.target-sentry" label="Try to target sentries"/> <AutoVariable width="fill" target="navbot.target-sentry" label="Try to target sentries"/>
<AutoVariable width="fill" target="navbot.stay-near" label="Zone enemies (stay near)"/> <AutoVariable width="fill" target="navbot.stay-near" label="Zone enemies (stay near)"/>

View File

@ -20,5 +20,6 @@ void Jump();
// Path // Path
bool NavToSniperSpot(int priority); bool NavToSniperSpot(int priority);
bool NavToNearestEnemy(); bool NavToNearestEnemy();
bool NavToBacktrackTick(int priority);
} // namespace hacks::shared::NavBot } // namespace hacks::shared::NavBot

View File

@ -18,20 +18,27 @@ class EffectChams : public IScreenSpaceEffect
{ {
public: public:
virtual void Init(); 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); virtual void Render(int x, int y, int w, int h);
inline virtual void Enable(bool bEnable) inline virtual void Enable(bool bEnable)
{ {
enabled = bEnable; enabled = bEnable;
}; }
inline virtual bool IsEnabled() inline virtual bool IsEnabled()
{ {
return enabled; return enabled;
}; }
void SetEntityColor(CachedEntity *ent, rgba_t color); void SetEntityColor(CachedEntity *ent, rgba_t color);
rgba_t ChamsColor(IClientEntity *entity); rgba_t ChamsColor(IClientEntity *entity);

View File

@ -17,20 +17,28 @@ class EffectGlow : public IScreenSpaceEffect
{ {
public: public:
virtual void Init(); 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); virtual void Render(int x, int y, int w, int h);
inline virtual void Enable(bool bEnable) inline virtual void Enable(bool bEnable)
{ {
enabled = bEnable; enabled = bEnable;
}; }
inline virtual bool IsEnabled() inline virtual bool IsEnabled()
{ {
return enabled; return enabled;
}; }
void StartStenciling(); void StartStenciling();
void EndStenciling(); void EndStenciling();

View File

@ -118,7 +118,7 @@ void CreateMove()
current_user_cmd->buttons |= IN_ATTACK2; current_user_cmd->buttons |= IN_ATTACK2;
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun)) 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; current_user_cmd->buttons |= IN_ATTACK2;
// We do this as we need to pass whether the aimkey allows aiming to both // 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 case 1: // Fov Priority
scr = 360.0f - calculated_data_array[ent->m_IDX].fov; scr = 360.0f - calculated_data_array[ent->m_IDX].fov;
break; break;
case 3: // Health Priority case 3: // Health Priority (Lowest)
scr = 450.0f - ent->m_iHealth(); scr = 450.0f - ent->m_iHealth();
break; 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: default:
break; break;
} }

View File

@ -374,6 +374,8 @@ bool ShouldChargePlayer(int idx)
const float damage_accum_duration = const float damage_accum_duration =
g_GlobalVars->curtime - data[idx].accum_damage_start; g_GlobalVars->curtime - data[idx].accum_damage_start;
const int health = target->m_iHealth(); const int health = target->m_iHealth();
if (health > g_pPlayerResource->GetMaxHealth(target))
return false;
if (!data[idx].accum_damage_start) if (!data[idx].accum_damage_start)
return false; return false;
if (health > 30 && data[idx].accum_damage < 45) if (health > 30 && data[idx].accum_damage < 45)

View File

@ -13,6 +13,7 @@
#include <glez/draw.hpp> #include <glez/draw.hpp>
#endif #endif
#include <settings/Bool.hpp> #include <settings/Bool.hpp>
#include "PlayerTools.hpp"
#include <hacks/Backtrack.hpp> #include <hacks/Backtrack.hpp>
static settings::Bool enable{ "backtrack.enable", "false" }; static settings::Bool enable{ "backtrack.enable", "false" };
@ -124,6 +125,8 @@ void Run()
continue; continue;
if (!pEntity->hitboxes.GetHitbox(0)) if (!pEntity->hitboxes.GetHitbox(0))
continue; continue;
if (HasCondition<TFCond_HalloweenGhostMode>(pEntity))
continue;
float _viewangles = CE_VECTOR(pEntity, netvar.m_angEyeAngles).y; float _viewangles = CE_VECTOR(pEntity, netvar.m_angEyeAngles).y;
float viewangles = float viewangles =
(_viewangles > 180) ? _viewangles - 360 : _viewangles; (_viewangles > 180) ? _viewangles - 360 : _viewangles;

View File

@ -257,7 +257,7 @@ void smart_crouch()
if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER || if (CE_BAD(ent) || ent->m_Type() != ENTITY_PLAYER ||
ent->m_iTeam() == LOCAL_E->m_iTeam() || ent->m_iTeam() == LOCAL_E->m_iTeam() ||
!(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) || !(ent->hitboxes.GetHitbox(0)) || !(ent->m_bAlivePlayer()) ||
player_tools::shouldTargetSteamId(ent->player_info.friendsID) != player_tools::shouldTarget(ent) !=
player_tools::IgnoreReason::DO_NOT_IGNORE || player_tools::IgnoreReason::DO_NOT_IGNORE ||
should_ignore_player(ent)) should_ignore_player(ent))
continue; continue;

View File

@ -1,5 +1,6 @@
#include "common.hpp" #include "common.hpp"
#include "NavBot.hpp" #include "NavBot.hpp"
#include "Backtrack.hpp"
#include "PlayerTools.hpp" #include "PlayerTools.hpp"
#include "navparser.hpp" #include "navparser.hpp"
#include "settings/Bool.hpp" #include "settings/Bool.hpp"
@ -77,7 +78,7 @@ void Init(bool from_LevelInit)
} }
static HookedFunction static HookedFunction
CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 10, []() { CreateMove(HookedFunctions_types::HF_CreateMove, "NavBot", 18, []() {
// Master Switch // Master Switch
if (!*enable) if (!*enable)
@ -119,8 +120,9 @@ static HookedFunction
// Stop pathing for ammo/Health if problem resolved // Stop pathing for ammo/Health if problem resolved
if ((!HasLowAmmo() && nav::curr_priority == 6) || ( nav::curr_priority == 7 && !HasLowHealth())) if ((!HasLowAmmo() && nav::curr_priority == 6) || ( nav::curr_priority == 7 && !HasLowHealth()))
nav::clearInstructions(); nav::clearInstructions();
// If Zoning enabled then zone enemy // 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(); NavToNearestEnemy();
// Prevent path spam on sniper bots // Prevent path spam on sniper bots
@ -129,8 +131,13 @@ static HookedFunction
if (sniper_mode) if (sniper_mode)
NavToSniperSpot(5); NavToSniperSpot(5);
else if ((*heavy_mode || scout_mode) && nav_to_nearest_enemy_cooldown.test_and_set(100)) 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)) if (!NavToNearestEnemy() && non_sniper_sniper_nav_cooldown.test_and_set(10000))
NavToSniperSpot(5); 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) if (*pick_optimal_slot)
UpdateSlot(); UpdateSlot();
@ -326,6 +333,36 @@ Vector GetClosestValidByDist(CachedEntity *ent, float mindist, float maxdist, bo
return cached_vector; 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 // Navigation
bool NavToSniperSpot(int priority) bool NavToSniperSpot(int priority)
{ {
@ -430,34 +467,52 @@ bool NavToNearestEnemy()
return false; return false;
} }
void UpdateSlot() bool NavToBacktrackTick(int priority)
{
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(); CachedEntity *ent = nearestEnemy();
if (CE_BAD(ent)) if (CE_BAD(ent))
return; return false;
if (ent->m_flDistance() < *jump_trigger && jump_cooldown.test_and_set(200)) // Health and ammo are more important
current_user_cmd->buttons |= IN_JUMP; 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<hacks::shared::backtrack::BacktrackData>
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 } // namespace hacks::shared::NavBot

View File

@ -32,7 +32,10 @@ static settings::Bool disco_chams{ "chams.disco", "false" };
namespace effect_chams 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() void EffectChams::Init()
{ {
logging::Info("Init EffectChams..."); logging::Info("Init EffectChams...");
@ -79,7 +82,7 @@ void EffectChams::EndRenderChams()
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
g_IVModelRender->ForcedMaterialOverride(nullptr); g_IVModelRender->ForcedMaterialOverride(nullptr);
} }
static rgba_t data[32] = {}; static rgba_t data[32] = {colors::empty};
void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color) void EffectChams::SetEntityColor(CachedEntity *ent, rgba_t color)
{ {
if (ent->m_IDX > 31 || ent->m_IDX < 0) if (ent->m_IDX > 31 || ent->m_IDX < 0)
@ -151,10 +154,11 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
} }
return disco; return disco;
} }
if (data[entity->entindex()]) if (data[entity->entindex()] != colors::empty)
{ {
data[entity->entindex()] = {}; auto toret = data[entity->entindex()];
return data[entity->entindex()]; data[entity->entindex()] = colors::empty;
return toret;
} }
if (CE_BAD(ent)) if (CE_BAD(ent))
return colors::white; return colors::white;
@ -327,7 +331,6 @@ void EffectChams::RenderChams(IClientEntity *entity)
} }
} }
} }
void EffectChams::Render(int x, int y, int w, int h) void EffectChams::Render(int x, int y, int w, int h)
{ {
PROF_SECTION(DRAW_chams); PROF_SECTION(DRAW_chams);
@ -351,7 +354,6 @@ void EffectChams::Render(int x, int y, int w, int h)
} }
EndRenderChams(); EndRenderChams();
} }
EffectChams g_EffectChams; EffectChams g_EffectChams;
CScreenSpaceEffectRegistration *g_pEffectChams = nullptr; CScreenSpaceEffectRegistration *g_pEffectChams = nullptr;
} // namespace effect_chams } // namespace effect_chams

View File

@ -138,6 +138,11 @@ static ShaderStencilState_t SS_SolidInvisible{};
static ShaderStencilState_t SS_Null{}; static ShaderStencilState_t SS_Null{};
static ShaderStencilState_t SS_Drawing{}; 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() void EffectGlow::Init()
{ {
logging::Info("Init Glow..."); logging::Info("Init Glow...");