Decompiled source of XRotateOomph v1.0.0

Niko666.XRotateOomph.dll

Decompiled 2 days 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 UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Add some more oomph factor to weapons' rotation X-axis (Pitch Up/Down) (also YZ axis if you want to) because your meats are too weak to hold da recoil lol")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Niko666.XRotateOomph")]
[assembly: AssemblyTitle("XRotateOomph")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 Niko666
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("Niko666.XRotateOomph", "XRotateOomph", "1.0.0")]
	public class XRotateOomph : BaseUnityPlugin
	{
		private ConfigEntry<float> configXAxisOomphAmount;

		private ConfigEntry<float> configForceAddXAxisOomphAmount;

		private ConfigEntry<float> configYAxisOomphAmount;

		private ConfigEntry<float> configForceAddYAxisOomphAmount;

		private ConfigEntry<float> configZAxisOomphAmount;

		private ConfigEntry<float> configForceAddZAxisOomphAmount;

		public static float XAxisOomphAmount = 1.5f;

		public static float YAxisOomphAmount = 1.1f;

		public static float ZAxisOomphAmount = 1.1f;

		public static float ForceAddXAxisOomphAmount = 3f;

		public static float ForceAddYAxisOomphAmount = 1f;

		public static float ForceAddZAxisOomphAmount = 1f;

		public const string Id = "Niko666.XRotateOomph";

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "XRotateOomph";

		public static string Version => "1.0.0";

		private void Awake()
		{
			configXAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "XAxisOomphAmount", 1.5f, "The amount of oomphs you want on X-Axis (Pitch Up/Down). 1 being H3VR defaults.");
			configForceAddXAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ForceAddXAxisOomphAmount", 3f, "The amount of oomphs which will always get added on X-Axis so single fire will still have some oomphs");
			configYAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "YAxisOomphAmount", 1.1f, "The amount of oomphs you want on Y-Axis (Yaw Left/Right). 1 being H3VR defaults.");
			configForceAddYAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ForceAddYAxisOomphAmount", 1f, "The (random) amount of oomphs which will always get added on Y-Axis so single fire will still have some oomphs");
			configZAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ZAxisOomphAmount", 1.1f, "The amount of oomphs you want on Z-Axis (Roll Left/Right). 1 being H3VR defaults.");
			configForceAddZAxisOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ForceAddZAxisOomphAmount", 1f, "The (random) amount of oomphs which will always get added on Z-Axis so single fire will still have some oomphs");
			XAxisOomphAmount = configXAxisOomphAmount.Value;
			ForceAddXAxisOomphAmount = configForceAddXAxisOomphAmount.Value;
			YAxisOomphAmount = configYAxisOomphAmount.Value;
			ForceAddYAxisOomphAmount = configForceAddYAxisOomphAmount.Value;
			ZAxisOomphAmount = configZAxisOomphAmount.Value;
			ForceAddZAxisOomphAmount = configForceAddZAxisOomphAmount.Value;
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(typeof(XRotateOomphPatch), (string)null);
			Logger.LogMessage((object)("Fuck this world! Sent from Niko666.XRotateOomph " + Version));
		}
	}
	internal class XRotateOomphPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(FVRFireArm), "Recoil")]
		[HarmonyPostfix]
		public static void ZRotateOomphing(FVRFireArm __instance)
		{
			__instance.m_recoilX = XRotateOomph.ForceAddXAxisOomphAmount + __instance.m_recoilX * XRotateOomph.XAxisOomphAmount;
			__instance.m_recoilY = Random.Range(0f - XRotateOomph.ForceAddYAxisOomphAmount, XRotateOomph.ForceAddYAxisOomphAmount) + __instance.m_recoilY * XRotateOomph.YAxisOomphAmount;
			__instance.m_recoilZ = Random.Range(0f - XRotateOomph.ForceAddZAxisOomphAmount, XRotateOomph.ForceAddZAxisOomphAmount) + __instance.m_recoilZ * XRotateOomph.ZAxisOomphAmount;
		}
	}
}