Please disclose if your mod was created primarily 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 FreeeeeeMoooooons v1.2.0
BepInEx/plugins/FreeMoons.dll
Decompiled 3 months agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FreeMoons")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+851dd70d47aaee4ecd3ad512ab9f753acea7cddf")] [assembly: AssemblyProduct("FreeMoons")] [assembly: AssemblyTitle("FreeMoons")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace SRH.Mods.LC { [BepInPlugin("SlushyRH.LethalCompany.FreeMoons", "FreeMoons", "1.0.2")] public class FreeMoonsPlugin : BaseUnityPlugin { public const string GUID = "SlushyRH.LethalCompany.FreeMoons"; public const string NAME = "FreeMoons"; public const string VERSION = "1.0.2"; private readonly Harmony harmony = new Harmony("SlushyRH.LethalCompany.FreeMoons"); public static FreeMoonsPlugin Instance { get; private set; } public ManualLogSource Log { get; private set; } private void Awake() { Log = Logger.CreateLogSource("SlushyRH.LethalCompany.FreeMoons"); if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(typeof(NetworkPrefabPatch)); harmony.PatchAll(typeof(MoonPricePatch)); } } [HarmonyPatch(typeof(NetworkManager))] internal class NetworkPrefabPatch { [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SlushyRH.LethalCompany.FreeMoons Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash("SlushyRH.LethalCompany.FreeMoons")); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } [HarmonyPatch(typeof(Terminal))] internal class MoonPricePatch { private static Terminal terminal = null; private static int totalCostOfItems = -5; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void FindTerminal() { FreeMoonsPlugin.Instance.Log.LogInfo((object)"Finding terminal object!"); terminal = Object.FindObjectOfType<Terminal>(); if ((Object)(object)terminal == (Object)null) { FreeMoonsPlugin.Instance.Log.LogError((object)"Failed to find terminal object!"); } else { FreeMoonsPlugin.Instance.Log.LogInfo((object)"Found terminal object!"); } } [HarmonyPatch("LoadNewNode")] [HarmonyPrefix] private static void LoadNewNodePatchBefore(ref TerminalNode node) { if ((!((Object)(object)terminal == (Object)null) || !((Object)(object)node == (Object)null)) && node.buyRerouteToMoon == -2) { Traverse val = Traverse.Create((object)terminal).Field("totalCostOfItems"); totalCostOfItems = (int)val.GetValue(); val.SetValue((object)0); } } [HarmonyPatch("LoadNewNode")] [HarmonyPostfix] private static void LoadNewNodePatchAfter(ref TerminalNode node) { if ((!((Object)(object)terminal == (Object)null) || !((Object)(object)node == (Object)null)) && totalCostOfItems != -5) { Traverse val = Traverse.Create((object)terminal).Field("totalCostOfItems"); val.SetValue((object)0); totalCostOfItems = -5; } } [HarmonyPatch("LoadNewNodeIfAffordable")] [HarmonyPrefix] private static void LoadNewNodeIfAffordablePatch(ref TerminalNode node) { if (!((Object)(object)node == (Object)null) && node.buyRerouteToMoon != -1) { node.itemCost = 0; } } } }