private void Update() //called by Unity every frame { if (!Game.Manager) { return; //don't run update code before Game.Manager exists } BasePatches.Update(); CheatPatches.Update(); InputPatches.Update(); RunTimerPatches.Update(); if (tooltip != null) { if (tooltipTimer.ElapsedMilliseconds > tooltipLength) { tooltipTimer.Reset(); tooltip.Hide(); tooltip = null; } } //if tooltip became null, stop timer else { tooltipTimer.Reset(); } //Check for the Return hotkey if (ResetKey.Value.IsDown() || ResetKey2.Value.IsDown()) { if (UnloadGame()) { hasReturned = true; BasePatches.searchForMe = -111; if (run != null) { run.reset(); run = null; } } } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { //display the splits folder on Ctrl+S if (Input.GetKeyDown(KeyCode.S)) { if (Game.Manager.Ui.currentCanvas.titleCanvas) { System.Diagnostics.Process.Start(Directory.GetCurrentDirectory() + "/splits"); } /* * else if (run != null) * { * run.save(); * ShowNotif("Run saved!", 2); * }*/ //don't allow saving midrun, could be done accidentally } //reset run on Ctrl+R if (Input.GetKeyDown(KeyCode.R) && run != null) { run.reset(true); ShowNotif("Run reset!", 2); } //quit run on Ctrl+Q if (Input.GetKeyDown(KeyCode.Q) && run != null) { run.reset(false); ShowNotif("Run quit!", 2); } } //if currently in a puzzle, and the status bar is up, and it's not nonstop mode, send data to autosplitters if (!Game.Manager.Ui.currentCanvas.titleCanvas && Game.Session && Game.Session.Puzzle.isPuzzleActive && !Game.Session.gameCanvas.cellphone.isOpen && Game.Session.Puzzle.puzzleStatus.statusType != PuzzleStatusType.NONSTOP) { //this is a possibly bold but necessary assumption to make about cellphone._currentApp UiCellphoneAppStatus status = (UiCellphoneAppStatus)AccessTools.Field(typeof(UiCellphone), "_currentApp").GetValue(Game.Session.gameCanvas.cellphone); bool isBonusRound = Game.Session.Puzzle.puzzleStatus.bonusRound; if (status.affectionMeter.currentValue == 0) { startingRelationshipType = Game.Persistence.playerFile.GetPlayerFileGirlPair(Game.Session.Location.currentGirlPair).relationshipType; startingCompletedPairs = Game.Persistence.playerFile.completedGirlPairs.Count; } if (status.affectionMeter.currentValue == status.affectionMeter.maxValue && (Game.Session.gameCanvas.puzzleGrid.roundState == PuzzleRoundState.SUCCESS || isBonusRound)) { if (!splitThisDate && run != null) { bool didSplit = false; //always split for the two tutorial splits if (Game.Session.Location.currentGirlPair.girlDefinitionOne.girlName == "Kyu") { didSplit = run.split(isBonusRound); } //don't split for dates in 48 Shoes, or in postgame else if (run.goal != 48 && Game.Persistence.playerFile.storyProgress < 13) { if (run.goal == 1 || SplitRules.Value <= 0) { didSplit = run.split(isBonusRound); } else if (SplitRules.Value == 1 && !isBonusRound) { didSplit = run.split(isBonusRound); } else if (SplitRules.Value == 2 && isBonusRound) { didSplit = run.split(isBonusRound); } //check for final split regardless of option else if (isBonusRound && (run.goal == startingCompletedPairs + 1 || (run.goal == 25 && Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS))) { didSplit = run.split(isBonusRound); } } if (didSplit) { //initiate the timers for displaying and removing our split times RunTimerPatches.initialTimerDelay.Start(); if (!isBonusRound) { RunTimerPatches.undoTimer.Start(); } GirlPairDefinition pair = Game.Session.Location.currentGirlPair; int dateNum = 1; if (startingRelationshipType == GirlPairRelationshipType.ATTRACTED) { dateNum = 2; } if (isBonusRound) { dateNum = 3; } //Kyu pair starts at ATTRACTED (2) and her bonus should be 2, not 3, so this is the easiest way if (pair.girlDefinitionOne.girlName == "Kyu") { dateNum--; } if (Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS) { dateNum = 5 - (Game.Session.Puzzle.puzzleStatus.girlListCount / 2); } string newSplit = pair.girlDefinitionOne.girlName + " & " + pair.girlDefinitionTwo.girlName; //don't put a number on the date if they started as lovers, or it's nonstop mode? (for 100%) //the storyProgress check probably makes this pointless if (startingRelationshipType != GirlPairRelationshipType.LOVERS && Game.Session.Puzzle.puzzleStatus.statusType != PuzzleStatusType.NONSTOP) { newSplit += " #" + dateNum; } newSplit += "\n " + run.splitText + "\n"; run.push(newSplit); if (isBonusRound && pair.girlDefinitionOne.girlName != "Kyu") { //I think it's possible that, with a huge chain reaction, completedGirlPairs.Count might not have updated yet //so use the number from before the date, +1 //funnily enough, that also makes the final boss's goal of "25" count //but I'll leave the double-check there if (run.goal == startingCompletedPairs + 1 || (run.goal == 25 && Game.Session.Puzzle.puzzleStatus.statusType == PuzzleStatusType.BOSS)) { Logger.LogMessage("initiating run.save"); if (run.rerollOccurred) { run.push("\n(Rerolled for Lillian)\n"); } //run.save(); RunTimerPatches.savePBDelay.Start(); } } } } if (isBonusRound) { BasePatches.searchForMe = 200; } else { BasePatches.searchForMe = 100; } splitThisDate = true; } else { BasePatches.searchForMe = 0; splitThisDate = false; } } //title-screen only options, to prevent non-vanilla things happening midrun if (Game.Manager.Ui.currentCanvas.titleCanvas) { UiTitleCanvas tc = (UiTitleCanvas)Game.Manager.Ui.currentCanvas; bool isLoading = (bool)AccessTools.Field(typeof(UiTitleCanvas), "_loadingGame").GetValue(tc); //display New Version tooltip for 10 seconds if (newVersionAvailable && !alertedOfUpdate) { alertedOfUpdate = true; ShowTooltip("Update Available!\nClick on Credits!", 10000, 0, 45); } if (!InputPatches.codeScreen && Input.GetKeyDown(KeyCode.A)) { CodeDefinition codeDefinition = Game.Data.Codes.Get(ABIAHAIR); if (!Game.Persistence.playerData.unlockedCodes.Contains(codeDefinition)) { Game.Persistence.playerData.unlockedCodes.Add(codeDefinition); ShowTooltip("Abia's Hair Enabled!", 2000); } else { Game.Persistence.playerData.unlockedCodes.Remove(codeDefinition); ShowTooltip("Abia's Hair Disabled!", 2000); } Game.Manager.Ui.currentCanvas.GetComponent <UiTitleCanvas>().coverArt.Refresh(); } //check for Kyu outfits if (Input.GetKey(KeyCode.K)) { bool hairstyle = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)); for (int i = (int)KeyCode.Alpha0; i <= (int)KeyCode.Alpha5; i++) { //Alpha0 = 48, Keypad0 = 256 int num = i - 48; if ((Input.GetKeyDown((KeyCode)i) || Input.GetKeyDown((KeyCode)(i + 208)))) { SetKyuOutfit(num, hairstyle); string s = "Kyu "; if (hairstyle) { s += "Hairstyle #"; } else { s += "Outfit #"; } s += num + " Chosen!"; ShowTooltip(s, 2000); } } } //check for the Cheat Mode hotkey if (!InputPatches.codeScreen && cheatsEnabled == false && !isLoading && CheatHotkey.Value.IsDown()) { Game.Manager.Audio.Play(AudioCategory.SOUND, Game.Manager.Ui.sfxReject); PlayCheatLine(); Harmony.CreateAndPatchAll(typeof(CheatPatches), null); CheatPatches.UnlockAllCodes(); ShowTooltip("Cheat Mode Activated!", 2000, 0, 30); cheatsEnabled = true; } } }
public static void StopTimers(UiCellphoneAppStatus __instance) { initialTimerDelay.Reset(); undoTimer.Reset(); shoeTimer.Reset(); }
public static void DisplayOurInfo(UiCellphoneAppStatus __instance, ref PuzzleStatus ____puzzleStatus) { UiCellphoneAppStatus status = __instance; RunTimer run = HP2SR.run; if (justFinishedDate) { justFinishedDate = false; status.affectionMeter.valueLabelPro.richText = true; status.affectionMeter.valueLabelPro.text = "<color=" + RunTimer.colors[(int)run.splitColor] + ">" + run.splitText + "</color>"; Sequence seq = DOTween.Sequence(); seq.Insert(0f, status.canvasGroupDate.DOFade(1, 0.32f).SetEase(Ease.Linear)); seq.Insert(0f, status.canvasGroupLeft.DOFade(1, 0.32f).SetEase(Ease.Linear)); seq.Insert(0f, status.canvasGroupRight.DOFade(1, 0.32f).SetEase(Ease.Linear)); Game.Manager.Time.Play(seq, status.pauseBehavior.pauseDefinition, 0f); if (run.prevColor == RunTimer.SplitColors.BLUE) { status.sentimentRollerRight.valueName = "THIS SPLIT"; status.sentimentRollerRight.maxName = "THIS SPLIT"; status.sentimentRollerRight.nameLabel.text = "THIS SPLIT"; status.sentimentRollerRight.valueLabelPro.text = run.prevText; } else if (run.prevColor == RunTimer.SplitColors.RED) { status.passionRollerRight.valueName = "THIS SPLIT"; status.passionRollerRight.maxName = "THIS SPLIT"; status.passionRollerRight.nameLabel.text = "THIS SPLIT"; status.passionRollerRight.valueLabelPro.text = run.prevText; } if (run.goldText != "") { status.movesRoller.valueName = "GOLD"; status.movesRoller.maxName = "GOLD"; status.movesRoller.nameLabel.text = "GOLD"; status.movesRoller.valueLabelPro.text = run.goldText; } } if (itsRewindTime) { itsRewindTime = false; status.sentimentRollerRight.valueName = "SENTIMENT"; status.sentimentRollerRight.maxName = "SENTI... • MAX"; status.sentimentRollerRight.Reset(____puzzleStatus.girlStatusRight.sentiment, 40); status.passionRollerRight.valueName = "PASSION"; status.passionRollerRight.maxName = "PASSION • MAX"; status.passionRollerRight.Reset(____puzzleStatus.girlStatusRight.passion, 100); status.movesRoller.valueName = "MOVES"; status.movesRoller.maxName = "MOVES • MAX"; status.movesRoller.Reset(____puzzleStatus.movesRemaining, ____puzzleStatus.maxMovesRemaining); } if (justGaveShoe) { justGaveShoe = false; //briefly display the affection meter for (int j = 0; j < status.simCanvasGroups.Length; j++) { status.simCanvasGroups[j].alpha = 0f; } status.affectionCanvasGroup.alpha = 1f; status.affectionMeter.valueLabelPro.richText = true; string shoeText = "<color=" + RunTimer.colors[(int)run.splitColor] + ">" + run.splitText + "</color>"; if (run.goldText != "") { shoeText += " <color=" + RunTimer.colors[(int)run.goldColor] + ">(" + run.goldText + ")</color>"; } status.affectionMeter.valueLabelPro.text = shoeText; } if (noMoreShoe) { noMoreShoe = false; status.affectionCanvasGroup.alpha = 0f; for (int j = 0; j < status.simCanvasGroups.Length; j++) { status.simCanvasGroups[j].alpha = 1f; } } }
public static void Update() { if (!HP2SR.cheatsEnabled) { return; } //add the quick transitions code if cheat mode is on if (!Game.Persistence.playerData.unlockedCodes.Contains(Game.Data.Codes.Get(HP2SR.QUICKTRANSITIONS))) { Game.Persistence.playerData.unlockedCodes.Add(Game.Data.Codes.Get(HP2SR.QUICKTRANSITIONS)); } if (Input.GetKeyDown(KeyCode.F1)) { if (Game.Session.Location.currentLocation.locationType == LocationType.DATE) { HP2SR.ShowNotif("Affection Filled!", 2); Game.Session.Puzzle.puzzleStatus.AddResourceValue(PuzzleResourceType.AFFECTION, 999999, false); Game.Session.Puzzle.puzzleStatus.AddResourceValue(PuzzleResourceType.AFFECTION, -1, false); Game.Session.Puzzle.puzzleStatus.CheckChanges(); } else { HP2SR.ShowNotif("Fruit Given!", 2); Game.Persistence.playerFile.AddFruitCount(PuzzleAffectionType.FLIRTATION, 100); Game.Persistence.playerFile.AddFruitCount(PuzzleAffectionType.ROMANCE, 100); Game.Persistence.playerFile.AddFruitCount(PuzzleAffectionType.SEXUALITY, 100); Game.Persistence.playerFile.AddFruitCount(PuzzleAffectionType.TALENT, 100); } } if (Input.GetKeyDown(KeyCode.F2)) { if (!Game.Manager.Ui.currentCanvas.titleCanvas) { HP2SR.ShowNotif("Stamina Gained!", 2); Game.Session.Puzzle.puzzleStatus.AddResourceValue(PuzzleResourceType.STAMINA, 6, false); Game.Session.Puzzle.puzzleStatus.AddResourceValue(PuzzleResourceType.STAMINA, 6, true); Game.Session.Puzzle.puzzleStatus.CheckChanges(); } } if (Input.GetKeyDown(KeyCode.F5)) { if (!Game.Manager.Ui.currentCanvas.titleCanvas) { HP2SR.ShowNotif("Girl Finder Refreshed!", 2); Game.Persistence.playerFile.PopulateFinderSlots(); Game.Session.gameCanvas.cellphone.LoadOpenApp(); } } if (Input.GetKeyDown(KeyCode.F6)) { if (!Game.Manager.Ui.currentCanvas.titleCanvas) { HP2SR.ShowNotif("Store Refreshed!", 2); Game.Persistence.playerFile.PopulateStoreProducts(); Game.Session.gameCanvas.cellphone.LoadOpenApp(); } } if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { if (Input.GetKeyDown(KeyCode.A) && !Game.Manager.Ui.currentCanvas.titleCanvas) { CodeDefinition abiaHair = Game.Data.Codes.Get(HP2SR.ABIAHAIR); if (!Game.Persistence.playerData.unlockedCodes.Contains(abiaHair)) { Game.Persistence.playerData.unlockedCodes.Add(abiaHair); HP2SR.ShowNotif("Abia's hair enabled!", 0); } else { Game.Persistence.playerData.unlockedCodes.Remove(abiaHair); HP2SR.ShowNotif("Abia's hair disabled!", 0); } foreach (UiDoll doll in Game.Session.gameCanvas.dolls) { if (doll.girlDefinition && doll.girlDefinition.girlName == "Abia") { doll.ChangeHairstyle(doll.currentHairstyleIndex); } } } for (int i = (int)KeyCode.Alpha0; i <= (int)KeyCode.Alpha9; i++) { //Alpha0 = 48, Keypad0 = 256 int num = i - 48; if (!Game.Manager.Ui.currentCanvas.titleCanvas && (Input.GetKeyDown((KeyCode)i) || Input.GetKeyDown((KeyCode)(i + 208)))) { foreach (UiDoll doll in Game.Session.gameCanvas.dolls) { HP2SR.ShowThreeNotif("Changed to Outfit #" + num); doll.ChangeHairstyle(num); doll.ChangeOutfit(num); } } } if (Input.GetKeyDown(KeyCode.N)) { HP2SR.nudePatch = !HP2SR.nudePatch; if (HP2SR.nudePatch) { HP2SR.ShowNotif("AWOOOOOOOOOOGA", 2); foreach (UiDoll doll in Game.Session.gameCanvas.dolls) { doll.partNipples.Show(); doll.partOutfit.Hide(); } } else { foreach (UiDoll doll in Game.Session.gameCanvas.dolls) { doll.partNipples.Hide(); doll.partOutfit.Show(); } } } if (Input.GetKeyDown(KeyCode.M)) { if (!InputPatches.mashCheat) { HP2SR.ShowThreeNotif("MASH POWER ACTIVATED"); } else { HP2SR.ShowThreeNotif("Mash power deactivated"); } InputPatches.mashCheat = !InputPatches.mashCheat; } if (Input.GetKeyDown(KeyCode.L)) { //Datamining.LocationInfo(); CodeDefinition codeDefinition = Game.Data.Codes.Get(16); if (!Game.Persistence.playerData.unlockedCodes.Contains(codeDefinition)) { Game.Persistence.playerData.unlockedCodes.Add(codeDefinition); HP2SR.ShowTooltip("Letterbox Code Enabled! (not that it does anything yet)", 2000); } else { Game.Persistence.playerData.unlockedCodes.Remove(codeDefinition); HP2SR.ShowTooltip("Letterbox Code Disabled!", 2000); } } //percent sign if (Input.GetKeyDown(KeyCode.Alpha5)) { Datamining.CheckPercentage(); } if (Input.GetKeyDown(KeyCode.G)) { Datamining.GetGirlData(); } if (Input.GetKeyDown(KeyCode.D)) { Datamining.GetAllDialogTriggers(); Datamining.GetAllCutsceneLines(); } if (Input.GetKeyDown(KeyCode.R)) { PlayerFileGirlPair thePair = Game.Persistence.playerFile.GetPlayerFileGirlPair(Game.Persistence.playerFile.girlPairDefinition); if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) { if (thePair.relationshipType != GirlPairRelationshipType.UNKNOWN) { thePair.relationshipType--; HP2SR.ShowThreeNotif("Relationship Leveled Down to " + thePair.relationshipType + "!"); UiCellphoneAppStatus status = (UiCellphoneAppStatus)AccessTools.Field(typeof(UiCellphone), "_currentApp").GetValue(Game.Session.gameCanvas.cellphone); status.Refresh(); } } else { if (thePair.relationshipType != GirlPairRelationshipType.LOVERS) { thePair.relationshipType++; HP2SR.ShowThreeNotif("Relationship Leveled Up to " + thePair.relationshipType + "!"); UiCellphoneAppStatus status = (UiCellphoneAppStatus)AccessTools.Field(typeof(UiCellphone), "_currentApp").GetValue(Game.Session.gameCanvas.cellphone); status.Refresh(); } } } } /*if (Input.GetKey(KeyCode.F9)) * { * Game.Persistence.playerFile.alphaDateCount -= 100; * * float num = 200f; * float num2 = 25f; * int num3 = Mathf.Min(Game.Persistence.playerFile.relationshipUpCount, 47); * if (Game.Persistence.playerFile.storyProgress >= 14 && !Game.Persistence.playerData.unlockedCodes.Contains(Game.Session.Puzzle.noAlphaModeCode)) * { * num3 += Game.Persistence.playerFile.alphaDateCount + 1; * } * for (int k = 0; k < num3; k++) * { * num += num2; * num2 += 3.3525f; * } * * Datamining.Logger.LogDebug((Mathf.RoundToInt(num / 5f) * 5)); * } * * if (Input.GetKey(KeyCode.F11)) * { * Game.Persistence.playerFile.alphaDateCount += 1000; * * float num = 200f; * float num2 = 25f; * int num3 = Mathf.Min(Game.Persistence.playerFile.relationshipUpCount, 47); * if (Game.Persistence.playerFile.storyProgress >= 14 && !Game.Persistence.playerData.unlockedCodes.Contains(Game.Session.Puzzle.noAlphaModeCode)) * { * num3 += Game.Persistence.playerFile.alphaDateCount + 1; * } * for (int k = 0; k < num3; k++) * { * num += num2; * num2 += 3.3525f; * } * * Datamining.Logger.LogDebug((Mathf.RoundToInt(num / 5f) * 5)); * } * * if (Input.GetKeyDown(KeyCode.F10)) * { * Game.Persistence.playerFile.alphaDateCount = 35000; * }*/ /* * i should still make a save toggle, on F3? * if (cheatsEnabled) * { * * 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"); * } * } * * } */ }