Exemple #1
0
 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;
     matchmakerPlayerRequest.PlayerAttributes["mod_private_data"] = MPModPrivateData.Serialize().ToString(Newtonsoft.Json.Formatting.None);
 }
Exemple #2
0
        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;
            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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 // there's a mode argument but in actual usage this is always NetworkMatch.GetMode()
 // so ignore it here, since the default value MatchMode.NUM means CTF now :(
 static bool Prefix(MatchMode mode, ref string __result)
 {
     __result = MPModPrivateData.GetModeString(NetworkMatch.GetMode());
     return(false);
 }
Exemple #6
0
        static bool Prefix(ref string __result)
        {
            __result = MPModPrivateData.GetModeString(MenuManager.mms_mode);

            return(false);
        }
Exemple #7
0
 public static void OnReceived(string data)
 {
     Debug.LogFormat("MPModPrivateData: received {0}", data);
     MPModPrivateData.Deserialize(JToken.Parse(data));
 }
Exemple #8
0
        public static void SendTo(int connId)
        {
            var mmpdMsg = new StringMessage(MPModPrivateData.Serialize().ToString(Newtonsoft.Json.Formatting.None));

            NetworkServer.SendToClient(connId, ModCustomMsg.MsgModPrivateData, mmpdMsg);
        }