diff --git a/src/core/data/block_join_reasons.hpp b/src/core/data/block_join_reasons.hpp index c3676dea..97296417 100644 --- a/src/core/data/block_join_reasons.hpp +++ b/src/core/data/block_join_reasons.hpp @@ -2,28 +2,132 @@ namespace big { - inline std::unordered_map block_join_reasons = { - {1, "None"}, - {5, "Been Voted Out"}, // You have already been voted out of this game session. - {7, "Incompatible Assets"}, // Failed to join session due to incompatible assets. - {8, "Session Full"}, // The session you're trying to join is currently full. - {9, "Slot Full"}, // The session you're trying to join is currently full of players. - {10, "No Title Update"}, // Please make sure all players have the latest Title Update. - {12, "Invites Disabled"}, // Invites are currently disabled in the session. - {13, "Different Targeting Mode"},// The session you are trying to join is using a different targeting preference. You can change your preference in the Settings tab of the Pause Menu in Grand Theft Auto V. Joining a new GTA Online Session. - {14, "Cheater"},// You are classed as a cheat and can only play with other cheats until you are forgiven. - {16, "Incompatible DLC"},// Incompatible downloadable content. All players must have the latest compatibility pack. - {17, "Crew Only"}, // You are trying to enter a Crew Members only session. - {21, "Session No Longer Exists"},// The session you are trying to join no longer exists. - {22, "Invite Only"},// The session you are trying to join is private. You will need to be invited to join this session. - {26, "Friends Only"}, // The session you are trying to join is friends only. - {23, "Different Build Type"},// The session you are trying to join is a different build type. - {25, "Different Content"}, // The session you are trying to join is not using the same content. - {18, "Bad Sport"},// The session you are trying to join is for people who are not Bad Sports or cheaters - you are a Bad Sport. - {19, "Bad Sports Only"},// The session you are trying to join is for Bad Sports only. - {20, "Cheaters Only"}, // The session you are trying to join is for cheaters only. - {27, "Bad Reputation"}, // Unable to join this session, your account has a bad reputation. - {28, "May Not Exist"}, // Unable to connect to session. The session may no longer exist. - {29, "Premium Race"},// Unable to Join. The session you are trying to join is a Premium Race. Joining and accepting invites is disabled for this mode. + enum block_join_reason_t : int32_t + { + UNK_0 = 0, + + None = 1, + + UNK_2 = 2, + UNK_3 = 3, + UNK_4 = 4, + + // You have already been voted out of this game session. + BeenVotedOut = 5, + + UNK_6 = 6, + + // Failed to join session due to incompatible assets. + IncompatibleAssets = 7, + + // The session you're trying to join is currently full. + SessionFull = 8, + + // The session you're trying to join is currently full of players. + SlotFull = 9, + + // Please make sure all players have the latest Title Update. + NoTitleUpdate = 10, + + UNK_11 = 11, + + // Invites are currently disabled in the session. + InvitesDisabled = 12, + + // The session you are trying to join is using a different targeting preference. You can change your preference in the Settings tab of the Pause Menu in Grand Theft Auto V. Joining a new GTA Online Session. + DifferentTargetingMode = 13, + + // You are classed as a cheat and can only play with other cheats until you are forgiven. + Cheater = 14, + + UNK_15 = 15, + + // Incompatible downloadable content. All players must have the latest compatibility pack. + IncompatibleDLC = 16, + + // You are trying to enter a Crew Members only session. + CrewOnly = 17, + + // The session you are trying to join is for people who are not Bad Sports or cheaters - you are a Bad Sport. + BadSport = 18, + + // The session you are trying to join is for Bad Sports only. + BadSportOnly = 19, + + // The session you are trying to join is for cheaters only. + CheatersOnly = 20, + + // The session you are trying to join no longer exists. + SessionNoLongerExists = 21, + + // The session you are trying to join is private. You will need to be invited to join this session. + InviteOnly = 22, + + // The session you are trying to join is a different build type. + DifferentBuildType = 23, + + UNK_24 = 24, + + // The session you are trying to join is not using the same content. + DifferentContent = 25, + + // The session you are trying to join is friends only. + FriendsOnly = 26, + + // Unable to join this session, your account has a bad reputation. + BadReputation = 27, + + // Unable to connect to session. The session may no longer exist. + MayNotExist = 28, + + // Unable to Join. The session you are trying to join is a Premium Race. Joining and accepting invites is disabled for this mode. + PremiumRace = 29 }; + + inline block_join_reason_t& operator++(block_join_reason_t& reason) + { + reason = static_cast(static_cast(reason) + 1); + + return reason; + } + + inline block_join_reason_t operator++(block_join_reason_t& reason, int32_t) + { + block_join_reason_t a = reason; + ++reason; + return a; + } + + inline constexpr auto block_join_reasons = std::to_array({ + "", // 0 + "None", // 1 + "", // 2 + "", // 3 + "", // 4 + "Been Voted Out", // 5 + "", // 6 + "Incompatible Assets", // 7 + "Session Full", // 8 + "Slot Full", // 9 + "No Title Update", // 10 + "", // 11 + "Invites Disabled", // 12 + "Different Targeting Mode", // 13 + "Cheater", // 14 + "", // 15 + "Incompatible DLC", // 16 + "Crew Only", // 17 + "Bad Sport", // 18 + "Bad Sports Only", // 19 + "Cheaters Only", // 20 + "Session No Longer Exists", // 21 + "Invite Only", // 22 + "Different Build Type", // 23 + "", // 24 + "Different Content", // 25 + "Friends Only", // 26 + "Bad Reputation", // 27 + "May Not Exist", // 28 + "Premium Race" // 29 + }); } \ No newline at end of file diff --git a/src/services/translation_service/translation_service.cpp b/src/services/translation_service/translation_service.cpp index 94bfb0c0..f13d6c87 100644 --- a/src/services/translation_service/translation_service.cpp +++ b/src/services/translation_service/translation_service.cpp @@ -1,5 +1,6 @@ #include "translation_service.hpp" +#include "core/data/block_join_reasons.hpp" #include "fiber_pool.hpp" #include "file_manager.hpp" #include "http_client/http_client.hpp" @@ -313,7 +314,7 @@ namespace big // Tweaks to make it easier for people playing in the China region g.session_browser.filter_multiplexed_sessions = true; g.reactions.chat_spam.block_joins = true; - g.reactions.chat_spam.block_join_reason = 27; + g.reactions.chat_spam.block_join_reason = block_join_reason_t::BadReputation; } if (does_language_exist(preferred_lang)) diff --git a/src/views/network/view_player_database.cpp b/src/views/network/view_player_database.cpp index edf60aa0..fa6f26ee 100644 --- a/src/views/network/view_player_database.cpp +++ b/src/views/network/view_player_database.cpp @@ -153,18 +153,26 @@ namespace big if (ImGui::BeginCombo("BLOCK_JOIN_ALERT"_T.data(), block_join_reasons[current_player->block_join_reason])) { - for (const auto& reason : block_join_reasons) + block_join_reason_t i = block_join_reason_t::None; + for (const auto& reason_str : block_join_reasons) { - if (ImGui::Selectable(reason.second, reason.first == current_player->block_join_reason)) + if (reason_str != "") { - current_player->block_join_reason = reason.first; - g_player_database_service->save(); + const bool is_selected = current_player->block_join_reason == i; + + if (ImGui::Selectable(reason_str, is_selected)) + { + current_player->block_join_reason = i; + g_player_database_service->save(); + } + + if (is_selected) + { + ImGui::SetItemDefaultFocus(); + } } - if (reason.first == current_player->block_join_reason) - { - ImGui::SetItemDefaultFocus(); - } + i++; } ImGui::EndCombo(); diff --git a/src/views/settings/view_reaction_settings.cpp b/src/views/settings/view_reaction_settings.cpp index 86611d4f..b535949f 100644 --- a/src/views/settings/view_reaction_settings.cpp +++ b/src/views/settings/view_reaction_settings.cpp @@ -1,5 +1,5 @@ -#include "views/view.hpp" #include "core/data/block_join_reasons.hpp" +#include "views/view.hpp" namespace big { @@ -28,14 +28,25 @@ namespace big if (reaction.block_joins) if (ImGui::BeginCombo("BLOCK_JOIN_ALERT"_T.data(), block_join_reasons[reaction.block_join_reason])) { - for (const auto& [key, value] : block_join_reasons) + block_join_reason_t i = block_join_reason_t::None; + for (const auto& reason_str : block_join_reasons) { - bool is_selected = (reaction.block_join_reason == key); + if (reason_str != "") + { + const bool is_selected = reaction.block_join_reason == i; - if (ImGui::Selectable(value, is_selected)) - reaction.block_join_reason = key; - if (is_selected) - ImGui::SetItemDefaultFocus(); + if (ImGui::Selectable(reason_str, is_selected)) + { + reaction.block_join_reason = i; + } + + if (is_selected) + { + ImGui::SetItemDefaultFocus(); + } + } + + i++; } ImGui::EndCombo(); } @@ -62,14 +73,25 @@ namespace big if (reaction.block_joins) if (ImGui::BeginCombo("BLOCK_JOIN_ALERT"_T.data(), block_join_reasons[reaction.block_join_reason])) { - for (const auto& [key, value] : block_join_reasons) + block_join_reason_t i = block_join_reason_t::None; + for (const auto& reason_str : block_join_reasons) { - bool is_selected = (reaction.block_join_reason == key); + if (reason_str != "") + { + const bool is_selected = reaction.block_join_reason == i; - if (ImGui::Selectable(value, is_selected)) - reaction.block_join_reason = key; - if (is_selected) - ImGui::SetItemDefaultFocus(); + if (ImGui::Selectable(reason_str, is_selected)) + { + reaction.block_join_reason = i; + } + + if (is_selected) + { + ImGui::SetItemDefaultFocus(); + } + } + + i++; } ImGui::EndCombo(); }