Beispiel #1
0
        public static void ToggleNKGrimm()
        {
            if (!DebugMod.GrimmTroupe())
            {
                Console.AddLine("Nightmare King Grimm does not exist on this patch");
                return;
            }

            if (PlayerData.instance.GetBoolInternal("killedNightmareGrimm") || PlayerData.instance.GetBoolInternal("destroyedNightmareLantern"))
            {
                PlayerData.instance.SetBoolInternal("troupeInTown", true);
                PlayerData.instance.SetBoolInternal("killedNightmareGrimm", false);
                PlayerData.instance.SetBoolInternal("destroyedNightmareLantern", false);
                PlayerData.instance.SetIntInternal("grimmChildLevel", 3);
                PlayerData.instance.SetIntInternal("flamesCollected", 3);
                PlayerData.instance.SetBoolInternal("grimmchildAwoken", false);
                PlayerData.instance.SetBoolInternal("metGrimm", true);
                PlayerData.instance.SetBoolInternal("foughtGrimm", true);
                PlayerData.instance.SetBoolInternal("killedGrimm", true);
            }
            else
            {
                PlayerData.instance.SetBoolInternal("troupeInTown", false);
                PlayerData.instance.SetBoolInternal("killedNightmareGrimm", true);
            }

            Console.AddLine("Set Nightmare King Grimm killed: " + PlayerData.instance.GetBoolInternal("killedNightmareGrimm"));
        }
Beispiel #2
0
 public static void RespawnGhost()
 {
     if (ghostFound)
     {
         PlayerData.instance.GetType().GetField(ghostData[DebugMod.GetSceneName()]).SetValue(PlayerData.instance, 0);
         Console.AddLine("Ghost Boss for this scene was reset, re-enter scene or warp");
     }
     else
     {
         Console.AddLine("No ghost in this scene to respawn");
     }
 }
Beispiel #3
0
 public static void RespawnBoss()
 {
     if (bossFound)
     {
         if (bossData[DebugMod.GetSceneName()].Key)
         {
             PlayMakerFSM[] components = GameObject.Find(bossData[DebugMod.GetSceneName()].Value).GetComponents <PlayMakerFSM>();
             if (components != null)
             {
                 foreach (PlayMakerFSM playMakerFSM in components)
                 {
                     if (playMakerFSM.FsmVariables.GetFsmBool("Activated") != null)
                     {
                         playMakerFSM.FsmVariables.GetFsmBool("Activated").Value = false;
                         Console.AddLine("Boss control for this scene was reset, re-enter scene or warp");
                     }
                 }
             }
             else
             {
                 Console.AddLine("GO does not exist or no FSM on it");
             }
         }
         else
         {
             if (bossData[DebugMod.GetSceneName()].Value == "killedGrimm")
             {
                 PlayerData.instance.SetIntInternal("grimmChildLevel", 2);
                 PlayerData.instance.SetIntInternal("flamesCollected", 3);
                 PlayerData.instance.SetBoolInternal("grimmChildAwoken", false);
                 PlayerData.instance.SetBoolInternal("foughtGrimm", false);
                 PlayerData.instance.SetBoolInternal("killedGrimm", false);
             }
             else
             {
                 PlayerData.instance.GetType().GetField(bossData[DebugMod.GetSceneName()].Value).SetValue(PlayerData.instance, false);
             }
             Console.AddLine("Boss control for this scene was reset, re-enter scene or warp");
         }
     }
     else
     {
         Console.AddLine("No boss in this scene to respawn");
     }
 }
Beispiel #4
0
        public static void IncreaseGrimmchildLevel()
        {
            if (!DebugMod.GrimmTroupe())
            {
                Console.AddLine("Grimmchild does not exist on this patch");
                return;
            }

            if (!PlayerData.instance.GetBoolInternal("gotCharm_40"))
            {
                PlayerData.instance.SetBoolInternal("gotCharm_40", true);
            }

            PlayerData.instance.SetIntInternal("grimmChildLevel", PlayerData.instance.GetIntInternal("grimmChildLevel") + 1);

            if (PlayerData.instance.GetIntInternal("grimmChildLevel") >= 6)
            {
                PlayerData.instance.SetIntInternal("grimmChildLevel", 0);
            }
        }
Beispiel #5
0
        public static void GiveAllCharms()
        {
            for (int i = 1; i <= 40; i++)
            {
                PlayerData.instance.SetBoolInternal("gotCharm_" + i, true);

                if (i == 36 && !DebugMod.GrimmTroupe())
                {
                    break;
                }
            }

            PlayerData.instance.charmSlots               = 10;
            PlayerData.instance.hasCharm                 = true;
            PlayerData.instance.charmsOwned              = 40;
            PlayerData.instance.royalCharmState          = 4;
            PlayerData.instance.gotKingFragment          = true;
            PlayerData.instance.gotQueenFragment         = true;
            PlayerData.instance.notchShroomOgres         = true;
            PlayerData.instance.notchFogCanyon           = true;
            PlayerData.instance.colosseumBronzeOpened    = true;
            PlayerData.instance.colosseumBronzeCompleted = true;
            PlayerData.instance.salubraNotch1            = true;
            PlayerData.instance.salubraNotch2            = true;
            PlayerData.instance.salubraNotch3            = true;
            PlayerData.instance.salubraNotch4            = true;

            if (DebugMod.GrimmTroupe())
            {
                PlayerData.instance.SetBoolInternal("fragileGreed_unbreakable", true);
                PlayerData.instance.SetBoolInternal("fragileHealth_unbreakable", true);
                PlayerData.instance.SetBoolInternal("fragileStrength_unbreakable", true);
                PlayerData.instance.SetIntInternal("grimmChildLevel", 5);
                PlayerData.instance.charmSlots = 11;
            }

            Console.AddLine("Added all charms to inventory");
        }
        public void Update()
        {
            InfoPanel.Update();
            TopMenu.Update();
            EnemiesPanel.Update();
            Console.Update();
            KeyBindPanel.Update();

            if (DebugMod.GetSceneName() != "Menu_Title")
            {
                //Handle keybinds
                foreach (KeyValuePair <string, int> bind in DebugMod.settings.binds)
                {
                    if (DebugMod.bindMethods.ContainsKey(bind.Key))
                    {
                        if ((KeyCode)bind.Value == KeyCode.None)
                        {
                            foreach (KeyCode kc in Enum.GetValues(typeof(KeyCode)))
                            {
                                if (Input.GetKeyDown(kc))
                                {
                                    if (KeyBindPanel.keyWarning != kc)
                                    {
                                        foreach (KeyValuePair <string, int> kvp in DebugMod.settings.binds)
                                        {
                                            if (kvp.Value == (int)kc)
                                            {
                                                Console.AddLine(kc.ToString() + " already bound to " + kvp.Key + ", press again to confirm");
                                                KeyBindPanel.keyWarning = kc;
                                            }
                                        }

                                        if (KeyBindPanel.keyWarning == kc)
                                        {
                                            break;
                                        }
                                    }

                                    KeyBindPanel.keyWarning = KeyCode.None;

                                    DebugMod.settings.binds[bind.Key] = (int)kc;
                                    KeyBindPanel.UpdateHelpText();
                                    break;
                                }
                            }
                        }
                        else if (Input.GetKeyDown((KeyCode)bind.Value))
                        {
                            try
                            {
                                ((MethodInfo)DebugMod.bindMethods[bind.Key].Second).Invoke(null, null);
                            }
                            catch (Exception e)
                            {
                                DebugMod.instance.LogError("Error running keybind method " + bind.Key + ":\n" + e.ToString());
                            }
                        }
                    }
                    else
                    {
                        DebugMod.instance.LogWarn("Bind found without matching method, removing from binds: " + bind.Key);
                        DebugMod.settings.binds.Remove(bind.Key);
                    }
                }

                if (DebugMod.infiniteSoul && PlayerData.instance.MPCharge < PlayerData.instance.maxMP && PlayerData.instance.health > 0 && !HeroController.instance.cState.dead && GameManager.instance.IsGameplayScene())
                {
                    PlayerData.instance.MPCharge = PlayerData.instance.maxMP;
                }

                if (DebugMod.playerInvincible && PlayerData.instance != null)
                {
                    PlayerData.instance.isInvincible = true;
                }

                if (DebugMod.noclip)
                {
                    if (DebugMod.IH.inputActions.left.IsPressed)
                    {
                        DebugMod.noclipPos = new Vector3(DebugMod.noclipPos.x - Time.deltaTime * 20f, DebugMod.noclipPos.y, DebugMod.noclipPos.z);
                    }

                    if (DebugMod.IH.inputActions.right.IsPressed)
                    {
                        DebugMod.noclipPos = new Vector3(DebugMod.noclipPos.x + Time.deltaTime * 20f, DebugMod.noclipPos.y, DebugMod.noclipPos.z);
                    }

                    if (DebugMod.IH.inputActions.up.IsPressed)
                    {
                        DebugMod.noclipPos = new Vector3(DebugMod.noclipPos.x, DebugMod.noclipPos.y + Time.deltaTime * 20f, DebugMod.noclipPos.z);
                    }

                    if (DebugMod.IH.inputActions.down.IsPressed)
                    {
                        DebugMod.noclipPos = new Vector3(DebugMod.noclipPos.x, DebugMod.noclipPos.y - Time.deltaTime * 20f, DebugMod.noclipPos.z);
                    }

                    if (HeroController.instance.transitionState.ToString() == "WAITING_TO_TRANSITION")
                    {
                        DebugMod.RefKnight.transform.position = DebugMod.noclipPos;
                    }
                    else
                    {
                        DebugMod.noclipPos = DebugMod.RefKnight.transform.position;
                    }
                }

                if (DebugMod.IH.inputActions.pause.WasPressed && DebugMod.GM.IsGamePaused())
                {
                    UIManager.instance.TogglePauseGame();
                }

                if (DebugMod.cameraFollow)
                {
                    BindableFunctions.cameraGameplayScene.SetValue(DebugMod.RefCamera, false);
                    DebugMod.RefCamera.SnapTo(DebugMod.RefKnight.transform.position.x, DebugMod.RefKnight.transform.position.y);
                }

                if (PlayerDeathWatcher.PlayerDied())
                {
                    PlayerDeathWatcher.LogDeathDetails();
                }

                if (PlayerData.instance.hazardRespawnLocation != hazardLocation)
                {
                    hazardLocation = PlayerData.instance.hazardRespawnLocation;
                    Console.AddLine("Hazard Respawn location updated: " + hazardLocation.ToString());

                    if (DebugMod.settings.EnemiesPanelVisible)
                    {
                        EnemiesPanel.EnemyUpdate(200f);
                    }
                }
                if (!string.IsNullOrEmpty(respawnSceneWatch) && respawnSceneWatch != PlayerData.instance.respawnScene)
                {
                    respawnSceneWatch = PlayerData.instance.respawnScene;
                    Console.AddLine(string.Concat(new string[]
                    {
                        "Save Respawn updated, new scene: ",
                        PlayerData.instance.respawnScene.ToString(),
                        ", Map Zone: ",
                        GameManager.instance.GetCurrentMapZone(),
                        ", Respawn Marker: ",
                        PlayerData.instance.respawnMarkerName.ToString()
                    }));
                }
            }
        }
Beispiel #7
0
 public static void ForcePause()
 {
     try
     {
         if ((PlayerData.instance.disablePause || (bool)TimeSlowed.GetValue(GameManager.instance) || (bool)IgnoreUnpause.GetValue(UIManager.instance)) && DebugMod.GetSceneName() != "Menu_Title" && DebugMod.GM.IsGameplayScene())
         {
             TimeSlowed.SetValue(GameManager.instance, false);
             IgnoreUnpause.SetValue(UIManager.instance, false);
             PlayerData.instance.disablePause = false;
             UIManager.instance.TogglePauseGame();
             Console.AddLine("Forcing Pause Menu because pause is disabled");
         }
         else
         {
             Console.AddLine("Game does not report that Pause is disabled, requesting it normally.");
             UIManager.instance.TogglePauseGame();
         }
     }
     catch (Exception e)
     {
         Console.AddLine("Error while attempting to pause, check ModLog.txt");
         DebugMod.instance.Log("Error while attempting force pause:\n" + e);
     }
 }
        public static void Update()
        {
            if (panel == null)
            {
                return;
            }

            if (DebugMod.GM == null)
            {
                return;
            }

            if (DebugMod.GM.IsNonGameplayScene())
            {
                if (panel.active)
                {
                    panel.SetActive(false, true);
                }

                return;
            }

            if (DebugMod.settings.InfoPanelVisible && !panel.active)
            {
                panel.SetActive(true, false);
            }
            else if (!DebugMod.settings.InfoPanelVisible && panel.active)
            {
                panel.SetActive(false, true);
            }

            if (panel.active)
            {
                PlayerData.instance.CountGameCompletion();

                panel.GetText("Hero State").UpdateText(HeroController.instance.hero_state.ToString());
                panel.GetText("Velocity").UpdateText(HeroController.instance.current_velocity.ToString());
                panel.GetText("Nail Damage").UpdateText(DebugMod.RefKnightSlash.FsmVariables.GetFsmInt("damageDealt").Value + " (Flat " + PlayerData.instance.nailDamage + ", x" + DebugMod.RefKnightSlash.FsmVariables.GetFsmFloat("Multiplier").Value + ")");
                panel.GetText("HP").UpdateText(PlayerData.instance.health + " / " + PlayerData.instance.maxHealth);
                panel.GetText("MP").UpdateText((PlayerData.instance.MPCharge + PlayerData.instance.MPReserve).ToString());

                panel.GetText("Completion").UpdateText(PlayerData.instance.completionPercentage.ToString());
                panel.GetText("Grubs").UpdateText(PlayerData.instance.grubsCollected + " / 46");

                panel.GetText("isInvuln").UpdateText(GetStringForBool(HeroController.instance.cState.invulnerable));
                panel.GetText("Invincible").UpdateText(GetStringForBool(PlayerData.instance.isInvincible));
                panel.GetText("Invincitest").UpdateText(GetStringForBool(PlayerData.instance.invinciTest));
                panel.GetText("Damage State").UpdateText(HeroController.instance.damageMode.ToString());
                panel.GetText("Dead State").UpdateText(GetStringForBool(HeroController.instance.cState.dead));
                panel.GetText("Hazard Death").UpdateText(HeroController.instance.cState.hazardDeath.ToString());

                panel.GetText("Scene Name").UpdateText(DebugMod.GetSceneName());
                panel.GetText("Transition").UpdateText(GetStringForBool(HeroController.instance.cState.transitioning));

                string transState = HeroController.instance.transitionState.ToString();
                if (transState == "WAITING_TO_ENTER_LEVEL")
                {
                    transState = "LOADING";
                }
                if (transState == "WAITING_TO_TRANSITION")
                {
                    transState = "WAITING";
                }

                panel.GetText("Trans State").UpdateText(transState);
                panel.GetText("is Gameplay").UpdateText(GetStringForBool(DebugMod.GM.IsGameplayScene()));
                panel.GetText("Game State").UpdateText(GameManager.instance.gameState.ToString());
                panel.GetText("UI State").UpdateText(UIManager.instance.uiState.ToString());
                panel.GetText("Hero Paused").UpdateText(GetStringForBool(HeroController.instance.cState.isPaused));
                panel.GetText("Camera Mode").UpdateText(DebugMod.RefCamera.mode.ToString());

                panel.GetText("Accept Input").UpdateText(GetStringForBool(HeroController.instance.acceptingInput));
                panel.GetText("Relinquished").UpdateText(GetStringForBool(HeroController.instance.controlReqlinquished));
                panel.GetText("atBench").UpdateText(GetStringForBool(PlayerData.instance.atBench));

                panel.GetText("Dashing").UpdateText(GetStringForBool(HeroController.instance.cState.dashing));
                panel.GetText("Jumping").UpdateText(GetStringForBool((HeroController.instance.cState.jumping || HeroController.instance.cState.doubleJumping)));
                panel.GetText("Superdashing").UpdateText(GetStringForBool(HeroController.instance.cState.superDashing));
                panel.GetText("Falling").UpdateText(GetStringForBool(HeroController.instance.cState.falling));
                panel.GetText("Hardland").UpdateText(GetStringForBool(HeroController.instance.cState.willHardLand));
                panel.GetText("Swimming").UpdateText(GetStringForBool(HeroController.instance.cState.swimming));
                panel.GetText("Recoiling").UpdateText(GetStringForBool(HeroController.instance.cState.recoiling));

                panel.GetText("Wall lock").UpdateText(GetStringForBool(HeroController.instance.wallLocked));
                panel.GetText("Wall jumping").UpdateText(GetStringForBool(HeroController.instance.cState.wallJumping));
                panel.GetText("Wall touching").UpdateText(GetStringForBool(HeroController.instance.cState.touchingWall));
                panel.GetText("Wall sliding").UpdateText(GetStringForBool(HeroController.instance.cState.wallSliding));
                panel.GetText("Wall left").UpdateText(GetStringForBool(HeroController.instance.touchingWallL));
                panel.GetText("Wall right").UpdateText(GetStringForBool(HeroController.instance.touchingWallR));

                panel.GetText("Attacking").UpdateText(GetStringForBool(HeroController.instance.cState.attacking));
                panel.GetText("canCast").UpdateText(GetStringForBool(HeroController.instance.CanCast()));
                panel.GetText("canSuperdash").UpdateText(GetStringForBool(HeroController.instance.CanSuperDash()));
                panel.GetText("canQuickmap").UpdateText(GetStringForBool(HeroController.instance.CanQuickMap()));
                panel.GetText("canInventory").UpdateText(GetStringForBool(HeroController.instance.CanOpenInventory()));
                panel.GetText("canWarp").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Dream Warp Allowed").Value));
                panel.GetText("canDGate").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Can Dream Gate").Value));
                panel.GetText("gateAllow").UpdateText(GetStringForBool(DebugMod.RefDreamNail.FsmVariables.GetFsmBool("Dream Gate Allowed").Value));

                int time1 = Mathf.FloorToInt(Time.realtimeSinceStartup / 60f);
                int time2 = Mathf.FloorToInt(Time.realtimeSinceStartup - (float)(time1 * 60));

                panel.GetText("Right1").UpdateText(string.Format("{0:00}:{1:00}", time1, time2) + "\n" + DebugMod.GetLoadTime() + "s\n" + (Vector2)DebugMod.RefKnight.transform.position + "\n" + string.Format("L: {0} R: {1}", DebugMod.IH.inputActions.left.RawValue, DebugMod.IH.inputActions.right.RawValue));
                panel.GetText("Right2").UpdateText(DebugMod.IH.inputActions.moveVector.Vector.x + ", " + DebugMod.IH.inputActions.moveVector.Vector.y + "\n" + GetStringForBool(InputManager.AnyKeyIsPressed) + "\n" + GetStringForBool(DebugMod.IH.inputActions.left.IsPressed || DebugMod.IH.inputActions.right.IsPressed) + "\n" + DebugMod.IH.inputX);
            }
        }
Beispiel #9
0
        public override void Initialize()
        {
            instance = this;

            instance.Log("Initializing");

            float startTime = Time.realtimeSinceStartup;

            instance.Log("Building MethodInfo dict...");

            bindMethods.Clear();
            foreach (MethodInfo method in typeof(BindableFunctions).GetMethods(BindingFlags.Public | BindingFlags.Static))
            {
                object[] attributes = method.GetCustomAttributes(typeof(BindableMethod), false);

                if (attributes.Any())
                {
                    BindableMethod attr = (BindableMethod)attributes[0];
                    string         name = attr.name;
                    string         cat  = attr.category;

                    bindMethods.Add(name, new Pair(cat, method));
                }
            }

            instance.Log("Done! Time taken: " + (Time.realtimeSinceStartup - startTime) + "s. Found " + bindMethods.Count + " methods");

            settings = GlobalSettings;

            if (settings.FirstRun)
            {
                instance.Log("First run detected, setting default binds");

                settings.FirstRun = false;
                settings.binds.Clear();

                settings.binds.Add("Toggle All UI", (int)KeyCode.F1);
                settings.binds.Add("Toggle Info", (int)KeyCode.F2);
                settings.binds.Add("Toggle Menu", (int)KeyCode.F3);
                settings.binds.Add("Toggle Console", (int)KeyCode.F4);
                settings.binds.Add("Force Pause", (int)KeyCode.F5);
                settings.binds.Add("Hazard Respawn", (int)KeyCode.F6);
                settings.binds.Add("Set Respawn", (int)KeyCode.F7);
                settings.binds.Add("Force Camera Follow", (int)KeyCode.F8);
                settings.binds.Add("Toggle Enemy Panel", (int)KeyCode.F9);
                settings.binds.Add("Self Damage", (int)KeyCode.F10);
                settings.binds.Add("Toggle Binds", (int)KeyCode.BackQuote);
                settings.binds.Add("Nail Damage +4", (int)KeyCode.Equals);
                settings.binds.Add("Nail Damage -4", (int)KeyCode.Minus);
                settings.binds.Add("Increase Timescale", (int)KeyCode.KeypadPlus);
                settings.binds.Add("Decrease Timescale", (int)KeyCode.KeypadMinus);
                settings.binds.Add("Toggle Hero Light", (int)KeyCode.Home);
                settings.binds.Add("Toggle Vignette", (int)KeyCode.Insert);
                settings.binds.Add("Zoom In", (int)KeyCode.PageUp);
                settings.binds.Add("Zoom Out", (int)KeyCode.PageDown);
                settings.binds.Add("Reset Camera Zoom", (int)KeyCode.End);
                settings.binds.Add("Toggle HUD", (int)KeyCode.Delete);
                settings.binds.Add("Hide Hero", (int)KeyCode.Backspace);
            }

            UnityEngine.SceneManagement.SceneManager.activeSceneChanged += LevelActivated;
            GameObject UIObj = new GameObject();

            UIObj.AddComponent <GUIController>();
            GameObject.DontDestroyOnLoad(UIObj);

            ModHooks.Instance.SavegameLoadHook    += LoadCharacter;
            ModHooks.Instance.NewGameHook         += NewCharacter;
            ModHooks.Instance.BeforeSceneLoadHook += OnLevelUnload;
            ModHooks.Instance.TakeHealthHook      += PlayerDamaged;
            ModHooks.Instance.ApplicationQuitHook += SaveSettings;

            BossHandler.PopulateBossLists();
            GUIController.Instance.BuildMenus();

            Console.AddLine("New session started " + DateTime.Now);
        }
        public static void RespawnBoss()
        {
            if (bossFound)
            {
                if (bossData[DebugMod.GetSceneName()].Key)
                {
                    SceneAdditiveLoadConditional bossLoader =
                        GameObject.Find("BossLoader")?.GetComponent <SceneAdditiveLoadConditional>();

                    if (bossLoader != null)
                    {
                        Console.AddLine(bossLoader.ToString());
                        Console.AddLine(bossLoader.sceneNameToLoad);
                    }

                    IEnumerator ResetBoss(string scene)
                    {
                        if (bossLoader != null && scene != null)
                        {
                            yield return(null);

                            yield return(UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(scene,
                                                                                                 LoadSceneMode.Additive));

                            FieldInfo fi = typeof(SceneAdditiveLoadConditional).GetField("sceneLoaded",
                                                                                         BindingFlags.Instance | BindingFlags.NonPublic);

                            fi.SetValue(bossLoader, true);
                            yield return(null);

                            GameManager.instance.LoadedBoss();
                        }

                        PlayMakerFSM[] components = GameObject.Find(bossData[DebugMod.GetSceneName()].Value)
                                                    .GetComponents <PlayMakerFSM>();

                        if (components != null)
                        {
                            foreach (PlayMakerFSM playMakerFSM in components)
                            {
                                if (playMakerFSM.FsmVariables.GetFsmBool("Activated") != null)
                                {
                                    Modding.Logger.Log(playMakerFSM.Fsm.GetFsmBool("Activated").Value);
                                    playMakerFSM.FsmVariables.GetFsmBool("Activated").Value = false;
                                    Modding.Logger.Log(playMakerFSM.Fsm.GetFsmBool("Activated").Value);
                                    Console.AddLine("Boss control for this scene was reset, re-enter scene or warp");
                                }
                            }
                        }
                        else
                        {
                            Console.AddLine("GO does not exist or no FSM on it");
                        }
                    }

                    GameManager.instance.StartCoroutine(ResetBoss(bossLoader != null ? bossLoader.sceneNameToLoad : null));
                }
                else
                {
                    if (bossData[DebugMod.GetSceneName()].Value == "killedGrimm")
                    {
                        PlayerData.instance.SetIntInternal("grimmChildLevel", 2);
                        PlayerData.instance.SetIntInternal("flamesCollected", 3);
                        PlayerData.instance.SetBoolInternal("grimmChildAwoken", false);
                        PlayerData.instance.SetBoolInternal("foughtGrimm", false);
                        PlayerData.instance.SetBoolInternal("killedGrimm", false);
                    }
                    else
                    {
                        PlayerData.instance.GetType().GetField(bossData[DebugMod.GetSceneName()].Value)
                        .SetValue(PlayerData.instance, false);
                    }

                    Console.AddLine("Boss control for this scene was reset, re-enter scene or warp");
                }
            }
            else
            {
                Console.AddLine("No boss in this scene to respawn");
            }
        }
Beispiel #11
0
 public static void RefreshEnemyList()
 {
     if (DebugMod.settings.EnemiesPanelVisible)
     {
         GameObject[] rootGameObjects = UnityEngine.SceneManagement.SceneManager.GetSceneByName(DebugMod.GetSceneName()).GetRootGameObjects();
         if (rootGameObjects != null)
         {
             foreach (GameObject gameObject in rootGameObjects)
             {
                 if ((gameObject.layer == 11 || gameObject.layer == 17 || gameObject.tag == "Boss") && !Ignore(gameObject.name))
                 {
                     HealthManager healthManager = gameObject.GetComponent <HealthManager>();
                     Component     component     = gameObject.GetComponent <tk2dSprite>();
                     int           num3          = gameObject.name.IndexOf("grass", StringComparison.OrdinalIgnoreCase);
                     int           num2          = gameObject.name.IndexOf("hopper", StringComparison.OrdinalIgnoreCase);
                     if (num3 >= 0 && num2 >= 0)
                     {
                         component = gameObject.transform.FindChild("Sprite").gameObject.gameObject.GetComponent <tk2dSprite>();
                     }
                     if (healthManager != null)
                     {
                         if (component == null)
                         {
                             component = null;
                         }
                         int value = healthManager.hp;
                         enemyPool.Add(new EnemyData(value, healthManager, component, parent, gameObject));
                     }
                 }
                 EnemyDescendants(gameObject.transform);
             }
         }
         if (enemyPool.Count > 0)
         {
             Console.AddLine("Enemy data filled, entries added: " + enemyPool.Count);
         }
         EnemyUpdate(200f);
     }
 }
        public static void Update()
        {
            if (panel == null)
            {
                return;
            }

            if (DebugMod.GM.IsNonGameplayScene())
            {
                if (panel.active)
                {
                    panel.SetActive(false, true);
                }

                return;
            }

            if (DebugMod.settings.TopMenuVisible && !panel.active)
            {
                panel.SetActive(true, false);
            }
            else if (!DebugMod.settings.TopMenuVisible && panel.active)
            {
                panel.SetActive(false, true);
            }

            if (panel.GetPanel("Skills Panel").active)
            {
                RefreshSkillsMenu();
            }

            if (panel.GetPanel("Items Panel").active)
            {
                RefreshItemsMenu();
            }

            if (panel.GetPanel("Charms Panel").active)
            {
                panel.GetButton("Overcharm", "Charms Panel").SetTextColor(PlayerData.instance.overcharmed ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Kingsoul", "Charms Panel").UpdateText("Kingsoul: " + PlayerData.instance.royalCharmState);

                if (DebugMod.GrimmTroupe())
                {
                    panel.GetButton("Grimmchild", "Charms Panel").UpdateText("Grimmchild: " + PlayerData.instance.GetIntInternal("grimmChildLevel"));
                }
            }

            if (panel.GetPanel("Cheats Panel").active)
            {
                panel.GetButton("Infinite Jump", "Cheats Panel").SetTextColor(PlayerData.instance.infiniteAirJump ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Infinite Soul", "Cheats Panel").SetTextColor(DebugMod.infiniteSoul ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Infinite HP", "Cheats Panel").SetTextColor(DebugMod.infiniteHP ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Invincibility", "Cheats Panel").SetTextColor(PlayerData.instance.isInvincible ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Noclip", "Cheats Panel").SetTextColor(DebugMod.noclip ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Lock KeyBinds", "Cheats Panel").SetTextColor(DebugMod.KeyBindLock ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
            }

            if (panel.GetPanel("Bosses Panel").active)
            {
                panel.GetButton("Failed Champ", "Bosses Panel").SetTextColor(PlayerData.instance.falseKnightDreamDefeated ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Soul Tyrant", "Bosses Panel").SetTextColor(PlayerData.instance.mageLordDreamDefeated ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                panel.GetButton("Lost Kin", "Bosses Panel").SetTextColor(PlayerData.instance.infectedKnightDreamDefeated ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);

                if (DebugMod.GrimmTroupe())
                {
                    panel.GetButton("NK Grimm", "Bosses Panel").SetTextColor((PlayerData.instance.GetBoolInternal("killedNightmareGrimm") || PlayerData.instance.GetBoolInternal("destroyedNightmareLantern")) ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);
                }
            }
            if (panel.GetPanel("DreamGate Panel").active)
            {
                panel.GetPanel("DreamGate Panel").GetButton("Delete Item").SetTextColor(DreamGate.delMenu ? new Color(244f / 255f, 127f / 255f, 32f / 255f) : Color.white);

                panel.GetPanel("DreamGate Panel").GetButton("Right1").UpdateText("");
                panel.GetPanel("DreamGate Panel").GetButton("Right2").UpdateText("");
                panel.GetPanel("DreamGate Panel").GetButton("Right3").UpdateText("");
                panel.GetPanel("DreamGate Panel").GetButton("Right4").UpdateText("");
                panel.GetPanel("DreamGate Panel").GetButton("Right5").UpdateText("");
                panel.GetPanel("DreamGate Panel").GetButton("Right6").UpdateText("");

                int i         = 0;
                int buttonNum = 1;

                foreach (string entryName in DreamGate.dgData.Keys)
                {
                    if (i >= DreamGate.scrollPosition)
                    {
                        panel.GetPanel("DreamGate Panel").GetButton("Right" + buttonNum).UpdateText(entryName);
                        buttonNum++;
                        if (buttonNum > 6)
                        {
                            break;
                        }
                    }

                    i++;
                }
            }
        }
Beispiel #13
0
        public static void Update()
        {
            if (altPanel == null)
            {
                return;
            }

            if (DebugMod.GM.IsNonGameplayScene())
            {
                if (altPanel.active)
                {
                    altPanel.SetActive(false, true);
                }
                return;
            }

            // Not intended min/full info panel logic, but should show the two panels one at a time
            if (DebugMod.settings.MinInfoPanelVisible && !altPanel.active)
            {
                altPanel.SetActive(true, false);
            }
            else if (!DebugMod.settings.MinInfoPanelVisible && altPanel.active)
            {
                altPanel.SetActive(false, true);
            }

            if (altPanel.active)
            {
                PlayerData.instance.CountGameCompletion();

                altPanel.GetText("Vel").UpdateText(HeroController.instance.current_velocity.ToString());
                altPanel.GetText("Pos").UpdateText(GetHeroPos());

                altPanel.GetText("MP").UpdateText((PlayerData.instance.MPCharge + PlayerData.instance.MPReserve).ToString());
                altPanel.GetText("NailDmg").UpdateText(DebugMod.RefKnightSlash.FsmVariables.GetFsmInt("damageDealt").Value + " (Flat " + PlayerData.instance.nailDamage + ", x" + DebugMod.RefKnightSlash.FsmVariables.GetFsmFloat("Multiplier").Value + ")");
                altPanel.GetText("CanCdash").UpdateText(GetStringForBool(HeroController.instance.CanSuperDash()));

                altPanel.GetText("Completion").UpdateText(PlayerData.instance.completionPercentage.ToString() + "%");
                altPanel.GetText("Grubs").UpdateText(PlayerData.instance.grubsCollected + " / 46");

                altPanel.GetText("Scene Name").UpdateText(DebugMod.GetSceneName());

                if (SaveStateManager.quickState.IsSet())
                {
                    //string[] temp = ;
                    //altPanel.GetText("Current SaveState").UpdateText(string.Format("{0}\n{1}", temp[2], temp[1]));
                    altPanel.GetText("Current SaveState").UpdateText(SaveStateManager.quickState.GetSaveStateID());
                }
                else
                {
                    altPanel.GetText("Current SaveState").UpdateText("No savestate");
                }

                string slotSet = SaveStateManager.GetCurrentSlot().ToString();
                if (slotSet == "-1")
                {
                    slotSet = "unset";
                }

                //altPanel.GetText("Autoslot").UpdateText(string.Format("{0}",
                //            GetStringForBool(SaveStateManager.GetAutoSlot())));
                altPanel.GetText("Current slot").UpdateText(string.Format("{0}", slotSet));

                altPanel.GetText("Hardfall").UpdateText(GetStringForBool(HeroController.instance.cState.willHardLand));
            }
        }