2022-05-04 19:16:40 +02:00
|
|
|
#include "views/view.hpp"
|
|
|
|
#include "fiber_pool.hpp"
|
|
|
|
#include "util/mobile.hpp"
|
|
|
|
#include "services/mobile_service.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
void view::mobile() {
|
|
|
|
components::button("Mors Mutual Fix All Vehicles", [] {
|
|
|
|
int amount_fixed = mobile::mors_mutual::fix_all();
|
|
|
|
g_notification_service->push("Mobile",
|
|
|
|
fmt::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have")
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
|
|
|
components::small_text("Lester");
|
|
|
|
|
|
|
|
ImGui::Checkbox("Off Radar", &g->self.off_radar);
|
|
|
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
|
|
|
components::small_text("Mechanic - Personal Vehicles");
|
|
|
|
|
|
|
|
static char search[64];
|
|
|
|
static std::string lower_search;
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
|
|
|
|
|
|
|
ImGui::SetNextItemWidth(400.f);
|
|
|
|
if (ImGui::InputTextWithHint("##search_pv_list", "Search", search, sizeof(search)))
|
|
|
|
{
|
|
|
|
lower_search = search;
|
|
|
|
std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(), tolower);
|
|
|
|
}
|
|
|
|
|
2022-05-10 19:02:30 +02:00
|
|
|
g_mobile_service->refresh_personal_vehicles();
|
2022-05-04 19:16:40 +02:00
|
|
|
if (ImGui::ListBoxHeader("##personal_veh_list", { 400.f, 500.f }))
|
|
|
|
{
|
2022-05-10 20:38:24 +02:00
|
|
|
if (g_mobile_service->personal_vehicles().empty())
|
2022-05-04 19:16:40 +02:00
|
|
|
{
|
2022-05-10 20:55:13 +02:00
|
|
|
ImGui::Text("No personal vehicles found, are you online?");
|
2022-05-10 20:38:24 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const auto personal_veh_idx = mobile::util::get_current_personal_vehicle();
|
|
|
|
for (const auto& it : g_mobile_service->personal_vehicles())
|
|
|
|
{
|
|
|
|
const auto& label = it.first;
|
|
|
|
const auto& personal_veh = it.second;
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-05-10 20:38:24 +02:00
|
|
|
auto lower = label;
|
|
|
|
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2022-05-10 20:38:24 +02:00
|
|
|
if (lower.find(lower_search) != std::string::npos)
|
2022-05-04 19:16:40 +02:00
|
|
|
{
|
2022-05-10 20:38:24 +02:00
|
|
|
if (ImGui::Selectable(label.c_str(), personal_veh->get_id() == personal_veh_idx))
|
|
|
|
{
|
|
|
|
strcpy(search, "");
|
|
|
|
lower_search = search;
|
|
|
|
|
|
|
|
g_fiber_pool->queue_job([&personal_veh] {
|
|
|
|
personal_veh->summon();
|
2022-05-10 20:55:13 +02:00
|
|
|
});
|
2022-05-10 20:38:24 +02:00
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::ListBoxFooter();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndGroup();
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
2022-05-10 19:02:30 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::Checkbox("Spawn in Vehicle", &g->vehicle.pv_teleport_into);
|
2022-05-10 19:02:30 +02:00
|
|
|
|
|
|
|
ImGui::EndGroup();
|
2022-05-04 19:16:40 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|