mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-07-01 12:02:55 +08:00
refactor!: Replace premake5 with CMake. (#551)
Co-authored-by: tupoy-ya <tupoy-ya@users.noreply.github.com>
This commit is contained in:
24
src/views/core/view_active_view.cpp
Normal file
24
src/views/core/view_active_view.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "views/view.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/gui/gui_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::active_view() {
|
||||
if (g_gui_service->get_selected()->func == nullptr) return;
|
||||
|
||||
static float alpha = 1.f;
|
||||
|
||||
ImGui::SetNextWindowPos({ 300.f + 20.f, 100.f }, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({ 0.f, 0.f });
|
||||
ImGui::SetNextWindowSizeConstraints({ 300.f, 100.f }, { (float)*g_pointers->m_resolution_x - 270.f, (float)*g_pointers->m_resolution_y - 110.f });
|
||||
if (ImGui::Begin("main", nullptr, window_flags))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
|
||||
components::title(g_gui_service->get_selected()->name);
|
||||
ImGui::Separator();
|
||||
g_gui_service->get_selected()->func();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
}
|
||||
}
|
27
src/views/core/view_heading.cpp
Normal file
27
src/views/core/view_heading.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::heading()
|
||||
{
|
||||
ImGui::SetNextWindowSize({ 300.f, 80.f });
|
||||
ImGui::SetNextWindowPos({ 10.f, 10.f });
|
||||
if (ImGui::Begin("menu_heading", nullptr, window_flags | ImGuiWindowFlags_NoScrollbar))
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Text("Welcome");
|
||||
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::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::PushStyleColor(ImGuiCol_Text, ImVec4(0.69f, 0.29f, 0.29f, 1.00f));
|
||||
if (components::nav_button("Unload"))
|
||||
{
|
||||
g_running = false;
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
28
src/views/core/view_navigation.cpp
Normal file
28
src/views/core/view_navigation.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "services/gui/gui_service.hpp"
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::navigation() {
|
||||
ImGui::SetNextWindowPos({ 10.f, 100.f }, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({ 300.f, 0.f }, ImGuiCond_Always);
|
||||
|
||||
if (ImGui::Begin("navigation", 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav))
|
||||
{
|
||||
g_gui_service->reset_nav_size();
|
||||
for (std::pair<tabs, navigation_struct> navItem : g_gui_service->get_navigation())
|
||||
{
|
||||
switch (navItem.first)
|
||||
{
|
||||
case tabs::PLAYER:
|
||||
case tabs::DEBUG:
|
||||
continue;
|
||||
default:
|
||||
components::nav_item(navItem, 0);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
}
|
96
src/views/core/view_notifications.cpp
Normal file
96
src/views/core/view_notifications.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
#include "pointers.hpp"
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
float draw_notification(float start_pos, ImDrawList* dl, std::string title, std::string message, ImVec4 color)
|
||||
{
|
||||
ImColor textCol = ImGui::ColorConvertFloat4ToU32({ 1.f, 1.f, 1.f, 1.f });
|
||||
color.w = 0.5f;
|
||||
ImColor fadeBegin = ImGui::ColorConvertFloat4ToU32(color);
|
||||
color.w = 0.f;
|
||||
ImColor fadeEnd = ImGui::ColorConvertFloat4ToU32(color);
|
||||
|
||||
int j = 0;
|
||||
int prevSpace = 0;
|
||||
float total_size = 0.f;
|
||||
std::vector<std::string> split_points;
|
||||
for (int i = 0; i <= message.size(); i++)
|
||||
{
|
||||
std::string current_message = message.substr(j, i - j);
|
||||
|
||||
if (message.substr(i, 1) == " ")
|
||||
{
|
||||
prevSpace = i;
|
||||
}
|
||||
|
||||
ImVec2 size = ImGui::CalcTextSize(current_message.c_str());
|
||||
|
||||
if (i == message.size())
|
||||
{
|
||||
total_size = total_size + size.y;
|
||||
split_points.push_back(message.substr(j, i));
|
||||
}
|
||||
else if (size.x >= 330.f)
|
||||
{
|
||||
total_size = total_size + size.y;
|
||||
split_points.push_back(message.substr(j, prevSpace - j));
|
||||
j = prevSpace + 1;
|
||||
i = prevSpace;
|
||||
}
|
||||
}
|
||||
|
||||
dl->AddRectFilled({ (float)*g_pointers->m_resolution_x - 360.f, 10.f + start_pos }, { (float)*g_pointers->m_resolution_x - 10.f, start_pos + 45.f + total_size }, g->window.color);
|
||||
dl->AddRectFilledMultiColor({ (float)*g_pointers->m_resolution_x - 360.f, 10.f + start_pos }, { (float)*g_pointers->m_resolution_x - 255.f, start_pos + 45.f + total_size }, fadeBegin, fadeEnd, fadeEnd, fadeBegin);
|
||||
|
||||
dl->AddText(g->window.font_sub_title, 22.f, { (float)*g_pointers->m_resolution_x - 350.f, 15.f + start_pos }, textCol, title.c_str());
|
||||
int i = 0;
|
||||
for (std::string txt : split_points)
|
||||
{
|
||||
dl->AddText({ (float)*g_pointers->m_resolution_x - 350.f, 40.f + (i * 20.f) + start_pos}, textCol, txt.c_str());
|
||||
i++;
|
||||
}
|
||||
|
||||
return start_pos + 45.f + total_size;
|
||||
}
|
||||
|
||||
void view::notifications()
|
||||
{
|
||||
ImDrawList* draw_list = ImGui::GetBackgroundDrawList();
|
||||
|
||||
std::vector<notification> notifications = g_notification_service->get();
|
||||
|
||||
float prev_pos = 0.f;
|
||||
for (int i = 0; i < notifications.size(); i++)
|
||||
{
|
||||
notification& n = notifications[i];
|
||||
|
||||
prev_pos = draw_notification(prev_pos, draw_list, n.title, n.message, g_notification_service->notification_colors.at(n.type));
|
||||
}
|
||||
|
||||
/*ImGui::SetNextWindowSize({ (float)g->window.x * 0.2f, (float)g->window.y });
|
||||
ImGui::SetNextWindowPos({ (float)g->window.x - (float)g->window.x * 0.2f, 0 });
|
||||
if (ImGui::Begin("notifications", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus))
|
||||
{
|
||||
std::vector<notification> notifications = g_notification_service->get();
|
||||
|
||||
for (int i = 0; i < notifications.size(); i++)
|
||||
{
|
||||
notification& n = notifications[i];
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, n.alpha);
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
|
||||
ImGui::SetNextWindowBgAlpha(n.alpha);
|
||||
ImGui::BeginChildFrame(i, ImVec2(0, 75.f + (float)(20 * (int)(n.message.size() / 28) + 20 * (float)std::count(n.message.begin(), n.message.end(), '\n'))), ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoInputs);
|
||||
ImGui::Text(n.title.c_str());
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, g_notification_service->notification_colors.at(n.type));
|
||||
ImGui::TextWrapped(n.message.c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndChildFrame();
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
ImGui::End();
|
||||
} */
|
||||
}
|
||||
}
|
14
src/views/core/view_root.cpp
Normal file
14
src/views/core/view_root.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::root()
|
||||
{
|
||||
view::heading();
|
||||
view::navigation();
|
||||
view::players();
|
||||
view::active_view();
|
||||
|
||||
debug::main();
|
||||
}
|
||||
}
|
23
src/views/debug/view_debug.cpp
Normal file
23
src/views/debug/view_debug.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "services/gui/gui_service.hpp"
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::main()
|
||||
{
|
||||
if (strcmp(g_gui_service->get_selected()->name, "Debug"))
|
||||
return;
|
||||
|
||||
if (ImGui::Begin("Debug"))
|
||||
{
|
||||
ImGui::BeginTabBar("debug_tabbar");
|
||||
misc();
|
||||
logs();
|
||||
globals();
|
||||
locals();
|
||||
script_events();
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
12
src/views/debug/view_debug.hpp
Normal file
12
src/views/debug/view_debug.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace big::debug
|
||||
{
|
||||
extern void globals();
|
||||
extern void locals();
|
||||
extern void logs();
|
||||
extern void misc();
|
||||
extern void script_events();
|
||||
|
||||
extern void main();
|
||||
}
|
161
src/views/debug/view_debug_globals.cpp
Normal file
161
src/views/debug/view_debug_globals.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
#include "gui/components/components.hpp"
|
||||
#include "services/globals/globals_service.hpp"
|
||||
#include "thread_pool.hpp"
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::globals()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Globals"))
|
||||
{
|
||||
if (ImGui::Checkbox("Enable Freezing", &g_globals_service->m_running) && g_globals_service->m_running)
|
||||
g_thread_pool->push([&]() { g_globals_service->loop(); });
|
||||
|
||||
if (components::button("Load"))
|
||||
g_globals_service->load();
|
||||
ImGui::SameLine();
|
||||
if (components::button("Save"))
|
||||
g_globals_service->save();
|
||||
|
||||
|
||||
ImGui::SameLine();
|
||||
if (components::button("Add Global"))
|
||||
{
|
||||
ImGui::OpenPopup("New Global");
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopupModal("New Global"))
|
||||
{
|
||||
static int base_address = 0;
|
||||
static bool freeze = false;
|
||||
static char name[32] = "";
|
||||
static int(*offsets)[2] = nullptr;
|
||||
static int offset_count = 0;
|
||||
static int previous_offset_count = 0;
|
||||
|
||||
ImGui::Text("Name:");
|
||||
components::input_text_with_hint("##global_name", "Name", name, sizeof(name));
|
||||
ImGui::Text("Base Address:");
|
||||
ImGui::InputInt("##modal_global_base_addr", &base_address);
|
||||
ImGui::Text("Freeze:");
|
||||
ImGui::Checkbox("##modal_global_freeze", &freeze);
|
||||
ImGui::Text("Number of Offsets:");
|
||||
ImGui::InputInt("##modal_offset_count", &offset_count);
|
||||
|
||||
if (offset_count < 0) offset_count = 0;
|
||||
else if (offset_count > 10) offset_count = 10;
|
||||
|
||||
if (offset_count != previous_offset_count)
|
||||
{
|
||||
int(*new_offsets)[2] = new int[offset_count][2]{ 0 };
|
||||
memcpy(new_offsets, offsets, sizeof(int) * std::min(offset_count, previous_offset_count) * 2);
|
||||
|
||||
delete[] offsets;
|
||||
offsets = new_offsets;
|
||||
|
||||
previous_offset_count = offset_count;
|
||||
}
|
||||
|
||||
ImGui::PushItemWidth(320.f);
|
||||
for (int i = 0; i < offset_count; i++)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Text("Offset: %d", i + 1);
|
||||
ImGui::InputInt("##offset", &offsets[i][0]);
|
||||
|
||||
ImGui::Text("Size:");
|
||||
ImGui::SameLine();
|
||||
ImGui::InputInt("##size", &offsets[i][1]);
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
if (components::button("Cancel"))
|
||||
{
|
||||
strcpy(name, "");
|
||||
freeze = false;
|
||||
delete[] offsets;
|
||||
offsets = nullptr;
|
||||
offset_count = 0;
|
||||
previous_offset_count = 0;
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Save"))
|
||||
{
|
||||
auto new_global = global(name, base_address, freeze, offsets, offset_count);
|
||||
new_global.build_cache();
|
||||
|
||||
g_globals_service->m_globals.push_back(new_global);
|
||||
|
||||
strcpy(name, "");
|
||||
freeze = false;
|
||||
delete[] offsets;
|
||||
offsets = nullptr;
|
||||
offset_count = 0;
|
||||
previous_offset_count = 0;
|
||||
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
for (auto& global : g_globals_service->m_globals)
|
||||
{
|
||||
char label[64];
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::PushID(global.get_id());
|
||||
ImGui::Checkbox("Freeze", &global.m_freeze);
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Text("Name:");
|
||||
ImGui::Text("Value:");
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Text(global.m_name.c_str());
|
||||
|
||||
sprintf(label, "###input_%d", global.get_id());
|
||||
ImGui::SetNextItemWidth(200.f);
|
||||
ImGui::InputInt(label, global.get());
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
if (components::button("Delete"))
|
||||
{
|
||||
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())
|
||||
g_globals_service->m_globals.erase(g_globals_service->m_globals.begin() + i);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (components::button("Write"))
|
||||
global.write();
|
||||
|
||||
ImGui::PopID();
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
13
src/views/debug/view_debug_locals.cpp
Normal file
13
src/views/debug/view_debug_locals.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::locals()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Locals"))
|
||||
{
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
25
src/views/debug/view_debug_misc.cpp
Normal file
25
src/views/debug/view_debug_misc.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "gui/components/components.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/system.hpp"
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::misc()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Misc"))
|
||||
{
|
||||
if (components::button("Dump entrypoints"))
|
||||
{
|
||||
system::dump_entry_points();
|
||||
}
|
||||
|
||||
components::button("Network Bail", []
|
||||
{
|
||||
NETWORK::NETWORK_BAIL(16, 0, 0);
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
66
src/views/debug/view_debug_script_events.cpp
Normal file
66
src/views/debug/view_debug_script_events.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#include "gui/components/components.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::script_events()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Script Events"))
|
||||
{
|
||||
static int64_t* args;
|
||||
static int event_arg_count = 3;
|
||||
static int previous_arg_count;
|
||||
static int event_player_bits;
|
||||
static bool event_everyone = false;
|
||||
|
||||
ImGui::Text("Script Argument Count:");
|
||||
ImGui::InputInt("###script_event_arg_count", &event_arg_count);
|
||||
if (event_arg_count > 32)
|
||||
event_arg_count = 32;
|
||||
else if (event_arg_count < 3)
|
||||
event_arg_count = 3;
|
||||
|
||||
if (event_arg_count != previous_arg_count)
|
||||
{
|
||||
int64_t* temp_args = new int64_t[event_arg_count]{ 0 };
|
||||
memcpy(temp_args, args, sizeof(int64_t) * std::min(event_arg_count, previous_arg_count));
|
||||
|
||||
delete[] args;
|
||||
args = temp_args;
|
||||
|
||||
previous_arg_count = event_arg_count;
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
for (int i = 0; i < event_arg_count; i++)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
ImGui::Text("Arg[%d]", i);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::InputScalar("###input_dynamic_arg", ImGuiDataType_S64, &args[i]);
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Send to everyone", &event_everyone);
|
||||
if (!event_everyone)
|
||||
{
|
||||
ImGui::Text("Player ID:");
|
||||
ImGui::InputInt("###player_bits", &event_player_bits);
|
||||
}
|
||||
|
||||
components::button("Send Event", []
|
||||
{
|
||||
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);
|
||||
});
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
41
src/views/debug/views_debug_logs.cpp
Normal file
41
src/views/debug/views_debug_logs.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "gui/components/components.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "view_debug.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void debug::logs()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Logs"))
|
||||
{
|
||||
ImGui::Checkbox("Log Metrics", &g->debug.logs.metric_logs);
|
||||
|
||||
ImGui::Checkbox("Native Script Hooks", &g->debug.logs.script_hook_logs);
|
||||
|
||||
if (ImGui::TreeNode("Script Event Logging"))
|
||||
{
|
||||
ImGui::Checkbox("Enable Script Event Logging", &g->debug.logs.script_event.logs);
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::Checkbox("Filter by Player", &g->debug.logs.script_event.filter_player);
|
||||
|
||||
if (g->debug.logs.script_event.filter_player)
|
||||
{
|
||||
ImGui::ListBoxHeader("##filter_player");
|
||||
for (const auto& [_, player] : g_player_service->players())
|
||||
{
|
||||
if (components::selectable(player->get_name(), g->debug.logs.script_event.player_id == player->id()))
|
||||
{
|
||||
g->debug.logs.script_event.player_id = player->id();
|
||||
}
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
145
src/views/esp/view_esp.cpp
Normal file
145
src/views/esp/view_esp.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
#include "view_esp.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/math.hpp"
|
||||
#include "util/misc.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
||||
static ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
||||
static ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
||||
static ImColor health_green_bg = ImColor(0.29f, 0.69f, 0.34f, .75f);
|
||||
static ImColor health_green = ImColor(0.29f, 0.69f, 0.34f, 1.f);
|
||||
static ImColor health_yellow_bg = ImColor(0.69f, 0.49f, 0.29f, .75f);
|
||||
static ImColor health_yellow = ImColor(0.69f, 0.49f, 0.29f, 1.f);
|
||||
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
||||
static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
||||
|
||||
void esp::draw_player(const player_ptr& plyr, ImDrawList* const draw_list) {
|
||||
if (g->esp.hide_self && plyr->is_valid() && plyr->id() == gta_util::get_network_player_mgr()->m_local_net_player->m_player_id ||
|
||||
!plyr->is_valid() ||
|
||||
!plyr->get_ped() ||
|
||||
!plyr->get_ped()->m_navigation) return;
|
||||
|
||||
auto& player_pos = plyr->get_ped()->m_navigation->m_position;
|
||||
|
||||
float screen_x, screen_y;
|
||||
|
||||
const float distance = math::calculate_distance_from_game_cam(player_pos);
|
||||
const float multplr = distance > g->esp.global_render_distance[1] ? -1.f : 6.17757f / distance;
|
||||
|
||||
if (multplr == -1.f || g->esp.global_render_distance[0] > distance) return;
|
||||
|
||||
uint32_t ped_damage_bits = plyr->get_ped()->m_damage_bits;
|
||||
|
||||
if (g_pointers->m_get_screen_coords_for_world_coords(player_pos.data, &screen_x, &screen_y))
|
||||
{
|
||||
const auto esp_x = (float)*g_pointers->m_resolution_x * screen_x;
|
||||
const auto esp_y = (float)*g_pointers->m_resolution_y * screen_y;
|
||||
|
||||
std::string name_str;
|
||||
ImVec2 name_pos = { esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 20.f };
|
||||
ImU32 esp_color = g->esp.default_color;
|
||||
|
||||
if (plyr->is_friend())
|
||||
{
|
||||
esp_color = g->esp.friend_color;
|
||||
}
|
||||
else if (g->esp.change_esp_color_from_dist) {
|
||||
if (distance <= g->esp.distance_threshold[0])
|
||||
esp_color = g->esp.enemy_color;
|
||||
else if (distance >= g->esp.distance_threshold[0] && distance < g->esp.distance_threshold[1])
|
||||
esp_color = g->esp.enemy_near_color;
|
||||
}
|
||||
|
||||
const auto armor_perc = plyr->get_ped()->m_armor / 50.f;
|
||||
const auto health_perc = plyr->get_ped()->m_health / (plyr->get_ped()->m_maxhealth + 0.001f);
|
||||
|
||||
if (distance < g->esp.tracer_render_distance[1] && distance > g->esp.tracer_render_distance[0] && g->esp.tracer)
|
||||
draw_list->AddLine({ (float)*g_pointers->m_resolution_x * g->esp.tracer_draw_position[0], (float)*g_pointers->m_resolution_y * g->esp.tracer_draw_position[1] }, { esp_x, esp_y }, esp_color);
|
||||
|
||||
if (distance < g->esp.box_render_distance[1] && distance > g->esp.box_render_distance[0] && g->esp.box)
|
||||
draw_list->AddRect({ esp_x - (62.5f * multplr), esp_y - (175.f * multplr) }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y - (175.f * multplr) + (350.f * multplr) }, esp_color);
|
||||
|
||||
if (g->esp.name)
|
||||
name_str = plyr->get_name();
|
||||
|
||||
if (g->esp.distance)
|
||||
{
|
||||
if (g->esp.name)
|
||||
name_str += " | ";
|
||||
name_str += std::to_string((int)distance);
|
||||
name_str += "m";
|
||||
}
|
||||
|
||||
draw_list->AddText(name_pos, esp_color, name_str.c_str());
|
||||
|
||||
if (g->esp.god) {
|
||||
std::string mode_str = "";
|
||||
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
{
|
||||
mode_str = "GOD";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::BULLET)
|
||||
{
|
||||
mode_str += "BULLET ";
|
||||
}
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
|
||||
{
|
||||
mode_str += "EXPLOSION ";
|
||||
}
|
||||
}
|
||||
|
||||
if (!mode_str.empty())
|
||||
{
|
||||
draw_list->AddText({ esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 40.f }, ImColor(1.f, 0.f, 0.f, 1.f), mode_str.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if (!(ped_damage_bits & (uint32_t)eEntityProofs::GOD))
|
||||
{
|
||||
if (g->esp.health) {
|
||||
if (g->esp.scale_health_from_dist) {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y + (175.f * multplr) + 5.f }, health_perc == 0.f ? death_bg : health_perc < 0.25f ? health_red_bg : health_perc < 0.65f ? health_yellow_bg : health_green_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (125.f * multplr) * health_perc, esp_y + (175.f * multplr) + 5.f }, health_perc < 0.25f ? health_red : health_perc < 0.65f ? health_yellow : health_green, 4);
|
||||
}
|
||||
else {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (100.f), esp_y + (175.f * multplr) + 5.f }, health_perc == 0.f ? death_bg : health_perc < 0.25f ? health_red_bg : health_perc < 0.65f ? health_yellow_bg : health_green_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (100.f * health_perc), esp_y + (175.f * multplr) + 5.f }, health_perc < 0.25f ? health_red : health_perc < 0.65f ? health_yellow : health_green, 4);
|
||||
}
|
||||
}
|
||||
if (g->esp.armor && plyr->get_ped()->m_armor > 0) {
|
||||
float offset = 5.f;
|
||||
offset = g->esp.health ? 10.f : 5.f;
|
||||
if (g->esp.scale_armor_from_dist) {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + offset }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y + (175.f * multplr) + offset }, armor_blue_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + offset }, { esp_x - (62.5f * multplr) + (125.f * multplr) * armor_perc, esp_y + (175.f * multplr) + offset }, armor_blue, 4);
|
||||
}
|
||||
else {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + offset }, { esp_x - (62.5f * multplr) + (100.f), esp_y + (175.f * multplr) + offset }, armor_blue_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + offset }, { esp_x - (62.5f * multplr) + (100.f * armor_perc), esp_y + (175.f * multplr) + offset }, armor_blue, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void esp::draw() {
|
||||
if (!g->esp.enabled) return;
|
||||
|
||||
if (const auto draw_list = ImGui::GetBackgroundDrawList(); draw_list)
|
||||
{
|
||||
draw_player(g_player_service->get_self(), draw_list);
|
||||
|
||||
for (const auto& [_, plyr] : g_player_service->players())
|
||||
{
|
||||
draw_player(plyr, draw_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
12
src/views/esp/view_esp.hpp
Normal file
12
src/views/esp/view_esp.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class esp
|
||||
{
|
||||
public:
|
||||
static void draw();
|
||||
static void draw_player(const player_ptr& plyr, ImDrawList* const draw_list);
|
||||
};
|
||||
}
|
32
src/views/network/view_session.cpp
Normal file
32
src/views/network/view_session.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/session.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::session()
|
||||
{
|
||||
static uint64_t rid = 0;
|
||||
ImGui::InputScalar("Input RID", ImGuiDataType_U64, &rid);
|
||||
components::button("Join RID", []
|
||||
{
|
||||
session::join_by_rockstar_id(rid);
|
||||
});
|
||||
|
||||
components::sub_title("Session Switcher");
|
||||
if (ImGui::ListBoxHeader("###session_switch"))
|
||||
{
|
||||
for (const auto& session_type : sessions)
|
||||
{
|
||||
components::selectable(session_type.name, false, [&session_type]
|
||||
{
|
||||
session::join_type(session_type.id);
|
||||
});
|
||||
}
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
|
||||
components::sub_title("Chat");
|
||||
ImGui::Checkbox("Disable Filter", &g->session.disable_chat_filter);
|
||||
}
|
||||
}
|
86
src/views/network/view_spoofing.cpp
Normal file
86
src/views/network/view_spoofing.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/teleport.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::spoofing()
|
||||
{
|
||||
components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.");
|
||||
|
||||
components::sub_title("Username");
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
||||
});
|
||||
|
||||
ImGui::Checkbox("Spoof Username", &g->spoofing.spoof_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::InputText("##username_input", name, sizeof(name));
|
||||
|
||||
if (name != g->spoofing.username)
|
||||
g->spoofing.username = std::string(name);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("IP Address");
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
||||
});
|
||||
|
||||
ImGui::Checkbox("Spoof IP", &g->spoofing.spoof_ip);
|
||||
|
||||
ImGui::Text("IP Address:");
|
||||
ImGui::DragInt4("##ip_fields", g->spoofing.ip_address, 0, 255);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("Rockstar ID");
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
||||
});
|
||||
|
||||
ImGui::Checkbox("Spoof Rockstar ID", &g->spoofing.spoof_rockstar_id);
|
||||
|
||||
ImGui::Text("Rockstar ID:");
|
||||
ImGui::InputScalar("##rockstar_id_input", ImGuiDataType_U64, &g->spoofing.rockstar_id);
|
||||
|
||||
components::sub_title("Proofs");
|
||||
ImGui::Checkbox("Hide God Mode", &g->spoofing.spoof_hide_god);
|
||||
|
||||
components::sub_title("Crew");
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
PAD::DISABLE_ALL_CONTROL_ACTIONS(0);
|
||||
});
|
||||
|
||||
ImGui::Checkbox("Spoof Crew", &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::InputText("##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("Square Crew Tag", &g->spoofing.square_crew_tag);
|
||||
|
||||
components::sub_title("Extra - Only work when Spoofed RID");
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
192
src/views/players/view_player.cpp
Normal file
192
src/views/players/view_player.cpp
Normal file
@ -0,0 +1,192 @@
|
||||
#include "gta_util.hpp"
|
||||
#include "services/pickups/pickup_service.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "util/globals.hpp"
|
||||
#include "util/misc.hpp"
|
||||
#include "util/ped.hpp"
|
||||
#include "util/teleport.hpp"
|
||||
#include "views/view.hpp"
|
||||
|
||||
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);
|
||||
|
||||
if (g_player_service->get_selected()->is_valid())
|
||||
{
|
||||
if (ImGui::TreeNode("Misc"))
|
||||
{
|
||||
components::button("Steal Outfit", [] {
|
||||
ped::steal_outfit(
|
||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
|
||||
);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Steal Identity", [] {
|
||||
ped::steal_identity(
|
||||
PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id())
|
||||
);
|
||||
});
|
||||
|
||||
components::button("Clear Wanted Level", [] {
|
||||
globals::clear_wanted_player(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("Never Wanted", &g_player_service->get_selected()->never_wanted);
|
||||
|
||||
components::button("Give Health", [] {
|
||||
g_pickup_service->give_player_health(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Give Armour", [] {
|
||||
g_pickup_service->give_player_armour(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
components::button("Give Ammo", [] {
|
||||
g_pickup_service->give_player_ammo(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Give Weapons", [] {
|
||||
g_pickup_service->give_player_weapons(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Info")) {
|
||||
|
||||
ImGui::Text("Player ID: %d", g_player_service->get_selected()->id());
|
||||
|
||||
ImGui::Text("Session Host: %s", g_player_service->get_selected()->is_host() ? "Yes" : "No");
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
uint32_t ped_damage_bits = 0;
|
||||
uint32_t ped_task_flag = 0;
|
||||
uint32_t veh_damage_bits = 0;
|
||||
std::string mode_str = "";
|
||||
|
||||
if (CPed* ped = g_player_service->get_selected()->get_ped(); ped != nullptr)
|
||||
{
|
||||
ped_damage_bits = ped->m_damage_bits;
|
||||
ped_task_flag = ped->m_ped_task_flag;
|
||||
}
|
||||
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
{
|
||||
mode_str = "God";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::BULLET)
|
||||
{
|
||||
mode_str += "Bullet, ";
|
||||
}
|
||||
if (ped_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
|
||||
{
|
||||
mode_str += "Explosion, ";
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_str.empty())
|
||||
{
|
||||
mode_str = "No";
|
||||
}
|
||||
|
||||
ImGui::Text("Player God Mode: %s", mode_str.c_str());
|
||||
|
||||
mode_str = "";
|
||||
|
||||
if (auto vehicle = g_player_service->get_selected()->get_current_vehicle(); vehicle != nullptr)
|
||||
{
|
||||
veh_damage_bits = vehicle->m_damage_bits;
|
||||
}
|
||||
|
||||
if (ped_task_flag & (uint8_t)ePedTask::TASK_DRIVING)
|
||||
{
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
{
|
||||
mode_str = "God";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::COLLISION)
|
||||
{
|
||||
mode_str += "Collision, ";
|
||||
}
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
|
||||
{
|
||||
mode_str += "Explosion, ";
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_str.empty())
|
||||
{
|
||||
mode_str = "No";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mode_str = "No vehicle detected";
|
||||
}
|
||||
|
||||
ImGui::Text("Vehicle God Mode: %s", 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(
|
||||
"IP Address: %d.%d.%d.%d:%d",
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Teleport"))
|
||||
{
|
||||
components::button("Teleport", [] {
|
||||
teleport::to_player(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Bring", [] {
|
||||
teleport::bring_player(g_player_service->get_selected()->id());
|
||||
});
|
||||
|
||||
components::button("Teleport into Vehicle", [] {
|
||||
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_player_service->get_selected()->id()), false);
|
||||
|
||||
teleport::into_vehicle(veh);
|
||||
});
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
99
src/views/players/view_players.cpp
Normal file
99
src/views/players/view_players.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
#include "pointers.hpp"
|
||||
#include "services/gui/gui_service.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "fonts/fonts.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
|
||||
#define IMGUI_DEFINE_PLACEMENT_NEW
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace big
|
||||
{
|
||||
static void player_button(const player_ptr& plyr)
|
||||
{
|
||||
bool selected_player = plyr == g_player_service->get_selected();
|
||||
|
||||
// generate icons string
|
||||
std::string player_icons;
|
||||
if (plyr->is_host())
|
||||
player_icons += FONT_ICON_HOST;
|
||||
if (plyr->is_friend())
|
||||
player_icons += FONT_ICON_FRIEND;
|
||||
if (const auto ped = plyr->get_ped(); ped != nullptr && ped->m_ped_task_flag & (uint8_t)ePedTask::TASK_DRIVING)
|
||||
player_icons += FONT_ICON_VEHICLE;
|
||||
|
||||
const auto player_iconsc = player_icons.c_str();
|
||||
const auto player_icons_end = player_iconsc + player_icons.size();
|
||||
|
||||
// calculate icons width
|
||||
const auto window = ImGui::GetCurrentWindow();
|
||||
ImGui::PushFont(g->window.font_icon);
|
||||
const auto icons_size = ImGui::CalcTextSize(player_iconsc, player_icons_end);
|
||||
const ImVec2 icons_pos(window->DC.CursorPos.x + 300.0f - 32.0f - icons_size.x, window->DC.CursorPos.y + 2.0f);
|
||||
const ImRect icons_box(icons_pos, icons_pos + icons_size);
|
||||
ImGui::PopFont();
|
||||
|
||||
if (selected_player)
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.29f, 0.45f, 0.69f, 1.f));
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, { 0.0, 0.5 });
|
||||
ImGui::PushID(plyr->id());
|
||||
if (ImGui::Button(plyr->get_name(), { 300.0f - ImGui::GetStyle().ScrollbarSize, 0.f }))
|
||||
{
|
||||
g_player_service->set_selected(plyr);
|
||||
g_gui_service->set_selected(tabs::PLAYER);
|
||||
g->window.switched_view = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
if (selected_player)
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
// render icons on top of the player button
|
||||
ImGui::PushFont(g->window.font_icon);
|
||||
ImGui::RenderTextWrapped(icons_box.Min, player_iconsc, player_icons_end, icons_size.x);
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
void view::players()
|
||||
{
|
||||
const auto player_count = g_player_service->players().size() + 1;
|
||||
|
||||
if (!*g_pointers->m_is_session_started && player_count < 2) return;
|
||||
float window_pos = 110.f + g_gui_service->nav_ctr * ImGui::CalcTextSize("W").y + g_gui_service->nav_ctr * ImGui::GetStyle().ItemSpacing.y + g_gui_service->nav_ctr * ImGui::GetStyle().ItemInnerSpacing.y + ImGui::GetStyle().WindowPadding.y;
|
||||
|
||||
ImGui::SetNextWindowSize({ 300.f, 0.f });
|
||||
ImGui::SetNextWindowPos({ 10.f, window_pos });
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, { 2.0f, 2.0f });
|
||||
|
||||
if (ImGui::Begin("playerlist", nullptr, window_flags))
|
||||
{
|
||||
float window_height = (ImGui::CalcTextSize("A").y + ImGui::GetStyle().ItemInnerSpacing.y * 2 + 6.0f) * player_count + 10.0f;
|
||||
window_height = window_height + window_pos > (float)*g_pointers->m_resolution_y - 10.f ? (float)*g_pointers->m_resolution_y - (window_pos + 40.f) : window_height;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, { 0.f, 0.f, 0.f, 0.f });
|
||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarBg, { 0.f, 0.f, 0.f, 0.f });
|
||||
|
||||
if (ImGui::BeginListBox("##players", { ImGui::GetWindowSize().x - ImGui::GetStyle().WindowPadding.x * 2 , window_height }))
|
||||
{
|
||||
player_button(g_player_service->get_self());
|
||||
|
||||
if (player_count > 1)
|
||||
ImGui::Separator();
|
||||
|
||||
for (const auto& [_, player] : g_player_service->players())
|
||||
player_button(player);
|
||||
|
||||
ImGui::EndListBox();
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
24
src/views/self/view_mobile.cpp
Normal file
24
src/views/self/view_mobile.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "services/mobile/mobile_service.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::mobile() {
|
||||
ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always);
|
||||
|
||||
components::sub_title("Lester");
|
||||
|
||||
ImGui::Checkbox("Off Radar", &g->self.off_radar);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::button("Mors Mutual Fix All Vehicles", [] {
|
||||
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")
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
242
src/views/self/view_self.cpp
Normal file
242
src/views/self/view_self.cpp
Normal file
@ -0,0 +1,242 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/local_player.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "core/data/hud_component_names.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::self()
|
||||
{
|
||||
components::button("Suicide", [] {
|
||||
ENTITY::SET_ENTITY_HEALTH(self::ped, 0, 0);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Heal", [] {
|
||||
ENTITY::SET_ENTITY_HEALTH(self::ped, PED::GET_PED_MAX_HEALTH(self::ped), 0);
|
||||
PED::SET_PED_ARMOUR(self::ped, PLAYER::GET_PLAYER_MAX_ARMOUR(self::id));
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Fill Inventory", [] {
|
||||
std::string mpPrefix = local_player::get_mp_prefix();
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "NO_BOUGHT_YUM_SNACKS"), 30, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "NO_BOUGHT_HEALTH_SNACKS"), 15, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "NO_BOUGHT_EPIC_SNACKS"), 5, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "MP_CHAR_ARMOUR_1_COUNT"), 10, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "MP_CHAR_ARMOUR_2_COUNT"), 10, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "MP_CHAR_ARMOUR_3_COUNT"), 10, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "MP_CHAR_ARMOUR_4_COUNT"), 10, true);
|
||||
STATS::STAT_SET_INT(rage::joaat(mpPrefix + "MP_CHAR_ARMOUR_5_COUNT"), 10, true);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Skip Cutscene", [] {
|
||||
CUTSCENE::STOP_CUTSCENE_IMMEDIATELY();
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Clean Player", [] {
|
||||
entity::clean_ped(self::ped);
|
||||
});
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("General");
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("God Mode", &g->self.god_mode);
|
||||
ImGui::Checkbox("Off Radar", &g->self.off_radar);
|
||||
ImGui::Checkbox("Free Cam", &g->self.free_cam);
|
||||
ImGui::Checkbox("Disable Phone", &g->tunables.disable_phone);
|
||||
ImGui::Checkbox("Unlimited Oxygen", &g->self.unlimited_oxygen);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("No Clip", &g->self.noclip);
|
||||
ImGui::Checkbox("No Ragdoll", &g->self.no_ragdoll);
|
||||
ImGui::Checkbox("Super Run", &g->self.super_run);
|
||||
ImGui::Checkbox("No Idle Kick", &g->tunables.no_idle_kick);
|
||||
ImGui::Checkbox("No Water Collision", &g->self.no_water_collision);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Invisibility", &g->self.invisibility);
|
||||
if (g->self.invisibility) {
|
||||
ImGui::Checkbox("Locally Visible", &g->self.local_visibility);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Keep Player Clean", &g->self.clean_player);
|
||||
|
||||
ImGui::Checkbox("No Collision", &g->self.no_collision);
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("Proofs");
|
||||
|
||||
if (ImGui::Button("Check all"))
|
||||
{
|
||||
g->self.proof_bullet = true;
|
||||
g->self.proof_fire = true;
|
||||
g->self.proof_collision = true;
|
||||
g->self.proof_melee = true;
|
||||
g->self.proof_explosion = true;
|
||||
g->self.proof_steam = true;
|
||||
g->self.proof_drown = true;
|
||||
g->self.proof_water = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Uncheck all"))
|
||||
{
|
||||
g->self.proof_bullet = false;
|
||||
g->self.proof_fire = false;
|
||||
g->self.proof_collision = false;
|
||||
g->self.proof_melee = false;
|
||||
g->self.proof_explosion = false;
|
||||
g->self.proof_steam = false;
|
||||
g->self.proof_drown = false;
|
||||
g->self.proof_water = false;
|
||||
}
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Bullet", &g->self.proof_bullet);
|
||||
ImGui::Checkbox("Fire", &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::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Explosion", &g->self.proof_explosion);
|
||||
ImGui::Checkbox("Steam", &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::EndGroup();
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("Police");
|
||||
|
||||
ImGui::Checkbox("Never Wanted", &g->self.never_wanted);
|
||||
|
||||
if (!g->self.never_wanted)
|
||||
{
|
||||
ImGui::Checkbox("Force Wanted Level", &g->self.force_wanted_level);
|
||||
ImGui::Text("Wanted Level");
|
||||
if (
|
||||
ImGui::SliderInt("###wanted_level", &g->self.wanted_level, 0, 5) &&
|
||||
!g->self.force_wanted_level &&
|
||||
g_local_player != nullptr
|
||||
) {
|
||||
g_local_player->m_player_info->m_wanted_level = g->self.wanted_level;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("HUD");
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Hide Radar", &g->self.hide_radar);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("Hide Ammo", &g->self.hide_ammo);
|
||||
|
||||
ImGui::Combo("##hud_comp_combo", &g->self.selected_hud_component, hud_component_names, (int)HudComponents::HUD_WEAPONS);
|
||||
ImGui::SameLine();
|
||||
components::button("Hide", [] {
|
||||
g->self.hud_components_states[g->self.selected_hud_component] = true;
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Show", [] {
|
||||
g->self.hud_components_states[g->self.selected_hud_component] = false;
|
||||
});
|
||||
|
||||
components::button("Hide all", [] {
|
||||
g->self.hide_radar = true;
|
||||
g->self.hide_ammo = true;
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
{
|
||||
g->self.hud_components_states[i] = true;
|
||||
}
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Show all", [] {
|
||||
g->self.hide_radar = false;
|
||||
g->self.hide_ammo = false;
|
||||
for (int i = 0; i < (int)HudComponents::HUD_WEAPONS; i++)
|
||||
{
|
||||
g->self.hud_components_states[i] = false;
|
||||
}
|
||||
});
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
g->self.proof_mask = 0;
|
||||
if (g->self.god_mode)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::GOD);
|
||||
}
|
||||
if (g->self.proof_bullet)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
|
||||
}
|
||||
if (g->self.proof_fire)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
|
||||
}
|
||||
if (g->self.proof_collision)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
|
||||
}
|
||||
if (g->self.proof_melee)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
|
||||
}
|
||||
if (g->self.proof_explosion)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
|
||||
}
|
||||
if (g->self.proof_steam)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
|
||||
}
|
||||
if (g->self.proof_drown)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::DROWN);
|
||||
}
|
||||
if (g->self.proof_water)
|
||||
{
|
||||
g->self.proof_mask |= static_cast<int>(eEntityProofs::WATER);
|
||||
}
|
||||
}
|
||||
}
|
50
src/views/self/view_teleport.cpp
Normal file
50
src/views/self/view_teleport.cpp
Normal file
@ -0,0 +1,50 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/globals.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "util/teleport.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::teleport()
|
||||
{
|
||||
ImGui::Text("Blips:");
|
||||
|
||||
components::button("Waypoint", []
|
||||
{
|
||||
teleport::to_waypoint();
|
||||
});
|
||||
|
||||
components::button("Objective", []
|
||||
{
|
||||
teleport::to_objective();
|
||||
});
|
||||
|
||||
ImGui::Text("Vehicles:");
|
||||
|
||||
components::button("Teleport to Last Vehicle", []
|
||||
{
|
||||
if (g_local_player && g_local_player->m_vehicle)
|
||||
{
|
||||
const Vehicle veh = g_pointers->m_ptr_to_handle(g_local_player->m_vehicle);
|
||||
|
||||
teleport::into_vehicle(veh);
|
||||
}
|
||||
});
|
||||
|
||||
components::button("Bring Personal Vehicle", []
|
||||
{
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
|
||||
vehicle::bring(veh, self::pos);
|
||||
});
|
||||
|
||||
components::button("Teleport to Personal Vehicle", []
|
||||
{
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
|
||||
teleport::into_vehicle(veh);
|
||||
});
|
||||
}
|
||||
}
|
140
src/views/self/view_weapons.cpp
Normal file
140
src/views/self/view_weapons.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
#include "core/data/custom_weapons.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "core/data/special_ammo_types.hpp"
|
||||
#include "core/data/bullet_impact_types.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "gta/joaat.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::weapons() {
|
||||
components::sub_title("Ammo");
|
||||
ImGui::Checkbox("Infinite Ammo", &g->weapons.infinite_ammo);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("Infinite Clip", &g->weapons.infinite_mag);
|
||||
|
||||
ImGui::Checkbox("Enable Special Ammo", &g->weapons.ammo_special.toggle);
|
||||
|
||||
if (ImGui::Checkbox("Bypass C4 Limit", &g->weapons.bypass_c4_limit))
|
||||
{
|
||||
*g_pointers->m_bypass_max_count_of_active_sticky_bombs = g->weapons.bypass_c4_limit ? 99 : 4;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
for (const auto& special_ammo : SPECIAL_AMMOS)
|
||||
{
|
||||
if (ImGui::Selectable(special_ammo.name, special_ammo.type == selected_ammo))
|
||||
{
|
||||
g->weapons.ammo_special.type = special_ammo.type;
|
||||
}
|
||||
|
||||
if (special_ammo.type == selected_ammo)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (ImGui::BeginCombo("Bullet Impact", BULLET_IMPACTS[selected_explosion]))
|
||||
{
|
||||
for (const auto& [type, name] : BULLET_IMPACTS)
|
||||
{
|
||||
if (ImGui::Selectable(name, type == selected_explosion))
|
||||
{
|
||||
g->weapons.ammo_special.explosion_tag = type;
|
||||
}
|
||||
|
||||
if (type == selected_explosion)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("Misc");
|
||||
|
||||
ImGui::Checkbox("Force Crosshairs", &g->weapons.force_crosshairs);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("No Recoil", &g->weapons.no_recoil);
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("No Spread", &g->weapons.no_spread);
|
||||
|
||||
components::button("Get All Weapons", []
|
||||
{
|
||||
for (const auto& [_, weapon] : g_gta_data_service->weapons())
|
||||
{
|
||||
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, weapon.m_hash, 9999, false);
|
||||
}
|
||||
|
||||
constexpr auto parachute_hash = RAGE_JOAAT("GADGET_PARACHUTE");
|
||||
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Remove Current Weapon", []
|
||||
{
|
||||
Hash weaponHash;
|
||||
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weaponHash, 1);
|
||||
if (weaponHash != RAGE_JOAAT("WEAPON_UNARMED"))
|
||||
{
|
||||
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
|
||||
}
|
||||
});
|
||||
|
||||
ImGui::SliderFloat("Damage Multiplier", &g->weapons.increased_damage, 1.f, 10.f, "%.1f");
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("Custom Weapons");
|
||||
|
||||
CustomWeapon selected = g->weapons.custom_weapon;
|
||||
|
||||
if (ImGui::BeginCombo("Weapon", custom_weapons[(int)selected].name))
|
||||
{
|
||||
for (const custom_weapon& weapon : custom_weapons)
|
||||
{
|
||||
if (ImGui::Selectable(weapon.name, weapon.id == selected))
|
||||
{
|
||||
g->weapons.custom_weapon = weapon.id;
|
||||
}
|
||||
|
||||
if (weapon.id == selected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
switch (selected)
|
||||
{
|
||||
case CustomWeapon::VEHICLE_GUN:
|
||||
components::input_text_with_hint(
|
||||
"Shooting Model",
|
||||
"Name of the vehicle model",
|
||||
g->weapons.vehicle_gun_model, sizeof(g->weapons.vehicle_gun_model)
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
41
src/views/settings/view_context_menu_settings.cpp
Normal file
41
src/views/settings/view_context_menu_settings.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include "views/view.hpp"
|
||||
#include "services/context_menu/context_menu_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::context_menu_settings()
|
||||
{
|
||||
ImGui::Checkbox("Context Menu Enabled", &g->context_menu.enabled);
|
||||
|
||||
if (g->context_menu.enabled)
|
||||
{
|
||||
ImGui::Text("Allowed Entity Types:");
|
||||
ImGui::CheckboxFlags("Object", reinterpret_cast<int*>(&g->context_menu.allowed_entity_types), static_cast<int>(ContextEntityType::OBJECT));
|
||||
ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("Ped", reinterpret_cast<int*>(&g->context_menu.allowed_entity_types), static_cast<int>(ContextEntityType::PED));
|
||||
ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("Player", reinterpret_cast<int*>(&g->context_menu.allowed_entity_types), static_cast<int>(ContextEntityType::PLAYER));
|
||||
ImGui::SameLine();
|
||||
ImGui::CheckboxFlags("Vehicle", reinterpret_cast<int*>(&g->context_menu.allowed_entity_types), static_cast<int>(ContextEntityType::VEHICLE));
|
||||
|
||||
static ImVec4 selected_option_color = ImGui::ColorConvertU32ToFloat4(g->context_menu.selected_option_color);
|
||||
ImGui::Text("Selected Option Color:");
|
||||
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);
|
||||
|
||||
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:");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
81
src/views/settings/view_esp_settings.cpp
Normal file
81
src/views/settings/view_esp_settings.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::esp_settings()
|
||||
{
|
||||
ImGui::Checkbox("ESP Enabled", &g->esp.enabled);
|
||||
|
||||
if (g->esp.enabled)
|
||||
{
|
||||
ImGui::Checkbox("Hide Self", &g->esp.hide_self);
|
||||
|
||||
ImGui::Text("Global Render Distance (min, max)");
|
||||
ImGui::SliderFloat2("###Global Render Distance", g->esp.global_render_distance, 0.f, 1500.f);
|
||||
|
||||
ImGui::Checkbox("Tracer", &g->esp.tracer);
|
||||
if (g->esp.tracer) {
|
||||
ImGui::Text("Tracer Draw Position (x, y)");
|
||||
ImGui::SliderFloat2("###Draw Position", g->esp.tracer_draw_position, 0.f, 1.f);
|
||||
ImGui::Text("Tracer Render Distance (min, max)");
|
||||
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);
|
||||
if (g->esp.box) {
|
||||
ImGui::Text("Box Render Distance (min, max)");
|
||||
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("Should ESP Color Change with Distance", &g->esp.change_esp_color_from_dist);
|
||||
if (g->esp.health)
|
||||
ImGui::Checkbox("Should Healthbar Scale with Distance", &g->esp.scale_health_from_dist);
|
||||
|
||||
if (g->esp.armor)
|
||||
ImGui::Checkbox("Should Armorbar Scale with Distance", &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::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 (g->esp.change_esp_color_from_dist) {
|
||||
ImGui::Text("Enemy Close Color:");
|
||||
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:");
|
||||
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:");
|
||||
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:");
|
||||
if (ImGui::ColorEdit4("###Friend ESP Color##friend_picker", (float*)&col_friend, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.friend_color = ImGui::ColorConvertFloat4ToU32(col_friend);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
14
src/views/settings/view_gui_settings.cpp
Normal file
14
src/views/settings/view_gui_settings.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::gui_settings()
|
||||
{
|
||||
static ImVec4 col_gui = ImGui::ColorConvertU32ToFloat4(g->window.color);
|
||||
if (ImGui::ColorEdit4("Gui Color##gui_picker", (float*)&col_gui, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->window.color = ImGui::ColorConvertFloat4ToU32(col_gui);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
109
src/views/settings/view_notification_settings.cpp
Normal file
109
src/views/settings/view_notification_settings.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void draw_pair_option(const std::string_view name, decltype(g->notifications.gta_thread_kill)& option)
|
||||
{
|
||||
ImGui::Text("%s", name.data());
|
||||
|
||||
ImGui::PushID(name.data());
|
||||
ImGui::Checkbox("Log", &option.log);
|
||||
ImGui::Checkbox("Notify", &option.notify);
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void view::notification_settings()
|
||||
{
|
||||
components::sub_title("GTA Threads");
|
||||
|
||||
draw_pair_option("Terminate", g->notifications.gta_thread_kill);
|
||||
draw_pair_option("Start", g->notifications.gta_thread_start);
|
||||
|
||||
components::sub_title("Network Player Manager");
|
||||
|
||||
ImGui::Text("Player Join");
|
||||
|
||||
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);
|
||||
|
||||
draw_pair_option("Player Leave", g->notifications.player_leave);
|
||||
|
||||
draw_pair_option("Init", g->notifications.network_player_mgr_init);
|
||||
draw_pair_option("Shutdown", g->notifications.network_player_mgr_shutdown);
|
||||
|
||||
components::sub_title("Received Event");
|
||||
|
||||
auto& received_event = g->notifications.received_event;
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Clear Ped Tasks", received_event.clear_ped_task);
|
||||
draw_pair_option("Kick Votes Notification", received_event.kick_vote);
|
||||
draw_pair_option("Detect Modder Events", received_event.modder_detect);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Report Cash Spawn", received_event.report_cash_spawn);
|
||||
draw_pair_option("Request Control Event", received_event.request_control_event);
|
||||
draw_pair_option("Vehicle Temp Action", received_event.vehicle_temp_action);
|
||||
ImGui::EndGroup();
|
||||
|
||||
components::sub_title("Script Event Handler");
|
||||
|
||||
auto& script_event_handler = g->notifications.script_event_handler;
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Bounty", script_event_handler.bounty);
|
||||
draw_pair_option("CEO Ban", script_event_handler.ceo_ban);
|
||||
draw_pair_option("CEO Kick", script_event_handler.ceo_kick);
|
||||
draw_pair_option("CEO Money", script_event_handler.ceo_money);
|
||||
draw_pair_option("Destroy Personal Vehicle", script_event_handler.personal_vehicle_destroyed);
|
||||
draw_pair_option("Fake Deposit", script_event_handler.fake_deposit);
|
||||
draw_pair_option("Force Mission", script_event_handler.force_mission);
|
||||
draw_pair_option("Force Teleport", script_event_handler.force_teleport);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("GTA Banner", script_event_handler.gta_banner);
|
||||
draw_pair_option("MC Teleport", script_event_handler.mc_teleport);
|
||||
draw_pair_option("Network Bail", script_event_handler.network_bail);
|
||||
draw_pair_option("Remote Off Radar", script_event_handler.remote_off_radar);
|
||||
draw_pair_option("Rotate Cam", script_event_handler.rotate_cam);
|
||||
draw_pair_option("Send to Cutscene", script_event_handler.send_to_cutscene);
|
||||
draw_pair_option("Send to Location", script_event_handler.send_to_location);
|
||||
draw_pair_option("Sound Spam", script_event_handler.sound_spam);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Spectate", script_event_handler.spectate);
|
||||
draw_pair_option("Transaction Error", script_event_handler.transaction_error);
|
||||
draw_pair_option("TSE Crash", script_event_handler.crash);
|
||||
draw_pair_option("TSE Freeze", script_event_handler.tse_freeze);
|
||||
draw_pair_option("TSE Sender Mismatch", script_event_handler.tse_sender_mismatch);
|
||||
draw_pair_option("Vehicle Kick", script_event_handler.vehicle_kick);
|
||||
draw_pair_option("Wanted Level", script_event_handler.clear_wanted_level);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
draw_pair_option("Teleport To Warehouse", script_event_handler.teleport_to_warehouse);
|
||||
draw_pair_option("Start Activity", script_event_handler.start_activity);
|
||||
ImGui::EndGroup();
|
||||
|
||||
components::sub_title("Other");
|
||||
|
||||
draw_pair_option("Reports", g->notifications.reports);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
49
src/views/settings/view_protection_settings.cpp
Normal file
49
src/views/settings/view_protection_settings.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include "views/view.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::protection_settings()
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Checkbox("Bounty", &g->protections.script_events.bounty);
|
||||
ImGui::Checkbox("CEO Ban", &g->protections.script_events.ceo_ban);
|
||||
ImGui::Checkbox("CEO Kick", &g->protections.script_events.ceo_kick);
|
||||
ImGui::Checkbox("CEO Money", &g->protections.script_events.ceo_money);
|
||||
ImGui::Checkbox("TSE Crash", &g->protections.script_events.crash);
|
||||
ImGui::Checkbox("Fake Deposit", &g->protections.script_events.fake_deposit);
|
||||
ImGui::Checkbox("Force Mission", &g->protections.script_events.force_mission);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
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("Network Bail", &g->protections.script_events.network_bail);
|
||||
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::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("Spectate", &g->protections.script_events.spectate);
|
||||
ImGui::Checkbox("Transaction Error", &g->protections.script_events.transaction_error);
|
||||
ImGui::Checkbox("Vehicle Kick", &g->protections.script_events.vehicle_kick);
|
||||
ImGui::Checkbox("Wanted Level", &g->protections.script_events.clear_wanted_level);
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Checkbox("Teleport To Warehouse", &g->protections.script_events.teleport_to_warehouse);
|
||||
ImGui::Checkbox("Start Activity", &g->protections.script_events.start_activity);
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
|
||||
}
|
58
src/views/settings/view_settings.cpp
Normal file
58
src/views/settings/view_settings.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
#include "views/view.hpp"
|
||||
#include "widgets/imgui_hotkey.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();
|
||||
components::sub_title("Hotkeys");
|
||||
|
||||
ImGui::PushItemWidth(350.f);
|
||||
|
||||
if (ImGui::Hotkey("Menu Toggle", &g->settings.hotkeys.menu_toggle))
|
||||
g->settings.hotkeys.editing_menu_toggle = true; // make our menu reappear
|
||||
|
||||
ImGui::Text("(Below hotkey is not implemented)");
|
||||
ImGui::Hotkey("Teleport to waypoint", &g->settings.hotkeys.teleport_waypoint);
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
234
src/views/vehicle/view_fun_vehicle.cpp
Normal file
234
src/views/vehicle/view_fun_vehicle.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
#include "core/enums.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "core/data/speed_units.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "services/model_preview/model_preview_service.hpp"
|
||||
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::fun_vehicle()
|
||||
{
|
||||
components::sub_title("Seat Changer");
|
||||
{
|
||||
static std::map<int, bool> seats;
|
||||
static bool ready = true;
|
||||
|
||||
if (self::veh == 0)
|
||||
{
|
||||
seats.clear();
|
||||
}
|
||||
|
||||
if (self::veh != 0 && ready == true)
|
||||
{
|
||||
ready = false;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
|
||||
std::map<int, bool> tmp_seats;
|
||||
|
||||
int num_of_seats = VEHICLE::GET_VEHICLE_MAX_NUMBER_OF_PASSENGERS(self::veh);
|
||||
|
||||
for (int i = -1; i < num_of_seats; i++)
|
||||
{
|
||||
tmp_seats[i] = VEHICLE::IS_VEHICLE_SEAT_FREE(self::veh, i, true);
|
||||
}
|
||||
|
||||
seats = tmp_seats;
|
||||
ready = true;
|
||||
});
|
||||
}
|
||||
|
||||
if (seats.size() == 0)
|
||||
{
|
||||
ImGui::Text("Please enter a vehicle.");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& it : seats)
|
||||
{
|
||||
int idx = it.first;
|
||||
|
||||
if (!it.second)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
|
||||
std::string name = "Driver";
|
||||
|
||||
if (idx >= 0)
|
||||
{
|
||||
name = "Seat " + std::to_string(idx + 1);
|
||||
}
|
||||
|
||||
if ((idx + 1) % 4 != 0) {
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
components::button(name, [idx] {
|
||||
PED::SET_PED_INTO_VEHICLE(self::ped, self::veh, idx);
|
||||
});
|
||||
if (!it.second)
|
||||
{
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Auto Drive");
|
||||
{
|
||||
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(),
|
||||
&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),
|
||||
"%.1f"
|
||||
)) {
|
||||
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]))
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (ImGui::Selectable(driving_style_names[i], g->vehicle.auto_drive_style == (AutoDriveStyle)i))
|
||||
{
|
||||
g->vehicle.auto_drive_style = (AutoDriveStyle)i;
|
||||
g_notification_service->push_warning(
|
||||
"Auto Drive",
|
||||
std::format("Driving style set to {}.", driving_style_names[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (g->vehicle.auto_drive_style == (AutoDriveStyle)i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (components::button("To Objective")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::OBJECTITVE;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("To Waypoint")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::WAYPOINT;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Wander")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::WANDER;
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (components::button("Emergency Stop")) {
|
||||
g->vehicle.auto_drive_destination = AutoDriveDestination::EMERGENCY_STOP;
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Rainbow Paint");
|
||||
{
|
||||
ImGui::Checkbox("Primary", &g->vehicle.rainbow_paint.primary);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Secondary", &g->vehicle.rainbow_paint.secondary);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Neon", &g->vehicle.rainbow_paint.neon);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Smoke", &g->vehicle.rainbow_paint.smoke);
|
||||
|
||||
static constexpr char const* rgb_types[] = { "Off", "Fade", "Spasm" };
|
||||
|
||||
ImGui::SetNextItemWidth(120);
|
||||
if (ImGui::BeginCombo("RGB Type", rgb_types[(int)g->vehicle.rainbow_paint.type]))
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
bool itemSelected = (int)g->vehicle.rainbow_paint.type == i;
|
||||
|
||||
if (ImGui::Selectable(rgb_types[i], itemSelected))
|
||||
{
|
||||
g->vehicle.rainbow_paint.type = (RainbowPaintType)i;
|
||||
}
|
||||
|
||||
if (itemSelected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (g->vehicle.rainbow_paint.type != RainbowPaintType::Off)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(150);
|
||||
ImGui::SliderInt("RGB Speed", &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<int>(g->vehicle.boost_behavior)]))
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
bool itemSelected = g->vehicle.boost_behavior == static_cast<eBoostBehaviors>(i);
|
||||
|
||||
if (ImGui::Selectable(boost_behaviors[i], itemSelected))
|
||||
{
|
||||
g->vehicle.boost_behavior = static_cast<eBoostBehaviors>(i);
|
||||
}
|
||||
|
||||
if (itemSelected)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Vehicle Fly");
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled);
|
||||
ImGui::Checkbox("Don't Stop", &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::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(),
|
||||
&fly_speed_user_unit,
|
||||
vehicle::mps_to_speed(0.f, g->vehicle.speed_unit),
|
||||
vehicle::mps_to_speed(150.f, g->vehicle.speed_unit),
|
||||
"%.1f"
|
||||
)) {
|
||||
g->vehicle.fly.speed = vehicle::speed_to_mps(fly_speed_user_unit, g->vehicle.speed_unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
952
src/views/vehicle/view_lsc.cpp
Normal file
952
src/views/vehicle/view_lsc.cpp
Normal file
@ -0,0 +1,952 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "script.hpp"
|
||||
#include "services/vehicle_helper/vehicle_helper.hpp"
|
||||
#include "core/data/lsc_types.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
#include <imgui_internal.h>
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::lsc()
|
||||
{
|
||||
static Vehicle player_vehicle = 0;
|
||||
static bool ready = true;
|
||||
|
||||
static std::map<int, int32_t> owned_mods;
|
||||
static std::map<int, std::string> slot_display_names;
|
||||
static std::map<int, std::map<int, std::string>> mod_display_names;
|
||||
static std::map<std::string, std::vector<int>> front_wheel_map;
|
||||
static std::map<std::string, std::vector<int>> rear_wheel_map;
|
||||
|
||||
static int selected_slot = -1;
|
||||
static bool is_bennys = false;
|
||||
static int front_wheel_stock_mod = -1;
|
||||
static int rear_wheel_stock_mod = -1;
|
||||
|
||||
if (self::veh == 0 || player_vehicle != self::veh)
|
||||
{
|
||||
if (self::veh == 0 )
|
||||
{
|
||||
owned_mods.clear();
|
||||
slot_display_names.clear();
|
||||
mod_display_names.clear();
|
||||
front_wheel_map.clear();
|
||||
rear_wheel_map.clear();
|
||||
player_vehicle = 0;
|
||||
|
||||
selected_slot = -1;
|
||||
ImGui::Text("Please enter a vehicle.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player_vehicle != self::veh && ready == true)
|
||||
{
|
||||
ready = false;
|
||||
player_vehicle = self::veh;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
if (!HUD::HAS_THIS_ADDITIONAL_TEXT_LOADED("MOD_MNU", 10))
|
||||
{
|
||||
HUD::CLEAR_ADDITIONAL_TEXT(10, TRUE);
|
||||
HUD::REQUEST_ADDITIONAL_TEXT("MOD_MNU", 10);
|
||||
script::get_current()->yield();
|
||||
}
|
||||
|
||||
VEHICLE::SET_VEHICLE_MOD_KIT(player_vehicle, 0);
|
||||
|
||||
Hash model = ENTITY::GET_ENTITY_MODEL(player_vehicle);
|
||||
|
||||
owned_mods = vehicle::get_owned_mods_from_vehicle(player_vehicle);
|
||||
VEHICLE::SET_VEHICLE_MOD_KIT(player_vehicle, 0);
|
||||
|
||||
std::map<int, std::string> tmp_slot_display_names;
|
||||
std::map<int, std::map<int, std::string>> tmp_mod_display_names;
|
||||
std::map<std::string, std::vector<int>> tmp_front_wheel_map;
|
||||
std::map<std::string, std::vector<int>> 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_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());
|
||||
tmp_mod_display_names[MOD_WHEEL_TYPE].insert(lsc_wheel_styles.begin(), lsc_wheel_styles.end());
|
||||
|
||||
is_bennys = owned_mods[MOD_WHEEL_TYPE] == WHEEL_TYPE_BENNYS_ORIGINAL ||
|
||||
owned_mods[MOD_WHEEL_TYPE] == WHEEL_TYPE_BENNYS_BESPOKE ||
|
||||
owned_mods[MOD_WHEEL_TYPE] == WHEEL_TYPE_OPEN_WHEEL ||
|
||||
owned_mods[MOD_WHEEL_TYPE] == WHEEL_TYPE_STREET ||
|
||||
owned_mods[MOD_WHEEL_TYPE] == WHEEL_TYPE_TRACK;
|
||||
|
||||
for (int slot = MOD_SPOILERS; slot <= MOD_LIGHTBAR; slot++)
|
||||
{
|
||||
int count = VEHICLE::GET_NUM_VEHICLE_MODS(player_vehicle, slot);
|
||||
if (count > 0)
|
||||
{
|
||||
int owner_mod = owned_mods[slot];
|
||||
|
||||
std::string slot_name = vehicle_helper::get_mod_slot_name(model, player_vehicle, slot);
|
||||
if (slot_name.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
tmp_slot_display_names[slot] = slot_name;
|
||||
|
||||
std::map<int, std::string> mod_names;
|
||||
|
||||
for (int mod = -1; mod < count; mod++)
|
||||
{
|
||||
if (vehicle_helper::check_mod_blacklist(model, slot, mod))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool is_repeated = false;
|
||||
|
||||
std::string mod_name = vehicle_helper::get_mod_name(model, player_vehicle, slot, mod, count);
|
||||
|
||||
if (mod_name.empty() || mod_name == "NULL")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (slot == MOD_FRONTWHEEL)
|
||||
{
|
||||
if (is_bennys)
|
||||
{
|
||||
if (mod_name.rfind("Chrome ", 0) == 0)
|
||||
{
|
||||
std::string new_mod_name = mod_name.substr(7);
|
||||
|
||||
if (tmp_front_wheel_map[new_mod_name].size() > 0)
|
||||
{
|
||||
mod_name = new_mod_name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tmp_front_wheel_map[mod_name].push_back(mod);
|
||||
|
||||
if (mod == owner_mod)
|
||||
{
|
||||
front_wheel_stock_mod = tmp_front_wheel_map[mod_name][0];
|
||||
}
|
||||
|
||||
if (tmp_front_wheel_map[mod_name].size() > 1)
|
||||
{
|
||||
is_repeated = true;
|
||||
}
|
||||
}
|
||||
else if(slot == MOD_REARWHEEL)
|
||||
{
|
||||
if (is_bennys)
|
||||
{
|
||||
if (mod_name.rfind("Chrome ", 0) == 0)
|
||||
{
|
||||
std::string new_mod_name = mod_name.substr(7);
|
||||
|
||||
if (tmp_rear_wheel_map[new_mod_name].size() > 0)
|
||||
{
|
||||
mod_name = new_mod_name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
tmp_rear_wheel_map[mod_name].push_back(mod);
|
||||
|
||||
if (mod == owner_mod)
|
||||
{
|
||||
rear_wheel_stock_mod = tmp_rear_wheel_map[mod_name][0];
|
||||
}
|
||||
|
||||
if (tmp_rear_wheel_map[mod_name].size() > 1)
|
||||
{
|
||||
is_repeated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_repeated)
|
||||
{
|
||||
mod_names[mod] = mod_name;
|
||||
}
|
||||
}
|
||||
|
||||
tmp_mod_display_names[slot] = mod_names;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_mod_display_names.count(MOD_HORNS) > 0)
|
||||
{
|
||||
tmp_mod_display_names[MOD_HORNS].insert(lsc_missing_horns.begin(), lsc_missing_horns.end());
|
||||
}
|
||||
|
||||
slot_display_names = tmp_slot_display_names;
|
||||
mod_display_names = tmp_mod_display_names;
|
||||
front_wheel_map = tmp_front_wheel_map;
|
||||
rear_wheel_map = tmp_rear_wheel_map;
|
||||
|
||||
ready = true;
|
||||
});
|
||||
}
|
||||
|
||||
components::button("Start LS Customs", [] {
|
||||
g->vehicle.ls_customs = true;
|
||||
});
|
||||
ImGui::SameLine();
|
||||
if (components::button("Max Vehicle"))
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
vehicle::max_vehicle(self::veh);
|
||||
|
||||
// refresh mod names
|
||||
player_vehicle = 0;
|
||||
});
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
static char plate[9];
|
||||
|
||||
ImGui::SetNextItemWidth(200.f);
|
||||
components::input_text_with_hint("##plate", "Plate Number", plate, sizeof(plate), ImGuiInputTextFlags_None);
|
||||
ImGui::SameLine();
|
||||
if (components::button("Change Plate Number"))
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
vehicle::set_plate(self::veh, plate);
|
||||
});
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
components::sub_title("Mod Options");
|
||||
|
||||
bool is_bulletproof_tires = !owned_mods[MOD_TIRE_CAN_BURST];
|
||||
if (ImGui::Checkbox("Bulletproof Tires", (bool*)&is_bulletproof_tires))
|
||||
{
|
||||
g_fiber_pool->queue_job([is_bulletproof_tires] {
|
||||
owned_mods[MOD_TIRE_CAN_BURST] = (int32_t)!is_bulletproof_tires;
|
||||
VEHICLE::SET_VEHICLE_TYRES_CAN_BURST(player_vehicle, owned_mods[MOD_TIRE_CAN_BURST]);
|
||||
});
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Low Grip Tires", (bool*)&owned_mods[MOD_DRIFT_TIRE]))
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_DRIFT_TYRES(player_vehicle, owned_mods[MOD_DRIFT_TIRE]);
|
||||
});
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Checkbox("Turbo", (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]))
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_TYRE_SMOKE, owned_mods[MOD_TYRE_SMOKE]);
|
||||
});
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Slot");
|
||||
if (ImGui::ListBoxHeader("##slot", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& [slot, name] : slot_display_names)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), slot == selected_slot))
|
||||
{
|
||||
selected_slot = slot;
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
if (selected_slot != -1)
|
||||
{
|
||||
auto wheel_stock_mod = &front_wheel_stock_mod;
|
||||
auto wheel_custom = &owned_mods[MOD_FRONTWHEEL_VAR];
|
||||
bool is_wheel_mod = false;
|
||||
|
||||
if (selected_slot == MOD_FRONTWHEEL)
|
||||
{
|
||||
is_wheel_mod = true;
|
||||
}
|
||||
else if (selected_slot == MOD_REARWHEEL)
|
||||
{
|
||||
wheel_stock_mod = &rear_wheel_stock_mod;
|
||||
wheel_custom = &owned_mods[MOD_REARWHEEL_VAR];
|
||||
is_wheel_mod = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_wheel_mod = false;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Mod");
|
||||
if (ImGui::ListBoxHeader("##mod", ImVec2(240, 200)))
|
||||
{
|
||||
for (const auto& it : mod_display_names[selected_slot])
|
||||
{
|
||||
const auto& mod = it.first;
|
||||
const auto& name = it.second;
|
||||
|
||||
bool item_selected = mod == owned_mods[selected_slot];
|
||||
|
||||
if (is_wheel_mod)
|
||||
{
|
||||
item_selected = mod == *wheel_stock_mod;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable(name.c_str(), item_selected))
|
||||
{
|
||||
g_fiber_pool->queue_job([&mod, is_wheel_mod, wheel_stock_mod, wheel_custom] {
|
||||
NETWORK::NETWORK_REQUEST_CONTROL_OF_ENTITY(self::veh);
|
||||
|
||||
if (selected_slot >= 0)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_MOD(player_vehicle, selected_slot, mod, false);
|
||||
owned_mods[selected_slot] = mod;
|
||||
|
||||
if (is_wheel_mod)
|
||||
{
|
||||
*wheel_stock_mod = mod;
|
||||
*wheel_custom = false;
|
||||
}
|
||||
}
|
||||
else if (selected_slot == MOD_WINDOW_TINT)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_WINDOW_TINT(player_vehicle, mod);
|
||||
owned_mods[selected_slot] = mod;
|
||||
}
|
||||
else if (selected_slot == MOD_WHEEL_TYPE)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_WHEEL_TYPE(player_vehicle, mod);
|
||||
VEHICLE::SET_VEHICLE_MOD(player_vehicle, MOD_FRONTWHEEL, 0, false);
|
||||
VEHICLE::SET_VEHICLE_MOD(player_vehicle, MOD_REARWHEEL, 0, false);
|
||||
player_vehicle = 0;
|
||||
}
|
||||
else if (selected_slot == MOD_PLATE_STYLE)
|
||||
{
|
||||
VEHICLE::SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(player_vehicle, mod);
|
||||
owned_mods[selected_slot] = mod;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
|
||||
if (
|
||||
is_wheel_mod && *wheel_stock_mod != -1
|
||||
) {
|
||||
auto wheel_map = front_wheel_map;
|
||||
|
||||
if (selected_slot == MOD_REARWHEEL)
|
||||
{
|
||||
wheel_map = rear_wheel_map;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
components::sub_title("Style");
|
||||
if (ImGui::ListBoxHeader("##style", ImVec2(200, 200)))
|
||||
{
|
||||
std::string mod_name = mod_display_names[selected_slot][*wheel_stock_mod];
|
||||
auto wheel_mods = wheel_map[mod_name];
|
||||
|
||||
for (int i = 0; i < wheel_mods.size(); i++)
|
||||
{
|
||||
int& mod = wheel_mods[i];
|
||||
|
||||
int should_custom = false;
|
||||
|
||||
// bennys fix
|
||||
if (!is_bennys)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
if (ImGui::Selectable("Stock", mod == owned_mods[selected_slot] && *wheel_custom == false))
|
||||
{
|
||||
g_fiber_pool->queue_job([&mod] {
|
||||
VEHICLE::SET_VEHICLE_MOD(player_vehicle, selected_slot, mod, false);
|
||||
player_vehicle = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
should_custom = true;
|
||||
}
|
||||
|
||||
std::string label = "Style " + 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] {
|
||||
VEHICLE::SET_VEHICLE_MOD(player_vehicle, selected_slot, mod, should_custom);
|
||||
player_vehicle = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ImGui::Separator();
|
||||
components::sub_title("Neon Light Options");
|
||||
|
||||
if (ImGui::Checkbox("Headlight##headlight_en", (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::SameLine();
|
||||
if (ImGui::Checkbox("Left", (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]))
|
||||
{
|
||||
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]))
|
||||
{
|
||||
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]))
|
||||
{
|
||||
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", [] {
|
||||
owned_mods[MOD_XENON_LIGHTS] = true;
|
||||
owned_mods[MOD_NEON_LEFT_ON] = true;
|
||||
owned_mods[MOD_NEON_RIGHT_ON] = true;
|
||||
owned_mods[MOD_NEON_FRONT_ON] = true;
|
||||
owned_mods[MOD_NEON_BACK_ON] = true;
|
||||
|
||||
VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_XENON_LIGHTS, owned_mods[MOD_XENON_LIGHTS]);
|
||||
VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_LEFT, owned_mods[MOD_NEON_LEFT_ON]);
|
||||
VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_RIGHT, owned_mods[MOD_NEON_RIGHT_ON]);
|
||||
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::SameLine();
|
||||
components::button("Uncheck All##neon_uncheck_all", [] {
|
||||
owned_mods[MOD_XENON_LIGHTS] = false;
|
||||
owned_mods[MOD_NEON_LEFT_ON] = false;
|
||||
owned_mods[MOD_NEON_RIGHT_ON] = false;
|
||||
owned_mods[MOD_NEON_FRONT_ON] = false;
|
||||
owned_mods[MOD_NEON_BACK_ON] = false;
|
||||
|
||||
VEHICLE::TOGGLE_VEHICLE_MOD(player_vehicle, MOD_XENON_LIGHTS, owned_mods[MOD_XENON_LIGHTS]);
|
||||
VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_LEFT, owned_mods[MOD_NEON_LEFT_ON]);
|
||||
VEHICLE::SET_VEHICLE_NEON_ENABLED(player_vehicle, NEON_RIGHT, owned_mods[MOD_NEON_RIGHT_ON]);
|
||||
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::Separator();
|
||||
components::sub_title("Color Options");
|
||||
|
||||
static int color_to_change = 0;
|
||||
static int color_type = 8;
|
||||
|
||||
if (
|
||||
(color_to_change == 7 && !owned_mods[MOD_XENON_LIGHTS]) ||
|
||||
(color_to_change == 5 && !owned_mods[MOD_TYRE_SMOKE])
|
||||
) {
|
||||
color_to_change = 0;
|
||||
color_type = 8;
|
||||
}
|
||||
|
||||
if (ImGui::ListBoxHeader("##color_options", ImVec2(120, 254)))
|
||||
{
|
||||
if (ImGui::Selectable("Primary", color_to_change == 0, ImGuiSelectableFlags_SelectOnClick))
|
||||
{
|
||||
color_to_change = 0;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Secondary", color_to_change == 1))
|
||||
{
|
||||
color_to_change = 1;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Pearlescent", color_to_change == 2))
|
||||
{
|
||||
color_to_change = 2;
|
||||
color_type = 4;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Interior", color_to_change == 3))
|
||||
{
|
||||
color_to_change = 3;
|
||||
color_type = 6;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Dashboard", color_to_change == 4))
|
||||
{
|
||||
color_to_change = 4;
|
||||
color_type = 7;
|
||||
}
|
||||
|
||||
if (!owned_mods[MOD_TYRE_SMOKE])
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::Selectable("Tire Smoke", color_to_change == 5))
|
||||
{
|
||||
color_to_change = 5;
|
||||
color_type = 8;
|
||||
}
|
||||
if (!owned_mods[MOD_TYRE_SMOKE])
|
||||
{
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Wheel Color", color_to_change == 6))
|
||||
{
|
||||
color_to_change = 6;
|
||||
color_type = 5;
|
||||
}
|
||||
|
||||
if (!owned_mods[MOD_XENON_LIGHTS])
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
if (ImGui::Selectable("Headlight##headlight_col", color_to_change == 7))
|
||||
{
|
||||
color_to_change = 7;
|
||||
color_type = 9;
|
||||
}
|
||||
if (!owned_mods[MOD_XENON_LIGHTS])
|
||||
{
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Neon", color_to_change == 8))
|
||||
{
|
||||
color_to_change = 8;
|
||||
color_type = 8;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
|
||||
if (color_to_change == 0 || color_to_change == 1)
|
||||
{
|
||||
if (color_type > 3)
|
||||
{
|
||||
color_type = 8;
|
||||
}
|
||||
|
||||
// primary and secondary color
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##colors", ImVec2(140, 254)))
|
||||
{
|
||||
if (ImGui::Selectable("Custom", color_type == 8, ImGuiSelectableFlags_SelectOnClick))
|
||||
{
|
||||
color_type = 8;
|
||||
}
|
||||
if (ImGui::Selectable("Remove Custom", false))
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
if (color_to_change == 0)
|
||||
{
|
||||
VEHICLE::CLEAR_VEHICLE_CUSTOM_PRIMARY_COLOUR(player_vehicle);
|
||||
}
|
||||
else
|
||||
{
|
||||
VEHICLE::CLEAR_VEHICLE_CUSTOM_SECONDARY_COLOUR(player_vehicle);
|
||||
}
|
||||
VEHICLE::SET_VEHICLE_COLOURS(player_vehicle, owned_mods[MOD_PRIMARY_COL], owned_mods[MOD_SECONDARY_COL]);
|
||||
});
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("Chrome", color_type == 0))
|
||||
{
|
||||
color_type = 0;
|
||||
}
|
||||
if (ImGui::Selectable("Classic", color_type == 1))
|
||||
{
|
||||
color_type = 1;
|
||||
}
|
||||
if (ImGui::Selectable("Matte", color_type == 2))
|
||||
{
|
||||
color_type = 2;
|
||||
}
|
||||
if (ImGui::Selectable("Metals", color_type == 3))
|
||||
{
|
||||
color_type = 3;
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
else if (color_to_change == 7)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
|
||||
if (color_type == 8)
|
||||
{
|
||||
// custom color
|
||||
|
||||
static float color[3] = { 1, 1, 1 };
|
||||
auto color_r = &owned_mods[MOD_PRIMARY_COL_R];
|
||||
auto color_g = &owned_mods[MOD_PRIMARY_COL_G];
|
||||
auto color_b = &owned_mods[MOD_PRIMARY_COL_B];
|
||||
|
||||
if (color_to_change == 1)
|
||||
{
|
||||
color_r = &owned_mods[MOD_SECONDARY_COL_R];
|
||||
color_g = &owned_mods[MOD_SECONDARY_COL_G];
|
||||
color_b = &owned_mods[MOD_SECONDARY_COL_B];
|
||||
}
|
||||
else if (color_to_change == 2)
|
||||
{
|
||||
color_r = &owned_mods[MOD_TIRESMOKE_COL_R];
|
||||
color_g = &owned_mods[MOD_TIRESMOKE_COL_G];
|
||||
color_b = &owned_mods[MOD_TIRESMOKE_COL_B];
|
||||
}
|
||||
else if (color_to_change == 3)
|
||||
{
|
||||
color_r = &owned_mods[MOD_NEON_COL_R];
|
||||
color_g = &owned_mods[MOD_NEON_COL_G];
|
||||
color_b = &owned_mods[MOD_NEON_COL_B];
|
||||
}
|
||||
|
||||
color[0] = (float)*color_r / 255;
|
||||
color[1] = (float)*color_g / 255;
|
||||
color[2] = (float)*color_b / 255;
|
||||
|
||||
if (color_to_change == 5)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##tire_smoke_rgb", ImVec2(140, 254)))
|
||||
{
|
||||
for (const auto& it : lsc_tire_smoke_rgb)
|
||||
{
|
||||
auto& name = it.first;
|
||||
auto& rgb = it.second;
|
||||
|
||||
if (ImGui::Selectable(name.c_str(), false))
|
||||
{
|
||||
g_fiber_pool->queue_job([&rgb] {
|
||||
VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(player_vehicle, rgb[0], rgb[1], rgb[2]);
|
||||
});
|
||||
*color_r = rgb[0];
|
||||
*color_g = rgb[1];
|
||||
*color_b = rgb[2];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
else if (color_to_change == 8)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
if (ImGui::ListBoxHeader("##neon_rgb", ImVec2(140, 254)))
|
||||
{
|
||||
for (const auto& it : lsc_neon_rgb)
|
||||
{
|
||||
auto& name = it.first;
|
||||
auto& rgb = it.second;
|
||||
|
||||
if (ImGui::Selectable(name.c_str(), false))
|
||||
{
|
||||
g_fiber_pool->queue_job([&rgb] {
|
||||
VEHICLE::SET_VEHICLE_NEON_COLOUR(player_vehicle, rgb[0], rgb[1], rgb[2]);
|
||||
});
|
||||
*color_r = rgb[0];
|
||||
*color_g = rgb[1];
|
||||
*color_b = rgb[2];
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(214);
|
||||
if (ImGui::ColorPicker3("Custom VehColor", color, ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_DisplayRGB | ImGuiColorEditFlags_DisplayHex))
|
||||
{
|
||||
*color_r = (int)(color[0] * 255);
|
||||
*color_g = (int)(color[1] * 255);
|
||||
*color_b = (int)(color[2] * 255);
|
||||
|
||||
g_fiber_pool->queue_job([color_r, color_g, color_b] {
|
||||
switch (color_to_change)
|
||||
{
|
||||
case 0:
|
||||
VEHICLE::SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(player_vehicle, *color_r, *color_g, *color_b);
|
||||
break;
|
||||
case 1:
|
||||
VEHICLE::SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(player_vehicle, *color_r, *color_g, *color_b);
|
||||
break;
|
||||
case 5:
|
||||
VEHICLE::SET_VEHICLE_TYRE_SMOKE_COLOR(player_vehicle, *color_r, *color_g, *color_b);
|
||||
break;
|
||||
case 8:
|
||||
VEHICLE::SET_VEHICLE_NEON_COLOUR(player_vehicle, *color_r, *color_g, *color_b);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// standard color
|
||||
|
||||
int selected_color = 0;
|
||||
switch (color_type)
|
||||
{
|
||||
case 4:
|
||||
selected_color = owned_mods[MOD_PEARLESCENT_COL];
|
||||
break;
|
||||
case 5:
|
||||
selected_color = owned_mods[MOD_WHEEL_COL];
|
||||
break;
|
||||
case 6:
|
||||
selected_color = owned_mods[MOD_INTERIOR_COL];
|
||||
break;
|
||||
case 7:
|
||||
selected_color = owned_mods[MOD_DASHBOARD_COL];
|
||||
break;
|
||||
case 9:
|
||||
selected_color = owned_mods[MOD_XENON_COL];
|
||||
break;
|
||||
default:
|
||||
selected_color = (color_to_change == 0) ? owned_mods[MOD_PRIMARY_COL] : owned_mods[MOD_SECONDARY_COL];
|
||||
}
|
||||
|
||||
if (color_type != 9)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if (ImGui::ListBoxHeader("##color", ImVec2(180, 254)))
|
||||
{
|
||||
switch (color_type)
|
||||
{
|
||||
case 0: //Chrome
|
||||
{
|
||||
if (ImGui::Selectable("Chrome", selected_color == COLOR_CHROME))
|
||||
{
|
||||
if (color_to_change == 0)
|
||||
{
|
||||
owned_mods[MOD_PRIMARY_COL] = COLOR_CHROME;
|
||||
}
|
||||
else
|
||||
{
|
||||
owned_mods[MOD_SECONDARY_COL] = COLOR_CHROME;
|
||||
}
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_COLOURS(player_vehicle, owned_mods[MOD_PRIMARY_COL], owned_mods[MOD_SECONDARY_COL]);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: //Classic
|
||||
{
|
||||
for (const auto& [color, name] : lsc_classic_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
|
||||
if (color_to_change == 0)
|
||||
{
|
||||
owned_mods[MOD_PRIMARY_COL] = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
owned_mods[MOD_SECONDARY_COL] = color;
|
||||
}
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_COLOURS(player_vehicle, owned_mods[MOD_PRIMARY_COL], owned_mods[MOD_SECONDARY_COL]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: //Matte
|
||||
{
|
||||
for (const auto& [color, name] : lsc_matte_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
|
||||
if (color_to_change == 0)
|
||||
{
|
||||
owned_mods[MOD_PRIMARY_COL] = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
owned_mods[MOD_SECONDARY_COL] = color;
|
||||
}
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_COLOURS(player_vehicle, owned_mods[MOD_PRIMARY_COL], owned_mods[MOD_SECONDARY_COL]);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3: //Metals
|
||||
{
|
||||
for (const auto& [color, name] : lsc_metal_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
|
||||
if (color_to_change == 0)
|
||||
{
|
||||
owned_mods[MOD_PRIMARY_COL] = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
owned_mods[MOD_SECONDARY_COL] = color;
|
||||
}
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_COLOURS(player_vehicle, owned_mods[MOD_PRIMARY_COL], owned_mods[MOD_SECONDARY_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: //Pearlescent
|
||||
{
|
||||
for (const auto& [color, name] : lsc_classic_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
owned_mods[MOD_PEARLESCENT_COL] = color;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_EXTRA_COLOURS(player_vehicle, owned_mods[MOD_PEARLESCENT_COL], owned_mods[MOD_WHEEL_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5: //Wheel Color
|
||||
{
|
||||
for (const auto& [color, name] : lsc_classic_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
owned_mods[MOD_WHEEL_COL] = color;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_EXTRA_COLOURS(player_vehicle, owned_mods[MOD_PEARLESCENT_COL], owned_mods[MOD_WHEEL_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: //Interior Color
|
||||
{
|
||||
for (const auto& [color, name] : lsc_classic_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
owned_mods[MOD_INTERIOR_COL] = color;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_EXTRA_COLOUR_5(player_vehicle, owned_mods[MOD_INTERIOR_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 7: //Dashboard Color
|
||||
{
|
||||
for (const auto& [color, name] : lsc_classic_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
owned_mods[MOD_DASHBOARD_COL] = color;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_EXTRA_COLOUR_6(player_vehicle, owned_mods[MOD_DASHBOARD_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 9: //Headlight Color
|
||||
{
|
||||
for (const auto& [color, name] : lsc_headlight_colors)
|
||||
{
|
||||
if (ImGui::Selectable(name.c_str(), selected_color == color))
|
||||
{
|
||||
selected_color = color;
|
||||
owned_mods[MOD_XENON_COL] = color;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
VEHICLE::SET_VEHICLE_XENON_LIGHT_COLOR_INDEX(player_vehicle, owned_mods[MOD_XENON_COL]);
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
86
src/views/vehicle/view_persist_car.cpp
Normal file
86
src/views/vehicle/view_persist_car.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "core/data/speed_units.hpp"
|
||||
#include "services/vehicle/persist_car_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static void save_vehicle(char* vehicle_file_name_input)
|
||||
{
|
||||
if (ENTITY::DOES_ENTITY_EXIST(self::veh))
|
||||
{
|
||||
const auto vehicle_file_name = std::string(vehicle_file_name_input).append(".json");
|
||||
persist_car_service::save_vehicle(self::veh, vehicle_file_name);
|
||||
ZeroMemory(vehicle_file_name_input, sizeof(vehicle_file_name_input));
|
||||
}
|
||||
}
|
||||
|
||||
static void load_vehicle(std::string& selected_vehicle_file)
|
||||
{
|
||||
if (!selected_vehicle_file.empty())
|
||||
{
|
||||
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");
|
||||
}
|
||||
else if (g->spawn_vehicle.spawn_inside)
|
||||
teleport::into_vehicle(vehicle);
|
||||
|
||||
selected_vehicle_file.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_warning("Persist Car", "Select a file first");
|
||||
}
|
||||
}
|
||||
|
||||
void view::persist_car()
|
||||
{
|
||||
static std::string selected_vehicle_file;
|
||||
|
||||
const auto vehicle_files = persist_car_service::list_files();
|
||||
|
||||
ImGui::PushItemWidth(250);
|
||||
ImGui::Text("Saved Vehicles");
|
||||
|
||||
if (ImGui::ListBoxHeader("##empty", ImVec2(200, 200)))
|
||||
{
|
||||
for (const auto& pair : vehicle_files)
|
||||
{
|
||||
if (ImGui::Selectable(pair.c_str(), selected_vehicle_file == pair))
|
||||
selected_vehicle_file = pair;
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
static char vehicle_file_name_input[50]{};
|
||||
|
||||
ImGui::PushItemWidth(250);
|
||||
components::input_text_with_hint(
|
||||
"Vehicle File Name",
|
||||
"Ex: My Cool Car",
|
||||
vehicle_file_name_input, IM_ARRAYSIZE(vehicle_file_name_input));
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Save Vehicle", []
|
||||
{
|
||||
save_vehicle(vehicle_file_name_input);
|
||||
});
|
||||
|
||||
components::button("Load Vehicle", []
|
||||
{
|
||||
load_vehicle(selected_vehicle_file);
|
||||
});
|
||||
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
}
|
184
src/views/vehicle/view_pv.cpp
Normal file
184
src/views/vehicle/view_pv.cpp
Normal file
@ -0,0 +1,184 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "services/mobile/mobile_service.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "services/model_preview/model_preview_service.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
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 (!g->clone_pv.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Spawn In", &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);
|
||||
if (g->clone_pv.spawn_clone)
|
||||
{
|
||||
num_of_rows = 5;
|
||||
|
||||
ImGui::Checkbox("Spawn Maxed", &g->clone_pv.spawn_maxed);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Clone PV Plate", &g->clone_pv.clone_plate);
|
||||
if (g->clone_pv.clone_plate)
|
||||
{
|
||||
num_of_rows = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
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, [] {
|
||||
g->clone_pv.plate = plate_buf;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int selected_class = -1;
|
||||
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::Selectable("ALL", selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
|
||||
static char search[64];
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
|
||||
g_mobile_service->refresh_personal_vehicles();
|
||||
if (ImGui::ListBoxHeader("###personal_veh_list", { 300, static_cast<float>(*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?");
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
|
||||
for (const auto& it : g_mobile_service->personal_vehicles())
|
||||
{
|
||||
const auto& label = it.first;
|
||||
const auto& personal_veh = it.second;
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(personal_veh->get_hash());
|
||||
|
||||
std::string vehicle_class = item.m_vehicle_class;
|
||||
std::string display_name = label;
|
||||
std::string display_manufacturer = item.m_display_manufacturer;
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
|
||||
if ((
|
||||
selected_class == -1 || class_arr[selected_class] == vehicle_class
|
||||
) && (
|
||||
display_name.find(lower_search) != std::string::npos ||
|
||||
display_manufacturer.find(lower_search) != std::string::npos
|
||||
)) {
|
||||
|
||||
ImGui::PushID('v' << 24 & personal_veh->get_id());
|
||||
components::selectable(label, false, [&personal_veh] {
|
||||
if (g->clone_pv.spawn_clone)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto vehicle_idx = personal_veh->get_vehicle_idx();
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle_idx(vehicle_idx);
|
||||
|
||||
const char* spawn_plate_buf = plate_buf;
|
||||
if (g->clone_pv.clone_plate)
|
||||
{
|
||||
spawn_plate_buf = personal_veh->get_plate();
|
||||
}
|
||||
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("Vehicle", "Unable to spawn vehicle");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g->clone_pv.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, spawn_plate_buf);
|
||||
|
||||
if (g->clone_pv.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(search, "");
|
||||
personal_veh->summon();
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
|
||||
if (!g->clone_pv.preview_vehicle || (g->clone_pv.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([&personal_veh] {
|
||||
g_model_preview_service->show_vehicle(
|
||||
vehicle::get_owned_mods_from_vehicle_idx(personal_veh->get_vehicle_idx()),
|
||||
g->clone_pv.spawn_maxed
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
}
|
204
src/views/vehicle/view_spawn_vehicle.cpp
Normal file
204
src/views/vehicle/view_spawn_vehicle.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "services/model_preview/model_preview_service.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::spawn_vehicle()
|
||||
{
|
||||
ImGui::SetWindowSize({ 0.f, (float)*g_pointers->m_resolution_y }, ImGuiCond_Always);
|
||||
|
||||
if (ImGui::Checkbox("Preview", &g->spawn_vehicle.preview_vehicle))
|
||||
{
|
||||
if (!g->spawn_vehicle.preview_vehicle)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Spawn In", &g->spawn_vehicle.spawn_inside);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Spawn Maxed", &g->spawn_vehicle.spawn_maxed);
|
||||
|
||||
static char plate_buf[9] = { 0 };
|
||||
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, [] {
|
||||
g->spawn_vehicle.plate = plate_buf;
|
||||
});
|
||||
|
||||
|
||||
static int selected_class = -1;
|
||||
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::Selectable("ALL", selected_class == -1))
|
||||
{
|
||||
selected_class = -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < class_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(class_arr[i].c_str(), selected_class == i))
|
||||
{
|
||||
selected_class = i;
|
||||
}
|
||||
|
||||
if (selected_class == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
|
||||
static char search[64];
|
||||
|
||||
ImGui::SetNextItemWidth(300.f);
|
||||
components::input_text_with_hint("Model Name", "Search", search, sizeof(search), ImGuiInputTextFlags_None);
|
||||
|
||||
|
||||
if (ImGui::ListBoxHeader("###vehicles", { 300, static_cast<float>(*g_pointers->m_resolution_y - 188 - 38 * 4) }))
|
||||
{
|
||||
if (self::veh)
|
||||
{
|
||||
static auto veh_hash = 0;
|
||||
|
||||
g_fiber_pool->queue_job([] {
|
||||
veh_hash = ENTITY::GET_ENTITY_MODEL(self::veh);
|
||||
});
|
||||
|
||||
if (veh_hash)
|
||||
{
|
||||
const auto& item = g_gta_data_service->vehicle_by_hash(veh_hash);
|
||||
|
||||
components::selectable(std::format("Current Vehicle [{}]", item.m_display_name), false, [] {
|
||||
if (self::veh)
|
||||
{
|
||||
Vector3 spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
|
||||
float spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
auto owned_mods = vehicle::get_owned_mods_from_vehicle(self::veh);
|
||||
|
||||
auto veh = vehicle::clone_from_owned_mods(owned_mods, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("Vehicle", "Unable to spawn vehicle");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g->spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
|
||||
if (g->spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
|
||||
if (!g->spawn_vehicle.preview_vehicle || (g->spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
g_model_preview_service->show_vehicle(
|
||||
vehicle::get_owned_mods_from_vehicle(self::veh),
|
||||
g->spawn_vehicle.spawn_maxed
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto& item_arr = g_gta_data_service->vehicles();
|
||||
if (item_arr.size() > 0)
|
||||
{
|
||||
std::string lower_search = search;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
|
||||
for (auto& item : item_arr)
|
||||
{
|
||||
const auto& vehicle = item.second;
|
||||
|
||||
std::string display_name = vehicle.m_display_name;
|
||||
std::string display_manufacturer = vehicle.m_display_manufacturer;
|
||||
std::string clazz = vehicle.m_vehicle_class;
|
||||
|
||||
std::transform(display_name.begin(), display_name.end(), display_name.begin(), ::tolower);
|
||||
std::transform(display_manufacturer.begin(), display_manufacturer.end(), display_manufacturer.begin(), ::tolower);
|
||||
|
||||
if ((
|
||||
selected_class == -1 || class_arr[selected_class] == clazz
|
||||
) && (
|
||||
display_name.find(lower_search) != std::string::npos ||
|
||||
display_manufacturer.find(lower_search) != std::string::npos
|
||||
)) {
|
||||
ImGui::PushID(vehicle.m_hash);
|
||||
components::selectable(vehicle.m_display_name, false, [&vehicle]
|
||||
{
|
||||
const auto spawn_location = vehicle::get_spawn_location(g->spawn_vehicle.spawn_inside);
|
||||
const auto spawn_heading = ENTITY::GET_ENTITY_HEADING(self::ped);
|
||||
|
||||
const auto veh = vehicle::spawn(vehicle.m_hash, spawn_location, spawn_heading);
|
||||
|
||||
if (veh == 0)
|
||||
{
|
||||
g_notification_service->push_error("Vehicle", "Unable to spawn vehicle");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g->spawn_vehicle.spawn_maxed)
|
||||
{
|
||||
vehicle::max_vehicle(veh);
|
||||
}
|
||||
|
||||
vehicle::set_plate(veh, plate_buf);
|
||||
|
||||
if (g->spawn_vehicle.spawn_inside)
|
||||
{
|
||||
vehicle::teleport_into_vehicle(veh);
|
||||
}
|
||||
}
|
||||
|
||||
g_model_preview_service->stop_preview();
|
||||
});
|
||||
ImGui::PopID();
|
||||
|
||||
if (!g->spawn_vehicle.preview_vehicle || (g->spawn_vehicle.preview_vehicle && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_model_preview_service->show_vehicle(vehicle.m_hash, g->spawn_vehicle.spawn_maxed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("No vehicles in registry.");
|
||||
}
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
}
|
||||
}
|
211
src/views/vehicle/view_vehicle.cpp
Normal file
211
src/views/vehicle/view_vehicle.cpp
Normal file
@ -0,0 +1,211 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/vehicle.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "core/data/speed_units.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::vehicle()
|
||||
{
|
||||
components::button("MMI Fix All PV", [] {
|
||||
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")
|
||||
);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Repair", [] {
|
||||
vehicle::repair(self::veh);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("Keep Vehicle Repaired", &g->vehicle.keep_vehicle_repaired);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::button("Teleport in PV", [] {
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
teleport::into_vehicle(veh);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Bring PV", [] {
|
||||
Vehicle veh = mobile::mechanic::get_personal_vehicle();
|
||||
vehicle::bring(veh, self::pos, true);
|
||||
});
|
||||
ImGui::SameLine();
|
||||
components::button("Bring Closest Vehicle", [] {
|
||||
Vehicle veh = vehicle::get_closest_to_location(self::pos, 200);
|
||||
vehicle::bring(veh, self::pos, true, -1);
|
||||
});
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
components::sub_title("General");
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
|
||||
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
|
||||
ImGui::Checkbox("Vehicle Jump", &g->vehicle.vehicle_jump);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Instant Brake", &g->vehicle.instant_brake);
|
||||
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
|
||||
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Seatbelt", &g->vehicle.seatbelt);
|
||||
ImGui::Checkbox("Turn Signals", &g->vehicle.turn_signals);
|
||||
if (g->vehicle.turn_signals)
|
||||
{
|
||||
ImGui::Checkbox("Fully Automatic Signal", &g->vehicle.auto_turn_signals);
|
||||
}
|
||||
ImGui::Checkbox("No Water Collision", &g->vehicle.no_water_collision);
|
||||
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Proofs");
|
||||
{
|
||||
if (ImGui::Button("Check all"))
|
||||
{
|
||||
g->vehicle.proof_bullet = true;
|
||||
g->vehicle.proof_fire = true;
|
||||
g->vehicle.proof_collision = true;
|
||||
g->vehicle.proof_melee = true;
|
||||
g->vehicle.proof_explosion = true;
|
||||
g->vehicle.proof_steam = true;
|
||||
g->vehicle.proof_water = true;
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (ImGui::Button("Uncheck all"))
|
||||
{
|
||||
g->vehicle.proof_bullet = false;
|
||||
g->vehicle.proof_fire = false;
|
||||
g->vehicle.proof_collision = false;
|
||||
g->vehicle.proof_melee = false;
|
||||
g->vehicle.proof_explosion = false;
|
||||
g->vehicle.proof_steam = false;
|
||||
g->vehicle.proof_water = false;
|
||||
}
|
||||
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Bullet", &g->vehicle.proof_bullet);
|
||||
ImGui::Checkbox("Fire", &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::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Explosion", &g->vehicle.proof_explosion);
|
||||
ImGui::Checkbox("Steam", &g->vehicle.proof_steam);
|
||||
|
||||
ImGui::EndGroup();
|
||||
ImGui::SameLine();
|
||||
ImGui::BeginGroup();
|
||||
|
||||
ImGui::Checkbox("Water", &g->vehicle.proof_water);
|
||||
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Speed Unit");
|
||||
{
|
||||
ImGui::RadioButton(
|
||||
speed_unit_strings[(int)SpeedUnit::KMPH].c_str(),
|
||||
(int*)&g->vehicle.speed_unit,
|
||||
(int)SpeedUnit::KMPH
|
||||
);
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(
|
||||
speed_unit_strings[(int)SpeedUnit::MIPH].c_str(),
|
||||
(int*)&g->vehicle.speed_unit,
|
||||
(int)SpeedUnit::MIPH
|
||||
);
|
||||
ImGui::SameLine();
|
||||
ImGui::RadioButton(
|
||||
speed_unit_strings[(int)SpeedUnit::MPS].c_str(),
|
||||
(int*)&g->vehicle.speed_unit,
|
||||
(int)SpeedUnit::MPS
|
||||
);
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Speedo Meter");
|
||||
{
|
||||
ImGui::Checkbox("Enabled", &g->vehicle.speedo_meter.enabled);
|
||||
|
||||
if (g->vehicle.speedo_meter.enabled)
|
||||
{
|
||||
ImGui::Text("Position (X, Y)");
|
||||
|
||||
float pos[2] = { g->vehicle.speedo_meter.x, g->vehicle.speedo_meter.y };
|
||||
|
||||
if (ImGui::SliderFloat2("###speedo_pos", pos, .001f, .999f, "%.3f"))
|
||||
{
|
||||
g->vehicle.speedo_meter.x = pos[0];
|
||||
g->vehicle.speedo_meter.y = pos[1];
|
||||
}
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::Checkbox("Left Sided", &g->vehicle.speedo_meter.left_side);
|
||||
}
|
||||
}
|
||||
|
||||
g->vehicle.proof_mask = 0;
|
||||
if (g->vehicle.god_mode)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::GOD);
|
||||
}
|
||||
if (g->vehicle.proof_bullet)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::BULLET);
|
||||
}
|
||||
if (g->vehicle.proof_fire)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::FIRE);
|
||||
}
|
||||
if (g->vehicle.proof_collision)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::COLLISION);
|
||||
}
|
||||
if (g->vehicle.proof_melee)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::MELEE);
|
||||
}
|
||||
if (g->vehicle.proof_explosion)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::EXPLOSION);
|
||||
}
|
||||
if (g->vehicle.proof_steam)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::STEAM);
|
||||
}
|
||||
if (g->vehicle.proof_water)
|
||||
{
|
||||
g->vehicle.proof_mask |= static_cast<int>(eEntityProofs::WATER);
|
||||
}
|
||||
}
|
||||
}
|
59
src/views/view.hpp
Normal file
59
src/views/view.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
#include "gui/components/components.hpp"
|
||||
#include "util/animator.hpp"
|
||||
#include "esp/view_esp.hpp"
|
||||
#include "debug/view_debug.hpp"
|
||||
|
||||
|
||||
namespace big
|
||||
{
|
||||
class view
|
||||
{
|
||||
inline static animator window_animator = animator();
|
||||
inline static ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav;
|
||||
|
||||
public:
|
||||
static void active_view();
|
||||
static void esp_settings();
|
||||
static void context_menu_settings();
|
||||
static void gui_settings();
|
||||
static void handling_current_profile();
|
||||
static void handling_saved_profiles();
|
||||
static void notification_settings();
|
||||
static void protection_settings();
|
||||
static void heading();
|
||||
static void mobile();
|
||||
static void navigation();
|
||||
static void notifications();
|
||||
static void root();
|
||||
static void self();
|
||||
static void session();
|
||||
static void settings();
|
||||
static void vehicle();
|
||||
static void lsc();
|
||||
static void spawn_vehicle();
|
||||
static void pv();
|
||||
static void persist_car();
|
||||
static void fun_vehicle();
|
||||
static void spawn_ped();
|
||||
static void time_and_weather();
|
||||
static void spoofing();
|
||||
static void teleport();
|
||||
static void view_player();
|
||||
static void players();
|
||||
static void weapons();
|
||||
static void context_menu();
|
||||
static void gta_data();
|
||||
|
||||
// later calls will be drawn over earlier calls
|
||||
static void always()
|
||||
{
|
||||
esp::draw();
|
||||
context_menu();
|
||||
|
||||
gta_data();
|
||||
|
||||
notifications();
|
||||
}
|
||||
};
|
||||
}
|
68
src/views/view_context_menu.cpp
Normal file
68
src/views/view_context_menu.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "view.hpp"
|
||||
#include "services/context_menu/context_menu_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
static void draw_model_bounding_box(ImDrawList* draw_list, const model_bounding_box_screen_space& m_model_bounding_box_screen_space)
|
||||
{
|
||||
const auto& box = g_context_menu_service->m_model_bounding_box_screen_space;
|
||||
const auto& color = g->context_menu.bounding_box_color;
|
||||
|
||||
draw_list->AddLine(box.edge1, box.edge2, color);
|
||||
draw_list->AddLine(box.edge1, box.edge4, color);
|
||||
draw_list->AddLine(box.edge2, box.edge3, color);
|
||||
draw_list->AddLine(box.edge3, box.edge4, color);
|
||||
|
||||
draw_list->AddLine(box.edge5, box.edge6, color);
|
||||
draw_list->AddLine(box.edge5, box.edge8, color);
|
||||
draw_list->AddLine(box.edge6, box.edge7, color);
|
||||
draw_list->AddLine(box.edge7, box.edge8, color);
|
||||
|
||||
draw_list->AddLine(box.edge1, box.edge7, color);
|
||||
draw_list->AddLine(box.edge2, box.edge8, color);
|
||||
draw_list->AddLine(box.edge3, box.edge5, color);
|
||||
draw_list->AddLine(box.edge4, box.edge6, color);
|
||||
}
|
||||
|
||||
void view::context_menu()
|
||||
{
|
||||
if (const auto draw_list = ImGui::GetBackgroundDrawList(); draw_list)
|
||||
{
|
||||
if (g_context_menu_service->enabled &&
|
||||
g_context_menu_service->m_pointer &&
|
||||
g_context_menu_service->m_pointer->m_navigation)
|
||||
{
|
||||
float context_screen_x;
|
||||
float context_screen_y;
|
||||
|
||||
auto& context_target_pos = g_context_menu_service->m_pointer->m_navigation->m_position;
|
||||
|
||||
const auto context_target_distance = math::calculate_distance_from_game_cam(context_target_pos);
|
||||
const auto context_target_multplr = context_target_distance > g->esp.global_render_distance[1] ? -1.f : 6.17757f / context_target_distance;
|
||||
|
||||
if (g_pointers->m_get_screen_coords_for_world_coords(context_target_pos.data, &context_screen_x, &context_screen_y))
|
||||
{
|
||||
const auto cm = g_context_menu_service->get_context_menu();
|
||||
if (cm == nullptr)
|
||||
return;
|
||||
|
||||
const auto cm_start_x = static_cast<float>(*g_pointers->m_resolution_x) * context_screen_x + (67.5f * context_target_multplr);
|
||||
const auto cm_start_y = static_cast<float>(*g_pointers->m_resolution_y) * context_screen_y - (175.f * context_target_multplr);
|
||||
|
||||
const auto cm_col = ImGui::ColorConvertFloat4ToU32({ 0.549f, 0.639f, 0.710f, 0.3f });
|
||||
|
||||
draw_list->AddRectFilled({ cm_start_x - 2.f , cm_start_y }, { cm_start_x + 2.f + cm->menu_size.x, cm_start_y + cm->menu_size.y }, cm_col, 5.f);
|
||||
|
||||
for (std::uint32_t i = 0; i < cm->options.size(); i++)
|
||||
{
|
||||
const auto co = cm->options.at(i);
|
||||
draw_list->AddText({ cm_start_x + 7.f, cm_start_y + (20.f * static_cast<float>(i)) + 5.f }, cm->current_option == i ? g->context_menu.selected_option_color : ImGui::ColorConvertFloat4ToU32({ 1.f, 1.f, 1.f, 1.f }), co.name.c_str());
|
||||
}
|
||||
|
||||
if (g->context_menu.bounding_box_enabled)
|
||||
draw_model_bounding_box(draw_list, g_context_menu_service->m_model_bounding_box_screen_space);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
76
src/views/view_gta_data.cpp
Normal file
76
src/views/view_gta_data.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
#include "view.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::gta_data()
|
||||
{
|
||||
if (!g_gta_data_service)
|
||||
return;
|
||||
|
||||
if (g_gta_data_service->cache_needs_update())
|
||||
{
|
||||
g_gui.m_opened = true;
|
||||
ImGui::OpenPopup("Game Cache");
|
||||
}
|
||||
|
||||
ImGui::SetNextWindowSize({ 800, 210 }, ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowPos({ 200, 200 }, ImGuiCond_FirstUseEver);
|
||||
if (ImGui::BeginPopupModal("Game Cache"))
|
||||
{
|
||||
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.");
|
||||
|
||||
if (*g_pointers->m_is_session_started)
|
||||
{
|
||||
if (ImGui::Button("Update Cache"))
|
||||
{
|
||||
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.");
|
||||
|
||||
if (ImGui::Button("I don't care, update in single player!"))
|
||||
{
|
||||
g_gta_data_service->update_now();
|
||||
}
|
||||
|
||||
if (ImGui::Button("Update cache in online."))
|
||||
{
|
||||
g_gta_data_service->update_in_online();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::WAITING_FOR_ONLINE:
|
||||
{
|
||||
ImGui::Text("Waiting for online to start cache update...");
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::UPDATING:
|
||||
{
|
||||
ImGui::Text("Updating cache, please wait...");
|
||||
|
||||
break;
|
||||
}
|
||||
case eGtaDataUpdateState::IDLE:
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
}
|
608
src/views/world/view_spawn_ped.cpp
Normal file
608
src/views/world/view_spawn_ped.cpp
Normal file
@ -0,0 +1,608 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "pointers.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "util/ped.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
#include "services/model_preview/model_preview_service.hpp"
|
||||
#include "services/players/player_service.hpp"
|
||||
|
||||
#include <imgui_internal.h>
|
||||
|
||||
|
||||
#define SPAWN_PED_ALL_WEAPONS -1
|
||||
#define SPAWN_PED_NO_WEAPONS -2
|
||||
|
||||
namespace big
|
||||
{
|
||||
Ped spawn_ped_at_location(
|
||||
const int selected_ped_type,
|
||||
const char* ped_model_buf,
|
||||
const Player selected_ped_player_id,
|
||||
const Player selected_ped_for_player_id,
|
||||
const bool is_bodyguard
|
||||
) {
|
||||
Hash hash = 0;
|
||||
Ped clone = 0;
|
||||
Vector3 location;
|
||||
Player player;
|
||||
Ped player_ped;
|
||||
|
||||
if (selected_ped_type == -2)
|
||||
{
|
||||
if (selected_ped_player_id == -1)
|
||||
{
|
||||
clone = self::ped;
|
||||
hash = ENTITY::GET_ENTITY_MODEL(clone);
|
||||
}
|
||||
else
|
||||
{
|
||||
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.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
clone = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
|
||||
hash = ENTITY::GET_ENTITY_MODEL(clone);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hash = rage::joaat(ped_model_buf);
|
||||
}
|
||||
|
||||
|
||||
if (selected_ped_for_player_id == -1)
|
||||
{
|
||||
location = self::pos;
|
||||
player = self::id;
|
||||
player_ped = self::ped;
|
||||
}
|
||||
else
|
||||
{
|
||||
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.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto player_pos = plyr->get_ped()->m_navigation->m_position;
|
||||
|
||||
location.x = player_pos.x;
|
||||
location.y = player_pos.y;
|
||||
location.z = player_pos.z;
|
||||
player = plyr->id();
|
||||
player_ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player);
|
||||
}
|
||||
|
||||
location.x += 1.f;
|
||||
location.y += 1.f;
|
||||
Ped ped = ped::spawn(ePedType::PED_TYPE_ARMY, hash, clone, location, 0);
|
||||
|
||||
if (ped == 0)
|
||||
{
|
||||
g_notification_service->push_error("Ped", "Failed to spawn model, did you give an incorrect model ? ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_bodyguard)
|
||||
{
|
||||
int player_group = PLAYER::GET_PLAYER_GROUP(player);
|
||||
|
||||
PED::SET_PED_AS_GROUP_MEMBER(ped, player_group);
|
||||
PED::SET_PED_RELATIONSHIP_GROUP_HASH(ped, PED::GET_PED_RELATIONSHIP_GROUP_HASH(player_ped));
|
||||
PED::SET_PED_AS_GROUP_LEADER(player_ped, player_group);
|
||||
PED::SET_PED_CAN_BE_TARGETTED_BY_PLAYER(ped, player, true);
|
||||
PED::SET_PED_ARMOUR(ped, 100);
|
||||
ENTITY::SET_ENTITY_MAX_HEALTH(ped, 1000);
|
||||
ENTITY::SET_ENTITY_HEALTH(ped, 1000, 0);
|
||||
PED::SET_PED_COMBAT_ABILITY(ped, 100);
|
||||
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 46, 1);
|
||||
PED::SET_PED_COMBAT_ATTRIBUTES(ped, 63, 0);
|
||||
|
||||
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
|
||||
TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(ped, 100.f, 0);
|
||||
PED::SET_PED_KEEP_TASK(ped, true);
|
||||
}
|
||||
|
||||
return ped;
|
||||
}
|
||||
|
||||
|
||||
void spawn_ped_give_weapon(
|
||||
const Ped ped,
|
||||
const int selected_ped_weapon_type,
|
||||
const Hash selected_ped_weapon_hash
|
||||
) {
|
||||
if (selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& weapon_type_arr = g_gta_data_service->weapon_types();
|
||||
for (auto& [_, weapon] : g_gta_data_service->weapons())
|
||||
{
|
||||
if (
|
||||
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
|
||||
weapon.m_weapon_type == weapon_type_arr[selected_ped_weapon_type]
|
||||
) {
|
||||
if (
|
||||
selected_ped_weapon_hash == 0 ||
|
||||
weapon.m_hash == selected_ped_weapon_hash
|
||||
) {
|
||||
WEAPON::GIVE_WEAPON_TO_PED(ped, weapon.m_hash, 9999, false, selected_ped_weapon_hash != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void view::spawn_ped()
|
||||
{
|
||||
static int selected_ped_type = -2;
|
||||
static bool ped_model_dropdown_open = false;
|
||||
static char ped_model_buf[64];
|
||||
static Player selected_ped_player_id = -1;
|
||||
|
||||
auto ped_type_arr = g_gta_data_service->ped_types();
|
||||
auto ped_arr = g_gta_data_service->peds();
|
||||
|
||||
|
||||
static int selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
|
||||
static Hash selected_ped_weapon_hash = 0;
|
||||
auto weapon_type_arr = g_gta_data_service->weapon_types();
|
||||
auto weapon_arr = g_gta_data_service->weapons();
|
||||
|
||||
static Player selected_ped_for_player_id = -1;
|
||||
auto player_arr = g_player_service->players();
|
||||
|
||||
if (!*g_pointers->m_is_session_started)
|
||||
{
|
||||
selected_ped_player_id = -1;
|
||||
selected_ped_for_player_id = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_player_service->get_by_id(selected_ped_player_id) == nullptr)
|
||||
{
|
||||
selected_ped_player_id = -1;
|
||||
}
|
||||
|
||||
if (g_player_service->get_by_id(selected_ped_for_player_id) == nullptr)
|
||||
{
|
||||
selected_ped_for_player_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
components::sub_title("Ped Model");
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::Text("Ped Type");
|
||||
|
||||
ImGui::SetNextItemWidth(160.f);
|
||||
if (ImGui::BeginCombo(
|
||||
"##ped_type",
|
||||
selected_ped_type == -1 ? "ALL" :
|
||||
selected_ped_type == -2 ? "ONLINE PLAYER" :
|
||||
ped_type_arr[selected_ped_type].c_str()
|
||||
)) {
|
||||
|
||||
if (ImGui::Selectable("ONLINE PLAYER", selected_ped_type == -2))
|
||||
{
|
||||
selected_ped_type = -2;
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("ALL", selected_ped_type == -1))
|
||||
{
|
||||
selected_ped_type = -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < ped_type_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(ped_type_arr[i].c_str(), selected_ped_type == i))
|
||||
{
|
||||
selected_ped_type = i;
|
||||
ped_model_buf[0] = 0;
|
||||
}
|
||||
|
||||
if (selected_ped_type == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
if (selected_ped_type == -2)
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::Text("Player");
|
||||
|
||||
ImGui::SetNextItemWidth(240.f);
|
||||
if (ImGui::BeginCombo(
|
||||
"##ped_player",
|
||||
selected_ped_player_id == -1 ?
|
||||
"Self" :
|
||||
g_player_service->get_by_id(selected_ped_player_id)->get_name()
|
||||
)) {
|
||||
if (ImGui::Selectable("Self", selected_ped_player_id == -1))
|
||||
{
|
||||
selected_ped_player_id = -1;
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([] {
|
||||
Ped ped = self::ped;
|
||||
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
|
||||
g_model_preview_service->show_ped(hash, ped);
|
||||
});
|
||||
}
|
||||
|
||||
if (selected_ped_player_id == -1)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
if (*g_pointers->m_is_session_started)
|
||||
{
|
||||
for (auto& item : player_arr)
|
||||
{
|
||||
auto plyr = item.second;
|
||||
auto plyr_id = plyr->id();
|
||||
|
||||
ImGui::PushID(plyr_id);
|
||||
if (ImGui::Selectable(plyr->get_name(), selected_ped_player_id == plyr_id))
|
||||
{
|
||||
selected_ped_player_id = plyr_id;
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && !ImGui::IsAnyItemHovered()))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
else if (ImGui::IsItemHovered())
|
||||
{
|
||||
g_fiber_pool->queue_job([plyr_id] {
|
||||
|
||||
auto plyr = g_player_service->get_by_id(plyr_id);
|
||||
if (plyr)
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
|
||||
Hash hash = ENTITY::GET_ENTITY_MODEL(ped);
|
||||
g_model_preview_service->show_ped(hash, ped);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
ImGui::PopID();
|
||||
|
||||
if (selected_ped_player_id == plyr_id)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::Text("Model Name");
|
||||
|
||||
ImGui::SetNextItemWidth(240.f);
|
||||
components::input_text_with_hint(
|
||||
"##ped_model_name", "Model Name",
|
||||
ped_model_buf, sizeof(ped_model_buf), ImGuiInputTextFlags_EnterReturnsTrue,
|
||||
[] {
|
||||
ped_model_dropdown_open = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
// ped model dropdown
|
||||
{
|
||||
bool ped_model_dropdown_focused = ImGui::IsItemActive();
|
||||
|
||||
if (ImGui::IsItemActivated())
|
||||
{
|
||||
ped_model_dropdown_open = true;
|
||||
}
|
||||
|
||||
if (ped_model_dropdown_open)
|
||||
{
|
||||
bool is_open = true;
|
||||
bool item_hovered = false;
|
||||
|
||||
std::string lower_search = ped_model_buf;
|
||||
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
||||
|
||||
ImGui::SetNextWindowPos({ ImGui::GetItemRectMin().x, ImGui::GetItemRectMax().y });
|
||||
ImGui::SetNextWindowSize({ 300, 300 });
|
||||
if (ImGui::Begin("##player_model_popup", &is_open, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_Tooltip))
|
||||
{
|
||||
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindow());
|
||||
ped_model_dropdown_focused |= ImGui::IsWindowFocused();
|
||||
|
||||
for (const auto& [_, item] : ped_arr)
|
||||
{
|
||||
std::string ped_type = item.m_ped_type;
|
||||
std::string name = item.m_name;
|
||||
|
||||
std::transform(name.begin(), name.end(), name.begin(), tolower);
|
||||
|
||||
if ((
|
||||
selected_ped_type == -1 || ped_type_arr[selected_ped_type] == ped_type
|
||||
) && (
|
||||
name.find(lower_search) != std::string::npos
|
||||
)) {
|
||||
|
||||
bool selectable_highlighted = lower_search == name;
|
||||
bool selectable_clicked = ImGui::Selectable(item.m_name, selectable_highlighted);
|
||||
ped_model_dropdown_focused |= ImGui::IsItemFocused();
|
||||
|
||||
if (selectable_clicked)
|
||||
{
|
||||
strncpy(ped_model_buf, item.m_name, 64);
|
||||
ped_model_dropdown_open = false;
|
||||
ped_model_dropdown_focused = false;
|
||||
}
|
||||
|
||||
if (selectable_highlighted)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
item_hovered = true;
|
||||
g_model_preview_service->show_ped(item.m_hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
ped_model_dropdown_open = ped_model_dropdown_focused;
|
||||
|
||||
if (!g->spawn_ped.preview_ped || (g->spawn_ped.preview_ped && (!item_hovered || !ped_model_dropdown_open)))
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Weapon");
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::Text("Weapon Type");
|
||||
|
||||
ImGui::SetNextItemWidth(160.f);
|
||||
if (ImGui::BeginCombo(
|
||||
"##ped_weapon_type",
|
||||
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ?
|
||||
"ALL" :
|
||||
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
|
||||
"NO WEAPONS" :
|
||||
weapon_type_arr[selected_ped_weapon_type].c_str()
|
||||
)) {
|
||||
if (ImGui::Selectable("ALL", selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS))
|
||||
{
|
||||
selected_ped_weapon_type = SPAWN_PED_ALL_WEAPONS;
|
||||
}
|
||||
|
||||
if (selected_ped_weapon_hash == SPAWN_PED_ALL_WEAPONS)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
if (ImGui::Selectable("NO WEAPONS", selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS))
|
||||
{
|
||||
selected_ped_weapon_type = SPAWN_PED_NO_WEAPONS;
|
||||
}
|
||||
|
||||
if (selected_ped_weapon_hash == SPAWN_PED_NO_WEAPONS)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
for (int i = 0; i < weapon_type_arr.size(); i++)
|
||||
{
|
||||
if (ImGui::Selectable(weapon_type_arr[i].c_str(), selected_ped_weapon_type == i))
|
||||
{
|
||||
selected_ped_weapon_type = i;
|
||||
selected_ped_weapon_hash = 0;
|
||||
}
|
||||
|
||||
if (selected_ped_weapon_type == i)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::Text("Weapon");
|
||||
|
||||
ImGui::SetNextItemWidth(240.f);
|
||||
if (ImGui::BeginCombo(
|
||||
"##ped_weapon",
|
||||
selected_ped_weapon_type == SPAWN_PED_NO_WEAPONS ?
|
||||
"NO WEAPONS" :
|
||||
selected_ped_weapon_hash == 0 ?
|
||||
"ALL" :
|
||||
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))
|
||||
{
|
||||
selected_ped_weapon_hash = 0;
|
||||
}
|
||||
|
||||
if (selected_ped_weapon_hash == 0)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
for (const auto& [_, weapon] : weapon_arr)
|
||||
{
|
||||
if (
|
||||
selected_ped_weapon_type == SPAWN_PED_ALL_WEAPONS ||
|
||||
weapon.m_weapon_type == weapon_type_arr[selected_ped_weapon_type]
|
||||
) {
|
||||
if (ImGui::Selectable(weapon.m_display_name, weapon.m_hash == selected_ped_weapon_hash))
|
||||
{
|
||||
selected_ped_weapon_hash = weapon.m_hash;
|
||||
}
|
||||
}
|
||||
|
||||
if (selected_ped_weapon_hash == weapon.m_hash)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
components::sub_title("Spawn For");
|
||||
{
|
||||
if (ImGui::BeginCombo(
|
||||
"##ped_for",
|
||||
selected_ped_for_player_id == -1 ?
|
||||
"Self" :
|
||||
g_player_service->get_by_id(selected_ped_for_player_id)->get_name()
|
||||
)) {
|
||||
if (ImGui::Selectable("Self", selected_ped_for_player_id == -1))
|
||||
{
|
||||
selected_ped_for_player_id = -1;
|
||||
}
|
||||
|
||||
if (selected_ped_for_player_id == -1)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
if (*g_pointers->m_is_session_started)
|
||||
{
|
||||
for (auto& [_, plyr] : player_arr)
|
||||
{
|
||||
auto plyr_id = plyr->id();
|
||||
|
||||
ImGui::PushID(plyr_id);
|
||||
if (ImGui::Selectable(plyr->get_name(), selected_ped_for_player_id == plyr_id))
|
||||
{
|
||||
selected_ped_for_player_id = plyr_id;
|
||||
}
|
||||
ImGui::PopID();
|
||||
|
||||
if (selected_ped_for_player_id == plyr_id)
|
||||
{
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
|
||||
|
||||
if (ImGui::Checkbox("Preview", &g->spawn_ped.preview_ped))
|
||||
{
|
||||
if (!g->spawn_ped.preview_ped)
|
||||
{
|
||||
g_model_preview_service->stop_preview();
|
||||
}
|
||||
}
|
||||
|
||||
components::button("Change Player Model", [] {
|
||||
if (selected_ped_type == -2)
|
||||
{
|
||||
if (selected_ped_player_id != -1)
|
||||
{
|
||||
auto plyr = g_player_service->get_by_id(selected_ped_player_id);
|
||||
if (plyr)
|
||||
{
|
||||
Ped ped = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(plyr->id());
|
||||
ped::steal_identity(ped);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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 ? ");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
spawn_ped_give_weapon(self::ped, selected_ped_weapon_type, selected_ped_weapon_hash);
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Spawn Ped", [] {
|
||||
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, false);
|
||||
|
||||
if (ped)
|
||||
{
|
||||
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
|
||||
}
|
||||
});
|
||||
|
||||
ImGui::SameLine();
|
||||
|
||||
components::button("Spawn Bodyguard", [] {
|
||||
Ped ped = spawn_ped_at_location(selected_ped_type, ped_model_buf, selected_ped_player_id, selected_ped_for_player_id, true);
|
||||
|
||||
if (ped)
|
||||
{
|
||||
spawn_ped_give_weapon(ped, selected_ped_weapon_type, selected_ped_weapon_hash);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
48
src/views/world/view_time_and_weather.cpp
Normal file
48
src/views/world/view_time_and_weather.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include "views/view.hpp"
|
||||
#include "fiber_pool.hpp"
|
||||
#include "util/session.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::time_and_weather()
|
||||
{
|
||||
if (ImGui::TreeNode("Local Time"))
|
||||
{
|
||||
ImGui::Checkbox("Override Time", &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::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Local Weather"))
|
||||
{
|
||||
components::button("Clear Override", []
|
||||
{
|
||||
MISC::CLEAR_OVERRIDE_WEATHER();
|
||||
});
|
||||
|
||||
if (ImGui::ListBox("", &g->session.local_weather, session::weathers, 15))
|
||||
{
|
||||
g_fiber_pool->queue_job([]
|
||||
{
|
||||
session::local_weather();
|
||||
});
|
||||
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
components::button("Force Thunder", []
|
||||
{
|
||||
session::force_thunder();
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user