mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-30 19:43:06 +08:00
Add Garage drop-down to Spawn PV menu (#2171)
* Fixed edge case where a garage that contained only banned vehicles would show if the user was using Spawn Clone. Refactored a large portion of the garage code to be production ready. Formatting changes. * Added singular garage items to the m_garage setter like the Terrorbyte. * Fixed is_blacklisted_vehicle returning an inverted condition. Fixed Garage drop-down not updating properly. * Separated out m_garage's setter into a ctor function. Replaced the 4 singular garages that use an overloaded index with a define to be able to shift them easier when new properties are added. * Removed obsolete and incorrect player.character_slot config entry. Removed deprecated local_player.hpp. Added self::char_slot that is guaranteed to be correct. * Removed extraneous semi-colon. * Added more stuff to fillsnacks. Removed more extraneous usages of MPPLY_LAST_MP_CHAR. * Added the vehicle's name to player info. * Fixed get_property_garage_size returning the incorrect size for the facility. Fixed get_static_property_name returning the Nightclub's name instead of Nightclub Service Entrance to maintain consistency with the Mechanic. Fixed garage_slot_iterator not starting and ending at the correct indexes. * Shifted the singular properties down one to compensate for the new math. * Fixed backwards math on Terrorbyte and Nightclub B1. * Fixed garage not being updated when the player moved the vehicle. * Fixed backwards comments.
This commit is contained in:
@ -4,11 +4,13 @@
|
||||
#include "natives.hpp"
|
||||
#include "services/player_database/player_database_service.hpp"
|
||||
#include "views/view.hpp"
|
||||
#include "services/gta_data/gta_data_service.hpp"
|
||||
|
||||
#include <network/netConnection.hpp>
|
||||
#include <script/globals/GPBD_FM.hpp>
|
||||
#include <script/globals/GPBD_FM_3.hpp>
|
||||
#include <script/globals/GlobalPlayerBD.hpp>
|
||||
#include <vehicle/CVehicleModelInfo.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
@ -48,7 +50,8 @@ namespace big
|
||||
uint32_t ped_health = 0;
|
||||
uint32_t ped_maxhealth = 0;
|
||||
uint32_t veh_damage_bits = 0;
|
||||
std::string mode_str = "";
|
||||
std::string mode_str{};
|
||||
std::string vehicle_name{};
|
||||
|
||||
if (CPed* ped = g_player_service->get_selected()->get_ped(); ped != nullptr)
|
||||
{
|
||||
@ -209,42 +212,47 @@ namespace big
|
||||
|
||||
ImGui::Text("PLAYER_INFO_PROOFS"_T.data(), 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;
|
||||
}
|
||||
mode_str.clear();
|
||||
|
||||
if (ped_task_flag & (uint8_t)ePedTask::TASK_DRIVING)
|
||||
{
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
if (auto vehicle = g_player_service->get_selected()->get_current_vehicle(); vehicle != nullptr)
|
||||
{
|
||||
mode_str = "PLAYER_INFO_GOD"_T;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::COLLISION)
|
||||
{
|
||||
mode_str += "PLAYER_INFO_COLLISION"_T;
|
||||
}
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
|
||||
{
|
||||
mode_str += "PLAYER_INFO_EXPLOSION"_T;
|
||||
}
|
||||
}
|
||||
veh_damage_bits = vehicle->m_damage_bits;
|
||||
|
||||
if (mode_str.empty())
|
||||
{
|
||||
mode_str = "NO"_T;
|
||||
if (CVehicleModelInfo* vehicle_model_info = static_cast<CVehicleModelInfo*>(vehicle->m_model_info))
|
||||
{
|
||||
vehicle_name = g_gta_data_service->vehicles()[vehicle_model_info->m_name].m_display_name;
|
||||
}
|
||||
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::GOD)
|
||||
{
|
||||
mode_str = "PLAYER_INFO_GOD"_T;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::COLLISION)
|
||||
{
|
||||
mode_str += "PLAYER_INFO_COLLISION"_T;
|
||||
}
|
||||
if (veh_damage_bits & (uint32_t)eEntityProofs::EXPLOSION)
|
||||
{
|
||||
mode_str += "PLAYER_INFO_EXPLOSION"_T;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_str.empty())
|
||||
{
|
||||
mode_str = "NO"_T;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mode_str = "PLAYER_INFO_NO_VEHICLE"_T;
|
||||
vehicle_name = "PLAYER_INFO_NO_VEHICLE"_T;
|
||||
}
|
||||
|
||||
ImGui::Text("PLAYER_INFO_VEHICLE_PROOFS"_T.data(), mode_str.c_str());
|
||||
ImGui::Text("PLAYER_INFO_VEHICLE"_T.data(), vehicle_name.c_str(), mode_str.c_str());
|
||||
|
||||
if (auto net_player_data = g_player_service->get_selected()->get_net_data())
|
||||
{
|
||||
|
Reference in New Issue
Block a user