Decompiled source of Beretta 80X v1.0.6

Beretta_80X.dll

Decompiled 2 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 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 MeatyScripts
{
	public class AttachmentAxisScale : MonoBehaviour
	{
		public Vector3 CustomScale = Vector3.one;

		static AttachmentAxisScale()
		{
			Harmony.CreateAndPatchAll(typeof(AttachmentAxisScale), (string)null);
		}

		[HarmonyPatch(typeof(FVRFireArmAttachment), "ScaleToMount")]
		[HarmonyPostfix]
		private static void ScaleToMount_Patch(FVRFireArmAttachment __instance, FVRFireArmAttachmentMount mount)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			AttachmentAxisScale component = ((Component)mount).GetComponent<AttachmentAxisScale>();
			if ((Object)(object)component != (Object)null)
			{
				((Component)__instance).transform.localScale = component.CustomScale;
			}
		}

		[HarmonyPatch(typeof(FVRFireArmAttachmentSensor), "SetHoveredMount")]
		[HarmonyPostfix]
		private static void SetHoveredMount_Patch(FVRFireArmAttachmentSensor __instance, FVRFireArmAttachmentMount newMount)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)newMount != (Object)null))
			{
				return;
			}
			AttachmentAxisScale component = ((Component)newMount).GetComponent<AttachmentAxisScale>();
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			if (__instance.Attachment.CanScaleToMount && (Object)(object)__instance.CurHoveredMount != (Object)null && __instance.CurHoveredMount.CanThisRescale())
			{
				FVRFireArmAttachmentMount rootMount = __instance.CurHoveredMount.GetRootMount();
				if (__instance.m_storedScaleMagnified != ((Vector3)(ref component.CustomScale)).magnitude)
				{
					__instance.m_storedScaleMagnified = ((Vector3)(ref component.CustomScale)).magnitude;
					((Component)__instance.Attachment).transform.localScale = component.CustomScale;
				}
			}
			else if (__instance.m_storedScaleMagnified != 1f)
			{
				__instance.m_storedScaleMagnified = 1f;
				((Component)__instance.Attachment).transform.localScale = new Vector3(__instance.m_storedScaleMagnified, __instance.m_storedScaleMagnified, __instance.m_storedScaleMagnified);
			}
		}
	}
}
namespace Lua.Beretta_80X
{
	[BepInPlugin("Lua.Beretta_80X", "Beretta_80X", "1.0.6")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class Beretta_80XPlugin : 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(), "Lua.Beretta_80X");
			OtherLoader.RegisterDirectLoad(BasePath, "Lua.Beretta_80X", "", "cheetah80xfde", "", "");
		}
	}
}