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 BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Enhance and modify vanilla weapon recoil parameters as you wish. Successor of ZLinearOomph and XRotateOomph.")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0")]
[assembly: AssemblyProduct("Niko666.UniversalRecoilControl")]
[assembly: AssemblyTitle("UniversalRecoilControl")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.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.UniversalRecoilControl", "UniversalRecoilControl", "2.0.0")]
public class UniversalRecoilControl : BaseUnityPlugin
{
public class WeaponSettings
{
public float? VerticalRotPerShot_MultiplyAmount { get; set; }
public float? VerticalRotPerShot_AddendAmount { get; set; }
public float? HorizontalRotPerShot_MultiplyAmount { get; set; }
public float? HorizontalRotPerShot_AddendAmount { get; set; }
public float? MaxVerticalRot_MultiplyAmount { get; set; }
public float? MaxHorizontalRot_MultiplyAmount { get; set; }
public float? VerticalRotRecovery_MultiplyAmount { get; set; }
public float? HorizontalRotRecovery_MultiplyAmount { get; set; }
public float? ZLinearPerShot_MultiplyAmount { get; set; }
public float? ZLinearPerShot_AddendAmount { get; set; }
public float? ZLinearMax_MultiplyAmount { get; set; }
public float? ZLinearRecovery_MultiplyAmount { get; set; }
public float? XYLinearPerShot_MultiplyAmount { get; set; }
public float? XYLinearPerShot_AddendAmount { get; set; }
public float? XYLinearMax_MultiplyAmount { get; set; }
public float? XYLinearRecovery_MultiplyAmount { get; set; }
public bool? IsConstantRecoil { get; set; }
public float? VerticalRotPerShot_Bipodded_MultiplyAmount { get; set; }
public float? VerticalRotPerShot_Bipodded_AddendAmount { get; set; }
public float? HorizontalRotPerShot_Bipodded_MultiplyAmount { get; set; }
public float? HorizontalRotPerShot_Bipodded_AddendAmount { get; set; }
public float? MaxVerticalRot_Bipodded_MultiplyAmount { get; set; }
public float? MaxHorizontalRot_Bipodded_MultiplyAmount { get; set; }
public float? RecoveryStabilizationFactors_Foregrip_MultiplyAmount { get; set; }
public float? RecoveryStabilizationFactors_Twohand_MultiplyAmount { get; set; }
public float? RecoveryStabilizationFactors_None_MultiplyAmount { get; set; }
public float? MassDriftIntensity_MultiplyAmount { get; set; }
public float? MassDriftFactors_MultiplyAmount { get; set; }
public float? MaxMassDriftMagnitude_MultiplyAmount { get; set; }
public float? MaxMassMaxRotation_MultiplyAmount { get; set; }
public float? MassDriftRecoveryFactor_MultiplyAmount { get; set; }
}
public class RecoilConfigData
{
public Dictionary<string, WeaponSettings> WeaponOverrides { get; set; }
}
public static Dictionary<string, WeaponSettings> WeaponOverrides = new Dictionary<string, WeaponSettings>();
public ConfigEntry<bool> configLogDebug;
public ConfigEntry<float> configVerticalRotPerShot_MultiplyAmount;
public ConfigEntry<float> configVerticalRotPerShot_AddendAmount;
public ConfigEntry<float> configHorizontalRotPerShot_MultiplyAmount;
public ConfigEntry<float> configHorizontalRotPerShot_AddendAmount;
public ConfigEntry<float> configMaxVerticalRot_MultiplyAmount;
public ConfigEntry<float> configMaxHorizontalRot_MultiplyAmount;
public ConfigEntry<float> configVerticalRotRecovery_MultiplyAmount;
public ConfigEntry<float> configHorizontalRotRecovery_MultiplyAmount;
public ConfigEntry<float> configZLinearPerShot_MultiplyAmount;
public ConfigEntry<float> configZLinearPerShot_AddendAmount;
public ConfigEntry<float> configZLinearMax_MultiplyAmount;
public ConfigEntry<float> configZLinearRecovery_MultiplyAmount;
public ConfigEntry<float> configXYLinearPerShot_MultiplyAmount;
public ConfigEntry<float> configXYLinearPerShot_AddendAmount;
public ConfigEntry<float> configXYLinearMax_MultiplyAmount;
public ConfigEntry<float> configXYLinearRecovery_MultiplyAmount;
public ConfigEntry<bool> configIsConstantRecoil;
public ConfigEntry<float> configVerticalRotPerShot_Bipodded_MultiplyAmount;
public ConfigEntry<float> configVerticalRotPerShot_Bipodded_AddendAmount;
public ConfigEntry<float> configHorizontalRotPerShot_Bipodded_MultiplyAmount;
public ConfigEntry<float> configHorizontalRotPerShot_Bipodded_AddendAmount;
public ConfigEntry<float> configMaxVerticalRot_Bipodded_MultiplyAmount;
public ConfigEntry<float> configMaxHorizontalRot_Bipodded_MultiplyAmount;
public ConfigEntry<float> configRecoveryStabilizationFactors_Foregrip_MultiplyAmount;
public ConfigEntry<float> configRecoveryStabilizationFactors_Twohand_MultiplyAmount;
public ConfigEntry<float> configRecoveryStabilizationFactors_None_MultiplyAmount;
public ConfigEntry<float> configMassDriftIntensity_MultiplyAmount;
public ConfigEntry<float> configMassDriftFactors_MultiplyAmount;
public ConfigEntry<float> configMaxMassDriftMagnitude_MultiplyAmount;
public ConfigEntry<float> configMaxMassMaxRotation_MultiplyAmount;
public ConfigEntry<float> configMassDriftRecoveryFactor_MultiplyAmount;
private const float DefaultVerticalRotPerShot_MultiplyAmount = 1.1f;
private const float DefaultVerticalRotPerShot_AddendAmount = 1f;
private const float DefaultHorizontalRotPerShot_MultiplyAmount = 1.1f;
private const float DefaultHorizontalRotPerShot_AddendAmount = 1f;
private const float DefaultMaxVerticalRot_MultiplyAmount = 1.1f;
private const float DefaultMaxHorizontalRot_MultiplyAmount = 1.1f;
private const float DefaultVerticalRotRecovery_MultiplyAmount = 1f;
private const float DefaultHorizontalRotRecovery_MultiplyAmount = 1f;
private const float DefaultZLinearPerShot_MultiplyAmount = 1.5f;
private const float DefaultZLinearPerShot_AddendAmount = 5f;
private const float DefaultZLinearMax_MultiplyAmount = 1.5f;
private const float DefaultZLinearRecovery_MultiplyAmount = 1f;
private const float DefaultXYLinearPerShot_MultiplyAmount = 1.1f;
private const float DefaultXYLinearPerShot_AddendAmount = 1f;
private const float DefaultXYLinearMax_MultiplyAmount = 1.1f;
private const float DefaultXYLinearRecovery_MultiplyAmount = 1f;
private const bool DefaultIsConstantRecoil = false;
private const float DefaultVerticalRotPerShot_Bipodded_MultiplyAmount = 1.1f;
private const float DefaultVerticalRotPerShot_Bipodded_AddendAmount = 1f;
private const float DefaultHorizontalRotPerShot_Bipodded_MultiplyAmount = 1.1f;
private const float DefaultHorizontalRotPerShot_Bipodded_AddendAmount = 1f;
private const float DefaultMaxVerticalRot_Bipodded_MultiplyAmount = 1.1f;
private const float DefaultMaxHorizontalRot_Bipodded_MultiplyAmount = 1.1f;
private const float DefaultRecoveryStabilizationFactors_Foregrip_MultiplyAmount = 1f;
private const float DefaultRecoveryStabilizationFactors_Twohand_MultiplyAmount = 1f;
private const float DefaultRecoveryStabilizationFactors_None_MultiplyAmount = 1f;
private const float DefaultMassDriftIntensity_MultiplyAmount = 1f;
private const float DefaultMassDriftFactors_MultiplyAmount = 1f;
private const float DefaultMaxMassDriftMagnitude_MultiplyAmount = 1f;
private const float DefaultMaxMassMaxRotation_MultiplyAmount = 1f;
private const float DefaultMassDriftRecoveryFactor_MultiplyAmount = 1f;
public const string Id = "Niko666.UniversalRecoilControl";
public static UniversalRecoilControl Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
public static string Name => "UniversalRecoilControl";
public static string Version => "2.0.0";
public void Awake()
{
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
configLogDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogDebug", false, "Log debug information");
configVerticalRotPerShot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "VerticalRotPerShot_MultiplyAmount", 1.1f, "Multiply the vertical recoil rotations (Pitch Up/Down). 1 being H3VR defaults.");
configVerticalRotPerShot_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "VerticalRotPerShot_AddendAmount", 1f, "The amount of rotations which will always get added on vertical recoils so weaker firearms will still have some movements");
configHorizontalRotPerShot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "HorizontalRotPerShot_MultiplyAmount", 1.1f, "Multiply the horizontal recoil rotations (Yaw Left/Right). 1 being H3VR defaults.");
configHorizontalRotPerShot_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "HorizontalRotPerShot_AddendAmount", 1f, "The amount of rotations which will always get added on horizontal recoils so weaker firearms will still have some movements");
configMaxVerticalRot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "MaxVerticalRot_MultiplyAmount", 1.1f, "Multiply the maximun vertical recoil rotations (Pitch Up/Down). 1 being H3VR defaults.");
configMaxHorizontalRot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "MaxHorizontalRot_MultiplyAmount", 1.1f, "Multiply the maximun horizontal recoil rotations (Yaw Left/Right). 1 being H3VR defaults.");
configVerticalRotRecovery_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "VerticalRotRecovery_MultiplyAmount", 1f, "Multiply the vertical recoil recovery speed. 1 being H3VR defaults.");
configHorizontalRotRecovery_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "HorizontalRotRecovery_MultiplyAmount", 1f, "Multiply the horizontal recoil recovery speed. 1 being H3VR defaults.");
configZLinearPerShot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "ZLinearPerShot_MultiplyAmount", 1.5f, "Multiply the Z linear recoil movements (Backwards/Forwards). 1 being H3VR defaults.");
configZLinearPerShot_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "ZLinearPerShot_AddendAmount", 5f, "The amount of movements which will always get added on Z linear recoils so weaker firearms will still have some movements");
configZLinearMax_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "ZLinearMax_MultiplyAmount", 1.5f, "Multiply the maximun Z linear recoil movements (Backwards/Forwards). 1 being H3VR defaults.");
configZLinearRecovery_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "ZLinearRecovery_MultiplyAmount", 1f, "Multiply the Z linear recoil recovery speed. 1 being H3VR defaults.");
configXYLinearPerShot_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "XYLinearPerShot_MultiplyAmount", 1.1f, "Multiply the XY linear recoil movements (Left/Right). 1 being H3VR defaults.");
configXYLinearPerShot_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "XYLinearPerShot_AddendAmount", 1f, "The amount of movements which will always get added on XY linear recoils so weaker firearms will still have some movements");
configXYLinearMax_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "XYLinearMax_MultiplyAmount", 1.1f, "Multiply the maximun XY linear recoil movements (Left/Right). 1 being H3VR defaults.");
configXYLinearRecovery_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Impulse Params", "XYLinearRecovery_MultiplyAmount", 1f, "Multiply the XY linear recoil recovery speed. 1 being H3VR defaults.");
configIsConstantRecoil = ((BaseUnityPlugin)this).Config.Bind<bool>("Recoil Impulse Params", "IsConstantRecoil", false, "Toggle if the firearm uses constant recoil. Untested but most firearms has this off.");
configVerticalRotPerShot_Bipodded_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "VerticalRotPerShot_Bipodded_MultiplyAmount", 1.1f, "Multiply the vertical recoil per shot when bipodded. 1 being H3VR defaults.");
configVerticalRotPerShot_Bipodded_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "VerticalRotPerShot_Bipodded_AddendAmount", 1f, "The amount of movements which will always get added on vertical recoil so weaker firearms will still have some movements");
configHorizontalRotPerShot_Bipodded_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "HorizontalRotPerShot_Bipodded_MultiplyAmount", 1.1f, "Multiply the horizontal recoil per shot when bipodded. 1 being H3VR defaults.");
configHorizontalRotPerShot_Bipodded_AddendAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "HorizontalRotPerShot_Bipodded_AddendAmount", 1f, "The amount of movements which will always get added on horizontal recoil so weaker firearms will still have some movements");
configMaxVerticalRot_Bipodded_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "MaxVerticalRot_Bipodded_MultiplyAmount", 1.1f, "Multiply the maximun vertical recoil when bipodded. 1 being H3VR defaults.");
configMaxHorizontalRot_Bipodded_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Bipodded Params", "MaxHorizontalRot_Bipodded_MultiplyAmount", 1.1f, "Multiply the maximun horizontal recoil when bipodded. 1 being H3VR defaults.");
configRecoveryStabilizationFactors_Foregrip_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Recovery Params", "RecoveryStabilizationFactors_Foregrip_MultiplyAmount", 1f, "Multiply the recoil stabilization factors when holding the foregrip. 1 being H3VR defaults.");
configRecoveryStabilizationFactors_Twohand_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Recovery Params", "RecoveryStabilizationFactors_Twohand_MultiplyAmount", 1f, "Multiply the recoil stabilization factors when holding the firearm two-handed. 1 being H3VR defaults.");
configRecoveryStabilizationFactors_None_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Recoil Recovery Params", "RecoveryStabilizationFactors_None_MultiplyAmount", 1f, "Multiply the recoil stabilization factors when there's no special action (one-handed). 1 being H3VR defaults.");
configMassDriftIntensity_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Dimension/Mass Related Params", "MassDriftIntensity_MultiplyAmount", 1f, "Multiply the mass drift intensity. 1 being H3VR defaults.");
configMassDriftFactors_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Dimension/Mass Related Params", "MassDriftFactors_MultiplyAmount", 1f, "Multiply the mass drift factors. 1 being H3VR defaults.");
configMaxMassDriftMagnitude_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Dimension/Mass Related Params", "MaxMassDriftMagnitude_MultiplyAmount", 1f, "Multiply the maximun mass drift magnitude. 1 being H3VR defaults.");
configMaxMassMaxRotation_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Dimension/Mass Related Params", "MaxMassMaxRotation_MultiplyAmount", 1f, "Multiply the maximun mass max rotation. 1 being H3VR defaults.");
configMassDriftRecoveryFactor_MultiplyAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Weapon Dimension/Mass Related Params", "MassDriftRecoveryFactor_MultiplyAmount", 1f, "Multiply the mass drift recovery factor. 1 being H3VR defaults.");
Instance.LoadJsonConfig();
Harmony.CreateAndPatchAll(typeof(UniversalRecoilControlPatch), (string)null);
Logger.LogMessage((object)("Fuck this world! Sent from Niko666.UniversalRecoilControl " + Version));
}
public void LogDebugMessage(string message)
{
if (Instance.configLogDebug.Value)
{
Logger.LogInfo((object)message);
}
}
public void CreateDefaultJsonConfig(string path)
{
try
{
string contents = JsonConvert.SerializeObject((object)new RecoilConfigData
{
WeaponOverrides = new Dictionary<string, WeaponSettings>
{
{
"InsertFirearmObjectIDHere",
new WeaponSettings
{
VerticalRotPerShot_MultiplyAmount = 1f,
VerticalRotPerShot_AddendAmount = 0f,
HorizontalRotPerShot_MultiplyAmount = 1f,
HorizontalRotPerShot_AddendAmount = 0f,
MaxVerticalRot_MultiplyAmount = 1f,
MaxHorizontalRot_MultiplyAmount = 1f,
VerticalRotRecovery_MultiplyAmount = 1f,
HorizontalRotRecovery_MultiplyAmount = 1f,
ZLinearPerShot_MultiplyAmount = 1f,
ZLinearPerShot_AddendAmount = 0f,
ZLinearMax_MultiplyAmount = 1f,
ZLinearRecovery_MultiplyAmount = 1f,
XYLinearPerShot_MultiplyAmount = 1f,
XYLinearPerShot_AddendAmount = 0f,
XYLinearMax_MultiplyAmount = 1f,
XYLinearRecovery_MultiplyAmount = 1f,
IsConstantRecoil = false,
VerticalRotPerShot_Bipodded_MultiplyAmount = 1f,
VerticalRotPerShot_Bipodded_AddendAmount = 0f,
HorizontalRotPerShot_Bipodded_MultiplyAmount = 1f,
HorizontalRotPerShot_Bipodded_AddendAmount = 0f,
MaxVerticalRot_Bipodded_MultiplyAmount = 1f,
MaxHorizontalRot_Bipodded_MultiplyAmount = 1f,
RecoveryStabilizationFactors_Foregrip_MultiplyAmount = 1f,
RecoveryStabilizationFactors_Twohand_MultiplyAmount = 1f,
RecoveryStabilizationFactors_None_MultiplyAmount = 1f,
MassDriftIntensity_MultiplyAmount = 1f,
MassDriftFactors_MultiplyAmount = 1f,
MaxMassDriftMagnitude_MultiplyAmount = 1f,
MaxMassMaxRotation_MultiplyAmount = 1f,
MassDriftRecoveryFactor_MultiplyAmount = 1f
}
},
{
"ForExampleM1911Classic",
new WeaponSettings
{
VerticalRotPerShot_MultiplyAmount = 1f,
VerticalRotPerShot_AddendAmount = 0f,
HorizontalRotPerShot_MultiplyAmount = 1f,
HorizontalRotPerShot_AddendAmount = 0f,
MaxVerticalRot_MultiplyAmount = 1f,
MaxHorizontalRot_MultiplyAmount = 1f,
VerticalRotRecovery_MultiplyAmount = 1f,
HorizontalRotRecovery_MultiplyAmount = 1f,
ZLinearPerShot_MultiplyAmount = 1f,
ZLinearPerShot_AddendAmount = 0f,
ZLinearMax_MultiplyAmount = 1f,
ZLinearRecovery_MultiplyAmount = 1f,
XYLinearPerShot_MultiplyAmount = 1f,
XYLinearPerShot_AddendAmount = 0f,
XYLinearMax_MultiplyAmount = 1f,
XYLinearRecovery_MultiplyAmount = 1f,
IsConstantRecoil = false,
VerticalRotPerShot_Bipodded_MultiplyAmount = 1f,
VerticalRotPerShot_Bipodded_AddendAmount = 0f,
HorizontalRotPerShot_Bipodded_MultiplyAmount = 1f,
HorizontalRotPerShot_Bipodded_AddendAmount = 0f,
MaxVerticalRot_Bipodded_MultiplyAmount = 1f,
MaxHorizontalRot_Bipodded_MultiplyAmount = 1f,
RecoveryStabilizationFactors_Foregrip_MultiplyAmount = 1f,
RecoveryStabilizationFactors_Twohand_MultiplyAmount = 1f,
RecoveryStabilizationFactors_None_MultiplyAmount = 1f,
MassDriftIntensity_MultiplyAmount = 1f,
MassDriftFactors_MultiplyAmount = 1f,
MaxMassDriftMagnitude_MultiplyAmount = 1f,
MaxMassMaxRotation_MultiplyAmount = 1f,
MassDriftRecoveryFactor_MultiplyAmount = 1f
}
}
}
}, (Formatting)1);
File.WriteAllText(path, contents);
Logger.LogInfo((object)("Created default config at: " + path));
}
catch (Exception ex)
{
Logger.LogError((object)("Error creating default config: " + ex.Message + "\n" + ex.StackTrace));
}
}
public void LoadJsonConfig()
{
try
{
string directoryName = Path.GetDirectoryName(Paths.BepInExConfigPath);
if (string.IsNullOrEmpty(directoryName))
{
Logger.LogError((object)"Failed to get config directory path.");
return;
}
string path = Path.Combine(directoryName, "Niko666.UniversalRecoilControl.json");
if (!File.Exists(path))
{
Logger.LogWarning((object)"Config file not found. Creating default config...");
CreateDefaultJsonConfig(path);
}
RecoilConfigData recoilConfigData = JsonConvert.DeserializeObject<RecoilConfigData>(File.ReadAllText(path));
if (recoilConfigData == null || recoilConfigData.WeaponOverrides == null)
{
return;
}
WeaponOverrides = recoilConfigData.WeaponOverrides;
Logger.LogInfo((object)$"Successfully loaded {WeaponOverrides.Count} weapon overrides.");
foreach (KeyValuePair<string, WeaponSettings> weaponOverride in WeaponOverrides)
{
LogDebugMessage(" - " + weaponOverride.Key);
}
}
catch (Exception ex)
{
Logger.LogError((object)("Error loading config: " + ex.Message + "\n" + ex.StackTrace));
}
}
public static FVRFireArmRecoilProfile CopyAndAdjustRecoilProfile(FVRFireArmRecoilProfile orig, string weaponID)
{
//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
//IL_071b: Unknown result type (might be due to invalid IL or missing references)
//IL_0722: Unknown result type (might be due to invalid IL or missing references)
//IL_0727: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmRecoilProfile obj = Object.Instantiate<FVRFireArmRecoilProfile>(orig);
float num = Instance.configVerticalRotPerShot_MultiplyAmount.Value;
float num2 = Instance.configVerticalRotPerShot_AddendAmount.Value;
float num3 = Instance.configHorizontalRotPerShot_MultiplyAmount.Value;
float num4 = Instance.configHorizontalRotPerShot_AddendAmount.Value;
float num5 = Instance.configMaxVerticalRot_MultiplyAmount.Value;
float num6 = Instance.configMaxHorizontalRot_MultiplyAmount.Value;
float num7 = Instance.configVerticalRotRecovery_MultiplyAmount.Value;
float num8 = Instance.configHorizontalRotRecovery_MultiplyAmount.Value;
float num9 = Instance.configZLinearPerShot_MultiplyAmount.Value;
float num10 = Instance.configZLinearPerShot_AddendAmount.Value;
float num11 = Instance.configZLinearMax_MultiplyAmount.Value;
float num12 = Instance.configZLinearRecovery_MultiplyAmount.Value;
float num13 = Instance.configXYLinearPerShot_MultiplyAmount.Value;
float num14 = Instance.configXYLinearPerShot_AddendAmount.Value;
float num15 = Instance.configXYLinearMax_MultiplyAmount.Value;
float num16 = Instance.configXYLinearRecovery_MultiplyAmount.Value;
bool flag = Instance.configIsConstantRecoil.Value;
float num17 = Instance.configVerticalRotPerShot_Bipodded_MultiplyAmount.Value;
float num18 = Instance.configVerticalRotPerShot_Bipodded_AddendAmount.Value;
float num19 = Instance.configHorizontalRotPerShot_Bipodded_MultiplyAmount.Value;
float num20 = Instance.configHorizontalRotPerShot_Bipodded_AddendAmount.Value;
float num21 = Instance.configMaxVerticalRot_Bipodded_MultiplyAmount.Value;
float num22 = Instance.configMaxHorizontalRot_Bipodded_MultiplyAmount.Value;
float num23 = Instance.configRecoveryStabilizationFactors_Foregrip_MultiplyAmount.Value;
float num24 = Instance.configRecoveryStabilizationFactors_Twohand_MultiplyAmount.Value;
float num25 = Instance.configRecoveryStabilizationFactors_None_MultiplyAmount.Value;
float num26 = Instance.configMassDriftIntensity_MultiplyAmount.Value;
float num27 = Instance.configMassDriftFactors_MultiplyAmount.Value;
float num28 = Instance.configMaxMassDriftMagnitude_MultiplyAmount.Value;
float num29 = Instance.configMaxMassMaxRotation_MultiplyAmount.Value;
float num30 = Instance.configMassDriftRecoveryFactor_MultiplyAmount.Value;
if (WeaponOverrides.TryGetValue(weaponID, out var value))
{
Logger.LogInfo((object)("Applying weapon-specific override for " + weaponID));
num = ApplyConfig(value.VerticalRotPerShot_MultiplyAmount, num, "VerticalRotPerShot_MultiplyAmount");
num2 = ApplyConfig(value.VerticalRotPerShot_AddendAmount, num2, "VerticalRotPerShot_AddendAmount");
num3 = ApplyConfig(value.HorizontalRotPerShot_MultiplyAmount, num3, "HorizontalRotPerShot_MultiplyAmount");
num4 = ApplyConfig(value.HorizontalRotPerShot_AddendAmount, num4, "HorizontalRotPerShot_AddendAmount");
num5 = ApplyConfig(value.MaxVerticalRot_MultiplyAmount, num5, "MaxVerticalRot_MultiplyAmount");
num6 = ApplyConfig(value.MaxHorizontalRot_MultiplyAmount, num6, "MaxHorizontalRot_MultiplyAmount");
num7 = ApplyConfig(value.VerticalRotRecovery_MultiplyAmount, num7, "VerticalRotRecovery_MultiplyAmount");
num8 = ApplyConfig(value.HorizontalRotRecovery_MultiplyAmount, num8, "HorizontalRotRecovery_MultiplyAmount");
num9 = ApplyConfig(value.ZLinearPerShot_MultiplyAmount, num9, "ZLinearPerShot_MultiplyAmount");
num10 = ApplyConfig(value.ZLinearPerShot_AddendAmount, num10, "ZLinearPerShot_AddendAmount");
num11 = ApplyConfig(value.ZLinearMax_MultiplyAmount, num11, "ZLinearMax_MultiplyAmount");
num12 = ApplyConfig(value.ZLinearRecovery_MultiplyAmount, num12, "ZLinearRecovery_MultiplyAmount");
num13 = ApplyConfig(value.XYLinearPerShot_MultiplyAmount, num13, "XYLinearPerShot_MultiplyAmount");
num14 = ApplyConfig(value.XYLinearPerShot_AddendAmount, num14, "XYLinearPerShot_AddendAmount");
num15 = ApplyConfig(value.XYLinearMax_MultiplyAmount, num15, "XYLinearMax_MultiplyAmount");
num16 = ApplyConfig(value.XYLinearRecovery_MultiplyAmount, num16, "XYLinearRecovery_MultiplyAmount");
flag = ApplyConfig(value.IsConstantRecoil, flag, "IsConstantRecoil");
num17 = ApplyConfig(value.VerticalRotPerShot_Bipodded_MultiplyAmount, num17, "VerticalRotPerShot_Bipodded_MultiplyAmount");
num18 = ApplyConfig(value.VerticalRotPerShot_Bipodded_AddendAmount, num18, "VerticalRotPerShot_Bipodded_AddendAmount");
num19 = ApplyConfig(value.HorizontalRotPerShot_Bipodded_MultiplyAmount, num19, "HorizontalRotPerShot_Bipodded_MultiplyAmount");
num20 = ApplyConfig(value.HorizontalRotPerShot_Bipodded_AddendAmount, num20, "HorizontalRotPerShot_Bipodded_AddendAmount");
num21 = ApplyConfig(value.MaxVerticalRot_Bipodded_MultiplyAmount, num21, "MaxVerticalRot_Bipodded_MultiplyAmount");
num22 = ApplyConfig(value.MaxHorizontalRot_Bipodded_MultiplyAmount, num22, "MaxHorizontalRot_Bipodded_MultiplyAmount");
num23 = ApplyConfig(value.RecoveryStabilizationFactors_Foregrip_MultiplyAmount, num23, "RecoveryStabilizationFactors_Foregrip_MultiplyAmount");
num24 = ApplyConfig(value.RecoveryStabilizationFactors_Twohand_MultiplyAmount, num24, "RecoveryStabilizationFactors_Twohand_MultiplyAmount");
num25 = ApplyConfig(value.RecoveryStabilizationFactors_None_MultiplyAmount, num25, "RecoveryStabilizationFactors_Bipod_MultiplyAmount");
num26 = ApplyConfig(value.MassDriftIntensity_MultiplyAmount, num26, "MassDriftIntensity_MultiplyAmount");
num27 = ApplyConfig(value.MassDriftFactors_MultiplyAmount, num27, "MassDriftFactors_MultiplyAmount");
num28 = ApplyConfig(value.MaxMassDriftMagnitude_MultiplyAmount, num28, "MaxMassDriftMagnitude_MultiplyAmount");
num29 = ApplyConfig(value.MaxMassMaxRotation_MultiplyAmount, num29, "MaxMassMaxRotation_MultiplyAmount");
num30 = ApplyConfig(value.MassDriftRecoveryFactor_MultiplyAmount, num30, "MassDriftRecoveryFactor_MultiplyAmount");
}
obj.VerticalRotPerShot = ValidateFloat(num * orig.VerticalRotPerShot + num2, orig.VerticalRotPerShot, "VerticalRotPerShot");
obj.HorizontalRotPerShot = ValidateFloat(num3 * orig.HorizontalRotPerShot + num4, orig.HorizontalRotPerShot, "HorizontalRotPerShot");
obj.MaxVerticalRot = ValidateFloatNoZero(num5 * orig.MaxVerticalRot, orig.MaxVerticalRot, "MaxVerticalRot");
obj.MaxHorizontalRot = ValidateFloatNoZero(num6 * orig.MaxHorizontalRot, orig.MaxHorizontalRot, "MaxHorizontalRot");
obj.VerticalRotRecovery = ValidateFloat(num7 * orig.VerticalRotRecovery, orig.VerticalRotRecovery, "VerticalRotRecovery");
obj.HorizontalRotRecovery = ValidateFloat(num8 * orig.HorizontalRotRecovery, orig.HorizontalRotRecovery, "HorizontalRotRecovery");
obj.ZLinearPerShot = ValidateFloat(num9 * orig.ZLinearPerShot + num10, orig.ZLinearPerShot, "ZLinearPerShot");
obj.ZLinearMax = ValidateFloatNoZero(num11 * orig.ZLinearMax, orig.ZLinearMax, "ZLinearMax");
obj.ZLinearRecovery = ValidateFloat(num12 * orig.ZLinearRecovery, orig.ZLinearRecovery, "ZLinearRecovery");
obj.XYLinearPerShot = ValidateFloat(num13 * orig.XYLinearPerShot + num14, orig.XYLinearPerShot, "XYLinearPerShot");
obj.XYLinearMax = ValidateFloatNoZero(num15 * orig.XYLinearMax, orig.XYLinearMax, "XYLinearMax");
obj.XYLinearRecovery = ValidateFloat(num16 * orig.XYLinearRecovery, orig.XYLinearRecovery, "XYLinearRecovery");
obj.IsConstantRecoil = flag;
obj.VerticalRotPerShot_Bipodded = ValidateFloat(num17 * orig.VerticalRotPerShot_Bipodded + num18, orig.VerticalRotPerShot_Bipodded, "VerticalRotPerShot_Bipodded");
obj.HorizontalRotPerShot_Bipodded = ValidateFloat(num19 * orig.HorizontalRotPerShot_Bipodded + num20, orig.HorizontalRotPerShot_Bipodded, "HorizontalRotPerShot_Bipodded");
obj.MaxVerticalRot_Bipodded = ValidateFloatNoZero(num21 * orig.MaxVerticalRot_Bipodded, orig.MaxVerticalRot_Bipodded, "MaxVerticalRot_Bipodded");
obj.MaxHorizontalRot_Bipodded = ValidateFloatNoZero(num22 * orig.MaxHorizontalRot_Bipodded, orig.MaxHorizontalRot_Bipodded, "MaxHorizontalRot_Bipodded");
obj.RecoveryStabilizationFactors_Foregrip = orig.RecoveryStabilizationFactors_Foregrip * num23;
obj.RecoveryStabilizationFactors_Twohand = orig.RecoveryStabilizationFactors_Twohand * num24;
obj.RecoveryStabilizationFactors_None = orig.RecoveryStabilizationFactors_None * num25;
obj.MassDriftIntensity = ValidateFloat(num26 * orig.MassDriftIntensity, orig.MassDriftIntensity, "MassDriftIntensity");
obj.MassDriftFactors = orig.MassDriftFactors * num27;
obj.MaxMassDriftMagnitude = ValidateFloatNoZero(num28 * orig.MaxMassDriftMagnitude, orig.MaxMassDriftMagnitude, "MaxMassDriftMagnitude");
obj.MaxMassMaxRotation = ValidateFloatNoZero(num29 * orig.MaxMassMaxRotation, orig.MaxMassMaxRotation, "MaxMassMaxRotation");
obj.MassDriftRecoveryFactor = ValidateFloat(num30 * orig.MassDriftRecoveryFactor, orig.MassDriftRecoveryFactor, "MassDriftRecoveryFactor");
return obj;
}
private static float ValidateFloat(float value, float defaultValue, string paramName = "")
{
if (float.IsNaN(value) || float.IsInfinity(value))
{
Logger.LogWarning((object)$"Invalid calculated value for {paramName}: {value}. Using default value {defaultValue}");
return defaultValue;
}
return value;
}
private static float ValidateFloatNoZero(float value, float defaultValue, string paramName = "")
{
if (float.IsNaN(value) || float.IsInfinity(value) || value == 0f)
{
Logger.LogWarning((object)$"Invalid calculated value for {paramName}: {value}. Using default value {defaultValue}");
return defaultValue;
}
return value;
}
private static T ApplyConfig<T>(T? configValue, T defaultValue, string paramName) where T : struct
{
if (configValue.HasValue)
{
Instance.LogDebugMessage($" {paramName}: {configValue.Value}");
return configValue.Value;
}
return defaultValue;
}
}
public class UniversalRecoilControlPatch
{
private static readonly Dictionary<string, FVRFireArmRecoilProfile> _originalRecoilProfiles = new Dictionary<string, FVRFireArmRecoilProfile>();
private static readonly Dictionary<string, FVRFireArmRecoilProfile> _originalRecoilProfilesStocked = new Dictionary<string, FVRFireArmRecoilProfile>();
[HarmonyPatch(typeof(FVRFireArm), "Awake")]
[HarmonyPostfix]
public static void AwakePatch(FVRFireArm __instance)
{
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
//IL_0819: Unknown result type (might be due to invalid IL or missing references)
//IL_0848: Unknown result type (might be due to invalid IL or missing references)
//IL_0877: Unknown result type (might be due to invalid IL or missing references)
//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
//IL_0cc1: Unknown result type (might be due to invalid IL or missing references)
//IL_0cf0: Unknown result type (might be due to invalid IL or missing references)
//IL_0d1f: Unknown result type (might be due to invalid IL or missing references)
//IL_0d7d: Unknown result type (might be due to invalid IL or missing references)
//IL_118f: Unknown result type (might be due to invalid IL or missing references)
//IL_11be: Unknown result type (might be due to invalid IL or missing references)
//IL_11ed: Unknown result type (might be due to invalid IL or missing references)
//IL_124b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.RecoilProfile != (Object)null)
{
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile VertRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile HorizontalRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxVerticalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxHorizontalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile VerticalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile HorizontalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile ZLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile ZLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile ZLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile XYLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile XYLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile XYLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile IsConstantRecoil:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.IsConstantRecoil}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile VerticalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile HorizontalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxVerticalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxHorizontalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile RecoveryStabilizationFactors_Foregrip:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Foregrip}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile RecoveryStabilizationFactors_Twohand:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Twohand}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile RecoveryStabilizationFactors_None:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_None}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MassDriftIntensity:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftIntensity}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MassDriftFactors:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftFactors}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxMassDriftMagnitude:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassDriftMagnitude}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MaxMassMaxRotation:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassMaxRotation}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile MassDriftRecoveryFactor:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftRecoveryFactor}");
_originalRecoilProfiles[((FVRPhysicalObject)__instance).ObjectWrapper.ItemID] = __instance.RecoilProfile;
__instance.RecoilProfile = UniversalRecoilControl.CopyAndAdjustRecoilProfile(__instance.RecoilProfile, ((FVRPhysicalObject)__instance).ObjectWrapper.ItemID);
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile VertRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile HorizontalRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxVerticalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxHorizontalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile VerticalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile HorizontalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile ZLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile ZLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile ZLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile XYLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile XYLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile XYLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile IsConstantRecoil:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.IsConstantRecoil}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile VerticalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile HorizontalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxVerticalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxHorizontalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile RecoveryStabilizationFactors_Foregrip:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Foregrip}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile RecoveryStabilizationFactors_Twohand:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Twohand}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile RecoveryStabilizationFactors_None:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_None}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MassDriftIntensity:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftIntensity}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MassDriftFactors:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftFactors}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxMassDriftMagnitude:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassDriftMagnitude}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MaxMassMaxRotation:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassMaxRotation}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile MassDriftRecoveryFactor:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftRecoveryFactor}");
}
if ((Object)(object)__instance.RecoilProfileStocked != (Object)null)
{
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked VertRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked HorizontalRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxVerticalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxHorizontalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked VerticalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked HorizontalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked ZLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked ZLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked ZLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked XYLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked XYLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked XYLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked IsConstantRecoil:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.IsConstantRecoil}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked VerticalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked HorizontalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxVerticalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxHorizontalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked RecoveryStabilizationFactors_Foregrip:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Foregrip}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked RecoveryStabilizationFactors_Twohand:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Twohand}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked RecoveryStabilizationFactors_None:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_None}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MassDriftIntensity:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftIntensity}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MassDriftFactors:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftFactors}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxMassDriftMagnitude:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassDriftMagnitude}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MaxMassMaxRotation:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassMaxRotation}");
UniversalRecoilControl.Instance.LogDebugMessage($"Original recoil profile stocked MassDriftRecoveryFactor:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftRecoveryFactor}");
_originalRecoilProfilesStocked[((FVRPhysicalObject)__instance).ObjectWrapper.ItemID] = __instance.RecoilProfileStocked;
__instance.RecoilProfileStocked = UniversalRecoilControl.CopyAndAdjustRecoilProfile(__instance.RecoilProfileStocked, ((FVRPhysicalObject)__instance).ObjectWrapper.ItemID);
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked VertRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked HorizontalRotPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxVerticalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxHorizontalRot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked VerticalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked HorizontalRotRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked ZLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked ZLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked ZLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.ZLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked XYLinearPerShot:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearPerShot}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked XYLinearMax:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearMax}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked XYLinearRecovery:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.XYLinearRecovery}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked IsConstantRecoil:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.IsConstantRecoil}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked VerticalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.VerticalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked HorizontalRotPerShot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.HorizontalRotPerShot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxVerticalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxVerticalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxHorizontalRot_Bipodded:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxHorizontalRot_Bipodded}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked RecoveryStabilizationFactors_Foregrip:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Foregrip}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked RecoveryStabilizationFactors_Twohand:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_Twohand}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked RecoveryStabilizationFactors_None:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.RecoveryStabilizationFactors_None}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MassDriftIntensity:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftIntensity}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MassDriftFactors:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftFactors}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxMassDriftMagnitude:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassDriftMagnitude}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MaxMassMaxRotation:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MaxMassMaxRotation}");
UniversalRecoilControl.Instance.LogDebugMessage($"Modified recoil profile stocked MassDriftRecoveryFactor:{((FVRPhysicalObject)__instance).ObjectWrapper.ItemID} {__instance.RecoilProfile.MassDriftRecoveryFactor}");
}
}
[HarmonyPatch(typeof(SteamVR_LoadLevel), "Begin")]
[HarmonyPrefix]
public static bool BeginPatch()
{
_originalRecoilProfiles.Clear();
_originalRecoilProfilesStocked.Clear();
UniversalRecoilControl.Instance.LoadJsonConfig();
((BaseUnityPlugin)UniversalRecoilControl.Instance).Config.Reload();
return true;
}
}
}