Player Database Enhancement (#2411)

Added 'Send Friend Request' through the player's rockstar ID.
This commit is contained in:
thehorizon84 2023-11-14 20:20:26 +01:00 committed by GitHub
parent cadb6dab92
commit ef355736a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 7 deletions

View File

@ -1,3 +1,5 @@
#include "backend/bool_command.hpp"
#include "backend/int_command.hpp"
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "services/players/player_service.hpp"
@ -41,6 +43,12 @@ namespace big
STREAMING::SET_FOCUS_ENTITY(target);
if (g.player.override_cam_distance)
CAM::SET_THIRD_PERSON_CAM_ORBIT_DISTANCE_LIMITS_THIS_UPDATE(1.f, (float)g.player.cam_distance);
bReset = false;
}
bool_command g_override_cam_distance("overridecamdistance", "BACKEND_LOOPED_PLAYER_OVERRIDE_CAM_DISTANCE", "BACKEND_LOOPED_PLAYER_OVERRIDE_CAM_DISTANCE_DESC", g.player.override_cam_distance);
int_command g_override_cam_distance_int("overridecamdistanceint", "BACKEND_LOOPED_PLAYER_OVERRIDE_CAM_DISTANCE_INT", "BACKEND_LOOPED_PLAYER_OVERRIDE_CAM_DISTANCE_INT_DESC", g.player.cam_distance, 1, 200);
}

View File

@ -227,9 +227,11 @@ namespace big
struct player
{
bool spectating = false;
bool spectating = false;
bool override_cam_distance = false;
int cam_distance = 10;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(player, spectating)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(player, spectating, override_cam_distance, cam_distance)
} player{};
struct player_db

View File

@ -120,6 +120,8 @@ namespace big::functions
using join_session_by_info = bool (*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
using invite_player_by_gamer_handle = bool(*)(uint64_t config, rage::rlGamerHandle* handle, int unk1, int unk2, int unk3, int unk4);
using add_friend_by_gamer_handle = void(*)(rage::rlGamerHandle* handle, const char* unk);
using show_profile_by_gamer_handle = void(*)(rage::rlGamerHandle* handle);
using generate_uuid = bool (*)(uint64_t* uuid);

View File

@ -163,6 +163,8 @@ namespace big
functions::join_session_by_info m_join_session_by_info;
functions::invite_player_by_gamer_handle m_invite_player_by_gamer_handle;
functions::add_friend_by_gamer_handle m_add_friend_by_gamer_handle;
functions::show_profile_by_gamer_handle m_show_profile_by_gamer_handle;
uint64_t m_network_config;
functions::reset_network_complaints m_reset_network_complaints;

View File

@ -646,6 +646,24 @@ namespace big
g_pointers->m_gta.m_invite_player_by_gamer_handle = ptr.add(1).rip().as<functions::invite_player_by_gamer_handle>();
}
},
// Add Friend By Gamer Handle
{
"AFBGH",
"48 89 5C 24 ? 57 48 83 EC ? 48 8B F9 B1 ? 48 8B DA E8 ? ? ? ? 84 C0 74 ? 8B 15",
[](memory::handle ptr)
{
g_pointers->m_gta.m_add_friend_by_gamer_handle = ptr.as<functions::add_friend_by_gamer_handle>();
}
},
// Show Profile By Gamer Handle
{
"SPBGH",
"E8 ? ? ? ? E9 ? ? ? ? 3D ? ? ? ? 75 ? E8",
[](memory::handle ptr)
{
g_pointers->m_gta.m_show_profile_by_gamer_handle = ptr.add(1).rip().as<functions::show_profile_by_gamer_handle>();
}
},
// Network Config
{
"NC",

View File

@ -170,6 +170,20 @@ namespace big::session
g_notification_service->push_success("Network", "Target player has been invited to your session!");
}
inline void show_profile_by_rockstar_id(uint64_t rid)
{
rage::rlGamerHandle player_handle(rid);
g_pointers->m_gta.m_show_profile_by_gamer_handle(&player_handle);
}
inline void add_friend_by_rockstar_id(uint64_t rid)
{
rage::rlGamerHandle player_handle(rid);
g_pointers->m_gta.m_add_friend_by_gamer_handle(&player_handle, 0);
}
inline void add_infraction(player_ptr player, Infraction infraction, const std::string& custom_reason = "")
{
if (g.debug.fuzzer.enabled)

View File

@ -208,10 +208,22 @@ namespace big
session::join_by_rockstar_id(current_player->rockstar_id);
});
ImGui::SameLine();
components::button("INVITE_PLAYER"_T, [] {
session::invite_by_rockstar_id(current_player->rockstar_id);
});
components::button("VIEW_PLAYER_INFO_SC_PROFILE"_T, [] {
session::show_profile_by_rockstar_id(current_player->rockstar_id);
});
ImGui::SameLine();
components::button("SEND_FRIEND_REQUEST"_T, [] {
session::add_friend_by_rockstar_id(current_player->rockstar_id);
});
static char message[256];
components::input_text("INPUT_MSG"_T, message, sizeof(message));
if (components::button("SEND_MSG"_T))

View File

@ -5,6 +5,7 @@
#include "services/player_database/player_database_service.hpp"
#include "views/view.hpp"
#include "services/gta_data/gta_data_service.hpp"
#include "util/session.hpp"
#include <network/netConnection.hpp>
#include <script/globals/GPBD_FM.hpp>
@ -179,11 +180,7 @@ namespace big
ImGui::SameLine();
if (ImGui::SmallButton("VIEW_PLAYER_INFO_SC_PROFILE"_T.data()))
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);
});
session::show_profile_by_rockstar_id(g_player_service->get_selected()->get_net_data()->m_gamer_handle.m_rockstar_id);
if (CPlayerInfo* player_info = g_player_service->get_selected()->get_player_info(); player_info != nullptr)
{

View File

@ -7,6 +7,14 @@ namespace big
{
ImGui::Checkbox("SPECTATE"_T.data(), &g.player.spectating);
if (g.player.spectating)
{
components::command_checkbox<"overridecamdistance">();
if (g.player.override_cam_distance)
components::command_int_slider<"overridecamdistanceint">();
}
if (g_player_service->get_selected()->is_valid())
{
player_ptr current_player = g_player_service->get_selected();