Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ExtraSaves v0.1.0
ExtraSaves.dll
Decompiled 9 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ExtraSaves")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("ExtraSaves")] [assembly: AssemblyTitle("ExtraSaves")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ExtraSaves { [BepInPlugin("extrasaves", "ExtraSaves", "0.1.0")] public class ExtraSaves : BaseUnityPlugin { public static int page = 1; public static ManualLogSource logSource; public static float cooldown = 0f; public static float pageCooldown = 0.25f; private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown logSource = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin extrasaves has loaded!"); Harmony val = new Harmony("com.example.patch"); val.PatchAll(); } private void Update() { if (cooldown == 0f) { if (Input.GetKeyDown((KeyCode)91)) { PrevPage(); } if (Input.GetKeyDown((KeyCode)93)) { NextPage(); } } if (cooldown < 0f) { cooldown = 0f; } if (cooldown > 0f) { cooldown -= Time.deltaTime; } } public static void PrevPage() { if (page != 1 && Object.op_Implicit((Object)(object)UIManager.instance.saveProfileScreen)) { page--; ReloadProfiles(); } } public static void NextPage() { if (page != 99 && Object.op_Implicit((Object)(object)UIManager.instance.saveProfileScreen)) { page++; ReloadProfiles(); } } public static void ReloadProfiles() { cooldown = pageCooldown; UIManager instance = UIManager.instance; SaveSlotButton[] array = (SaveSlotButton[])(object)new SaveSlotButton[4] { instance.slotOne, instance.slotTwo, instance.slotThree, instance.slotFour }; SaveSlotButton[] array2 = array; foreach (SaveSlotButton val in array2) { val.ResetButton(GameManager.instance, true, true); } } public static void Log(string msg) { logSource.LogInfo((object)msg); } } public static class PluginInfo { public const string PLUGIN_GUID = "extrasaves"; public const string PLUGIN_NAME = "ExtraSaves"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace ExtraSaves.Patches { [HarmonyPatch(typeof(Platform), "IsSaveSlotIndexValid")] internal class _099ValidSaves { [HarmonyPrefix] public static bool Postfix(int slotIndex, ref bool __result) { __result = slotIndex >= 0; return false; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] internal class PaginatedSaveIndex { [HarmonyPostfix] public static void Postfix(SaveSlotButton __instance, ref int __result) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) __result += 4 * (ExtraSaves.page - 1); Text component = ((Component)__instance.slotNumberText).GetComponent<Text>(); RectTransform component2 = ((Component)((Component)__instance.slotNumberText).transform).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(120f, 154f); if ((Object)(object)component != (Object)null) { component.text = $"{__result}."; } } } } namespace ExtraSaves.Extensions { public static class SaveSlotButtonExt { public static SaveStats GetSaveStats(this SaveSlotButton button) { return Traverse.Create((object)button).Field("saveStats").GetValue<SaveStats>(); } public static void AltPresentSaveSlot(this SaveSlotButton button, SaveStats saveStats) { Traverse.Create((object)button).Method("PresentSaveSlot", new object[1] { saveStats }).GetValue(); } } }