From 8028db84b367699093856a2b39a424c297680b18 Mon Sep 17 00:00:00 2001 From: Yimura <24669514+Yimura@users.noreply.github.com> Date: Wed, 1 Feb 2023 19:46:33 +0100 Subject: [PATCH] feat: Translation Service (#844) Co-authored-by: mrwoowoo Co-authored-by: LiamD-Flop <40887493+LiamD-Flop@users.noreply.github.com> --- scripts/gtav-classes.cmake | 2 +- src/common.hpp | 1 + .../current_profile_brakes.cpp | 8 +- .../current_profile_gearing.cpp | 8 +- .../current_profile_general.cpp | 10 +- .../current_profile/current_profile_other.cpp | 8 +- .../current_profile_roll_centre_height.cpp | 8 +- .../current_profile_rollbars.cpp | 6 +- .../current_profile_steering.cpp | 4 +- .../current_profile_suspension.cpp | 16 +- .../current_profile_traction.cpp | 16 +- .../current_profile_transmission.cpp | 8 +- src/gui/handling/handling_current_profile.cpp | 8 +- src/gui/handling/handling_saved_profiles.cpp | 5 +- src/gui/handling/modals/save_handling.cpp | 8 +- src/hooks/info/get_network_event_data.cpp | 2 +- .../assign_physical_index.cpp | 13 +- .../player_management/network_player_mgr.cpp | 4 +- src/hooks/protections/handle_join_request.cpp | 2 +- src/hooks/protections/receive_net_message.cpp | 28 ++- src/hooks/protections/received_event.cpp | 9 +- src/main.cpp | 3 + .../creator_storage_service.cpp | 2 +- src/services/gui/gui_service.hpp | 2 + .../notifications/notification_service.cpp | 5 +- .../translation_service/local_index.hpp | 18 ++ .../translation_service/remote_index.hpp | 16 ++ .../translation_service/translation_entry.hpp | 13 ++ .../translation_service.cpp | 213 ++++++++++++++++++ .../translation_service.hpp | 88 ++++++++ src/services/vehicle/persist_car_service.cpp | 2 +- src/util/spam.hpp | 3 +- src/util/teleport.hpp | 14 +- src/util/toxic.hpp | 8 +- src/util/train.hpp | 5 +- src/util/vehicle.hpp | 8 +- src/views/core/view_heading.cpp | 8 +- src/views/debug/view_debug.cpp | 3 +- src/views/debug/view_debug.hpp | 1 + src/views/debug/view_debug_globals.cpp | 40 ++-- src/views/debug/view_debug_locals.cpp | 2 +- src/views/debug/view_debug_misc.cpp | 4 +- src/views/debug/view_debug_script_events.cpp | 12 +- src/views/debug/view_debug_scripts.cpp | 26 +++ src/views/debug/views_debug_logs.cpp | 14 +- src/views/esp/view_esp.cpp | 6 +- src/views/network/view_player_database.cpp | 46 ++-- src/views/network/view_session.cpp | 168 +++++++------- src/views/network/view_session_browser.cpp | 50 ++-- src/views/network/view_spoofing.cpp | 58 ++--- src/views/players/player/player_info.cpp | 77 ++++--- src/views/players/player/player_kick.cpp | 2 +- src/views/players/player/player_misc.cpp | 8 +- src/views/players/player/player_toxic.cpp | 42 ++-- src/views/players/player/player_troll.cpp | 6 +- src/views/players/view_player.cpp | 10 +- src/views/self/view_mobile.cpp | 22 +- src/views/self/view_self.cpp | 56 ++--- src/views/self/view_teleport.cpp | 4 +- src/views/self/view_weapons.cpp | 24 +- .../settings/view_context_menu_settings.cpp | 18 +- src/views/settings/view_esp_settings.cpp | 44 ++-- src/views/settings/view_gui_settings.cpp | 10 +- .../settings/view_protection_settings.cpp | 48 ++-- src/views/settings/view_reaction_settings.cpp | 70 +++--- src/views/settings/view_settings.cpp | 38 +--- .../settings/view_translation_settings.cpp | 26 +++ src/views/vehicle/view_fun_vehicle.cpp | 60 ++--- src/views/vehicle/view_lsc.cpp | 100 ++++---- src/views/vehicle/view_persist_car.cpp | 14 +- src/views/vehicle/view_pv.cpp | 22 +- src/views/vehicle/view_spawn_vehicle.cpp | 18 +- src/views/vehicle/view_vehicle.cpp | 60 ++--- src/views/view.hpp | 1 + src/views/view_gta_data.cpp | 18 +- src/views/world/view_creator.cpp | 40 ++-- src/views/world/view_spawn_ped.cpp | 61 ++--- src/views/world/view_time_and_weather.cpp | 16 +- src/views/world/view_train.cpp | 35 ++- 79 files changed, 1183 insertions(+), 779 deletions(-) create mode 100644 src/services/translation_service/local_index.hpp create mode 100644 src/services/translation_service/remote_index.hpp create mode 100644 src/services/translation_service/translation_entry.hpp create mode 100644 src/services/translation_service/translation_service.cpp create mode 100644 src/services/translation_service/translation_service.hpp create mode 100644 src/views/debug/view_debug_scripts.cpp create mode 100644 src/views/settings/view_translation_settings.cpp diff --git a/scripts/gtav-classes.cmake b/scripts/gtav-classes.cmake index 77a71735..7e9acabe 100644 --- a/scripts/gtav-classes.cmake +++ b/scripts/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git - GIT_TAG a4a559be1abd84ffbd4d127c572cce036a8cc5ad + GIT_TAG c6eb3c8c1253b5d9822a79feda7bdc61875cd47c GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/common.hpp b/src/common.hpp index ea87afff..68a09766 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -56,6 +56,7 @@ #include "ped/CPed.hpp" #include "services/notifications/notification_service.hpp" +#include "services/translation_service/translation_service.hpp" namespace big { diff --git a/src/gui/handling/current_profile/current_profile_brakes.cpp b/src/gui/handling/current_profile/current_profile_brakes.cpp index 388002db..5c61543d 100644 --- a/src/gui/handling/current_profile/current_profile_brakes.cpp +++ b/src/gui/handling/current_profile/current_profile_brakes.cpp @@ -4,17 +4,17 @@ namespace big { void tab_current_profile::tab_brakes() { - if (ImGui::BeginTabItem("Brakes")) + if (ImGui::BeginTabItem("HANDLING_TAB_BRAKES"_T.data())) { - ImGui::Text("Brake Force"); + ImGui::Text("HANDLING_BRAKE_FORCE"_T.data()); ImGui::DragFloat("##brake force", &g_local_player->m_vehicle->m_handling_data->m_brake_force, .01f, 0.f, 10.f); - ImGui::Text("Brake Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)"); + ImGui::Text("HANDLING_BRAKE_BIAS"_T.data()); float fBrakeBias = g_local_player->m_vehicle->m_handling_data->m_brake_bias_front / 2; if (ImGui::SliderFloat("##brake bias front", &fBrakeBias, 0.f, 1.f)) g_local_player->m_vehicle->m_handling_data->m_brake_bias_front = fBrakeBias * 2; - ImGui::Text("Hand Brake Force"); + ImGui::Text("HANDLING_HAND_BRAKE_FORCE"_T.data()); ImGui::DragFloat("##hand brake force", &g_local_player->m_vehicle->m_handling_data->m_handbrake_force, .01f, 0.f, 10.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_gearing.cpp b/src/gui/handling/current_profile/current_profile_gearing.cpp index fa2480ea..3d419017 100644 --- a/src/gui/handling/current_profile/current_profile_gearing.cpp +++ b/src/gui/handling/current_profile/current_profile_gearing.cpp @@ -4,17 +4,17 @@ namespace big { void tab_current_profile::tab_gearing() { - if (ImGui::BeginTabItem("Gearing")) + if (ImGui::BeginTabItem("HANDLING_TAB_GEARING"_T.data())) { - ImGui::Text("Initial Drive Gears"); + ImGui::Text("HANDLING_INITIAL_DRIVE_GEARS"_T.data()); int initial_drive_gears = g_local_player->m_vehicle->m_handling_data->m_initial_drive_gears; if (ImGui::DragInt("###handling_drive_gears", &initial_drive_gears, .1f, 1, 16)) g_local_player->m_vehicle->m_handling_data->m_initial_drive_gears = initial_drive_gears; - ImGui::Text("Upshift Multiplier"); + ImGui::Text("HANDLING_UPSHIFT_MULTIPLIER"_T.data()); ImGui::DragFloat("###handling_upshift", &g_local_player->m_vehicle->m_handling_data->m_upshift, .01f, 0.f, 10.f); - ImGui::Text("Downshift Multiplier"); + ImGui::Text("HANDLING_DOWNSHIFT_MULTIPLIER"_T.data()); ImGui::DragFloat("###handling_downshift", &g_local_player->m_vehicle->m_handling_data->m_downshift, .01f, 0.f, 10.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_general.cpp b/src/gui/handling/current_profile/current_profile_general.cpp index 3aa5c95f..4469820a 100644 --- a/src/gui/handling/current_profile/current_profile_general.cpp +++ b/src/gui/handling/current_profile/current_profile_general.cpp @@ -4,15 +4,15 @@ namespace big { void tab_current_profile::tab_general() { - if (ImGui::BeginTabItem("General")) + if (ImGui::BeginTabItem("HANDLING_TAB_GENERAL"_T.data())) { - ImGui::Text("Gravity"); + ImGui::Text("HANDLING_GRAVITY"_T.data()); ImGui::SliderFloat("##Gravity", &g_local_player->m_vehicle->m_gravity, -50.f, 50.f); - ImGui::Text("Mass"); + ImGui::Text("HANDLING_MASS"_T.data()); ImGui::SliderFloat("##Mass", &g_local_player->m_vehicle->m_handling_data->m_mass, 0.f, 50000.f); - ImGui::Text("Centre of mass"); + ImGui::Text("HANDLING_CENTRE_OF_MASS"_T.data()); float fCenterOfMass[3] { g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.x, @@ -26,7 +26,7 @@ namespace big g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.z = fCenterOfMass[2]; } - ImGui::Text("Buoyancy"); + ImGui::Text("HANDLING_BUOYANCY"_T.data()); ImGui::SliderFloat("##buoyancy", &g_local_player->m_vehicle->m_handling_data->m_buoyancy, .01f, 99.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_other.cpp b/src/gui/handling/current_profile/current_profile_other.cpp index 8035100e..10be9c9f 100644 --- a/src/gui/handling/current_profile/current_profile_other.cpp +++ b/src/gui/handling/current_profile/current_profile_other.cpp @@ -4,15 +4,15 @@ namespace big { void tab_current_profile::tab_other() { - if (ImGui::BeginTabItem("Other")) + if (ImGui::BeginTabItem("HANDLING_TAB_OTHER"_T.data())) { - ImGui::Text("Acceleration Multiplier"); + ImGui::Text("HANDLING_ACCELERATION_MULTIPLIER"_T.data()); ImGui::DragFloat("###handling_acceleration", &g_local_player->m_vehicle->m_handling_data->m_acceleration, 1.f, .01f, 10.f); - ImGui::Text("Downforce Multiplier"); + ImGui::Text("HANDLING_DOWNFORCE_MULTIPLIER"_T.data()); ImGui::DragFloat("###handling_downforce", &g_local_player->m_vehicle->m_handling_data->m_downforce_multiplier, 1.f, 0.f, 10.f); - ImGui::Text("Inertia Multiplier"); + ImGui::Text("HANDLING_INERTIA_MULTIPLIER"_T.data()); float fInertiaMult[3]; fInertiaMult[0] = g_local_player->m_vehicle->m_handling_data->m_inertia_mult.x; fInertiaMult[1] = g_local_player->m_vehicle->m_handling_data->m_inertia_mult.y; diff --git a/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp b/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp index 45b44022..4b2da15d 100644 --- a/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp +++ b/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp @@ -4,16 +4,16 @@ namespace big { void tab_current_profile::tab_roll_centre_height() { - if (ImGui::BeginTabItem("Roll Centre Height")) + if (ImGui::BeginTabItem("HANDLING_TAB_ROLL_CENTRE_HEIGHT"_T.data())) { - ImGui::Text("The point in the transverse vertical plane through any pair of wheel centres\nat which lateral forces apply to the sprung mass without producing suspension roll."); + ImGui::Text("HANDLING_ROLL_CENTRE_HEIGHT_DESCRIPTION"_T.data()); ImGui::Separator(); - ImGui::Text("Roll Centre Height Front"); + ImGui::Text("HANDLING_ROLL_CENTRE_HEIGHT_FRONT"_T.data()); ImGui::SliderFloat("##roll centre height front", &g_local_player->m_vehicle->m_handling_data->m_roll_centre_height_front, -1.f, 1.f); - ImGui::Text("Roll Centre Height Back"); + ImGui::Text("HANDLING_ROLL_CENTRE_HEIGHT_BACK"_T.data()); ImGui::SliderFloat("##roll centre height back", &g_local_player->m_vehicle->m_handling_data->m_roll_centre_height_rear, -1.f, 1.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_rollbars.cpp b/src/gui/handling/current_profile/current_profile_rollbars.cpp index e088381e..88fd04be 100644 --- a/src/gui/handling/current_profile/current_profile_rollbars.cpp +++ b/src/gui/handling/current_profile/current_profile_rollbars.cpp @@ -4,12 +4,12 @@ namespace big { void tab_current_profile::tab_rollbars() { - if (ImGui::BeginTabItem("Rollbars")) + if (ImGui::BeginTabItem("HANDLING_TAB_ROLLBARS"_T.data())) { - ImGui::Text("Anti-Roll Bar force"); + ImGui::Text("HANDLING_ANTI_ROLL_BAR_FORCE"_T.data()); ImGui::SliderFloat("##anti rollbar force", &g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_force, 0.f, 10.f); - ImGui::Text("Anti-Roll Bar Bias front (0 = front, 1 = rear)"); + ImGui::Text("HANDLING_ANTI_ROLL_BAR_BIAS_FRONT"_T.data()); float fAntiRollBarBiasFront = g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_bias_front / 2; if (ImGui::SliderFloat("##anti rollbar bias", &fAntiRollBarBiasFront, 0.f, 1.f)) g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_bias_front = fAntiRollBarBiasFront * 2; diff --git a/src/gui/handling/current_profile/current_profile_steering.cpp b/src/gui/handling/current_profile/current_profile_steering.cpp index 2a10bd48..e7d30f6b 100644 --- a/src/gui/handling/current_profile/current_profile_steering.cpp +++ b/src/gui/handling/current_profile/current_profile_steering.cpp @@ -4,9 +4,9 @@ namespace big { void tab_current_profile::tab_steering() { - if (ImGui::BeginTabItem("Steering")) + if (ImGui::BeginTabItem("HANDLING_TAB_STEERING"_T.data())) { - ImGui::Text("Steering Lock (degrees)"); + ImGui::Text("HANDLING_STEERING_LOCK_DEGREES"_T.data()); ImGui::SliderAngle("##steering lock", &g_local_player->m_vehicle->m_handling_data->m_steering_lock, -90.f, 90.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_suspension.cpp b/src/gui/handling/current_profile/current_profile_suspension.cpp index 31f544f3..d24e65b4 100644 --- a/src/gui/handling/current_profile/current_profile_suspension.cpp +++ b/src/gui/handling/current_profile/current_profile_suspension.cpp @@ -4,27 +4,27 @@ namespace big { void tab_current_profile::tab_suspension() { - if (ImGui::BeginTabItem("Suspension")) + if (ImGui::BeginTabItem("HANDLING_TAB_SUSPENSION"_T.data())) { - ImGui::Text("Suspension Force (General Suspension Strength)"); + ImGui::Text("HANDLING_SUSPENSION_FORCE"_T.data()); ImGui::SliderFloat("##suspension force", &g_local_player->m_vehicle->m_handling_data->m_suspension_force, 0.f, 5.f); - ImGui::Text("Suspension Compression Damp (Higher = Less Compression)"); + ImGui::Text("HANDLING_SUSPENSION_COMPRESSION_DAMP"_T.data()); ImGui::SliderFloat("##suspension comp", &g_local_player->m_vehicle->m_handling_data->m_suspension_comp_damp, 0.f, 5.f); - ImGui::Text("Suspension Rebound Damp (Higher = Less Decompression)"); + ImGui::Text("HANDLING_SUSPENSION_REBOUND_DAMP"_T.data()); ImGui::SliderFloat("##suspension rebound", &g_local_player->m_vehicle->m_handling_data->m_suspension_rebound_damp, 0.f, 5.f); - ImGui::Text("Suspension Upper Limit (mostly visual)"); + ImGui::Text("HANDLING_SUSPENSION_UPPER_LIMIT"_T.data()); ImGui::SliderFloat("##suspension upper", &g_local_player->m_vehicle->m_handling_data->m_suspension_upper_limit, -1.f, 1.f); - ImGui::Text("Suspension Lower Limit (mostly visual)"); + ImGui::Text("HANDLING_SUSPENSION_LOWER_LIMIT"_T.data()); ImGui::SliderFloat("##suspension lower", &g_local_player->m_vehicle->m_handling_data->m_suspension_lower_limit, -1.f, 1.f); - ImGui::Text("Suspension Raise (Ride Height)"); + ImGui::Text("HANDLING_SUSPENSION_RAISE"_T.data()); ImGui::SliderFloat("##suspension raise", &g_local_player->m_vehicle->m_handling_data->m_suspension_raise, -1.f, 1.f); - ImGui::Text("Suspension Bias Front (Strength Bias, 1 = front, 0 = rear)"); + ImGui::Text("HANDLING_SUSPENSION_BAIS_FRONT"_T.data()); float fSuspensionBiasFront = g_local_player->m_vehicle->m_handling_data->m_suspension_bias_front / 2; if (ImGui::SliderFloat("##suspension bias", &fSuspensionBiasFront, 0.f, 1.f)) g_local_player->m_vehicle->m_handling_data->m_suspension_bias_front = fSuspensionBiasFront * 2; diff --git a/src/gui/handling/current_profile/current_profile_traction.cpp b/src/gui/handling/current_profile/current_profile_traction.cpp index d8b278e5..175f6082 100644 --- a/src/gui/handling/current_profile/current_profile_traction.cpp +++ b/src/gui/handling/current_profile/current_profile_traction.cpp @@ -4,32 +4,32 @@ namespace big { void tab_current_profile::tab_traction() { - if (ImGui::BeginTabItem("Traction")) + if (ImGui::BeginTabItem("HANDLING_TAB_TRACTION"_T.data())) { - ImGui::Text("Minimum Traction"); + ImGui::Text("HANDLING_MINIMUM_TRACTION"_T.data()); ImGui::SliderFloat("##traction curve min", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_min, 0.f, 7.f); - ImGui::Text("Peak Traction before grip is lost"); + ImGui::Text("HANDLING_PEAK_TRACTION"_T.data()); ImGui::SliderFloat("##traction curve max", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_max, 0.f, 7.f); - ImGui::Text("Traction Curve (point of grip loss)"); + ImGui::Text("HANDLING_TRACTION_CURVE"_T.data()); ImGui::SliderAngle("##traction curve lateral", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_lateral); - ImGui::Text("Traction Height Loss (distance ground and tires)"); + ImGui::Text("HANDLING_TRACTION_HEIGHT_LOSS"_T.data()); ImGui::SliderFloat("##traction spring delta max", &g_local_player->m_vehicle->m_handling_data->m_traction_spring_delta_max, 0.f, 2.f); - ImGui::Text("Burnout Multiplier"); + ImGui::Text("HANDLING_BURNOUT_MULTIPLIER"_T.data()); ImGui::SliderFloat("##low speed traction loss mult", &g_local_player->m_vehicle->m_handling_data->m_low_speed_traction_loss_mult, 0.f, 10.f); //ImGui::Text("Camber Stiffness (grip when drifting)"); //ImGui::SliderFloat("##camber stiffness", &g_local_player->m_vehicle->m_handling_data->m_camber_stiffness, -1.f, 1.f); - ImGui::Text("Traction Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)"); + ImGui::Text("HANDLING_TRACTION_BIAS"_T.data()); float fTractionBiasFront = g_local_player->m_vehicle->m_handling_data->m_traction_bias_front / 2; if (ImGui::SliderFloat("##traction bias front", &fTractionBiasFront, 0.01f, .99f)) g_local_player->m_vehicle->m_handling_data->m_traction_bias_front = fTractionBiasFront * 2; - ImGui::Text("Off-Road Traction Loss (1.0 = normal, lower = better)"); + ImGui::Text("HANDLING_OFF_ROAD_LOSS"_T.data()); ImGui::SliderFloat("##traction loss mult", &g_local_player->m_vehicle->m_handling_data->m_traction_loss_mult, 0.f, 5.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/current_profile/current_profile_transmission.cpp b/src/gui/handling/current_profile/current_profile_transmission.cpp index 1dbf81a1..cb9b6da7 100644 --- a/src/gui/handling/current_profile/current_profile_transmission.cpp +++ b/src/gui/handling/current_profile/current_profile_transmission.cpp @@ -4,19 +4,19 @@ namespace big { void tab_current_profile::tab_transmission() { - if (ImGui::BeginTabItem("Transmission")) + if (ImGui::BeginTabItem("HANDLING_TAB_TRANSMISSION"_T.data())) { - ImGui::Text("Drive Bias (1.0 = front, 0.0 = rear, 0.5 = balanced 4WD)"); + ImGui::Text("HANDLING_DRIVE_BIAS_FRONT"_T.data()); float fDriveBiasFront = g_local_player->m_vehicle->m_handling_data->m_drive_bias_front / 2; if (ImGui::SliderFloat("##drive_bias_front", &fDriveBiasFront, 0.f, 1.0f)) g_local_player->m_vehicle->m_handling_data->m_drive_bias_front = fDriveBiasFront * 2; - ImGui::Text("Drive Bias (1.0 = rear, 0.0 = front, 0.5 = balanced 4WD)"); + ImGui::Text("HANDLING_DRIVE_BIAS_REAR"_T.data()); float fDriveBiasRear = g_local_player->m_vehicle->m_handling_data->m_drive_bias_rear / 2; if (ImGui::SliderFloat("##drive_bias_rear", &fDriveBiasRear, 0.f, 1.0f)) g_local_player->m_vehicle->m_handling_data->m_drive_bias_rear = fDriveBiasRear * 2; - ImGui::Text("Transmission Output (force)"); + ImGui::Text("HANDLING_TRANSMISSION_OUTPUT"_T.data()); ImGui::SliderFloat("##initial drive force", &g_local_player->m_vehicle->m_handling_data->m_initial_drive_force, 0.01f, 2.f); ImGui::EndTabItem(); diff --git a/src/gui/handling/handling_current_profile.cpp b/src/gui/handling/handling_current_profile.cpp index 9cd98c47..7a1529e9 100644 --- a/src/gui/handling/handling_current_profile.cpp +++ b/src/gui/handling/handling_current_profile.cpp @@ -8,19 +8,19 @@ namespace big { if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - ImGui::Text("Please enter a vehicle."); + ImGui::Text("HANDLING_ENTER_VEHICLE"_T.data()); return; } g_handling_service->backup_vehicle(); - if (components::button("Save Profile")) + if (components::button("HANDLING_SAVE_PROFILE"_T.data())) { - ImGui::OpenPopup("Save Handling"); + ImGui::OpenPopup("HANDLING_SAVE_HANDLING"_T.data()); } modal_handling::modal_save_handling(); ImGui::SameLine(); - if (components::button("Restore Handling")) + if (components::button("HANDLING_RESTORE_HANDLING"_T.data())) g_handling_service->restore_vehicle(); ImGui::Separator(); diff --git a/src/gui/handling/handling_saved_profiles.cpp b/src/gui/handling/handling_saved_profiles.cpp index 51a6d804..39144474 100644 --- a/src/gui/handling/handling_saved_profiles.cpp +++ b/src/gui/handling/handling_saved_profiles.cpp @@ -7,17 +7,16 @@ namespace big { if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - ImGui::Text("Please enter a vehicle."); + ImGui::Text("HANDLING_ENTER_VEHICLE"_T.data()); return; } g_handling_service->backup_vehicle(); - if (components::button("Reload Profiles")) + if (components::button("HANDLING_RELOAD_PROFILES"_T)) { g_handling_service->load_files(); } - if (ImGui::ListBoxHeader("##handling_profiles")) { for (auto& [name, profile] : g_handling_service->profiles()) diff --git a/src/gui/handling/modals/save_handling.cpp b/src/gui/handling/modals/save_handling.cpp index f6a952f2..d2424b53 100644 --- a/src/gui/handling/modals/save_handling.cpp +++ b/src/gui/handling/modals/save_handling.cpp @@ -10,20 +10,20 @@ namespace big void modal_handling::modal_save_handling() { ImGui::SetNextWindowSize({ 520, 325 }, ImGuiCond_FirstUseEver); - if (ImGui::BeginPopupModal("Save Handling")) + if (ImGui::BeginPopupModal("HANDLING_SAVE_HANDLING"_T.data())) { static char name[32]; - components::input_text_with_hint("Name", "Name", name, sizeof(name)); + components::input_text_with_hint("NAME"_T, "NAME"_T, name, sizeof(name)); - if (components::button("Cancel")) + if (components::button("CANCEL"_T)) { strcpy(name, ""); ImGui::CloseCurrentPopup(); } ImGui::SameLine(); - if (components::button("Save")) + if (components::button("SAVE"_T)) { g_thread_pool->push([&] { diff --git a/src/hooks/info/get_network_event_data.cpp b/src/hooks/info/get_network_event_data.cpp index 6d744e21..a5afa0af 100644 --- a/src/hooks/info/get_network_event_data.cpp +++ b/src/hooks/info/get_network_event_data.cpp @@ -12,7 +12,7 @@ namespace big { case rage::eEventNetworkType::CEventNetworkRemovedFromSessionDueToComplaints: { - g_notification_service->push_warning("Kicked", "You have been desync kicked."); + g_notification_service->push_warning("KICKED"_T.data(), "USER_DESYNC_KICKED"_T.data()); break; } case rage::eEventNetworkType::CEventNetworkEntityDamage: diff --git a/src/hooks/player_management/assign_physical_index.cpp b/src/hooks/player_management/assign_physical_index.cpp index d54abb73..1a0d4337 100644 --- a/src/hooks/player_management/assign_physical_index.cpp +++ b/src/hooks/player_management/assign_physical_index.cpp @@ -26,7 +26,10 @@ namespace big << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; if (g.notifications.player_leave.notify) - g_notification_service->push("Player Left", std::format("{} freeing slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id)); + { + g_notification_service->push("PLAYER_LEFT"_T.data(), + std::vformat("PLAYER_LEFT_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id))); + } } return g_hooking->get_original()(netPlayerMgr, player, new_index); @@ -45,7 +48,10 @@ namespace big << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; if (g.notifications.player_join.notify) - g_notification_service->push("Player Joined", std::format("{} taking slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id)); + { + g_notification_service->push("PLAYER_JOINED"_T.data(), + std::vformat("PLAYER_JOINED_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id))); + } auto id = player->m_player_id; g_fiber_pool->queue_job([id] @@ -60,7 +66,8 @@ namespace big if (strcmp(plyr->get_name(), entry->name.data())) { - g_notification_service->push("Players", std::format("{} changed their name to {}", entry->name, plyr->get_name())); + g_notification_service->push("PLAYERS"_T.data(), + std::vformat("PLAYER_CHANGED_NAME"_T, std::make_format_args(entry->name, plyr->get_name()))); entry->name = plyr->get_name(); g_player_database_service->save(); } diff --git a/src/hooks/player_management/network_player_mgr.cpp b/src/hooks/player_management/network_player_mgr.cpp index 6bcd3741..292dadd3 100644 --- a/src/hooks/player_management/network_player_mgr.cpp +++ b/src/hooks/player_management/network_player_mgr.cpp @@ -13,7 +13,7 @@ namespace big if (g.notifications.network_player_mgr_init.log) LOG(INFO) << "CNetworkPlayerMgr#init got called, we're probably entering a session."; if (g.notifications.network_player_mgr_init.notify) - g_notification_service->push("Network Player Manager", "Entering session and initializing player data."); + g_notification_service->push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_INIT"_T.data()); // set our local spoofed name if (g.spoofing.spoof_username && g.spoofing.spoof_local_username) @@ -43,7 +43,7 @@ namespace big if (g.notifications.network_player_mgr_shutdown.log) LOG(INFO) << "CNetworkPlayerMgr#shutdown got called, we're probably leaving our session."; if (g.notifications.network_player_mgr_shutdown.notify) - g_notification_service->push("Network Player Manager", "Leaving session and cleaning up player data."); + g_notification_service->push("NETWORK_PLAYER_MGR"_T.data(), "NETWORK_PLAYER_MGR_DESTROY"_T.data()); g_hooking->get_original()(_this); } diff --git a/src/hooks/protections/handle_join_request.cpp b/src/hooks/protections/handle_join_request.cpp index 6c739e2a..02104fe5 100644 --- a/src/hooks/protections/handle_join_request.cpp +++ b/src/hooks/protections/handle_join_request.cpp @@ -14,7 +14,7 @@ namespace big CMsgJoinResponse response{}; response.m_status_code = player->block_join_reason; g_pointers->m_write_join_response_data(&response, ctx->m_join_response_data, 512, &ctx->m_join_response_size); - g_notification_service->push("Block Join", std::format("Blocked {} from joining", player->name)); + g_notification_service->push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_INFO"_T, std::make_format_args(player->name))); return false; } else diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 1884ecd0..442a5b57 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -95,11 +95,12 @@ namespace big { if (player) { - g_notification_service->push_error("Protections", std::format("Blocked invalid transition launch crash from {}", player->get_name())); + g_notification_service->push_error("PROTECTIONS"_T.data(), + std::vformat("REMOTE_CRASH_INVALID_TRANSITION_FROM"_T, std::make_format_args(player->get_name()))); } else { - g_notification_service->push_error("Protections", "Blocked invalid transition launch remote crash"); + g_notification_service->push_error("PROTECTIONS"_T.data(), "REMOTE_CRASH_INVALID_TRANSITION"_T.data()); } return true; @@ -109,11 +110,12 @@ namespace big { if (player) { - g_notification_service->push_error("Protections", std::format("Blocked invalid blacklist crash from {}", player->get_name())); + g_notification_service->push_error("PROTECTIONS"_T.data(), + std::vformat("REMOTE_CRASH_INVALID_BLACKLIST_FROM"_T, std::make_format_args(player->get_name()))); } else { - g_notification_service->push_error("Protections", "Blocked invalid blacklist remote crash"); + g_notification_service->push_error("PROTECTIONS"_T.data(), "REMOTE_CRASH_INVALID_BLACKLIST"_T.data()); } return true; } @@ -159,7 +161,8 @@ namespace big if (player->m_host_migration_rate_limit.exceeded_last_process()) { session::add_infraction(player, Infraction::TRIED_KICK_PLAYER); - g_notification_service->push_error("Protections", std::format("{} tried to OOM kick you!", player->get_name())); + g_notification_service->push_error("PROTECTIONS"_T.data(), + std::vformat("OOM_KICK"_T, std::make_format_args(player->get_name()))); } return true; } @@ -285,7 +288,8 @@ namespace big { if (player->block_join) { - g_notification_service->push("Join Blocker", std::format("Trying to prevent {} from joining...", player->get_name())); + g_notification_service->push("BLOCK_JOIN"_T.data(), + std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(player->get_name()))); return true; } break; @@ -342,7 +346,7 @@ namespace big auto self = g_player_service->get_self(); if (self->get_net_data() && self->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) { - g_notification_service->push_error("Warning!", "Someone tried to lost connection kick you remotely!"); + g_notification_service->push_error("KICK"_T.data(), "REMOTE_KICK_LOST_CONNECTION"_T.data()); return true; } @@ -350,7 +354,8 @@ namespace big { if (plyr->get_net_data() && plyr->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) { - g_notification_service->push_error("Warning!", std::format("Someone tried to lost connection kick {} remotely!", plyr->get_name())); + g_notification_service->push_error("KICK"_T.data(), + std::vformat("REMOTE_KICK_LOST_CONNECTION_PLAYER"_T, std::make_format_args(plyr->get_name()))); return true; } } @@ -392,9 +397,10 @@ namespace big if (target && count == 1 && frame->m_msg_id == -1) { if (target->id() == g_player_service->get_self()->id()) - g_notification_service->push_error("Warning!", "Someone tried to breakup kick you remotely!"); + g_notification_service->push_error("KICK"_T.data(), "REMOTE_KICK_BREAKUP"_T.data()); else - g_notification_service->push_error("Warning!", std::format("Someone tried to breakup kick {} remotely!", target->get_name())); + g_notification_service->push_error("KICK"_T.data(), + std::vformat("REMOTE_KICK_BREAKUP_PLAYER"_T, std::make_format_args(target->get_name()))); } return true; @@ -403,7 +409,7 @@ namespace big { if (is_kick_instruction(buffer)) { - g_notification_service->push_error("Warning!", "Someone tried to gamer instruction kick you remotely!"); + g_notification_service->push_error("KICK"_T.data(), "REMOTE_KICK_GAMER_INSTRUCTION"_T.data()); return true; } break; diff --git a/src/hooks/protections/received_event.cpp b/src/hooks/protections/received_event.cpp index 45187707..9174c94a 100644 --- a/src/hooks/protections/received_event.cpp +++ b/src/hooks/protections/received_event.cpp @@ -309,7 +309,8 @@ namespace big if (f208 == 0 && entity && entity->gap28 == 4 && reinterpret_cast(entity)->m_player_info && player->m_player_info->m_ped && player->m_player_info->m_ped->m_net_object && ownerNetId != player->m_player_info->m_ped->m_net_object->m_object_id && !offset_object) { - g_notification_service->push_error("Warning!", std::format("{} blamed {} for explosion", player->get_name(), reinterpret_cast(entity)->m_player_info->m_net_player_data.m_name)); + g_notification_service->push_error("WARNING"_T.data(), + std::vformat("BLAMED_FOR_EXPLOSION"_T, std::make_format_args(player->get_name(), reinterpret_cast(entity)->m_player_info->m_net_player_data.m_name))); session::add_infraction(g_player_service->get_by_id(player->m_player_id), Infraction::BLAME_EXPLOSION_DETECTED); return; } @@ -539,7 +540,8 @@ namespace big if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id) { - g_notification_service->push_warning("Protections", std::format("{} tried to remove a weapon.", source_player->get_name())); + g_notification_service->push_warning("PROTECTIONS"_T.data(), + std::vformat("REMOVE_WEAPON_ATTEMPT"_T, std::make_format_args(source_player->get_name()))); g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); return; } @@ -553,7 +555,8 @@ namespace big if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id) { - g_notification_service->push_warning("Protections", std::format("{} tried to remove all weapons.", source_player->get_name())); + g_notification_service->push_warning("PROTECTIONS"_T.data(), + std::vformat("REMOVE_ALL_WEAPONS_ATTEMPT"_T, std::make_format_args(source_player->get_name()))); g_pointers->m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset); return; } diff --git a/src/main.cpp b/src/main.cpp index dab8bd62..7d3c6cb6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,6 +58,9 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) LOG(INFO) << "Yim's Menu Initializing"; LOGF(INFO, "Git Info\n\tBranch:\t%s\n\tHash:\t%s\n\tDate:\t%s", version::GIT_BRANCH, version::GIT_SHA1, version::GIT_DATE); + g_translation_service.init(); + LOG(INFO) << "Translation Service initialized."; + auto thread_pool_instance = std::make_unique(); LOG(INFO) << "Thread pool initialized."; diff --git a/src/services/creator_storage/creator_storage_service.cpp b/src/services/creator_storage/creator_storage_service.cpp index c8a85670..27fae5b8 100644 --- a/src/services/creator_storage/creator_storage_service.cpp +++ b/src/services/creator_storage/creator_storage_service.cpp @@ -46,7 +46,7 @@ namespace big if (!buffer) { - g_notification_service->push_error("Save Job", "Cannot obtain JSON data"); + g_notification_service->push_error("CREATOR_STORAGE_SAVE_JOB"_T.data(), "CREATOR_STORAGE_CANNOT_OBTAIN_JSON"_T.data()); return; } diff --git a/src/services/gui/gui_service.hpp b/src/services/gui/gui_service.hpp index 02e20673..ae632bb1 100644 --- a/src/services/gui/gui_service.hpp +++ b/src/services/gui/gui_service.hpp @@ -45,6 +45,7 @@ namespace big HOTKEY_SETTINGS, REACTION_SETTINGS, PROTECTION_SETTINGS, + TRANSLATION_SETTINGS, DEBUG, PLAYER @@ -101,6 +102,7 @@ namespace big { tabs::HOTKEY_SETTINGS, { "Hotkeys", view::hotkey_settings }}, { tabs::REACTION_SETTINGS, { "Reactions", view::reaction_settings}}, { tabs::PROTECTION_SETTINGS, { "Protection", view::protection_settings}}, + { tabs::TRANSLATION_SETTINGS, { "Translation", view::translation_settings}}, { tabs::DEBUG, { "Debug", nullptr }}, }}}, {tabs::PLAYER, {"", view::view_player}} diff --git a/src/services/notifications/notification_service.cpp b/src/services/notifications/notification_service.cpp index dfe52fa3..84d52c61 100644 --- a/src/services/notifications/notification_service.cpp +++ b/src/services/notifications/notification_service.cpp @@ -5,7 +5,10 @@ namespace big { notification_service::notification_service() { - push("Welcome", std::format("Loaded YimMenu. Press {} to open", ImGui::key_names[g.settings.hotkeys.menu_toggle])); + push( + "NOTIFICATION_WELCOME_TITLE"_T.data(), + std::vformat("NOTIFICATION_WELCOME_TEXT"_T, std::make_format_args(ImGui::key_names[g.settings.hotkeys.menu_toggle])) + ); g_notification_service = this; } diff --git a/src/services/translation_service/local_index.hpp b/src/services/translation_service/local_index.hpp new file mode 100644 index 00000000..267bbc90 --- /dev/null +++ b/src/services/translation_service/local_index.hpp @@ -0,0 +1,18 @@ +#pragma once +#include "translation_entry.hpp" + +namespace big +{ + class local_index + { + public: + int version = -1; + std::string selected_language; + std::string fallback_default_language; + std::map fallback_languages; + + NLOHMANN_DEFINE_TYPE_INTRUSIVE(local_index, version, selected_language, fallback_default_language, fallback_languages) + + }; + +} \ No newline at end of file diff --git a/src/services/translation_service/remote_index.hpp b/src/services/translation_service/remote_index.hpp new file mode 100644 index 00000000..6a8ba153 --- /dev/null +++ b/src/services/translation_service/remote_index.hpp @@ -0,0 +1,16 @@ +#pragma once +#include "translation_entry.hpp" + +namespace big +{ + class remote_index + { + public: + int version = -1; + std::string default_lang; + std::map translations; + + NLOHMANN_DEFINE_TYPE_INTRUSIVE(remote_index, version, default_lang, translations) + + }; +} \ No newline at end of file diff --git a/src/services/translation_service/translation_entry.hpp b/src/services/translation_service/translation_entry.hpp new file mode 100644 index 00000000..74007202 --- /dev/null +++ b/src/services/translation_service/translation_entry.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace big +{ + class translation_entry + { + public: + std::string name; + std::string file; + + NLOHMANN_DEFINE_TYPE_INTRUSIVE(translation_entry, name, file) + }; +} \ No newline at end of file diff --git a/src/services/translation_service/translation_service.cpp b/src/services/translation_service/translation_service.cpp new file mode 100644 index 00000000..3bf948ff --- /dev/null +++ b/src/services/translation_service/translation_service.cpp @@ -0,0 +1,213 @@ +#include "translation_service.hpp" +#include "file_manager.hpp" +#include "thread_pool.hpp" +#include + +namespace big +{ + translation_service::translation_service() : + m_url("https://cdn.jsdelivr.net/gh/YimMenu/Translations@master") + { + + } + + void translation_service::init() + { + m_translation_directory = std::make_unique(g_file_manager->get_project_folder("./translations").get_path()); + + bool loaded_remote_index = false; + for (size_t i = 0; i < 5 && !loaded_remote_index; i++) + { + if (i) + LOG(WARNING) << "Failed to download remote index, trying again... (" << i << ")"; + loaded_remote_index = download_index(); + } + + if (load_local_index()) + { + if (!loaded_remote_index) + { + LOG(WARNING) << "Failed to load remote index, attempting to use fallback."; + use_fallback_remote(); + } + else if (m_local_index.version < m_remote_index.version) + { + LOG(INFO) << "Languages outdated, downloading new translations."; + + update_language_packs(); + m_local_index.version = m_remote_index.version; + } + load_translations(); + + return; + } + + if (!loaded_remote_index) + { + LOG(WARNING) << "Failed to load remote index, unable to load translations."; + return; + } + + LOG(INFO) << "Downloading translations..."; + + m_local_index.fallback_default_language = m_remote_index.default_lang; + m_local_index.selected_language = m_remote_index.default_lang; + m_local_index.version = m_remote_index.version; + + load_translations(); + } + + std::string_view translation_service::get_translation(const std::string_view translation_key) const + { + return get_translation(rage::joaat(translation_key)); + } + + + std::string_view translation_service::get_translation(const rage::joaat_t translation_key) const + { + if (auto it = m_translations.find(translation_key); it != m_translations.end()) + return it->second.c_str(); + + return { 0, 0 }; + } + + std::map& translation_service::available_translations() + { + return m_remote_index.translations; + } + + const std::string& translation_service::current_language_pack() + { + return m_local_index.selected_language; + } + + void translation_service::select_language_pack(const std::string& pack_id) + { + g_thread_pool->push([this, &pack_id] + { + m_local_index.selected_language = pack_id; + load_translations(); + }); + } + + void translation_service::load_translations() + { + m_translations.clear(); + + // load default lang first to make sure there are fallback keys if another language pack doesn't have a certain key + auto j = load_translation(m_remote_index.default_lang); + for (auto& [key, value] : j.items()) + { + m_translations.insert({ rage::joaat(key), value.get() }); + } + + // Don't load selected language if it's the same as default + if (m_local_index.selected_language != m_remote_index.default_lang) + { + auto j = load_translation(m_local_index.selected_language); + for (auto &[key, value] : j.items()) + { + m_translations[rage::joaat(key)] = value; + } + } + + save_local_index(); + } + + nlohmann::json translation_service::load_translation(const std::string_view pack_id) + { + auto file = m_translation_directory->get_file(std::format("./{}.json", pack_id)); + if (!file.exists()) + { + LOG(INFO) << "Translations for '" << pack_id << "' does not exist, downloading..."; + if (!download_language_pack(pack_id)) + { + LOG(WARNING) << "Failed to download language pack, can't recover..."; + return {}; + } + // make a copy available + m_local_index.fallback_languages[pack_id.data()] = m_remote_index.translations[pack_id.data()]; + } + return nlohmann::json::parse(std::ifstream(file.get_path(), std::ios::binary)); + } + + bool translation_service::download_language_pack(const std::string_view pack_id) + { + if (auto it = m_remote_index.translations.find(pack_id.data()); it != m_remote_index.translations.end()) + { + cpr::Response response = cpr::Get(cpr::Url{ m_url + "/" + it->second.file }); + + if (response.status_code == 200) + { + auto json = nlohmann::json::parse(response.text); + auto lang_file = m_translation_directory->get_file("./" + it->second.file); + + auto out_file = std::ofstream(lang_file.get_path(), std::ios::binary | std::ios::trunc); + out_file << json.dump(4); + out_file.close(); + + return true; + } + } + return false; + } + + void translation_service::update_language_packs() + { + for (auto item : std::filesystem::directory_iterator(m_translation_directory->get_path())) + { + const auto path = item.path(); + const auto stem = path.stem().string(); + if (stem == "index" || item.path().extension() != ".json") + continue; + + if (!download_language_pack(stem)) + { + LOG(WARNING) << "Failed to update '" << stem << "' language pack"; + } + } + } + + bool translation_service::download_index() + { + cpr::Response response = cpr::Get(cpr::Url{ m_url + "/index.json" }); + + if (response.status_code == 200) + { + m_remote_index = nlohmann::json::parse(response.text); + + return true; + } + return false; + } + + bool translation_service::load_local_index() + { + const auto local_index = m_translation_directory->get_file("./index.json"); + if (local_index.exists()) + { + const auto path = local_index.get_path(); + m_local_index = nlohmann::json::parse(std::ifstream(path, std::ios::binary)); + + return true; + } + return false; + } + + void translation_service::save_local_index() + { + nlohmann::json j = m_local_index; + + const auto local_index = m_translation_directory->get_file("./index.json"); + + auto os = std::ofstream(local_index.get_path(), std::ios::binary | std::ios::trunc); + os << j.dump(4); + os.close(); + } + + void translation_service::use_fallback_remote() + { + m_remote_index.default_lang = m_local_index.fallback_default_language; + m_remote_index.translations = m_local_index.fallback_languages; + } +} diff --git a/src/services/translation_service/translation_service.hpp b/src/services/translation_service/translation_service.hpp new file mode 100644 index 00000000..49b677c0 --- /dev/null +++ b/src/services/translation_service/translation_service.hpp @@ -0,0 +1,88 @@ +#pragma once +#include "gta/joaat.hpp" +#include "file_manager/folder.hpp" +#include "local_index.hpp" +#include "remote_index.hpp" + +namespace big +{ + using translation_map = std::unordered_map; + + class translation_service + { + public: + translation_service(); + virtual ~translation_service() = default; + translation_service(const translation_service&) = delete; + translation_service(translation_service&&) noexcept = delete; + translation_service& operator=(const translation_service&) = delete; + translation_service& operator=(translation_service&&) noexcept = delete; + + void init(); + + std::string_view get_translation(const std::string_view translation_key) const; + std::string_view get_translation(const rage::joaat_t translation_key) const; + + std::map& available_translations(); + const std::string& current_language_pack(); + void select_language_pack(const std::string& pack_id); + + private: + void load_translations(); + nlohmann::json load_translation(const std::string_view pack_id); + + bool download_language_pack(const std::string_view pack_id); + void update_language_packs(); + + /** + * @brief Downloads the remote index to compare with our local index + * + * @return true + * @return false + */ + bool download_index(); + bool load_local_index(); + void save_local_index(); + /** + * @brief Attempts to load the remote from the local index fallback + */ + void use_fallback_remote(); + + private: + const std::string m_url; + std::unique_ptr m_translation_directory; + local_index m_local_index; + remote_index m_remote_index; + + translation_map m_translations; + + }; + + inline auto g_translation_service = translation_service(); + + template + struct TranslationLiteral + { + rage::joaat_t m_hash; + char m_key[N]{}; + + consteval TranslationLiteral(char const(&pp)[N]) + { + std::ranges::copy(pp, m_key); + m_hash = rage::joaat(pp); + }; + + const std::string_view translation() const + { + if (const auto translation = g_translation_service.get_translation(m_hash); translation.length()) + return translation; + return m_key; + } + }; + + template + constexpr auto operator"" _T() + { + return T.translation(); + } +} \ No newline at end of file diff --git a/src/services/vehicle/persist_car_service.cpp b/src/services/vehicle/persist_car_service.cpp index b102d57b..cb8cc70f 100644 --- a/src/services/vehicle/persist_car_service.cpp +++ b/src/services/vehicle/persist_car_service.cpp @@ -13,7 +13,7 @@ namespace big if (!ENTITY::DOES_ENTITY_EXIST(vehicle) || !ENTITY::IS_ENTITY_A_VEHICLE(vehicle)) { - g_notification_service->push_warning("Persist Car", "Tried to save a vehicle which does not exist"); + g_notification_service->push_warning("PERSIST_CAR_TITLE"_T.data(), "PERSIST_CAR_INVALID_VEHICLE_SAVE_ATTEMPT"_T.data()); return; } diff --git a/src/util/spam.hpp b/src/util/spam.hpp index 54e2d7e7..fc3a5aef 100644 --- a/src/util/spam.hpp +++ b/src/util/spam.hpp @@ -25,7 +25,8 @@ namespace "doit#", "krutka#", "", - "\xD0\xBC\xD0\xB5", // Cyrillic "me" + // causes false positives for people typing in cyrillic + // "\xD0\xBC\xD0\xB5", // Cyrillic "me" "P888", "gtacash", "\xE6\x89\xA3\xE6\x89\xA3", // no clue what this is diff --git a/src/util/teleport.hpp b/src/util/teleport.hpp index a0926732..61a5438d 100644 --- a/src/util/teleport.hpp +++ b/src/util/teleport.hpp @@ -12,13 +12,13 @@ namespace big::teleport if (ENTITY::IS_ENTITY_DEAD(ent, true)) { - g_notification_service->push_warning("Teleport", "Target player is dead."); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_PLAYER_IS_DEAD"_T.data()); return false; } if (!PED::IS_PED_IN_ANY_VEHICLE(ent, true)) { - g_notification_service->push_warning("Teleport", "Target player is not in a vehicle."); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_PLAYER_IS_NOT_IN_VEHICLE"_T.data()); return false; } @@ -27,7 +27,7 @@ namespace big::teleport if (entity::take_control_of(ent)) ENTITY::SET_ENTITY_COORDS(ent, coords.x, coords.y, coords.z, 0, 0, 0, 0); else - g_notification_service->push_warning("Teleport", "Failed to take control of player vehicle."); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_FAILED_TO_TAKE_CONTROL"_T.data()); return true; } @@ -71,7 +71,7 @@ namespace big::teleport { if (!ENTITY::IS_ENTITY_A_VEHICLE(veh)) { - g_notification_service->push_warning("Teleport", "Invalid vehicle handle"); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_INVALID_VEHICLE"_T.data()); return false; } @@ -84,7 +84,7 @@ namespace big::teleport if (seat_index == 255) { - g_notification_service->push_warning("Teleport", "No seats are free in the player vehicle."); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_NO_SEATS_FREE"_T.data()); return false; } @@ -141,7 +141,7 @@ namespace big::teleport { if (!to_blip((int)BlipIcons::Waypoint)) { - g_notification_service->push_warning("Teleport", "Failed to find waypoint position"); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_NO_WAYPOINT_SET"_T.data()); return false; } @@ -154,7 +154,7 @@ namespace big::teleport if (!blip::get_objective_location(location)) { - g_notification_service->push_warning("Teleport", "Failed to find objective position"); + g_notification_service->push_warning("TELEPORT"_T.data(), "TELEPORT_NO_OBJECTIVE"_T.data()); return false; } diff --git a/src/util/toxic.hpp b/src/util/toxic.hpp index f4ded625..6573355a 100644 --- a/src/util/toxic.hpp +++ b/src/util/toxic.hpp @@ -57,13 +57,13 @@ namespace big::toxic { if (!g_player_service->get_self()->is_host()) { - g_notification_service->push_error("Modify Time", "Modifying time requires session host"); + g_notification_service->push_error("MODIFY_TIME"_T.data(), "MODIFY_TIME_HOST_REQUIRED"_T.data()); return false; } if (!target->player_time_value.has_value()) { - g_notification_service->push_error("Modify Time", "We do not have the player's timestamp yet"); + g_notification_service->push_error("MODIFY_TIME"_T.data(), "MODIFY_TIME_NO_PLAYER_TIMESTAMP"_T.data()); return false; } @@ -91,7 +91,7 @@ namespace big::toxic { if (!target->player_time_value.has_value()) { - g_notification_service->push_error("Warp Time", "We do not have the player's timestamp yet"); + g_notification_service->push_error("WARP_TIME_TITLE"_T.data(), "MODIFY_TIME_NO_PLAYER_TIMESTAMP"_T.data()); return; } @@ -103,7 +103,7 @@ namespace big::toxic { if (!g_player_service->get_self()->is_host()) { - g_notification_service->push_error("Modify Time", "Modifying time requires session host"); + g_notification_service->push_error("MODIFY_TIME"_T.data(), "MODIFY_TIME_HOST_REQUIRED"_T.data()); return; } diff --git a/src/util/train.hpp b/src/util/train.hpp index c99dedda..38019482 100644 --- a/src/util/train.hpp +++ b/src/util/train.hpp @@ -46,17 +46,16 @@ namespace big::train entity::take_control_of(train); PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), train, -1); - g_notification_service->push_error("Hijack Train", "Found a train nearby"); + g_notification_service->push_error("HIJACK_TRAIN"_T.data(), "HIJACK_TRAIN_FOUND_TRAIN"_T.data()); } } inline void delete_train() { - if (!PED::IS_PED_IN_ANY_VEHICLE(PLAYER::PLAYER_PED_ID(), false) && get_closest_train() != 0) { VEHICLE::DELETE_ALL_TRAINS(); - g_notification_service->push_error("Hijack Train", "Deleted the nearby train"); + g_notification_service->push_error("HIJACK_TRAIN"_T.data(), "HIJACK_TRAIN_DELETED_TRAIN"_T.data()); } } diff --git a/src/util/vehicle.hpp b/src/util/vehicle.hpp index 22ae8015..118dc135 100644 --- a/src/util/vehicle.hpp +++ b/src/util/vehicle.hpp @@ -70,13 +70,13 @@ namespace big::vehicle inline void bring(Vehicle veh, Vector3 location, bool put_in = true, int seatIdx = -1) { - if (!ENTITY::IS_ENTITY_A_VEHICLE(veh)) return g_notification_service->push_error("Vehicle", "Invalid handle"); + if (!ENTITY::IS_ENTITY_A_VEHICLE(veh)) return g_notification_service->push_error("VEHICLE"_T.data(), "VEHICLE_INVALID"_T.data()); auto vecVehicleLocation = ENTITY::GET_ENTITY_COORDS(veh, true); teleport::load_ground_at_3dcoord(vecVehicleLocation); if (!entity::take_control_of(veh)) - return g_notification_service->push_warning("Vehicle", "Failed to take control of remote vehicle."); + return g_notification_service->push_warning("VEHICLE"_T.data(), "VEHICLE_FAILED_CONTROL"_T.data()); auto ped = self::ped; ENTITY::SET_ENTITY_COORDS(veh, location.x, location.y, location.z + 1.f, 0, 0, 0, 0); @@ -654,14 +654,14 @@ namespace big::vehicle if (current_vehicle) VEHICLE::SET_VEHICLE_ENGINE_ON(current_vehicle, state, immediately, disable_auto_start); else - return g_notification_service->push_warning("Vehicle", "Please be in a car first then try again."); + return g_notification_service->push_warning("VEHICLE"_T.data(), "PLEASE_ENTER_VEHICLE"_T.data()); } inline bool remote_control_vehicle(Vehicle veh) { if (!entity::take_control_of(veh, 4000)) { - g_notification_service->push_warning("Remote Control", "Failed to take control of remote vehicle"); + g_notification_service->push_warning("REMOTE_CONTROL"_T.data(), "VEHICLE_FAILED_CONTROL"_T.data()); return false; } diff --git a/src/views/core/view_heading.cpp b/src/views/core/view_heading.cpp index d2f79054..e88a4061 100644 --- a/src/views/core/view_heading.cpp +++ b/src/views/core/view_heading.cpp @@ -10,15 +10,15 @@ namespace big if (ImGui::Begin("menu_heading", nullptr, window_flags | ImGuiWindowFlags_NoScrollbar)) { ImGui::BeginGroup(); - ImGui::Text("Welcome"); + ImGui::Text("HEADING_WELCOME"_T.data()); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.172f, 0.380f, 0.909f, 1.f)); - ImGui::Text(g_local_player == nullptr || g_local_player->m_player_info == nullptr ? "unknown" : g_local_player->m_player_info->m_net_player_data.m_name); + ImGui::Text(g_local_player == nullptr || g_local_player->m_player_info == nullptr ? "UNKNOWN_USERNAME"_T.data() : g_local_player->m_player_info->m_net_player_data.m_name); ImGui::PopStyleColor(); ImGui::EndGroup(); ImGui::SameLine(); - ImGui::SetCursorPos({ 300.f - ImGui::CalcTextSize("Unload").x - ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().WindowPadding.y / 2 + ImGui::GetStyle().ItemSpacing.y + (ImGui::CalcTextSize("W").y / 2) }); + ImGui::SetCursorPos({ 300.f - ImGui::CalcTextSize("UNLOAD"_T.data()).x - ImGui::GetStyle().ItemSpacing.x, ImGui::GetStyle().WindowPadding.y / 2 + ImGui::GetStyle().ItemSpacing.y + (ImGui::CalcTextSize("W").y / 2) }); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.69f, 0.29f, 0.29f, 1.00f)); - if (components::nav_button("Unload")) + if (components::nav_button("UNLOAD"_T)) { g_fiber_pool->queue_job([] { diff --git a/src/views/debug/view_debug.cpp b/src/views/debug/view_debug.cpp index af859bfb..e45237f7 100644 --- a/src/views/debug/view_debug.cpp +++ b/src/views/debug/view_debug.cpp @@ -8,7 +8,7 @@ namespace big if (strcmp(g_gui_service->get_selected()->name, "Debug")) return; - if (ImGui::Begin("Debug")) + if (ImGui::Begin("DEBUG_WINDOW"_T.data())) { ImGui::BeginTabBar("debug_tabbar"); misc(); @@ -16,6 +16,7 @@ namespace big globals(); locals(); script_events(); + scripts(); ImGui::EndTabBar(); } ImGui::End(); diff --git a/src/views/debug/view_debug.hpp b/src/views/debug/view_debug.hpp index 675e1823..1dd444bf 100644 --- a/src/views/debug/view_debug.hpp +++ b/src/views/debug/view_debug.hpp @@ -7,6 +7,7 @@ namespace big::debug extern void logs(); extern void misc(); extern void script_events(); + extern void scripts(); extern void main(); } \ No newline at end of file diff --git a/src/views/debug/view_debug_globals.cpp b/src/views/debug/view_debug_globals.cpp index 0d5e9c25..3da79238 100644 --- a/src/views/debug/view_debug_globals.cpp +++ b/src/views/debug/view_debug_globals.cpp @@ -7,25 +7,25 @@ namespace big { void debug::globals() { - if (ImGui::BeginTabItem("Globals")) + if (ImGui::BeginTabItem("DEBUG_TAB_GLOBALS"_T.data())) { - if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running) + if (ImGui::Checkbox("DEBUG_GLOBALS_ENABLE_FREEZING"_T.data(), &g_globals_service->m_running) && g_globals_service->m_running) g_thread_pool->push([&]() { g_globals_service->loop(); }); - if (components::button("Load")) + if (components::button("LOAD"_T)) g_globals_service->load(); ImGui::SameLine(); - if (components::button("Save")) + if (components::button("SAVE"_T)) g_globals_service->save(); ImGui::SameLine(); - if (components::button("Add Global")) + if (components::button("DEBUG_GLOBALS_ADD"_T)) { - ImGui::OpenPopup("New Global"); + ImGui::OpenPopup("DEBUG_GLOBALS_NEW"_T.data()); } - if (ImGui::BeginPopupModal("New Global")) + if (ImGui::BeginPopupModal("DEBUG_GLOBALS_NEW"_T.data())) { static int base_address = 0; static bool freeze = false; @@ -34,13 +34,13 @@ namespace big static int offset_count = 0; static int previous_offset_count = 0; - ImGui::Text("Name:"); + ImGui::Text("DEBUG_GLOBALS_NAME"_T.data()); components::input_text_with_hint("##global_name", "Name", name, sizeof(name)); - ImGui::Text("Base Address:"); + ImGui::Text("DEBUG_GLOBALS_BASE_ADDRESS"_T.data()); ImGui::InputInt("##modal_global_base_addr", &base_address); - ImGui::Text("Freeze:"); + ImGui::Text("DEBUG_GLOBAL_FREEZE"_T.data()); ImGui::Checkbox("##modal_global_freeze", &freeze); - ImGui::Text("Number of Offsets:"); + ImGui::Text("DEBUG_GLOBAL_OFFSET_COUNT"_T.data()); ImGui::InputInt("##modal_offset_count", &offset_count); if (offset_count < 0) offset_count = 0; @@ -64,10 +64,10 @@ namespace big ImGui::Separator(); - ImGui::Text("Offset: %d", i + 1); + ImGui::Text("DEBUG_GLOBAL_OFFSET"_T.data(), i + 1); ImGui::InputInt("##offset", &offsets[i][0]); - ImGui::Text("Size:"); + ImGui::Text("DEBUG_GLOBAL_SIZE"_T.data()); ImGui::SameLine(); ImGui::InputInt("##size", &offsets[i][1]); @@ -75,7 +75,7 @@ namespace big } ImGui::PopItemWidth(); - if (components::button("Cancel")) + if (components::button("CANCEL"_T)) { strcpy(name, ""); freeze = false; @@ -87,7 +87,7 @@ namespace big ImGui::CloseCurrentPopup(); } ImGui::SameLine(); - if (components::button("Save")) + if (components::button("SAVE"_T)) { auto new_global = global(name, base_address, freeze, offsets, offset_count); new_global.build_cache(); @@ -114,12 +114,12 @@ namespace big ImGui::Separator(); ImGui::PushID(global.get_id()); - ImGui::Checkbox("Freeze", &global.m_freeze); + ImGui::Checkbox("DEBUG_GLOBAL_FREEZE_TOGGLE"_T.data(), &global.m_freeze); ImGui::BeginGroup(); - ImGui::Text("Name:"); - ImGui::Text("Value:"); + ImGui::Text("DEBUG_GLOBALS_NAME"_T.data()); + ImGui::Text("DEBUG_GLOBALS_VALUE"_T.data()); ImGui::EndGroup(); @@ -139,7 +139,7 @@ namespace big ImGui::BeginGroup(); - if (components::button("Delete")) + if (components::button("DELETE"_T)) { for (int i = 0; i < g_globals_service->m_globals.size(); i++) if (auto& it = g_globals_service->m_globals.at(i); it.get_id() == global.get_id()) @@ -148,7 +148,7 @@ namespace big break; } - if (components::button("Write")) + if (components::button("WRITE"_T)) global.write(); ImGui::PopID(); diff --git a/src/views/debug/view_debug_locals.cpp b/src/views/debug/view_debug_locals.cpp index 742ef3c0..3d06d845 100644 --- a/src/views/debug/view_debug_locals.cpp +++ b/src/views/debug/view_debug_locals.cpp @@ -4,7 +4,7 @@ namespace big { void debug::locals() { - if (ImGui::BeginTabItem("Locals")) + if (ImGui::BeginTabItem("DEBUG_TAB_LOCALS"_T.data())) { ImGui::EndTabItem(); diff --git a/src/views/debug/view_debug_misc.cpp b/src/views/debug/view_debug_misc.cpp index 9f01dfd1..0f9ce0a2 100644 --- a/src/views/debug/view_debug_misc.cpp +++ b/src/views/debug/view_debug_misc.cpp @@ -13,7 +13,7 @@ namespace big { void debug::misc() { - if (ImGui::BeginTabItem("Misc")) + if (ImGui::BeginTabItem("DEBUG_TAB_MISC"_T.data())) { if (components::button("Dump entrypoints")) { @@ -25,7 +25,7 @@ namespace big NETWORK::NETWORK_BAIL(16, 0, 0); }); - components::button("Remove from Bad Sport", [] + components::button("DEBUG_REMOVE_FROM_BAD_SPORT"_T, [] { STATS::STAT_SET_FLOAT(RAGE_JOAAT("mpply_overall_badsport"), 0.0f, TRUE); STATS::STAT_SET_BOOL(RAGE_JOAAT("mpply_was_i_bad_sport"), FALSE, TRUE); diff --git a/src/views/debug/view_debug_script_events.cpp b/src/views/debug/view_debug_script_events.cpp index ccfb4e49..574013a7 100644 --- a/src/views/debug/view_debug_script_events.cpp +++ b/src/views/debug/view_debug_script_events.cpp @@ -6,7 +6,7 @@ namespace big { void debug::script_events() { - if (ImGui::BeginTabItem("Script Events")) + if (ImGui::BeginTabItem("DEBUG_TAB_SCRIPT_EVENTS"_T.data())) { static int64_t* args; static int event_arg_count = 3; @@ -14,7 +14,7 @@ namespace big static int event_player_bits; static bool event_everyone = false; - ImGui::Text("Script Argument Count:"); + ImGui::Text("DEBUG_SCRIPT_EVENT_ARG_COUNT"_T.data()); ImGui::InputInt("###script_event_arg_count", &event_arg_count); if (event_arg_count > 32) event_arg_count = 32; @@ -37,7 +37,7 @@ namespace big for (int i = 0; i < event_arg_count; i++) { ImGui::PushID(i); - ImGui::Text("Arg[%d]", i); + ImGui::Text("DEBUG_SCRIPT_EVENT_ARG"_T.data(), i); ImGui::SameLine(); ImGui::InputScalar("###input_dynamic_arg", ImGuiDataType_S64, &args[i]); @@ -47,14 +47,14 @@ namespace big ImGui::Separator(); - ImGui::Checkbox("Send to everyone", &event_everyone); + ImGui::Checkbox("DEBUG_SCRIPT_EVENT_EVERYONE"_T.data(), &event_everyone); if (!event_everyone) { - ImGui::Text("Player ID:"); + ImGui::Text("DEBUG_SCRIPT_EVENT_PLAYER_ID"_T.data()); ImGui::InputInt("###player_bits", &event_player_bits); } - components::button("Send Event", [] + components::button("DEBUG_SCRIPT_EVENT_SEND_EVENT"_T, [] { args[1] = self::id; // prevent detection from AC g_pointers->m_trigger_script_event(1, args, event_arg_count, event_everyone ? -1 : 1 << event_player_bits); diff --git a/src/views/debug/view_debug_scripts.cpp b/src/views/debug/view_debug_scripts.cpp new file mode 100644 index 00000000..74c29c6a --- /dev/null +++ b/src/views/debug/view_debug_scripts.cpp @@ -0,0 +1,26 @@ +#include "view_debug.hpp" +#include "gui/components/components.hpp" +#include "script_mgr.hpp" + +namespace big +{ + void debug::scripts() + { + if (ImGui::BeginTabItem("DEBUG_TAB_SCRIPTS"_T.data())) + { + components::sub_title("DEBUG_SCRIPTS_SUB_TITLE"_T); + + for (const auto& script : g_script_mgr.scripts()) + { + if (script->is_toggleable()) + { + if (ImGui::Checkbox(script->name(), script->toggle_ptr())) + { + g_notification_service->push(std::string(script->name()).append(" script"), script->is_enabled() ? "Resumed" : "Halted"); + } + } + } + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/src/views/debug/views_debug_logs.cpp b/src/views/debug/views_debug_logs.cpp index 17448598..2d4b5f5f 100644 --- a/src/views/debug/views_debug_logs.cpp +++ b/src/views/debug/views_debug_logs.cpp @@ -6,18 +6,18 @@ namespace big { void debug::logs() { - if (ImGui::BeginTabItem("Logs")) + if (ImGui::BeginTabItem("DEBUG_TABS_LOGS"_T.data())) { - ImGui::Checkbox("Log Metrics", &g.debug.logs.metric_logs); - ImGui::Checkbox("Log Packets", &g.debug.logs.packet_logs); - ImGui::Checkbox("Native Script Hooks", &g.debug.logs.script_hook_logs); + ImGui::Checkbox("DEBUG_LOG_METRICS"_T.data(), &g.debug.logs.metric_logs); + ImGui::Checkbox("Log Packets", &g.debug.logs.packet_logs); // TODO: translate + ImGui::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs); - if (ImGui::TreeNode("Script Event Logging")) + if (ImGui::TreeNode("DEBUG_LOG_TREE_SCRIPT_EVENT"_T.data())) { - ImGui::Checkbox("Enable Script Event Logging", &g.debug.logs.script_event.logs); + ImGui::Checkbox("DEBUG_LOG_SCRIPT_EVENT"_T.data(), &g.debug.logs.script_event.logs); ImGui::Separator(); - ImGui::Checkbox("Filter by Player", &g.debug.logs.script_event.filter_player); + ImGui::Checkbox("DEBUG_LOG_SCRIPT_EVENT_FILTER_BY_PLAYER"_T.data(), &g.debug.logs.script_event.filter_player); if (g.debug.logs.script_event.filter_player) { diff --git a/src/views/esp/view_esp.cpp b/src/views/esp/view_esp.cpp index 2c603770..26519cd2 100644 --- a/src/views/esp/view_esp.cpp +++ b/src/views/esp/view_esp.cpp @@ -83,17 +83,17 @@ namespace big if (ped_damage_bits & (uint32_t)eEntityProofs::GOD) { - mode_str = "GOD"; + mode_str = "ESP_GOD"_T.data(); } else { if (ped_damage_bits & (uint32_t)eEntityProofs::BULLET) { - mode_str += "BULLET "; + mode_str += "ESP_BULLET"_T.data(); } if (ped_damage_bits & (uint32_t)eEntityProofs::EXPLOSION) { - mode_str += "EXPLOSION "; + mode_str += "ESP_EXPLOSION"_T.data(); } } diff --git a/src/views/network/view_player_database.cpp b/src/views/network/view_player_database.cpp index 1e6f52e3..a89dc7d6 100644 --- a/src/views/network/view_player_database.cpp +++ b/src/views/network/view_player_database.cpp @@ -19,7 +19,7 @@ namespace big static char search[64]; ImGui::SetNextItemWidth(300.f); - components::input_text_with_hint("Player", "Search", search, sizeof(search), ImGuiInputTextFlags_None); + components::input_text_with_hint("PLAYER"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None); if (ImGui::ListBoxHeader("###players", { 180, static_cast(*g_pointers->m_resolution_y - 400 - 38 * 4) })) { @@ -53,7 +53,7 @@ namespace big } else { - ImGui::Text("No stored players"); + ImGui::Text("NO_STORED_PLAYERS"_T.data()); } ImGui::ListBoxFooter(); @@ -64,16 +64,16 @@ namespace big ImGui::SameLine(); if (ImGui::BeginChild("###selected_player", { 500, static_cast(*g_pointers->m_resolution_y - 388 - 38 * 4) }, false, ImGuiWindowFlags_NoBackground)) { - if (ImGui::InputText("Name", name_buf, sizeof(name_buf))) + if (ImGui::InputText("NAME"_T.data(), name_buf, sizeof(name_buf))) { current_player.name = name_buf; } - ImGui::InputScalar("Rockstar ID", ImGuiDataType_S64, ¤t_player.rockstar_id); - ImGui::Checkbox("Is Modder", ¤t_player.is_modder); - ImGui::Checkbox("Block Join", ¤t_player.block_join); + ImGui::InputScalar("RID"_T.data(), ImGuiDataType_S64, ¤t_player.rockstar_id); + ImGui::Checkbox("IS_MODDER"_T.data(), ¤t_player.is_modder); + ImGui::Checkbox("BLOCK_JOIN"_T.data(), ¤t_player.block_join); - if (ImGui::BeginCombo("Block Join Alert", block_join_reasons[current_player.block_join_reason])) + if (ImGui::BeginCombo("BLOCK_JOIN_ALERT"_T.data(), block_join_reasons[current_player.block_join_reason])) { for (const auto& reason : block_join_reasons) { @@ -92,10 +92,10 @@ namespace big } if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Only works as host"); + ImGui::SetTooltip("ONLY_AS_HOST"_T.data()); - if (ImGui::BeginCombo("Chat Command Permissions", COMMAND_ACCESS_LEVELS[current_player.command_access_level.value_or(g.session.chat_command_default_access_level)])) + if (ImGui::BeginCombo("CHAT_COMMAND_PERMISSIONS"_T.data(), COMMAND_ACCESS_LEVELS[current_player.command_access_level.value_or(g.session.chat_command_default_access_level)])) { for (const auto& [type, name] : COMMAND_ACCESS_LEVELS) { @@ -115,7 +115,7 @@ namespace big if (!current_player.infractions.empty()) { - ImGui::Text("Infractions:"); + ImGui::Text("INFRACTIONS"_T.data()); for (auto& infraction : current_player.infractions) { @@ -123,32 +123,32 @@ namespace big } } - components::button("Kick", [] + components::button("KICK"_T, [] { session::kick_by_rockstar_id(current_player.rockstar_id); }); - components::button("Join Session", [] + components::button("JOIN_SESSION"_T, [] { session::join_by_rockstar_id(current_player.rockstar_id); }); static char message[256]; - components::input_text("Input Message", message, sizeof(message)); - if (components::button("Send Message")) + components::input_text("INPUT_MSG"_T, message, sizeof(message)); + if (components::button("SEND_MSG"_T)) { g_thread_pool->push([selected] { if (g_api_service->send_socialclub_message(selected->rockstar_id, message)) { - g_notification_service->push("SCAPI", "Message successfully sent"); + g_notification_service->push("SCAPI"_T.data(), "MSG_SENT_SUCCESS"_T.data()); return; } - g_notification_service->push_error("SCAPI", "Message not sent. Are you connected to the internet?"); + g_notification_service->push_error("SCAPI"_T.data(), "MSG_SENT_FAIL"_T.data()); }); }; - if (ImGui::Button("Save")) + if (ImGui::Button("SAVE"_T.data())) { if (current_player.rockstar_id != selected->rockstar_id) g_player_database_service->update_rockstar_id(selected->rockstar_id, current_player.rockstar_id); @@ -159,7 +159,7 @@ namespace big ImGui::SameLine(); - if (ImGui::Button("Remove")) + if (ImGui::Button("REMOVE"_T.data())) { g_player_database_service->remove_rockstar_id(selected->rockstar_id); } @@ -167,7 +167,7 @@ namespace big ImGui::EndChild(); } - if (ImGui::Button("Remove All")) + if (ImGui::Button("REMOVE_ALL"_T.data())) { g_player_database_service->set_selected(nullptr); g_player_database_service->get_players().clear(); @@ -175,15 +175,15 @@ namespace big } ImGui::Separator(); - components::sub_title("New Entry"); + components::sub_title("NEW_ENTRY"_T); static char new_name[64]; static int64_t new_rockstar_id; - components::input_text("Name", new_name, sizeof(new_name)); - ImGui::InputScalar("Rockstar ID", ImGuiDataType_S64, &new_rockstar_id); + components::input_text("NAME"_T, new_name, sizeof(new_name)); + ImGui::InputScalar("RID"_T.data(), ImGuiDataType_S64, &new_rockstar_id); - if (ImGui::Button("Add")) + if (ImGui::Button("ADD"_T.data())) { g_player_database_service->get_players()[new_rockstar_id] = persistent_player(new_name, new_rockstar_id); g_player_database_service->save(); diff --git a/src/views/network/view_session.cpp b/src/views/network/view_session.cpp index 9d18b6e4..bfbfab4b 100644 --- a/src/views/network/view_session.cpp +++ b/src/views/network/view_session.cpp @@ -19,46 +19,46 @@ namespace big void view::session() { static uint64_t rid = 0; - ImGui::InputScalar("Input RID", ImGuiDataType_U64, &rid); - components::button("Join by RID", [] + ImGui::InputScalar("INPUT_RID"_T.data(), ImGuiDataType_U64, &rid); + components::button("JOIN_BY_RID"_T, [] { session::join_by_rockstar_id(rid); }); ImGui::SameLine(); - components::button("Kick by RID", [] + components::button("KICK_BY_RID"_T, [] { session::kick_by_rockstar_id(rid); }); static char username[20]; - components::input_text("Input Username", username, sizeof(username)); - if (components::button("Join by Username")) + components::input_text("INPUT_USERNAME"_T, username, sizeof(username)); + if (components::button("JOIN_BY_USERNAME"_T)) { session::join_by_username(username); }; ImGui::SameLine(); - if (components::button("Kick by Username")) + if (components::button("KICK_BY_USERNAME"_T)) { session::kick_by_username(username); }; static char base64[500]{}; - components::input_text("Session Info", base64, sizeof(base64)); - components::button("Join Session Info", [] + components::input_text("SESSION_INFO"_T, base64, sizeof(base64)); + components::button("JOIN_SESSION_INFO"_T, [] { rage::rlSessionInfo info; g_pointers->m_decode_session_info(&info, base64, nullptr); session::join_session(info); }); ImGui::SameLine(); - components::button("Copy Current Session Info", [] + components::button("COPY_SESSION_INFO"_T, [] { char buf[0x100]; g_pointers->m_encode_session_info(>a_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0x7D, nullptr); ImGui::SetClipboardText(buf); }); - components::sub_title("Session Switcher"); + components::sub_title("SESSION_SWITCHER"_T); if (ImGui::ListBoxHeader("###session_switch")) { for (const auto& session_type : sessions) @@ -71,7 +71,7 @@ namespace big ImGui::EndListBox(); } - components::sub_title("Region Switcher"); + components::sub_title("REGION_SWITCHER"_T); if (ImGui::ListBoxHeader("###region_switch")) { for (const auto& region_type : regions) @@ -84,30 +84,29 @@ namespace big ImGui::EndListBox(); } - ImGui::Checkbox("Join in SCTV slots", &g.session.join_in_sctv_slots); + ImGui::Checkbox("JOIN_IN_SCTV"_T.data(), &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"); + ImGui::SetTooltip("JOIN_IN_SCTV_DESC"_T.data()); - components::sub_title("Player Magnet"); - ImGui::Checkbox("Enabled", &g.session.player_magnet_enabled); + components::sub_title("PLAYER_MAGNET"_T); + ImGui::Checkbox("ENABLED"_T.data(), &g.session.player_magnet_enabled); if (g.session.player_magnet_enabled) { - ImGui::InputInt("Player Count", &g.session.player_magnet_count); + ImGui::InputInt("PLAYER_COUNT"_T.data(), &g.session.player_magnet_count); } - components::sub_title("Chat"); - ImGui::Checkbox("Auto-kick Chat Spammers", &g.session.kick_chat_spammers); - ImGui::Checkbox("Force Clean", &g.session.chat_force_clean); + ImGui::Checkbox("AUTO_KICK_CHAT_SPAMMERS"_T.data(), &g.session.kick_chat_spammers); + ImGui::Checkbox("DISABLE_FILTER"_T.data(), &g.session.chat_force_clean); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Your sent chat messages will not be censored to the receivers"); - ImGui::Checkbox("Log Chat Messages", &g.session.log_chat_messages); - ImGui::Checkbox("Log Text Messages", &g.session.log_text_messages); + ImGui::SetTooltip("Your sent chat messages will not be censored to the receivers"); // TODO: add translation + ImGui::Checkbox("LOG_CHAT_MSG"_T.data(), &g.session.log_chat_messages); + ImGui::Checkbox("LOG_TXT_MSG"_T.data(), &g.session.log_text_messages); static char msg[256]; components::input_text("##message", msg, sizeof(msg)); ImGui::SameLine(); - ImGui::Checkbox("Is Team", &g.session.is_team); + ImGui::Checkbox("IS_TEAM"_T.data(), &g.session.is_team); ImGui::SameLine(); - components::button("Send", [] + components::button("SEND"_T, [] { if (const auto net_game_player = gta_util::get_network_player_mgr()->m_local_net_player; net_game_player) { @@ -116,10 +115,10 @@ namespace big } }); - ImGui::Checkbox("Chat Commands", &g.session.chat_commands); + ImGui::Checkbox("CHAT_COMMANDS"_T.data(), &g.session.chat_commands); if (g.session.chat_commands) { - if (ImGui::BeginCombo("Default Command Permissions", COMMAND_ACCESS_LEVELS[g.session.chat_command_default_access_level])) + if (ImGui::BeginCombo("DEFAULT_CMD_PERMISSIONS"_T.data(), COMMAND_ACCESS_LEVELS[g.session.chat_command_default_access_level])) { for (const auto& [type, name] : COMMAND_ACCESS_LEVELS) { @@ -138,21 +137,21 @@ namespace big } } - components::sub_title("Decloak"); - components::script_patch_checkbox("Reveal OTR Players", &g.session.decloak_players); + components::sub_title("DECLOAK"_T); + components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players); - components::sub_title("Force Host"); - ImGui::Checkbox("Force Session Host", &g.session.force_session_host); + components::sub_title("FORCE_HOST"_T); + ImGui::Checkbox("FORCE_SESSION_HOST"_T.data(), &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"); + ImGui::SetTooltip("FORCE_SESSION_HOST_DESC"_T.data()); ImGui::SameLine(); if (g.session.force_session_host) { ImGui::SameLine(); - ImGui::Checkbox("Kick Host During Join", &g.session.kick_host_when_forcing_host); + ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host); } - if (ImGui::Checkbox("Force Script Host", &g.session.force_script_host)) + if (ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host)) { if (g.session.force_script_host) g_fiber_pool->queue_job([] @@ -167,16 +166,16 @@ namespace big }); } - components::sub_title("Remote Name Spoofing"); - ImGui::Checkbox("Spoof Other Players' Names", &g.session.name_spoof_enabled); + components::sub_title("REMOTE_NAME_SPOOFING"_T); + ImGui::Checkbox("SPOOF_PLAYER_NAMES"_T.data(), &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"); + ImGui::SetTooltip("SPOOF_PLAYER_NAMES_DESC"_T.data()); if (g.session.name_spoof_enabled) { - ImGui::Checkbox("Advertise YimMenu", &g.session.advertise_menu); + ImGui::Checkbox("ADVERTISE_YIMMENU"_T.data(), &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"); + ImGui::SetTooltip("ADVERTISE_YIMMENU_DESC"_T.data()); if (!g.session.advertise_menu) { @@ -184,7 +183,7 @@ namespace big static char name[name_size]; strcpy_s(name, sizeof(name), g.session.spoofed_name.c_str()); - ImGui::Text("Name: "); + ImGui::Text("PLAYER_SPOOFED_NAME"_T.data()); components::input_text("##username_input", name, sizeof(name)); if (name != g.session.spoofed_name) @@ -192,40 +191,40 @@ namespace big } } - components::sub_title("All Players"); - ImGui::Checkbox("Off The Radar", &g.session.off_radar_all); + components::sub_title("ALL_PLAYERS"_T); + ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g.session.off_radar_all); ImGui::SameLine(); - ImGui::Checkbox("Never Wanted", &g.session.never_wanted_all); + ImGui::Checkbox("NEVER_WANTED"_T.data(), &g.session.never_wanted_all); ImGui::SameLine(); - ImGui::Checkbox("Semi Godmode", &g.session.semi_godmode_all); + ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g.session.semi_godmode_all); - ImGui::Checkbox("Explosion Karma", &g.session.explosion_karma); + ImGui::Checkbox("EXPLOSION_KARMA"_T.data(), &g.session.explosion_karma); ImGui::SameLine(); - ImGui::Checkbox("Damage Karma", &g.session.damage_karma); + ImGui::Checkbox("DAMAGE_KARMA"_T.data(), &g.session.damage_karma); static int global_wanted_level = 0; - if (ImGui::SliderInt("Wanted Level", &global_wanted_level, 0, 5)) + if (ImGui::SliderInt("WANTED_LVL"_T.data(), &global_wanted_level, 0, 5)) { *scr_globals::globalplayer_bd.at(self::id, scr_globals::size::globalplayer_bd).at(213).as() = global_wanted_level; } ImGui::SameLine(); - if (ImGui::Checkbox("Force", &g.session.wanted_level_all)) + if (ImGui::Checkbox("FORCE"_T.data(), &g.session.wanted_level_all)) { *scr_globals::globalplayer_bd.at(self::id, scr_globals::size::globalplayer_bd).at(212).as() = __rdtsc() + 32; *scr_globals::globalplayer_bd.at(self::id, scr_globals::size::globalplayer_bd).at(213).as() = global_wanted_level; } - components::command_button<"killall">({ }, "Kill Everyone"); + components::command_button<"killall">({ }, "KILL_ALL"_T); ImGui::SameLine(); - components::command_button<"explodeall">({ }, "Explode Everyone"); + components::command_button<"explodeall">({ }, "EXPLODE_ALL"_T); ImGui::SameLine(); components::command_button<"beastall">({ }); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Including you"); + ImGui::SetTooltip("INCLUDING_YOU"_T.data()); components::command_button<"giveweapsall">({ }); ImGui::SameLine(); @@ -235,9 +234,10 @@ namespace big ImGui::SameLine(); components::command_button<"vehkickall">({ }); - components::command_button<"ragdollall">({ }, "Ragdoll Players"); + + components::command_button<"ragdollall">({ }, "RAGDOLL_PLAYERS"_T); ImGui::SameLine(); - components::command_button<"intkickall">({ }, "Kick Everyone From Interiors"); + components::command_button<"intkickall">({ }, "KICK_ALL_FROM_INTERIORS"_T); components::command_button<"missionall">({ }); ImGui::SameLine(); @@ -253,7 +253,7 @@ namespace big ImGui::SameLine(); components::command_button<"fakebanall">({ }, "Send Fake Ban Messages"); - components::small_text("Teleports"); + components::small_text("TELEPORTS"_T); if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx])) { @@ -275,7 +275,7 @@ namespace big ImGui::SameLine(); - components::command_button<"apartmenttpall">({ (uint64_t)g.session.send_to_apartment_idx }, "TP All To Apartment"); + components::command_button<"apartmenttpall">({ (uint64_t)g.session.send_to_apartment_idx }, "TP_ALL_TO_APARTMENT"_T); if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx])) { @@ -297,37 +297,37 @@ namespace big ImGui::SameLine(); - components::command_button<"warehousetpall">({ (uint64_t)g.session.send_to_warehouse_idx }, "TP All To Warehouse"); + components::command_button<"warehousetpall">({ (uint64_t)g.session.send_to_warehouse_idx }, "TP_ALL_TO_WAREHOUSE"_T); - components::button("TP All To Darts", [] { g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::Darts); }); }); + components::button("TP_ALL_TO_DARTS"_T, [] { 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); }); }); + components::button("TP_ALL_TO_FLIGHT_SCHOOL"_T, [] { 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_MAP_CENTER"_T, [] { 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); }); }); + components::button("TP_ALL_TO_SKYDIVE"_T, [] { g_player_service->iterate([](auto& plyr) { toxic::start_activity(plyr.second, eActivityType::Skydive); }); }); ImGui::SameLine(); - components::command_button<"interiortpall">({ 81 }, "TP All To MOC"); + components::command_button<"interiortpall">({ 81 }, "TP_ALL_TO_MOC"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 123 }, "TP All To Casino"); + components::command_button<"interiortpall">({ 123 }, "TP_ALL_TO_CASINO"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 124 }, "TP All To Penthouse"); + components::command_button<"interiortpall">({ 124 }, "TP_ALL_TO_PENTHOUSE"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 128 }, "TP All To Arcade"); + components::command_button<"interiortpall">({ 128 }, "TP_ALL_TO_ARCADE"_T); - components::command_button<"interiortpall">({ 146 }, "TP All To Music Locker"); + components::command_button<"interiortpall">({ 146 }, "TP_ALL_TO_MUSIC_LOCKER"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 148 }, "TP All To Record A Studios"); + components::command_button<"interiortpall">({ 148 }, "TP_ALL_TO_RECORD_A_STUDIOS"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 149 }, "TP All To Custom Auto Shop"); + components::command_button<"interiortpall">({ 149 }, "TP_ALL_TO_CUSTOM_AUTO_SHOP"_T); - components::command_button<"interiortpall">({ 155 }, "TP All To Agency"); + components::command_button<"interiortpall">({ 155 }, "TP_ALL_TO_AGENCY"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 160 }, "TP All To Freakshop"); + components::command_button<"interiortpall">({ 160 }, "TP_ALL_TO_FREAKSHOP"_T); ImGui::SameLine(); - components::command_button<"interiortpall">({ 161 }, "TP All To Multi Floor Garage"); + components::command_button<"interiortpall">({ 161 }, "TP_ALL_TO_MULTI_FLOOR_GARAGE"_T); components::command_button<"tutorialall">(); ImGui::SameLine(); @@ -347,34 +347,34 @@ namespace big ImGui::SameLine(); components::command_button<"camhedzall">(); - ImGui::Checkbox("Disable Pedestrians", &g.session.disable_peds); + ImGui::Checkbox("DISABLE_PEDS"_T.data(), &g.session.disable_peds); ImGui::SameLine(); - ImGui::Checkbox("Disable Traffic", &g.session.disable_traffic); + ImGui::Checkbox("DISABLE_TRAFFIC"_T.data(), &g.session.disable_traffic); ImGui::SameLine(); - ImGui::Checkbox("Force Thunder", &g.session.force_thunder); + ImGui::Checkbox("FORCE_THUNDER"_T.data(), &g.session.force_thunder); - components::small_text("Warp Time (requires session host)"); + components::small_text("WARP_TIME"_T.data()); - components::button("+1 Minute", [] { toxic::warp_time_forward_all(60 * 1000); }); + components::button("PLUS_1_MINUTE"_T, [] { toxic::warp_time_forward_all(60 * 1000); }); ImGui::SameLine(); - components::button("+5 Minutes", [] { toxic::warp_time_forward_all(5 * 60 * 1000); }); + components::button("PLUS_5_MINUTES"_T, [] { toxic::warp_time_forward_all(5 * 60 * 1000); }); ImGui::SameLine(); - components::button("+48 Minutes", [] { toxic::warp_time_forward_all(48 * 60 * 1000); }); + components::button("PLUS_48_MINUTES"_T, [] { toxic::warp_time_forward_all(48 * 60 * 1000); }); ImGui::SameLine(); - components::button("+96 Minutes", [] { toxic::warp_time_forward_all(96 * 60 * 1000); }); + components::button("PLUS_96_MINUTES"_T, [] { toxic::warp_time_forward_all(96 * 60 * 1000); }); ImGui::SameLine(); - components::button("+200 Minutes", [] { toxic::warp_time_forward_all(200 * 60 * 1000); }); + components::button("PLUS_200_MINUTES"_T, [] { toxic::warp_time_forward_all(200 * 60 * 1000); }); ImGui::SameLine(); - components::button("Stop Time", [] { toxic::set_time_all(INT_MAX - 3000); }); + components::button("STOP_TIME"_T, [] { toxic::set_time_all(INT_MAX - 3000); }); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("This cannot be reversed. Use with caution"); + ImGui::SetTooltip("STOP_TIME_DESC"_T.data()); - components::sub_title("Script Host Features"); - ImGui::Checkbox("Disable CEO Money", &g.session.block_ceo_money); + components::sub_title("SCRIPT_HOST_FEATURES"_T); + ImGui::Checkbox("DISABLE_CEO_MONEY"_T.data(), &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::SetTooltip("DISABLE_CEO_MONEY_DESC"_T.data()); ImGui::SameLine(); - ImGui::Checkbox("Randomize CEO Colors", &g.session.randomize_ceo_colors); + ImGui::Checkbox("RANDOMIZE_CEO_COLORS"_T.data(), &g.session.randomize_ceo_colors); ImGui::Checkbox("Block Jobs", &g.session.block_jobs); if (ImGui::IsItemHovered()) ImGui::SetTooltip("Prevents remote players from starting jobs while in your session"); diff --git a/src/views/network/view_session_browser.cpp b/src/views/network/view_session_browser.cpp index 6c614060..66137895 100644 --- a/src/views/network/view_session_browser.cpp +++ b/src/views/network/view_session_browser.cpp @@ -49,7 +49,7 @@ namespace big } else { - ImGui::Text("No sessions"); + ImGui::Text("NO_SESSIONS"_T.data()); } ImGui::ListBoxFooter(); @@ -62,25 +62,25 @@ namespace big { auto& session = g_matchmaking_service->get_found_sessions()[selected_session_idx]; - ImGui::Text("Num Players: %d", session.attributes.player_count); - ImGui::Text("Discriminator: 0x%X", session.attributes.discriminator); - ImGui::Text("Region: %s", regions[session.attributes.region].name); - ImGui::Text("Language: %s", languages[session.attributes.language].name); + ImGui::Text("SESSION_BROWSER_NUM_PLAYERS"_T.data(), session.attributes.player_count); + ImGui::Text("SESSION_BROWSER_DISCRIMINATOR"_T.data(), session.attributes.discriminator); + ImGui::Text("SESSION_BROWSER_REGION"_T.data(), regions[session.attributes.region].name); + ImGui::Text("SESSION_BROWSER_LANGUAGE"_T.data(), languages[session.attributes.language].name); auto& data = session.info.m_net_player_data; - ImGui::Text("Host Rockstar ID: %d", data.m_gamer_handle.m_rockstar_id); + ImGui::Text("SESSION_BROWSER_HOST_RID"_T.data(), data.m_gamer_handle.m_rockstar_id); - components::button("Copy Session Info", [] + components::button("COPY_SESSION_INFO"_T, [] { ImGui::SetClipboardText(session_info); }); ImGui::SameLine(); - components::button("Join", [session] + components::button("JOIN"_T, [session] { if (SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(RAGE_JOAAT("maintransition")) != 0 || STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS()) { - g_notification_service->push_error("Join Session", "Player switch in progress, wait a bit."); + g_notification_service->push_error("JOIN_SESSION"_T.data(), "PLAYER_SWITCH_IN_PROGRESS"_T.data()); return; } @@ -96,12 +96,12 @@ namespace big ImGui::EndChild(); } - if (ImGui::TreeNode("Filters")) + if (ImGui::TreeNode("FILTERS"_T.data())) { - ImGui::Checkbox("Region", &g.session_browser.region_filter_enabled); + ImGui::Checkbox("REGION"_T.data(), &g.session_browser.region_filter_enabled); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("It is highly recommended to keep this filter enabled"); + ImGui::SetTooltip("REGION_FILTER_DESC"_T.data()); if (g.session_browser.region_filter_enabled) { @@ -121,10 +121,10 @@ namespace big } - ImGui::Checkbox("Language", &g.session_browser.language_filter_enabled); + ImGui::Checkbox("LANGUAGE"_T.data(), &g.session_browser.language_filter_enabled); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Setting a correct region filter for the language will help tremendously"); + ImGui::SetTooltip("LANGUAGE_FILTER_DESC"_T.data()); if (g.session_browser.language_filter_enabled) { @@ -143,15 +143,15 @@ namespace big } } - ImGui::Checkbox("Players", &g.session_browser.player_count_filter_enabled); + ImGui::Checkbox("PLAYERS"_T.data(), &g.session_browser.player_count_filter_enabled); if (g.session_browser.player_count_filter_enabled) { - ImGui::InputInt("Minimum", &g.session_browser.player_count_filter_minimum); - ImGui::InputInt("Maximum", &g.session_browser.player_count_filter_maximum); + ImGui::InputInt("MIN"_T.data(), &g.session_browser.player_count_filter_minimum); + ImGui::InputInt("MAX"_T.data(), &g.session_browser.player_count_filter_maximum); } - ImGui::Checkbox("Pool Type", &g.session_browser.pool_filter_enabled); + ImGui::Checkbox("POOL_TYPE"_T.data(), &g.session_browser.pool_filter_enabled); if (g.session_browser.pool_filter_enabled) { ImGui::SameLine(); @@ -161,25 +161,25 @@ namespace big ImGui::TreePop(); } - if (ImGui::TreeNode("Sorting")) + if (ImGui::TreeNode("SORTING"_T.data())) { - ImGui::Combo("Sort By", &g.session_browser.sort_method, "Off\0Player Count"); + ImGui::Combo("SORT_BY"_T.data(), &g.session_browser.sort_method, "Off\0Player Count"); if (g.session_browser.sort_method != 0) - ImGui::Combo("Direction", &g.session_browser.sort_direction, "Ascending\0Descending"); + ImGui::Combo("DIRECTION"_T.data(), &g.session_browser.sort_direction, "Ascending\0Descending"); ImGui::TreePop(); } - if (ImGui::Checkbox("Replace Game Matchmaking", &g.session_browser.replace_game_matchmaking)); + if (ImGui::Checkbox("REPLACE_GAME_MATCHMAKING"_T.data(), &g.session_browser.replace_game_matchmaking)); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("This will replace the default game matchmaking with a custom one that will use the filters and sorting set here"); + ImGui::SetTooltip("REPLACE_GAME_MATCHMAKING_DESC"_T.data()); - components::button("Refresh", [] + components::button("REFRESH"_T, [] { selected_session_idx = -1; if (!g_matchmaking_service->matchmake()) - g_notification_service->push_error("Matchmaking", "Matchmaking failed"); + g_notification_service->push_error("MATCHMAKING"_T.data(), "MATCHMAKING_FAIL"_T.data()); }); } } diff --git a/src/views/network/view_spoofing.cpp b/src/views/network/view_spoofing.cpp index 9a66f1a3..ca0e36f5 100644 --- a/src/views/network/view_spoofing.cpp +++ b/src/views/network/view_spoofing.cpp @@ -9,22 +9,22 @@ namespace big { void view::spoofing() { - components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.\nAll spoofed details will be only visible by other players, your game will still show your actual name, ip, rid..."); + components::small_text("SPOOFING_DESCRIPTION"_T); - components::sub_title("Username"); + components::sub_title("USERNAME"_T); - ImGui::Checkbox("Spoof Username", &g.spoofing.spoof_username); + ImGui::Checkbox("SPOOFING_USERNAME"_T.data(), &g.spoofing.spoof_username); if (g.spoofing.spoof_username) { ImGui::SameLine(); - ImGui::Checkbox("Spoof Username Locally", &g.spoofing.spoof_local_username); + ImGui::Checkbox("SPOOFING_USERNAME_LOCAL"_T.data(), &g.spoofing.spoof_local_username); } constexpr size_t name_size = RTL_FIELD_SIZE(rage::rlGamerInfo, m_name); static char name[name_size]; strcpy_s(name, sizeof(name), g.spoofing.username.c_str()); - ImGui::Text("Username:"); + ImGui::Text("USERNAME_COLON"_T.data()); components::input_text("##username_input", name, sizeof(name)); if (name != g.spoofing.username) @@ -32,56 +32,56 @@ namespace big ImGui::Separator(); - components::sub_title("IP Address"); + components::sub_title("IP_ADDRESS"_T); - ImGui::Checkbox("Spoof IP", &g.spoofing.spoof_ip); + ImGui::Checkbox("SPOOFING_IP"_T.data(), &g.spoofing.spoof_ip); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Disable this feature if you're having trouble joining sessions."); + ImGui::SetTooltip("SPOOFING_IP_DESCRIPTION"_T.data()); - ImGui::Text("IP Address:"); + ImGui::Text("IP_ADDRESS_COLON"_T.data()); ImGui::DragInt4("##ip_fields", g.spoofing.ip_address.data(), 0, 255); ImGui::Separator(); - components::sub_title("Rockstar ID"); + components::sub_title("ROCKSTAR_ID"_T); - ImGui::Checkbox("Spoof Rockstar ID", &g.spoofing.spoof_rockstar_id); + ImGui::Checkbox("SPOOFING_ROCKSTAR_ID"_T.data(), &g.spoofing.spoof_rockstar_id); - ImGui::Text("Rockstar ID:"); + ImGui::Text("ROCKSTAR_ID_COLON"_T.data()); ImGui::InputScalar("##rockstar_id_input", ImGuiDataType_U64, &g.spoofing.rockstar_id); - components::sub_title("Hide Features"); - ImGui::Checkbox("Hide God Mode", &g.spoofing.spoof_hide_god); - ImGui::Checkbox("Hide Spectate", &g.spoofing.spoof_hide_spectate); + components::sub_title("SPOOFING_HIDE_FEATURES"_T); + ImGui::Checkbox("SPOOFING_HIDE_GOD_MODE"_T.data(), &g.spoofing.spoof_hide_god); + ImGui::Checkbox("SPOOFING_HIDE_SPECTATE"_T.data(), &g.spoofing.spoof_hide_spectate); - components::sub_title("Crew"); + components::sub_title("CREW"_T); - ImGui::Checkbox("Spoof Crew", &g.spoofing.spoof_crew_data); + ImGui::Checkbox("SPOOFING_CREW"_T.data(), &g.spoofing.spoof_crew_data); constexpr size_t crew_tag_size = RTL_FIELD_SIZE(ClanData, m_clan_tag); static char crew_tag[crew_tag_size]; strcpy_s(crew_tag, sizeof(crew_tag), g.spoofing.crew_tag.c_str()); - ImGui::Text("Crew Tag:"); + ImGui::Text("SPOOFING_CREW_TAG"_T.data()); components::input_text("##crew_tag_input", crew_tag, sizeof(crew_tag)); if (crew_tag != g.spoofing.crew_tag) g.spoofing.crew_tag = std::string(crew_tag); - ImGui::Checkbox("Is Rockstar Crew", &g.spoofing.rockstar_crew); + ImGui::Checkbox("SPOOFING_CREW_ROCKSTAR"_T.data(), &g.spoofing.rockstar_crew); - ImGui::Checkbox("Square Crew Tag", &g.spoofing.square_crew_tag); + ImGui::Checkbox("SPOOFING_CREW_SQUARE_TAG"_T.data(), &g.spoofing.square_crew_tag); - components::sub_title("Extra - Only work when Spoofed RID"); + components::sub_title("SPOOFING_EXTRA"_T); - ImGui::Checkbox("Is Cheater", &g.spoofing.spoof_cheater); - ImGui::Checkbox("Is Rockstar Dev", &g.spoofing.spoof_rockstar_dev); - ImGui::Checkbox("Is Rockstar QA", &g.spoofing.spoof_rockstar_qa); + ImGui::Checkbox("SPOOFING_IS_CHEATER"_T.data(), &g.spoofing.spoof_cheater); + ImGui::Checkbox("SPOOFING_IS_DEV"_T.data(), &g.spoofing.spoof_rockstar_dev); + ImGui::Checkbox("SPOOFING_IS_QA"_T.data(), &g.spoofing.spoof_rockstar_qa); - components::sub_title("Session Attributes"); - components::small_text("Only works when session host"); + components::sub_title("SPOOFING_SESSION_ATTRIBUTES"_T); + components::small_text("SPOOFING_ONLY_WORKS_AS_HOST"_T); - ImGui::Checkbox("Region", &g.spoofing.spoof_session_region_type); + ImGui::Checkbox("SPOOFING_ATTRIBUTE_REGION"_T.data(), &g.spoofing.spoof_session_region_type); if (g.spoofing.spoof_session_region_type) { ImGui::SameLine(); @@ -97,7 +97,7 @@ namespace big ImGui::EndCombo(); } } - ImGui::Checkbox("Language", &g.spoofing.spoof_session_language); + ImGui::Checkbox("SPOOFING_ATTRIBUTE_LANGUAGE"_T.data(), &g.spoofing.spoof_session_language); if (g.spoofing.spoof_session_language) { ImGui::SameLine(); @@ -115,7 +115,7 @@ namespace big } } - ImGui::Checkbox("Player Count", &g.spoofing.spoof_session_player_count); + ImGui::Checkbox("SPOOFING_ATTRIBUTE_PLAYER_COUNT"_T.data(), &g.spoofing.spoof_session_player_count); if (g.spoofing.spoof_session_player_count) { ImGui::SameLine(); diff --git a/src/views/players/player/player_info.cpp b/src/views/players/player/player_info.cpp index 013b39bd..38a4fa26 100644 --- a/src/views/players/player/player_info.cpp +++ b/src/views/players/player/player_info.cpp @@ -11,18 +11,18 @@ namespace big { void view::player_info() { - if (ImGui::TreeNode("Info")) + if (ImGui::TreeNode("INFO"_T.data())) { - ImGui::Text("Player ID: %d", g_player_service->get_selected()->id()); + ImGui::Text("PLAYER_INFO_ID"_T.data(), g_player_service->get_selected()->id()); - ImGui::Text("Session Host: %s", g_player_service->get_selected()->is_host() ? "Yes" : "No"); + ImGui::Text("PLAYER_INFO_SESSION_HOST"_T.data(), g_player_service->get_selected()->is_host() ? "YES"_T.data() : "NO"_T.data()); ImGui::Separator(); if (CPlayerInfo* player_info = g_player_service->get_selected()->get_player_info(); player_info != nullptr) { - ImGui::Text("Wanted Level: %d", player_info->m_wanted_level); + ImGui::Text("PLAYER_INFO_WANTED_LEVEL"_T.data(), player_info->m_wanted_level); } uint32_t ped_damage_bits = 0; @@ -42,17 +42,17 @@ namespace big if (ped_damage_bits & (uint32_t)eEntityProofs::GOD) { - mode_str = "God"; + mode_str = "PLAYER_INFO_GOD"_T; } else { if (ped_damage_bits & (uint32_t)eEntityProofs::BULLET) { - mode_str += "Bullet, "; + mode_str += "PLAYER_INFO_BULLET"_T; } if (ped_damage_bits & (uint32_t)eEntityProofs::EXPLOSION) { - mode_str += "Explosion, "; + mode_str += "PLAYER_INFO_EXPLOSION"_T; } if (ped_health > 328 || ped_maxhealth > 328 && !(uint32_t)eEntityProofs::EXPLOSION && !(uint32_t)eEntityProofs::BULLET) { @@ -62,10 +62,10 @@ namespace big if (mode_str.empty()) { - mode_str = "No"; + mode_str = "NO"_T; } - ImGui::Text("Player God Mode: %s", mode_str.c_str()); + ImGui::Text("PLAYER_INFO_PROOFS"_T.data(), mode_str.c_str()); mode_str = ""; @@ -78,44 +78,46 @@ namespace big { if (veh_damage_bits & (uint32_t)eEntityProofs::GOD) { - mode_str = "God"; + mode_str = "PLAYER_INFO_GOD"_T; } else { if (veh_damage_bits & (uint32_t)eEntityProofs::COLLISION) { - mode_str += "Collision, "; + mode_str += "PLAYER_INFO_COLLISION"_T; } if (veh_damage_bits & (uint32_t)eEntityProofs::EXPLOSION) { - mode_str += "Explosion, "; + mode_str += "PLAYER_INFO_EXPLOSION"_T; } } if (mode_str.empty()) { - mode_str = "No"; + mode_str = "NO"_T; } } else { - mode_str = "No vehicle detected"; + mode_str = "PLAYER_INFO_NO_VEHICLE"_T; } - ImGui::Text("Vehicle God Mode: %s", mode_str.c_str()); + ImGui::Text("PLAYER_INFO_VEHICLE_PROOFS"_T.data(), mode_str.c_str()); ImGui::Separator(); if (auto net_player_data = g_player_service->get_selected()->get_net_data(); net_player_data != nullptr) { - ImGui::Text("Rockstar ID: %d", net_player_data->m_gamer_handle_2.m_rockstar_id); + ImGui::Text("PLAYER_INFO_RID"_T.data(), net_player_data->m_gamer_handle_2.m_rockstar_id); ImGui::SameLine(); - if (ImGui::Button("Copy##rid")) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle_2.m_rockstar_id).data()); + ImGui::PushID("##rid"); + if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle_2.m_rockstar_id).data()); + ImGui::PopID(); ImGui::Text( - "IP Address: %d.%d.%d.%d:%d", + "PLAYER_INFO_IP"_T.data(), net_player_data->m_external_ip.m_field1, net_player_data->m_external_ip.m_field2, net_player_data->m_external_ip.m_field3, @@ -125,11 +127,13 @@ namespace big ImGui::SameLine(); - if (ImGui::Button("Copy##ip")) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", net_player_data->m_external_ip.m_field1, + ImGui::PushID("##ip"); + if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", net_player_data->m_external_ip.m_field1, net_player_data->m_external_ip.m_field2, net_player_data->m_external_ip.m_field3, net_player_data->m_external_ip.m_field4, net_player_data->m_external_port).data()); + ImGui::PopID(); } ImGui::Separator(); @@ -142,27 +146,28 @@ namespace big auto& boss_goon = scr_globals::gpbd_fm_3.as()->Entries[id].BossGoon; if (boss_goon.Language >= 0 && boss_goon.Language < 13) - ImGui::Text("Language: %s", languages[boss_goon.Language].name); + ImGui::Text("PLAYER_INFO_LANGUAGE"_T.data(), languages[boss_goon.Language].name); + + ImGui::Text("PLAYER_INFO_CEO_NAME"_T.data(), boss_goon.GangName); + ImGui::Text("PLAYER_INFO_MC_NAME"_T.data(), boss_goon.ClubhouseName); + ImGui::Text("PLAYER_INFO_WALLET"_T.data(), stats.WalletBalance); + ImGui::Text("PLAYER_INFO_BANK"_T.data(), stats.Money - stats.WalletBalance); + ImGui::Text("PLAYER_INFO_TOTAL_MONEY"_T.data(), stats.Money); + ImGui::Text("PLAYER_INFO_RANK"_T.data(), stats.Rank, stats.RP); + ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); // TODO: translate + ImGui::Text("PLAYER_INFO_KD"_T.data(), stats.KdRatio); + ImGui::Text("PLAYER_INFO_KILLS"_T.data(), stats.KillsOnPlayers); + ImGui::Text("PLAYER_INFO_DEATHS"_T.data(), stats.DeathsByPlayers); + ImGui::Text("PLAYER_INFO_PROSTITUTES"_T.data(), stats.ProstitutesFrequented); + ImGui::Text("PLAYER_INFO_LAP_DANCES"_T.data(), stats.LapDancesBought); + ImGui::Text("PLAYER_INFO_MISSIONS_CREATED"_T.data(), stats.MissionsCreated); + ImGui::Text("PLAYER_INFO_METLDOWN_COMPLETE"_T.data(), scr_globals::gpbd_fm_1.as()->Entries[id].MeltdownComplete ? "YES"_T.data() : "NO"_T.data()); // curious to see if anyone has actually played singleplayer - ImGui::Text("CEO Name: %s", boss_goon.GangName); - ImGui::Text("MC Name: %s", boss_goon.ClubhouseName); - ImGui::Text("Money In Wallet: %d", stats.WalletBalance); - ImGui::Text("Money In Bank: %d", stats.Money - stats.WalletBalance); - ImGui::Text("Total Money: %d", stats.Money); - ImGui::Text("Rank: %d (RP %d)", stats.Rank, stats.RP); - ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); - ImGui::Text("K/D Ratio: %f", stats.KdRatio); - ImGui::Text("Kills On Players: %d", stats.KillsOnPlayers); - ImGui::Text("Deaths By Players: %d", stats.DeathsByPlayers); - ImGui::Text("Prostitutes Frequented: %d", stats.ProstitutesFrequented); - ImGui::Text("Lap Dances Bought: %d", stats.LapDancesBought); - ImGui::Text("Missions Created: %d", stats.MissionsCreated); - ImGui::Text("Meltdown Complete: %s", scr_globals::gpbd_fm_1.as()->Entries[id].MeltdownComplete ? "Yes" : "No"); // curious to see if anyone has actually played singleplayer ImGui::Separator(); } - if (ImGui::BeginCombo("Chat Command Permissions", COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)])) + if (ImGui::BeginCombo("CHAT_COMMAND_PERMISSIONS"_T.data(), COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)])) { for (const auto& [type, name] : COMMAND_ACCESS_LEVELS) { @@ -182,7 +187,7 @@ namespace big ImGui::EndCombo(); } - if (ImGui::Button("Add To Database")) + if (ImGui::Button("PLAYER_INFO_ADD_TO_DB"_T.data())) { g_player_database_service->get_or_create_player(g_player_service->get_selected()); } diff --git a/src/views/players/player/player_kick.cpp b/src/views/players/player/player_kick.cpp index 433348cb..d0c2fc6e 100644 --- a/src/views/players/player/player_kick.cpp +++ b/src/views/players/player/player_kick.cpp @@ -6,7 +6,7 @@ namespace big { void view::player_kick() { - if (ImGui::TreeNode("Kick")) + if (ImGui::TreeNode("KICK"_T.data())) { auto const is_session_host = [] { return gta_util::get_network()->m_game_session_ptr->is_host(); }; diff --git a/src/views/players/player/player_misc.cpp b/src/views/players/player/player_misc.cpp index ad9270de..207e79b4 100644 --- a/src/views/players/player/player_misc.cpp +++ b/src/views/players/player/player_misc.cpp @@ -5,7 +5,7 @@ namespace big { void view::player_misc() { - if (ImGui::TreeNode("Misc")) + if (ImGui::TreeNode("MISC"_T.data())) { components::player_command_button<"joinceo">(g_player_service->get_selected()); components::player_command_button<"enterint">(g_player_service->get_selected()); @@ -20,9 +20,9 @@ namespace big ImGui::SameLine(); components::player_command_button<"giveammo">(g_player_service->get_selected()); - ImGui::Checkbox("Off The Radar", &g_player_service->get_selected()->off_radar); - ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted); - ImGui::Checkbox("Semi Godmode", &g_player_service->get_selected()->semi_godmode); + ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g_player_service->get_selected()->off_radar); + ImGui::Checkbox("NEVER_WANTED"_T.data(), &g_player_service->get_selected()->never_wanted); + ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g_player_service->get_selected()->semi_godmode); components::button("Gooch Test", [] { diff --git a/src/views/players/player/player_toxic.cpp b/src/views/players/player/player_toxic.cpp index 58118e69..98f5ff0a 100644 --- a/src/views/players/player/player_toxic.cpp +++ b/src/views/players/player/player_toxic.cpp @@ -8,7 +8,7 @@ namespace big { void view::player_toxic() { - if (ImGui::TreeNode("Toxic")) + if (ImGui::TreeNode("TOXIC"_T.data())) { components::player_command_button<"kill">(g_player_service->get_selected(), {}); ImGui::SameLine(); @@ -39,11 +39,11 @@ namespace big components::player_command_button<"fakeban">(g_player_service->get_selected(), {}); static int wanted_level; - ImGui::SliderInt("Wanted Level", &wanted_level, 0, 5); + ImGui::SliderInt("WANTED_LVL"_T.data(), &wanted_level, 0, 5); ImGui::SameLine(); components::player_command_button<"wanted">(g_player_service->get_selected(), { (uint64_t)wanted_level }, "Set"); - components::small_text("Teleports"); + components::small_text("TELEPORTS"_T); if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx])) { @@ -89,13 +89,13 @@ namespace big components::player_command_button<"warehousetp">(g_player_service->get_selected(), { (uint64_t)g.session.send_to_warehouse_idx }); - components::button("TP To Darts", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts); }); + components::button("TP_TO_DARTS"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts); }); ImGui::SameLine(); - components::button("TP To Flight School", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool); }); + components::button("TP_TO_FLIGHT_SCHOOL"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool); }); ImGui::SameLine(); - components::button("TP To Map Center", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling); }); + components::button("TP_TO_MAP_CENTER"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling); }); - components::button("TP To Skydive", [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive); }); + components::button("TP_TO_SKYDIVE"_T, [] { toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive); }); ImGui::SameLine(); components::player_command_button<"cayotp">(g_player_service->get_selected(), { }); ImGui::SameLine(); @@ -142,33 +142,33 @@ namespace big ImGui::SameLine(); components::player_command_button<"camhedz">(g_player_service->get_selected(), { }); - components::small_text("Warp Time (requires session host)"); + components::small_text("WARP_TIME"_T); - components::button("+1 Minute", [] { toxic::warp_time_forward(g_player_service->get_selected(), 60 * 1000); }); + components::button("PLUS_1_MINUTE"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 60 * 1000); }); ImGui::SameLine(); - components::button("+5 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 5 * 60 * 1000); }); + components::button("PLUS_5_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 5 * 60 * 1000); }); ImGui::SameLine(); - components::button("+48 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 48 * 60 * 1000); }); + components::button("PLUS_48_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 48 * 60 * 1000); }); ImGui::SameLine(); - components::button("+96 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 96 * 60 * 1000); }); + components::button("PLUS_96_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 96 * 60 * 1000); }); ImGui::SameLine(); - components::button("+200 Minutes", [] { toxic::warp_time_forward(g_player_service->get_selected(), 200 * 60 * 1000); }); + components::button("PLUS_200_MINUTES"_T, [] { toxic::warp_time_forward(g_player_service->get_selected(), 200 * 60 * 1000); }); ImGui::SameLine(); - components::button("Stop Time", [] { toxic::set_time(g_player_service->get_selected(), INT_MAX - 3000); }); + components::button("STOP_TIME"_T, [] { toxic::set_time(g_player_service->get_selected(), INT_MAX - 3000); }); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("This cannot be reversed. Use with caution"); + ImGui::SetTooltip("PLAYER_TOXIC_NO_WAY_BACK"_T.data()); - ImGui::Checkbox("Kill Loop", &g_player_service->get_selected()->kill_loop); + ImGui::Checkbox("KILL_LOOP"_T.data(), &g_player_service->get_selected()->kill_loop); ImGui::SameLine(); - ImGui::Checkbox("Explosion Loop", &g_player_service->get_selected()->explosion_loop); + ImGui::Checkbox("EXPLOSION_LOOP"_T.data(), &g_player_service->get_selected()->explosion_loop); ImGui::SameLine(); - ImGui::Checkbox("Freeze Loop", &g_player_service->get_selected()->freeze_loop); + ImGui::Checkbox("FREEZE_LOOP"_T.data(), &g_player_service->get_selected()->freeze_loop); - ImGui::Checkbox("Ragdoll Loop", &g_player_service->get_selected()->ragdoll_loop); + ImGui::Checkbox("RAGDOLL_LOOP"_T.data(), &g_player_service->get_selected()->ragdoll_loop); ImGui::SameLine(); - ImGui::Checkbox("Rotate Cam Loop", &g_player_service->get_selected()->rotate_cam_loop); + ImGui::Checkbox("ROT_CAM_LOOP"_T.data(), &g_player_service->get_selected()->rotate_cam_loop); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Also brings the player out of godmode if the event isn't blocked"); + ImGui::SetTooltip("PLAYER_TOXIC_BRING_PLAYER_OUT_GOD"_T.data()); ImGui::TreePop(); } diff --git a/src/views/players/player/player_troll.cpp b/src/views/players/player/player_troll.cpp index 5dba01da..264d8176 100644 --- a/src/views/players/player/player_troll.cpp +++ b/src/views/players/player/player_troll.cpp @@ -7,7 +7,7 @@ namespace big { void view::player_troll() { - if (ImGui::TreeNode("Troll")) + if (ImGui::TreeNode("TROLL"_T.data())) { components::player_command_button<"playertp">(g_player_service->get_selected()); ImGui::SameLine(); @@ -18,11 +18,11 @@ namespace big static int bounty_value = 0; - ImGui::SliderInt("Bounty", &bounty_value, 0, 10000); + ImGui::SliderInt("BOUNTY"_T.data(), &bounty_value, 0, 10000); ImGui::SameLine(); components::command_checkbox<"anonbounty">(); ImGui::SameLine(); - components::button("Set", [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);}); + components::button("SET"_T, [] { troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);}); ImGui::TreePop(); } diff --git a/src/views/players/view_player.cpp b/src/views/players/view_player.cpp index 611f01e8..04cc66b3 100644 --- a/src/views/players/view_player.cpp +++ b/src/views/players/view_player.cpp @@ -2,12 +2,10 @@ namespace big { - void view::view_player() { - - std::string title = std::format("Player Options: {}", g_player_service->get_selected()->get_name()); - - ImGui::Text(title.c_str()); - ImGui::Checkbox("Spectate", &g.player.spectating); + void view::view_player() + { + ImGui::Text("VIEW_PLAYER_PLAYER_OPTIONS"_T.data(), g_player_service->get_selected()->get_name()); + ImGui::Checkbox("SPECTATE"_T.data(), &g.player.spectating); if (g_player_service->get_selected()->is_valid()) { diff --git a/src/views/self/view_mobile.cpp b/src/views/self/view_mobile.cpp index 751fd477..339eb964 100644 --- a/src/views/self/view_mobile.cpp +++ b/src/views/self/view_mobile.cpp @@ -8,39 +8,39 @@ namespace big void view::mobile() { ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); - components::sub_title("Merryweather"); + components::sub_title("MERRYWEATHER"_T); ImGui::Separator(); - components::button("Request Ammo Drop", [] { + components::button("MW_AMMO_DROP"_T, [] { mobile::merry_weather::request_ammo_drop(); }); - components::button("Helicopter Pickup", [] { + components::button("MW_HELI_PICKUP"_T, [] { mobile::merry_weather::request_helicopter_pickup(); }); - components::button("Request Backup Helicopter", [] { + components::button("MW_BACKUP_HELI"_T, [] { mobile::merry_weather::request_backup_helicopter(); }); - components::button("Request Airstrike", [] { + components::button("MW_AIRSTRIKE"_T, [] { mobile::merry_weather::request_airstrike(); }); - components::sub_title("Mors Mutual"); + components::sub_title("MORS_MUTUAL"_T); ImGui::Separator(); - components::button("Mors Mutual Fix All Vehicles", [] { + components::button("MORS_FIX_ALL"_T, [] { int amount_fixed = mobile::mors_mutual::fix_all(); - g_notification_service->push("Mobile", - std::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have") + g_notification_service->push("MOBILE"_T.data(), + std::vformat("VEHICLE_FIX_AMOUNT"_T, std::make_format_args(amount_fixed, amount_fixed == 1 ? "VEHICLE_FIX_HAS"_T.data() : "VEHICLE_FIX_HAVE"_T.data())) ); }); - components::sub_title("CEO Abilities"); + components::sub_title("CEO_ABILITIES"_T); ImGui::Separator(); - components::button("Bullshark Testosterone", [] { + components::button("CEO_BULLSHARK"_T, [] { mobile::ceo_abilities::request_bullshark_testosterone(); }); diff --git a/src/views/self/view_self.cpp b/src/views/self/view_self.cpp index ecac3ae2..5443eab4 100644 --- a/src/views/self/view_self.cpp +++ b/src/views/self/view_self.cpp @@ -21,7 +21,7 @@ namespace big ImGui::Separator(); - components::sub_title("General"); + components::sub_title("GENERAL"_T); ImGui::BeginGroup(); @@ -39,7 +39,7 @@ namespace big components::command_checkbox<"noclip">(); components::command_checkbox<"noragdoll">(); components::command_checkbox<"fastrun">(); - ImGui::Checkbox("No Idle Kick", &g.tunables.no_idle_kick); + ImGui::Checkbox("NO_IDLE_KICK"_T.data(), &g.tunables.no_idle_kick); components::command_checkbox<"walkunder">(); if(!g.self.super_jump) components::command_checkbox<"beastjump">(); @@ -56,15 +56,15 @@ namespace big components::command_checkbox<"nocollision">(); components::command_checkbox<"mobileradio">(); - ImGui::Checkbox("Dance Mode", &g.self.dance_mode); + ImGui::Checkbox("DANCE_MODE"_T.data(), &g.self.dance_mode); ImGui::EndGroup(); ImGui::Separator(); - components::sub_title("Proofs"); + components::sub_title("PROOFS"_T); - if (ImGui::Button("Check all")) + if (ImGui::Button("CHECK_ALL"_T.data())) { g.self.proof_bullet = true; g.self.proof_fire = true; @@ -78,7 +78,7 @@ namespace big ImGui::SameLine(); - if (ImGui::Button("Uncheck all")) + if (ImGui::Button("UNCHECK_ALL"_T.data())) { g.self.proof_bullet = false; g.self.proof_fire = false; @@ -92,42 +92,42 @@ namespace big ImGui::BeginGroup(); - ImGui::Checkbox("Bullet", &g.self.proof_bullet); - ImGui::Checkbox("Fire", &g.self.proof_fire); + ImGui::Checkbox("BULLET"_T.data(), &g.self.proof_bullet); + ImGui::Checkbox("FIRE"_T.data(), &g.self.proof_fire); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Collision", &g.self.proof_collision); - ImGui::Checkbox("Melee", &g.self.proof_melee); + ImGui::Checkbox("COLLISION"_T.data(), &g.self.proof_collision); + ImGui::Checkbox("MELEE"_T.data(), &g.self.proof_melee); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Explosion", &g.self.proof_explosion); - ImGui::Checkbox("Steam", &g.self.proof_steam); + ImGui::Checkbox("EXPLOSION"_T.data(), &g.self.proof_explosion); + ImGui::Checkbox("STEAM"_T.data(), &g.self.proof_steam); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Drown", &g.self.proof_drown); - ImGui::Checkbox("Water", &g.self.proof_water); + ImGui::Checkbox("DROWN"_T.data(), &g.self.proof_drown); + ImGui::Checkbox("WATER"_T.data(), &g.self.proof_water); ImGui::EndGroup(); ImGui::Separator(); - components::sub_title("Police"); + components::sub_title("POLICE"_T); - ImGui::Checkbox("Never Wanted", &g.self.never_wanted); + ImGui::Checkbox("NEVER_WANTED"_T.data(), &g.self.never_wanted); if (!g.self.never_wanted) { - ImGui::Checkbox("Force Wanted Level", &g.self.force_wanted_level); - ImGui::Text("Wanted Level"); + ImGui::Checkbox("FORCE_WANTED_LVL"_T.data(), &g.self.force_wanted_level); + ImGui::Text("WANTED_LVL"_T.data()); if ( ImGui::SliderInt("###wanted_level", &g.self.wanted_level, 0, 5) && !g.self.force_wanted_level && @@ -139,31 +139,31 @@ namespace big ImGui::Separator(); - components::sub_title("HUD"); + components::sub_title("HUD"_T); ImGui::BeginGroup(); - ImGui::Checkbox("Hide Radar", &g.self.hide_radar); + ImGui::Checkbox("HIDE_RADAR"_T.data(), &g.self.hide_radar); ImGui::SameLine(); - ImGui::Checkbox("Hide Ammo", &g.self.hide_ammo); + ImGui::Checkbox("HIDE_AMMO"_T.data(), &g.self.hide_ammo); ImGui::SameLine(); - ImGui::Checkbox("Force show HUD", &g.self.force_show_hud); + ImGui::Checkbox("FORCE_SHOW_HUD"_T.data(), &g.self.force_show_hud); ImGui::Combo("##hud_comp_combo", &g.self.selected_hud_component, hud_component_names, (int)HudComponents::HUD_WEAPONS); ImGui::SameLine(); - components::button("Hide", [] { + components::button("HIDE"_T, [] { g.self.hud_components_states[g.self.selected_hud_component] = true; }); ImGui::SameLine(); - components::button("Show", [] { + components::button("SHOW"_T, [] { g.self.hud_components_states[g.self.selected_hud_component] = false; }); - components::button("Hide all", [] { + components::button("HIDE_ALL"_T, [] { g.self.hide_radar = true; g.self.hide_ammo = true; for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++) @@ -172,7 +172,7 @@ namespace big } }); ImGui::SameLine(); - components::button("Show all", [] { + components::button("SHOW_ALL"_T, [] { g.self.hide_radar = false; g.self.hide_ammo = false; for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++) @@ -181,9 +181,9 @@ namespace big } }); ImGui::SameLine(); - ImGui::Checkbox("Force show HUD element", &g.self.force_show_hud_element); + ImGui::Checkbox("FORCE_SHOW_HUD_ELEMENT"_T.data(), &g.self.force_show_hud_element); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("To force show a HUD specific element, click Hide all then click Show on the desired element."); + ImGui::SetTooltip("FORCE_SHOW_HUD_ELEMENT_DESC"_T.data()); ImGui::EndGroup(); diff --git a/src/views/self/view_teleport.cpp b/src/views/self/view_teleport.cpp index dfc8ac6e..0b87848a 100644 --- a/src/views/self/view_teleport.cpp +++ b/src/views/self/view_teleport.cpp @@ -9,14 +9,14 @@ namespace big { void view::teleport() { - ImGui::Text("Blips:"); + ImGui::Text("BLIPS"_T.data()); components::command_button<"waypointtp">({}, "Waypoint"); ImGui::SameLine(); components::command_button<"objectivetp">({}, "Objective"); components::command_checkbox<"autotptowp">(); - ImGui::Text("Vehicles:"); + ImGui::Text("VEHICLES"_T.data()); components::command_button<"lastvehtp">(); ImGui::SameLine(); components::command_button<"bringpv">(); diff --git a/src/views/self/view_weapons.cpp b/src/views/self/view_weapons.cpp index 5affd73a..a0b71152 100644 --- a/src/views/self/view_weapons.cpp +++ b/src/views/self/view_weapons.cpp @@ -11,7 +11,7 @@ namespace big { void view::weapons() { - components::sub_title("Ammo"); + components::sub_title("AMMO"_T); ImGui::BeginGroup(); @@ -22,7 +22,7 @@ namespace big ImGui::SameLine(); ImGui::BeginGroup(); - if (ImGui::Checkbox("Bypass C4 Limit", &g.weapons.bypass_c4_limit)) + if (ImGui::Checkbox("BYPASS_C4_LIM"_T.data(), &g.weapons.bypass_c4_limit)) { if (g.weapons.bypass_c4_limit) g_pointers->m_bypass_max_count_of_active_sticky_bombs->apply(); @@ -35,12 +35,12 @@ namespace big ImGui::Separator(); - ImGui::Checkbox("Enable Special Ammo", &g.weapons.ammo_special.toggle); + ImGui::Checkbox("ENABLE_SPECIAL_AMMO"_T.data(), &g.weapons.ammo_special.toggle); eAmmoSpecialType selected_ammo = g.weapons.ammo_special.type; eExplosionTag selected_explosion = g.weapons.ammo_special.explosion_tag; - if (ImGui::BeginCombo("Special Ammo", SPECIAL_AMMOS[(int)selected_ammo].name)) + if (ImGui::BeginCombo("SPECIAL_AMMO"_T.data(), SPECIAL_AMMOS[(int)selected_ammo].name)) { for (const auto& special_ammo : SPECIAL_AMMOS) { @@ -58,7 +58,7 @@ namespace big ImGui::EndCombo(); } - if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_explosion])) + if (ImGui::BeginCombo("BULLET_IMPACT"_T.data(), BULLET_IMPACTS[selected_explosion])) { for (const auto& [type, name] : BULLET_IMPACTS) { @@ -78,7 +78,7 @@ namespace big ImGui::Separator(); - components::sub_title("Misc"); + components::sub_title("MISC"_T); components::command_checkbox<"crosshairs">(); ImGui::SameLine(); @@ -86,7 +86,7 @@ namespace big ImGui::SameLine(); components::command_checkbox<"nospread">(); - components::button("Get All Weapons", [] + components::button("GET_ALL_WEAPONS"_T, [] { for (const auto& [_, weapon] : g_gta_data_service->weapons()) { @@ -97,7 +97,7 @@ namespace big WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true); }); ImGui::SameLine(); - components::button("Remove Current Weapon", [] + components::button("REMOVE_CUR_WEAPON"_T, [] { Hash weaponHash; WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weaponHash, 1); @@ -107,15 +107,15 @@ namespace big } }); - ImGui::SliderFloat("Damage Multiplier", &g.weapons.increased_damage, 1.f, 10.f, "%.1f"); + ImGui::SliderFloat("DMG_MULTIPLR"_T.data(), &g.weapons.increased_damage, 1.f, 10.f, "%.1f"); ImGui::Separator(); - components::sub_title("Custom Weapons"); + components::sub_title("CUSTOM_WEAPONS"_T); CustomWeapon selected = g.weapons.custom_weapon; - if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name)) + if (ImGui::BeginCombo("WEAPON"_T.data(), custom_weapons[(int)selected].name)) { for (const custom_weapon& weapon : custom_weapons) { @@ -142,7 +142,7 @@ namespace big // this some ugly ass looking code static char vehicle_gun[12]; std::memcpy(vehicle_gun, g.weapons.vehicle_gun_model.c_str(), 12); - if (ImGui::InputTextWithHint("Shooting Model", "Name of the vehicle model", vehicle_gun, sizeof(vehicle_gun))) + if (ImGui::InputTextWithHint("SHOOTING_MODEL"_T.data(), "NAME_VEHICLE_MODEL"_T.data(), vehicle_gun, sizeof(vehicle_gun))) { g.weapons.vehicle_gun_model = vehicle_gun; } diff --git a/src/views/settings/view_context_menu_settings.cpp b/src/views/settings/view_context_menu_settings.cpp index 19baa3c2..3a03b216 100644 --- a/src/views/settings/view_context_menu_settings.cpp +++ b/src/views/settings/view_context_menu_settings.cpp @@ -5,32 +5,32 @@ namespace big { void view::context_menu_settings() { - ImGui::Checkbox("Context Menu Enabled", &g.context_menu.enabled); + ImGui::Checkbox("SETTINGS_CONTEXT_MENU"_T.data(), &g.context_menu.enabled); if (g.context_menu.enabled) { - ImGui::Text("Allowed Entity Types:"); - ImGui::CheckboxFlags("Object", reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::OBJECT)); + ImGui::Text("SETTINGS_CONTEXT_MENU_ENTITY_TYPES"_T.data()); + ImGui::CheckboxFlags("SETTINGS_CONTEXT_MENU_ENTITY_TYPE_OBJECT"_T.data(), reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::OBJECT)); ImGui::SameLine(); - ImGui::CheckboxFlags("Ped", reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::PED)); + ImGui::CheckboxFlags("SETTINGS_CONTEXT_MENU_ENTITY_TYPE_PED"_T.data(), reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::PED)); ImGui::SameLine(); - ImGui::CheckboxFlags("Player", reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::PLAYER)); + ImGui::CheckboxFlags("SETTINGS_CONTEXT_MENU_ENTITY_TYPE_PLAYER"_T.data(), reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::PLAYER)); ImGui::SameLine(); - ImGui::CheckboxFlags("Vehicle", reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::VEHICLE)); + ImGui::CheckboxFlags("SETTINGS_CONTEXT_MENU_ENTITY_TYPE_VEHICLE"_T.data(), reinterpret_cast(&g.context_menu.allowed_entity_types), static_cast(ContextEntityType::VEHICLE)); static ImVec4 selected_option_color = ImGui::ColorConvertU32ToFloat4(g.context_menu.selected_option_color); - ImGui::Text("Selected Option Color:"); + ImGui::Text("SETTINGS_CONTEXT_MENU_COLOR"_T.data()); if (ImGui::ColorEdit4("###BSelected Option Color##cm_picker", (float*)&selected_option_color, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.context_menu.selected_option_color = ImGui::ColorConvertFloat4ToU32(selected_option_color); } - ImGui::Checkbox("Bounding Box Enabled", &g.context_menu.bounding_box_enabled); + ImGui::Checkbox("SETTINGS_CONTEXT_MENU_BOUNDING_BOX"_T.data(), &g.context_menu.bounding_box_enabled); if (g.context_menu.bounding_box_enabled) { static ImVec4 bounding_box_color = ImGui::ColorConvertU32ToFloat4(g.context_menu.bounding_box_color); - ImGui::Text("Bounding Box Color:"); + ImGui::Text("SETTINGS_CONTEXT_MENU_BOUNDING_BOX_COLOR"_T.data()); if (ImGui::ColorEdit4("###Bounding Box Color##cm_picker", (float*)&bounding_box_color, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.context_menu.bounding_box_color = ImGui::ColorConvertFloat4ToU32(bounding_box_color); diff --git a/src/views/settings/view_esp_settings.cpp b/src/views/settings/view_esp_settings.cpp index 04ec7a57..a3dc726a 100644 --- a/src/views/settings/view_esp_settings.cpp +++ b/src/views/settings/view_esp_settings.cpp @@ -4,73 +4,73 @@ namespace big { void view::esp_settings() { - ImGui::Checkbox("ESP Enabled", &g.esp.enabled); + ImGui::Checkbox("SETTINGS_ESP"_T.data(), &g.esp.enabled); if (g.esp.enabled) { - ImGui::Checkbox("Hide Self", &g.esp.hide_self); + ImGui::Checkbox("SETTINGS_ESP_HIDE_SELF"_T.data(), &g.esp.hide_self); - ImGui::Text("Global Render Distance (min, max)"); + ImGui::Text("SETTINGS_ESP_GLOBAL_RENDER_DISTANCE"_T.data()); ImGui::SliderFloat2("###Global Render Distance", g.esp.global_render_distance, 0.f, 1500.f); - ImGui::Checkbox("Tracer", &g.esp.tracer); + ImGui::Checkbox("SETTINGS_ESP_TRACER"_T.data(), &g.esp.tracer); if (g.esp.tracer) { - ImGui::Text("Tracer Draw Position (x, y)"); + ImGui::Text("SETTINGS_ESP_TRACER_POSITION"_T.data()); ImGui::SliderFloat2("###Draw Position", g.esp.tracer_draw_position, 0.f, 1.f); - ImGui::Text("Tracer Render Distance (min, max)"); + ImGui::Text("SETTINGS_ESP_TRACER_RENDER_DISTANCE"_T.data()); ImGui::SliderFloat2("###Tracer Render Distance", g.esp.tracer_render_distance, g.esp.global_render_distance[0], g.esp.global_render_distance[1]); } - ImGui::Checkbox("Box ESP", &g.esp.box); + ImGui::Checkbox("SETTINGS_ESP_BOX"_T.data(), &g.esp.box); if (g.esp.box) { - ImGui::Text("Box Render Distance (min, max)"); + ImGui::Text("SETTINGS_ESP_BOX_RENDER_DISTANCE"_T.data()); ImGui::SliderFloat2("###Box Render Distance", g.esp.box_render_distance, g.esp.global_render_distance[0], g.esp.global_render_distance[1]); } - ImGui::Checkbox("Show Player Name", &g.esp.name); - ImGui::Checkbox("Show Player Distance", &g.esp.distance); - ImGui::Checkbox("Show Player Godmode", &g.esp.god); - ImGui::Checkbox("Show Player Health", &g.esp.health); - ImGui::Checkbox("Show Player Armor", &g.esp.armor); + ImGui::Checkbox("SETTINGS_ESP_PLAYER_NAME"_T.data(), &g.esp.name); + ImGui::Checkbox("SETTINGS_ESP_PLAYER_DISTANCE"_T.data(), &g.esp.distance); + ImGui::Checkbox("SETTINGS_ESP_PLAYER_GOD_MODE"_T.data(), &g.esp.god); + ImGui::Checkbox("SETTINGS_ESP_PLAYER_HEALTH"_T.data(), &g.esp.health); + ImGui::Checkbox("SETTINGS_ESP_PLAYER_ARMOR"_T.data(), &g.esp.armor); - ImGui::Checkbox("Should ESP Color Change with Distance", &g.esp.change_esp_color_from_dist); + ImGui::Checkbox("SETTINGS_ESP_COLOR_W_DISTANCE"_T.data(), &g.esp.change_esp_color_from_dist); if (g.esp.health) - ImGui::Checkbox("Should Healthbar Scale with Distance", &g.esp.scale_health_from_dist); + ImGui::Checkbox("SETTINGS_ESP_SCALE_HEALTH"_T.data(), &g.esp.scale_health_from_dist); if (g.esp.armor) - ImGui::Checkbox("Should Armorbar Scale with Distance", &g.esp.scale_armor_from_dist); + ImGui::Checkbox("SETTINGS_ESP_SCALE_ARMOR"_T.data(), &g.esp.scale_armor_from_dist); static ImVec4 col_enemy = ImGui::ColorConvertU32ToFloat4(g.esp.enemy_color); static ImVec4 col_enemy_near = ImGui::ColorConvertU32ToFloat4(g.esp.enemy_near_color); static ImVec4 col_default = ImGui::ColorConvertU32ToFloat4(g.esp.default_color); static ImVec4 col_friend = ImGui::ColorConvertU32ToFloat4(g.esp.friend_color); - ImGui::Text("Distance threshold (min, max)"); + ImGui::Text("SETTINGS_ESP_DISTANCE_THRESHOLD"_T.data()); ImGui::SliderFloat2("###Distance threshold", g.esp.distance_threshold, g.esp.global_render_distance[0], g.esp.global_render_distance[1]); - if (ImGui::TreeNode("ESP Colors (RGBA)")) + if (ImGui::TreeNode("SETTINGS_ESP_COLORS"_T.data())) { if (g.esp.change_esp_color_from_dist) { - ImGui::Text("Enemy Close Color:"); + ImGui::Text("SETTINGS_ESP_ENEMY_CLOSE_COLOR"_T.data()); if (ImGui::ColorEdit4("###Enemy ESP Color##esp_picker", (float*)&col_enemy, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.esp.enemy_color = ImGui::ColorConvertFloat4ToU32(col_enemy); } - ImGui::Text("Enemy Near Color:"); + ImGui::Text("SETTINGS_ESP_ENEMY_NEAR_COLOR"_T.data()); if (ImGui::ColorEdit4("###Enemy Near ESP Color##esp_picker", (float*)&col_enemy_near, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.esp.enemy_near_color = ImGui::ColorConvertFloat4ToU32(col_enemy_near); } } - ImGui::Text("Default Color:"); + ImGui::Text("SETTINGS_ESP_ENEMY_DEFAULT_COLOR"_T.data()); if (ImGui::ColorEdit4("###Default ESP Color##esp_picker", (float*)&col_default, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.esp.default_color = ImGui::ColorConvertFloat4ToU32(col_default); } - ImGui::Text("Friendly Color:"); + ImGui::Text("SETTINGS_ESP_FRIENDLY_COLOR"_T.data()); if (ImGui::ColorEdit4("###Friend ESP Color##friend_picker", (float*)&col_friend, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.esp.friend_color = ImGui::ColorConvertFloat4ToU32(col_friend); diff --git a/src/views/settings/view_gui_settings.cpp b/src/views/settings/view_gui_settings.cpp index c944579d..d9ce205a 100644 --- a/src/views/settings/view_gui_settings.cpp +++ b/src/views/settings/view_gui_settings.cpp @@ -5,17 +5,17 @@ namespace big { void view::gui_settings() { - components::sub_title("UI Scale"); + components::sub_title("SETTINGS_UI_SCALE"_T); ImGui::SliderFloat("##gui-scale", &g.window.gui_scale, 1.f, 1.5f, "%.2f"); ImGui::SameLine(); - if (ImGui::Button("Apply##gui-scale")) + if (ImGui::Button("APPLY"_T.data())) g_renderer->rescale(g.window.gui_scale); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Changing the UI scale may break rendering and require you to unload and inject YimMenu again."); + ImGui::SetTooltip("SETTINGS_UI_SCALE_DESCRIPTION"_T.data()); - components::sub_title("Colors"); + components::sub_title("SETTINGS_UI_COLOR"_T); static ImVec4 col_gui = ImGui::ColorConvertU32ToFloat4(g.window.color); - if (ImGui::ColorEdit4("Gui Color##gui_picker", (float*)&col_gui, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) + if (ImGui::ColorEdit4("SETTINGS_UI_COLOR_PICKER"_T.data(), (float*)&col_gui, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview)) { g.window.color = ImGui::ColorConvertFloat4ToU32(col_gui); } diff --git a/src/views/settings/view_protection_settings.cpp b/src/views/settings/view_protection_settings.cpp index 35cb6719..102b3aac 100644 --- a/src/views/settings/view_protection_settings.cpp +++ b/src/views/settings/view_protection_settings.cpp @@ -5,46 +5,46 @@ namespace big void view::protection_settings() { ImGui::BeginGroup(); - ImGui::Checkbox("Bounty", &g.protections.script_events.bounty); - ImGui::Checkbox("CEO Money", &g.protections.script_events.ceo_money); - ImGui::Checkbox("Fake Deposit", &g.protections.script_events.fake_deposit); - ImGui::Checkbox("Force Mission", &g.protections.script_events.force_mission); - ImGui::Checkbox("Force Teleport", &g.protections.script_events.force_teleport); - ImGui::Checkbox("GTA Banner", &g.protections.script_events.gta_banner); - ImGui::Checkbox("MC Teleport", &g.protections.script_events.mc_teleport); + ImGui::Checkbox("BOUNTY"_T.data(), &g.protections.script_events.bounty); + ImGui::Checkbox("CEO_MONEY"_T.data(), &g.protections.script_events.ceo_money); + ImGui::Checkbox("FAKE_DEPOSIT"_T.data(), &g.protections.script_events.fake_deposit); + ImGui::Checkbox("FORCE_MISSION"_T.data(), &g.protections.script_events.force_mission); + ImGui::Checkbox("FORCE_TELEPORT"_T.data(), &g.protections.script_events.force_teleport); + ImGui::Checkbox("GTA_BANNER"_T.data(), &g.protections.script_events.gta_banner); + ImGui::Checkbox("MC_TELEPORT"_T.data(), &g.protections.script_events.mc_teleport); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Send to Cutscene", &g.protections.script_events.send_to_cutscene); - ImGui::Checkbox("Send to Location", &g.protections.script_events.send_to_location); - ImGui::Checkbox("Sound Spam", &g.protections.script_events.sound_spam); - ImGui::Checkbox("Personal Vehicle Destroyed", &g.protections.script_events.personal_vehicle_destroyed); - ImGui::Checkbox("Remote Off Radar", &g.protections.script_events.remote_off_radar); - ImGui::Checkbox("Rotate Cam", &g.protections.script_events.rotate_cam); - ImGui::Checkbox("Teleport To Warehouse", &g.protections.script_events.teleport_to_warehouse); + ImGui::Checkbox("SEND_TO_CUTSCENE"_T.data(), &g.protections.script_events.send_to_cutscene); + ImGui::Checkbox("SEND_TO_LOCATION"_T.data(), &g.protections.script_events.send_to_location); + ImGui::Checkbox("SOUND_SPAM"_T.data(), &g.protections.script_events.sound_spam); + ImGui::Checkbox("PERSONAL_VEHICLE_DESTROYED"_T.data(), &g.protections.script_events.personal_vehicle_destroyed); + ImGui::Checkbox("REMOTE_OFF_RADAR"_T.data(), &g.protections.script_events.remote_off_radar); + ImGui::Checkbox("ROTATE_CAM"_T.data(), &g.protections.script_events.rotate_cam); + ImGui::Checkbox("TELEPORT_TO_WAREHOUSE"_T.data(), &g.protections.script_events.teleport_to_warehouse); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Start Activity", &g.protections.script_events.start_activity); - ImGui::Checkbox("Send SMS", &g.protections.script_events.send_sms); - ImGui::Checkbox("Spectate", &g.protections.script_events.spectate); - ImGui::Checkbox("Vehicle Kick", &g.protections.script_events.vehicle_kick); - ImGui::Checkbox("Wanted Level", &g.protections.script_events.clear_wanted_level); - ImGui::Checkbox("Desync Kick", &g.protections.desync_kick); + ImGui::Checkbox("START_ACTIVITY"_T.data(), &g.protections.script_events.start_activity); + ImGui::Checkbox("SEND_SMS"_T.data(), &g.protections.script_events.send_sms); + ImGui::Checkbox("SPECTATE"_T.data(), &g.protections.script_events.spectate); + ImGui::Checkbox("VEHICLE_KICK"_T.data(), &g.protections.script_events.vehicle_kick); + ImGui::Checkbox("WANTED_LEVEL"_T.data(), &g.protections.script_events.clear_wanted_level); + ImGui::Checkbox("DESYNC_KICK"_T.data(), &g.protections.desync_kick); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("RID Join", &g.protections.rid_join); + ImGui::Checkbox("BLOCK_RID_JOINING"_T.data(), &g.protections.rid_join); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("This will block anyone trying to join, kick or crash you with your Rockstar ID, including your friends"); - ImGui::Checkbox("Lessen Breakup Kicks As Host", &g.protections.lessen_breakups); + ImGui::SetTooltip("BLOCK_RID_JOINING_DESCRIPTION"_T.data()); + ImGui::Checkbox("LESSEN_BREAKUP_KICK"_T.data(), &g.protections.lessen_breakups); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Attacker must join after you have become host for this to work. There are anti-cheat concerns with this feature"); + ImGui::SetTooltip("LESSEN_BREAKUP_KICK_DESCRIPTION"_T.data()); ImGui::EndGroup(); } diff --git a/src/views/settings/view_reaction_settings.cpp b/src/views/settings/view_reaction_settings.cpp index 269a31be..3f9c453b 100644 --- a/src/views/settings/view_reaction_settings.cpp +++ b/src/views/settings/view_reaction_settings.cpp @@ -4,11 +4,11 @@ namespace big { void draw_pair_option(const std::string_view name, decltype(g.notifications.gta_thread_kill)& option) { - ImGui::Text("%s", name.data()); + ImGui::Text(name.data()); ImGui::PushID(name.data()); - ImGui::Checkbox("Log", &option.log); - ImGui::Checkbox("Notify", &option.notify); + ImGui::Checkbox("LOG"_T.data(), &option.log); + ImGui::Checkbox("NOTIFY"_T.data(), &option.notify); ImGui::PopID(); } @@ -16,13 +16,13 @@ namespace big { if (ImGui::TreeNode(reaction.m_event_name)) { - ImGui::Checkbox("Announce In Chat", &reaction.announce_in_chat); - ImGui::Checkbox("Notify", &reaction.notify); - ImGui::Checkbox("Log", &reaction.log); - ImGui::Checkbox("Add Player To Database", &reaction.add_to_player_db); + ImGui::Checkbox("REACTION_CHAT"_T.data(), &reaction.announce_in_chat); + ImGui::Checkbox("NOTIFY"_T.data(), &reaction.notify); + ImGui::Checkbox("LOG"_T.data(), &reaction.log); + ImGui::Checkbox("REACTION_ADD_TO_DATABASE"_T.data(), &reaction.add_to_player_db); if (reaction.add_to_player_db) - ImGui::Checkbox("Block Joins", &reaction.block_joins); - ImGui::Checkbox("Kick Player", &reaction.kick); + ImGui::Checkbox("REACTION_BLOCK_JOINS"_T.data(), &reaction.block_joins); + ImGui::Checkbox("REACTION_KICK_PLAYER"_T.data(), &reaction.kick); ImGui::TreePop(); } } @@ -32,22 +32,22 @@ namespace big { if (ImGui::TreeNode(reaction.m_event_name)) { - ImGui::Checkbox("Announce In Chat", &reaction.announce_in_chat); - ImGui::Checkbox("Notify", &reaction.notify); - ImGui::Checkbox("Log", &reaction.log); - ImGui::Checkbox("Add Attacker To Database", &reaction.add_to_player_db); + ImGui::Checkbox("REACTION_CHAT"_T.data(), &reaction.announce_in_chat); + ImGui::Checkbox("NOTIFY"_T.data(), &reaction.notify); + ImGui::Checkbox("LOG"_T.data(), &reaction.log); + ImGui::Checkbox("REACTION_ADD_TO_DATABASE"_T.data(), &reaction.add_to_player_db); if (reaction.add_to_player_db) - ImGui::Checkbox("Block Joins", &reaction.block_joins); - ImGui::Checkbox("Kick Attacker", &reaction.kick); + ImGui::Checkbox("REACTION_BLOCK_JOINS"_T.data(), &reaction.block_joins); + ImGui::Checkbox("REACTION_KICK_ATTACKER"_T.data(), &reaction.kick); if (reaction.m_blockable || reaction.m_karmaable) ImGui::Separator(); if (reaction.m_blockable) - ImGui::Checkbox("Block", &reaction.block); + ImGui::Checkbox("BLOCK"_T.data(), &reaction.block); if (reaction.m_karmaable) - ImGui::Checkbox("Karma", &reaction.karma); + ImGui::Checkbox("KARMA"_T.data(), &reaction.karma); ImGui::TreePop(); } @@ -55,7 +55,7 @@ namespace big void view::reaction_settings() { - components::title("Reactions"); + components::title("SETTINGS_REACTIONS"_T); draw_reaction(g.reactions.bounty); draw_reaction(g.reactions.ceo_kick); draw_reaction(g.reactions.ceo_money); @@ -104,31 +104,31 @@ namespace big draw_interloper_reaction(g.reactions.lost_connection_kick_others); draw_interloper_reaction(g.reactions.breakup_others); - components::title("Notifications"); - components::sub_title("GTA Threads"); + components::title("SETTINGS_NOTIFICATIONS"_T); + components::sub_title("SETTINGS_NOTIFY_GTA_THREADS"_T); - draw_pair_option("Terminate", g.notifications.gta_thread_kill); - draw_pair_option("Start", g.notifications.gta_thread_start); + draw_pair_option("SETTINGS_NOTIFY_GTA_THREADS_TERMINATE"_T, g.notifications.gta_thread_kill); + draw_pair_option("SETTINGS_NOTIFY_GTA_THREADS_START"_T, g.notifications.gta_thread_start); - components::sub_title("Network Player Manager"); + components::sub_title("SETTINGS_NOTIFY_PLAYER_MGR"_T); - ImGui::Text("Player Join"); + ImGui::Text("SETTINGS_NOTIFY_PLAYER_JOIN"_T.data()); - ImGui::Checkbox("Above Map", &g.notifications.player_join.above_map); - ImGui::Checkbox("Log", &g.notifications.player_join.log); - ImGui::Checkbox("Notify", &g.notifications.player_join.notify); + ImGui::Checkbox("SETTINGS_NOTIFY_PLAYER_JOIN_ABOVE_MAP"_T.data(), &g.notifications.player_join.above_map); + ImGui::Checkbox("LOG"_T.data(), &g.notifications.player_join.log); + ImGui::Checkbox("NOTIFY"_T.data(), &g.notifications.player_join.notify); - draw_pair_option("Player Leave", g.notifications.player_leave); + draw_pair_option("SETTINGS_NOTIFY_PLAYER_LEAVE"_T, g.notifications.player_leave); - draw_pair_option("Init", g.notifications.network_player_mgr_init); - draw_pair_option("Shutdown", g.notifications.network_player_mgr_shutdown); + draw_pair_option("SETTINGS_NOTIFY_PLAYER_MGR_INIT"_T, g.notifications.network_player_mgr_init); + draw_pair_option("SETTINGS_NOTIFY_PLAYER_MGR_SHUTDOWN"_T, g.notifications.network_player_mgr_shutdown); - components::sub_title("Other"); + components::sub_title("SETTINGS_NOTIFY_OTHER"_T); - draw_pair_option("Transaction Error / Rate Limit", g.notifications.transaction_rate_limit); - draw_pair_option("Mismatch sync type", g.notifications.mismatch_sync_type); - draw_pair_option("Out of allowed range sync type", g.notifications.out_of_allowed_range_sync_type); - draw_pair_option("Invalid sync", g.notifications.invalid_sync); + draw_pair_option("SETTINGS_NOTIFY_TRANSACTION_RATE_LIMIT"_T, g.notifications.transaction_rate_limit); + draw_pair_option("SETTINGS_NOTIFY_MISMATCH_SYNC_TYPE"_T, g.notifications.mismatch_sync_type); + draw_pair_option("SETTINGS_NOTIFY_OUT_OF_ALLOWED_RANGE_SYNC_TYPE"_T, g.notifications.out_of_allowed_range_sync_type); + draw_pair_option("SETTINGS_NOTIFY_INVALID_SYNC"_T, g.notifications.invalid_sync); } } diff --git a/src/views/settings/view_settings.cpp b/src/views/settings/view_settings.cpp index 4671973a..e7a3026a 100644 --- a/src/views/settings/view_settings.cpp +++ b/src/views/settings/view_settings.cpp @@ -1,44 +1,10 @@ #include "views/view.hpp" -#include "script_mgr.hpp" namespace big { - void scripts_popupmodal() - { - ImGui::BeginGroup(); - components::sub_title("Scripts"); - ImGui::SameLine(ImGui::GetWindowWidth() - 100); - if (ImGui::Button("Close")) ImGui::CloseCurrentPopup(); - ImGui::Spacing(); - components::sub_title("These scripts are responsible for all looped features.\nOnly disable if you know what you are doing."); - - for (const auto& script : g_script_mgr.scripts()) - { - if (script->is_toggleable()) - if (ImGui::Checkbox(script->name(), script->toggle_ptr())) - g_notification_service->push(std::string(script->name()).append(" script"), script->is_enabled() ? "Resumed" : "Halted"); - } - - ImGui::EndGroup(); - } - void view::settings() { - components::sub_title("Misc"); - ImGui::Checkbox("Enable Dev DLC", &g.settings.dev_dlc); - - ImGui::Separator(); - - if (ImGui::Button("Manage scripts")) - ImGui::OpenPopup("Scripts"); - - ImGui::SetNextWindowPos({ 780,228 }, ImGuiCond_FirstUseEver); - if (ImGui::BeginPopupModal("Scripts", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) - { - scripts_popupmodal(); - - ImGui::EndPopup(); - } - + components::sub_title("SETTINGS_MISC"_T); + ImGui::Checkbox("SETTINGS_MISC_DEV_DLC"_T.data(), &g.settings.dev_dlc); } } \ No newline at end of file diff --git a/src/views/settings/view_translation_settings.cpp b/src/views/settings/view_translation_settings.cpp new file mode 100644 index 00000000..95a4ac58 --- /dev/null +++ b/src/views/settings/view_translation_settings.cpp @@ -0,0 +1,26 @@ +#include "views/view.hpp" + +namespace big +{ + void view::translation_settings() + { + const auto& language_entries = g_translation_service.available_translations(); + const auto current_pack = g_translation_service.current_language_pack(); + + ImGui::Text("SETTINGS_LANGUAGES"_T.data()); + if (ImGui::BeginCombo("##combo-languages", language_entries.at(current_pack).name.c_str())) + { + for (auto& i : language_entries) + { + if (ImGui::Selectable(i.second.name.c_str(), i.first == current_pack)) + g_translation_service.select_language_pack(i.first); + + if (i.first == current_pack) + { + ImGui::SetItemDefaultFocus(); + } + } + ImGui::EndCombo(); + } + } +} diff --git a/src/views/vehicle/view_fun_vehicle.cpp b/src/views/vehicle/view_fun_vehicle.cpp index 5b3df8fd..b4d03ddc 100644 --- a/src/views/vehicle/view_fun_vehicle.cpp +++ b/src/views/vehicle/view_fun_vehicle.cpp @@ -14,7 +14,7 @@ namespace big { void view::fun_vehicle() { - components::sub_title("Seat Changer"); + components::sub_title("SEAT_CHANGER"_T); { static std::map seats; static bool ready = true; @@ -46,7 +46,7 @@ namespace big if (seats.size() == 0) { - ImGui::Text("Please enter a vehicle."); + ImGui::Text("PLEASE_ENTER_VEHICLE"_T.data()); } else { @@ -59,11 +59,11 @@ namespace big ImGui::BeginDisabled(); } - std::string name = "Driver"; + std::string name = "DRIVER"_T.data(); if (idx >= 0) { - name = "Seat " + std::to_string(idx + 1); + name = "FUN_VEHICLE_SEAT"_T.data() + std::to_string(idx + 1); } if ((idx + 1) % 4 != 0) { @@ -83,11 +83,11 @@ namespace big ImGui::Separator(); - components::sub_title("Auto Drive"); + components::sub_title("AUTO_DRIVE"_T); { float auto_drive_speed_user_unit = vehicle::mps_to_speed(g.vehicle.auto_drive_speed, g.vehicle.speed_unit); if (ImGui::SliderFloat( - std::format("Top Speed({})", speed_unit_strings[(int)g.vehicle.speed_unit]).c_str(), + std::vformat("FUN_VEHICLE_TOP_SPEED"_T, std::make_format_args(speed_unit_strings[(int)g.vehicle.speed_unit])).c_str(), &auto_drive_speed_user_unit, vehicle::mps_to_speed(0.f, g.vehicle.speed_unit), vehicle::mps_to_speed(150.f, g.vehicle.speed_unit), @@ -96,8 +96,8 @@ namespace big g.vehicle.auto_drive_speed = vehicle::speed_to_mps(auto_drive_speed_user_unit, g.vehicle.speed_unit); } - static constexpr char const* driving_style_names[] = { "Law-Abiding", "The Road Is Yours" }; - if (ImGui::BeginCombo("Driving Style", driving_style_names[(int)g.vehicle.auto_drive_style])) + const char* driving_style_names[] = { "LAW_ABIDING"_T.data(), "ROAD_IS_YOURS"_T.data() }; + if (ImGui::BeginCombo("DRIVING_STYLE"_T.data(), driving_style_names[(int)g.vehicle.auto_drive_style])) { for (int i = 0; i < 2; i++) { @@ -105,8 +105,8 @@ namespace big { g.vehicle.auto_drive_style = (AutoDriveStyle)i; g_notification_service->push_warning( - "Auto Drive", - std::format("Driving style set to {}.", driving_style_names[i]) + "AUTO_DRIVE"_T.data(), + std::vformat("DRIVING_STYLE_SET_TO"_T.data(), std::make_format_args(driving_style_names[i])) ); } @@ -119,39 +119,39 @@ namespace big ImGui::EndCombo(); } - if (components::button("To Objective")) { + if (components::button("TO_OBJECTIVE"_T)) { g.vehicle.auto_drive_destination = AutoDriveDestination::OBJECTITVE; } ImGui::SameLine(); - if (components::button("To Waypoint")) { + if (components::button("TO_WAYPOINT"_T)) { g.vehicle.auto_drive_destination = AutoDriveDestination::WAYPOINT; } ImGui::SameLine(); - if (components::button("Wander")) { + if (components::button("WANDER"_T)) { g.vehicle.auto_drive_destination = AutoDriveDestination::WANDER; } ImGui::SameLine(); - if (components::button("Emergency Stop")) { + if (components::button("EMERGENCY_STOP"_T)) { g.vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP; } } ImGui::Separator(); - components::sub_title("Rainbow Paint"); + components::sub_title("RAINBOW_PAINT"_T); { - ImGui::Checkbox("Primary", &g.vehicle.rainbow_paint.primary); + ImGui::Checkbox("PRIMARY"_T.data(), &g.vehicle.rainbow_paint.primary); ImGui::SameLine(); - ImGui::Checkbox("Secondary", &g.vehicle.rainbow_paint.secondary); + ImGui::Checkbox("SECONDARY"_T.data(), &g.vehicle.rainbow_paint.secondary); ImGui::SameLine(); - ImGui::Checkbox("Neon", &g.vehicle.rainbow_paint.neon); + ImGui::Checkbox("NEON"_T.data(), &g.vehicle.rainbow_paint.neon); ImGui::SameLine(); - ImGui::Checkbox("Smoke", &g.vehicle.rainbow_paint.smoke); + ImGui::Checkbox("SMOKE"_T.data(), &g.vehicle.rainbow_paint.smoke); - static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" }; + const char* rgb_types[] = { "OFF"_T.data(), "FADE"_T.data(), "SPASM"_T.data() }; ImGui::SetNextItemWidth(120); - if (ImGui::BeginCombo("RGB Type", rgb_types[(int)g.vehicle.rainbow_paint.type])) + if (ImGui::BeginCombo("RGB_TYPE"_T.data(), rgb_types[(int)g.vehicle.rainbow_paint.type])) { for (int i = 0; i < 3; i++) { @@ -174,13 +174,13 @@ namespace big { ImGui::SameLine(); ImGui::SetNextItemWidth(150); - ImGui::SliderInt("RGB Speed", &g.vehicle.rainbow_paint.speed, 1, 10); + ImGui::SliderInt("RGB_SPEED"_T.data(), &g.vehicle.rainbow_paint.speed, 1, 10); } } ImGui::Separator(); - static constexpr char const* boost_behaviors[] = { "Default", "Instant Refill", "Infinite" }; - if (ImGui::BeginCombo("Boost Behavior", boost_behaviors[static_cast(g.vehicle.boost_behavior)])) + const char* boost_behaviors[] = { "DEFAULT"_T.data(), "INSTANT_REFILL"_T.data(), "INFINITE"_T.data() }; + if (ImGui::BeginCombo("BOOST_BEHAVIOR"_T.data(), boost_behaviors[static_cast(g.vehicle.boost_behavior)])) { for (int i = 0; i < 3; i++) { @@ -203,25 +203,25 @@ namespace big ImGui::Separator(); - components::sub_title("Vehicle Fly"); + components::sub_title("VEHICLE_FLY"_T); { ImGui::BeginGroup(); - ImGui::Checkbox("Enabled", &g.vehicle.fly.enabled); - ImGui::Checkbox("Don't Stop", &g.vehicle.fly.dont_stop); + ImGui::Checkbox("ENABLED"_T.data(), &g.vehicle.fly.enabled); + ImGui::Checkbox("DONT_STOP"_T.data(), &g.vehicle.fly.dont_stop); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Disable Collision", &g.vehicle.fly.no_collision); - ImGui::Checkbox("Stop On Exit", &g.vehicle.fly.stop_on_exit); + ImGui::Checkbox("DISABLE_COLLISION"_T.data(), &g.vehicle.fly.no_collision); + ImGui::Checkbox("STOP_ON_EXIT"_T.data(), &g.vehicle.fly.stop_on_exit); ImGui::EndGroup(); float fly_speed_user_unit = vehicle::mps_to_speed(g.vehicle.fly.speed, g.vehicle.speed_unit); if (ImGui::SliderFloat( - std::format("Speed({})", speed_unit_strings[(int)g.vehicle.speed_unit]).c_str(), + std::vformat("FUN_VEHICLE_SPEED"_T.data(), std::make_format_args(speed_unit_strings[(int)g.vehicle.speed_unit])).c_str(), &fly_speed_user_unit, vehicle::mps_to_speed(0.f, g.vehicle.speed_unit), vehicle::mps_to_speed(150.f, g.vehicle.speed_unit), diff --git a/src/views/vehicle/view_lsc.cpp b/src/views/vehicle/view_lsc.cpp index ed2c04f7..8b44afe5 100644 --- a/src/views/vehicle/view_lsc.cpp +++ b/src/views/vehicle/view_lsc.cpp @@ -37,7 +37,7 @@ namespace big player_vehicle = 0; selected_slot = -1; - ImGui::Text("Please enter a vehicle."); + ImGui::Text("PLEASE_ENTER_A_VEHICLE"_T.data()); return; } } @@ -67,9 +67,9 @@ namespace big std::map> tmp_front_wheel_map; std::map> tmp_rear_wheel_map; - tmp_slot_display_names[MOD_PLATE_STYLE] = "Plate Style"; - tmp_slot_display_names[MOD_WINDOW_TINT] = "Window Tint"; - tmp_slot_display_names[MOD_WHEEL_TYPE] = "Wheel Type"; + tmp_slot_display_names[MOD_PLATE_STYLE] = "PLATE_STYLE"_T.data(); + tmp_slot_display_names[MOD_WINDOW_TINT] = "WINDOW_TINT"_T.data(); + tmp_slot_display_names[MOD_WHEEL_TYPE] = "WHEEL_TYPE"_T.data(); tmp_mod_display_names[MOD_PLATE_STYLE].insert(lsc_plate_styles.begin(), lsc_plate_styles.end()); tmp_mod_display_names[MOD_WINDOW_TINT].insert(lsc_window_tint_types.begin(), lsc_window_tint_types.end()); @@ -117,7 +117,7 @@ namespace big { if (is_bennys) { - if (mod_name.rfind("Chrome ", 0) == 0) + if (mod_name.rfind("LSC_CHROME"_T.data(), 0) == 0) { std::string new_mod_name = mod_name.substr(7); @@ -145,7 +145,7 @@ namespace big { if (is_bennys) { - if (mod_name.rfind("Chrome ", 0) == 0) + if (mod_name.rfind("LSC_CHROME"_T.data(), 0) == 0) { std::string new_mod_name = mod_name.substr(7); @@ -194,11 +194,11 @@ namespace big }); } - components::button("Start LS Customs", [] { + components::button("START_LS_CUSTOMS"_T, [] { g.vehicle.ls_customs = true; }); ImGui::SameLine(); - if (components::button("Max Vehicle")) + if (components::button("MAX_VEHICLE"_T)) { g_fiber_pool->queue_job([] { vehicle::max_vehicle(self::veh); @@ -213,9 +213,9 @@ namespace big static char plate[9]; ImGui::SetNextItemWidth(200.f); - components::input_text_with_hint("##plate", "Plate Number", plate, sizeof(plate), ImGuiInputTextFlags_None); + components::input_text_with_hint("##plate", "PLATE_NUMBER"_T, plate, sizeof(plate), ImGuiInputTextFlags_None); ImGui::SameLine(); - if (components::button("Change Plate Number")) + if (components::button("CHANGE_PLATE_NUMBER"_T)) { g_fiber_pool->queue_job([] { vehicle::set_plate(self::veh, plate); @@ -223,10 +223,10 @@ namespace big } ImGui::Separator(); - components::sub_title("Mod Options"); + components::sub_title("MOD_OPTIONS"_T); bool is_bulletproof_tires = !owned_mods[MOD_TIRE_CAN_BURST]; - if (ImGui::Checkbox("Bulletproof Tires", (bool*)&is_bulletproof_tires)) + if (ImGui::Checkbox("BULLETPROOF_TIRES"_T.data(), (bool*)&is_bulletproof_tires)) { g_fiber_pool->queue_job([is_bulletproof_tires] { owned_mods[MOD_TIRE_CAN_BURST] = (int32_t)!is_bulletproof_tires; @@ -235,7 +235,7 @@ namespace big } ImGui::SameLine(); - if (ImGui::Checkbox("Low Grip Tires", (bool*)&owned_mods[MOD_DRIFT_TIRE])) + if (ImGui::Checkbox("LOW_GRIP_TIRES"_T.data(), (bool*)&owned_mods[MOD_DRIFT_TIRE])) { g_fiber_pool->queue_job([] { VEHICLE::SET_DRIFT_TYRES(player_vehicle, owned_mods[MOD_DRIFT_TIRE]); @@ -243,14 +243,14 @@ namespace big } ImGui::SameLine(); - if (ImGui::Checkbox("Turbo", (bool*)&owned_mods[MOD_TURBO])) + if (ImGui::Checkbox("TURBO"_T.data(), (bool*)&owned_mods[MOD_TURBO])) { g_fiber_pool->queue_job([] { VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_TURBO, owned_mods[MOD_TURBO]); }); } ImGui::SameLine(); - if (ImGui::Checkbox("Tiresmoke", (bool*)&owned_mods[MOD_TYRE_SMOKE])) + if (ImGui::Checkbox("TIRESMOKE"_T.data(), (bool*)&owned_mods[MOD_TYRE_SMOKE])) { g_fiber_pool->queue_job([] { VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_TYRE_SMOKE, owned_mods[MOD_TYRE_SMOKE]); @@ -261,7 +261,7 @@ namespace big ImGui::BeginGroup(); - components::sub_title("Slot"); + components::sub_title("SLOT"_T); if (ImGui::ListBoxHeader("##slot", ImVec2(200, 200))) { for (const auto& [slot, name] : slot_display_names) @@ -300,7 +300,7 @@ namespace big ImGui::SameLine(); ImGui::BeginGroup(); - components::sub_title("Mod"); + components::sub_title("MOD"_T); if (ImGui::ListBoxHeader("##mod", ImVec2(240, 200))) { for (const auto& it : mod_display_names[selected_slot]) @@ -369,7 +369,7 @@ namespace big ImGui::SameLine(); ImGui::BeginGroup(); - components::sub_title("Style"); + components::sub_title("STYLE"_T); if (ImGui::ListBoxHeader("##style", ImVec2(200, 200))) { std::string mod_name = mod_display_names[selected_slot][*wheel_stock_mod]; @@ -386,7 +386,7 @@ namespace big { if (i == 0) { - if (ImGui::Selectable("Stock", mod == owned_mods[selected_slot] && *wheel_custom == false)) + if (ImGui::Selectable("STOCK"_T.data(), mod == owned_mods[selected_slot] && *wheel_custom == false)) { g_fiber_pool->queue_job([&mod] { VEHICLE::SET_VEHICLE_MOD(player_vehicle, selected_slot, mod, false); @@ -398,7 +398,7 @@ namespace big should_custom = true; } - std::string label = "Style " + std::to_string(mod); + std::string label = "LSC_STYLE"_T.data() + std::to_string(mod); if (ImGui::Selectable(label.c_str(), mod == owned_mods[selected_slot] && *wheel_custom == should_custom)) { g_fiber_pool->queue_job([&mod, should_custom] { @@ -417,44 +417,47 @@ namespace big ImGui::Separator(); - components::sub_title("Neon Light Options"); + components::sub_title("NEON_LIGHT_OPTIONS"_T); - if (ImGui::Checkbox("Headlight##headlight_en", (bool*)&owned_mods[MOD_XENON_LIGHTS])) + ImGui::PushID("##headlight_en"); + if (ImGui::Checkbox("HEADLIGHT"_T.data(), (bool*)&owned_mods[MOD_XENON_LIGHTS])) { g_fiber_pool->queue_job([] { VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_XENON_LIGHTS, owned_mods[MOD_XENON_LIGHTS]); }); } + ImGui::PopID(); ImGui::SameLine(); - if (ImGui::Checkbox("Left", (bool*)&owned_mods[MOD_NEON_LEFT_ON])) + if (ImGui::Checkbox("LEFT"_T.data(), (bool*)&owned_mods[MOD_NEON_LEFT_ON])) { g_fiber_pool->queue_job([] { VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_LEFT, owned_mods[MOD_NEON_LEFT_ON]); }); } ImGui::SameLine(); - if (ImGui::Checkbox("Right", (bool*)&owned_mods[MOD_NEON_RIGHT_ON])) + if (ImGui::Checkbox("RIGHT"_T.data(), (bool*)&owned_mods[MOD_NEON_RIGHT_ON])) { g_fiber_pool->queue_job([] { VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_RIGHT, owned_mods[MOD_NEON_RIGHT_ON]); }); } ImGui::SameLine(); - if (ImGui::Checkbox("Front", (bool*)&owned_mods[MOD_NEON_FRONT_ON])) + if (ImGui::Checkbox("FRONT"_T.data(), (bool*)&owned_mods[MOD_NEON_FRONT_ON])) { g_fiber_pool->queue_job([] { VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_FRONT, owned_mods[MOD_NEON_FRONT_ON]); }); } ImGui::SameLine(); - if (ImGui::Checkbox("Back", (bool*)&owned_mods[MOD_NEON_BACK_ON])) + if (ImGui::Checkbox("BACK"_T.data(), (bool*)&owned_mods[MOD_NEON_BACK_ON])) { g_fiber_pool->queue_job([] { VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_BACK, owned_mods[MOD_NEON_BACK_ON]); }); } ImGui::SameLine(); - components::button("Check All##neon_check_all", [] { + ImGui::PushID("##neon_check_all"); + components::button("CHECK_ALL"_T, [] { owned_mods[MOD_XENON_LIGHTS] = true; owned_mods[MOD_NEON_LEFT_ON] = true; owned_mods[MOD_NEON_RIGHT_ON] = true; @@ -467,8 +470,10 @@ namespace big VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_FRONT, owned_mods[MOD_NEON_FRONT_ON]); VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_BACK, owned_mods[MOD_NEON_BACK_ON]); }); + ImGui::PopID(); ImGui::SameLine(); - components::button("Uncheck All##neon_uncheck_all", [] { + ImGui::PushID("##neon_uncheck_all"); + components::button("UNCHECK_ALL"_T, [] { owned_mods[MOD_XENON_LIGHTS] = false; owned_mods[MOD_NEON_LEFT_ON] = false; owned_mods[MOD_NEON_RIGHT_ON] = false; @@ -481,9 +486,10 @@ namespace big VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_FRONT, owned_mods[MOD_NEON_FRONT_ON]); VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_BACK, owned_mods[MOD_NEON_BACK_ON]); }); + ImGui::PopID(); ImGui::Separator(); - components::sub_title("Color Options"); + components::sub_title("COLOR_OPTIONS"_T); static int color_to_change = 0; static int color_type = 8; @@ -498,29 +504,29 @@ namespace big if (ImGui::ListBoxHeader("##color_options", ImVec2(120, 254))) { - if (ImGui::Selectable("Primary", color_to_change == 0, ImGuiSelectableFlags_SelectOnClick)) + if (ImGui::Selectable("PRIMARY"_T.data(), color_to_change == 0, ImGuiSelectableFlags_SelectOnClick)) { color_to_change = 0; } - if (ImGui::Selectable("Secondary", color_to_change == 1)) + if (ImGui::Selectable("SECONDARY"_T.data(), color_to_change == 1)) { color_to_change = 1; } - if (ImGui::Selectable("Pearlescent", color_to_change == 2)) + if (ImGui::Selectable("PEARLESCENT"_T.data(), color_to_change == 2)) { color_to_change = 2; color_type = 4; } - if (ImGui::Selectable("Interior", color_to_change == 3)) + if (ImGui::Selectable("INTERIOR"_T.data(), color_to_change == 3)) { color_to_change = 3; color_type = 6; } - if (ImGui::Selectable("Dashboard", color_to_change == 4)) + if (ImGui::Selectable("DASHBOARD"_T.data(), color_to_change == 4)) { color_to_change = 4; color_type = 7; @@ -530,7 +536,7 @@ namespace big { ImGui::BeginDisabled(); } - if (ImGui::Selectable("Tire Smoke", color_to_change == 5)) + if (ImGui::Selectable("TIRE_SMOKE"_T.data(), color_to_change == 5)) { color_to_change = 5; color_type = 8; @@ -540,7 +546,7 @@ namespace big ImGui::EndDisabled(); } - if (ImGui::Selectable("Wheel Color", color_to_change == 6)) + if (ImGui::Selectable("WHEEL_COLOR"_T.data(), color_to_change == 6)) { color_to_change = 6; color_type = 5; @@ -550,17 +556,19 @@ namespace big { ImGui::BeginDisabled(); } - if (ImGui::Selectable("Headlight##headlight_col", color_to_change == 7)) + ImGui::PushID("##headlight_col"); + if (ImGui::Selectable("HEADLIGHT"_T.data(), color_to_change == 7)) { color_to_change = 7; color_type = 9; } + ImGui::PopID(); if (!owned_mods[MOD_XENON_LIGHTS]) { ImGui::EndDisabled(); } - if (ImGui::Selectable("Neon", color_to_change == 8)) + if (ImGui::Selectable("NEON"_T.data(), color_to_change == 8)) { color_to_change = 8; color_type = 8; @@ -582,11 +590,11 @@ namespace big ImGui::SameLine(); if (ImGui::ListBoxHeader("##colors", ImVec2(140, 254))) { - if (ImGui::Selectable("Custom", color_type == 8, ImGuiSelectableFlags_SelectOnClick)) + if (ImGui::Selectable("CUSTOM"_T.data(), color_type == 8, ImGuiSelectableFlags_SelectOnClick)) { color_type = 8; } - if (ImGui::Selectable("Remove Custom", false)) + if (ImGui::Selectable("REMOVE_CUSTOM"_T.data(), false)) { g_fiber_pool->queue_job([] { if (color_to_change == 0) @@ -601,19 +609,19 @@ namespace big }); } - if (ImGui::Selectable("Chrome", color_type == 0)) + if (ImGui::Selectable("CHROME"_T.data(), color_type == 0)) { color_type = 0; } - if (ImGui::Selectable("Classic", color_type == 1)) + if (ImGui::Selectable("CLASSIC"_T.data(), color_type == 1)) { color_type = 1; } - if (ImGui::Selectable("Matte", color_type == 2)) + if (ImGui::Selectable("MATTE"_T.data(), color_type == 2)) { color_type = 2; } - if (ImGui::Selectable("Metals", color_type == 3)) + if (ImGui::Selectable("METALS"_T.data(), color_type == 3)) { color_type = 3; } @@ -710,7 +718,7 @@ namespace big ImGui::SameLine(); ImGui::SetNextItemWidth(214); - if (ImGui::ColorPicker3("Custom VehColor", color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHex)) + if (ImGui::ColorPicker3("CUSTOM_VEHCOLOR"_T.data(), color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHex)) { *color_r = (int)(color[0] * 255); *color_g = (int)(color[1] * 255); @@ -772,7 +780,7 @@ namespace big { case 0: //Chrome { - if (ImGui::Selectable("Chrome", selected_color == COLOR_CHROME)) + if (ImGui::Selectable("CHROME"_T.data(), selected_color == COLOR_CHROME)) { if (color_to_change == 0) { diff --git a/src/views/vehicle/view_persist_car.cpp b/src/views/vehicle/view_persist_car.cpp index 4f5342e0..4e83c49b 100644 --- a/src/views/vehicle/view_persist_car.cpp +++ b/src/views/vehicle/view_persist_car.cpp @@ -25,7 +25,7 @@ namespace big const auto vehicle = persist_car_service::load_vehicle(selected_vehicle_file); if (!vehicle) { - g_notification_service->push_warning("Persist Car", "Vehicle failed to spawn, there is most likely too many spawned vehicles in the area"); + g_notification_service->push_warning("PERSIST_CAR"_T.data(), "PERSIST_CAR_TO_MANY_SPAWNED"_T.data()); } else if (g.spawn_vehicle.spawn_inside) teleport::into_vehicle(vehicle); @@ -34,7 +34,7 @@ namespace big } else { - g_notification_service->push_warning("Persist Car", "Select a file first"); + g_notification_service->push_warning("PERSIST_CAR"_T.data(), "SELECT_FILE_FIRST"_T.data()); } } @@ -45,7 +45,7 @@ namespace big const auto vehicle_files = persist_car_service::list_files(); ImGui::PushItemWidth(250); - ImGui::Text("Saved Vehicles"); + ImGui::Text("SAVED_VEHICLES"_T.data()); if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200))) { @@ -65,18 +65,18 @@ namespace big ImGui::PushItemWidth(250); components::input_text_with_hint( - "Vehicle File Name", - "Ex: My Cool Car", + "VEHICLE_FILE_NAME"_T, + "VEHICLE_FILE_NAME_EXAMPLE"_T, vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input)); ImGui::SameLine(); - components::button("Save Vehicle", [] + components::button("SAVE_VEHICLE"_T, [] { save_vehicle(vehicle_file_name_input); }); - components::button("Load Vehicle", [] + components::button("LOAD_VEHICLE"_T, [] { load_vehicle(selected_vehicle_file); }); diff --git a/src/views/vehicle/view_pv.cpp b/src/views/vehicle/view_pv.cpp index 4a58d531..fc329984 100644 --- a/src/views/vehicle/view_pv.cpp +++ b/src/views/vehicle/view_pv.cpp @@ -11,7 +11,7 @@ namespace big void view::pv() { ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); - if (ImGui::Checkbox("Preview", &g.clone_pv.preview_vehicle)) + if (ImGui::Checkbox("PREVIEW"_T.data(), &g.clone_pv.preview_vehicle)) { if (!g.clone_pv.preview_vehicle) { @@ -19,21 +19,21 @@ namespace big } } ImGui::SameLine(); - ImGui::Checkbox("Spawn In", &g.clone_pv.spawn_inside); + ImGui::Checkbox("SPAWN_IN"_T.data(), &g.clone_pv.spawn_inside); ImGui::SameLine(); static char plate_buf[9] = { 0 }; int num_of_rows = 3; - ImGui::Checkbox("Spawn Clone", &g.clone_pv.spawn_clone); + ImGui::Checkbox("SPAWN_CLONE"_T.data(), &g.clone_pv.spawn_clone); if (g.clone_pv.spawn_clone) { num_of_rows = 5; - ImGui::Checkbox("Spawn Maxed", &g.clone_pv.spawn_maxed); + ImGui::Checkbox("SPAWN_MAXED"_T.data(), &g.clone_pv.spawn_maxed); ImGui::SameLine(); - ImGui::Checkbox("Clone PV Plate", &g.clone_pv.clone_plate); + ImGui::Checkbox("CLONE_PV_PLATE"_T.data(), &g.clone_pv.clone_plate); if (g.clone_pv.clone_plate) { num_of_rows = 4; @@ -43,7 +43,7 @@ namespace big ImGui::SetNextItemWidth(300.f); strncpy(plate_buf, g.clone_pv.plate.c_str(), 9); - components::input_text_with_hint("Plate", "Plate Number", plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] { + components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] { g.clone_pv.plate = plate_buf; }); } @@ -54,9 +54,9 @@ namespace big const auto& class_arr = g_gta_data_service->vehicle_classes(); ImGui::SetNextItemWidth(300.f); - if (ImGui::BeginCombo("Vehicle Class", selected_class == -1 ? "ALL" : class_arr[selected_class].c_str())) + if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(), selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str())) { - if (ImGui::Selectable("ALL", selected_class == -1)) + if (ImGui::Selectable("ALL"_T.data(), selected_class == -1)) { selected_class = -1; } @@ -81,14 +81,14 @@ namespace big static char search[64]; ImGui::SetNextItemWidth(300.f); - components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None); + components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None); g_mobile_service->refresh_personal_vehicles(); if (ImGui::ListBoxHeader("###personal_veh_list", { 300, static_cast(*g_pointers->m_resolution_y - 188 - 38 * num_of_rows) })) { if (g_mobile_service->personal_vehicles().empty()) { - ImGui::Text("No personal vehicles found, \nare you online?"); + ImGui::Text("NO_PERSONAL_VEHICLES"_T.data()); } else { @@ -134,7 +134,7 @@ namespace big if (veh == 0) { - g_notification_service->push_error("Vehicle", "Unable to spawn vehicle"); + g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data()); } else { diff --git a/src/views/vehicle/view_spawn_vehicle.cpp b/src/views/vehicle/view_spawn_vehicle.cpp index 7ac54e72..8d9d695f 100644 --- a/src/views/vehicle/view_spawn_vehicle.cpp +++ b/src/views/vehicle/view_spawn_vehicle.cpp @@ -11,7 +11,7 @@ namespace big { ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always); - if (ImGui::Checkbox("Preview", &g.spawn_vehicle.preview_vehicle)) + if (ImGui::Checkbox("PREVIEW"_T.data(), &g.spawn_vehicle.preview_vehicle)) { if (!g.spawn_vehicle.preview_vehicle) { @@ -27,7 +27,7 @@ namespace big strncpy(plate_buf, g.spawn_vehicle.plate.c_str(), 9); ImGui::SetNextItemWidth(300.f); - components::input_text_with_hint("Plate", "Plate Number", plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] { + components::input_text_with_hint("PLATE"_T, "PLATE_NUMBER"_T, plate_buf, sizeof(plate_buf), ImGuiInputTextFlags_None, [] { g.spawn_vehicle.plate = plate_buf; }); @@ -36,9 +36,9 @@ namespace big const auto& class_arr = g_gta_data_service->vehicle_classes(); ImGui::SetNextItemWidth(300.f); - if (ImGui::BeginCombo("Vehicle Class", selected_class == -1 ? "ALL" : class_arr[selected_class].c_str())) + if (ImGui::BeginCombo("VEHICLE_CLASS"_T.data(), selected_class == -1 ? "ALL"_T.data() : class_arr[selected_class].c_str())) { - if (ImGui::Selectable("ALL", selected_class == -1)) + if (ImGui::Selectable("ALL"_T.data(), selected_class == -1)) { selected_class = -1; } @@ -63,7 +63,7 @@ namespace big static char search[64]; ImGui::SetNextItemWidth(300.f); - components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None); + components::input_text_with_hint("MODEL_NAME"_T, "SEARCH"_T, search, sizeof(search), ImGuiInputTextFlags_None); if (ImGui::ListBoxHeader("###vehicles", { 300, static_cast(*g_pointers->m_resolution_y - 188 - 38 * 4) })) @@ -80,7 +80,7 @@ namespace big { const auto& item = g_gta_data_service->vehicle_by_hash(veh_hash); - components::selectable(std::format("Current Vehicle [{}]", item.m_display_name), false, [] { + components::selectable(std::vformat("SPAWN_VEHICLE_CURRENT_VEHICLE"_T, std::make_format_args(item.m_display_name)), false, [] { if (self::veh) { Vector3 spawn_location = vehicle::get_spawn_location(g.spawn_vehicle.spawn_inside); @@ -92,7 +92,7 @@ namespace big if (veh == 0) { - g_notification_service->push_error("Vehicle", "Unable to spawn vehicle"); + g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data()); } else { @@ -162,7 +162,7 @@ namespace big if (veh == 0) { - g_notification_service->push_error("Vehicle", "Unable to spawn vehicle"); + g_notification_service->push_error("VEHICLE"_T.data(), "UNABLE_TO_SPAWN_VEHICLE"_T.data()); } else { @@ -196,7 +196,7 @@ namespace big } else { - ImGui::Text("No vehicles in registry."); + ImGui::Text("NO_VEHICLE_IN_REGISTRY"_T.data()); } ImGui::ListBoxFooter(); } diff --git a/src/views/vehicle/view_vehicle.cpp b/src/views/vehicle/view_vehicle.cpp index 508f8ee9..5ed6cdb0 100644 --- a/src/views/vehicle/view_vehicle.cpp +++ b/src/views/vehicle/view_vehicle.cpp @@ -8,14 +8,14 @@ namespace big { void view::vehicle() { - components::button("MMI Fix All PV", [] { + components::button("MORS_FIX_ALL"_T, [] { int amount_fixed = mobile::mors_mutual::fix_all(); - g_notification_service->push("Mobile", - std::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have") + g_notification_service->push("MOBILE"_T.data(), + std::vformat("VEHICLE_FIX_AMOUNT"_T.data(), std::make_format_args(amount_fixed, amount_fixed == 1 ? "VEHICLE_FIX_HAS"_T.data() : "VEHICLE_FIX_HAVE"_T.data())) ); }); ImGui::SameLine(); - components::button("Repair", [] { + components::button("REPAIR"_T, [] { vehicle::repair(self::veh); }); @@ -24,24 +24,24 @@ namespace big ImGui::Separator(); - components::button("Teleport in PV", [] { + components::button("TP_IN_PV"_T, [] { Vehicle veh = mobile::mechanic::get_personal_vehicle(); teleport::into_vehicle(veh); }); ImGui::SameLine(); - components::button("Bring PV", [] { + components::button("BRING_PV"_T, [] { Vehicle veh = mobile::mechanic::get_personal_vehicle(); vehicle::bring(veh, self::pos, true); }); ImGui::SameLine(); - components::button("Bring Closest Vehicle", [] { + components::button("BRING_CLOSEST_VEHICLE"_T, [] { Vehicle veh = vehicle::get_closest_to_location(self::pos, 200); vehicle::bring(veh, self::pos, true, -1); }); ImGui::Separator(); - components::button("Turn Engine On", [] { + components::button("TURN_ENGINE_ON"_T, [] { vehicle::set_engine_state( self::veh, true, @@ -50,7 +50,7 @@ namespace big ); }); ImGui::SameLine(); - components::button("Turn Engine Off", [] { + components::button("TURN_ENGINE_OFF"_T, [] { vehicle::set_engine_state( self::veh, false, @@ -58,17 +58,17 @@ namespace big g.vehicle.disable_engine_auto_start ); }); - ImGui::Checkbox("Disable Engine Auto Start", &g.vehicle.disable_engine_auto_start); + ImGui::Checkbox("DISABLE_ENGINE_AUTO_START"_T.data(), &g.vehicle.disable_engine_auto_start); ImGui::SameLine(); - ImGui::Checkbox("Change State Immediately", &g.vehicle.change_engine_state_immediately); + ImGui::Checkbox("CHANGE_STATE_IMMEDIATELY"_T.data(), &g.vehicle.change_engine_state_immediately); ImGui::Separator(); - components::sub_title("General"); + components::sub_title("GENERAL"_T); { ImGui::BeginGroup(); - ImGui::Checkbox("God Mode", &g.vehicle.god_mode); + ImGui::Checkbox("GOD_MODE"_T.data(), &g.vehicle.god_mode); components::command_checkbox<"hornboost">(); components::command_checkbox<"vehjump">(); components::command_checkbox<"invisveh">(); @@ -91,10 +91,10 @@ namespace big ImGui::BeginGroup(); components::command_checkbox<"seatbelt">(); - ImGui::Checkbox("Turn Signals", &g.vehicle.turn_signals); + ImGui::Checkbox("TURN_SIGNALS"_T.data(), &g.vehicle.turn_signals); if (g.vehicle.turn_signals) { - ImGui::Checkbox("Fully Automatic Signal", &g.vehicle.auto_turn_signals); + ImGui::Checkbox("FULLY_AUTOMATIC_SIGNAL"_T.data(), &g.vehicle.auto_turn_signals); } components::command_checkbox<"driveunder">(); @@ -103,9 +103,9 @@ namespace big ImGui::Separator(); - components::sub_title("Proofs"); + components::sub_title("PROOFS"_T); { - if (ImGui::Button("Check all")) + if (ImGui::Button("CHECK_ALL"_T.data())) { g.vehicle.proof_bullet = true; g.vehicle.proof_fire = true; @@ -118,7 +118,7 @@ namespace big ImGui::SameLine(); - if (ImGui::Button("Uncheck all")) + if (ImGui::Button("UNCHECK_ALL"_T.data())) { g.vehicle.proof_bullet = false; g.vehicle.proof_fire = false; @@ -131,35 +131,35 @@ namespace big ImGui::BeginGroup(); - ImGui::Checkbox("Bullet", &g.vehicle.proof_bullet); - ImGui::Checkbox("Fire", &g.vehicle.proof_fire); + ImGui::Checkbox("BULLET"_T.data(), &g.vehicle.proof_bullet); + ImGui::Checkbox("FIRE"_T.data(), &g.vehicle.proof_fire); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Collision", &g.vehicle.proof_collision); - ImGui::Checkbox("Melee", &g.vehicle.proof_melee); + ImGui::Checkbox("COLLISION"_T.data(), &g.vehicle.proof_collision); + ImGui::Checkbox("MELEE"_T.data(), &g.vehicle.proof_melee); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Explosion", &g.vehicle.proof_explosion); - ImGui::Checkbox("Steam", &g.vehicle.proof_steam); + ImGui::Checkbox("EXPLOSION"_T.data(), &g.vehicle.proof_explosion); + ImGui::Checkbox("STEAM"_T.data(), &g.vehicle.proof_steam); ImGui::EndGroup(); ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::Checkbox("Water", &g.vehicle.proof_water); + ImGui::Checkbox("WATER"_T.data(), &g.vehicle.proof_water); ImGui::EndGroup(); } ImGui::Separator(); - components::sub_title("Speed Unit"); + components::sub_title("SPEED_UNIT"_T); { ImGui::RadioButton( speed_unit_strings[(int)SpeedUnit::KMPH].c_str(), @@ -181,13 +181,13 @@ namespace big } ImGui::Separator(); - components::sub_title("Speedo Meter"); + components::sub_title("SPEEDO_METER"_T); { - ImGui::Checkbox("Enabled", &g.vehicle.speedo_meter.enabled); + ImGui::Checkbox("ENABLED"_T.data(), &g.vehicle.speedo_meter.enabled); if (g.vehicle.speedo_meter.enabled) { - ImGui::Text("Position (X, Y)"); + ImGui::Text("POS_X_Y"_T.data()); float pos[2] = { g.vehicle.speedo_meter.x, g.vehicle.speedo_meter.y }; @@ -199,7 +199,7 @@ namespace big ImGui::SameLine(); - ImGui::Checkbox("Left Sided", &g.vehicle.speedo_meter.left_side); + ImGui::Checkbox("LEFT_SIDED"_T.data(), &g.vehicle.speedo_meter.left_side); } } diff --git a/src/views/view.hpp b/src/views/view.hpp index ac6835ae..22e62d53 100644 --- a/src/views/view.hpp +++ b/src/views/view.hpp @@ -23,6 +23,7 @@ namespace big static void handling_saved_profiles(); static void reaction_settings(); static void protection_settings(); + static void translation_settings(); static void heading(); static void mobile(); static void navigation(); diff --git a/src/views/view_gta_data.cpp b/src/views/view_gta_data.cpp index 36ab4810..b0dcc136 100644 --- a/src/views/view_gta_data.cpp +++ b/src/views/view_gta_data.cpp @@ -13,36 +13,36 @@ namespace big if (g_gta_data_service->cache_needs_update()) { g_gui->toggle(true); - ImGui::OpenPopup("Game Cache"); + ImGui::OpenPopup("GAME_CACHE"_T.data()); } ImGui::SetNextWindowSize({ 800, 210 }, ImGuiCond_FirstUseEver); ImGui::SetNextWindowPos({ 200, 200 }, ImGuiCond_FirstUseEver); - if (ImGui::BeginPopupModal("Game Cache")) + if (ImGui::BeginPopupModal("GAME_CACHE"_T.data())) { switch (g_gta_data_service->state()) { case eGtaDataUpdateState::NEEDS_UPDATE: { - ImGui::Text("YimMenu requires a rebuild of the game cache. This may take up to one minute to generate."); + ImGui::Text("GAME_CACHE_UPDATE"_T.data()); if (*g_pointers->m_is_session_started) { - if (ImGui::Button("Update Cache")) + if (ImGui::Button("GAME_CACHE_UPDATE_CACHE"_T.data())) { g_gta_data_service->update_now(); } } else { - ImGui::TextWrapped("You are currently in single player, you can force build the cache in single player but risk crashing when going into multiplayer or load online and cache."); + ImGui::TextWrapped("GAME_CACHE_SINGLE_PLAYER_DESCRIPTION"_T.data()); - if (ImGui::Button("I don't care, update in single player!")) + if (ImGui::Button("GAME_CACHE_DONT_CARE"_T.data())) { g_gta_data_service->update_now(); } - if (ImGui::Button("Update cache in online.")) + if (ImGui::Button("GAME_CACHE_GO_ONLINE"_T.data())) { g_gta_data_service->update_in_online(); } @@ -52,13 +52,13 @@ namespace big } case eGtaDataUpdateState::WAITING_FOR_ONLINE: { - ImGui::Text("Waiting for online to start cache update..."); + ImGui::Text("GAME_CACHE_WAITING_FOR_ONLINE"_T.data()); break; } case eGtaDataUpdateState::UPDATING: { - ImGui::Text("Updating cache, please wait..."); + ImGui::Text("GAME_CACHE_UPDATING"_T.data()); break; } diff --git a/src/views/world/view_creator.cpp b/src/views/world/view_creator.cpp index 1fd43a7e..44779f30 100644 --- a/src/views/world/view_creator.cpp +++ b/src/views/world/view_creator.cpp @@ -21,7 +21,7 @@ namespace big } ImGui::PushItemWidth(250); - components::sub_title("Saved Jobs"); + components::sub_title("CREATOR_SAVED_JOBS"_T); if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200))) { @@ -40,14 +40,14 @@ namespace big if (!selected_creator_file.empty()) { - components::button("Save To File", [] + components::button("CREATOR_SAVE_TO_FILE"_T, [] { creator_storage_service::save_file(selected_creator_file); }); ImGui::SameLine(); - components::button("Load From File", [] + components::button("CREATOR_LOAD_FROM_FILE"_T, [] { creator_storage_service::load_file(selected_creator_file); }); @@ -57,11 +57,11 @@ namespace big ImGui::PushItemWidth(250); components::input_text_with_hint( - "Job Name", - "Ex: My Cool Job", + "CREATOR_JOB_FILENAME"_T, + "CREATOR_JOB_FILENAME_HINT"_T, job_file_name_input, IM_ARRAYSIZE(job_file_name_input)); - components::button("Create Job File", [] + components::button("CREATOR_JOB_CREATE_FILE"_T, [] { cached_creator_files = false; creator_storage_service::create_file(std::string(job_file_name_input) + ".json"); @@ -69,7 +69,7 @@ namespace big ImGui::SameLine(); - components::button("Refresh", [] + components::button("REFRESH"_T, [] { cached_creator_files = false; }); @@ -77,9 +77,9 @@ namespace big ImGui::Separator(); static char job_link[69]{}; - components::input_text("SocialClub Job Link", job_link, sizeof(job_link)); + components::input_text("CREATOR_JOB_LINK"_T, job_link, sizeof(job_link)); - components::button("Import", [] + components::button("CREATOR_JOB_IMPORT"_T, [] { g_thread_pool->push([] { @@ -100,14 +100,14 @@ namespace big if (g_api_service->download_job_metadata(content_id, f1 < 0 ? 0 : f1, f0 < 0 ? 0 : f0, NETWORK::UGC_GET_CONTENT_LANGUAGE(0))) { cached_creator_files = false; - g_notification_service->push("Job Import", "Job Import successfully done"); + g_notification_service->push("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_IMPORT_SUCCESS"_T.data()); } else { - g_notification_service->push_error("Job Import", "Could download job metadata"); + g_notification_service->push_error("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_FAILED_METADATA_FETCH"_T.data()); } } else { - g_notification_service->push_error("Job Import", "UGC QueryContent failed"); + g_notification_service->push_error("CREATOR_JOB_IMPORT_NOTIFICATION"_T.data(), "CREATOR_JOB_UGC_QUERY_FAILED"_T.data()); } }); }); @@ -115,19 +115,19 @@ namespace big ImGui::EndGroup(); - components::sub_title("Launch Creator"); + components::sub_title("CREATOR_LAUNCH"_T); ImGui::BeginGroup(); - components::button("Race", [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine(); - components::button("Capture", [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine(); - components::button("Deathmatch", [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine(); - components::button("LTS", [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); }); + components::button("RACE"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_race_creator")); }); ImGui::SameLine(); + components::button("CAPTURE"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_capture_creator")); }); ImGui::SameLine(); + components::button("DEATHMATCH"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_deathmatch_creator")); }); ImGui::SameLine(); + components::button("LTS"_T, [] { scripts::start_creator_script(RAGE_JOAAT("fm_lts_creator")); }); ImGui::EndGroup(); - components::sub_title("Creator Options"); + components::sub_title("CREATOR_OPTIONS"_T); ImGui::BeginGroup(); - ImGui::Checkbox("Infinite Model Memory", &g.ugc.infinite_model_memory); + ImGui::Checkbox("CREATOR_INFINITE_MEMORY"_T.data(), &g.ugc.infinite_model_memory); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("Infinite Model Memory is only useful if dev mode is not activated"); + ImGui::SetTooltip("CREATOR_INFINITE_MEMORY_DESCRIPTION"_T.data()); ImGui::EndGroup(); } diff --git a/src/views/world/view_spawn_ped.cpp b/src/views/world/view_spawn_ped.cpp index 4c798105..f65b4e69 100644 --- a/src/views/world/view_spawn_ped.cpp +++ b/src/views/world/view_spawn_ped.cpp @@ -77,7 +77,7 @@ namespace big auto plyr = g_player_service->get_by_id(selected_ped_player_id); if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation) { - g_notification_service->push_error("Ped", "Invalid Online Player."); + g_notification_service->push_error("PED"_T.data(), "INVALID_ONLINE_PED"_T.data()); return 0; } @@ -102,7 +102,7 @@ namespace big auto plyr = g_player_service->get_by_id(selected_ped_for_player_id); if (plyr == nullptr || !plyr->is_valid() || !plyr->get_ped() || !plyr->get_ped()->m_navigation) { - g_notification_service->push_error("Ped", "Invalid Online Player."); + g_notification_service->push_error("PED"_T.data(), "INVALID_ONLINE_PED"_T.data()); return 0; } @@ -121,7 +121,7 @@ namespace big if (ped == 0) { - g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? "); + g_notification_service->push_error("PED"_T.data(), "SPAWN_MODEL_FAILED"_T.data()); return 0; } @@ -234,26 +234,26 @@ namespace big } } - components::sub_title("Ped Model"); + components::sub_title("PED_MODEL"_T); { ImGui::BeginGroup(); { - ImGui::Text("Ped Type"); + ImGui::Text("PED_TYPE"_T.data()); ImGui::SetNextItemWidth(160.f); if (ImGui::BeginCombo( "##ped_type", - selected_ped_type == -1 ? "ALL" : - selected_ped_type == -2 ? "ONLINE PLAYER" : + selected_ped_type == -1 ? "ALL"_T.data() : + selected_ped_type == -2 ? "ONLINE_PLAYER"_T.data() : ped_type_arr[selected_ped_type].c_str() )) { - if (ImGui::Selectable("ONLINE PLAYER", selected_ped_type == -2)) + if (ImGui::Selectable("ONLINE_PLAYER"_T.data(), selected_ped_type == -2)) { selected_ped_type = -2; } - if (ImGui::Selectable("ALL", selected_ped_type == -1)) + if (ImGui::Selectable("ALL"_T.data(), selected_ped_type == -1)) { selected_ped_type = -1; } @@ -283,16 +283,16 @@ namespace big { ImGui::BeginGroup(); { - ImGui::Text("Player"); + ImGui::Text("PLAYER"_T.data()); ImGui::SetNextItemWidth(240.f); if (ImGui::BeginCombo( "##ped_player", selected_ped_player_id == -1 ? - "Self" : + "SELF"_T.data() : g_player_service->get_by_id(selected_ped_player_id)->get_name() )) { - if (ImGui::Selectable("Self", selected_ped_player_id == -1)) + if (ImGui::Selectable("SELF"_T.data(), selected_ped_player_id == -1)) { selected_ped_player_id = -1; g_model_preview_service->stop_preview(); @@ -364,11 +364,11 @@ namespace big { ImGui::BeginGroup(); { - ImGui::Text("Model Name"); + ImGui::Text("MODEL_NAME"_T.data()); ImGui::SetNextItemWidth(240.f); components::input_text_with_hint( - "##ped_model_name", "Model Name", + "##ped_model_name", "MODEL_NAME"_T, ped_model_buf, sizeof(ped_model_buf), ImGuiInputTextFlags_EnterReturnsTrue, [] { ped_model_dropdown_open = false; @@ -453,22 +453,22 @@ namespace big ImGui::Separator(); - components::sub_title("Weapon"); + components::sub_title("WEAPON"_T); { ImGui::BeginGroup(); { - ImGui::Text("Weapon Type"); + ImGui::Text("WEAPON_TYPE"_T.data()); ImGui::SetNextItemWidth(160.f); if (ImGui::BeginCombo( "##ped_weapon_type", selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ? - "ALL" : + "ALL"_T.data() : selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ? - "NO WEAPONS" : + "NO_WEAPONS"_T.data() : weapon_type_arr[selected_ped_weapon_type].c_str() )) { - if (ImGui::Selectable("ALL", selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS)) + if (ImGui::Selectable("ALL"_T.data(), selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS)) { selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS; } @@ -478,7 +478,7 @@ namespace big ImGui::SetItemDefaultFocus(); } - if (ImGui::Selectable("NO WEAPONS", selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)) + if (ImGui::Selectable("NO_WEAPONS"_T.data(), selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)) { selected_ped_weapon_type = SPAWN_PED_NO_WEAPONS; } @@ -511,20 +511,20 @@ namespace big ImGui::BeginGroup(); { - ImGui::Text("Weapon"); + ImGui::Text("WEAPON"_T.data()); ImGui::SetNextItemWidth(240.f); if (ImGui::BeginCombo( "##ped_weapon", selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ? - "NO WEAPONS" : + "NO_WEAPONS"_T.data() : selected_ped_weapon_hash == 0 ? - "ALL" : + "ALL"_T.data() : g_gta_data_service->weapon_by_hash(selected_ped_weapon_hash).m_display_name )) { if (selected_ped_weapon_type != SPAWN_PED_NO_WEAPONS) { - if (ImGui::Selectable("ALL", selected_ped_weapon_hash == 0)) + if (ImGui::Selectable("ALL"_T.data(), selected_ped_weapon_hash == 0)) { selected_ped_weapon_hash = 0; } @@ -562,7 +562,7 @@ namespace big ImGui::Separator(); - components::sub_title("Spawn For"); + components::sub_title("SPAWN_FOR"_T); { if (ImGui::BeginCombo( "##ped_for", @@ -619,7 +619,7 @@ namespace big ImGui::Separator(); - if (ImGui::Checkbox("Preview", &g.world.spawn_ped.preview_ped)) + if (ImGui::Checkbox("PREVIEW"_T.data(), &g.world.spawn_ped.preview_ped)) { if (!g.world.spawn_ped.preview_ped) { @@ -631,7 +631,7 @@ namespace big ImGui::Checkbox("Invisible", &g.world.spawn_ped.spawn_invisible); ImGui::Checkbox("Attacker", &g.world.spawn_ped.spawn_as_attacker); - components::button("Change Player Model", [] + components::button("CHANGE_PLAYER_MODEL"_T, [] { if (selected_ped_type == -2) { @@ -649,7 +649,7 @@ namespace big { if (!ped::change_player_model(rage::joaat(ped_model_buf))) { - g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model?"); + g_notification_service->push_error("PED"_T.data(), "SPAWN_MODEL_FAILED"_T.data()); return; } @@ -659,7 +659,8 @@ namespace big ImGui::SameLine(); - components::button("Spawn Ped", [] + + components::button("SPAWN_PED"_T, [] { if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE) { @@ -676,7 +677,7 @@ namespace big ImGui::SameLine(); - components::button("Spawn Bodyguard", [] + components::button("SPAWN_BODYGUARD"_T, [] { if (selected_ped_for_player_id == SPAWN_PED_FOR_EVERYONE) { diff --git a/src/views/world/view_time_and_weather.cpp b/src/views/world/view_time_and_weather.cpp index 259a0e2a..dc1e914d 100644 --- a/src/views/world/view_time_and_weather.cpp +++ b/src/views/world/view_time_and_weather.cpp @@ -6,28 +6,28 @@ namespace big { void view::time_and_weather() { - if (ImGui::TreeNode("Local Time")) + if (ImGui::TreeNode("LOCAL_TIME"_T.data())) { - ImGui::Checkbox("Override Time", &g.session.override_time); + ImGui::Checkbox("OVERRIDE_TIME"_T.data(), &g.session.override_time); if (g.session.override_time) { - ImGui::SliderInt("Hour", &g.session.custom_time.hour, 0, 23); - ImGui::SliderInt("Minute", &g.session.custom_time.minute, 0, 59); - ImGui::SliderInt("Second", &g.session.custom_time.second, 0, 59); + ImGui::SliderInt("HOUR"_T.data(), &g.session.custom_time.hour, 0, 23); + ImGui::SliderInt("MINUTE"_T.data(), &g.session.custom_time.minute, 0, 59); + ImGui::SliderInt("SECOND"_T.data(), &g.session.custom_time.second, 0, 59); } ImGui::TreePop(); } - if (ImGui::TreeNode("Local Weather")) + if (ImGui::TreeNode("LOCAL_WEATHER"_T.data())) { - components::button("Clear Override", [] + components::button("CLEAR_OVERRIDE"_T, [] { MISC::CLEAR_OVERRIDE_WEATHER(); }); - if (ImGui::ListBox("", &g.session.local_weather, session::weathers, 15)) + if (ImGui::ListBox("##weather-listbox", &g.session.local_weather, session::weathers, 15)) { g_fiber_pool->queue_job([] { diff --git a/src/views/world/view_train.cpp b/src/views/world/view_train.cpp index d4121744..5a9d563e 100644 --- a/src/views/world/view_train.cpp +++ b/src/views/world/view_train.cpp @@ -8,39 +8,38 @@ namespace big { void view::train() { - components::button("Hijack Train", [] - { - train::hijack_train(); - }); + components::button("HIJACK_TRAIN"_T, [] + { + train::hijack_train(); + }); ImGui::SameLine(); - components::button("Delete Train", [] - { - train::delete_train(); - }); + components::button("DELETE_TRAIN"_T, [] + { + train::delete_train(); + }); if (ImGui::IsItemHovered()) - ImGui::SetTooltip("You cant delete the train while in it."); + ImGui::SetTooltip("DELETE_TRAIN_DESC"_T.data()); ImGui::SameLine(); - components::button("Exit Train", [] - { - train::exit_train(); - }); + components::button("EXIT_TRAIN"_T, [] + { + train::exit_train(); + }); static float train_speed = 0; - ImGui::SliderFloat("Train Speed", &train_speed, -500.f, 500.f); + ImGui::SliderFloat("TRAIN_SPEED"_T.data(), &train_speed, -500.f, 500.f); ImGui::SameLine(); - components::button("Set", [] { train::set_train_speed(train_speed); }); + components::button("SET"_T, [] { train::set_train_speed(train_speed); }); - ImGui::Checkbox("Drive Train", &g.world.train.drive_train); + ImGui::Checkbox("DRIVE_TRAIN"_T.data(), &g.world.train.drive_train); ImGui::SameLine(); - ImGui::Checkbox("Derail Train", &g.world.train.derail_train); - + ImGui::Checkbox("DERAIL_TRAIN"_T.data(), &g.world.train.derail_train); } } \ No newline at end of file