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 VoidLeak v1.0.0
BepInEx/plugins/VoidLeak.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using VoidLeak.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SoulWithMae")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("AssetWarehouse had a breach. (BONELAB/BONEWORKS scrap items)")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e426d693dc135f921d0057fe1b1456bb69a11b54")] [assembly: AssemblyProduct("VoidLeak")] [assembly: AssemblyTitle("VoidLeak")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 VoidLeak { public static class AssetLoader { private static AssetBundle _assets; private const int CheapItemRarity = 75; private const int SmallItemRarity = 50; private const int BigItemRarity = 45; private const int ExpensiveItemRarity = 30; private const int SuperExpensiveItemRarity = 15; private const int DebugRarity = 100; private const string AssetsPath = "Assets/VoidLeak"; private const LevelTypes LowTierMoons = 28; private const LevelTypes MidTierMoons = 96; private const LevelTypes HighTierMoons = 896; public static void LoadBundle() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (directoryName != null) { _assets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "voidleak")); return; } Plugin.mls.LogError((object)"Failed to load asset bundle."); Plugin.mls.LogError((object)"Check if the asset bundle is in the same directory as the plugin."); } public static void LoadItems() { Item obj = _assets.LoadAsset<Item>("Assets/VoidLeak/Apollo.asset"); Item val = _assets.LoadAsset<Item>("Assets/VoidLeak/BlueApollo.asset"); Item val2 = _assets.LoadAsset<Item>("Assets/VoidLeak/GoldApollo.asset"); Item val3 = _assets.LoadAsset<Item>("Assets/VoidLeak/Headset.asset"); Item val4 = _assets.LoadAsset<Item>("Assets/VoidLeak/Crowbar.asset"); Item val5 = _assets.LoadAsset<Item>("Assets/VoidLeak/Bottle.asset"); Item val6 = _assets.LoadAsset<Item>("Assets/VoidLeak/SpawnGun.asset"); Item val7 = _assets.LoadAsset<Item>("Assets/VoidLeak/LunarLander.asset"); Item val8 = _assets.LoadAsset<Item>("Assets/VoidLeak/SkeleSkull.asset"); Item val9 = _assets.LoadAsset<Item>("Assets/VoidLeak/BarrelCoroutine.asset"); Item val10 = _assets.LoadAsset<Item>("Assets/VoidLeak/BarrelMemoryLeak.asset"); Item val11 = _assets.LoadAsset<Item>("Assets/VoidLeak/PlasticBarrel.asset"); NetworkPrefabs.RegisterNetworkPrefab(obj.spawnPrefab); Items.RegisterScrap(obj, 50, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, 50, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Items.RegisterScrap(val2, 15, (LevelTypes)28); Items.RegisterScrap(val2, 30, (LevelTypes)96); Items.RegisterScrap(val2, 45, (LevelTypes)896); NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); Items.RegisterScrap(val3, 50, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Items.RegisterScrap(val4, 50, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab); Items.RegisterScrap(val5, 75, (LevelTypes)28); Items.RegisterScrap(val5, 50, (LevelTypes)96); Items.RegisterScrap(val5, 45, (LevelTypes)896); NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab); Items.RegisterScrap(val6, 30, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab); Items.RegisterScrap(val7, 30, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab); Items.RegisterScrap(val8, 30, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab); Items.RegisterScrap(val9, 45, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab); Items.RegisterScrap(val10, 45, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab); Items.RegisterScrap(val11, 45, (LevelTypes)(-1)); } } public class ModInfo { public const string PluginGuid = "SoulWithMae.VoidLeak"; public const string PluginName = "VoidLeak"; public const string PluginVersion = "1.0.0"; } [BepInPlugin("SoulWithMae.VoidLeak", "VoidLeak", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource mls; private void Awake() { mls = ((BaseUnityPlugin)this).Logger; Type[] types = Assembly.GetExecutingAssembly().GetTypes(); for (int i = 0; i < types.Length; i++) { MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SoulWithMae.VoidLeak is loaded, version 1.0.0"); AssetLoader.LoadBundle(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded asset bundle. Registering items."); AssetLoader.LoadItems(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered items."); } } public static class PluginInfo { public const string PLUGIN_GUID = "VoidLeak"; public const string PLUGIN_NAME = "VoidLeak"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace VoidLeak.Monobehaviours { [AddComponentMenu("Weather Electric/Void Leak/Destroy On Timer")] public class DestroyOnTimer : NetworkBehaviour { [Tooltip("The object to destroy. If null, the script will destroy whatever object the script is on.")] public GameObject objectToDestroy; [Space(10f)] [Tooltip("The time to destroy the object.")] public float timeToDestroy = 5f; private void Start() { ((MonoBehaviour)this).StartCoroutine(Destroy((Object)(object)(((Object)(object)objectToDestroy == (Object)null) ? ((Component)this).gameObject : objectToDestroy), timeToDestroy)); } private static IEnumerator Destroy(Object obj, float time) { yield return (object)new WaitForSeconds(time); Object.Destroy(obj); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "DestroyOnTimer"; } } [AddComponentMenu("Weather Electric/Void Leak/Material Variants")] public class MaterialVariants : NetworkBehaviour { [Tooltip("The item data of the scrap.")] public Item itemData; [Space(5f)] [Tooltip("The mesh renderers to change the material of. This will use the first material in the array.")] public MeshRenderer[] meshRenderers; [Space(5f)] public bool ChangeScanNodeText; [Tooltip("The text to change to when the material is changed.")] public string[] scanNodeText; [Space(5f)] [Tooltip("The scan node properties to change the text of.")] public ScanNodeProperties scanNodeProperties; private readonly NetworkVariable<int> _materialVariant = new NetworkVariable<int>(0, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private void Start() { SetRendererServerRpc(); } [ServerRpc(RequireOwnership = false)] private void SetRendererServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(686749944u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 686749944u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SetRendererClientRpc(); } } } [ClientRpc] private void SetRendererClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1409986893u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1409986893u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } if (((NetworkBehaviour)this).IsHost) { _materialVariant.Value = Random.Range(0, itemData.materialVariants.Length); } MeshRenderer[] array = meshRenderers; for (int i = 0; i < array.Length; i++) { ((Renderer)array[i]).material = itemData.materialVariants[_materialVariant.Value]; if (ChangeScanNodeText) { scanNodeProperties.headerText = scanNodeText[_materialVariant.Value]; } } } protected override void __initializeVariables() { if (_materialVariant == null) { throw new Exception("MaterialVariants._materialVariant cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_materialVariant).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_materialVariant, "_materialVariant"); base.NetworkVariableFields.Add((NetworkVariableBase)(object)_materialVariant); ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_MaterialVariants() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(686749944u, new RpcReceiveHandler(__rpc_handler_686749944)); NetworkManager.__rpc_func_table.Add(1409986893u, new RpcReceiveHandler(__rpc_handler_1409986893)); } private static void __rpc_handler_686749944(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((MaterialVariants)(object)target).SetRendererServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1409986893(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)2; ((MaterialVariants)(object)target).SetRendererClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "MaterialVariants"; } } [AddComponentMenu("Weather Electric/Void Leak/Spawn Gun")] public class SpawnGun : GrabbableObject { [Space(30f)] public Transform firePoint; [Space(10f)] public GameObject spawnObject; [Space(10f)] public float raycastDistance = 10f; [Space(10f)] public AudioSource spawnAudio; [Space(10f)] public GameObject laser; public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (base.insertedBattery.charge <= 0f) { return; } ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(firePoint.position, firePoint.forward), ref val, raycastDistance)) { Object.Instantiate<GameObject>(spawnObject, ((RaycastHit)(ref val)).point, Quaternion.identity); spawnAudio.Play(); } if (base.insertedBattery.charge > 0f) { Battery insertedBattery = base.insertedBattery; insertedBattery.charge -= 0.1f; } } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } base.isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); laser.SetActive(false); } public override void PocketItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } base.isBeingUsed = false; ((GrabbableObject)this).PocketItem(); laser.SetActive(false); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); base.playerHeldBy.equippedUsableItemQE = true; laser.SetActive(true); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected internal override string __getTypeName() { return "SpawnGun"; } } } namespace VoidLeak.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }