-
Автор темы
- #1
C++:
int GetPlayerHP( Player* player ) {
return std::min( 100, player->m_iHealth( ) );
}
float GetMinimalDamage( float damage, int hp ) {
int half_hp = hp / 2;
if ( hp < damage )
return hp + 5;
else if ( half_hp < damage )
return std::ceil( ( half_hp )+5 );
else
return std::ceil( ( damage / 100.f ) * hp );
}
bool GetPenetrationStatus( bool can_penetrate, int weapon_id, int hp ) {
if ( weapon_id == ZEUS )
return true;
return can_penetrate;
}
bool GetPenetrationStatus( bool can_penetrate, int weapon_id, int hp ) {
if ( weapon_id == ZEUS )
return true;
return can_penetrate;
}
penetration::PenetrationInput_t GetPenetrationInput( float minimal_damage,
float penetrate_minimal_damage,
bool can_penetrate,
Player* player,
vec3_t point,
int hitscan_mode ) {
penetration::PenetrationInput_t in;
in.m_damage = minimal_damage;
in.m_damage_pen = penetrate_minimal_damage;
in.m_can_pen = can_penetrate;
in.m_target = player;
in.m_from = g_cl.m_local;
in.m_pos = point;
return in;
}
bool IsValidHitgroup( int hitbox, int hitgroup ) {
if ( hitgroup <= HITGROUP_GENERIC || hitgroup >= HITGROUP_GEAR )
return false;
return true;
}
bool IsPreferredHitscanMode( HitscanMode mode ) {
return mode == PREFER;
}
bool IsLethalHitscanMode( HitscanMode mode ) {
return mode == LETHAL;
}
bool AimPlayer::GetBestAimPosition(vec3_t& aim, float& damage, LagRecord* record) {
int hp = GetPlayerHP( m_player );
float minimal_damage = GetMinimalDamage( g_menu.main.aimbot.minimal_damage.get( ), hp );
float penetrate_minimal_damage = GetMinimalDamage( g_menu.main.aimbot.penetrate_minimal_damage.get( ), hp );
bool can_penetrate = GetPenetrationStatus( g_menu.main.aimbot.penetrate.get( ), g_cl.m_weapon_id, hp );
record->cache( );
HitscanData_t scan;
for ( const auto& it : m_hitboxes ) {
std::vector<vec3_t> points;
if ( !SetupHitboxPoints( record, record->m_bones, it.m_index, points ) )
continue;
for ( const auto& point : points ) {
penetration::PenetrationInput_t in = GetPenetrationInput( minimal_damage, penetrate_minimal_damage, can_penetrate, m_player, point, it.m_mode );
penetration::PenetrationOutput_t out;
if ( penetration::run( &in, &out ) ) {
if ( !IsValidHitgroup( it.m_index, out.m_hitgroup ) )
continue;
if ( IsPreferredHitscanMode( it.m_mode ) ) {
aim = point;
damage = out.m_damage;
return true;
}
else if ( IsLethalHitscanMode( it.m_mode ) ) {
scan.m_damage = std::max( scan.m_damage, out.m_damage );
scan.m_pos = point;
}
}
}
}
if (scan.m_damage > 0.f) {
aim = scan.m_pos;
damage = scan.m_damage;
return true;
}
return false;
}