Decompiled source of CCI Pepperbox v1.2.0

CCI_Pepperbox.dll

Decompiled 2 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;
using UnityEngine.Events;

[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 ShermanJumbo
{
	public class BreakActionSpeedloaderInsertTrigger : MonoBehaviour
	{
		public BreakActionWeapon Weapon;
	}
	public class BreakActionSpeedloaderTrigger : MonoBehaviour
	{
		public FVRFireArmMagazine Loader;

		private void OnTriggerEnter(Collider collider)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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)
			if (!((Object)(object)Loader != (Object)null) || !((Object)(object)Loader.FireArm == (Object)null) || !((Object)(object)((FVRPhysicalObject)Loader).QuickbeltSlot == (Object)null) || !((Object)(object)((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>() != (Object)null))
			{
				return;
			}
			BreakActionSpeedloaderInsertTrigger component = ((Component)collider).gameObject.GetComponent<BreakActionSpeedloaderInsertTrigger>();
			BreakActionWeapon weapon = component.Weapon;
			if (((FVRFireArm)weapon).RoundType != Loader.RoundType || weapon.m_isLatched)
			{
				return;
			}
			for (int i = 0; i < weapon.Barrels.Length; i++)
			{
				if (Loader.HasARound() && !weapon.Barrels[i].Chamber.IsFull)
				{
					FVRLoadedRound val = Loader.RemoveRound(0);
					Transform transform = Loader.DisplayBullets[Mathf.Clamp(0, Loader.DisplayBullets.Length - 1, i)].transform;
					weapon.Barrels[i].Chamber.Autochamber(val.LR_Class, transform.position, transform.rotation);
					((FVRFireArm)weapon).PlayAudioEvent((FirearmAudioEventType)20, 1f);
				}
			}
		}
	}
}
namespace KamikazeF0X.CCI_Pepperbox
{
	[BepInPlugin("KamikazeF0X.CCI_Pepperbox", "CCI_Pepperbox", "1.2.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class CCI_PepperboxPlugin : 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(), "KamikazeF0X.CCI_Pepperbox");
			OtherLoader.RegisterDirectLoad(BasePath, "KamikazeF0X.CCI_Pepperbox", "", "", "ccipepperbox", "");
		}
	}
}
public class PrefabLoader : MonoBehaviour
{
	private AssetBundle LoadedPrefabAssetBundle;

	public string PrefabPath;

	public string Prefab_to_Load;

	private void Start()
	{
		LoadPrefab(PrefabPath);
		ActivatePrefab(Prefab_to_Load);
	}

	private void LoadPrefab(string bundleURL)
	{
		LoadedPrefabAssetBundle = AssetBundle.LoadFromFile(bundleURL);
		Debug.Log((object)((!((Object)(object)LoadedPrefabAssetBundle == (Object)null)) ? ("Loaded AssetBundle " + PrefabPath) : "AssetBundle Failed to load"));
	}

	private void ActivatePrefab(string Prefab_to_Load)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		Object val = LoadedPrefabAssetBundle.LoadAsset(Prefab_to_Load);
		Object.Instantiate(val, ((Component)this).transform.position, ((Component)this).transform.rotation);
	}
}
internal class Target : MonoBehaviour
{
	[Tooltip("Clip to be played when shot.")]
	public List<AudioClip> clips;

	[Tooltip("Range of volume for clip, chosen from randomly each time the target is shot.")]
	public Vector2 volumeRange = new Vector2(0.9f, 1.1f);

	[Tooltip("Range of pitch for clip, chosen from randomly each time the target is shot.")]
	public Vector2 pitchRange = new Vector2(0.97f, 1.03f);

	[Tooltip("Range of speed for clip, chosen from randomly each time the target is shot.")]
	public Vector2 speedRange = new Vector2(1f, 1f);

	[Tooltip("A Unity event, useful for triggering events that exist in base Unity code.")]
	public UnityEvent shotEvent;

	public void InitializeComponent()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Expected O, but got Unknown
		ReactiveSteelTarget val = ((Component)this).gameObject.AddComponent<ReactiveSteelTarget>();
		val.HitEvent = new AudioEvent();
		val.HitEvent.Clips = clips;
		val.HitEvent.VolumeRange = volumeRange;
		val.HitEvent.PitchRange = pitchRange;
		val.HitEvent.ClipLengthRange = speedRange;
		if (val.HitEvent.Clips.Count == 0)
		{
			val.HitEvent.Clips = new List<AudioClip>();
			val.HitEvent.Clips.Add(new AudioClip());
		}
		val.BulletHolePrefabs = (GameObject[])(object)new GameObject[0];
	}
}