Example #1
0
        public static void ChangePuzzleUIText()
        {
            UIPuzzleStatus status = GameManager.Stage.uiPuzzle.puzzleStatus;
            RunTimer       run    = BaseHunieModPlugin.run;

            status.affectionLabel.SetText("^C" + RunTimer.colors[(int)run.splitColor] + "FF" + run.splitText);

            if (run.prevColor != RunTimer.SplitColors.WHITE)
            {
                status.passionSubtitle.SetText("This Split/Gold");
                string passionText = "^C" + RunTimer.colors[(int)run.prevColor] + "FF" + run.prevText + "^C" + RunTimer.colors[(int)run.goldColor] + "FF";
                if (run.goldText != "")
                {
                    if (run.prevText.Length <= 6)
                    {
                        passionText += " ";
                    }
                    passionText += "[" + run.goldText + "]";
                }
                status.passionLabel.SetText(passionText);
            }
            else if (run.goldText != "")
            {
                string passionText = "^C" + RunTimer.colors[(int)run.goldColor] + "FF" + run.goldText;
                status.passionLabel.SetText(passionText);
            }
        }
Example #2
0
        public static void ChangeFile1Text(LoadScreenSaveFile __instance, ref int ____saveFileIndex, ref SaveFile ____saveFile)
        {
            if (____saveFile.started || !BaseHunieModPlugin.InGameTimer.Value)
            {
                return;
            }

            __instance.noDataContainer.gameObj.SetActive(false);
            __instance.dataContainer.gameObj.SetActive(true);

            __instance.titleLabel.SetText("Start New Run");
            __instance.dataDateLabel.SetText(RunTimer.categories[BaseHunieModPlugin.lastChosenCategory]);
            __instance.dataLocationLabel.SetText(RunTimer.difficulties[BaseHunieModPlugin.lastChosenDifficulty]);

            __instance.dataTimeLabel.SetText(RunTimer.GetPB(BaseHunieModPlugin.lastChosenCategory, BaseHunieModPlugin.lastChosenDifficulty));
            __instance.dataGirlLabel.SetText(RunTimer.GetGolds(BaseHunieModPlugin.lastChosenCategory, BaseHunieModPlugin.lastChosenDifficulty));
        }
Example #3
0
        public static void Update()
        {
            if (!BaseHunieModPlugin.InGameTimer.Value || BaseHunieModPlugin.run == null)
            {
                return;
            }
            RunTimer run = BaseHunieModPlugin.run;

            //checking criterias for non-Wing categories
            if (run.goal == 100 && GameManager.System.SaveFile != null && GameManager.System.SaveFile.GetPercentComplete() == 100)
            {
                run.split();
                string newSplit = "100%\n      " + run.splitText + "\n";
                run.push(newSplit);
                run.save();
                //run.goal should no longer be 100% now, so this will only execute once
            }

            int goalMillis = 1000;

            //lower milliseconds before stats show in bonus rounds, because it fades away too quick
            if (isBonusRound)
            {
                goalMillis = 500;
            }

            if (initialTimerDelay.IsRunning && initialTimerDelay.ElapsedMilliseconds > goalMillis)
            {
                initialTimerDelay.Reset();
                preventAllUpdate = true;
            }
            //there's no point to reverting our change early, because the passion level gets drained to zero by then anyway

            /*
             * if (revertDiffDelay.IsRunning && revertDiffDelay.ElapsedMilliseconds > 6000)
             * {
             *  revertDiffDelay.Reset();
             *  preventAllUpdate = false;
             *  UIPuzzleStatus status = GameManager.Stage.uiPuzzle.puzzleStatus;
             *  int plevel = (int)AccessTools.Field(typeof(UIPuzzleStatus), "_passionLevel").GetValue(status);
             *  status.passionSubtitle.SetText("Passion Level");
             *  status.SetPassionLevel(plevel);
             * }
             */
        }
Example #4
0
        private void Update() // Another Unity method
        {
            //Logger.LogMessage("scroll wheel: " + Input.GetAxis("Mouse ScrollWheel"));
            //InputPatches.mouseWasDown = false; InputPatches.mouseWasClicked = false;
            RunTimerPatches.Update();

            //Test if we should send the "Venus unlocked" signal
            //All Panties routes would have met Momo or Celeste by now
            if (GameManager.System.GameState == GameState.SIM &&
                GameManager.System.Player.GetGirlData(GameManager.Stage.uiGirl.alienGirlDef).metStatus != GirlMetStatus.MET &&
                GameManager.System.Player.GetGirlData(GameManager.Stage.uiGirl.catGirlDef).metStatus != GirlMetStatus.MET &&
                !BaseHunieModPlugin.cheatsEnabled && GameManager.Stage.girl.definition.firstName == "Venus" &&
                GameManager.System.Player.GetGirlData(GameManager.Stage.girl.definition).metStatus != GirlMetStatus.MET &&
                GameManager.Stage.girl.girlPieceContainers.localX < 520)
            {
                BasePatches.searchForMe = 500;
                if (run != null && run.goal == 69)
                {
                    run.split();
                    string newSplit = "Venus Unlocked\n      " + run.splitText + "\n";
                    run.push(newSplit);
                    run.save();
                }
            }

            if (GameManager.System.GameState == GameState.TITLE && BasePatches.titleScreenInteractive)
            {
                bool updateText = false;
                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    lastChosenDifficulty++; if (lastChosenDifficulty >= RunTimer.difficulties.Length)
                    {
                        lastChosenDifficulty = 0;
                    }
                    updateText = true;
                }
                if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    lastChosenDifficulty--; if (lastChosenDifficulty < 0)
                    {
                        lastChosenDifficulty = RunTimer.difficulties.Length - 1;
                    }
                    updateText = true;
                }
                if (Input.GetKeyDown(KeyCode.RightArrow))
                {
                    lastChosenCategory++; if (lastChosenCategory >= RunTimer.categories.Length)
                    {
                        lastChosenCategory = 0;
                    }
                    updateText = true;
                }
                if (Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    lastChosenCategory--; if (lastChosenCategory < 0)
                    {
                        lastChosenCategory = RunTimer.categories.Length - 1;
                    }
                    updateText = true;
                }

                if (updateText)
                {
                    RunTimerPatches.UpdateFiles();
                }

                if (CheatHotkeyEnabled.Value && cheatsEnabled == false && Input.GetKeyDown(KeyCode.C))
                {
                    GameManager.System.Audio.Play(AudioCategory.SOUND, GameManager.Stage.uiPuzzle.puzzleGrid.failureSound, false, 2f, false);
                    GameManager.System.Audio.Play(AudioCategory.SOUND, GameManager.Stage.uiPuzzle.puzzleGrid.badMoveSound, false, 2f, false);
                    PlayCheatLine();
                    Harmony.CreateAndPatchAll(typeof(CheatPatches), null);
                    cheatsEnabled = true;
                }
            }

            if (ResetKey.Value.IsDown() || ResetKey2.Value.IsDown())
            {
                if (GameManager.System.GameState == GameState.TITLE)
                {
                    //GameUtil.QuitGame();
                }
                else
                {
                    if (GameUtil.EndGameSession(false, false, false))
                    {
                        hasReturned             = true;
                        BasePatches.searchForMe = -111;
                        if (run != null)
                        {
                            run.reset();
                            run = null;
                        }
                    }
                }
            }

            //display the splits folder on Ctrl+S
            if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
            {
                //display the splits folder on Ctrl+S
                if (Input.GetKeyDown(KeyCode.S))
                {
                    if (GameManager.System.GameState == GameState.TITLE)
                    {
                        System.Diagnostics.Process.Start(Directory.GetCurrentDirectory() + "/splits");
                    }

                    /*
                     * else if (run != null)
                     * {
                     *  run.save();
                     *  GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Run saved!");
                     * }*/
                }
                //reset run on Ctrl+R
                if (Input.GetKeyDown(KeyCode.R) && run != null)
                {
                    run.reset(true);
                    GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Run reset!");
                }
                //quit run on Ctrl+Q
                if (Input.GetKeyDown(KeyCode.Q) && run != null)
                {
                    run.reset(false);
                    GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Run quit!");
                }
            }

            if (cheatsEnabled)
            {
                if (Input.GetKeyDown(KeyCode.F1))
                {
                    if (GameManager.System.GameState == GameState.PUZZLE)
                    {
                        if (GameManager.System.Puzzle.Game.puzzleGameState == PuzzleGameState.WAITING)
                        {
                            GameManager.System.Puzzle.Game.SetResourceValue(PuzzleGameResourceType.AFFECTION, 999999, false);
                            GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Puzzle cleared!");
                        }
                    }
                    else if (GameManager.System.GameState == GameState.SIM)
                    {
                        CheatPatches.AddGreatGiftsToInventory();
                        GameManager.System.Player.money = 69420;
                        GameManager.System.Player.hunie = 69420;
                    }
                }

                if (Input.GetKeyDown(KeyCode.F2))
                {
                    if (savingDisabled)
                    {
                        savingDisabled = false;
                        GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Saving has been enabled");
                    }
                    else
                    {
                        savingDisabled = true;
                        GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Saving has been disabled");
                    }
                }

                if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
                {
                    if (Input.GetKeyDown(KeyCode.M))
                    {
                        InputPatches.mashCheat = !InputPatches.mashCheat;
                        if (InputPatches.mashCheat)
                        {
                            GameUtil.ShowNotification(CellNotificationType.MESSAGE, "MASH POWER ACTIVATED!!!!!");
                        }
                        else
                        {
                            GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Mash power disabled");
                        }
                    }

                    if (Input.GetKeyDown(KeyCode.T))
                    {
                        //PUZZLE TEST

                        /*The pieces in tokens are ordered alphabetically
                         * Broken Heart, Flirtation, Joy, Passion, Romance, Sentiment, Sexuality, Talent */
                        GameUtil.ShowNotification(CellNotificationType.MESSAGE, "PUZZLE TEST");
                        PuzzleTokenDefinition[] tokens = GameManager.Data.PuzzleTokens.GetAll();

                        Dictionary <string, PuzzleGridPosition> theBoard = (Dictionary <string, PuzzleGridPosition>)AccessTools.Field(typeof(PuzzleGame), "_gridPositions").GetValue(Game.Puzzle.Game);
                        UIPuzzleGrid ui = (UIPuzzleGrid)AccessTools.Field(typeof(PuzzleGame), "_puzzleGrid").GetValue(Game.Puzzle.Game);

                        /*
                         * int[] badboard = {
                         * 1, 4, 6, 7, 1, 4, 6, 7,
                         * 4, 6, 7, 1, 4, 6, 7, 1,
                         * 6, 7, 1, 4, 6, 7, 1, 4,
                         * 1, 4, 6, 7, 1, 4, 6, 7,
                         * 4, 6, 7, 1, 4, 6, 7, 1,
                         * 6, 7, 1, 4, 6, 7, 1, 4,
                         * 1, 4, 6, 7, 1, 4, 6, 7
                         * };
                         */

                        int[] badboard =
                        {
                            1, 4, 6, 7, 1, 4, 6, 7,
                            4, 6, 7, 1, 4, 0, 7, 1,
                            6, 7, 1, 4, 6, 6, 1, 4,
                            1, 4, 6, 7, 1, 6, 6, 7,
                            4, 6, 7, 6, 6, 7, 6, 1,
                            6, 7, 1, 0, 0, 6, 0, 0,
                            1, 4, 6, 0, 0, 6, 0, 0
                        };

                        for (int m = 6; m >= 0; m--)
                        {
                            for (int n = 7; n >= 0; n--)
                            {
                                PuzzleGridPosition blank = new PuzzleGridPosition(m, n, ui);
                                PuzzleGridPosition pgp   = theBoard[blank.GetKey(0, 0)];
                                PuzzleToken        pt    = (PuzzleToken)AccessTools.Field(typeof(PuzzleGridPosition), "_token").GetValue(pgp);
                                pt.definition = tokens[badboard[(m * 8) + n]];
                                pt.level      = 1;
                                pt.sprite.SetSprite(GameManager.Stage.uiPuzzle.puzzleGrid.puzzleTokenSpriteCollection, pt.definition.levels[pt.level - 1].GetSpriteName(false, false));
                                pgp.SetToken(pt);
                            }
                        }
                    }
                }
            }
        }
Example #5
0
        void Start()
        {
            if (!VsyncEnabled.Value)
            {
                QualitySettings.vSyncCount = 0;
                if (CapAt144.Value)
                {
                    Application.targetFrameRate = 144;
                }
                else
                {
                    Application.targetFrameRate = 60;
                }
            }

            Harmony.CreateAndPatchAll(typeof(BasePatches), null);
            //initiate the variable used for autosplitting
            BasePatches.InitSearchForMe();

            //Create the splits files for the first time if they don't exist
            if (!System.IO.Directory.Exists("splits"))
            {
                System.IO.Directory.CreateDirectory("splits");
                System.IO.Directory.CreateDirectory("splits/data");
            }
            RunTimer.ConvertOldSplits();

            //Check for a new update
            WebClient client = new WebClient();

            try
            {
                string reply = client.DownloadString("https://pastebin.com/raw/md3qeuCk");

                if (reply != PluginVersion)
                {
                    newVersionAvailable = true;
                }
            }
            catch (Exception e) { Logger.LogDebug("Couldn't read the update pastebin! " + e.ToString()); }

            //Create the item names dictionary for easier rewarding of specific items
            foreach (ItemDefinition item in HunieMod.Definitions.Items)
            {
                ItemNameList.Add(item.name, item.id);
            }

            if (CensorshipEnabled.Value)
            {
                Harmony.CreateAndPatchAll(typeof(CensorshipPatches), null);
            }
            if (InputModsEnabled.Value)
            {
                Harmony.CreateAndPatchAll(typeof(InputPatches), null);
            }
            if (InGameTimer.Value)
            {
                Harmony.CreateAndPatchAll(typeof(RunTimerPatches), null);
            }

            string both = MouseKeys.Value + "," + ControllerKeys.Value;

            string[] keys          = both.Split(',');
            string   validKeycodes = "Mouse button bound to keys/buttons: ";

            for (int i = 0; i < keys.Length; i++)
            {
                keys[i] = keys[i].Trim();
                KeyCode kc = KeyCode.None;
                try
                {
                    kc = (KeyCode)System.Enum.Parse(typeof(KeyCode), keys[i]);
                }
                catch { Logger.LogMessage(keys[i] + " is not a valid keycode name!"); }
                if (kc != KeyCode.None)
                {
                    InputPatches.mouseKeyboardKeys.Add(kc);
                    validKeycodes += keys[i] + ", ";
                }
            }
            Logger.LogMessage(validKeycodes);
        }
Example #6
0
        public static void AutosplitHelp(PuzzleGame __instance, ref int ____goalAffection, ref bool ____victory, ref bool ____isBonusRound)
        {
            //allow splits to happen with cheats/has returned, as long as we don't auto-start with those on it's fine
            //if (BaseHunieModPlugin.cheatsEnabled || BaseHunieModPlugin.hasReturned) return;
            if (__instance.currentDisplayAffection == 0)
            {
                startingCompletedGirls = GameManager.System.Player.GetTotalMaxRelationships();
                startingRelationship   = GameManager.System.Player.GetGirlData(GameManager.Stage.girl.definition).relationshipLevel;
            }
            if (__instance.currentDisplayAffection == ____goalAffection && (____victory || ____isBonusRound))
            {
                //make the autosplitter more viable for 100%?
                if (startingCompletedGirls < 12)
                {
                    searchForMe = 100;
                }
                //if a timer is running, split
                if (!splitThisDate && BaseHunieModPlugin.run != null)
                {
                    bool     didSplit = false;
                    RunTimer run      = BaseHunieModPlugin.run;
                    //don't split for dates in postgame
                    if (startingCompletedGirls < 12)
                    {
                        //check our rules
                        if (run.goal <= 2 || BaseHunieModPlugin.SplitRules.Value <= 0)
                        {
                            didSplit = run.split(____isBonusRound);
                        }
                        else if (BaseHunieModPlugin.SplitRules.Value == 1 && !____isBonusRound)
                        {
                            didSplit = run.split(____isBonusRound);
                        }
                        else if (BaseHunieModPlugin.SplitRules.Value == 2 && ____isBonusRound)
                        {
                            didSplit = run.split(____isBonusRound);
                        }
                        //check for final split regardless of option
                        //technically someone could just repeat sex with a girl to trigger this split. if they do that, too bad
                        else if (____isBonusRound && (run.goal == startingCompletedGirls + 1))
                        {
                            didSplit = run.split(____isBonusRound);
                        }
                    }
                    if (didSplit)
                    {
                        RunTimerPatches.initialTimerDelay.Start();
                        if (!____isBonusRound)
                        {
                            RunTimerPatches.revertDiffDelay.Start();
                        }
                        RunTimerPatches.isBonusRound = ____isBonusRound;
                        int dateNum = startingRelationship;
                        //if (____isBonusRound) dateNum++; I thought I need to increase this but it makes it #6

                        string newSplit = GameManager.Stage.girl.definition.firstName + " #" + dateNum;
                        if (GameManager.Stage.girl.definition.firstName == "Kyu" && startingCompletedGirls == 0)
                        {
                            newSplit = "Tutorial";
                        }
                        newSplit += "\n      " + run.splitText + "\n";
                        run.push(newSplit);

                        if (____isBonusRound && (run.goal == startingCompletedGirls + 1))
                        {
                            run.save();
                        }
                    }
                }


                splitThisDate = true;
            }
            else
            {
                searchForMe   = 0;
                replacingText = false;
                splitThisDate = false;
            }
        }