void c_ragebot::on_create_move ( usercmd_t* cmd, bool& send_packet )
{
static auto last_in_shot = false;
static auto last_shot_time = 0.f;
if ( last_in_shot )
{
last_in_shot = false;
return;
}
const auto curtime = interfaces::global_vars->curtime;
this->did_shoot = false;
if ( last_shot_time > curtime )
last_shot_time = curtime;
const auto suppressed_tick_delta = interfaces::global_vars->tickcount - globals.prev_supressed_tick;
if ( suppressed_tick_delta < 0 )
globals.prev_supressed_tick = interfaces::global_vars->tickcount;
if ( !g_options.ragebot_master )
return;
g_features.autowall.reset_overwrite( );
const auto local = static_cast< C_BasePlayer* > ( g_local );
if ( !local || !local->is_alive( ) )
return;
auto weapon = local->active_weapon( ).get( );
if ( !weapon || !weapon->has_bullets( ) || !weapon->can_fire( ) || weapon->item( ).item_definition_index( ) == WEAPON_C4 )
return;
if ( weapon->is_zeus( ) )
{
zeusbot ( cmd, local, weapon, send_packet );
return;
}
if (weapon->is_r8())
{
revolver(cmd, local, weapon, send_packet);
return;
}
if ( weapon->is_knife( ) )
return;
auto weapon_data = weapon->get_cs_weapon_data( );
if ( !weapon_data )
return;
if ( curtime - ( last_shot_time + *reinterpret_cast< float* > ( reinterpret_cast< uintptr_t > ( weapon_data ) + 0xDC ) ) < 0.f )
return;
if ( !g_options.ragebot_autoshoot && ! ( cmd->buttons & IN_ATTACK ) )
return;
if ( !g_options.ragebot_autoshoot )
cmd->buttons &= ~IN_ATTACK;
if ( g_options.ragebot_shooting_mode == static_cast< int > ( shooting_modes_t::supress ) && interfaces::client_state->chokedcommands >= 15 )
return;
//console::write_line ( "sequence: " + std::to_string ( weapon->get_sequence() ) );
//update_weapon_config ( weapon );
auto damage = 0.f;
auto position = Vector ( 0, 0, 0 );
auto entity_index = -1;
static auto last_entity = entity_index;
auto currently_baiming = false;
auto ragebot_hitbox = 0;
create_hitbox_list( );
backtrack_all_data ball_data;
auto using_backtrack = false;
if ( !get_target_by_damage ( local, weapon, damage, position, entity_index, currently_baiming, ragebot_hitbox, ball_data, using_backtrack ) )
return;
/*if ( using_backtrack )
console::write_line ( "backtrack" );*/
if ( ( last_entity == -1 || last_entity != entity_index ) && static_cast< shooting_modes_t > ( g_options.ragebot_shooting_mode ) == shooting_modes_t::
normal
)
{
last_entity = entity_index;
if ( entity_index != -1 )
{
QAngle ang = g_math.calc_angle ( g_local->get_eye_pos ( g_features.animations.m_real_state ), position );
g_math.normalize_angles ( ang );
g_math.clamp_angles ( ang );
interfaces::engine_client->set_viewangles ( &ang );
}
return;
}
if ( entity_index == -1 )
return;
const auto entity = dynamic_cast< C_BasePlayer* > ( interfaces::entity_list->get_client_entity ( entity_index ) );
if ( !entity || !entity->is_alive( ) )
return;
player_backup_data_t org_data;
auto simtime_to_shoot = entity->simulation_time( );
if ( using_backtrack )
{
simtime_to_shoot = ball_data.simtime;
org_data.create ( entity );
ball_data.ndata.restore ( entity );
}
if ( static_cast< shooting_modes_t > ( g_options.ragebot_shooting_mode ) == shooting_modes_t::antiaim && interfaces::client_state->chokedcommands >= 1 )
send_packet = true;
if ( static_cast< shooting_modes_t > ( g_options.ragebot_shooting_mode ) == shooting_modes_t::antiaim && !send_packet )
{
if ( using_backtrack )
org_data.restore ( entity );
return;
}
const auto tick = time_to_ticks ( simtime_to_shoot + g_features.rage_backtrack.get_lerp_time() );
auto ang = g_math.calc_angle ( g_local->get_eye_pos ( g_features.animations.m_real_state ), position );
static auto weapon_recoil_scale = interfaces::cvar->find_var ( xor_str ( "weapon_recoil_scale" ) );
ang -= globals.old_aimpunch * weapon_recoil_scale->get_float( );
g_math.normalize_angles ( ang );
static auto last_in_scope = 0;
if ( weapon->is_sniper( ) && last_in_scope <= 3 )
{
last_in_scope++;
if ( using_backtrack )
org_data.restore ( entity );
return;
}
if ( weapon->is_sniper( ) && !local->is_scoped( ) )
{
last_in_scope = 0;
auto_scope ( cmd );
if ( using_backtrack )
org_data.restore ( entity );
return;
}
auto_stop ( cmd );
if ( !hit_chance ( ang, entity, g_options.ragebot_hitchance ) )
{
if ( using_backtrack )
org_data.restore ( entity );
return;
}
cmd->viewangles = ang;
g_math.normalize_angles ( cmd->viewangles );
g_math.clamp_angles ( cmd->viewangles );
cmd->tick_count = tick;
/*if (!weapon->is_r8( ) )
cmd->buttons |= IN_ATTACK2;
else
cmd->buttons |= IN_ATTACK;*/
//if (!weapon->is_r8())
// cmd->buttons |= IN_ATTACK;
if ( !using_backtrack )
g_features.event_logger.set_rbot_data ( entity, entity_index, ang );
else
g_features.event_logger.set_rbot_data_backtrack ( entity, entity_index, ang, ball_data );
//const auto ba_last_shot_time = last_shot_time;
this->did_shoot = true;
if ( !weapon->is_r8( ) )
last_shot_time = curtime;
switch ( static_cast< shooting_modes_t > ( g_options.ragebot_shooting_mode ) )
{
case shooting_modes_t::normal:
interfaces::engine_client->set_viewangles ( &cmd->viewangles );
break;
case shooting_modes_t::instant:
send_packet = true;
break;
case shooting_modes_t::supress:
send_packet = false;
should_supress = true;
break;
default:
break;
}
last_in_shot = true;
globals.real_yaw = cmd->viewangles.yaw;
if ( using_backtrack )
org_data.restore ( entity );