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 Infinite Credit v1.0.4
InfiniteCredit.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using InfiniteCredit.IC; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("InfiniteJetpack")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("InfiniteJetpack")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b1f23e9e-253d-4a71-ba6e-4ac999b8d776")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace InfiniteCredit { [BepInPlugin("SpiralMods.InfiniteCredit", "InfiniteCredit", "1.0.4")] public class InfiniteCreditBase : BaseUnityPlugin { public const string modGUID = "SpiralMods.InfiniteCredit"; private const string modName = "InfiniteCredit"; private const string modVersion = "1.0.4"; public static ConfigEntry<int> CreditAmount; private readonly Harmony harmony = new Harmony("SpiralMods.InfiniteCredit"); private static InfiniteCreditBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("SpiralMods.InfiniteCredit"); mls.LogInfo((object)"InfiniteCredit has loaded (ModVersion: 1.0.4, ModGUID: SpiralMods.InfiniteCredit)!"); ConfigCreate(); } private void ConfigCreate() { CreditAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Amount of credit", 99999, "Minimum 0, Maximum 2147483647"); Patches(); } private void ConfigFix() { if (CreditAmount.Value <= 0) { CreditAmount.Value = 0; } if (CreditAmount.Value >= int.MaxValue) { CreditAmount.Value = int.MaxValue; } Patches(); } private void Patches() { harmony.PatchAll(typeof(CreditPatch)); } } } namespace InfiniteCredit.IC { [HarmonyPatch(typeof(Terminal))] internal class CreditPatch { public static Terminal terminal = Object.FindFirstObjectByType<Terminal>(); [HarmonyPatch("Update")] [HarmonyPostfix] private static void patchUpdate(ref int ___groupCredits, ref int ___numberOfItemsInDropship) { if (___groupCredits != InfiniteCreditBase.CreditAmount.Value && GameNetworkManager.Instance.isHostingGame) { syncServerCredits(___numberOfItemsInDropship); syncClientCredits(___numberOfItemsInDropship); } } [ServerRpc(RequireOwnership = true)] private static void syncServerCredits(int numberOfItemsInDropship) { terminal.SyncGroupCreditsServerRpc(InfiniteCreditBase.CreditAmount.Value, numberOfItemsInDropship); } [ClientRpc] private static void syncClientCredits(int numberOfItemsInDropship) { terminal.SyncGroupCreditsClientRpc(InfiniteCreditBase.CreditAmount.Value, numberOfItemsInDropship); } } }