Decompiled source of SteinerCQBL1 v1.0.0

SteinerCQBL1.dll

Decompiled 3 weeks ago
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]
public class AdvanceLaserSightComponent : LaserLightAttachment
{
	public Transform KnobMesh;

	public Vector3 RotationAxis = Vector3.up;

	public List<float> CustomRotationAngles;

	public GameObject ControlledGameObject;

	public bool[] GameObjectEnableFlags;

	public AudioEvent SettingSwapSound;

	private int previousSettingsIndex = -1;

	private void Start()
	{
		UpdateKnobRotationAndGameObject();
	}

	private void Update()
	{
		UpdateKnobRotationAndGameObject();
	}

	private void UpdateKnobRotationAndGameObject()
	{
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)KnobMesh != (Object)null && base.Settings.Count > 0 && CustomRotationAngles.Count == base.Settings.Count && GameObjectEnableFlags.Length == base.Settings.Count)
		{
			float num = CustomRotationAngles[base.SettingsIndex];
			KnobMesh.localEulerAngles = RotationAxis * num;
			UpdateControlledGameObject(base.SettingsIndex);
			if (base.SettingsIndex != previousSettingsIndex)
			{
				PlaySettingSwapSound();
				previousSettingsIndex = base.SettingsIndex;
			}
		}
	}

	private void UpdateControlledGameObject(int settingIndex)
	{
		if ((Object)(object)ControlledGameObject != (Object)null)
		{
			ControlledGameObject.SetActive(GameObjectEnableFlags[settingIndex]);
		}
	}

	private void PlaySettingSwapSound()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		if (SettingSwapSound != null && SettingSwapSound.Clips.Count > 0)
		{
			AudioClip val = SettingSwapSound.Clips[Random.Range(0, SettingSwapSound.Clips.Count)];
			AudioSource.PlayClipAtPoint(val, ((Component)this).transform.position, Random.Range(SettingSwapSound.VolumeRange.x, SettingSwapSound.VolumeRange.y));
		}
	}
}
public class DiceFaceDetector : MonoBehaviour
{
	public ParticleSystem effect;

	public Transform faceOneMarker;

	public float checkThreshold = 0.9f;

	public float cooldownTime = 2f;

	private float lastTriggerTime = 0f;

	private void Update()
	{
		//IL_0039: 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)
		if (!((Object)(object)faceOneMarker == (Object)null) && !(Time.time - lastTriggerTime < cooldownTime) && Vector3.Dot(faceOneMarker.up, Vector3.up) > checkThreshold)
		{
			TriggerEffect();
		}
	}

	private void TriggerEffect()
	{
		if ((Object)(object)effect != (Object)null)
		{
			effect.Play();
			lastTriggerTime = Time.time;
		}
	}
}
namespace Volks.SteinerCQBL1;

[BepInPlugin("Volks.SteinerCQBL1", "SteinerCQBL1", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class SteinerCQBL1Plugin : 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(), "Volks.SteinerCQBL1");
		OtherLoader.RegisterDirectLoad(BasePath, "Volks.SteinerCQBL1", "", "", "steinercqbl", "");
	}
}
internal class AutoReleaseOnMagLoad : MonoBehaviour
{
	private FVRFireArm weapon;

	private Handgun handgun;

	private bool wasLoaded;

	public void Start()
	{
		weapon = ((Component)this).GetComponent<FVRFireArm>();
		if (!((Object)(object)weapon == (Object)null) && weapon is Handgun)
		{
			ref Handgun reference = ref handgun;
			FVRFireArm obj = weapon;
			reference = (Handgun)(object)((obj is Handgun) ? obj : null);
		}
	}

	public void FixedUpdate()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Invalid comparison between Unknown and I4
		if ((Object)(object)handgun != (Object)null)
		{
			if ((Object)(object)weapon.Magazine != (Object)null)
			{
				if (weapon.Magazine.HasARound())
				{
					if ((int)handgun.Slide.CurPos >= 2 && !wasLoaded)
					{
						handgun.Slide.ImpartFiringImpulse();
						wasLoaded = true;
					}
				}
				else
				{
					wasLoaded = false;
				}
			}
			else
			{
				wasLoaded = false;
			}
		}
		else
		{
			wasLoaded = false;
		}
	}
}