Decompiled source of ToiletMod v1.0.0

BepInEx/plugins/ToiletMod/ToiletMod.dll

Decompiled a month ago
using System;
using System.Collections;
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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.Mono;
using FishNet;
using FishNet.Managing;
using FishNet.Managing.Object;
using FishNet.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ScheduleOne;
using ScheduleOne.DevUtilities;
using ScheduleOne.EntityFramework;
using ScheduleOne.Equipping;
using ScheduleOne.ItemFramework;
using ScheduleOne.Storage;
using ScheduleOneTestingBep.Managers;
using ScheduleOneTestingBep.Scripts.Components.ObjectScripts;
using ScheduleOneTestingBep.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("FishNet.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ScheduleOneTestingBep")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ToiletFlushing")]
[assembly: AssemblyTitle("ScheduleOneTestingBep")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 ScheduleOneTestingBep
{
	[BepInPlugin("ScheduleOneTestingBep", "ToiletFlushing", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <InitializeData>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <InitializeData>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => AssetManager.IsLoaded));
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					RegistryManager.RetieveDataFromRegistry(Singleton<Registry>.Instance);
					RegistryManager.RegisterItem<ToiletCustom>("toilet", "decoration/toilet/toilet_built_custom.prefab", "");
					RegistryManager.RegisterItem<ToiletCustom>("goldentoilet", "decoration/toilet/goldentoilet_built_custom.prefab", "");
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			ManualLogSource logger = Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ToiletFlushing");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			logger.LogInfo(val);
			new Harmony("com.maxtorcoder.ToiletFlushing").PatchAll();
			((MonoBehaviour)this).StartCoroutine(InitializeData());
		}

		[IteratorStateMachine(typeof(<InitializeData>d__2))]
		private IEnumerator InitializeData()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <InitializeData>d__2(0)
			{
				<>4__this = this
			};
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ScheduleOneTestingBep";

		public const string PLUGIN_NAME = "ToiletFlushing";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ScheduleOneTestingBep.Utils
{
	public static class Extensions
	{
		public static ushort Get16BitHash(this AssetBundle assetBundle)
		{
			if ((Object)(object)assetBundle == (Object)null)
			{
				throw new ArgumentNullException("assetBundle");
			}
			int seed = 0;
			seed = assetBundle.GetAllAssetNames().Aggregate(seed, (int current, string assetName) => current * 31 * assetName.GetHashCode());
			seed *= 31 * ((Object)assetBundle).name.GetHashCode();
			return (ushort)(65535 - (ushort)(seed % 65535));
		}

		public static string ToPascalCase(this string input)
		{
			if (string.IsNullOrWhiteSpace(input))
			{
				return input;
			}
			string input2 = input.ToLower();
			return Regex.Replace(input2, "(^|_)(\\w)", (Match match) => match.Groups[2].Value.ToUpper());
		}
	}
}
namespace ScheduleOneTestingBep.Patches
{
	[HarmonyPatch(typeof(Registry))]
	public class RegistryPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void Awake_Prefix(Registry __instance)
		{
			AssetManager.LoadAssetBundle("custom_asset_bundle");
			AssetManager.Register(InstanceFinder.NetworkManager, AssetManager.LoadedAssetBundle);
		}
	}
}
namespace ScheduleOneTestingBep.Managers
{
	public static class AssetManager
	{
		public static AssetBundle LoadedAssetBundle;

		public static bool IsLoaded;

		private static readonly Dictionary<string, GameObject> _loadedGameObjects = new Dictionary<string, GameObject>();

		private static readonly Dictionary<string, ScriptableObject> _loadedScriptableObjects = new Dictionary<string, ScriptableObject>();

		public static void LoadAssetBundle(string assetBundleName)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)LoadedAssetBundle))
			{
				return;
			}
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ScheduleOneTestingBep.Assets." + assetBundleName);
			bool flag = default(bool);
			if (stream == null)
			{
				ManualLogSource logger = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(39, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AssetManager]: Failed to load stream: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(assetBundleName);
				}
				logger.LogError(val);
				return;
			}
			AssetBundle val2 = AssetBundle.LoadFromStream(stream);
			if ((Object)(object)val2 == (Object)null)
			{
				ManualLogSource logger2 = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(44, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AssetManager]: Failed to load AssetBundle: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(assetBundleName);
				}
				logger2.LogError(val);
				return;
			}
			string[] allAssetNames = val2.GetAllAssetNames();
			ManualLogSource logger3 = Plugin.Logger;
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[AssetManager]: Loaded AssetBundle: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(assetBundleName);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" with: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(allAssetNames.Length);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" asset(s)");
			}
			logger3.LogInfo(val3);
			LoadedAssetBundle = val2;
		}

		public static void Register(NetworkManager networkManager, AssetBundle assetBundle)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)assetBundle))
			{
				return;
			}
			ushort num = assetBundle.Get16BitHash();
			PrefabObjects prefabObjects = networkManager.GetPrefabObjects<SinglePrefabObjects>(num, true);
			string[] allAssetNames = assetBundle.GetAllAssetNames();
			bool flag = default(bool);
			foreach (string text in allAssetNames)
			{
				GameObject val = assetBundle.LoadAsset<GameObject>(text);
				if (Object.op_Implicit((Object)(object)val) && !_loadedGameObjects.ContainsKey(text))
				{
					NetworkObject component = val.GetComponent<NetworkObject>();
					if (Object.op_Implicit((Object)(object)component))
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(62, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[AssetManager]:     -> Loaded GameObject ");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" with NetworkedObject");
						}
						logger.LogInfo(val2);
						prefabObjects.AddObject(component, true);
					}
					else
					{
						ManualLogSource logger2 = Plugin.Logger;
						BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[AssetManager]:     -> Loaded GameObject ");
							((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
						}
						logger2.LogInfo(val2);
					}
					_loadedGameObjects.Add(text, val);
				}
				ScriptableObject val3 = assetBundle.LoadAsset<ScriptableObject>(text);
				if (Object.op_Implicit((Object)(object)val3) && !_loadedScriptableObjects.ContainsKey(text))
				{
					ManualLogSource logger3 = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[AssetManager]:     -> Loaded ScriptableObject ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
					}
					logger3.LogInfo(val2);
					_loadedScriptableObjects.TryAdd(text, val3);
				}
			}
			IsLoaded = true;
		}

		public static GameObject GetRegisteredGameObject(string objectName)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (_loadedGameObjects.TryGetValue(objectName, out var value))
			{
				return value;
			}
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(59, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AssetManager]: Could not find loaded GameObject with name ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(objectName);
			}
			logger.LogError(val);
			return null;
		}

		public static ScriptableObject GetRegisteredScriptableObject(string objectName)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if (_loadedScriptableObjects.TryGetValue(objectName, out var value))
			{
				return value;
			}
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(65, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[AssetManager]: Could not find loaded ScriptableObject with name ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(objectName);
			}
			logger.LogError(val);
			return null;
		}
	}
	public static class RegistryManager
	{
		private static readonly Dictionary<string, GameObject> _buildHandlerObjects = new Dictionary<string, GameObject>();

		private static readonly Dictionary<string, Equippable> _equippableObjects = new Dictionary<string, Equippable>();

		private static readonly Dictionary<string, StoredItem> _storedItemObjects = new Dictionary<string, StoredItem>();

		public static void RegisterItem<T>(string key, string prefabPath, string itemDefinitionPath = "") where T : Object
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Expected O, but got Unknown
			prefabPath = "assets/resources/" + prefabPath;
			if (!string.IsNullOrEmpty(itemDefinitionPath))
			{
				itemDefinitionPath = "assets/resources/" + itemDefinitionPath;
			}
			ItemRegister val = ((IEnumerable<ItemRegister>)Singleton<Registry>.Instance.ItemRegistry).FirstOrDefault((Func<ItemRegister, bool>)((ItemRegister x) => x.ID == key));
			ItemRegister val2 = val;
			ItemRegister val3 = val2;
			bool flag = default(bool);
			if (val3 == null)
			{
				if (!string.IsNullOrEmpty(itemDefinitionPath))
				{
					ScriptableObject registeredScriptableObject = AssetManager.GetRegisteredScriptableObject(itemDefinitionPath);
					if (!Object.op_Implicit((Object)(object)registeredScriptableObject))
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(46, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[AssetManager]: Failed to find definition for ");
							((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(itemDefinitionPath);
						}
						logger.LogError(val4);
						return;
					}
					val = new ItemRegister
					{
						Definition = (ItemDefinition)registeredScriptableObject,
						ID = key,
						AssetPath = prefabPath
					};
					Singleton<Registry>.Instance.ItemRegistry.Add(val);
					Singleton<Registry>.Instance.AddToItemDictionary(val);
				}
				else if (string.IsNullOrEmpty(itemDefinitionPath))
				{
					ManualLogSource logger2 = Plugin.Logger;
					BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(95, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[AssetManager]: Failed to create new ItemDefinition with key: ");
						((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(key);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(", itemDefinition argument is null");
					}
					logger2.LogError(val4);
					return;
				}
			}
			if (val == null)
			{
				ManualLogSource logger3 = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(57, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[AssetManager]: Failed to retrieve itemRegistry for key: ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(key);
				}
				logger3.LogError(val4);
				return;
			}
			GameObject registeredGameObject = AssetManager.GetRegisteredGameObject(prefabPath);
			if (!Object.op_Implicit((Object)(object)registeredGameObject))
			{
				ManualLogSource logger4 = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[AssetManager]: Failed to find ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(prefabPath);
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" in asset bundle");
				}
				logger4.LogError(val4);
				return;
			}
			if (_equippableObjects.TryGetValue(((Object)val.Definition.Equippable).name, out var value))
			{
				val.Definition.Equippable = value;
			}
			ItemDefinition definition = val.Definition;
			StorableItemDefinition val5 = (StorableItemDefinition)(object)((definition is StorableItemDefinition) ? definition : null);
			if (val5 != null && _storedItemObjects.TryGetValue(((Object)val5.StoredItem).name, out var value2))
			{
				val5.StoredItem = value2;
			}
			ItemDefinition definition2 = val.Definition;
			BuildableItemDefinition val6 = (BuildableItemDefinition)(object)((definition2 is BuildableItemDefinition) ? definition2 : null);
			if (val6 == null)
			{
				return;
			}
			BuildableItem component = registeredGameObject.GetComponent<BuildableItem>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				ManualLogSource logger5 = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(60, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[AssetManager]: Failed to find \"BuildableItem\" component in ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<GameObject>(registeredGameObject);
				}
				logger5.LogError(val4);
				return;
			}
			if (_buildHandlerObjects.TryGetValue(((Object)val6.BuiltItem.BuildHandler).name, out var value3))
			{
				component.buildHandler = value3;
			}
			val6.BuiltItem = component;
			ManualLogSource logger6 = Plugin.Logger;
			BepInExInfoLogInterpolatedStringHandler val7 = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[AssetManager]: Assigned ");
				((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<GameObject>(registeredGameObject);
			}
			logger6.LogInfo(val7);
		}

		public static void RetieveDataFromRegistry(Registry registryInstance)
		{
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			foreach (ItemRegister item in registryInstance.ItemRegistry)
			{
				ItemDefinition definition = item.Definition;
				BuildableItemDefinition val = (BuildableItemDefinition)(object)((definition is BuildableItemDefinition) ? definition : null);
				if (val != null)
				{
					if (!Object.op_Implicit((Object)(object)val.BuiltItem))
					{
						continue;
					}
					GameObject buildHandler = val.BuiltItem.BuildHandler;
					_buildHandlerObjects.TryAdd(((Object)buildHandler).name, buildHandler);
				}
				ItemDefinition definition2 = item.Definition;
				StorableItemDefinition val2 = (StorableItemDefinition)(object)((definition2 is StorableItemDefinition) ? definition2 : null);
				if (val2 != null)
				{
					if (!Object.op_Implicit((Object)(object)val2.StoredItem))
					{
						continue;
					}
					StoredItem storedItem = val2.StoredItem;
					_storedItemObjects.TryAdd(((Object)storedItem).name, storedItem);
				}
				if (Object.op_Implicit((Object)(object)item.Definition.Equippable))
				{
					_equippableObjects.TryAdd(((Object)item.Definition.Equippable).name, item.Definition.Equippable);
				}
			}
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(43, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[RegistryManager]: Loaded ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(_buildHandlerObjects.Count);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" build handler(s)");
			}
			logger.LogInfo(val3);
			ManualLogSource logger2 = Plugin.Logger;
			val3 = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[RegistryManager]: Loaded ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(_storedItemObjects.Count);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" stored item(s)");
			}
			logger2.LogInfo(val3);
			ManualLogSource logger3 = Plugin.Logger;
			val3 = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[RegistryManager]: Loaded ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(_equippableObjects.Count);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" equippable(s)");
			}
			logger3.LogInfo(val3);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

BepInEx/plugins/ToiletMod/ToiletMod.Scripts.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using FishNet.Object;
using ScheduleOne.Interaction;
using ScheduleOne.Storage;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("FishNet.Runtime")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ScheduleOneTestingBep.Scripts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScheduleOneTestingBep.Scripts")]
[assembly: AssemblyTitle("ScheduleOneTestingBep.Scripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ScheduleOneTestingBep.Scripts.Components.ObjectScripts
{
	public class ToiletCustom : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <FlushCoroutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ToiletCustom <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <FlushCoroutine>d__8(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Expected O, but got Unknown
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					UnityEvent onFlush = <>4__this.onFlush;
					if (onFlush != null)
					{
						onFlush.Invoke();
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
				case 1:
					<>1__state = -1;
					<>4__this.storageEntity.ClearContents();
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<>4__this._isFlushing = false;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public StorageEntity storageEntity;

		public UnityEvent onFlush;

		public InteractableObject interactableObject;

		private bool _isFlushing;

		public void Interacted()
		{
			_isFlushing = true;
			ServerFlush();
		}

		public void Hovered()
		{
			if (!_isFlushing)
			{
				interactableObject.SetInteractableState((EInteractableState)0);
				interactableObject.SetMessage("Flush");
			}
			else
			{
				interactableObject.SetInteractableState((EInteractableState)2);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void ServerFlush()
		{
			ClientFlush();
		}

		[ObserversRpc]
		private void ClientFlush()
		{
			_isFlushing = true;
			((MonoBehaviour)this).StartCoroutine(FlushCoroutine());
		}

		[IteratorStateMachine(typeof(<FlushCoroutine>d__8))]
		private IEnumerator FlushCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FlushCoroutine>d__8(0)
			{
				<>4__this = this
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}