コード例 #1
0
ファイル: BasePatches.cs プロジェクト: Buurazu/HunieMod
 public static void PostReturnNotification()
 {
     titleScreenInteractive = true; //reset title screen interactive here
     if (BaseHunieModPlugin.cheatsEnabled)
     {
         GameUtil.ShowNotification(CellNotificationType.MESSAGE, "CHEATS ARE ENABLED");
     }
     else if (BaseHunieModPlugin.hasReturned)
     {
         GameUtil.ShowNotification(CellNotificationType.MESSAGE, "This is for practice purposes only");
     }
 }
コード例 #2
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);
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
        public bool split(bool bonus = false)
        {
            long tickDiff = DateTime.UtcNow.Ticks - runTimer;

            //I hope this code never runs
            if (tickDiff < 0)
            {
                reset(false);
                GameUtil.ShowNotification(CellNotificationType.MESSAGE, "Timer somehow became negative; run quit! Please report this!");
                return(false);
            }
            splits.Add(new TimeSpan(tickDiff));
            isBonus.Add(bonus);
            splitColor = SplitColors.WHITE; prevColor = SplitColors.WHITE; goldColor = SplitColors.WHITE;
            splitText  = ""; prevText = ""; goldText = "";

            TimeSpan s   = splits[splits.Count - 1];
            string   val = convert(s);

            int numDates = 0, numBonuses = 0;

            foreach (bool b in isBonus)
            {
                if (b)
                {
                    numBonuses++;
                }
                else
                {
                    numDates++;
                }
            }

            if (category != "")
            {
                //create the affection meter replacement text
                //time [+/-]
                if (comparisonDates.Count >= numDates && comparisonBonuses.Count >= numBonuses)
                {
                    TimeSpan elapsedC = GetTimeAt(numDates, numBonuses);
                    val += " [";
                    TimeSpan diff = s - elapsedC;
                    if (diff.TotalSeconds > 0)
                    {
                        val       += "+";
                        splitColor = SplitColors.RED;
                    }
                    else
                    {
                        val       += "-";
                        splitColor = SplitColors.BLUE;
                    }

                    val += convert(diff) + "]";

                    //create the this split text, which is just this split's diff minus the last split's diff
                    TimeSpan diff2;
                    if (splits.Count != 1)
                    {
                        TimeSpan s2 = splits[splits.Count - 2];
                        TimeSpan prevElapsedC;
                        if (bonus)
                        {
                            prevElapsedC = GetTimeAt(numDates, numBonuses - 1);
                        }
                        else
                        {
                            prevElapsedC = GetTimeAt(numDates - 1, numBonuses);
                        }
                        diff2 = s2 - prevElapsedC;
                        diff2 = diff - diff2;
                    }
                    else
                    {
                        diff2 = diff;
                    }
                    if (diff2.TotalSeconds > 0)
                    {
                        prevText += "+";
                        prevColor = SplitColors.RED;
                    }
                    else
                    {
                        prevText += "-";
                        prevColor = SplitColors.BLUE;
                    }
                    prevText += convert(diff2);
                }

                //create the gold diff text
                if (goldDates.Count >= numDates && goldBonuses.Count >= numBonuses)
                {
                    //get segment length
                    if (splits.Count > 1)
                    {
                        s = s - splits[splits.Count - 2];
                    }
                    TimeSpan diff;
                    if (bonus)
                    {
                        diff = s - goldBonuses[numBonuses - 1];
                    }
                    else
                    {
                        diff = s - goldDates[numDates - 1];
                    }
                    if (diff.TotalSeconds < 0)
                    {
                        //new gold
                        goldText  += "-";
                        splitColor = SplitColors.GOLD;
                        goldColor  = SplitColors.GOLD;
                        if (bonus)
                        {
                            goldBonuses[numBonuses - 1] = s;
                        }
                        else
                        {
                            goldDates[numDates - 1] = s;
                        }
                    }
                    else
                    {
                        goldText += "+";
                    }
                    goldText += convert(diff);
                }
                //no gold to compare with, or no category defined
                else
                {
                    if (splits.Count > 1)
                    {
                        s = s - splits[splits.Count - 2];
                    }
                    if (bonus)
                    {
                        goldBonuses.Add(s);
                    }
                    else
                    {
                        goldDates.Add(s);
                    }
                }
            }
            else //category == ""
            {
                //reset the timer for each split if we aren't in a category
                runTimer = DateTime.UtcNow.Ticks;
            }

            splitText = val;
            //Logger.LogMessage(splitText + " " + goldText);
            return(true);
        }