public static void Init()
 {
     Client.EventMessageReceived += Client_EventMessageReceived;
     //       Client.ClientLevelStarted += Client_ClientLevelStarted;
     Client.ClientJoinedRoom += Client_ClientJoinedRoom;
     MultiMain.Log("initializing");
 }
        private static void Client_EventMessageReceived(string header, string data)
        {
            MultiMain.Log("Message Recieved: " + header + " : " + data);
            if (header != "GMP")
            {
                return;
            }
            if (otherGmpPlayer)
            {
                if (data.Contains("!gmm"))
                {
                    string command = data.ToLower();
                    MultiMain.multiCommands.CheckHealthCommands(command);
                    MultiMain.multiCommands.CheckSizeCommands(command);
                    MultiMain.multiCommands.CheckGameplayCommands(command);
                    MultiMain.multiCommands.CheckSpeedCommands(command);
                }
            }
            else
            {
                if (data == "HasPlugin" + version)
                {
                    if (!GMPUI.AllowMulti)
                    {
                        return;
                    }
                    if (spectating)
                    {
                        return;
                    }
                    otherGmpPlayer = true;
                    if (playerName == "")
                    {
                        playerName = Client.instance.playerInfo.playerName;
                    }
                    Client.instance.playerInfo.playerName += " (GMP)";
                    Client.disableScoreSubmission          = true;
                }

                else if (data.Contains("HavePlugin?"))
                {
                    if (!GMPUI.AllowMulti)
                    {
                        return;
                    }
                    if (spectating)
                    {
                        return;
                    }
                    Client.instance.SendEventMessage("GMP", "HasPlugin" + version);
                }
            }

            if (otherGmpPlayer && !initialized)
            {
                MultiMain.Activate();
                initialized = true;
            }
        }
        public void CheckGameplayCommands(String message)
        {
            if (message.Contains("!gmm da") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("DA"))
            {
                MultiMain.Log("Trying DA");
                //      Plugin.beepSound.Play();

                MultiMain.Powers.StartCoroutine(MultiPowers.TempDA(MultiMain.Config.daDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.daCooldown, "DA", "DA Active."));
                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }

            if (message.Contains("!gmm njsrandom") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("RandomNJS"))
            {
                //         Plugin.beepSound.Play();
                MultiMain.Powers.StartCoroutine(MultiPowers.NjsRandom(MultiMain.Config.njsRandomDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.njsRandomCooldown, "NJSRandom", "Random Note Jump Speed Active."));
                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }
            if (message.Contains("!gmm noarrows") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("NoArrows"))
            {
                //       Plugin.beepSound.Play();
                MultiMain.Powers.StartCoroutine(MultiPowers.TempNoArrows(MultiMain.Config.noArrowsDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.noArrowsCooldown, "NoArrows", "Temporary No Arrows Activated"));
                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }
            if (message.Contains("!gmm funky") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("Funky"))
            {
                //           Plugin.beepSound.Play();
                MultiMain.Powers.StartCoroutine(MultiPowers.Funky(MultiMain.Config.funkyDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.funkyCooldown, "Funky", "Funky Mode Activated"));
                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }
            if (message.Contains("!gmm rainbow") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("Rainbow"))
            {
                //          Plugin.beepSound.Play();
                MultiMain.Powers.StartCoroutine(MultiPowers.Rainbow(MultiMain.Config.rainbowDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.rainbowCooldown, "Rainbow", "Rainbow Activated"));

                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }

            if (message.Contains("!gmm bombs") && message.Contains(MultiClientInterface.version) && !Plugin.cooldowns.GetCooldown("Bombs") && MultiMain.Config.bombChance > 0)
            {
                //                Plugin.beepSound.Play();
                MultiMain.Powers.StartCoroutine(MultiPowers.RandomBombs(MultiMain.Config.bombDuration));
                MultiMain.Powers.StartCoroutine(MultiPowers.CoolDown(MultiMain.Config.bombCooldown, "Bombs", "Sneaking Bombs into the map."));
                Plugin.commandsLeftForMessage -= 1;
                globalActive = true;
            }
        }
 public static void Client_ClientLevelStarted()
 {
     MultiMain.Log("Multiplayer Level Started");
     Client.disableScoreSubmission = false;
     if (!GMPUI.AllowMulti)
     {
         return;
     }
     if (spectating)
     {
         return;
     }
     SharedCoroutineStarter.instance.StartCoroutine(DelayedSendPluginCheck());
     //        Client_EventMessageReceived("GMP", "HasPlugin" + version);
 }
示例#5
0
        public void OnApplicationStart()
        {
            SceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;
            SceneManager.sceneLoaded        += SceneManager_sceneLoaded;
            {
                Log("Creating Harmony Instance");
                harmony = HarmonyInstance.Create("com.kyle1413.BeatSaber.GamePlayModifiersPlus");
            }

            if (PluginManager.Plugins.Any(x => x.Name == "Beat Saber Multiplayer"))
            {
                multi = new GamePlayModifiersPlus.Multiplayer.MultiMain();
                multi.Initialize();
                multiInstalled = true;
                Log("Multiplayer Detected, enabling multiplayer functionality");
            }

            if (PluginManager.Plugins.Any(x => x.Name == "CustomColorsEdit"))
            {
                customColorsInstalled = true;
            }
            if (PluginManager.Plugins.Any(x => x.Name == "BeatSaberChallenges"))
            {
                ChallengeIntegration.AddListeners();
            }

            ReadPrefs();
            cooldowns = new Cooldowns();
            defColorA.SetColor(new Color(1f, 0, 0));
            defColorB.SetColor(new Color(0, .706f, 1));

            if (ModPrefs.GetInt("GameplayModifiersPlus", "GameRumbleSetting", -1, false) != -1)
            {
                Log("Rumble Key Exists");
                setDefaultRumble = true;
            }
        }
 private static void Client_ClientJoinedRoom()
 {
     MultiMain.Log("Joined Room, Logging spectator setting");
     spectating = BeatSaberMultiplayer.Config.Instance.SpectatorMode;
 }
 public static void SendCommand(string command)
 {
     MultiMain.Log("Sending Command: " + command + version);
     Client.Instance.SendEventMessage("GMP", command + version);
 }