Decompiled source of DoorFix v1.0.0

DoorFix.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using DunGen;
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: AssemblyCompany("DoorFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes the hitbox of doors so items can be picked up through open doors more easily.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoorFix")]
[assembly: AssemblyTitle("DoorFix")]
[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 DoorFix
{
	[BepInPlugin("DoorFix", "DoorFix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DungeonUtil))]
		[HarmonyPatch("AddAndSetupDoorComponent")]
		public class DungeonUtilPatch
		{
			private static void Postfix(Dungeon dungeon, GameObject doorPrefab, Doorway doorway)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)doorPrefab).name.StartsWith("SteelDoorMapSpawn"))
				{
					return;
				}
				foreach (Transform item in doorPrefab.GetComponent<SpawnSyncedObject>().spawnPrefab.transform)
				{
					Transform val = item;
					if (!((Object)val).name.StartsWith("SteelDoor"))
					{
						continue;
					}
					foreach (Transform item2 in ((Component)val).transform)
					{
						Transform val2 = item2;
						if (!((Object)val2).name.StartsWith("DoorMesh"))
						{
							continue;
						}
						LOGGER.LogInfo((object)((object)val2).ToString());
						foreach (Transform item3 in ((Component)val2).transform)
						{
							Transform val3 = item3;
							if (((Component)val3).tag != "InteractTrigger")
							{
								continue;
							}
							LOGGER.LogInfo((object)((object)val3).ToString());
							BoxCollider[] components = ((Component)val3).gameObject.GetComponents<BoxCollider>();
							foreach (BoxCollider val4 in components)
							{
								if (((Collider)val4).isTrigger)
								{
									LOGGER.LogDebug((object)"Patching door size");
									val4.size = new Vector3(0.64f, 1f, 1f);
								}
							}
						}
					}
				}
			}
		}

		private static readonly ManualLogSource LOGGER = Logger.CreateLogSource("DoorFix");

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("DoorFix").PatchAll();
			LOGGER.LogInfo((object)"Plugin DoorFix is loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "DoorFix";

		public const string PLUGIN_NAME = "DoorFix";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}