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 CreditRollover v1.1.0
BepInEx/Plugins/CreditRollover.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("CreditRollover")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("This mod makes your credits rollover to the next round after you get ejected.")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("CreditRollover")] [assembly: AssemblyTitle("CreditRollover")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public sealed class ImNotReallySureHowToDoThis { private static readonly ImNotReallySureHowToDoThis instance; public static float valueOfRolloverPercentage; public static ImNotReallySureHowToDoThis _instance => instance; static ImNotReallySureHowToDoThis() { instance = new ImNotReallySureHowToDoThis(); } private ImNotReallySureHowToDoThis() { } } internal class PatchCreditsToRollOver { private static int creds; [HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")] [HarmonyPrefix] private static void GrabCreditAmountBeforeWipe(ref GameNetworkManager __instance) { creds = Object.FindObjectOfType<Terminal>().groupCredits; } [HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")] [HarmonyPostfix] private static void SetCredit(ref GameNetworkManager __instance) { ES3.Save<int>("GroupCredits", creds, __instance.currentSaveFileName); } [HarmonyPatch(typeof(StartOfRound), "ResetShip")] [HarmonyPostfix] private static void SetCreditTerminal(ref StartOfRound __instance) { Object.FindObjectOfType<Terminal>().groupCredits = (int)Math.Floor((float)creds * ImNotReallySureHowToDoThis.valueOfRolloverPercentage); } } namespace CreditRollover { public static class PluginInfo { public const string PLUGIN_GUID = "CreditRollover"; public const string PLUGIN_NAME = "CreditRollover"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace FloopyLessRogueLikeMoreRogueLite { [BepInPlugin("pop.mods.creditrollover", "CreditRollover", "1.1.0")] public class Plugin : BaseUnityPlugin { public ConfigEntry<float> percentageRollover; private void Awake() { percentageRollover = ((BaseUnityPlugin)this).Config.Bind<float>("General", "percentageRollover", 1f, "The percentage of credits that rollover to the next round. Ideally within 0 to 1 as rolloverCredits = previousCreds * percentageRollover."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CreditRollover has loaded :)"); Harmony.CreateAndPatchAll(typeof(PatchCreditsToRollOver), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CreditRollover is finished patching :D"); ImNotReallySureHowToDoThis.valueOfRolloverPercentage = percentageRollover.Value; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded config"); } } }