Decompiled source of MundsBar v1.0.1

BepInEx/plugins/MundsBar/MundsBar.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using LethalLib.Modules;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("MundsBar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("MundsBar Scrap")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MundsBar")]
[assembly: AssemblyTitle("MundsBar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 MundsBar
{
	[BepInPlugin("MundsBar", "MundsBar", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		public static class StartOfRoundPatch
		{
			[HarmonyPostfix]
			private static void Postfix(StartOfRound __instance)
			{
				Item val = ((IEnumerable<Item>)__instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item item) => (Object)(object)item != (Object)null && item.itemName == "Toilet paper"));
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)"[MundsBar] Could not find Toilet paper!");
					return;
				}
				MundsBar.grabSFX = val.grabSFX;
				MundsBar.dropSFX = val.dropSFX;
				MundsBar.pocketSFX = val.pocketSFX;
				Debug.Log((object)"[MundsBar] Copied Toilet Paper sounds!");
			}
		}

		public static Item MundsBar;

		private void Awake()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MundsBar is loaded!");
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "mundsbar");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load AssetBundle: " + text));
				return;
			}
			MundsBar = val.LoadAsset<Item>("mundsbar");
			if ((Object)(object)MundsBar == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load MundsBar from AssetBundle!");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(MundsBar.spawnPrefab);
			Items.RegisterScrap(MundsBar, 350, (LevelTypes)(-1));
			new Harmony("MundsBar").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MundsBar registered successfully!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MundsBar";

		public const string PLUGIN_NAME = "MundsBar";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}