Decompiled source of HuntAntebellumWit v1.0.2

HuntAntebellumWit.dll

Decompiled 3 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]
namespace BitWizrd.HuntAntebellumWit;

[BepInPlugin("BitWizrd.HuntAntebellumWit", "HuntAntebellumWit", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntAntebellumWitPlugin : 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(), "BitWizrd.HuntAntebellumWit");
		OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntAntebellumWit", "", "antebellumwit", "", "");
	}
}
public class HingeAngleDebugger : MonoBehaviour
{
	private BreakActionWeapon weapon;

	private float prevHingeAngle;

	private bool prevIsEjecting;

	private float ejectTriggerAngle = float.NaN;

	private void Start()
	{
		weapon = ((Component)this).GetComponent<BreakActionWeapon>();
		if ((Object)(object)weapon == (Object)null)
		{
			Debug.LogError((object)"HingeAngleDebugger: BreakActionWeapon component not found on this GameObject.");
			((Behaviour)this).enabled = false;
		}
		else
		{
			ResetPreviousValues();
		}
	}

	private void Update()
	{
		if ((Object)(object)weapon == (Object)null)
		{
			return;
		}
		HingeJoint hinge = weapon.Hinge;
		if ((Object)(object)hinge == (Object)null)
		{
			Debug.LogError((object)"HingeAngleDebugger: HingeJoint component not found on the Hinge Transform.");
			((Behaviour)this).enabled = false;
			return;
		}
		float angle = hinge.angle;
		bool flag = Mathf.Abs(angle) >= weapon.HingeEjectLimit;
		if (Time.frameCount == 1)
		{
			Debug.Log((object)("Hinge Eject Limit: " + weapon.HingeEjectLimit));
			Debug.Log((object)("Hinge Limit: " + weapon.HingeLimit));
		}
		if (!Mathf.Approximately(angle, prevHingeAngle))
		{
			Debug.Log((object)("Current Hinge Angle (Relative to Start): " + angle.ToString("F2") + " degrees"));
			prevHingeAngle = angle;
		}
		if (flag != prevIsEjecting)
		{
			if (flag)
			{
				ejectTriggerAngle = angle;
				Debug.Log((object)("Ejection Triggered at Angle: " + ejectTriggerAngle.ToString("F2") + " degrees"));
			}
			else
			{
				Debug.Log((object)"Ejection Condition No Longer Met.");
			}
			prevIsEjecting = flag;
		}
		for (int i = 0; i < weapon.Barrels.Length; i++)
		{
			FVRFireArmChamber chamber = weapon.Barrels[i].Chamber;
			if ((Object)(object)chamber != (Object)null)
			{
				string text = "Barrel " + i + " - Chamber Full: " + chamber.IsFull + ", Chamber Spent: " + chamber.IsSpent;
				Debug.Log((object)text);
			}
			else
			{
				Debug.LogWarning((object)("Barrel " + i + " - Chamber component is missing."));
			}
		}
	}

	private void ResetPreviousValues()
	{
		prevHingeAngle = float.NaN;
		prevIsEjecting = false;
	}

	private void OnDrawGizmos()
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)weapon == (Object)null) && !((Object)(object)weapon.Hinge == (Object)null))
		{
			Vector3 position = ((Component)weapon.Hinge).transform.position;
			Vector3 forward = ((Component)weapon.Hinge).transform.forward;
			Gizmos.color = Color.green;
			Gizmos.DrawLine(position, position + forward * 0.5f);
			Vector3 val = ((Component)weapon.Hinge).transform.rotation * Vector3.up;
			Gizmos.color = Color.red;
			Gizmos.DrawLine(position, position + val * 0.5f);
		}
	}
}