Exemplo n.º 1
0
        private static bool ClientLoadoutValid(int connectionId)
        {
            var conn = NetworkServer.connections[connectionId];

            if (conn != null)
            {
                var player = NetworkMatch.m_player_loadout_data[conn.connectionId];
                if (player != null)
                {
                    return(MPModifiers.PlayerModifiersValid(player.m_mp_modifier1, player.m_mp_modifier2));
                }
            }

            return(false);
        }
Exemplo n.º 2
0
 public static void UpdateLobbyStatus()
 {
     if (!MPModifiers.PlayerModifiersValid(Player.Mp_modifier1, Player.Mp_modifier2))
     {
         if (Array.IndexOf(MenuManager.m_mp_status_id, 20) == -1)
         {
             MenuManager.AddMpStatus("MODIFIER(S) DISALLOWED, CHECK CUSTOMIZE MENU", 1f, 20);
         }
     }
     else
     {
         var idx = Array.IndexOf(MenuManager.m_mp_status_id, 20);
         if (idx >= 0)
         {
             MenuManager.m_mp_status_details[idx] = String.Empty;
             MenuManager.m_mp_status_flash[idx]   = 0f;
             MenuManager.m_mp_status_id[idx]      = -1;
         }
     }
 }
Exemplo n.º 3
0
            static void Prefix()
            {
                if (!Overload.NetworkManager.IsServer())
                {
                    return;
                }

                bool[] serverFilters = new bool[8];
                RUtility.BitmaskToBoolArray(MPModPrivateData.ModifierFilterMask, ref serverFilters);

                foreach (var player in NetworkMatch.m_player_loadout_data.Where(x => x.Key > 0))
                {
                    if (!MPModifiers.PlayerModifiersValid(player.Value.m_mp_modifier1, player.Value.m_mp_modifier2))
                    {
                        var conn = NetworkServer.connections[player.Key];
                        if (conn != null)
                        {
                            NetworkServer.SendToClient(conn.connectionId, 86, new StringMessage("This match has disabled modifiers: " + GetDisabledModifiers()));
                            NetworkMatch.RemoveConnectionId(conn.connectionId);
                            GameManager.m_gm.StartCoroutine(DisconnectCoroutine(conn.connectionId));
                        }
                    }
                }
            }
Exemplo n.º 4
0
        private static void Postfix(NetworkMessage msg)
        {
            var connId = msg.conn.connectionId;

            if (connId == 0) // ignore local connection
            {
                return;
            }
            if (!MPTweaks.ClientInfos.TryGetValue(connId, out var clientInfo))
            {
                clientInfo = MPTweaks.ClientCapabilitiesSet(connId, new Dictionary <string, string>());
            }
            Debug.Log("MPTweaks: conn " + connId + " OnLoadoutDataMessage clientInfo is now " + clientInfo.Capabilities.Join());
            if (!MPTweaks.ClientHasMod(connId) && MPTweaks.MatchNeedsMod())
            {
                //LobbyChatMessage chatMsg = new LobbyChatMessage(connId, "SERVER", MpTeam.ANARCHY, "You need OLMOD to join this match", false);
                //NetworkServer.SendToClient(connId, CustomMsgType.LobbyChatToClient, chatMsg);
                NetworkServer.SendToClient(connId, 86, new StringMessage("This match requires OLMod to play."));
                GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId));
            }
            if ((NetworkMatch.GetMatchState() != MatchState.LOBBY && NetworkMatch.GetMatchState() != MatchState.LOBBY_LOAD_COUNTDOWN) && !ClientLoadoutValid(connId))
            {
                NetworkServer.SendToClient(connId, 86, new StringMessage("This match has disabled modifiers.  Please disable these modifiers and try again: " + MPModifiers.GetDisabledModifiers()));
                GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId));
            }
            if (!clientInfo.Capabilities.ContainsKey("ClassicWeaponSpawns") && (MPClassic.matchEnabled || MPModPrivateData.ClassicSpawnsEnabled))
            {
                NetworkServer.SendToClient(connId, 86, new StringMessage("This match has classic weapon spawns and requires OLMod 0.3.6 or greater."));
                GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId));
            }
            if (clientInfo.Capabilities.ContainsKey("ModPrivateData"))
            {
                MPModPrivateDataTransfer.SendTo(connId);
            }
        }
Exemplo n.º 5
0
        private static void Postfix(NetworkMessage msg)
        {
            var connId = msg.conn.connectionId;

            if (connId == 0) // ignore local connection
            {
                return;
            }
            if (!MPTweaks.ClientInfos.TryGetValue(connId, out var clientInfo))
            {
                clientInfo = MPTweaks.ClientCapabilitiesSet(connId, new Dictionary <string, string>());
            }

            /*
             * if (!clientInfo.SupportsTweaks.Contains("proj") && !MPTweaks.IncompatibleMatchReported)
             * {
             *  MPTweaks.IncompatibleMatchReported = true;
             *  string name = NetworkMatch.m_players.TryGetValue(connId, out var playerData) ? playerData.m_name : connId.ToString();
             *  var text = "DISABLED HUNTER SPEED CHANGE! OLD OLMOD: " + name;
             *  Debug.LogFormat("MPTweaks: IncompatibleMatchReported {0}", text);
             *  JIPClientHandlers.SendAddMpStatus(text);
             * }
             */
            Debug.Log("MPTweaks: conn " + connId + " OnLoadoutDataMessage clientInfo is now " + clientInfo.Capabilities.Join());
            if (!MPTweaks.ClientHasMod(connId) && MPTweaks.MatchNeedsMod())
            {
                //LobbyChatMessage chatMsg = new LobbyChatMessage(connId, "SERVER", MpTeam.ANARCHY, "You need OLMOD to join this match", false);
                //NetworkServer.SendToClient(connId, CustomMsgType.LobbyChatToClient, chatMsg);
                NetworkServer.SendToClient(connId, 86, new StringMessage("You need OLMOD to join this match."));
                GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId));
            }
            if ((NetworkMatch.GetMatchState() != MatchState.LOBBY && NetworkMatch.GetMatchState() != MatchState.LOBBY_LOAD_COUNTDOWN) && !ClientLoadoutValid(connId))
            {
                NetworkServer.SendToClient(connId, 86, new StringMessage("This match has disabled modifiers: " + MPModifiers.GetDisabledModifiers()));
                GameManager.m_gm.StartCoroutine(DisconnectCoroutine(connId));
            }
            if (clientInfo.Capabilities.ContainsKey("ModPrivateData"))
            {
                MPModPrivateDataTransfer.SendTo(connId);
            }
        }
Exemplo n.º 6
0
        static bool DrawLast(UIElement uie)
        {
            if (MenuManager.m_menu_micro_state != 0)
            {
                return(MenuManager.m_menu_micro_state == 1 ? DrawLastQuit(uie) : true);
            }
            Vector2 position;

            position.x = 0f;
            position.y = 170f + 62f * 2;
            //uie.DrawMenuSeparator(position - Vector2.up * 40f);
            bool flag = NetworkMatch.m_last_lobby_status != null && NetworkMatch.m_last_lobby_status.m_can_start_now && MPModifiers.PlayerModifiersValid(Player.Mp_modifier1, Player.Mp_modifier2);

            uie.SelectAndDrawCheckboxItem(Loc.LS("START MATCH NOW"), position - Vector2.right * 250f, 0, MenuManager.m_mp_ready_to_start && flag,
                                          !flag || MenuManager.m_mp_ready_vote_timer > 0f, 0.75f, -1);
            //position.y += 62f;
            uie.SelectAndDrawItem(Loc.LS("CUSTOMIZE"), position + Vector2.right * 250f, 1, false, 0.75f, 0.75f);
            position.y += 62f;
            uie.SelectAndDrawItem(Loc.LS("OPTIONS"), position - Vector2.right * 250f, 2, false, 0.75f, 0.75f);
            //position.y += 62f;
            uie.SelectAndDrawItem(Loc.LS("MULTIPLAYER MENU"), position + Vector2.right * 250f, 100, false, 0.75f, 0.75f);
            return(false);
        }
Exemplo n.º 7
0
 static void Prefix()
 {
     MPModifiers.UpdateLobbyStatus();
 }
Exemplo n.º 8
0
            static void Postfix()
            {
                if (MenuManager.m_menu_sub_state == MenuSubState.ACTIVE)
                {
                    // Add status if your modifiers aren't allowed
                    if (MenuManager.m_menu_micro_state != 2)
                    {
                        MPModifiers.UpdateLobbyStatus();
                    }


                    if (!UIManager.PushedSelect(100) && (!MenuManager.option_dir || !UIManager.PushedDir()))
                    {
                        return;
                    }

                    switch (MenuManager.m_menu_micro_state)
                    {
                    // Allowed modifiers button
                    case 6:
                        switch (UIManager.m_menu_selection)
                        {
                        case 8:
                            MenuManager.m_menu_micro_state = 9;
                            MenuManager.UIPulse(2f);
                            MenuManager.PlaySelectSound(1f);
                            return;

                        case 100:
                            MenuManager.m_menu_micro_state = 6;
                            MenuManager.UIPulse(2f);
                            MenuManager.PlaySelectSound(1f);
                            return;

                        default:
                            return;
                        }

                    // Allowed modifiers window
                    case 9:
                        switch (UIManager.m_menu_selection)
                        {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                            MPModifiers.mms_modifier_filter[UIManager.m_menu_selection] = !MPModifiers.mms_modifier_filter[UIManager.m_menu_selection];
                            MenuManager.PlaySelectSound(1f);
                            return;

                        case 100:
                            MenuManager.m_menu_micro_state = 6;
                            MenuManager.UIPulse(2f);
                            MenuManager.PlaySelectSound(1f);
                            return;

                        default:
                            return;
                        }
                    }
                }
            }