Decompiled source of Kantrael Lasgun v1.0.1

Kantrael_Lasgun.dll

Decompiled 4 months ago
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace MeatKit
{
	public class HideInNormalInspectorAttribute : PropertyAttribute
	{
	}
}
namespace Buster_Scruggs.Kantrael_Lasgun
{
	[BepInPlugin("Buster_Scruggs.Kantrael_Lasgun", "Kantrael_Lasgun", "1.0.1")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Kantrael_LasgunPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Buster_Scruggs.Kantrael_Lasgun");
			OtherLoader.RegisterDirectLoad(BasePath, "Buster_Scruggs.Kantrael_Lasgun", "", "", "kantrael_lasgun", "");
		}
	}
}
namespace Cityrobo
{
	public class HaloCompass : MonoBehaviour
	{
		public Transform CompassNeedle;

		public Axis NeedleAxis;

		public float NeedleRotationOffset;

		public bool InvertRotation;

		private float _currentHeading;

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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)
			Vector3 forward = ((Component)this).transform.forward;
			forward.y = 0f;
			Vector3 forward2 = Vector3.forward;
			Vector3 up = Vector3.up;
			float currentHeading = AngleSigned(forward2, forward, up);
			_currentHeading = currentHeading;
			if (_currentHeading < 0f)
			{
				_currentHeading += 360f;
			}
			float num = GetNeedleRotationValue();
			if (InvertRotation)
			{
				num = 0f - num;
			}
			UnityEngineExtensions.ModifyLocalRotationAxisValue(CompassNeedle, NeedleAxis, num + NeedleRotationOffset);
		}

		private float GetNeedleRotationValue()
		{
			if (_currentHeading < 22.5f || _currentHeading > 337.5f)
			{
				return 0f;
			}
			if (_currentHeading >= 22.5f && _currentHeading < 67.5f)
			{
				return 45f;
			}
			if (_currentHeading >= 67.5f && _currentHeading < 112.5f)
			{
				return 90f;
			}
			if (_currentHeading >= 112.5f && _currentHeading < 157.5f)
			{
				return 135f;
			}
			if (_currentHeading >= 157.5f && _currentHeading < 202.5f)
			{
				return 180f;
			}
			if (_currentHeading >= 202.5f && _currentHeading < 247.5f)
			{
				return -135f;
			}
			if (_currentHeading >= 247.5f && _currentHeading < 292.5f)
			{
				return -90f;
			}
			return -45f;
		}

		private float AngleSigned(Vector3 v1, Vector3 v2, Vector3 n)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Atan2(Vector3.Dot(n, Vector3.Cross(v1, v2)), Vector3.Dot(v1, v2)) * 57.29578f;
		}
	}
}
namespace Scruggs
{
	public class ToggleGameObject : FVRInteractiveObject
	{
		public GameObject Object;

		public AudioEvent AudioClipOn;

		public AudioEvent AudioClipOff;

		private bool IsOn;

		public override void SimpleInteraction(FVRViveHand hand)
		{
			((FVRInteractiveObject)this).SimpleInteraction(hand);
			ToggleObject();
		}

		private void ToggleObject()
		{
			//IL_005b: 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)
			IsOn = !IsOn;
			Object.SetActive(IsOn);
			if (IsOn)
			{
				SM.PlayCoreSound((FVRPooledAudioType)10, AudioClipOn, ((Component)this).transform.position);
			}
			else
			{
				SM.PlayCoreSound((FVRPooledAudioType)10, AudioClipOff, ((Component)this).transform.position);
			}
		}
	}
}
namespace Cityrobo
{
	[RequireComponent(typeof(TrailRenderer))]
	public class TrailFade : MonoBehaviour
	{
		public AnimationCurve FadeCurve;

		private TrailRenderer _trailRenderer;

		private float _timePassed = 0f;

		public void Awake()
		{
			_trailRenderer = ((Component)this).GetComponent<TrailRenderer>();
		}

		public void Update()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			_timePassed += Time.deltaTime;
			float num = FadeCurve.Evaluate(_timePassed);
			Gradient val = new Gradient();
			val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey(num, 0f),
				new GradientAlphaKey(num, 1f)
			});
			_trailRenderer.colorGradient = val;
		}
	}
}