using ADOFAIRenderer.Core; using HarmonyLib; namespace ADOFAIRenderer.Patch.Game; /// /// Keeps a render from writing custom level results to the player's save data. /// /// Patched member: scrMistakesManager.SaveCustom(string hash, bool wonLevel, float multiplier), which compares the /// run with the stored completion, accuracy, speed trial and death records of the custom level (keyed by the level hash), /// stores new bests through Persistence and returns an EndLevelInfo. The game calls it from /// scrController.OnLandOnPortal (custom level win) and Fail2Action (custom boss level failure). /// /// /// Active while (stage >= OnScene); the run of a render is not stored as a player /// record. The skipped call returns a default EndLevelInfo. /// /// [HarmonyPatch(typeof(scrMistakesManager))] // ReSharper disable once InconsistentNaming public static class scrMistakesManagerPatch { /// Prefix of scrMistakesManager.SaveCustom. /// True to run the original method (not rendering); false to skip it (rendering). [HarmonyPrefix] [HarmonyPatch("SaveCustom")] public static bool PreventSaveCustom() { return !RenderManager.IsActive; } }