From 78a6e235c3b0006bf29868d5f7ad0628d522fa79 Mon Sep 17 00:00:00 2001 From: navewindre Date: Fri, 31 Aug 2018 18:57:02 +0200 Subject: ah yes --- internal_rewrite/c_base_player.hpp | 2 +- internal_rewrite/lag_mgr.cpp | 6 + internal_rewrite/ragebot.cpp | 4 - internal_rewrite/settings.hpp | 1 + internal_rewrite/ui.h | 3 +- internal_rewrite/ui_text_input.cpp | 16 ++- internal_rewrite/ui_text_input.h | 5 +- internal_rewrite/update_clientside_animation.cpp | 8 +- loader/ui.h | 92 ++++++++++++-- loader/ui_text_input.cpp | 153 +++++++++++++---------- loader/ui_text_input.h | 73 +++++------ 11 files changed, 239 insertions(+), 124 deletions(-) diff --git a/internal_rewrite/c_base_player.hpp b/internal_rewrite/c_base_player.hpp index 0ed9aa1..bf8a9c0 100644 --- a/internal_rewrite/c_base_player.hpp +++ b/internal_rewrite/c_base_player.hpp @@ -302,7 +302,7 @@ public: OFFSET( m_CachedBoneData, 0x28FC + sizeof( void* ), CUtlVector< matrix3x4 > ); - OFFSET( m_flSpawnTime, 0xa290, float ); + OFFSET( m_flSpawnTime, 0xA2A0, float ); OFFSET( m_IKContext, 0x265c, IKContext* ); public: static uintptr_t get_player_resource( ); diff --git a/internal_rewrite/lag_mgr.cpp b/internal_rewrite/lag_mgr.cpp index 72ad8c4..ed01568 100644 --- a/internal_rewrite/lag_mgr.cpp +++ b/internal_rewrite/lag_mgr.cpp @@ -127,6 +127,12 @@ namespace features } } + if( settings.jump_reset ) { + if( was_onground && !( g_ctx.m_local->m_fFlags( ) & FL_ONGROUND ) ) { + send = get_choked( ) > 0; + } + } + was_onground = g_ctx.m_local->m_fFlags( ) & FL_ONGROUND; if( ( m_cmd->m_buttons & IN_ATTACK ) && g_ctx.m_local->can_attack( ) && diff --git a/internal_rewrite/ragebot.cpp b/internal_rewrite/ragebot.cpp index 435559e..5e106ce 100644 --- a/internal_rewrite/ragebot.cpp +++ b/internal_rewrite/ragebot.cpp @@ -140,10 +140,6 @@ namespace features vec3_t max_dir = math::angle_vectors( math::vector_angles( center, box->bbmax ) ); vec3_t max = center + max_dir * dist * g_settings.rage.active->m_hitbox_scale * 1.1f; - //float radius = box->m_flRadius * 1.1f * g_settings.rage.active->m_hitbox_scale; - //min -= vec3_t( radius, radius, radius ); - //max += vec3_t( radius, radius, radius ); - static int point_index[ 65 ][ HITBOX_MAX ]; std::array< vec3_t, 8 > points = { diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index 1a2874e..75641c5 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -228,6 +228,7 @@ namespace data con_var< bool > in_move{ &holder_, fnv( "fakelag_in_move" ), false }; con_var< bool > in_attack{ &holder_, fnv( "fakelag_in_attack" ), false }; con_var< bool > avoid_ground{ &holder_, fnv( "fakelag_avoid_ground" ), false }; + con_var< bool > jump_reset{ &holder_, fnv( "fakelag_jump_reset" ), false }; } fakelag; con_var< bool > anti_aim{ &holder_, fnv( "rage_anti_aim" ), false }; diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index 5585973..4d1ec8e 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -35,7 +35,7 @@ namespace ui menu.reset( ); #ifndef _DEBUG - menu = std::make_shared< ui::c_menu >( 10, 10, 580, 470, xors( "moneybot" ), + menu = std::make_shared< ui::c_menu >( 10, 10, 580, 470, xors( "hit p hook" ), date_str.c_str( ) ); #else menu = std::make_shared< ui::c_menu >( 10, 10, 580, 470, xors( "moneybot (cooler edition)" ), @@ -447,6 +447,7 @@ namespace ui flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "on peek" ), &g_settings.rage.fakelag.on_peek ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "while shooting" ), &g_settings.rage.fakelag.in_attack ) ); flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "avoid ground" ), &g_settings.rage.fakelag.avoid_ground ) ); + flags_form->add_item( std::make_shared< ui::c_checkbox >( 0, 0, xors( "reset on jump" ), &g_settings.rage.fakelag.jump_reset ) ); } left_column->add_item( main_form ); diff --git a/internal_rewrite/ui_text_input.cpp b/internal_rewrite/ui_text_input.cpp index 44a4ebc..f2c3530 100644 --- a/internal_rewrite/ui_text_input.cpp +++ b/internal_rewrite/ui_text_input.cpp @@ -29,6 +29,11 @@ void ui::c_text_input::render( ) { m_last_key_input[ i ] = current_time; continue; } + + if( i == KEYS_RETURN ) { + m_active = false; + break; + } m_key_states[ i ] = 0xf0; wchar_t pressed_char; @@ -65,5 +70,14 @@ void ui::c_text_input::render( ) { ( is_hovered( ) || m_active ) ? ui_get_text_col( ) : ui_get_accent_col( ) ); ui_draw_rect( x, y, m_width, m_height, ui_get_disabled_col( ) ); - ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr ); + if( !m_hidden ) + ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr ); + else { + std::string str; + str.append( "*", strlen( m_text_ptr ) ); + if( m_active ) + str += '_'; + + ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), str.c_str( ) ); + } } \ No newline at end of file diff --git a/internal_rewrite/ui_text_input.h b/internal_rewrite/ui_text_input.h index b651828..243c40b 100644 --- a/internal_rewrite/ui_text_input.h +++ b/internal_rewrite/ui_text_input.h @@ -5,8 +5,8 @@ namespace ui { class c_text_input : public base_item { public: - c_text_input( int x, int y, int w, const char* name, size_t max_chars, char* str ) : - base_item( x, y, w, 16, name ), m_text_len( max_chars ), m_text_ptr( str ) { + c_text_input( int x, int y, int w, const char* name, size_t max_chars, char* str, bool hidden = false ) : + base_item( x, y, w, 16, name ), m_text_len( max_chars ), m_text_ptr( str ), m_hidden( hidden ) { } virtual bool is_hovered( ) override { @@ -33,5 +33,6 @@ namespace ui bool m_active{ }; float m_last_key_input[ KEYS_LAST ]{ }; uint8_t m_key_states[ 256 ]{ }; + bool m_hidden{ }; }; } \ No newline at end of file diff --git a/internal_rewrite/update_clientside_animation.cpp b/internal_rewrite/update_clientside_animation.cpp index b95c8ae..4653fa6 100644 --- a/internal_rewrite/update_clientside_animation.cpp +++ b/internal_rewrite/update_clientside_animation.cpp @@ -11,11 +11,17 @@ void __fastcall hooks::update_clientside_animation( void* ecx_, void* edx_ ) { static ent_animdata_t prev_anims; static float last_choke; static float last_update; + static float last_spawntime = 0.f; + // Arbitrary number much. - if( !g_settings.rage.anti_aim || !g_ctx.m_local->is_valid( ) || std::abs( last_update - g_csgo.m_globals->m_curtime ) > TICKS_TO_TIME( 20 ) ) { + if( !g_settings.rage.anti_aim || !g_ctx.m_local->is_valid( ) || std::abs( last_update - g_csgo.m_globals->m_curtime ) > TICKS_TO_TIME( 20 ) || last_spawntime != ent->m_flSpawnTime( ) ) { last_update = g_csgo.m_globals->m_curtime; first_update = true; + + if( last_spawntime != ent->m_flSpawnTime( ) ) + last_spawntime = ent->m_flSpawnTime( ); + return old_func( ecx_, edx_ ); } diff --git a/loader/ui.h b/loader/ui.h index 12cc37c..a6874f5 100644 --- a/loader/ui.h +++ b/loader/ui.h @@ -18,8 +18,41 @@ char g_login[ 32 ]; int g_game = 1; float g_progress = 0.f; +enum { + STATUS_LOGIN, + STATUS_LOGGING_IN, + STATUS_LOGGED_IN, + STATUS_LOADING, +}; + +int g_status = STATUS_LOGIN; + extern void execute_login( ); +enum { + GAME_UNSAFE = 0, + GAME_SAFE = 1, +}; + +struct game_t { + int status; + char name[ 32 ]; + bool valid_sub; +}; + + +std::vector< game_t > games = { + { GAME_SAFE, xors( "csgo" ), true }, + { GAME_UNSAFE, xors( "csgo ( beta )" ), false } +}; + + +//fill this vector when receiving game data based on the one above (this is just a test sample one) +std::vector< ui::dropdowns::dropdown_item_t< int > > game_list = { + { xors( "csgo" ), 1 }, + { xors( "csgo ( beta )" ), 2 }, +}; + namespace ui { auto menu = std::make_shared< ui::c_menu >( 0, 0, 500, 400, xors( "moneybot" ), "" ); @@ -30,22 +63,61 @@ namespace ui menu = std::make_shared< ui::c_menu >( 0, 0, 450, 375, xors( "moneybot" ), "" ); auto login_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, - 0, xors( "login" ) ) ); - - login_form->add_item( std::make_shared< ui::c_text_input >( 15, 0, 140, xors( "username" ), 32, g_login ) ); - login_form->add_item( std::make_shared< ui::c_dropdown< > >( 15, 0, 140, xors( "game" ), &g_game, &dropdowns::games ) ); - login_form->add_item( std::make_shared< ui::base_item >( 0, 0, 0, 3 ) ); - login_form->add_item( std::make_shared< ui::c_button >( 15, 0, 140, 18, xors( "submit" ), [ ]( ) { - execute_login( ); - } ) ); - login_form->add_item( std::make_shared< ui::c_progress_bar >( 15, 0, 140, &g_progress ) ); - + 115, xors( "login" ) ) ); { + login_form->add_item( std::make_shared< ui::c_text_input >( 15, 0, 140, xors( "username" ), 32, g_login, true ) ); + login_form->add_item( std::make_shared< ui::base_item >( 0, 0, 0, 3 ) ); + login_form->add_item( std::make_shared< ui::c_button >( 15, 0, 140, 18, xors( "submit" ), [ ]( ) { + g_status = STATUS_LOGGING_IN; + /* + execute your code to log in here + */ + } ) ); + } + + login_form->set_cond( [ ]( ) { return g_status == STATUS_LOGIN; } ); + + auto logging_in_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "logging in" ) ) ); { + logging_in_form->add_item( std::make_shared< ui::c_label >( 54, 39, xors( "please wait." ) ) ); + } + + logging_in_form->set_cond( [ ]( ) { return g_status == STATUS_LOGGING_IN; } ); + + auto games_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "inject" ) ) ); { + games_form->add_item( std::make_shared< ui::c_dropdown< > >( 15, 0, 140, xors( "game" ), &g_game, &game_list ) ); + games_form->add_item( std::make_shared< ui::c_button >( 15, 0, 140, 18, xors( "inject" ), [ ]( ) { + g_status = STATUS_LOADING; + /* + execute your code to inject here + */ + } ) ); + + games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "subscription: active" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).valid_sub; } ); + games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "subscription: inactive" ) ) )->set_cond( [ ]( ) { return !games.at( g_game - 1 ).valid_sub; } ); + games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "status: safe" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).status == GAME_SAFE; } ); + games_form->add_item( std::make_shared< ui::c_label >( 15, 0, xors( "status: unsafe" ) ) )->set_cond( [ ]( ) { return games.at( g_game - 1 ).status == GAME_UNSAFE; } ); + } + + games_form->set_cond( [ ]( ) { return g_status == STATUS_LOGGED_IN; } ); + + auto loading_form = menu->add_item( std::make_shared< ui::c_form >( 120, 20, 190, 115, xors( "loading" ) ) ); { + loading_form->add_item( std::make_shared< ui::c_label >( 54, 39, xors( "please wait." ) ) ); + } + + loading_form->set_cond( [ ]( ) { return g_status == STATUS_LOADING; } ); + menu->add_item( std::make_shared< ui::c_button >( 393, 208, 50, 18, xors( "exit" ), [ ]( ) { exit( 0 ); } ) ); was_setup = true; } else { render_item( menu.get( ) ); + static float loading_time; + if( g_status == STATUS_LOGGING_IN && !loading_time ) { + loading_time = GetTickCount( ) * 0.001f + 2.f; + } + else if( g_status == STATUS_LOGGING_IN && GetTickCount( ) * 0.001f > loading_time ) { + g_status = STATUS_LOGGED_IN; + } } } } \ No newline at end of file diff --git a/loader/ui_text_input.cpp b/loader/ui_text_input.cpp index 92f0d0c..db1ec7c 100644 --- a/loader/ui_text_input.cpp +++ b/loader/ui_text_input.cpp @@ -1,69 +1,86 @@ -#include "ui_text_input.h" -#include - -void ui::c_text_input::render( ) { - if( is_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { - if( !m_was_held ) { - m_active ^= 1; - } - m_was_held = true; - } - else { - m_was_held = false; - } - - if( m_active ) { - if( !is_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { - m_active = false; - } - - float current_time = GetTickCount( ) * 0.001f; - size_t length = strlen( m_text_ptr ); - - for( size_t i{ }; i < 0xfe; ++i ) { - if( g_input.is_key_pressed( i ) ) { - float delta_time = current_time - m_last_key_input[ i ]; - if( fabs( delta_time ) > 0.2f ) { - if( i == KEYS_BACK ) { - m_text_ptr[ length - 1 ] = 0; - m_last_key_input[ i ] = current_time; - continue; - } - - m_key_states[ i ] = 0xf0; - wchar_t pressed_char; - const auto scan = MapVirtualKeyA( i, 2 ); - auto ret = ToAscii( i, scan, ( BYTE* )m_key_states, ( LPWORD )&pressed_char, 1 ); - - if( ret == 1 ) { - if( length < m_text_len ) { - m_text_ptr[ length ] = ( char )( pressed_char ); - m_text_ptr[ length + 1 ] = 0; - } - } - m_last_key_input[ i ] = current_time; - } - } - else { - m_last_key_input[ i ] = 0.f; - m_key_states[ i ] = 0; - } - } - - if( g_input.is_key_pressed( KEYS_RETURN ) ) { - m_active = false; - } - } - - int x = get_relative_x( ); - int y = get_relative_y( ); - - ui_draw_string( x + 2, y, false, ui_get_text_col( ), m_text ); - y += 12; - - ui_draw_rect( x - 1, y - 1, m_width + 2, m_height + 2, - ( is_hovered( ) || m_active ) ? ui_get_text_col( ) : ui_get_accent_col( ) ); - ui_draw_rect( x, y, m_width, m_height, ui_get_disabled_col( ) ); - - ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr ); +#include "ui_text_input.h" +#include + +#include + +void ui::c_text_input::render( ) { + if( is_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { + if( !m_was_held ) { + m_active ^= 1; + } + m_was_held = true; + } + else { + m_was_held = false; + } + + if( m_active ) { + if( !is_hovered( ) && g_input.is_key_pressed( KEYS_MOUSE1 ) ) { + m_active = false; + } + + float current_time = GetTickCount( ) * 0.001f; + size_t length = strlen( m_text_ptr ); + + for( size_t i{ }; i < 0xfe; ++i ) { + if( g_input.is_key_pressed( i ) ) { + float delta_time = current_time - m_last_key_input[ i ]; + if( fabs( delta_time ) > 0.2f ) { + if( i == KEYS_BACK ) { + m_text_ptr[ length - 1 ] = 0; + m_last_key_input[ i ] = current_time; + continue; + } + + if( i == KEYS_RETURN ) { + m_active = false; + break; + } + + m_key_states[ i ] = 0xf0; + wchar_t pressed_char; + const auto scan = MapVirtualKeyA( i, 2 ); + auto ret = ToAscii( i, scan, ( BYTE* )m_key_states, ( LPWORD )&pressed_char, 1 ); + + if( ret == 1 ) { + if( length < m_text_len ) { + m_text_ptr[ length ] = ( char )( pressed_char ); + m_text_ptr[ length + 1 ] = 0; + } + } + m_last_key_input[ i ] = current_time; + } + } + else { + m_last_key_input[ i ] = 0.f; + m_key_states[ i ] = 0; + } + } + + if( g_input.is_key_pressed( KEYS_RETURN ) ) { + m_active = false; + } + } + + int x = get_relative_x( ); + int y = get_relative_y( ); + + ui_draw_string( x + 2, y, false, ui_get_text_col( ), m_text ); + y += 12; + + ui_draw_rect( x - 1, y - 1, m_width + 2, m_height + 2, + ( is_hovered( ) || m_active ) ? ui_get_text_col( ) : ui_get_accent_col( ) ); + ui_draw_rect( x, y, m_width, m_height, ui_get_disabled_col( ) ); + + if( !m_hidden ) + ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), m_active ? "%s_" : "%s", m_text_ptr ); + else { + std::string str; + str.append( strlen( m_text_ptr ), '*' ); + + if( m_active ) + str += '_'; + + ui_draw_string( x + 2, y + 3, false, ui_get_text_col( ), str.c_str( ) ); + } } \ No newline at end of file diff --git a/loader/ui_text_input.h b/loader/ui_text_input.h index 84d8e66..243c40b 100644 --- a/loader/ui_text_input.h +++ b/loader/ui_text_input.h @@ -1,37 +1,38 @@ -#pragma once -#include "ui_base_item.h" - -namespace ui -{ - class c_text_input : public base_item { - public: - c_text_input( int x, int y, int w, const char* name, size_t max_chars, char* str ) : - base_item( x, y, w, 16, name ), m_text_len( max_chars ), m_text_ptr( str ) { - } - - virtual bool is_hovered( ) override { - int cursor_x, cursor_y; - ui_get_cursor_pos( cursor_x, cursor_y ); - - int x = get_relative_x( ); - int y = get_relative_y( ) + 12; - - return cursor_x >= x && cursor_x <= x + m_width - && cursor_y >= y && cursor_y <= y + m_height; - } - - virtual int get_total_height( ) const override { - return m_height + 12; - } - - virtual void render( ) override; - - protected: - bool m_was_held{ }; - char* m_text_ptr{ }; - size_t m_text_len{ }; - bool m_active{ }; - float m_last_key_input[ KEYS_LAST ]{ }; - uint8_t m_key_states[ 256 ]{ }; - }; +#pragma once +#include "ui_base_item.h" + +namespace ui +{ + class c_text_input : public base_item { + public: + c_text_input( int x, int y, int w, const char* name, size_t max_chars, char* str, bool hidden = false ) : + base_item( x, y, w, 16, name ), m_text_len( max_chars ), m_text_ptr( str ), m_hidden( hidden ) { + } + + virtual bool is_hovered( ) override { + int cursor_x, cursor_y; + ui_get_cursor_pos( cursor_x, cursor_y ); + + int x = get_relative_x( ); + int y = get_relative_y( ) + 12; + + return cursor_x >= x && cursor_x <= x + m_width + && cursor_y >= y && cursor_y <= y + m_height; + } + + virtual int get_total_height( ) const override { + return m_height + 12; + } + + virtual void render( ) override; + + protected: + bool m_was_held{ }; + char* m_text_ptr{ }; + size_t m_text_len{ }; + bool m_active{ }; + float m_last_key_input[ KEYS_LAST ]{ }; + uint8_t m_key_states[ 256 ]{ }; + bool m_hidden{ }; + }; } \ No newline at end of file -- cgit v1.2.3