From 4a53204965489d24725631ce4997c596c9205a21 Mon Sep 17 00:00:00 2001 From: navewindre Date: Tue, 11 Sep 2018 00:27:00 +0200 Subject: a --- internal_rewrite/ragebot.cpp | 309 +++++++++++++++++++++++-------------------- 1 file changed, 165 insertions(+), 144 deletions(-) (limited to 'internal_rewrite/ragebot.cpp') diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 1638a55..f458bdc 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -675,186 +675,193 @@ namespace features return -1; } - c_ragebot::aim_target_t c_ragebot::find_best_target( ) { - aim_target_t ret{ -1, m_cmd->m_tick_count, -1, vec3_t{ }, vec3_t{ }, vec3_t{ }, 0.f, 0 }; - vec3_t aim_angle{ }; - vec3_t local_pos{ }; - vec3_t aim_pos{ }; - auto weapon_info = g_ctx.m_local->get_weapon( )->get_wpn_info( ); - bool is_zeus = g_ctx.m_local->get_weapon( )->m_iItemDefinitionIndex( ) == WEAPON_TASER; - int damage = weapon_info->damage; + bool c_ragebot::can_hit_target( int it, aim_target_t* ret, bool zeus ) { + vec3_t aim_ang; + vec3_t aim_pos; + vec3_t local_pos = g_ctx.m_local->get_eye_pos( ); - local_pos = g_ctx.m_local->get_eye_pos( ); + auto entity = g_csgo.m_entlist( )->GetClientEntity< >( it ); + if( !entity || !entity->is_valid( ) || entity == g_ctx.m_local ) + return false; + if( entity->m_bGunGameImmunity( ) ) + return false; + if( !entity->has_valid_anim( ) ) + return false; - auto players = get_sorted_targets( ); - auto data = players.data( ); + bool baim = false; + bool should_baim = true; + bool backtracked = false; + bool restore = false; + float hit_damage = 0.f; + vec3_t extrapolate{ }; - for( size_t i{ }; i < players.size( ); ++i ) { - auto& it = data[ i ]; - - auto entity = g_csgo.m_entlist( )->GetClientEntity< >( it ); - if( !entity || !entity->is_valid( ) || entity == g_ctx.m_local ) continue; - if( entity->m_bGunGameImmunity( ) ) continue; - if( !entity->has_valid_anim( ) ) continue; - - bool baim = false; - bool should_baim = true; - bool backtracked = false; - bool restore = false; - float hit_damage = 0.f; - vec3_t extrapolate{ }; - - lag_record_t original_record( entity ); - lag_record_t* backtracked_record{ }; - - int tick_count = m_cmd->m_tick_count; - float lerp = util::get_lerptime( ); - auto record_type = m_lagcomp->can_backtrack_entity( it ); - if( !g_settings.rage.resolver( ) ) { - if( !util::is_tick_valid( entity->m_flSimulationTime( ) + lerp ) ) { - int new_tickcount = m_lagcomp->backtrack_entity( it, - record_type, &backtracked_record ); - - if( new_tickcount != -1 ) { - restore = true; - tick_count = new_tickcount; - } - else if( g_settings.misc.net_fakelag == 4 && can_hit_without_ping( it ) ) { - m_can_fakeping = false; - } + lag_record_t original_record( entity ); + lag_record_t* backtracked_record{ }; + + int tick_count = m_cmd->m_tick_count; + float lerp = util::get_lerptime( ); + auto record_type = m_lagcomp->can_backtrack_entity( it ); + if( !g_settings.rage.resolver( ) ) { + if( !util::is_tick_valid( entity->m_flSimulationTime( ) + lerp ) ) { + int new_tickcount = m_lagcomp->backtrack_entity( it, + record_type, &backtracked_record ); + + if( new_tickcount != -1 ) { + restore = true; + tick_count = new_tickcount; + } + else if( g_settings.misc.net_fakelag == 4 && can_hit_without_ping( it ) ) { + m_can_fakeping = false; } } + } + else { + int new_tickcount = m_lagcomp->backtrack_entity( it, record_type, &backtracked_record ); + if( new_tickcount != -1 ) { + tick_count = new_tickcount; + should_baim = record_type != RECORD_LBY; + backtracked = record_type == RECORD_LBY; + restore = true; + } else { - int new_tickcount = m_lagcomp->backtrack_entity( it, record_type, &backtracked_record ); - if( new_tickcount != -1 ) { - tick_count = new_tickcount; - should_baim = record_type != RECORD_LBY; - backtracked = record_type == RECORD_LBY; - restore = true; + if( g_settings.misc.net_fakelag == 4 ) { + //if( can_hit_without_ping( it ) ) + // m_can_fakeping = false; } - else { - if( g_settings.misc.net_fakelag == 4 ) { - //if( can_hit_without_ping( it ) ) - // m_can_fakeping = false; - } - lag_record_t* last_simtime_record = m_lagcomp->get_newest_valid_record( it ); - if( last_simtime_record ) { - //ENSURE THE MOST ACCURATE DATA - entity->m_vecVelocity( ) = entity->get_animdata( ).m_last_velocity; - - auto velocity = entity->m_vecVelocity( ); - auto min_vel = 64 / TICK_INTERVAL( ) / 14; + lag_record_t* last_simtime_record = m_lagcomp->get_newest_valid_record( it ); + if( last_simtime_record ) { + //ENSURE THE MOST ACCURATE DATA + entity->m_vecVelocity( ) = entity->get_animdata( ).m_last_velocity; + + auto velocity = entity->m_vecVelocity( ); + auto min_vel = 64 / TICK_INTERVAL( ) / 14; - //IS HE A SLOW BOI OR A FAST NIGGER - if( g_settings.rage.fakelag_resolver( ) && velocity.length2d( ) > min_vel - 10.f ) { - auto new_record = *last_simtime_record; + //IS HE A SLOW BOI OR A FAST NIGGER + if( g_settings.rage.fakelag_resolver( ) && velocity.length2d( ) > min_vel - 10.f ) { + auto new_record = *last_simtime_record; - //FUCK FAKE PINGERS WE IN THIS BITCH - auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); //GOD FUCKING KNOWS WHY - float latency = nci->GetLatency( 0 ) + g_csgo.m_globals->m_frametime; + //FUCK FAKE PINGERS WE IN THIS BITCH + auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); //GOD FUCKING KNOWS WHY + float latency = nci->GetLatency( 0 ) + g_csgo.m_globals->m_frametime; - auto pred_choke = g_cheat.m_prediction.get_predicted_choke( it ); - auto latency_ticks = TIME_TO_TICKS( latency ); + auto pred_choke = g_cheat.m_prediction.get_predicted_choke( it ); + auto latency_ticks = TIME_TO_TICKS( latency ); - float time_since_update = g_ctx.pred_time( ) + latency - entity->m_flSimulationTime( ); + float time_since_update = g_ctx.pred_time( ) + latency - entity->m_flSimulationTime( ); - //NIGGA UPDATED ALREADY FUCK ADAPTIVE - if( TIME_TO_TICKS( time_since_update ) > pred_choke && pred_choke > 0 ) { - if( g_settings.rage.fakelag_resolver( ) == 1 ) - continue; + //NIGGA UPDATED ALREADY FUCK ADAPTIVE + if( TIME_TO_TICKS( time_since_update ) > pred_choke && pred_choke > 0 ) { + if( g_settings.rage.fakelag_resolver( ) == 1 ) + return false; - else if( latency_ticks > 0 ) { - int update_count = TIME_TO_TICKS( time_since_update ) / pred_choke; + else if( latency_ticks > 0 ) { + int update_count = TIME_TO_TICKS( time_since_update ) / pred_choke; - vec3_t extrapolated_origin = g_cheat.m_prediction.full_walk_move( entity, update_count * pred_choke ); - new_record.m_vecRenderOrigin = extrapolated_origin; - new_record.m_tickcount += update_count * pred_choke; - } + vec3_t extrapolated_origin = g_cheat.m_prediction.full_walk_move( entity, update_count * pred_choke ); + new_record.m_vecRenderOrigin = extrapolated_origin; + new_record.m_tickcount += update_count * pred_choke; } + } - //if( !new_record.is_valid( ) ) - // continue; + //if( !new_record.is_valid( ) ) + // continue; - int shots = m_resolver->get_shots( i ); - bool recalc = shots != last_simtime_record->m_shots; + int shots = m_resolver->get_shots( it ); + bool recalc = shots != last_simtime_record->m_shots; - new_record.restore( true, recalc ); - tick_count = new_record.m_tickcount; - backtracked_record = last_simtime_record; - restore = true; - } - else { - int shots = m_resolver->get_shots( i ); - bool recalc = shots != last_simtime_record->m_shots; - - last_simtime_record->restore( recalc, recalc ); - tick_count = last_simtime_record->m_tickcount; - backtracked_record = last_simtime_record; - restore = true; - } + new_record.restore( true, recalc ); + tick_count = new_record.m_tickcount; + backtracked_record = last_simtime_record; + restore = true; } else { - //fake ping, just wait for an update - continue; + int shots = m_resolver->get_shots( it ); + bool recalc = shots != last_simtime_record->m_shots; + + last_simtime_record->restore( recalc, recalc ); + tick_count = last_simtime_record->m_tickcount; + backtracked_record = last_simtime_record; + restore = true; } } + else { + //fake ping, just wait for an update + return false; + } } + } - baim = should_baim_entity( entity, !should_baim ); + baim = should_baim_entity( entity, !should_baim ); - auto restore_player = [ &original_record, &restore, &entity, this ]( ) { - original_record.restore( true ); - //entity->m_flLastBoneSetupTime( ) = std::numeric_limits< float >::quiet_NaN( ); - }; + auto restore_player = [ &original_record, &restore, &entity, this ]( ) { + original_record.restore( true ); + //entity->m_flLastBoneSetupTime( ) = std::numeric_limits< float >::quiet_NaN( ); + }; - int hitbox = hitscan( entity, baim, aim_pos, hit_damage ); - if( hitbox == -1 ) { - restore_player( ); - continue; - } + int hitbox = hitscan( entity, baim, aim_pos, hit_damage ); + if( hitbox == -1 ) { + restore_player( ); + return false; + } - if( aim_pos.dist_to( local_pos ) > 150.f && is_zeus ) { - restore_player( ); - continue; - } + if( aim_pos.dist_to( local_pos ) > 150.f && zeus ) { + restore_player( ); + return false; + } - aim_angle = math::vector_angles( local_pos, aim_pos ).clamp( ); + aim_ang = math::vector_angles( local_pos, aim_pos ).clamp( ); - if( g_settings.rage.active->m_auto_stop( ) == 2 ) - quick_stop( m_cmd ); + if( g_settings.rage.active->m_auto_stop( ) == 2 ) + quick_stop( m_cmd ); - if( !util::hitchance( it, aim_angle, - g_settings.rage.active->m_hitchance, hitbox ) ) { - if( g_settings.rage.active->m_auto_stop( ) == 1 ) - quick_stop( m_cmd ); + if( !util::hitchance( it, aim_ang, + g_settings.rage.active->m_hitchance, hitbox ) ) { + if( g_settings.rage.active->m_auto_stop( ) == 1 ) + quick_stop( m_cmd ); - if( g_settings.rage.auto_scope( ) && g_ctx.m_local->get_weapon( )->is_sniper( ) ) { - if( !g_ctx.m_local->m_bIsScoped( ) ) { - m_cmd->m_buttons |= IN_ATTACK2; - } + if( g_settings.rage.auto_scope( ) && g_ctx.m_local->get_weapon( )->is_sniper( ) ) { + if( !g_ctx.m_local->m_bIsScoped( ) ) { + m_cmd->m_buttons |= IN_ATTACK2; } - - restore_player( ); - continue; } - ret.m_ent_index = it; - ret.m_position = aim_pos; - ret.m_tick_count = tick_count; - ret.m_hitbox = hitbox; - ret.m_backtracked = backtracked; - ret.m_min = entity->get_hitbox_mins( hitbox ); - ret.m_max = entity->get_hitbox_maxs( hitbox ); - ret.m_radius = entity->get_hitbox_radius( hitbox ); + restore_player( ); + return false; + } - memcpy( m_shot_matrix, entity->m_CachedBoneData( ).GetElements( ), sizeof( matrix3x4 ) * entity->m_CachedBoneData( ).GetSize( ) ); + ret->m_ent_index = it; + ret->m_position = aim_pos; + ret->m_tick_count = tick_count; + ret->m_hitbox = hitbox; + ret->m_backtracked = backtracked; + ret->m_min = entity->get_hitbox_mins( hitbox ); + ret->m_max = entity->get_hitbox_maxs( hitbox ); + ret->m_radius = entity->get_hitbox_radius( hitbox ); - m_shot_target = it; + memcpy( m_shot_matrix, entity->m_CachedBoneData( ).GetElements( ), sizeof( matrix3x4 ) * entity->m_CachedBoneData( ).GetSize( ) ); - restore_player( ); + m_shot_target = it; - break; + restore_player( ); + + return true; + } + + c_ragebot::aim_target_t c_ragebot::find_best_target( ) { + aim_target_t ret{ -1, m_cmd->m_tick_count, -1, vec3_t{ }, vec3_t{ }, vec3_t{ }, 0.f, 0 }; + vec3_t aim_angle{ }; + vec3_t aim_pos{ }; + auto weapon_info = g_ctx.m_local->get_weapon( )->get_wpn_info( ); + bool is_zeus = g_ctx.m_local->get_weapon( )->m_iItemDefinitionIndex( ) == WEAPON_TASER; + int damage = weapon_info->damage; + + auto players = get_sorted_targets( ); + auto data = players.data( ); + + for( size_t i{ }; i < players.size( ); ++i ) { + if( can_hit_target( data[ i ], &ret, is_zeus ) ) + break; } return ret; @@ -1031,6 +1038,12 @@ namespace features m_send_next = false; } + // do not + if( g_settings.rage.silent == 2 && !g_cheat.m_lagmgr.get_choked( ) && !m_antiaim->is_fakewalking( ) ) { + g_cheat.m_lagmgr.set_state( false ); + return; + } + auto wep = g_ctx.m_local->get_weapon( ); if( !wep ) { m_target = -1; @@ -1039,9 +1052,6 @@ namespace features bool in_attack = false; - if( !g_ctx.m_local->can_attack( ) ) - return; - m_can_fakeping = true; if ( g_settings.rage.activation_type == 0 ) in_attack = true; @@ -1063,6 +1073,17 @@ namespace features return; } + if( !g_ctx.m_local->can_attack( ) ) { + aim_target_t t{ }; + bool is_zeus = wep->m_iItemDefinitionIndex( ) == WEAPON_TASER; + + if( m_target != -1 && !m_antiaim->is_fakewalking( ) ) + if( g_settings.rage.active->m_auto_stop == 2 && can_hit_target( m_target, &t, is_zeus ) ) + quick_stop( m_cmd ); + + return; + } + auto target = find_best_target( ); if ( target.m_ent_index != -1 ) { aim_at_target( target ); -- cgit v1.2.3