Decompiled source of KeysOnMap v1.0.0

KeysOnTheMap.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using KeysOnTheMap.Scripts;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("KeysOnTheMap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bd1fc858fcf043b0bb804080b18355804467d30f")]
[assembly: AssemblyProduct("KeysOnTheMap")]
[assembly: AssemblyTitle("KeysOnTheMap")]
[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.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 KeysOnTheMap
{
	[BepInPlugin("grug.lethalcompany.KeysOnMap", "Keys On Map", "9.28.0.5")]
	public class KeyMapPlugin : BaseUnityPlugin
	{
		public const string modGUID = "grug.lethalcompany.KeysOnMap";

		public const string modName = "Keys On Map";

		public static AssetBundle? assetbundle;

		public void Awake()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			assetbundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "keysonmap"));
			Texture2D val = assetbundle.LoadAsset<Texture2D>("Assets/KeyOnMap/key.png");
			GameObject iconPrefab = assetbundle.LoadAsset<GameObject>("Assets/KeyOnMap/Canvas.prefab");
			Hook val2 = new Hook((MethodBase)typeof(GrabbableObject).GetMethod("Start", (BindingFlags)2147483647), (Delegate)(Action<Action<GrabbableObject>, GrabbableObject>)delegate(Action<GrabbableObject> original, GrabbableObject self)
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				if (self.itemProperties.itemName == "Key")
				{
					GameObject val3 = Object.Instantiate<GameObject>(iconPrefab);
					val3.transform.SetParent(((Component)self).transform, false);
					val3.transform.SetLocalPositionAndRotation(new Vector3(0f, 0.5f, 0f), Quaternion.Euler(new Vector3(90f, 0f, 0f)));
					val3.transform.localScale = new Vector3(25f, 25f, 25f);
					val3.layer = StartOfRound.Instance.itemRadarIconPrefab.layer;
					((Object)val3).name = "keyicon :3";
					val3.AddComponent<KeepUpwards>();
					self.radarIcon = val3.transform;
				}
				original(self);
			});
		}
	}
}
namespace KeysOnTheMap.Scripts
{
	public class KeepUpwards : MonoBehaviour
	{
		public void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.rotation = Quaternion.Euler(90f, -45f, 0f);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}