Decompiled source of ToiletPaperNormalizer v1.0.0

TPNormalizer.dll

Decompiled a month ago
using 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("TPNormalizer")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Normalizes toilet paper")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TPNormalizer")]
[assembly: AssemblyTitle("TPNormalizer")]
[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 TPNormalizer
{
	[BepInPlugin("giosuel.tpnormalizer", "Toilet Paper Normalizer", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "giosuel.tpnormalizer";

		private const string PLUGIN_NAME = "Toilet Paper Normalizer";

		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("giosuel.tpnormalizer").PatchAll();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class PlayerControllerPatch
	{
		[HarmonyPatch(typeof(PlayerControllerB))]
		internal static class PreloadPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
			private static void ConnectClientToPlayerObjectPatch(PlayerControllerB __instance)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				Item val = ((IEnumerable<Item>)Resources.FindObjectsOfTypeAll<Item>()).FirstOrDefault((Func<Item, bool>)((Item obj) => obj.itemName == "Toilet paper"));
				if (Object.op_Implicit((Object)(object)val))
				{
					val.positionOffset = new Vector3(0.1f, 0f, 0.2f);
					Plugin.Log.LogInfo((object)"Toilet Paper has been normalized!");
				}
				else
				{
					Plugin.Log.LogWarning((object)"Toilet Paper was not found!");
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TPNormalizer";

		public const string PLUGIN_NAME = "TPNormalizer";

		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)
		{
		}
	}
}