Decompiled source of RE4 Remake Weapon Pack v1.0.4

RE4_Remake_Weapon_Pack.dll

Decompiled a week 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 JerryComponent
{
	public class HealthSpray : MonoBehaviour
	{
		public HairsprayCan spray;

		public float muzzleAngleLimit = 30f;

		public float healthRecoverPerFrame = 1f;

		public float maxRange = 0.5f;

		private Vector3 muzzlepos;

		public GameObject lookatHead;

		public GameObject lookatOffHand;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)GM.CurrentPlayerBody.Head).gameObject != (Object)null)
			{
				AxisLookAt(lookatHead.transform, ((Component)GM.CurrentPlayerBody.Head).transform.position, Vector3.forward);
			}
			if ((Object)(object)((FVRInteractiveObject)spray).m_hand != (Object)null)
			{
				AxisLookAt(lookatOffHand.transform, ((Component)((FVRInteractiveObject)spray).m_hand.OtherHand).gameObject.transform.position, Vector3.forward);
			}
			if (spray.m_isSpraying)
			{
				if (Vector3.Angle(((Component)spray.Muzzle).transform.InverseTransformVector(((Component)this).transform.forward), lookatHead.transform.InverseTransformVector(((Component)this).transform.forward)) < muzzleAngleLimit)
				{
					if (Vector3.Distance(((Component)spray.Muzzle).transform.position, ((Component)GM.CurrentPlayerBody.Head).transform.position) < maxRange)
					{
						GM.CurrentPlayerBody.Health = GM.CurrentPlayerBody.Health + healthRecoverPerFrame;
					}
				}
				else if (Vector3.Angle(((Component)spray.Muzzle).transform.InverseTransformVector(((Component)this).transform.forward), lookatOffHand.transform.InverseTransformVector(((Component)this).transform.forward)) < muzzleAngleLimit && Vector3.Distance(((Component)spray.Muzzle).transform.position, ((Component)((FVRInteractiveObject)spray).m_hand.OtherHand).gameObject.transform.position) < maxRange)
				{
					GM.CurrentPlayerBody.Health = GM.CurrentPlayerBody.Health + healthRecoverPerFrame;
				}
			}
			if (GM.CurrentPlayerBody.Health > (float)GM.CurrentPlayerBody.GetMaxHealthPlayerRaw())
			{
				GM.CurrentPlayerBody.Health = GM.CurrentPlayerBody.GetMaxHealthPlayerRaw();
			}
		}

		private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_000a: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = tr_self.rotation;
			Vector3 val = lookPos - tr_self.position;
			Vector3 val2 = tr_self.rotation * directionAxis;
			Vector3 val3 = Vector3.Cross(val2, val);
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = Vector3.Angle(val2, val);
			tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation;
		}
	}
	public class meleewithhealth : MonoBehaviour
	{
		public meleewithhealth nextmwh;

		public FVRPhysicalObject melee;

		public bool spawnblade = false;

		public GameObject brokenBlade;

		public Transform bladeBreakPos;

		public float totalHealth = 100f;

		public GameObject Prefab;

		public bool havenext = true;

		public GameObject nextPrefab;

		public float damX;

		public float damY;

		public float damZ;

		private bool broke = false;

		public void Awake()
		{
		}

		public void OnCollisionEnter(Collision col)
		{
			totalHealth -= Random.Range(1f, 2f);
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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)
			if (Prefab.activeInHierarchy)
			{
				melee.MP.BaseDamageBCP = new Vector3(damX, damY, damZ);
				melee.MP.HighDamageBCP = new Vector3(damX, damY, damZ);
			}
			if (totalHealth > 0f)
			{
				Prefab.SetActive(true);
				nextPrefab.SetActive(false);
				((Behaviour)nextmwh).enabled = false;
			}
			else if (totalHealth < 0f)
			{
				totalHealth = 0f;
			}
			else if (totalHealth == 0f)
			{
				if (havenext)
				{
					Prefab.SetActive(false);
					nextPrefab.SetActive(true);
					((Behaviour)nextmwh).enabled = true;
				}
				if (spawnblade && !broke)
				{
					Object.Instantiate<GameObject>(brokenBlade, ((Component)bladeBreakPos).transform.position, ((Component)bladeBreakPos).transform.rotation);
					broke = true;
				}
				((Behaviour)this).enabled = false;
			}
		}
	}
}
namespace thewnbot.RE4_Remake_Weapon_Pack
{
	[BepInPlugin("thewnbot.RE4_Remake_Weapon_Pack", "RE4_Remake_Weapon_Pack", "1.0.4")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class RE4_Remake_Weapon_PackPlugin : 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(), "thewnbot.RE4_Remake_Weapon_Pack");
			OtherLoader.RegisterDirectLoad(BasePath, "thewnbot.RE4_Remake_Weapon_Pack", "", "", "re4weapons", "");
		}
	}
}