diff --git a/BigBaseV2/backend/looped/rgb/synced_fade.cpp b/BigBaseV2/backend/looped/rgb/synced_fade.cpp new file mode 100644 index 00000000..929305a6 --- /dev/null +++ b/BigBaseV2/backend/looped/rgb/synced_fade.cpp @@ -0,0 +1,83 @@ +#include "backend/looped/looped.hpp" +#include "script.hpp" + +namespace big +{ + enum rgb_controller_t + { + rgb_controller_green_up, + rgb_controller_red_down, + rgb_controller_blue_up, + rgb_controller_green_down, + rgb_controller_red_up, + rgb_controller_blue_down, + }; + + void looped::rgb_synced_fade() + { + if (g->rgb.fade) + { + static int rgb_controller_v = rgb_controller_green_up; + + switch (rgb_controller_v) + { + case rgb_controller_green_up: + g->rgb.g += g->rgb.speed; + if (g->rgb.g >= 255) + { + g->rgb.g = 255; + rgb_controller_v = rgb_controller_red_down; + } + break; + + case rgb_controller_red_down: + g->rgb.r -= g->rgb.speed; + if (g->rgb.r < 0) + { + g->rgb.r = 0; + rgb_controller_v = rgb_controller_blue_up; + } + break; + + case rgb_controller_blue_up: + g->rgb.b += g->rgb.speed; + if (g->rgb.b >= 255) + { + g->rgb.b = 255; + rgb_controller_v = rgb_controller_green_down; + } + break; + + case rgb_controller_green_down: + g->rgb.g -= g->rgb.speed; + if (g->rgb.g < 0) + { + g->rgb.g = 0; + rgb_controller_v = rgb_controller_red_up; + } + break; + + case rgb_controller_red_up: + g->rgb.r += g->rgb.speed; + if (g->rgb.r >= 255) + { + g->rgb.r = 255; + rgb_controller_v = rgb_controller_blue_down; + } + break; + + case rgb_controller_blue_down: + g->rgb.b -= g->rgb.speed; + if (g->rgb.b < 0) + { + g->rgb.b = 0; + rgb_controller_v = rgb_controller_green_up; + } + break; + + default: + throw std::runtime_error("Invalid case provided to RGB controller!"); + } + } + } +} \ No newline at end of file diff --git a/BigBaseV2/backend/looped/rgb/synced_spam.cpp b/BigBaseV2/backend/looped/rgb/synced_spam.cpp new file mode 100644 index 00000000..4acf5e35 --- /dev/null +++ b/BigBaseV2/backend/looped/rgb/synced_spam.cpp @@ -0,0 +1,18 @@ +#include "backend/looped/looped.hpp" +#include "script.hpp" + +namespace big +{ + void looped::rgb_synced_spasm() + { + auto delay = std::chrono::milliseconds(1000 - (g->rgb.speed * 100)); + + if (g->rgb.spasm) + { + g->rgb.r = rand() % 256; + g->rgb.g = rand() % 256; + g->rgb.b = rand() % 256; + } + script::get_current()->yield(delay); + } +} \ No newline at end of file diff --git a/BigBaseV2/drive_on_water.cpp b/BigBaseV2/drive_on_water.cpp new file mode 100644 index 00000000..9846ccee --- /dev/null +++ b/BigBaseV2/drive_on_water.cpp @@ -0,0 +1,65 @@ +#include "backend/looped/looped.hpp" +#include "natives.hpp" +#include "script.hpp" +#include "util/entity.hpp" + +namespace big +{ + void looped::vehicle_drive_on_water() + { + if (g->vehicle.drive_on_water) { + + Player player = PLAYER::PLAYER_ID(); + Ped playerPed = PLAYER::PLAYER_PED_ID(); + Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(playerPed, 0); + DWORD model = ENTITY::GET_ENTITY_MODEL(veh); + Vector3 pos = ENTITY::GET_ENTITY_COORDS(playerPed, 0); + Hash hash = MISC::GET_HASH_KEY("prop_container_ld2"); + float height = 0; + + WATER::SET_DEEP_OCEAN_SCALER(height); + if ((!(VEHICLE::IS_THIS_MODEL_A_PLANE(ENTITY::GET_ENTITY_MODEL(veh)))) && WATER::GET_WATER_HEIGHT_NO_WAVES(pos.x, pos.y, pos.z, &height)) { + Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(pos.x, pos.y, pos.z, 4.0, hash, 0, 0, 1); + if (ENTITY::DOES_ENTITY_EXIST(container) && height > -50.0f) { + Vector3 pRot = ENTITY::GET_ENTITY_ROTATION(playerPed, 0); + if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 1)) pRot = ENTITY::GET_ENTITY_ROTATION(veh, 0); + entity::take_control_of(container); + ENTITY::SET_ENTITY_COORDS(container, pos.x, pos.y, height - 2.5f, 0, 0, 0, 1); + ENTITY::SET_ENTITY_ROTATION(container, 0, 0, pRot.z, 0, 1); + Vector3 containerCoords = ENTITY::GET_ENTITY_COORDS(container, 1); + if (pos.z < containerCoords.z) { + if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) { + ENTITY::SET_ENTITY_COORDS(playerPed, pos.x, pos.y, containerCoords.z + 2.0f, 0, 0, 0, 1); + } + else { + entity::take_control_of(veh); + Vector3 vehc = ENTITY::GET_ENTITY_COORDS(veh, 1); + ENTITY::SET_ENTITY_COORDS(veh, vehc.x, vehc.y, containerCoords.z + 2.0f, 0, 0, 0, 1); + } + } + } + else { + Hash model = hash; + STREAMING::REQUEST_MODEL(model); + while (!STREAMING::HAS_MODEL_LOADED(model)) script::get_current()->yield(0ms); + container = OBJECT::CREATE_OBJECT(model, pos.x, pos.y, pos.z, 1, 1, 0); + entity::take_control_of(container); + ENTITY::FREEZE_ENTITY_POSITION(container, 1); + ENTITY::SET_ENTITY_ALPHA(container, 0, 1); + ENTITY::SET_ENTITY_VISIBLE(container, false, 0); + } + } + else { + Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(pos.x, pos.y, pos.z, 4.0, hash, 0, 0, 1); + if (ENTITY::DOES_ENTITY_EXIST(container)) { + entity::take_control_of(container); + ENTITY::SET_ENTITY_COORDS(container, 0, 0, -1000.0f, 0, 0, 0, 1); + script::get_current()->yield(10ms); + ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&container); + ENTITY::DELETE_ENTITY(&container); + WATER::RESET_DEEP_OCEAN_SCALER(); + } + } + } + } +} \ No newline at end of file diff --git a/BigBaseV2/rgb_paint.cpp b/BigBaseV2/rgb_paint.cpp new file mode 100644 index 00000000..6f278117 --- /dev/null +++ b/BigBaseV2/rgb_paint.cpp @@ -0,0 +1,27 @@ +#include "backend/looped/looped.hpp" +#include "natives.hpp" + +namespace big +{ + void looped::vehicle_rainbow_paint() + { + const Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::PLAYER_PED_ID(), false); + + if (veh && g->vehicle.rainbow_paint) + { + if (g->vehicle.rainbow_paint == 1) + { + g->rgb.fade = true; + g->rgb.spasm = false; + } + else if (g->vehicle.rainbow_paint == 2) + { + g->rgb.spasm = true; + g->rgb.fade = false; + } + + VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh, g->rgb.r, g->rgb.g, g->rgb.b); + VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(veh, g->rgb.r, g->rgb.g, g->rgb.b); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/backend/looped/self/super_run.cpp b/BigBaseV2/src/backend/looped/self/super_run.cpp index 217a0485..ddebd394 100644 --- a/BigBaseV2/src/backend/looped/self/super_run.cpp +++ b/BigBaseV2/src/backend/looped/self/super_run.cpp @@ -1,5 +1,4 @@ #include "backend/looped/looped.hpp" -#include "gta/enums.hpp" #include "natives.hpp" #include "util/math.hpp" @@ -11,12 +10,6 @@ namespace big void looped::self_super_run() { - - // g_local_player->m_player_info->m_run_speed is bwoke - - /* - - if (g->self.super_run && PAD::IS_CONTROL_PRESSED(0, 21)) { if (run_speed < run_cap) run_speed += .5f; @@ -56,8 +49,5 @@ namespace big } super_run_state = g->self.super_run; - - */ - } } \ No newline at end of file diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 0d8cf0e7..395f92cd 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -226,6 +226,8 @@ namespace big bool users = true; bool player = false; + ImU32 color = 3357612055; + ImFont* font_title = nullptr; ImFont* font_sub_title = nullptr; ImFont* font_small = nullptr; @@ -446,6 +448,7 @@ namespace big this->weapons.ammo_special.type = (eAmmoSpecialType)j["weapons"]["ammo_special"]["type"]; this->weapons.ammo_special.toggle = j["weapons"]["ammo_special"]["toggle"]; + this->window.color = j["window"]["color"]; this->window.debug = j["window"]["debug"]; this->window.handling = j["window"]["handling"]; this->window.log = j["window"]["log"]; @@ -660,6 +663,7 @@ namespace big }, { "window", { + { "color", this->window.color }, { "debug", this->window.debug }, { "handling", this->window.handling }, { "log", this->window.log }, diff --git a/BigBaseV2/src/gui.cpp b/BigBaseV2/src/gui.cpp index 211b60eb..ef7acc86 100644 --- a/BigBaseV2/src/gui.cpp +++ b/BigBaseV2/src/gui.cpp @@ -22,14 +22,14 @@ namespace big { void gui::dx_init() { - static ImVec4 bgColor = ImVec4(0.117f, 0.113f, 0.172f, .75f); + static ImVec4 bgColor = ImVec4(0.09f, 0.094f, 0.129f, .9f); static ImVec4 primary = ImVec4(0.172f, 0.380f, 0.909f, 1.f); static ImVec4 secondary = ImVec4(0.443f, 0.654f, 0.819f, 1.f); static ImVec4 whiteBroken = ImVec4(0.792f, 0.784f, 0.827f, 1.f); auto& style = ImGui::GetStyle(); style.WindowPadding = ImVec2(15, 15); - style.WindowRounding = 0.f; + style.WindowRounding = 10.f; style.WindowBorderSize = 0.f; style.FramePadding = ImVec2(5, 5); style.FrameRounding = 4.0f; @@ -42,10 +42,12 @@ namespace big style.GrabRounding = 3.0f; style.ChildRounding = 4.0f; + LOG(INFO) << (int32_t)g->window.color; + auto& colors = style.Colors; colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f); - colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f); + colors[ImGuiCol_WindowBg] = ImGui::ColorConvertU32ToFloat4(g->window.color); colors[ImGuiCol_ChildBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f); colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f); @@ -82,7 +84,9 @@ namespace big void gui::dx_on_tick() { + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::ColorConvertU32ToFloat4(g->window.color)); view::root(); + ImGui::PopStyleColor(); } void gui::always_draw() diff --git a/BigBaseV2/src/gui/components/components.hpp b/BigBaseV2/src/gui/components/components.hpp index ecec8665..1b8197b2 100644 --- a/BigBaseV2/src/gui/components/components.hpp +++ b/BigBaseV2/src/gui/components/components.hpp @@ -3,6 +3,9 @@ namespace big { + struct navigation_struct; + enum class tabs; + class components { static void custom_text(const std::string_view, ImFont*); @@ -13,6 +16,7 @@ namespace big static void sub_title(const std::string_view); static void title(const std::string_view); static void button(const std::string_view, std::function); + static void nav_item(std::pair&, int); static void input_text_with_hint(const std::string_view label, const std::string_view hint, char* buf, size_t buf_size, ImGuiInputTextFlags_ flag = ImGuiInputTextFlags_None, std::function cb = nullptr); @@ -21,4 +25,4 @@ namespace big static void selectable(const std::string_view, bool, std::function); static void selectable(const std::string_view, bool, ImGuiSelectableFlags, std::function); }; -} \ No newline at end of file +} diff --git a/BigBaseV2/src/gui/components/nav_button.cpp b/BigBaseV2/src/gui/components/nav_button.cpp index 6c63f465..4b5aa0f0 100644 --- a/BigBaseV2/src/gui/components/nav_button.cpp +++ b/BigBaseV2/src/gui/components/nav_button.cpp @@ -7,11 +7,14 @@ namespace big { ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.f, 0.f, 0.f, 0.f)); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.f, 0.f, 0.f)); ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, { 0.f, 0.5f }); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, { 0, 5 }); + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, { 0, 2 }); + ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, { 0, 0 }); bool result = ImGui::Button(text.data(), {((float)*g_pointers->m_resolution_x * 0.15f) - 30, 0}); - ImGui::PopStyleVar(2); - ImGui::PopStyleColor(2); + ImGui::PopStyleVar(4); + ImGui::PopStyleColor(3); return result; } diff --git a/BigBaseV2/src/gui/components/nav_item.cpp b/BigBaseV2/src/gui/components/nav_item.cpp new file mode 100644 index 00000000..d8239ea1 --- /dev/null +++ b/BigBaseV2/src/gui/components/nav_item.cpp @@ -0,0 +1,31 @@ +#include "components.hpp" +#include "services/gui_service.hpp" + +namespace big +{ + void components::nav_item(std::pair& navItem, int nested) + { + const bool curTab = !g_gui_service->get_selected_tab().empty() && g_gui_service->get_selected_tab().size() > nested && navItem.first == g_gui_service->get_selected_tab().at(nested); + if (curTab) + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.29f, 0.45f, 0.69f, 1.f)); + + if (components::nav_button(navItem.second.name)) + g_gui_service->set_selected(navItem.first); + + if (curTab) + ImGui::PopStyleColor(); + + if (curTab && !navItem.second.sub_nav.empty()) + { + ImDrawList* dl = ImGui::GetForegroundDrawList(); + + for (std::pair item : navItem.second.sub_nav) + { + dl->AddRectFilled({ 10.f, ImGui::GetCursorPosY() + 100.f }, { 10.f + 250.f, ImGui::GetCursorPosY() + 100.f + ImGui::CalcTextSize("A").y + ImGui::GetStyle().ItemInnerSpacing.y * 2 }, ImGui::ColorConvertFloat4ToU32({ 1.f, 1.f, 1.f, .15f + (.075f * nested)})); + nav_item(item, nested + 1); + } + } + + g_gui_service->increment_nav_size(); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/handling/handling_current_profile.cpp b/BigBaseV2/src/gui/handling/handling_current_profile.cpp index e65fa2d6..5dd443b0 100644 --- a/BigBaseV2/src/gui/handling/handling_current_profile.cpp +++ b/BigBaseV2/src/gui/handling/handling_current_profile.cpp @@ -1,48 +1,52 @@ -#include "handling_tabs.hpp" +#include "current_profile/current_profile_tabs.hpp" +#include "services/vehicle_service.hpp" +#include "views/view.hpp" namespace big { - void tab_handling::tab_current_profile() + void view::handling_current_profile() { - if (ImGui::BeginTabItem("Current Profile")) + if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash).empty()) - { - if (ImGui::Button("Save Profile")) - { - ImGui::OpenPopup("Save Handling"); - } - } - else - { - if (ImGui::Button("Update Profile")) - { - ImGui::OpenPopup("Update Handling"); - } - } - - modal_handling::modal_save_handling(); - modal_handling::modal_update_handling(); - ImGui::SameLine(); - if (ImGui::Button("Restore Handling")) - g_vehicle_service->restore_vehicle(); - - ImGui::Separator(); - - ImGui::BeginTabBar("handling_tabbar"); - tab_current_profile::tab_general(); - tab_current_profile::tab_other(); - tab_current_profile::tab_brakes(); - tab_current_profile::tab_gearing(); - tab_current_profile::tab_traction(); - tab_current_profile::tab_transmission(); - tab_current_profile::tab_steering(); - tab_current_profile::tab_suspension(); - tab_current_profile::tab_rollbars(); - tab_current_profile::tab_roll_centre_height(); - ImGui::EndTabBar(); - - ImGui::EndTabItem(); + ImGui::Text("Please enter a vehicle."); + return; } + + if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash).empty()) + { + if (ImGui::Button("Save Profile")) + { + ImGui::OpenPopup("Save Handling"); + } + } + else + { + if (ImGui::Button("Update Profile")) + { + ImGui::OpenPopup("Update Handling"); + } + } + + modal_handling::modal_save_handling(); + modal_handling::modal_update_handling(); + ImGui::SameLine(); + if (ImGui::Button("Restore Handling")) + g_vehicle_service->restore_vehicle(); + + ImGui::Separator(); + + ImGui::BeginTabBar("handling_tabbar"); + tab_current_profile::tab_general(); + tab_current_profile::tab_other(); + tab_current_profile::tab_brakes(); + tab_current_profile::tab_gearing(); + tab_current_profile::tab_traction(); + tab_current_profile::tab_transmission(); + tab_current_profile::tab_steering(); + tab_current_profile::tab_suspension(); + tab_current_profile::tab_rollbars(); + tab_current_profile::tab_roll_centre_height(); + ImGui::EndTabBar(); + } } \ No newline at end of file diff --git a/BigBaseV2/src/gui/handling/handling_my_profiles.cpp b/BigBaseV2/src/gui/handling/handling_my_profiles.cpp index 11409d87..f6150ce5 100644 --- a/BigBaseV2/src/gui/handling/handling_my_profiles.cpp +++ b/BigBaseV2/src/gui/handling/handling_my_profiles.cpp @@ -1,55 +1,58 @@ -#include "handling_tabs.hpp" +#include "services/vehicle_service.hpp" +#include "views/view.hpp" namespace big { - void tab_handling::tab_my_profiles() + void view::handling_my_profiles() { - if (ImGui::BeginTabItem("My Profiles")) + if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - if (!g_vehicle_service->update_mine()) - ImGui::Text("Loading profiles..."); - else + ImGui::Text("Please enter a vehicle."); + return; + } + + if (!g_vehicle_service->update_mine()) + ImGui::Text("Loading profiles..."); + else + { + if (g_vehicle_service->m_my_profiles.size() == 0) + ImGui::Text("You have no profiles available for this vehicle."); + for (auto& key : g_vehicle_service->m_my_profiles) { - if (g_vehicle_service->m_my_profiles.size() == 0) - ImGui::Text("You have no profiles available for this vehicle."); - for (auto& key : g_vehicle_service->m_my_profiles) + if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end()) { - if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end()) - { - auto& profile = it->second; + auto& profile = it->second; - if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) - ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); + if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) + ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); - ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); + ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); - ImGui::TableNextRow(); + ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Name:"); - ImGui::TableNextColumn(); - ImGui::Text(profile.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("Share Code: %s", profile.share_code.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("Name:"); + ImGui::TableNextColumn(); + ImGui::Text(profile.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("Share Code: %s", profile.share_code.c_str()); - ImGui::TableNextRow(); + ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Description:"); - ImGui::TableNextColumn(); - ImGui::TextWrapped(profile.description.c_str()); - ImGui::TableNextColumn(); - if (ImGui::Button("Load Profile")) - g_vehicle_service->set_handling_profile(profile); + ImGui::TableNextColumn(); + ImGui::Text("Description:"); + ImGui::TableNextColumn(); + ImGui::TextWrapped(profile.description.c_str()); + ImGui::TableNextColumn(); + if (ImGui::Button("Load Profile")) + g_vehicle_service->set_handling_profile(profile); - ImGui::EndTable(); + ImGui::EndTable(); - ImGui::Separator(); - } + ImGui::Separator(); } } - - ImGui::EndTabItem(); } + } -} \ No newline at end of file +} diff --git a/BigBaseV2/src/gui/handling/handling_saved_profiles.cpp b/BigBaseV2/src/gui/handling/handling_saved_profiles.cpp index 8ea7b75b..31a008fe 100644 --- a/BigBaseV2/src/gui/handling/handling_saved_profiles.cpp +++ b/BigBaseV2/src/gui/handling/handling_saved_profiles.cpp @@ -1,55 +1,57 @@ -#include "handling_tabs.hpp" +#include "services/vehicle_service.hpp" +#include "views/view.hpp" namespace big { - void tab_handling::tab_saved_profiles() + void view::handling_saved_profiles() { - if (ImGui::BeginTabItem("Saved Profiles")) + if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - if (!g_vehicle_service->load_saved_profiles()) - ImGui::Text("Loading profiles..."); - else + ImGui::Text("Please enter a vehicle."); + return; + } + + if (!g_vehicle_service->load_saved_profiles()) + ImGui::Text("Loading profiles..."); + else + { + if (g_vehicle_service->m_saved_profiles.size() == 0) + ImGui::Text("You have no saved profiles available for this vehicle."); + for (auto& key : g_vehicle_service->m_saved_profiles) { - if (g_vehicle_service->m_saved_profiles.size() == 0) - ImGui::Text("You have no saved profiles available for this vehicle."); - for (auto& key : g_vehicle_service->m_saved_profiles) + if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end()) { - if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end()) - { - auto& profile = it->second; + auto& profile = it->second; - if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) - ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); + if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) + ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); - ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); + ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); - ImGui::TableNextRow(); + ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Name:"); - ImGui::TableNextColumn(); - ImGui::Text(profile.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("Share Code: %s", profile.share_code.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("Name:"); + ImGui::TableNextColumn(); + ImGui::Text(profile.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("Share Code: %s", profile.share_code.c_str()); - ImGui::TableNextRow(); + ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::Text("Description:"); - ImGui::TableNextColumn(); - ImGui::TextWrapped(profile.description.c_str()); - ImGui::TableNextColumn(); - if (ImGui::Button("Load Profile")) - g_vehicle_service->set_handling_profile(profile); + ImGui::TableNextColumn(); + ImGui::Text("Description:"); + ImGui::TableNextColumn(); + ImGui::TextWrapped(profile.description.c_str()); + ImGui::TableNextColumn(); + if (ImGui::Button("Load Profile")) + g_vehicle_service->set_handling_profile(profile); - ImGui::EndTable(); + ImGui::EndTable(); - ImGui::Separator(); - } + ImGui::Separator(); } } - - ImGui::EndTabItem(); } } -} \ No newline at end of file +} diff --git a/BigBaseV2/src/gui/handling/handling_search.cpp b/BigBaseV2/src/gui/handling/handling_search.cpp index f88c2603..35c745f5 100644 --- a/BigBaseV2/src/gui/handling/handling_search.cpp +++ b/BigBaseV2/src/gui/handling/handling_search.cpp @@ -1,87 +1,87 @@ #include "api/api.hpp" #include "fiber_pool.hpp" -#include "handling_tabs.hpp" #include "natives.hpp" #include "script.hpp" #include "thread_pool.hpp" +#include "services/vehicle_service.hpp" +#include "views/view.hpp" namespace big { - void tab_handling::tab_search() + void view::handling_search() { - if (ImGui::BeginTabItem("Search")) + if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT) { - QUEUE_JOB_BEGIN_CLAUSE() + ImGui::Text("Please enter a vehicle."); + return; + } + + static char search[13]; + components::input_text_with_hint("##search_share_code", "Search by share code", search, sizeof(search), ImGuiInputTextFlags_EnterReturnsTrue, [] + { + g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); }); + }); + ImGui::SameLine(); + if (ImGui::Button("Search")) + g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); }); + + switch (g_vehicle_service->m_search_status) + { + case SearchStatus::SEARCHING: + ImGui::Text("Searching..."); + + break; + case SearchStatus::NO_RESULT: + ImGui::Text("No results found for %s", search); + + break; + case SearchStatus::FAILED: + ImGui::Text("Search failed, host is down or response body is invalid..."); + + break; + case SearchStatus::FOUND: + if (auto it = g_vehicle_service->m_handling_profiles.find(search); it != g_vehicle_service->m_handling_profiles.end()) { - PAD::DISABLE_ALL_CONTROL_ACTIONS(0); - }QUEUE_JOB_END_CLAUSE + auto& profile = it->second; - static char search[13]; - ImGui::InputTextWithHint("##search_share_code", "Search by share code", search, sizeof(search)); - ImGui::SameLine(); - if (ImGui::Button("Search")) - g_thread_pool->push([&] { g_vehicle_service->get_by_share_code(search); }); + if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) + ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); - switch (g_vehicle_service->m_search_status) - { - case SearchStatus::SEARCHING: - ImGui::Text("Searching..."); + ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); - break; - case SearchStatus::NO_RESULT: - ImGui::Text("No results found for %s", search); + ImGui::TableNextRow(); - break; - case SearchStatus::FAILED: - ImGui::Text("Search failed, host is down or response body is invalid..."); + ImGui::TableNextColumn(); + ImGui::Text("Name:"); + ImGui::TableNextColumn(); + ImGui::Text(profile.name.c_str()); + ImGui::TableNextColumn(); + ImGui::Text("Share Code: %s", profile.share_code.c_str()); - break; - case SearchStatus::FOUND: - if (auto it = g_vehicle_service->m_handling_profiles.find(search); it != g_vehicle_service->m_handling_profiles.end()) + ImGui::TableNextRow(); + + ImGui::TableNextColumn(); + ImGui::Text("Description:"); + ImGui::TableNextColumn(); + ImGui::TextWrapped(profile.description.c_str()); + ImGui::TableNextColumn(); + if (ImGui::Button("Load Profile")) + g_vehicle_service->set_handling_profile(profile); + ImGui::SameLine(); + if (ImGui::Button("Save Profile")) { - auto& profile = it->second; + g_thread_pool->push([&] + { + api::vehicle::handling::save_profile(profile.share_code); - if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash)) - ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active"); - - ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp); - - ImGui::TableNextRow(); - - ImGui::TableNextColumn(); - ImGui::Text("Name:"); - ImGui::TableNextColumn(); - ImGui::Text(profile.name.c_str()); - ImGui::TableNextColumn(); - ImGui::Text("Share Code: %s", profile.share_code.c_str()); - - ImGui::TableNextRow(); - - ImGui::TableNextColumn(); - ImGui::Text("Description:"); - ImGui::TableNextColumn(); - ImGui::TextWrapped(profile.description.c_str()); - ImGui::TableNextColumn(); - if (ImGui::Button("Load Profile")) - g_vehicle_service->set_handling_profile(profile); - ImGui::SameLine(); - if (ImGui::Button("Save Profile")) - { - g_thread_pool->push([&] - { - api::vehicle::handling::save_profile(profile.share_code); - - g_vehicle_service->load_saved_profiles(true); - }); - } - - ImGui::EndTable(); + g_vehicle_service->load_saved_profiles(true); + }); } - break; + ImGui::EndTable(); } - ImGui::EndTabItem(); + break; } } -} \ No newline at end of file +} diff --git a/BigBaseV2/src/gui/handling/modals/update_handling.cpp b/BigBaseV2/src/gui/handling/modals/update_handling.cpp index ca20da95..b4222119 100644 --- a/BigBaseV2/src/gui/handling/modals/update_handling.cpp +++ b/BigBaseV2/src/gui/handling/modals/update_handling.cpp @@ -56,7 +56,7 @@ namespace big PAD::DISABLE_ALL_CONTROL_ACTIONS(0); }QUEUE_JOB_END_CLAUSE - ImGui::BeginGroup(); + ImGui::BeginGroup(); ImGui::Text("Name:"); ImGui::Text("Description:"); diff --git a/BigBaseV2/src/main.cpp b/BigBaseV2/src/main.cpp index a0a54998..31e3fad9 100644 --- a/BigBaseV2/src/main.cpp +++ b/BigBaseV2/src/main.cpp @@ -12,6 +12,7 @@ #include "native_hooks/native_hooks.hpp" #include "services/globals_service.hpp" +#include "services/gui_service.hpp" #include "services/player_service.hpp" #include "services/mobile_service.hpp" #include "services/notification_service.hpp" @@ -70,6 +71,7 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) auto player_service_instance = std::make_unique(); auto vehicle_preview_service_instance = std::make_unique(); auto vehicle_service_instance = std::make_unique(); + auto gui_service_instance = std::make_unique(); LOG(INFO) << "Registered service instances..."; g_script_mgr.add_script(std::make_unique