Decompiled source of HuntEmber v1.0.2

HuntEmber.dll

Decompiled 4 days ago
using System.Collections;
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 UnityEditor;
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.HuntEmber;

[BepInPlugin("BitWizrd.HuntEmber", "HuntEmber", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntEmberPlugin : 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.HuntEmber");
		OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntEmber", "", "ember", "", "");
	}
}
public class BloodBondSR : MonoBehaviour
{
	private void Awake()
	{
		string name = "Ammo_69_CashMoney_D100(Clone)";
		((Object)((Component)this).gameObject).name = name;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			((Object)((Component)componentsInChildren[i]).gameObject).name = name;
		}
	}
}
public class CylindersphereAdjuster : EditorWindow
{
	private Transform centerTransform;

	private float offset = 1E-05f;

	private string offsetString = "0.00001";

	private bool useLocalSpace = true;

	private string instructions = "Select the sphere objects you want to adjust. When using Local Space, each object's local position will be adjusted radially (from its parent's center). When not using Local Space, a Center Transform (or world origin if left empty) is used to compute the radial offset.";

	[MenuItem("Tools/Cylindersphere Adjuster")]
	public static void ShowWindow()
	{
		EditorWindow.GetWindow<CylindersphereAdjuster>("Cylindersphere Adjuster");
	}

	private void OnGUI()
	{
		EditorGUILayout.LabelField("Cylindersphere Adjuster", EditorStyles.boldLabel, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		EditorGUILayout.HelpBox(instructions, (MessageType)1);
		useLocalSpace = EditorGUILayout.Toggle("Use Local Space", useLocalSpace, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (!useLocalSpace)
		{
			ref Transform reference = ref centerTransform;
			Object obj = EditorGUILayout.ObjectField("Center Transform", (Object)(object)centerTransform, typeof(Transform), true, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			reference = (Transform)(object)((obj is Transform) ? obj : null);
		}
		offsetString = EditorGUILayout.TextField("Offset", offsetString, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (!float.TryParse(offsetString, out offset))
		{
			offset = 1E-05f;
			offsetString = offset.ToString("0.000000");
		}
		else
		{
			offsetString = offset.ToString("0.000000");
		}
		if (GUILayout.Button("Apply Adjustment to Selected", (GUILayoutOption[])(object)new GUILayoutOption[0]))
		{
			AdjustSelectedObjects();
		}
	}

	private void AdjustSelectedObjects()
	{
		//IL_005d: 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_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_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		if (Selection.gameObjects.Length == 0)
		{
			EditorUtility.DisplayDialog("No Objects Selected", "Please select the sphere objects to adjust.", "OK");
			return;
		}
		GameObject[] gameObjects = Selection.gameObjects;
		foreach (GameObject val in gameObjects)
		{
			if (useLocalSpace)
			{
				Undo.RecordObject((Object)(object)val.transform, "Adjust Local Position");
				Vector3 localPosition = val.transform.localPosition;
				if (localPosition == Vector3.zero)
				{
					Debug.LogWarning((object)("Object " + ((Object)val).name + " has a local position of zero and cannot be adjusted."));
					continue;
				}
				float magnitude = ((Vector3)(ref localPosition)).magnitude;
				float num = magnitude + offset;
				Vector3 localPosition2 = ((Vector3)(ref localPosition)).normalized * num;
				val.transform.localPosition = localPosition2;
				continue;
			}
			Undo.RecordObject((Object)(object)val.transform, "Adjust World Position");
			Vector3 val2 = ((!Object.op_Implicit((Object)(object)centerTransform)) ? Vector3.zero : centerTransform.position);
			Vector3 val3 = val.transform.position - val2;
			if (val3 == Vector3.zero)
			{
				Debug.LogWarning((object)("Object " + ((Object)val).name + " is at the center point and cannot be adjusted."));
				continue;
			}
			float magnitude2 = ((Vector3)(ref val3)).magnitude;
			float num2 = magnitude2 + offset;
			Vector3 position = val2 + ((Vector3)(ref val3)).normalized * num2;
			val.transform.position = position;
		}
	}
}
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);
		}
	}
}
public class HuntDollarSR : MonoBehaviour
{
	private IEnumerator Start()
	{
		yield return (object)new WaitForSeconds(3f);
		string str = "CharcoalBriquette(Clone)";
		((Object)((Component)this).gameObject).name = str;
		Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Component val = (Component)(object)componentsInChildren[i];
			((Object)val.gameObject).name = str;
		}
	}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
	public AudioClip[] spawnSounds;

	public float volume = 1f;

	[Header("Pitch Settings")]
	public float minPitch = 0.9f;

	public float maxPitch = 1.1f;

	private AudioSource audioSource;

	private void Start()
	{
		if (spawnSounds.Length > 0)
		{
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioSource.playOnAwake = false;
			audioSource.spatialBlend = 1f;
			audioSource.volume = volume;
			AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
			audioSource.pitch = Random.Range(minPitch, maxPitch);
			audioSource.PlayOneShot(val);
		}
	}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
	public float spinForce = 0.5f;

	public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);

	private Rigidbody rb;

	private void Start()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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)
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb != (Object)null)
		{
			((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
			rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
		}
	}
}