Decompiled source of ExtensionLadderFix v0.0.1

LC_LadderFix.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_Template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_Template")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f0665a4a-fa55-44a9-bc91-21caf15c74ff")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public static class LadderPatches
{
	public static LayerMask layer = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "Default", "Room", "Colliders" }));

	public const float distance = 0.4f;

	public const float distance2 = 0.6f;

	[HarmonyPatch(typeof(ExtensionLadderItem), "DiscardItem")]
	[HarmonyPostfix]
	public static void LadderPatch(ExtensionLadderItem __instance)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		Vector3 forward = ((Component)StartOfRound.Instance.localPlayerController).gameObject.transform.forward;
		Vector3 val = -forward + Vector3.up;
		Transform transform = ((Component)__instance).transform;
		Ray val2 = default(Ray);
		((Ray)(ref val2))..ctor(transform.position + val * 0.4f, -val);
		RaycastHit val3 = default(RaycastHit);
		if (Physics.Raycast(val2, ref val3, 0.6f, LayerMask.op_Implicit(layer)))
		{
			((GrabbableObject)__instance).targetFloorPosition = ((RaycastHit)(ref val3)).point + ((GrabbableObject)__instance).itemProperties.verticalOffset * Vector3.up;
			if ((Object)(object)((Component)__instance).transform.parent != (Object)null)
			{
				((GrabbableObject)__instance).targetFloorPosition = ((Component)__instance).transform.parent.InverseTransformPoint(((GrabbableObject)__instance).targetFloorPosition);
			}
		}
	}
}
[BepInPlugin("Mellowdy.LadderFix", "LadderFix", "0.0.1")]
public class LC_LadderFix : BaseUnityPlugin
{
	private const string modGUID = "Mellowdy.LadderFix";

	private const string modName = "LadderFix";

	private const string modVersion = "0.0.1";

	private readonly Harmony harmony = new Harmony("Mellowdy.LadderFix");

	public static ManualLogSource mls;

	private static LC_LadderFix instance;

	private void Awake()
	{
		if ((Object)(object)instance == (Object)null)
		{
			instance = this;
		}
		mls = Logger.CreateLogSource("Mellowdy.LadderFix");
		harmony.PatchAll();
		harmony.PatchAll(typeof(LadderPatches));
		mls.LogInfo((object)"LadderFix has been loaded");
	}
}