Decompiled source of OomphFactor v0.0.3

NGA.OomphFactor.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sodalite.ModPanel;
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("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("NGA.OomphFactor")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.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 NGA
{
	[BepInPlugin("NGA.OomphFactor", "OomphFactor", "0.0.1")]
	[BepInDependency("nrgill28.Sodalite", "1.4.1")]
	[BepInProcess("h3vr.exe")]
	public class OomphFactor : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(FVRFireArm))]
		[HarmonyPatch("Recoil")]
		public class FVRFireArmRecoil : MonoBehaviour
		{
			private static void Postfix(FVRFireArm __instance)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				if (RecoilShakeEnabled.Value)
				{
					FVRFireArmRecoilProfile recoilProfile = __instance.GetRecoilProfile();
					float num = ((1f + recoilProfile.MaxVerticalRot > 100f) ? 4f : (recoilProfile.MaxVerticalRot / 100f));
					ScreenShake.TriggerShake(new ShakeProfile(RecoilMagMult.Value * num, RecoilLenghtShake.Value, RecoilShakeFalloffExp.Value));
					Logger.LogMessage((object)("Recoil Mult: " + recoilProfile.MaxVerticalRot));
				}
			}
		}

		[HarmonyPatch(typeof(FVRPlayerHitbox))]
		[HarmonyPatch("Damage", new Type[] { typeof(Damage) })]
		public class FVRPlayerHitboxDamage : MonoBehaviour
		{
			private static void Postfix(FVRPlayerHitbox __instance, Damage d)
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				if (DamageVignEnabled.Value)
				{
					Color val = default(Color);
					((Color)(ref val))..ctor(0f, 0f, 0f, DamageVignAlpha.Value);
					ScreenShake.TriggerShake(new ShakeProfile(DamageVignWarp.Value, DamageVignLen.Value, DamageVignDropOff.Value), new VignetteProfile(DamageVignMagMult.Value, DamageVignRadius.Value, DamageVignLen.Value, val));
				}
			}
		}

		[HarmonyPatch(typeof(FVRFireArm))]
		[HarmonyPatch("Awake")]
		public class FVRFireArmAwake : MonoBehaviour
		{
			private static void Prefix(FVRFireArm __instance)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Invalid comparison between Unknown and I4
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Invalid comparison between Unknown and I4
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Invalid comparison between Unknown and I4
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: 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_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				if (MuzzleFlashUpgradeEnabled.Value)
				{
					if ((int)__instance.DefaultMuzzleEffectSize == 0)
					{
						__instance.DefaultMuzzleEffectSize = (MuzzleEffectSize)1;
					}
					else if ((int)__instance.DefaultMuzzleEffectSize == 1)
					{
						__instance.DefaultMuzzleEffectSize = (MuzzleEffectSize)2;
					}
					else if ((int)__instance.DefaultMuzzleEffectSize == 2)
					{
						__instance.DefaultMuzzleEffectSize = (MuzzleEffectSize)3;
					}
					else
					{
						__instance.DefaultMuzzleEffectSize = (MuzzleEffectSize)4;
					}
					MuzzleEffect[] muzzleEffects = __instance.MuzzleEffects;
					foreach (MuzzleEffect val in muzzleEffects)
					{
						val.Size = __instance.DefaultMuzzleEffectSize;
					}
				}
			}
		}

		private static ConfigEntry<bool> RecoilShakeEnabled;

		private static ConfigEntry<float> RecoilMagMult;

		private static ConfigEntry<float> RecoilLenghtShake;

		private static ConfigEntry<float> RecoilShakeFalloffExp;

		private static ConfigEntry<bool> DamageVignEnabled;

		private static ConfigEntry<float> DamageVignMagMult;

		private static ConfigEntry<float> DamageVignLen;

		private static ConfigEntry<float> DamageVignRadius;

		private static ConfigEntry<float> DamageVignDropOff;

		private static ConfigEntry<float> DamageVignAlpha;

		private static ConfigEntry<float> DamageVignWarp;

		private static ConfigEntry<bool> MuzzleFlashUpgradeEnabled;

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("NGA.OomphFactor");
			Logger.LogMessage((object)"New harmony");
			SetUpConfigFields();
			Logger.LogMessage((object)"Setted the fields");
			val.PatchAll();
			Logger.LogMessage((object)"Hello, world! Sent from NGA.OomphFactor 0.0.1");
		}

		private void SetUpConfigFields()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			RecoilShakeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Recoil", "ON/OFF", true, "Enable camera warp?");
			RecoilMagMult = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil", "Recoil Warp Multiplier", 0.05f, new ConfigDescription("How hard it Warps", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 5f, 0.01f), new object[0]));
			RecoilLenghtShake = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil", "Length of  Warp", 0.1f, new ConfigDescription("How long it Warps", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 2f, 0.05f), new object[0]));
			RecoilShakeFalloffExp = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil", "Warp Falloff Exponent", 0.5f, new ConfigDescription("How quickly the Warp dissipates", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 10f, 0.05f), new object[0]));
			DamageVignEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Damaged", "ON/OFF", true, "Enable player hit vignete effect");
			DamageVignMagMult = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Vignette Magnitude", 0.1f, new ConfigDescription("How hard it does", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			DamageVignLen = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Length of  Vignette", 3f, new ConfigDescription("How long it does", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			DamageVignRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Radius of Vignette", 1f, new ConfigDescription("How wide it does", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			DamageVignAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Vignette Transparency", 1f, new ConfigDescription("How invisible it does", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			DamageVignWarp = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Vignette Shake Magnitude", 0.1f, new ConfigDescription("How hard it does", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			DamageVignDropOff = ((BaseUnityPlugin)this).Config.Bind<float>("Damaged", "Vignette Dropoff Exp", 6.2f, new ConfigDescription("How fast it dissipates", (AcceptableValueBase)new AcceptableValueFloatRangeStep(0f, 100f, 0.1f), new object[0]));
			MuzzleFlashUpgradeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Gun Effects", "ON/OFF", true, "Requires NEWLY SPAWNED GUN. Enable muzzle flash upgrades");
		}
	}
}