From 04f5db968773cdd28bec8231d0a3ec56e444807f Mon Sep 17 00:00:00 2001 From: Yimura Date: Sat, 16 Jan 2021 13:52:29 +0100 Subject: [PATCH] refactor(PlayerWindow): Restructured in tab bar --- BigBaseV2/src/gui/tab_bar.hpp | 3 + BigBaseV2/src/gui/tab_bar/player/drop.cpp | 22 +++ BigBaseV2/src/gui/tab_bar/player/griefing.cpp | 137 ++++++++++++++++ BigBaseV2/src/gui/tab_bar/player/info.cpp | 14 ++ BigBaseV2/src/gui/tab_bar/player/teleport.cpp | 28 ++++ BigBaseV2/src/gui/windows/player.cpp | 153 +----------------- 6 files changed, 208 insertions(+), 149 deletions(-) create mode 100644 BigBaseV2/src/gui/tab_bar/player/drop.cpp create mode 100644 BigBaseV2/src/gui/tab_bar/player/griefing.cpp create mode 100644 BigBaseV2/src/gui/tab_bar/player/info.cpp create mode 100644 BigBaseV2/src/gui/tab_bar/player/teleport.cpp diff --git a/BigBaseV2/src/gui/tab_bar.hpp b/BigBaseV2/src/gui/tab_bar.hpp index f7ebb75c..8096653f 100644 --- a/BigBaseV2/src/gui/tab_bar.hpp +++ b/BigBaseV2/src/gui/tab_bar.hpp @@ -25,6 +25,9 @@ namespace big static void render_settings(); static void player_info(); + static void player_griefing(); + static void player_teleport(); + static void player_drop(); }; } \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/player/drop.cpp b/BigBaseV2/src/gui/tab_bar/player/drop.cpp new file mode 100644 index 00000000..b0e2f931 --- /dev/null +++ b/BigBaseV2/src/gui/tab_bar/player/drop.cpp @@ -0,0 +1,22 @@ +#include "gui/tab_bar.hpp" + +namespace big +{ + void tabbar::player_drop() + { + if (ImGui::BeginTabItem("Drop")) + { + if (ImGui::Button("Drop Money (!)")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), true); + + features::functions::create_ambient_money(coords, rand() % 500 + 2000); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/player/griefing.cpp b/BigBaseV2/src/gui/tab_bar/player/griefing.cpp new file mode 100644 index 00000000..8bf2173f --- /dev/null +++ b/BigBaseV2/src/gui/tab_bar/player/griefing.cpp @@ -0,0 +1,137 @@ +#include "gui/tab_bar.hpp" +#include "pointers.hpp" + +namespace big +{ + void tabbar::player_griefing() + { + if (ImGui::BeginTabItem("Griefing")) + { + if (ImGui::Button("Cage")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::functions::cage_ped(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id)); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::TreeNode("Lester")) + { + if (ImGui::Button("Bounty 10k")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::functions::set_player_bounty(g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Kick")) + { + if (ImGui::Button("Kick (Host) - Permanently Blacklisted")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + if (NETWORK::NETWORK_IS_HOST()) + { + NETWORK::NETWORK_SESSION_KICK_PLAYER(g_selectedPlayer.id); + } + else + { + features::notify::above_map("You aren't the host"); + } + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("Kick (Non-Host)")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t args[4] = { 0, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 }; + + for (int64_t kick_hash : kick_hashes) + { + args[0] = kick_hash; + + g_pointers->m_trigger_script_event(true, args, 4, 1 << g_selectedPlayer.id); + } + }QUEUE_JOB_END_CLAUSE + } + + ImGui::TreePop(); + } + + if (ImGui::TreeNode("Script Events")) + { + if (ImGui::Button("Kick from Vehicle")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t args[2] = { RemoteEvents::VehicleKick, g_selectedPlayer.id }; + + g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("CEO Kick")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t ceokick[4] = { RemoteEvents::CeoKick, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 }; + + g_pointers->m_trigger_script_event(true, ceokick, 4, 1 << g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("CEO Ban")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t ceoban[4] = { RemoteEvents::CeoBan, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 1, 5 }; + + g_pointers->m_trigger_script_event(true, ceoban, 4, 1 << g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("Send to Job")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t args[2] = { RemoteEvents::ForceMission, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id) }; + + g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::Text("Force TP Location:"); + if (ImGui::BeginCombo("##teleport_location", locations[g_temp.teleport_location].name)) + { + for (uint8_t i = 0; i < IM_ARRAYSIZE(locations); i++) + { + bool is_selected = (g_temp.teleport_location == i); + if (ImGui::Selectable(locations[i].name, is_selected)) + g_temp.teleport_location = i; + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + + ImGui::EndCombo(); + } + if (ImGui::Button("Teleport to selected location.")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + int64_t args[9] = { RemoteEvents::Teleport, g_selectedPlayer.id, 1, -1, 1, locations[g_temp.teleport_location].id, 0,0,0 }; // 1097312011 + g_pointers->m_trigger_script_event(true, args, 9, 1 << g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::TreePop(); + } + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/player/info.cpp b/BigBaseV2/src/gui/tab_bar/player/info.cpp new file mode 100644 index 00000000..3c735480 --- /dev/null +++ b/BigBaseV2/src/gui/tab_bar/player/info.cpp @@ -0,0 +1,14 @@ +#include "gui/tab_bar.hpp" + +namespace big +{ + void tabbar::player_info() + { + if (ImGui::BeginTabItem("Info")) + { + ImGui::Checkbox("Spectate Player", &g_temp.spectate_player); + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/tab_bar/player/teleport.cpp b/BigBaseV2/src/gui/tab_bar/player/teleport.cpp new file mode 100644 index 00000000..442a3bac --- /dev/null +++ b/BigBaseV2/src/gui/tab_bar/player/teleport.cpp @@ -0,0 +1,28 @@ +#include "gui/tab_bar.hpp" + +namespace big +{ + void tabbar::player_teleport() + { + if (ImGui::BeginTabItem("Teleport")) + { + if (ImGui::Button("Teleport to Player")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::teleport::teleport_to_player(g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + if (ImGui::Button("Teleport into Vehicle")) + { + QUEUE_JOB_BEGIN_CLAUSE() + { + features::teleport::teleport_into_player_vehicle(g_selectedPlayer.id); + }QUEUE_JOB_END_CLAUSE + } + + ImGui::EndTabItem(); + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/gui/windows/player.cpp b/BigBaseV2/src/gui/windows/player.cpp index 8ee2e437..97dea118 100644 --- a/BigBaseV2/src/gui/windows/player.cpp +++ b/BigBaseV2/src/gui/windows/player.cpp @@ -1,7 +1,5 @@ #include "gui/window.hpp" #include "gui/tab_bar.hpp" -#include "features.hpp" -#include "pointers.hpp" namespace big { @@ -20,155 +18,12 @@ namespace big } ImGui::BeginTabBar("tabbar_player"); - + tabbar::player_info(); + tabbar::player_griefing(); + tabbar::player_teleport(); + tabbar::player_drop(); ImGui::EndTabBar(); - ImGui::Separator(); - - ImGui::Separator(); - - - if (ImGui::Button("Bounty 10k")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - features::functions::set_player_bounty(g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - ImGui::Separator(); - - if (ImGui::Button("Teleport to Player")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - features::teleport::teleport_to_player(g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("Teleport into Vehicle")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - features::teleport::teleport_into_player_vehicle(g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - ImGui::Separator(); - - if (ImGui::Button("Kick (Host) - Permanently Blacklisted")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - if (NETWORK::NETWORK_IS_HOST()) - { - NETWORK::NETWORK_SESSION_KICK_PLAYER(g_selectedPlayer.id); - } - else - { - features::notify::above_map("You aren't the host"); - } - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("Kick (Non-Host)")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t args[4] = { 0, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 }; - - for (int64_t kick_hash : kick_hashes) - { - args[0] = kick_hash; - - g_pointers->m_trigger_script_event(true, args, 4, 1 << g_selectedPlayer.id); - } - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("Kick from Vehicle")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t args[2] = { RemoteEvents::VehicleKick, g_selectedPlayer.id }; - - g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("CEO Kick")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t ceokick[4] = { RemoteEvents::CeoKick, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 0, 0 }; - - g_pointers->m_trigger_script_event(true, ceokick, 4, 1 << g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("CEO Ban")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t ceoban[4] = { RemoteEvents::CeoBan, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), 1, 5 }; - - g_pointers->m_trigger_script_event(true, ceoban, 4, 1 << g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("Send to Job")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t args[2] = { RemoteEvents::ForceMission, PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id) }; - - g_pointers->m_trigger_script_event(true, args, 2, 1 << g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - ImGui::Text("Force TP Location:"); - if (ImGui::BeginCombo("##teleport_location", locations[g_temp.teleport_location].name)) - { - for (uint8_t i = 0; i < IM_ARRAYSIZE(locations); i++) - { - bool is_selected = (g_temp.teleport_location == i); - if (ImGui::Selectable(locations[i].name, is_selected)) - g_temp.teleport_location = i; - if (is_selected) - ImGui::SetItemDefaultFocus(); - } - - ImGui::EndCombo(); - } - if (ImGui::Button("Teleport to selected location.")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - int64_t args[9] = { RemoteEvents::Teleport, g_selectedPlayer.id, 1, -1, 1, locations[g_temp.teleport_location].id, 0,0,0 }; // 1097312011 - g_pointers->m_trigger_script_event(true, args, 9, 1 << g_selectedPlayer.id); - }QUEUE_JOB_END_CLAUSE - } - - ImGui::Separator(); - - if (ImGui::Button("Drop Money (!)")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - Vector3 coords = ENTITY::GET_ENTITY_COORDS(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id), true); - - features::functions::create_ambient_money(coords, rand() % 500 + 2000); - }QUEUE_JOB_END_CLAUSE - } - - if (ImGui::Button("Cage")) - { - QUEUE_JOB_BEGIN_CLAUSE() - { - features::functions::cage_ped(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(g_selectedPlayer.id)); - }QUEUE_JOB_END_CLAUSE - } - ImGui::End(); } }