Decompiled source of TerribleScripts v0.2.3

TerribleScripts.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using FistVR;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("nootarc")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Scripts for my mods. It's like i'm a real modder now!")]
[assembly: AssemblyFileVersion("0.2.3.0")]
[assembly: AssemblyInformationalVersion("0.2.3+28bb7bedf0040a9525a519f640518c06e78588ac")]
[assembly: AssemblyProduct("TerribleScripts")]
[assembly: AssemblyTitle("TerribleScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace nootarc
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("TerribleScripts", "TerribleScripts", "0.2.3+28bb7bedf0040a9525a519f640518c06e78588ac")]
	public class TerribleScriptsBase : BaseUnityPlugin
	{
		public const string Id = "TerribleScripts";

		public static string Name => "TerribleScripts";

		public static string Version => "0.2.3+28bb7bedf0040a9525a519f640518c06e78588ac";

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "TerribleScripts.cfg"), true);
		}
	}
	[CreateAssetMenu(menuName = "Misc/CalculateBDCC", fileName = "NewBDCCurve")]
	public class ScaleBDCC : ScriptableObject
	{
		public AnimationCurve curve;

		public AnimationCurve scaledCurve;

		public float Width = 1f;

		public float Height = 0.1f;

		[ContextMenu("Scale Curve")]
		public void ScaleCurve()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < curve.keys.Length; i++)
			{
				Keyframe val = curve.keys[i];
				((Keyframe)(ref val)).value = ((Keyframe)(ref curve.keys[i])).value * Height;
				((Keyframe)(ref val)).time = ((Keyframe)(ref curve.keys[i])).time * Width;
				((Keyframe)(ref val)).inTangent = ((Keyframe)(ref curve.keys[i])).inTangent * Height / Width;
				((Keyframe)(ref val)).outTangent = ((Keyframe)(ref curve.keys[i])).outTangent * Height / Width;
				scaledCurve.AddKey(val);
			}
		}
	}
}
namespace nootarc.WeaponModifications
{
	public class IntegratedMagazineButtonReplenish : MonoBehaviour
	{
		[Tooltip("The round class that should be replenished by default if the gun spawns empty")]
		public FireArmRoundClass FallbackRoundClass;

		public FVRFireArm firearm;

		[Tooltip("Delay in seconds between loading rounds")]
		public float replenishRate = 0.066f;

		public bool ShouldMakeSoundOnIndividualRoundReplenish;

		[HideInInspector]
		public bool isReplenishing = true;

		[HideInInspector]
		public float replenishTimer;

		[HideInInspector]
		public FireArmRoundClass RoundClass;

		private FVRViveHand hand;

		public void Awake()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			RoundClass = FallbackRoundClass;
		}

		public void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			hand = ((FVRInteractiveObject)firearm).m_hand;
			if (RoundClass != firearm.FChambers[0].GetRound().RoundClass && (Object)(object)firearm.FChambers[0].GetRound() != (Object)null)
			{
				RoundClass = firearm.FChambers[0].GetRound().RoundClass;
			}
			if (!((Object)(object)hand != (Object)null))
			{
				return;
			}
			if (hand.IsInStreamlinedMode)
			{
				if (hand.Input.AXButtonDown)
				{
					goto IL_00eb;
				}
				if (!hand.Input.AXButtonDown)
				{
					goto IL_011c;
				}
			}
			else
			{
				if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f)
				{
					goto IL_00eb;
				}
				if (!hand.Input.TouchpadDown)
				{
					goto IL_011c;
				}
			}
			goto IL_0125;
			IL_0125:
			if (replenishTimer > 0f)
			{
				replenishTimer -= Time.deltaTime;
			}
			if (isReplenishing && replenishTimer <= 0f)
			{
				firearm.Magazine.AddRound(RoundClass, ShouldMakeSoundOnIndividualRoundReplenish, false);
				replenishTimer = replenishRate;
			}
			return;
			IL_00eb:
			isReplenishing = true;
			goto IL_0125;
			IL_011c:
			isReplenishing = false;
			goto IL_0125;
		}
	}
}
namespace nootarc.HCBBoltStuff
{
	public class HCBBoltify : MonoBehaviour
	{
		public FVRFireArm FireArm;

		public FVRFireArmChamber Chamber;

		private void Hook()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			GM.CurrentSceneSettings.ShotFiredEvent += new ShotFired(OnShotFired);
		}

		private void OnShotFired(FVRFireArm firearm)
		{
			//IL_004e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)firearm == (Object)(object)FireArm && (Object)(object)((Component)Chamber.GetRound()).GetComponent<RoundHCBBoltType>() != (Object)null)
			{
				FVRFireArmRound round = Chamber.GetRound();
				RoundHCBBoltType component = ((Component)round).GetComponent<RoundHCBBoltType>();
				GameObject roundHCBBolt = component.RoundHCBBolt;
				GameObject val = Object.Instantiate<GameObject>(roundHCBBolt, firearm.CurrentMuzzle.position, firearm.CurrentMuzzle.rotation);
				HCBBolt component2 = val.GetComponent<HCBBolt>();
				component2.SetCookedAmount(1f);
				component2.Fire(firearm.MuzzlePos.forward, firearm.MuzzlePos.position, 1f);
			}
		}

		public void Awake()
		{
			Hook();
		}
	}
	public class RoundHCBBoltType : MonoBehaviour
	{
		public GameObject RoundHCBBolt;
	}
	public class TrepangExplodeyBolt : MonoBehaviour
	{
		public ParticleSystem fuseParticles;

		public AudioEvent fuseSound;

		[HideInInspector]
		public float fuseTime = 3f;

		public float startFuseTime = 3f;

		public List<GameObject> ExplosionSpawns;

		[HideInInspector]
		public int IFF;

		[HideInInspector]
		public float fuseTick;

		public void StartExplosion()
		{
			//IL_008b: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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)
			fuseTime -= Time.deltaTime;
			float num = Mathf.Clamp(1f - fuseTime / startFuseTime, 0f, 1f);
			num = Mathf.Pow(num, 2f);
			if (fuseTick <= 0f)
			{
				fuseTick = Mathf.Lerp(0.3f, 0.01f, num);
				float num2 = Mathf.Lerp(1.8f, 3.7f, num);
				SM.PlayCoreSoundOverrides((FVRPooledAudioType)0, fuseSound, ((Component)this).transform.position, new Vector2(1f, 1f), new Vector2(num2, num2));
				fuseParticles.Emit(2);
			}
			else
			{
				fuseTick -= Time.deltaTime;
			}
			if (!(fuseTime <= 0f))
			{
				return;
			}
			foreach (GameObject explosionSpawn in ExplosionSpawns)
			{
				GameObject val = Object.Instantiate<GameObject>(explosionSpawn, ((Component)this).transform.position, Quaternion.identity);
				Explosion component = val.GetComponent<Explosion>();
				if ((Object)(object)component != (Object)null)
				{
					component.IFF = IFF;
				}
				ExplosionSound component2 = val.GetComponent<ExplosionSound>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.IFF = IFF;
				}
			}
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void Update()
		{
			if (!Object.op_Implicit((Object)(object)((Component)this).gameObject.GetComponent<HCBBolt>()) || !((Component)this).gameObject.GetComponent<HCBBolt>().m_isFlying)
			{
				StartExplosion();
			}
		}
	}
}