2022-10-26 14:12:29 +02:00
# include "views/view.hpp"
2022-05-04 19:16:40 +02:00
# include "fiber_pool.hpp"
# include "util/session.hpp"
2022-11-12 07:13:01 +08:00
# include "core/data/region_codes.hpp"
2022-11-14 23:37:38 +08:00
# include "gta_util.hpp"
# include "util/notify.hpp"
2022-11-21 15:42:12 +00:00
# include "util/scripts.hpp"
2022-12-06 16:12:02 +00:00
# include "util/toxic.hpp"
# include "core/data/apartment_names.hpp"
# include "core/data/warehouse_names.hpp"
2022-12-17 14:47:01 +00:00
# include <network/Network.hpp>
2022-05-04 19:16:40 +02:00
namespace big
{
2022-07-06 11:59:08 +02:00
void view : : session ( )
{
2022-10-26 14:12:29 +02:00
static uint64_t rid = 0 ;
ImGui : : InputScalar ( " Input RID " , ImGuiDataType_U64 , & rid ) ;
2022-12-17 17:24:45 +01:00
components : : button ( " Join by RID " , [ ]
2022-10-26 14:12:29 +02:00
{
session : : join_by_rockstar_id ( rid ) ;
} ) ;
2022-12-17 17:24:45 +01:00
static char username [ 20 ] ;
ImGui : : InputText ( " Input Username " , username , sizeof ( username ) ) ;
if ( components : : button ( " Join by Username " ) )
{
session : : join_by_username ( username ) ;
} ;
2022-12-17 14:47:01 +00:00
static char base64 [ 500 ] { } ;
ImGui : : InputText ( " Session Info " , base64 , sizeof ( base64 ) ) ;
components : : button ( " Join Session Info " , [ ]
{
rage : : rlSessionInfo info ;
g_pointers - > m_decode_session_info ( & info , base64 , nullptr ) ;
session : : join_session ( info ) ;
} ) ;
ImGui : : SameLine ( ) ;
components : : button ( " Copy Current Session Info " , [ ]
{
char buf [ 0x100 ] ;
g_pointers - > m_encode_session_info ( & gta_util : : get_network ( ) - > m_game_session . m_rline_session . m_session_info , buf , 0x7D , nullptr ) ;
ImGui : : SetClipboardText ( buf ) ;
} ) ;
2022-08-10 08:42:34 +08:00
components : : sub_title ( " Session Switcher " ) ;
2022-07-06 11:59:08 +02:00
if ( ImGui : : ListBoxHeader ( " ###session_switch " ) )
2022-05-04 19:16:40 +02:00
{
2022-07-06 11:59:08 +02:00
for ( const auto & session_type : sessions )
{
2022-10-26 14:12:29 +02:00
components : : selectable ( session_type . name , false , [ & session_type ]
2022-10-19 00:30:32 +02:00
{
session : : join_type ( session_type . id ) ;
2022-07-06 11:59:08 +02:00
} ) ;
}
ImGui : : EndListBox ( ) ;
2022-05-04 19:16:40 +02:00
}
2022-11-12 07:13:01 +08:00
components : : sub_title ( " Region Switcher " ) ;
if ( ImGui : : ListBoxHeader ( " ###region_switch " ) )
{
for ( const auto & region_type : regions )
{
components : : selectable ( region_type . name , * g_pointers - > m_region_code = = region_type . id , [ & region_type ]
{
* g_pointers - > m_region_code = region_type . id ;
} ) ;
}
ImGui : : EndListBox ( ) ;
}
2022-10-26 15:38:01 -04:00
2022-11-24 21:49:05 +00:00
ImGui : : Checkbox ( " Join in SCTV slots " , & g - > session . join_in_sctv_slots ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Allows you to join full and solo sessions but can be detected by other modders " ) ;
2022-11-19 01:49:36 +00:00
components : : sub_title ( " Player Magnet " ) ;
ImGui : : Checkbox ( " Enabled " , & g - > session . player_magnet_enabled ) ;
if ( g - > session . player_magnet_enabled )
{
ImGui : : InputInt ( " Player Count " , & g - > session . player_magnet_count ) ;
}
2022-10-29 05:54:32 -04:00
components : : sub_title ( " Chat " ) ;
2022-12-06 16:12:02 +00:00
ImGui : : Checkbox ( " Auto-kick Chat Spammers " , & g - > session . kick_chat_spammers ) ;
2022-10-29 05:54:32 -04:00
ImGui : : Checkbox ( " Disable Filter " , & g - > session . disable_chat_filter ) ;
2022-11-12 03:17:22 +10:30
ImGui : : Checkbox ( " Log Chat Messages " , & g - > session . log_chat_messages ) ;
ImGui : : Checkbox ( " Log Text Messages " , & g - > session . log_text_messages ) ;
2022-11-14 23:37:38 +08:00
static char msg [ 256 ] ;
ImGui : : InputText ( " ##message " , msg , sizeof ( msg ) ) ;
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Is Team " , & g - > session . is_team ) ;
ImGui : : SameLine ( ) ;
components : : button ( " Send " , [ ]
{
if ( const auto net_game_player = gta_util : : get_network_player_mgr ( ) - > m_local_net_player ; net_game_player )
{
if ( g_pointers - > m_send_chat_message ( * g_pointers - > m_send_chat_ptr , net_game_player - > get_net_data ( ) , msg , g - > session . is_team ) )
notify : : draw_chat ( msg , net_game_player - > get_name ( ) , g - > session . is_team ) ;
}
} ) ;
2022-11-12 18:35:28 +00:00
components : : sub_title ( " Decloak " ) ;
components : : script_patch_checkbox ( " Reveal OTR Players " , & g - > session . decloak_players ) ;
2022-11-13 16:34:44 +00:00
components : : sub_title ( " Force Host " ) ;
ImGui : : Checkbox ( " Force Session Host " , & g - > session . force_session_host ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Join another session to apply changes. The original host of the session must leave or be kicked. This feature is easily detectable by other mod menus, use with caution " ) ;
2022-12-06 16:12:02 +00:00
ImGui : : SameLine ( ) ;
if ( g - > session . force_session_host )
{
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Kick Host During Join " , & g - > session . kick_host_when_forcing_host ) ;
}
if ( ImGui : : Checkbox ( " Force Script Host " , & g - > session . force_script_host ) )
{
if ( g - > session . force_script_host )
g_fiber_pool - > queue_job ( [ ]
{
scripts : : force_host ( RAGE_JOAAT ( " freemode " ) ) ;
if ( auto script = gta_util : : find_script_thread ( RAGE_JOAAT ( " freemode " ) ) ; script & & script - > m_net_component )
script - > m_net_component - > block_host_migration ( true ) ;
} ) ;
}
2022-11-21 15:42:12 +00:00
components : : sub_title ( " Remote Name Spoofing " ) ;
ImGui : : Checkbox ( " Spoof Other Players' Names " , & g - > session . name_spoof_enabled ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Requires session host. Spoofed names will not visible locally nor to the player that had their name spoofed. Requires players to join after becoming host " ) ;
if ( g - > session . name_spoof_enabled )
{
ImGui : : Checkbox ( " Advertise YimMenu " , & g - > session . advertise_menu ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Advertise YimMenu by spoofing player names to differently colored variants of 'YimMenu'. You will not be able to customize the name with this option enabled " ) ;
if ( ! g - > session . advertise_menu )
{
constexpr size_t name_size = RTL_FIELD_SIZE ( rage : : rlGamerInfo , m_name ) ;
static char name [ name_size ] ;
strcpy_s ( name , sizeof ( name ) , g - > session . spoofed_name . c_str ( ) ) ;
ImGui : : Text ( " Name: " ) ;
ImGui : : InputText ( " ##username_input " , name , sizeof ( name ) ) ;
if ( name ! = g - > session . spoofed_name )
g - > session . spoofed_name = std : : string ( name ) ;
}
}
components : : sub_title ( " All Players " ) ;
ImGui : : Checkbox ( " Off The Radar " , & g - > session . off_radar_all ) ;
2022-12-06 16:12:02 +00:00
ImGui : : SameLine ( ) ;
2022-11-21 15:42:12 +00:00
ImGui : : Checkbox ( " Never Wanted " , & g - > session . never_wanted_all ) ;
2022-12-06 16:12:02 +00:00
ImGui : : SameLine ( ) ;
2022-11-21 15:42:12 +00:00
ImGui : : Checkbox ( " Semi Godmode " , & g - > session . semi_godmode_all ) ;
2022-12-06 16:12:02 +00:00
ImGui : : Checkbox ( " Explosion Karma " , & g - > session . explosion_karma ) ;
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Damage Karma " , & g - > session . damage_karma ) ;
static int global_wanted_level = 0 ;
if ( ImGui : : SliderInt ( " Wanted Level " , & global_wanted_level , 0 , 5 ) )
{
* scr_globals : : globalplayer_bd . at ( self : : id , scr_globals : : size : : globalplayer_bd ) . at ( 213 ) . as < int * > ( ) = global_wanted_level ;
}
ImGui : : SameLine ( ) ;
if ( ImGui : : Checkbox ( " Force " , & g - > session . wanted_level_all ) )
{
* scr_globals : : globalplayer_bd . at ( self : : id , scr_globals : : size : : globalplayer_bd ) . at ( 212 ) . as < Player * > ( ) = __rdtsc ( ) + 32 ;
* scr_globals : : globalplayer_bd . at ( self : : id , scr_globals : : size : : globalplayer_bd ) . at ( 213 ) . as < int * > ( ) = global_wanted_level ;
}
components : : button ( " Kill Everyone " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : kill_player ( plyr . second , g_player_service - > get_self ( ) ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " Turn Everyone Into Beast " , [ ] { toxic : : turn_everyone_into_beast ( ) ; } ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Including you " ) ;
components : : button ( " Give All Weapons " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : give_all_weapons ( plyr . second ) ; script : : get_current ( ) - > yield ( 450 ms ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " Remove All Weapons " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : remove_all_weapons ( plyr . second ) ; } ) ; } ) ;
2022-12-17 14:47:01 +00:00
components : : button ( " CEO Kick " , [ ] {
g_player_service - > iterate ( [ ] ( auto & plyr )
{
if ( * scr_globals : : gpbd_fm_3 . at ( plyr . second - > id ( ) , scr_globals : : size : : gpbd_fm_3 ) . at ( 10 ) . as < int * > ( ) ! = - 1 )
toxic : : ceo_kick ( plyr . second ) ;
} ) ;
} ) ;
2022-12-06 16:12:02 +00:00
components : : small_text ( " Teleports " ) ;
if ( ImGui : : BeginCombo ( " ##apartment " , apartment_names [ g - > session . send_to_apartment_idx ] ) )
{
for ( int i = 1 ; i < apartment_names . size ( ) ; i + + )
{
if ( ImGui : : Selectable ( apartment_names [ i ] , i = = g - > session . send_to_apartment_idx ) )
{
g - > session . send_to_apartment_idx = i ;
}
if ( i = = g - > session . send_to_apartment_idx )
{
ImGui : : SetItemDefaultFocus ( ) ;
}
}
ImGui : : EndCombo ( ) ;
}
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Apartment " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_apartment ( plyr . second , g - > session . send_to_apartment_idx ) ; } ) ; } ) ;
if ( ImGui : : BeginCombo ( " ##warehouse " , warehouse_names [ g - > session . send_to_warehouse_idx ] ) )
{
for ( int i = 1 ; i < warehouse_names . size ( ) ; i + + )
{
if ( ImGui : : Selectable ( warehouse_names [ i ] , i = = g - > session . send_to_warehouse_idx ) )
{
g - > session . send_to_warehouse_idx = i ;
}
if ( i = = g - > session . send_to_warehouse_idx )
{
ImGui : : SetItemDefaultFocus ( ) ;
}
}
ImGui : : EndCombo ( ) ;
}
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Warehouse " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_warehouse ( plyr . second , g - > session . send_to_warehouse_idx ) ; } ) ; } ) ;
components : : button ( " TP All To Darts " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : start_activity ( plyr . second , eActivityType : : Darts ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Flight School " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : start_activity ( plyr . second , eActivityType : : PilotSchool ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Map Center " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : start_activity ( plyr . second , eActivityType : : ArmWresling ) ; } ) ; } ) ;
components : : button ( " TP All To Skydive " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : start_activity ( plyr . second , eActivityType : : Skydive ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Cayo Perico " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_island ( plyr . second ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To MOC " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 81 ) ; } ) ; } ) ;
components : : button ( " TP All To Casino " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 123 ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Penthouse " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 124 ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Arcade " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 128 ) ; } ) ; } ) ;
components : : button ( " TP All To Music Locker " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 146 ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Record A Studios " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 148 ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Custom Auto Shop " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 149 ) ; } ) ; } ) ;
components : : button ( " TP All To Agency " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 155 ) ; } ) ; } ) ;
2022-12-14 16:27:40 +00:00
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Freakshop " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 160 ) ; } ) ; } ) ;
ImGui : : SameLine ( ) ;
components : : button ( " TP All To Multi-Floor Garage " , [ ] { g_player_service - > iterate ( [ ] ( auto & plyr ) { toxic : : send_player_to_interior ( plyr . second , 161 ) ; } ) ; } ) ;
2022-12-06 16:12:02 +00:00
2022-11-21 15:42:12 +00:00
components : : sub_title ( " Event Starter " ) ;
ImGui : : BeginGroup ( ) ;
components : : button ( " Hot Target " , [ ] { scripts : : start_launcher_script ( 36 ) ; } ) ;
components : : button ( " Kill List " , [ ] { scripts : : start_launcher_script ( 37 ) ; } ) ;
components : : button ( " Checkpoints " , [ ] { scripts : : start_launcher_script ( 39 ) ; } ) ;
components : : button ( " Challenges " , [ ] { scripts : : start_launcher_script ( 40 ) ; } ) ;
components : : button ( " Penned In " , [ ] { scripts : : start_launcher_script ( 41 ) ; } ) ;
ImGui : : EndGroup ( ) ;
ImGui : : SameLine ( ) ;
ImGui : : BeginGroup ( ) ;
components : : button ( " Hot Property " , [ ] { scripts : : start_launcher_script ( 43 ) ; } ) ;
components : : button ( " King Of The Castle " , [ ] { scripts : : start_launcher_script ( 45 ) ; } ) ;
components : : button ( " Criminal Damage " , [ ] { scripts : : start_launcher_script ( 46 ) ; } ) ;
components : : button ( " Hunt The Beast " , [ ] { scripts : : start_launcher_script ( 47 ) ; } ) ;
components : : button ( " Business Battles " , [ ] { scripts : : start_launcher_script ( 114 ) ; } ) ;
ImGui : : EndGroup ( ) ;
2022-12-06 16:12:02 +00:00
ImGui : : SameLine ( ) ;
ImGui : : BeginGroup ( ) ;
2022-12-17 14:47:01 +00:00
components : : button ( " One-On-One Deathmatch " , [ ] { scripts : : start_launcher_script ( 197 ) ; } ) ;
2022-12-06 16:12:02 +00:00
components : : button ( " Impromptu Race " , [ ] { scripts : : start_launcher_script ( 16 ) ; } ) ;
2022-12-17 14:47:01 +00:00
components : : button ( " Flight School " , [ ] { scripts : : start_launcher_script ( 196 ) ; } ) ;
components : : button ( " Golf " , [ ] { scripts : : start_launcher_script ( 193 ) ; } ) ;
2022-12-06 16:12:02 +00:00
components : : button ( " Tutorial " , [ ] { scripts : : start_launcher_script ( 20 ) ; } ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Only works on joining players " ) ;
ImGui : : EndGroup ( ) ;
ImGui : : SameLine ( ) ;
ImGui : : BeginGroup ( ) ;
2022-12-17 14:47:01 +00:00
components : : button ( " Gunslinger " , [ ] { scripts : : start_launcher_script ( 211 ) ; } ) ;
components : : button ( " Space Monkey " , [ ] { scripts : : start_launcher_script ( 216 ) ; } ) ;
components : : button ( " Wizard " , [ ] { scripts : : start_launcher_script ( 212 ) ; } ) ;
components : : button ( " QUB3D " , [ ] { scripts : : start_launcher_script ( 217 ) ; } ) ;
components : : button ( " Camhedz " , [ ] { scripts : : start_launcher_script ( 218 ) ; } ) ;
2022-12-06 16:12:02 +00:00
ImGui : : EndGroup ( ) ;
ImGui : : Checkbox ( " Disable Pedestrians " , & g - > session . disable_peds ) ;
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Disable Traffic " , & g - > session . disable_traffic ) ;
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Force Thunder " , & g - > session . force_thunder ) ;
components : : sub_title ( " Script Host Features " ) ;
ImGui : : Checkbox ( " Disable CEO Money " , & g - > session . block_ceo_money ) ;
if ( ImGui : : IsItemHovered ( ) )
ImGui : : SetTooltip ( " Blocks CEO money drops across the entire session. This can also break other stuff, use with caution " ) ;
ImGui : : SameLine ( ) ;
ImGui : : Checkbox ( " Randomize CEO Colors " , & g - > session . randomize_ceo_colors ) ;
2022-05-04 19:16:40 +02:00
}
2022-10-26 14:12:29 +02:00
}