Decompiled source of EasyPlace v1.0.0

com.Nathrexeio.EasyPlace.dll

Decompiled 3 months 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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.InputSystem;
using Zorro.Core;

[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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.Nathrexeio.EasyPlace")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("com.Nathrexeio.EasyPlace")]
[assembly: AssemblyTitle("EasyPlace")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace EasyPlace
{
	[BepInPlugin("com.Nathrexeio.EasyPlace", "EasyPlace", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private RaycastHit hit;

		private InputAction placeItemAction;

		private ConfigEntry<string> configplaceKeybind;

		private static Plugin _instance;

		public const string Id = "com.Nathrexeio.EasyPlace";

		public static string placeKeybind => Instance.configplaceKeybind.Value;

		public static Plugin Instance
		{
			get
			{
				return _instance;
			}
			private set
			{
				_instance = value;
			}
		}

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "EasyPlace";

		public static string Version => "1.0.0";

		private void Awake()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
			configplaceKeybind = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PlaceKeyBind", "p", new ConfigDescription("Sets the keybind to place an item where you look", (AcceptableValueBase)null, Array.Empty<object>()));
		}

		private void OnEnable()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			placeItemAction = new InputAction("PlaceItem", (InputActionType)1, "<Keyboard>/" + configplaceKeybind.Value.ToLower(), (string)null, (string)null, (string)null);
			placeItemAction.performed += PlaceItemAction;
			placeItemAction.Enable();
		}

		private void OnDisable()
		{
			placeItemAction.Disable();
			placeItemAction.performed -= PlaceItemAction;
			placeItemAction.Dispose();
		}

		public void PlaceItemAction(CallbackContext _)
		{
			//IL_000b: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)Camera.main).transform.position + ((Component)Camera.main).transform.forward * 1.5f;
			Vector3 forward = ((Component)Camera.main).transform.forward;
			LayerMask val2 = LayerMask.op_Implicit(LayerMask.op_Implicit(HelperExtensions.ToLayerMask((LayerType)1)) | LayerMask.op_Implicit(HelperExtensions.ToLayerMask((LayerType)3)) | LayerMask.op_Implicit(HelperExtensions.ToLayerMask((LayerType)4)));
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val, forward, ref val3, 3f, LayerMask.op_Implicit(val2)) && Character.localCharacter.refs.items.currentSelectedSlot.IsSome && Object.op_Implicit((Object)(object)Character.localCharacter.data.currentItem))
			{
				int layer = ((Component)((RaycastHit)(ref val3)).collider).gameObject.layer;
				string text = LayerMask.LayerToName(layer);
				float num = 0.2f;
				if (text == "Map")
				{
					num += 0.2f;
				}
				Renderer component = ((Component)Character.localCharacter.data.currentItem).GetComponent<Renderer>();
				float num2 = 0.5f;
				if ((Object)(object)component != (Object)null)
				{
					Bounds bounds = component.bounds;
					num2 = ((Bounds)(ref bounds)).extents.y * num2;
				}
				num2 += num;
				Vector3 val4 = ((RaycastHit)(ref val3)).point + Vector3.up * num2;
				int num3 = (int)((Component)Character.localCharacter).transform.eulerAngles.y;
				Optionable<byte> currentSelectedSlot = Character.localCharacter.refs.items.currentSelectedSlot;
				ItemSlot itemSlot = Character.localCharacter.player.GetItemSlot(currentSelectedSlot.Value);
				byte value = currentSelectedSlot.Value;
				((MonoBehaviourPun)Character.localCharacter).photonView.RPC("DropItemRpc", (RpcTarget)0, new object[6]
				{
					0f,
					value,
					val4,
					Vector3.zero,
					((Component)Character.localCharacter).transform.rotation,
					itemSlot.data
				});
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}