Don't mark players in missions as joinable (#3444)

* do not mark missions as joinable

* disabled join button
This commit is contained in:
CringeArab 2024-07-27 00:27:50 +03:00 committed by GitHub
parent 187ac86535
commit 995b381053
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 10 deletions

View File

@ -33,7 +33,7 @@ namespace big
if (!player.notify_online) if (!player.notify_online)
return; return;
if (g.player_db.notify_when_joinable && !is_joinable_session(player.session_type) && is_joinable_session(new_session_type)) if (g.player_db.notify_when_joinable && !is_joinable_session(player.session_type, player.game_mode) && is_joinable_session(new_session_type, player.game_mode))
{ {
g_notification_service.push_success("Player DB", std::format("{} is now in a joinable session", player.name)); g_notification_service.push_success("Player DB", std::format("{} is now in a joinable session", player.name));
} }
@ -41,7 +41,7 @@ namespace big
{ {
g_notification_service.push_success("Player DB", std::format("{} is now online", player.name)); g_notification_service.push_success("Player DB", std::format("{} is now online", player.name));
} }
else if (g.player_db.notify_when_unjoinable && is_joinable_session(player.session_type) && !is_joinable_session(new_session_type) && new_session_type != GSType::Invalid) else if (g.player_db.notify_when_unjoinable && is_joinable_session(player.session_type, player.game_mode) && !is_joinable_session(new_session_type, player.game_mode) && new_session_type != GSType::Invalid)
{ {
g_notification_service.push("Player DB", std::format("{} is no longer in a joinable session", player.name)); g_notification_service.push("Player DB", std::format("{} is no longer in a joinable session", player.name));
} }
@ -101,8 +101,7 @@ namespace big
for (auto& player : m_players) for (auto& player : m_players)
{ {
if (player.second->join_redirect && is_joinable_session(player.second->session_type) if (player.second->join_redirect && is_joinable_session(player.second->session_type, player.second->game_mode))
&& current_preference_level < player.second->join_redirect_preference)
{ {
current_preference_level = player.second->join_redirect_preference; current_preference_level = player.second->join_redirect_preference;
preferred_session = player.second->redirect_info; preferred_session = player.second->redirect_info;
@ -528,9 +527,9 @@ namespace big
} }
} }
bool player_database_service::is_joinable_session(GSType type) bool player_database_service::is_joinable_session(GSType type, GameMode mode)
{ {
return type == GSType::Public || type == GSType::OpenCrew; return (type == GSType::Public || type == GSType::OpenCrew) && !can_fetch_name(mode);
} }
const char* player_database_service::get_session_type_str(GSType type) const char* player_database_service::get_session_type_str(GSType type)

View File

@ -57,7 +57,7 @@ namespace big
void start_update_loop(); void start_update_loop();
void update_player_states(bool tracked_only = false); void update_player_states(bool tracked_only = false);
static bool is_joinable_session(GSType type); static bool is_joinable_session(GSType type, GameMode mode);
static const char* get_session_type_str(GSType type); static const char* get_session_type_str(GSType type);
static const char* get_game_mode_str(GameMode mode); static const char* get_game_mode_str(GameMode mode);
static bool can_fetch_name(GameMode mode); static bool can_fetch_name(GameMode mode);

View File

@ -25,7 +25,7 @@ namespace big
return ImVec4(.5f, .5f, .5f, 1.0f); return ImVec4(.5f, .5f, .5f, 1.0f);
else if (player.session_type == GSType::Invalid) else if (player.session_type == GSType::Invalid)
return ImVec4(1.f, 0.f, 0.f, 1.f); return ImVec4(1.f, 0.f, 0.f, 1.f);
else if (!player_database_service::is_joinable_session(player.session_type)) else if (!player_database_service::is_joinable_session(player.session_type, player.game_mode))
return ImVec4(1.f, 1.f, 0.f, 1.f); return ImVec4(1.f, 1.f, 0.f, 1.f);
else else
return ImVec4(0.f, 1.f, 0.f, 1.f); return ImVec4(0.f, 1.f, 0.f, 1.f);
@ -100,13 +100,13 @@ namespace big
for (auto& player : item_arr | std::ranges::views::values) for (auto& player : item_arr | std::ranges::views::values)
{ {
if (player_database_service::is_joinable_session(player->session_type)) if (player_database_service::is_joinable_session(player->session_type, player->game_mode))
draw_player_db_entry(player, lower_search); draw_player_db_entry(player, lower_search);
} }
for (auto& player : item_arr | std::ranges::views::values) for (auto& player : item_arr | std::ranges::views::values)
{ {
if (!player_database_service::is_joinable_session(player->session_type) && player->session_type != GSType::Invalid if (!player_database_service::is_joinable_session(player->session_type, player->game_mode) && player->session_type != GSType::Invalid
&& player->session_type != GSType::Unknown) && player->session_type != GSType::Unknown)
draw_player_db_entry(player, lower_search); draw_player_db_entry(player, lower_search);
} }
@ -228,9 +228,14 @@ namespace big
ImGui::SliderInt("VIEW_NET_PLAYER_DB_PREFERENCE"_T.data(), &current_player->join_redirect_preference, 1, 10); ImGui::SliderInt("VIEW_NET_PLAYER_DB_PREFERENCE"_T.data(), &current_player->join_redirect_preference, 1, 10);
} }
bool joinable =
player_database_service::is_joinable_session(current_player->session_type, current_player->game_mode);
ImGui::BeginDisabled(!joinable);
components::button("JOIN_SESSION"_T, [] { components::button("JOIN_SESSION"_T, [] {
session::join_by_rockstar_id(current_player->rockstar_id); session::join_by_rockstar_id(current_player->rockstar_id);
}); });
ImGui::EndDisabled();
ImGui::SameLine(); ImGui::SameLine();