Player UI tweaks (#1489)

* Redesigned Player UI

* Formatting
This commit is contained in:
DayibBaba 2023-06-22 10:11:56 +02:00 committed by GitHub
parent 9201cc363b
commit b96fddd8d0
11 changed files with 306 additions and 234 deletions

View File

@ -59,7 +59,7 @@ namespace big
struct navigation_struct
{
const char name[48] = "";
char name[48] = "";
std::function<void()> func = nullptr;
std::map<tabs, navigation_struct> sub_nav{};
rage::joaat_t hash = rage::joaat(name);

View File

@ -15,16 +15,9 @@
#include <script/globals/GPBD_FM_3.hpp>
#include <script/globals/GlobalPlayerBD.hpp>
//Percentage of window space
constexpr auto listbox_width = 0.5f;
constexpr auto listbox_height = 0.2f;
namespace big
{
static ImVec2 get_listbox_dimensions()
{
return {750 * listbox_width, ImGui::GetWindowHeight() * listbox_height};
}
void render_rid_joiner()
{

View File

@ -13,20 +13,11 @@ namespace big
{
void view::player_info()
{
if (ImGui::TreeNode("INFO"_T.data()))
ImGui::BeginGroup();
components::sub_title("Info");
if (ImGui::ListBoxHeader("##infobox", get_listbox_dimensions()))
{
ImGui::Text("PLAYER_INFO_ID"_T.data(), g_player_service->get_selected()->id());
ImGui::Text("PLAYER_INFO_SESSION_HOST"_T.data(),
g_player_service->get_selected()->is_host() ? "YES"_T.data() : "NO"_T.data());
ImGui::Separator();
if (CPlayerInfo* player_info = g_player_service->get_selected()->get_player_info(); player_info != nullptr)
{
ImGui::Text("PLAYER_INFO_WANTED_LEVEL"_T.data(), player_info->m_wanted_level);
}
uint32_t ped_damage_bits = 0;
uint32_t ped_task_flag = 0;
uint32_t ped_health = 0;
@ -42,6 +33,87 @@ namespace big
ped_maxhealth = ped->m_maxhealth;
}
components::options_modal(
"Extra Info",
[ped_health, ped_maxhealth] {
auto id = g_player_service->get_selected()->id();
if (id != -1)
{
auto& stats = scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PlayerStats;
auto& boss_goon = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[id].BossGoon;
if (boss_goon.Language >= 0 && boss_goon.Language < 13)
ImGui::Text("PLAYER_INFO_LANGUAGE"_T.data(), languages[boss_goon.Language].name);
ImGui::Text("PLAYER_INFO_CEO_NAME"_T.data(), boss_goon.GangName);
ImGui::Text("PLAYER_INFO_MC_NAME"_T.data(), boss_goon.ClubhouseName);
ImGui::Text("PLAYER_INFO_WALLET"_T.data(), stats.WalletBalance);
ImGui::Text("PLAYER_INFO_BANK"_T.data(), stats.Money - stats.WalletBalance);
ImGui::Text("PLAYER_INFO_TOTAL_MONEY"_T.data(), stats.Money);
ImGui::Text("PLAYER_INFO_RANK"_T.data(), stats.Rank, stats.RP);
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); // TODO: translate
ImGui::Text("PLAYER_INFO_KD"_T.data(), stats.KdRatio);
ImGui::Text("PLAYER_INFO_KILLS"_T.data(), stats.KillsOnPlayers);
ImGui::Text("PLAYER_INFO_DEATHS"_T.data(), stats.DeathsByPlayers);
ImGui::Text("PLAYER_INFO_PROSTITUTES"_T.data(), stats.ProstitutesFrequented);
ImGui::Text("PLAYER_INFO_LAP_DANCES"_T.data(), stats.LapDancesBought);
ImGui::Text("PLAYER_INFO_MISSIONS_CREATED"_T.data(), stats.MissionsCreated);
ImGui::Text("PLAYER_INFO_METLDOWN_COMPLETE"_T.data(),
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "YES"_T.data() :
"NO"_T.data()); // curious to see if anyone has actually played singleplayer
ImGui::Separator();
}
ImGui::Checkbox("Block Explosions", &g_player_service->get_selected()->block_explosions);
if (ImGui::BeginCombo("CHAT_COMMAND_PERMISSIONS"_T.data(),
COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(
g.session.chat_command_default_access_level)]))
{
for (const auto& [type, name] : COMMAND_ACCESS_LEVELS)
{
if (ImGui::Selectable(name,
type == g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)))
{
g.session.chat_command_default_access_level = type;
g_player_database_service->get_or_create_player(g_player_service->get_selected())->command_access_level = type;
g_player_database_service->save();
}
if (type == g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level))
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
},
false,
"Extra Info");
ImGui::SameLine();
if (ImGui::SmallButton("PLAYER_INFO_ADD_TO_DB"_T.data()))
{
g_player_database_service->get_or_create_player(g_player_service->get_selected());
}
ImGui::SameLine();
if (ImGui::SmallButton("SC Profile"))
g_fiber_pool->queue_job([] {
uint64_t gamerHandle[13];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(g_player_service->get_selected()->id(), (Any*)&gamerHandle, 13);
NETWORK::NETWORK_SHOW_PROFILE_UI((Any*)&gamerHandle);
});
if (CPlayerInfo* player_info = g_player_service->get_selected()->get_player_info(); player_info != nullptr)
{
ImGui::Text("PLAYER_INFO_WANTED_LEVEL"_T.data(), player_info->m_wanted_level);
}
if (ped_damage_bits & (uint32_t)eEntityProofs::GOD)
{
mode_str = "PLAYER_INFO_GOD"_T;
@ -106,8 +178,6 @@ namespace big
ImGui::Text("PLAYER_INFO_VEHICLE_PROOFS"_T.data(), mode_str.c_str());
ImGui::Separator();
if (auto net_player_data = g_player_service->get_selected()->get_net_data())
{
ImGui::Text("PLAYER_INFO_RID"_T.data(), net_player_data->m_gamer_handle.m_rockstar_id);
@ -115,7 +185,7 @@ namespace big
ImGui::SameLine();
ImGui::PushID("##rid");
if (ImGui::Button("COPY"_T.data()))
if (ImGui::SmallButton("COPY"_T.data()))
ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle.m_rockstar_id).data());
ImGui::PopID();
@ -127,82 +197,14 @@ namespace big
ImGui::SameLine();
ImGui::PushID("##ip");
if (ImGui::Button("COPY"_T.data()))
if (ImGui::SmallButton("COPY"_T.data()))
ImGui::SetClipboardText(
std::format("{}.{}.{}.{}:{}", ip.m_field1, ip.m_field2, ip.m_field3, ip.m_field4, port).data());
ImGui::PopID();
}
ImGui::Separator();
auto id = g_player_service->get_selected()->id();
if (id != -1)
{
auto& stats = scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].PlayerStats;
auto& boss_goon = scr_globals::gpbd_fm_3.as<GPBD_FM_3*>()->Entries[id].BossGoon;
if (boss_goon.Language >= 0 && boss_goon.Language < 13)
ImGui::Text("PLAYER_INFO_LANGUAGE"_T.data(), languages[boss_goon.Language].name);
ImGui::Text("PLAYER_INFO_CEO_NAME"_T.data(), boss_goon.GangName);
ImGui::Text("PLAYER_INFO_MC_NAME"_T.data(), boss_goon.ClubhouseName);
ImGui::Text("PLAYER_INFO_WALLET"_T.data(), stats.WalletBalance);
ImGui::Text("PLAYER_INFO_BANK"_T.data(), stats.Money - stats.WalletBalance);
ImGui::Text("PLAYER_INFO_TOTAL_MONEY"_T.data(), stats.Money);
ImGui::Text("PLAYER_INFO_RANK"_T.data(), stats.Rank, stats.RP);
ImGui::Text("Health: %d (MaxHealth: %d)", ped_health, ped_maxhealth); // TODO: translate
ImGui::Text("PLAYER_INFO_KD"_T.data(), stats.KdRatio);
ImGui::Text("PLAYER_INFO_KILLS"_T.data(), stats.KillsOnPlayers);
ImGui::Text("PLAYER_INFO_DEATHS"_T.data(), stats.DeathsByPlayers);
ImGui::Text("PLAYER_INFO_PROSTITUTES"_T.data(), stats.ProstitutesFrequented);
ImGui::Text("PLAYER_INFO_LAP_DANCES"_T.data(), stats.LapDancesBought);
ImGui::Text("PLAYER_INFO_MISSIONS_CREATED"_T.data(), stats.MissionsCreated);
ImGui::Text("PLAYER_INFO_METLDOWN_COMPLETE"_T.data(),
scr_globals::gpbd_fm_1.as<GPBD_FM*>()->Entries[id].MeltdownComplete ? "YES"_T.data() : "NO"_T.data()); // curious to see if anyone has actually played singleplayer
ImGui::Separator();
}
ImGui::Checkbox("Block Explosions", &g_player_service->get_selected()->block_explosions);
if (ImGui::BeginCombo("CHAT_COMMAND_PERMISSIONS"_T.data(),
COMMAND_ACCESS_LEVELS[g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)]))
{
for (const auto& [type, name] : COMMAND_ACCESS_LEVELS)
{
if (ImGui::Selectable(name,
type == g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level)))
{
g.session.chat_command_default_access_level = type;
g_player_database_service->get_or_create_player(g_player_service->get_selected())->command_access_level = type;
g_player_database_service->save();
}
if (type == g_player_service->get_selected()->command_access_level.value_or(g.session.chat_command_default_access_level))
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if (ImGui::Button("PLAYER_INFO_ADD_TO_DB"_T.data()))
{
g_player_database_service->get_or_create_player(g_player_service->get_selected());
}
ImGui::SameLine();
components::button("Open SC Overlay", [] {
uint64_t gamerHandle[13];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(g_player_service->get_selected()->id(), (Any*)&gamerHandle, 13);
NETWORK::NETWORK_SHOW_PROFILE_UI((Any*)&gamerHandle);
});
ImGui::TreePop();
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -6,7 +6,9 @@ namespace big
{
void view::player_kick()
{
if (ImGui::TreeNode("KICK"_T.data()))
ImGui::BeginGroup();
components::sub_title("Kick");
if (ImGui::ListBoxHeader("##kick", get_listbox_dimensions()))
{
auto const is_session_host = [] {
return gta_util::get_network()->m_game_session_ptr->is_host();
@ -14,7 +16,7 @@ namespace big
ImGui::Text("Host/breakup kick require Host");
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
components::player_command_button<"hostkick">(g_player_service->get_selected());
components::player_command_button<"breakup">(g_player_service->get_selected());
@ -35,7 +37,9 @@ namespace big
ImGui::SameLine();
components::player_command_button<"desync">(g_player_service->get_selected());
ImGui::TreePop();
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -7,9 +7,12 @@ namespace big
{
void view::player_misc()
{
if (ImGui::TreeNode("MISC"_T.data()))
ImGui::BeginGroup();
components::sub_title("Misc");
if (ImGui::ListBoxHeader("##misc", get_listbox_dimensions()))
{
components::player_command_button<"joinceo">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"enterint">(g_player_service->get_selected());
components::player_command_button<"copyoutfit">(g_player_service->get_selected());
ImGui::SameLine();
@ -19,19 +22,17 @@ namespace big
components::player_command_button<"givehealth">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"givearmor">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"giveammo">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"giveweaps">(g_player_service->get_selected(), {});
ImGui::Checkbox("OFF_THE_RADAR"_T.data(), &g_player_service->get_selected()->off_radar);
ImGui::Checkbox("NEVER_WANTED"_T.data(), &g_player_service->get_selected()->never_wanted);
ImGui::Checkbox("SEMI_GODMODE"_T.data(), &g_player_service->get_selected()->semi_godmode);
components::button("Gooch Test", [] {
*script_global(1890378).at(289).at(1).as<Player*>() = g_player_service->get_selected()->id();
scripts::start_launcher_script(171);
});
ImGui::TreePop();
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -0,0 +1,140 @@
#include "core/data/apartment_names.hpp"
#include "core/data/warehouse_names.hpp"
#include "util/teleport.hpp"
#include "util/toxic.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
namespace big
{
void view::player_teleport()
{
ImGui::BeginGroup();
components::sub_title("Teleport");
if (ImGui::ListBoxHeader("##teleport", get_listbox_dimensions()))
{
components::player_command_button<"playertp">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"playervehtp">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"bring">(g_player_service->get_selected());
components::button("Waypoint", [] {
Vector3 location;
if (blip::get_blip_location(location, (int)BlipIcons::Waypoint))
entity::load_ground_at_3dcoord(location), teleport::teleport_player_to_coords(g_player_service->get_selected(), location);
});
components::options_modal(
"Interior Teleport",
[] {
components::player_command_button<"intkick">(g_player_service->get_selected(), {});
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
{
for (int i = 1; i < apartment_names.size(); i++)
{
if (ImGui::Selectable(apartment_names[i], i == g.session.send_to_apartment_idx))
{
g.session.send_to_apartment_idx = i;
}
if (i == g.session.send_to_apartment_idx)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::SameLine();
components::player_command_button<"apartmenttp">(g_player_service->get_selected(),
{(uint64_t)g.session.send_to_apartment_idx});
if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx]))
{
for (int i = 1; i < warehouse_names.size(); i++)
{
if (ImGui::Selectable(warehouse_names[i], i == g.session.send_to_warehouse_idx))
{
g.session.send_to_warehouse_idx = i;
}
if (i == g.session.send_to_warehouse_idx)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::SameLine();
components::player_command_button<"warehousetp">(g_player_service->get_selected(),
{(uint64_t)g.session.send_to_warehouse_idx});
components::button("TP_TO_DARTS"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts);
});
ImGui::SameLine();
components::button("TP_TO_FLIGHT_SCHOOL"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool);
});
ImGui::SameLine();
components::button("TP_TO_MAP_CENTER"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling);
});
components::button("TP_TO_SKYDIVE"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive);
});
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {81}, "TP To MOC");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {123}, "TP To Casino");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {124}, "TP To Penthouse");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {128}, "TP To Arcade");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {146}, "TP To Music Locker");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {148}, "TP To Record A Studios");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {149}, "TP To Custom Auto Shop");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {155}, "TP To Agency");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {160}, "TP To Freakshop");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {161}, "TP To Multi Floor Garage");
},
false,
"Interior");
static float new_location[3];
static float current_location[3] = {
g_player_service->get_selected()->get_ped()->m_navigation->get_position()->x,
g_player_service->get_selected()->get_ped()->m_navigation->get_position()->y,
g_player_service->get_selected()->get_ped()->m_navigation->get_position()->z};
components::small_text("Custom TP");
ImGui::SetNextItemWidth(400);
ImGui::InputFloat3("##customlocation", new_location);
components::button("TP", [] {
teleport::teleport_player_to_coords(g_player_service->get_selected(), {new_location[0], new_location[1], new_location[2]});
});
ImGui::SameLine();
if (ImGui::Button("Get current"))
{
std::copy(std::begin(current_location), std::end(current_location), std::begin(new_location));
}
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -2,13 +2,16 @@
#include "core/data/warehouse_names.hpp"
#include "util/teleport.hpp"
#include "util/toxic.hpp"
#include "util/troll.hpp"
#include "views/view.hpp"
namespace big
{
void view::player_toxic()
{
if (ImGui::TreeNode("TOXIC"_T.data()))
ImGui::BeginGroup();
components::sub_title("Toxic");
if (ImGui::ListBoxHeader("##toxic", get_listbox_dimensions()))
{
components::player_command_button<"kill">(g_player_service->get_selected(), {});
ImGui::SameLine();
@ -16,12 +19,13 @@ namespace big
components::player_command_button<"ceokick">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"vehkick">(g_player_service->get_selected(), {});
components::button("Gooch Test", [] {
*script_global(1890378).at(289).at(1).as<Player*>() = g_player_service->get_selected()->id();
scripts::start_launcher_script(171);
});
components::player_command_button<"ragdoll">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"intkick">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"beast">(g_player_service->get_selected(), {});
components::player_command_button<"mission">(g_player_service->get_selected(), {});
@ -46,91 +50,6 @@ namespace big
ImGui::SliderInt("WANTED_LVL"_T.data(), &wanted_level, 0, 5);
ImGui::SameLine();
components::player_command_button<"wanted">(g_player_service->get_selected(), {(uint64_t)wanted_level}, "Set");
components::small_text("TELEPORTS"_T);
if (ImGui::BeginCombo("##apartment", apartment_names[g.session.send_to_apartment_idx]))
{
for (int i = 1; i < apartment_names.size(); i++)
{
if (ImGui::Selectable(apartment_names[i], i == g.session.send_to_apartment_idx))
{
g.session.send_to_apartment_idx = i;
}
if (i == g.session.send_to_apartment_idx)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::SameLine();
components::player_command_button<"apartmenttp">(g_player_service->get_selected(), {(uint64_t)g.session.send_to_apartment_idx});
if (ImGui::BeginCombo("##warehouse", warehouse_names[g.session.send_to_warehouse_idx]))
{
for (int i = 1; i < warehouse_names.size(); i++)
{
if (ImGui::Selectable(warehouse_names[i], i == g.session.send_to_warehouse_idx))
{
g.session.send_to_warehouse_idx = i;
}
if (i == g.session.send_to_warehouse_idx)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
ImGui::SameLine();
components::player_command_button<"warehousetp">(g_player_service->get_selected(), {(uint64_t)g.session.send_to_warehouse_idx});
components::button("TP_TO_DARTS"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::Darts);
});
ImGui::SameLine();
components::button("TP_TO_FLIGHT_SCHOOL"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::PilotSchool);
});
ImGui::SameLine();
components::button("TP_TO_MAP_CENTER"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::ArmWresling);
});
components::button("TP_TO_SKYDIVE"_T, [] {
toxic::start_activity(g_player_service->get_selected(), eActivityType::Skydive);
});
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {81}, "TP To MOC");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {123}, "TP To Casino");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {124}, "TP To Penthouse");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {128}, "TP To Arcade");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {146}, "TP To Music Locker");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {148}, "TP To Record A Studios");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {149}, "TP To Custom Auto Shop");
components::player_command_button<"interiortp">(g_player_service->get_selected(), {155}, "TP To Agency");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {160}, "TP To Freakshop");
ImGui::SameLine();
components::player_command_button<"interiortp">(g_player_service->get_selected(), {161}, "TP To Multi Floor Garage");
ImGui::SameLine();
components::player_command_button<"giveweaps">(g_player_service->get_selected(), {});
ImGui::SameLine();
components::player_command_button<"remweaps">(g_player_service->get_selected(), {});
@ -165,7 +84,6 @@ namespace big
components::button("PLUS_48_MINUTES"_T, [] {
toxic::warp_time_forward(g_player_service->get_selected(), 48 * 60 * 1000);
});
ImGui::SameLine();
components::button("PLUS_96_MINUTES"_T, [] {
toxic::warp_time_forward(g_player_service->get_selected(), 96 * 60 * 1000);
});
@ -192,7 +110,19 @@ namespace big
if (ImGui::IsItemHovered())
ImGui::SetTooltip("PLAYER_TOXIC_BRING_PLAYER_OUT_GOD"_T.data());
ImGui::TreePop();
static int bounty_value = 0;
ImGui::SetNextItemWidth(300);
ImGui::SliderInt("BOUNTY"_T.data(), &bounty_value, 0, 10000);
components::command_checkbox<"anonbounty">();
ImGui::SameLine();
components::button("SET"_T, [] {
troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);
});
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -1,32 +0,0 @@
#include "util/teleport.hpp"
#include "util/troll.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
namespace big
{
void view::player_troll()
{
if (ImGui::TreeNode("TROLL"_T.data()))
{
components::player_command_button<"playertp">(g_player_service->get_selected());
ImGui::SameLine();
components::player_command_button<"bring">(g_player_service->get_selected());
components::player_command_button<"playervehtp">(g_player_service->get_selected());
components::player_command_button<"rcplayer">(g_player_service->get_selected());
static int bounty_value = 0;
ImGui::SliderInt("BOUNTY"_T.data(), &bounty_value, 0, 10000);
ImGui::SameLine();
components::command_checkbox<"anonbounty">();
ImGui::SameLine();
components::button("SET"_T, [] {
troll::set_bounty_on_player(g_player_service->get_selected(), bounty_value, g.session.anonymous_bounty);
});
ImGui::TreePop();
}
}
}

View File

@ -4,7 +4,9 @@ namespace big
{
void view::player_vehicle()
{
if (ImGui::TreeNode("Vehicle"))
ImGui::BeginGroup();
components::sub_title("Vehicle");
if (ImGui::ListBoxHeader("##veh", get_listbox_dimensions()))
{
components::player_command_button<"vehkick">(g_player_service->get_selected(), {});
ImGui::SameLine();
@ -38,7 +40,10 @@ namespace big
ImGui::SameLine();
components::player_command_button<"downgradeveh">(g_player_service->get_selected(), {});
ImGui::TreePop();
components::player_command_button<"rcplayer">(g_player_service->get_selected());
ImGui::ListBoxFooter();
}
ImGui::EndGroup();
}
}

View File

@ -1,19 +1,39 @@
#include "services/gui/gui_service.hpp"
#include "views/view.hpp"
namespace big
{
void view::view_player()
{
ImGui::Text("VIEW_PLAYER_PLAYER_OPTIONS"_T.data(), g_player_service->get_selected()->get_name());
ImGui::Checkbox("SPECTATE"_T.data(), &g.player.spectating);
if (g_player_service->get_selected()->is_valid())
{
player_ptr current_player = g_player_service->get_selected();
navigation_struct& player_tab = g_gui_service->get_navigation().at(tabs::PLAYER);
strcpy(player_tab.name, current_player->get_name());
strcat(player_tab.name, std::format(" ({})", std::to_string(current_player->id())).data());
if (current_player->is_host())
strcat(player_tab.name, " [HOST]");
if (current_player->is_friend())
strcat(player_tab.name, " [FRIEND]");
if (current_player->is_modder)
strcat(player_tab.name, " [MOD]");
view::player_info();
view::player_troll();
ImGui::SameLine();
view::player_teleport();
view::player_kick();
ImGui::SameLine();
view::player_toxic();
view::player_misc();
ImGui::SameLine();
view::player_vehicle();
}
}

View File

@ -4,9 +4,18 @@
#include "gui/components/components.hpp"
#include "util/animator.hpp"
//Percentage of window space
constexpr auto listbox_width = 0.5f;
constexpr auto listbox_height = 0.2f;
namespace big
{
inline ImVec2 get_listbox_dimensions()
{
return {750 * listbox_width, 1000 * listbox_height};
}
class view
{
inline static animator window_animator = animator();
@ -65,7 +74,7 @@ namespace big
static void lua_scripts();
static void player_info();
static void player_troll();
static void player_teleport();
static void player_kick();
static void player_toxic();
static void player_misc();