Exemple #1
0
        //IMPORTANT
        //AAAAAAAAA
        //CURRENTLY DOESN'T WORK IN HIDDEN REALMS
        //WHILE IS UP TO CHOICE IF IT DOES OR NOT WHAT I MEAN BY THIS IS THAT IT THROWS A NULL EXCEPTION!!!!!!!!

        //We could probably do this via the game's own SceneExitController but some stages such as the Ambry doesn't have one so we'll create one.
        protected override bool ActivateEquipment(EquipmentSlot slot)
        {
            if (Stage.instance.sceneDef.isFinalStage || UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "moon")
            {
#if DEBUG
                Chat.AddMessage("Turbo Edition: " + EquipmentName + " this is a final stage, won't skip!");
#endif
                return(false);
            }
            if (!(SceneCatalog.mostRecentSceneDef.sceneType == SceneType.Stage))
            {
#if DEBUG
                Chat.AddMessage("Turbo Edition: " + EquipmentName + " current scene is not a stage, won't skip!");
#endif
                return(false);
            }
            int sceneExitCount = InstanceTracker.GetInstancesList <SceneExitController>().Count;
#if DEBUG
            TurboEdition._logger.LogWarning("sceneExitCount: " + sceneExitCount);
#endif
            if (TeleporterInteraction.instance || !SceneExitController.isRunning)
            {
                //Makes sure that theres only the game's own controller, if theres none at least it wont create more than three
                //Increased to two since Bazaar has two
                if (sceneExitCount <= 2)
                {
                    if (TeleporterInteraction.instance.chargeFraction >= 0.99 || Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared"))
                    {
                        SceneExitController sceneExitController = explicitSceneExitController;
                        if (!sceneExitController)
                        {
                            sceneExitController = InstanceTracker.FirstOrNull <SceneExitController>();
#if DEBUG
                            TurboEdition._logger.LogWarning("TE instanceTracker.FirstOrNull: " + sceneExitController);
#endif
                        }
                        SkipStage(sceneExitController);
                        return(true);
                    }
                }
            }
#if DEBUG
            Chat.AddMessage("Turbo Edition: " + EquipmentName + " couldn't skip stage, see log for details.");
            TurboEdition._logger.LogWarning("TE chargeFraction: " + TeleporterInteraction.instance.chargeFraction);
            TurboEdition._logger.LogWarning("TE monstersCleared: " + Reflection.GetFieldValue <bool>(TeleporterInteraction.instance, "monstersCleared"));
            TurboEdition._logger.LogWarning("TE isRunning: " + SceneExitController.isRunning);
#endif
            return(false);
        }