public static void JustCheckingDifficulty(UiCellphoneAppNew __instance) { if (HP2SR.lastChosenCategory < RunTimer.categories.Length) { HP2SR.ShowTooltip(RunTimer.GetAll(HP2SR.lastChosenCategory, HP2SR.lastChosenDifficulty), 3000, 0, 50); } }
public static void Update() { if (!HP2SR.InGameTimer.Value || HP2SR.run == null) { return; } RunTimer run = HP2SR.run; if (initialTimerDelay.IsRunning && initialTimerDelay.ElapsedMilliseconds > 1000) { initialTimerDelay.Reset(); justFinishedDate = true; } if (undoTimer.IsRunning && undoTimer.ElapsedMilliseconds > 6000) { undoTimer.Reset(); itsRewindTime = true; } if (shoeTimer.IsRunning && shoeTimer.ElapsedMilliseconds > 4000) { shoeTimer.Reset(); noMoreShoe = true; } if (savePBDelay.IsRunning && savePBDelay.ElapsedMilliseconds > 5000) { savePBDelay.Reset(); run.save(); } //checking criterias for non-Wing categories if (run.goal == 100 && Game.Persistence.playerFile.CalculateCompletePercent() == 100) { run.split(); string newSplit = "100%\n " + run.splitText + "\n"; run.push(newSplit); run.save(); HP2SR.ShowThreeNotif("100% completed at " + run.splitText); } else if (run.goal == 48 && Game.Persistence.playerFile.GetStyleLevelExp() > shoesProgress) { shoesProgress = Game.Persistence.playerFile.GetStyleLevelExp(); //split every style level if (shoesProgress % 6 == 0) { run.split(); justGaveShoe = true; shoeTimer.Start(); string newSplit = "Shoe #" + shoesProgress + "\n " + run.splitText + "\n"; run.push(newSplit); if (shoesProgress == 48) { run.save(); //let you bask in the glory shoeTimer.Reset(); } } } }
public static void DefaultCategory(UiCellphoneAppNew __instance, ref int ____newSaveFileIndex, ref UiAppFileIconSlot ____selectedFileIconSlot) { if (HP2SR.cheatsEnabled || HP2SR.AllPairsEnabled.Value) { return; } //default girl head to the last chosen category, show their details on the mouse if (____selectedFileIconSlot != null) { ____selectedFileIconSlot.button.Enable(); } ____selectedFileIconSlot = __instance.fileIconSlots[HP2SR.lastChosenCategory]; ____selectedFileIconSlot.button.Disable(); HP2SR.ShowTooltip(RunTimer.GetAll(HP2SR.lastChosenCategory, HP2SR.lastChosenDifficulty), 3000, 0, 50); __instance.Refresh(); }
public static bool CategoryNameDisplay(UiAppFileIconSlot __instance, ref UiTooltipSimple ____tooltip) { if (HP2SR.cheatsEnabled || HP2SR.AllPairsEnabled.Value || !Game.Manager.Ui.currentCanvas.titleCanvas) { return(true); } int cat = __instance.girlDefinition.id - 1; int diff = HP2SR.lastChosenDifficulty; if (cat < RunTimer.categories.Length) { HP2SR.ShowTooltip(RunTimer.GetAll(cat, diff), 3000, 0, 50); return(false); } else { HP2SR.tooltip = null; HP2SR.tooltipTimer.Reset(); return(true); } }
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; } } }
void Start() { //I can't believe the game doesn't run in background by default Application.runInBackground = true; //allow max 144fps if (!VsyncEnabled.Value) { QualitySettings.vSyncCount = 0; if (CapAt144.Value) { Application.targetFrameRate = 144; } else { Application.targetFrameRate = 60; } } //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/5z5PsCqr"); if (reply != PluginVersion) { newVersionAvailable = true; } } catch (Exception e) { Logger.LogMessage("Couldn't read the update pastebin! " + e.ToString()); } //initiate the variable used for autosplitting Harmony.CreateAndPatchAll(typeof(BasePatches), null); BasePatches.InitSearchForMe(); Harmony.CreateAndPatchAll(typeof(CensorshipPatches), null); Harmony.CreateAndPatchAll(typeof(InputPatches), null); if (InGameTimer.Value) { Harmony.CreateAndPatchAll(typeof(RunTimerPatches), null); } if (AllPairsEnabled.Value) { Harmony.CreateAndPatchAll(typeof(AllPairsPatches), 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); }
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; } } }