public static void PatchModPrivateData(MatchmakerPlayerRequest matchmakerPlayerRequest) { if (!MenuManager.m_mp_lan_match) // LAN includes internet match { return; } MPModPrivateData.MatchMode = MenuManager.mms_mode; MPModPrivateData.RearViewEnabled = RearView.MPMenuManagerEnabled; MPModPrivateData.JIPEnabled = MPJoinInProgress.MenuManagerEnabled || MPJoinInProgress.SingleMatchEnable; MPModPrivateData.TeamCount = MPTeams.MenuManagerTeamCount; MPModPrivateData.LapLimit = ExtMenuManager.mms_ext_lap_limit; MPModPrivateData.MatchNotes = MPServerBrowser.mms_match_notes; MPModPrivateData.SniperPacketsEnabled = true; MPModPrivateData.ScaleRespawnTime = Menus.mms_scale_respawn_time; MPModPrivateData.ModifierFilterMask = RUtility.BoolArrayToBitmask(MPModifiers.mms_modifier_filter); MPModPrivateData.ClassicSpawnsEnabled = Menus.mms_classic_spawns; MPModPrivateData.CtfCarrierBoostEnabled = Menus.mms_ctf_boost; MPModPrivateData.AlwaysCloaked = Menus.mms_always_cloaked; MPModPrivateData.AllowSmash = Menus.mms_allow_smash; MPModPrivateData.MatchTimeLimit = Menus.mms_match_time_limit == 0 ? int.MaxValue : Menus.mms_match_time_limit; MPModPrivateData.AssistScoring = Menus.mms_assist_scoring; if (Menus.mms_mp_projdata_fn == "STOCK") { MPModPrivateData.CustomProjdata = string.Empty; } else { try { MPModPrivateData.CustomProjdata = System.IO.File.ReadAllText(Menus.mms_mp_projdata_fn); } catch (Exception) { Debug.Log("Unable to read custom projdata file: " + Menus.mms_mp_projdata_fn); MPModPrivateData.CustomProjdata = String.Empty; } } var mpd = (PrivateMatchDataMessage)AccessTools.Field(typeof(NetworkMatch), "m_private_data").GetValue(null); MPModPrivateData.HasPassword = mpd.m_password.Contains('_'); matchmakerPlayerRequest.PlayerAttributes["mod_private_data"] = MPModPrivateData.Serialize().ToString(Newtonsoft.Json.Formatting.None); }
public static void PatchModPrivateData(MatchmakerPlayerRequest matchmakerPlayerRequest) { if (!MenuManager.m_mp_lan_match) // LAN includes internet match { return; } MPModPrivateData.MatchMode = MenuManager.mms_mode; MPModPrivateData.RearViewEnabled = RearView.MPMenuManagerEnabled; MPModPrivateData.JIPEnabled = MPJoinInProgress.MenuManagerEnabled || MPJoinInProgress.SingleMatchEnable; MPModPrivateData.TeamCount = MPTeams.MenuManagerTeamCount; MPModPrivateData.LapLimit = ExtMenuManager.mms_ext_lap_limit; MPModPrivateData.MatchNotes = MPServerBrowser.mms_match_notes; MPModPrivateData.SniperPacketsEnabled = true; MPModPrivateData.ScaleRespawnTime = Menus.mms_scale_respawn_time; MPModPrivateData.ModifierFilterMask = RUtility.BoolArrayToBitmask(MPModifiers.mms_modifier_filter); MPModPrivateData.ClassicSpawnsEnabled = Menus.mms_classic_spawns; MPModPrivateData.CtfCarrierBoostEnabled = Menus.mms_ctf_boost; var mpd = (PrivateMatchDataMessage)AccessTools.Field(typeof(NetworkMatch), "m_private_data").GetValue(null); MPModPrivateData.HasPassword = mpd.m_password.Contains('_'); matchmakerPlayerRequest.PlayerAttributes["mod_private_data"] = MPModPrivateData.Serialize().ToString(Newtonsoft.Json.Formatting.None); }