Decompiled source of HuntPoisonBomb v1.0.0

HuntPoisonBomb.dll

Decompiled 2 months 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]
namespace BitWizrd.HuntPoisonBomb;

[BepInPlugin("BitWizrd.HuntPoisonBomb", "HuntPoisonBomb", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntPoisonBombPlugin : 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.HuntPoisonBomb");
		OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntPoisonBomb", "", "poisonbomb", "", "");
	}
}
public class ExplosionSweetener : MonoBehaviour
{
	public List<AudioClip> SweetenerAudioClips;

	public bool PlayAllSweetenersAtOnce;

	public bool PlayRandomSweetenersAtOnce;

	public int MinSweetenersToPlay = 2;

	public int MaxSweetenersToPlay = 4;

	private ExplosionSound explosionSound;

	private bool hasExploded;

	private void Start()
	{
		explosionSound = ((Component)this).GetComponent<ExplosionSound>();
		if ((Object)(object)explosionSound == (Object)null)
		{
			Debug.LogError((object)"No FistVR.ExplosionSound component found on this GameObject.");
		}
	}

	private void PlaySweetenerSounds()
	{
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		if (SweetenerAudioClips.Count <= 0)
		{
			return;
		}
		if (PlayAllSweetenersAtOnce)
		{
			foreach (AudioClip sweetenerAudioClip in SweetenerAudioClips)
			{
				AudioSource.PlayClipAtPoint(sweetenerAudioClip, ((Component)this).transform.position);
			}
			return;
		}
		if (PlayRandomSweetenersAtOnce)
		{
			int num = Random.Range(MinSweetenersToPlay, Mathf.Min(MaxSweetenersToPlay, SweetenerAudioClips.Count) + 1);
			HashSet<int> hashSet = new HashSet<int>();
			while (hashSet.Count < num)
			{
				int num2 = Random.Range(0, SweetenerAudioClips.Count);
				if (hashSet.Add(num2))
				{
					AudioSource.PlayClipAtPoint(SweetenerAudioClips[num2], ((Component)this).transform.position);
				}
			}
		}
		else
		{
			int index = Random.Range(0, SweetenerAudioClips.Count);
			AudioClip val = SweetenerAudioClips[index];
			AudioSource.PlayClipAtPoint(val, ((Component)this).transform.position);
		}
	}

	private void Update()
	{
		if ((Object)(object)explosionSound != (Object)null && explosionSound.m_hasExploded && !hasExploded)
		{
			hasExploded = true;
			PlaySweetenerSounds();
		}
	}
}
[CreateAssetMenu(fileName = "New Haptic Profile", menuName = "Haptic Profile")]
public class FVRHapticBuzzProfile : ScriptableObject
{
	[Range(0.1f, 5f)]
	public float BuzzLength = 0.8f;

	[Range(0.1f, 2f)]
	public float AmpMult = 1f;

	[Range(100f, 300f)]
	public int Freq = 220;

	public AnimationCurve BuzzCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
	{
		new Keyframe(0f, 1f),
		new Keyframe(0.1f, 0.7f),
		new Keyframe(0.5f, 0.6f),
		new Keyframe(0.7f, 0.4f),
		new Keyframe(0.8f, 0f)
	});
}