Decompiled source of BO2Mauser v0.2.2

BO2Mauser.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
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 BO2Mauser
{
	public class BoomhildaBolt : MonoBehaviour
	{
		public const float Bo2ToBlunt = 1.6f;

		[Header("c96_upgraded_zm")]
		public float Speed = 76.2f;

		public float Lifetime = 5f;

		public float HitDamage = 1000f;

		public float Radius = 0.8128f;

		public float InnerDamage = 1000f;

		public float OuterDamage = 500f;

		[Tooltip("Push on loose rigidbodies at the centre of the blast (m/s)")]
		public float Push = 4f;

		[Header("Effects")]
		public GameObject ImpactPrefab;

		public GameObject FleshImpactPrefab;

		public TrailRenderer[] Trails = (TrailRenderer[])(object)new TrailRenderer[0];

		public LayerMask HitMask;

		public LayerMask DamageMask;

		public LayerMask BlockMask;

		private Vector3 m_velocity;

		private float m_life;

		private Rigidbody m_ignore;

		private int m_iff;

		private Vector3 m_origin;

		private bool m_done;

		public void Launch(FVRFireArm gun, Vector3 direction)
		{
			//IL_0004: 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)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			m_velocity = ((Vector3)(ref direction)).normalized * Speed;
			m_life = Lifetime;
			m_ignore = ((!((Object)(object)gun != (Object)null)) ? null : ((FVRPhysicalObject)gun).RootRigidbody);
			m_iff = (((Object)(object)GM.CurrentPlayerBody != (Object)null) ? GM.CurrentPlayerBody.GetPlayerIFF() : 0);
			m_origin = ((Component)this).transform.position;
		}

		private void Update()
		{
			//IL_0018: 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_0023: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (m_done)
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			Vector3 val = m_velocity * deltaTime;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude > 0f)
			{
				RaycastHit[] array = Physics.RaycastAll(((Component)this).transform.position, val / magnitude, magnitude, LayerMask.op_Implicit(HitMask), (QueryTriggerInteraction)1);
				RaycastHit val2 = default(RaycastHit);
				float num = float.MaxValue;
				for (int i = 0; i < array.Length; i++)
				{
					if ((!((Object)(object)m_ignore != (Object)null) || !((Object)(object)((RaycastHit)(ref array[i])).collider.attachedRigidbody == (Object)(object)m_ignore)) && ((RaycastHit)(ref array[i])).distance < num)
					{
						num = ((RaycastHit)(ref array[i])).distance;
						val2 = array[i];
					}
				}
				if (num < float.MaxValue)
				{
					((Component)this).transform.position = ((RaycastHit)(ref val2)).point;
					Explode(((RaycastHit)(ref val2)).point, ((RaycastHit)(ref val2)).normal, ((RaycastHit)(ref val2)).collider);
					return;
				}
				Transform transform = ((Component)this).transform;
				transform.position += val;
				((Component)this).transform.rotation = Quaternion.LookRotation(m_velocity);
			}
			m_life -= deltaTime;
			if (m_life <= 0f)
			{
				Finish();
			}
		}

		private void Explode(Vector3 point, Vector3 normal, Collider hit)
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_00b8: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 normalized = ((Vector3)(ref m_velocity)).normalized;
			SosigLink val = FindLink(hit);
			GameObject val2 = ((!((Object)(object)val != (Object)null) || !((Object)(object)FleshImpactPrefab != (Object)null)) ? ImpactPrefab : FleshImpactPrefab);
			if ((Object)(object)val2 != (Object)null)
			{
				Object.Instantiate<GameObject>(val2, point + normal * 0.02f, Quaternion.LookRotation(normal));
			}
			IFVRDamageable val3 = (IFVRDamageable)((!((Object)(object)val != (Object)null)) ? ((object)FindDamageable(hit)) : ((object)val));
			if (val3 != null)
			{
				Hurt(val3, HitDamage, point, normalized, (DamageClass)1);
			}
			Dictionary<Sosig, SosigLink> dictionary = new Dictionary<Sosig, SosigLink>();
			Dictionary<Sosig, float> dictionary2 = new Dictionary<Sosig, float>();
			HashSet<IFVRDamageable> hashSet = new HashSet<IFVRDamageable>();
			HashSet<Rigidbody> hashSet2 = new HashSet<Rigidbody>();
			Collider[] array = Physics.OverlapSphere(point, Radius, LayerMask.op_Implicit(DamageMask), (QueryTriggerInteraction)1);
			foreach (Collider val4 in array)
			{
				Rigidbody attachedRigidbody = val4.attachedRigidbody;
				if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)attachedRigidbody == (Object)(object)m_ignore)
				{
					continue;
				}
				Vector3 val5 = val4.ClosestPointOnBounds(point);
				float num = Vector3.Distance(point, val5);
				SosigLink val6 = FindLink(val4);
				if ((Object)(object)val6 != (Object)null && (Object)(object)val6.S != (Object)null)
				{
					if (!dictionary2.TryGetValue(val6.S, out var value) || num < value)
					{
						dictionary2[val6.S] = num;
						dictionary[val6.S] = val6;
					}
				}
				else
				{
					IFVRDamageable val7 = FindDamageable(val4);
					if (val7 != null && hashSet.Add(val7) && !Blocked(point, val5, attachedRigidbody))
					{
						float bo = Falloff(num);
						Vector3 val8 = val5 - point;
						Hurt(val7, bo, val5, ((Vector3)(ref val8)).normalized, (DamageClass)2);
					}
				}
				if ((Object)(object)attachedRigidbody != (Object)null && !attachedRigidbody.isKinematic && (Object)(object)val6 == (Object)null && hashSet2.Add(attachedRigidbody))
				{
					Vector3 val9 = attachedRigidbody.worldCenterOfMass - point;
					float num2 = 1f - Mathf.Clamp01(((Vector3)(ref val9)).magnitude / Radius);
					attachedRigidbody.AddForce(((Vector3)(ref val9)).normalized * Push * num2, (ForceMode)2);
				}
			}
			foreach (KeyValuePair<Sosig, SosigLink> item in dictionary)
			{
				SosigLink value2 = item.Value;
				Vector3 position = ((Component)value2).transform.position;
				if (!Blocked(point, position, value2.R))
				{
					float bo2 = Falloff(dictionary2[item.Key]);
					Vector3 val10 = position - point;
					Hurt((IFVRDamageable)(object)value2, bo2, position, ((Vector3)(ref val10)).normalized, (DamageClass)2);
				}
			}
			Finish();
		}

		private float Falloff(float distance)
		{
			return Mathf.Lerp(InnerDamage, OuterDamage, Mathf.Clamp01(distance / Radius));
		}

		private void Hurt(IFVRDamageable target, float bo2, Vector3 point, Vector3 dir, DamageClass cls)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Damage val = new Damage();
			val.Class = cls;
			val.point = point;
			val.hitNormal = -dir;
			val.strikeDir = dir;
			val.damageSize = 0.1f;
			val.Source_IFF = m_iff;
			val.Source_Point = m_origin;
			val.Dam_Blunt = bo2 * 1.6f;
			val.Dam_TotalKinetic = val.Dam_Blunt;
			target.Damage(val);
		}

		private bool Blocked(Vector3 from, Vector3 to, Rigidbody target)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = to - from;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (magnitude < 0.02f)
			{
				return false;
			}
			RaycastHit val2 = default(RaycastHit);
			return Physics.Raycast(from, val / magnitude, ref val2, magnitude - 0.01f, LayerMask.op_Implicit(BlockMask), (QueryTriggerInteraction)1) && ((Object)(object)target == (Object)null || (Object)(object)((RaycastHit)(ref val2)).collider.attachedRigidbody != (Object)(object)target);
		}

		private static SosigLink FindLink(Collider c)
		{
			if ((Object)(object)c == (Object)null)
			{
				return null;
			}
			SosigLink component = ((Component)c).GetComponent<SosigLink>();
			if ((Object)(object)component == (Object)null && (Object)(object)c.attachedRigidbody != (Object)null)
			{
				component = ((Component)c.attachedRigidbody).GetComponent<SosigLink>();
			}
			return component;
		}

		private static IFVRDamageable FindDamageable(Collider c)
		{
			if ((Object)(object)c == (Object)null)
			{
				return null;
			}
			Component component = ((Component)c).GetComponent(typeof(IFVRDamageable));
			IFVRDamageable val = (IFVRDamageable)(object)((component is IFVRDamageable) ? component : null);
			if (val == null && (Object)(object)c.attachedRigidbody != (Object)null)
			{
				Component component2 = ((Component)c.attachedRigidbody).GetComponent(typeof(IFVRDamageable));
				val = (IFVRDamageable)(object)((component2 is IFVRDamageable) ? component2 : null);
			}
			return val;
		}

		private void Finish()
		{
			m_done = true;
			for (int i = 0; i < Trails.Length; i++)
			{
				TrailRenderer val = Trails[i];
				if (!((Object)(object)val == (Object)null))
				{
					((Component)val).transform.SetParent((Transform)null, true);
					val.autodestruct = true;
				}
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
	public class BoomhildaPistol : MauserPistol
	{
		[Header("Boomhilda (c96_upgraded_zm)")]
		public BoomhildaBolt BoltPrefab;

		[Tooltip("fx_zm_raygun2_ug_world, rebuilt")]
		public GameObject MuzzleFlashPrefab;

		private static bool s_patched;

		public override void Awake()
		{
			Patch();
			base.Awake();
		}

		private static void Patch()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			if (!s_patched)
			{
				s_patched = true;
				MethodInfo methodInfo = AccessTools.Method(typeof(FVRFireArm), "Fire", new Type[5]
				{
					typeof(FVRFireArmChamber),
					typeof(Transform),
					typeof(bool),
					typeof(float),
					typeof(float)
				}, (Type[])null);
				if ((object)methodInfo == null)
				{
					Debug.LogError((object)"[BO2Mauser] FVRFireArm.Fire not found: Boomhilda fires plain bullets");
				}
				else
				{
					new Harmony("LJIndustries.BO2Mauser").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(BoomhildaPistol), "FirePrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		private static bool FirePrefix(FVRFireArm __instance, Transform muzzle, bool doBuzz)
		{
			BoomhildaPistol boomhildaPistol = __instance as BoomhildaPistol;
			if ((Object)(object)boomhildaPistol == (Object)null)
			{
				return true;
			}
			boomhildaPistol.FireBolt(muzzle, doBuzz);
			return false;
		}

		private void FireBolt(Transform muzzle, bool doBuzz)
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			if (doBuzz && (Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
			{
				((FVRInteractiveObject)this).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_GunShot);
				if ((Object)(object)((FVRPhysicalObject)this).AltGrip != (Object)null && (Object)(object)((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand != (Object)null)
				{
					((FVRInteractiveObject)((FVRPhysicalObject)this).AltGrip).m_hand.Buzz(((FVRInteractiveObject)this).m_hand.Buzzer.Buzz_GunShot);
				}
			}
			if (!((FVRInteractiveObject)this).IsHeld && !((FVRPhysicalObject)this).IsKinematicLocked && !((FVRPhysicalObject)this).IsPivotLocked && (Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null)
			{
				((FVRPhysicalObject)this).RootRigidbody.AddForceAtPosition(Vector3.Slerp(-muzzle.forward, Random.onUnitSphere, 0.1f) * Random.Range(0.4f, 0.8f), muzzle.position, (ForceMode)2);
			}
			GM.CurrentSceneSettings.OnShotFired((FVRFireArm)(object)this);
			GM.CurrentPlayerBody.VisibleEvent((!((FVRFireArm)this).IsSuppressed()) ? 2f : 0.1f);
			if ((Object)(object)BoltPrefab != (Object)null)
			{
				BoomhildaBolt boomhildaBolt = Object.Instantiate<BoomhildaBolt>(BoltPrefab, muzzle.position, muzzle.rotation);
				boomhildaBolt.Launch((FVRFireArm)(object)this, muzzle.forward);
			}
			if ((Object)(object)MuzzleFlashPrefab != (Object)null && !((FVRFireArm)this).IsSuppressed())
			{
				Object.Instantiate<GameObject>(MuzzleFlashPrefab, muzzle.position, muzzle.rotation, muzzle);
			}
		}
	}
	public class BoomhildaScope : MonoBehaviour
	{
		public const string LensSourceId = "DeagleScope";

		public GameObject Optics;

		public PIPScope Scope;

		public Renderer[] Lenses = (Renderer[])(object)new Renderer[0];

		public GameObject FallbackReticle;

		private static bool s_looked;

		private static Material s_lens;

		private static Texture2D s_normal;

		private static Texture2D s_specular;

		private void Awake()
		{
			Borrow();
			if ((Object)(object)s_lens == (Object)null || (Object)(object)Optics == (Object)null || (Object)(object)Scope == (Object)null)
			{
				if ((Object)(object)FallbackReticle != (Object)null)
				{
					FallbackReticle.SetActive(true);
				}
				return;
			}
			for (int i = 0; i < Lenses.Length; i++)
			{
				if ((Object)(object)Lenses[i] != (Object)null)
				{
					Lenses[i].sharedMaterial = s_lens;
				}
			}
			if ((Object)(object)Scope.normalMap == (Object)null)
			{
				Scope.normalMap = s_normal;
			}
			if ((Object)(object)Scope.specularTexture == (Object)null)
			{
				Scope.specularTexture = s_specular;
			}
			if ((Object)(object)FallbackReticle != (Object)null)
			{
				FallbackReticle.SetActive(false);
			}
			Optics.SetActive(true);
		}

		private static void Borrow()
		{
			if (s_looked && (Object)(object)s_lens != (Object)null)
			{
				return;
			}
			s_looked = true;
			if (IM.OD != null && IM.OD.TryGetValue("DeagleScope", out var value) && (Object)(object)value != (Object)null)
			{
				GameObject gameObject = ((AnvilAsset)value).GetGameObject();
				PIPScope val = ((!((Object)(object)gameObject != (Object)null)) ? null : gameObject.GetComponentInChildren<PIPScope>(true));
				if ((Object)(object)val != (Object)null && (Object)(object)val.lensRenderer != (Object)null)
				{
					s_lens = ((Renderer)val.lensRenderer).sharedMaterial;
					s_normal = val.normalMap;
					s_specular = val.specularTexture;
				}
			}
			if ((Object)(object)s_lens == (Object)null)
			{
				Debug.LogWarning((object)"[BO2Mauser] H3VR's DeagleScope was not found: Boomhilda's scope falls back to an unmagnified reticle");
			}
		}
	}
	public class MauserMagazine : FVRFireArmMagazine
	{
		public override void Awake()
		{
			base.Profile = MauserVanilla.Merge(base.Profile);
			((FVRFireArmMagazine)this).Awake();
		}
	}
	public class MauserPistol : Handgun
	{
		[Header("BO2 Mauser")]
		[Tooltip("How far back the bolt is (m), ascending")]
		public float[] HammerClearOffsets = new float[0];

		[Tooltip("The furthest-forward hammer angle (deg, about X) clear of the bolt at each offset")]
		public float[] HammerClearAngles = new float[0];

		private static readonly FieldInfo LastHammerVal = typeof(Handgun).GetField("m_lastHammerVal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		public override void Awake()
		{
			((FVRFireArm)this).AudioClipSet = MauserVanilla.Merge(((FVRFireArm)this).AudioClipSet);
			MauserVanilla.FillGasOut((FVRFireArm)(object)this);
			((Handgun)this).Awake();
		}

		public override void FVRUpdate()
		{
			((Handgun)this).FVRUpdate();
			PushHammer();
		}

		private void PushHammer()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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)
			if (!((Object)(object)base.Hammer == (Object)null) && !((Object)(object)base.Slide == (Object)null) && !((Object)(object)base.Slide.Point_Slide_Forward == (Object)null) && HammerClearAngles.Length != 0)
			{
				float back = base.Slide.Point_Slide_Forward.localPosition.z - ((Component)base.Slide).transform.localPosition.z;
				float num = (((object)LastHammerVal == null) ? base.HammerForward : ((float)LastHammerVal.GetValue(this)));
				float num2 = Mathf.Min(num, Clearance(back));
				base.Hammer.localEulerAngles = new Vector3(num2, 0f, 0f);
			}
		}

		private float Clearance(float back)
		{
			int num = Mathf.Min(HammerClearOffsets.Length, HammerClearAngles.Length);
			if (back <= HammerClearOffsets[0])
			{
				return HammerClearAngles[0];
			}
			for (int i = 1; i < num; i++)
			{
				if (back <= HammerClearOffsets[i])
				{
					float num2 = Mathf.InverseLerp(HammerClearOffsets[i - 1], HammerClearOffsets[i], back);
					return Mathf.Lerp(HammerClearAngles[i - 1], HammerClearAngles[i], num2);
				}
			}
			return HammerClearAngles[num - 1];
		}
	}
	public class MauserTimedEffect : MonoBehaviour
	{
		public float Lifetime = 2f;

		public AudioSource Audio;

		public AudioClip[] Clips = (AudioClip[])(object)new AudioClip[0];

		public Vector2 Volume = Vector2.one;

		public Vector2 Pitch = Vector2.one;

		public Light FlashLight;

		public float LightLife = 0.05f;

		public float LightRangeStart = 1f;

		public float LightRangeEnd = 1f;

		private float m_age;

		private float m_intensity;

		private void Start()
		{
			if ((Object)(object)Audio != (Object)null && Clips.Length > 0)
			{
				Audio.clip = Clips[Random.Range(0, Clips.Length)];
				Audio.volume = Random.Range(Volume.x, Volume.y);
				Audio.pitch = Random.Range(Pitch.x, Pitch.y);
				Audio.Play();
			}
			if ((Object)(object)FlashLight != (Object)null)
			{
				m_intensity = FlashLight.intensity;
			}
			Object.Destroy((Object)(object)((Component)this).gameObject, Lifetime);
		}

		private void Update()
		{
			m_age += Time.deltaTime;
			if (!((Object)(object)FlashLight == (Object)null))
			{
				float num = Mathf.Clamp01(m_age / Mathf.Max(LightLife, 0.001f));
				FlashLight.range = Mathf.Lerp(LightRangeStart, LightRangeEnd, num);
				FlashLight.intensity = m_intensity * (1f - num);
				((Behaviour)FlashLight).enabled = num < 1f;
			}
		}
	}
	public static class MauserVanilla
	{
		public const string ItemId = "M712Mauser";

		private static bool s_looked;

		private static Handgun s_m712;

		private static readonly Dictionary<FVRFirearmAudioSet, FVRFirearmAudioSet> s_merged = new Dictionary<FVRFirearmAudioSet, FVRFirearmAudioSet>();

		public static Handgun M712
		{
			get
			{
				if (!s_looked || (Object)(object)s_m712 == (Object)null)
				{
					s_looked = true;
					if (IM.OD != null && IM.OD.TryGetValue("M712Mauser", out var value) && (Object)(object)value != (Object)null)
					{
						GameObject gameObject = ((AnvilAsset)value).GetGameObject();
						if ((Object)(object)gameObject != (Object)null)
						{
							s_m712 = gameObject.GetComponent<Handgun>();
						}
					}
					if ((Object)(object)s_m712 == (Object)null)
					{
						Debug.LogWarning((object)"[BO2Mauser] H3VR's M712 (M712Mauser) was not found: no Mauser mechanical sounds or gas");
					}
				}
				return s_m712;
			}
		}

		public static FVRFirearmAudioSet Merge(FVRFirearmAudioSet own)
		{
			if ((Object)(object)own == (Object)null)
			{
				return null;
			}
			if (s_merged.TryGetValue(own, out var value) && (Object)(object)value != (Object)null)
			{
				return value;
			}
			Handgun m = M712;
			if ((Object)(object)m == (Object)null || (Object)(object)((FVRFireArm)m).AudioClipSet == (Object)null)
			{
				return own;
			}
			value = Object.Instantiate<FVRFirearmAudioSet>(((FVRFireArm)m).AudioClipSet);
			((Object)value).name = ((Object)own).name + " (M712 mechanics)";
			value.Shots_Main = own.Shots_Main;
			if (own.Shots_Suppressed != null && own.Shots_Suppressed.Clips != null && own.Shots_Suppressed.Clips.Count > 0)
			{
				value.Shots_Suppressed = own.Shots_Suppressed;
			}
			value.UsesTail_Main = own.UsesTail_Main;
			value.UsesTail_Suppressed = own.UsesTail_Suppressed;
			s_merged[own] = value;
			return value;
		}

		public static void FillGasOut(FVRFireArm gun)
		{
			if (gun.GasOutEffects == null || gun.GasOutEffects.Length == 0)
			{
				return;
			}
			Handgun m = M712;
			List<GasOutEffect> list = new List<GasOutEffect>();
			for (int i = 0; i < gun.GasOutEffects.Length; i++)
			{
				GasOutEffect val = gun.GasOutEffects[i];
				if ((Object)(object)val.EffectPrefab == (Object)null && (Object)(object)m != (Object)null && ((FVRFireArm)m).GasOutEffects != null && i < ((FVRFireArm)m).GasOutEffects.Length)
				{
					val.EffectPrefab = ((FVRFireArm)m).GasOutEffects[i].EffectPrefab;
				}
				if ((Object)(object)val.EffectPrefab != (Object)null && (Object)(object)val.Parent != (Object)null)
				{
					list.Add(val);
				}
			}
			gun.GasOutEffects = list.ToArray();
		}
	}
}
namespace LJIndustries.BO2Mauser
{
	[BepInPlugin("LJIndustries.BO2Mauser", "BO2Mauser", "0.2.2")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class BO2MauserPlugin : 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(), "LJIndustries.BO2Mauser");
			OtherLoader.RegisterDirectLoad(BasePath, "LJIndustries.BO2Mauser", "", "", "bo2_mauser", "");
		}
	}
}