Decompiled source of ONE PUNCH v1.1.0

ONE_PUNCH.dll

Decompiled 2 weeks 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]
public class Powerfist : FVRPhysicalObject
{
	[Header("Fist Properties")]
	public PunchArea punchArea;

	public float velocityThreshold;

	public Animator anim;

	public override void UpdateInteraction(FVRViveHand hand)
	{
		//IL_0036: 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)
		((FVRPhysicalObject)this).UpdateInteraction(hand);
		float triggerFloat = hand.Input.TriggerFloat;
		anim.SetFloat("Blend", triggerFloat);
		if (triggerFloat > 0.7f)
		{
			Vector3 velocity = ((FVRPhysicalObject)this).RootRigidbody.velocity;
			if (((Vector3)(ref velocity)).magnitude >= velocityThreshold)
			{
				hand.Buzz(hand.Buzzer.Buzz_GunShot);
				punchArea.canPunch = true;
				return;
			}
		}
		punchArea.canPunch = false;
	}
}
public class PunchArea : MonoBehaviour
{
	[HideInInspector]
	public bool canPunch;

	public GameObject spawnOnPunch;

	public Transform SOPPos;

	public void OnTriggerEnter(Collider other)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Rigidbody componentInParent = ((Component)other).GetComponentInParent<Rigidbody>();
		if (canPunch && Object.op_Implicit((Object)(object)componentInParent))
		{
			Object.Instantiate<GameObject>(spawnOnPunch, SOPPos.position, SOPPos.rotation);
		}
	}
}
namespace JerryComponent
{
	public class gunpodtrigger : MonoBehaviour
	{
		public FVRInteractiveObject obj;

		public GameObject trigger;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)obj.m_hand != (Object)null)
			{
				if (obj.m_hand.Input.TriggerPressed)
				{
					trigger.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
				}
				else
				{
					trigger.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				}
			}
			else
			{
				trigger.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			}
		}
	}
	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;
			}
		}
	}
	public class SMG0818EjectPort : MonoBehaviour
	{
		public OpenBoltReceiver gun;

		public Transform leftpos;

		public Transform rightpos;

		public GameObject coverrot;

		private void Start()
		{
		}

		private void FixedUpdate()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((FVRFireArm)gun).Magazine != (Object)null)
			{
				coverrot.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				if (((FVRFireArm)gun).Magazine.m_numRounds > 0)
				{
					((FVRFireArm)gun).MagazineEjectPos = leftpos;
				}
				else if (((FVRFireArm)gun).Magazine.m_numRounds <= 0)
				{
					((FVRFireArm)gun).MagazineEjectPos = rightpos;
					((FVRFireArm)gun).EjectMag(false);
				}
			}
			else if ((Object)(object)((FVRFireArm)gun).Magazine == (Object)null)
			{
				((FVRFireArm)gun).MagazineEjectPos = leftpos;
				coverrot.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
			}
		}
	}
}
namespace thewnbot.ONE_PUNCH
{
	[BepInPlugin("thewnbot.ONE_PUNCH", "ONE_PUNCH", "1.1.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class ONE_PUNCHPlugin : 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.ONE_PUNCH");
			OtherLoader.RegisterDirectLoad(BasePath, "thewnbot.ONE_PUNCH", "", "", "onepunch", "");
		}
	}
}
public class Test : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}