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 Fun Scrap v0.1.0
plugins/funScrapCode.dll
Decompiled 5 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Collections; 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("funScrapCode")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Scripted elements for funScrap")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("funScrapCode")] [assembly: AssemblyTitle("funScrapCode")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 funScrapGlobalCode { [BepInPlugin("oskiebadoskie.funScrapGlobalCode", "funScrapGlobalCode", "0.1.0")] public class Plugin : BaseUnityPlugin { public const string modGUID = "oskiebadoskie.funScrapGlobalCode"; public const string modName = "funScrapGlobalCode"; public const string modVersion = "0.1.0"; internal static ManualLogSource nls = Logger.CreateLogSource("oskiebadoskie.funScrapGlobalCode"); private void Awake() { MonoBehaviour.print((object)"> > > > > FUNSCRAP CODE LOADED"); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "oskiebadoskie.funScrapGlobalCode"); } } public static class PluginInfo { public const string PLUGIN_GUID = "funScrapCode"; public const string PLUGIN_NAME = "funScrapCode"; public const string PLUGIN_VERSION = "0.1.0"; } } namespace funScrapGlobalCode.Patches { [HarmonyPatch(typeof(TimeOfDay))] internal class TimeOfDayPatch { public static Transform ShipTransform => StartOfRound.Instance.elevatorTransform; [HarmonyPatch("OnDayChanged")] [HarmonyPostfix] private static void OnDayChanged() { if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer) { return; } List<GrabbableObject> list = ((Component)ShipTransform).GetComponentsInChildren<GrabbableObject>().ToList(); Dictionary<ulong, int> dictionary = new Dictionary<ulong, int>(); foreach (GrabbableObject item in list) { if (!((Object)(object)item.itemProperties == (Object)null) && !(item.itemProperties.itemName != "Wine")) { int scrapValue = item.scrapValue; int num = scrapValue + Mathf.RoundToInt((float)scrapValue * 0.07f); item.SetScrapValue(num); dictionary[((NetworkBehaviour)item).NetworkObjectId] = num; Debug.Log((object)$"[Wine] {scrapValue} -> {item.scrapValue}"); } } ScrapValueSync.BroadcastValues(dictionary); } } [HarmonyPatch(typeof(PlayerControllerB))] internal static class ScrapValueSync { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnReceiveSync; } private const string SyncMessageName = "funScrapGlobalCode_WineValueSync"; private static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; [HarmonyPostfix] [HarmonyPatch("ConnectClientToPlayerObject")] private static void RegisterHandler() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if (!NetworkManager.Singleton.IsServer) { CustomMessagingManager messageManager = MessageManager; object obj = <>O.<0>__OnReceiveSync; if (obj == null) { HandleNamedMessageDelegate val = OnReceiveSync; <>O.<0>__OnReceiveSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("funScrapGlobalCode_WineValueSync", (HandleNamedMessageDelegate)obj); } } internal unsafe static void BroadcastValues(Dictionary<ulong, int> changedValues) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer || changedValues.Count == 0) { return; } FastBufferWriter val = default(FastBufferWriter); foreach (ulong connectedClientsId in NetworkManager.Singleton.ConnectedClientsIds) { if (connectedClientsId == 0) { continue; } int num = 4 + changedValues.Count * 12; ((FastBufferWriter)(ref val))..ctor(num, (Allocator)2, -1); try { int count = changedValues.Count; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref count, default(ForPrimitives)); foreach (KeyValuePair<ulong, int> changedValue in changedValues) { ulong key = changedValue.Key; ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(ref key, default(ForPrimitives)); count = changedValue.Value; ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref count, default(ForPrimitives)); } MessageManager.SendNamedMessage("funScrapGlobalCode_WineValueSync", connectedClientsId, val, (NetworkDelivery)3); } finally { ((IDisposable)(*(FastBufferWriter*)(&val))/*cast due to .constrained prefix*/).Dispose(); } } } private static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); ulong key = default(ulong); int num2 = default(int); for (int i = 0; i < num; i++) { ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref key, default(ForPrimitives)); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num2, default(ForPrimitives)); if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(key, out var value)) { GrabbableObject component = ((Component)value).GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { component.SetScrapValue(num2); Debug.Log((object)$"[Wine] synced from host: {num2}"); } } } } } }