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("Force enable quickbolt for bolt-actions and slam-fire for pump-actions.")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("Niko666.BoltPumpQuickShooter")]
[assembly: AssemblyTitle("BoltPumpQuickShooter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 Niko666
{
[BepInProcess("h3vr.exe")]
[BepInPlugin("Niko666.BoltPumpQuickShooter", "BoltPumpQuickShooter", "1.0.3")]
public class BoltPumpQuickShooter : BaseUnityPlugin
{
public static ConfigEntry<bool> configEnableSlamfire;
public static ConfigEntry<bool> configEnableQuickbolt;
public static ConfigEntry<bool> configAllowSlamfireInSemiAutoMode;
public const string Id = "Niko666.BoltPumpQuickShooter";
internal static ManualLogSource Logger { get; private set; }
public static string Name => "BoltPumpQuickShooter";
public static string Version => "1.0.3";
public void Awake()
{
configEnableSlamfire = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableSlamfire", true, "Force enable slamfire for all pump-action shotguns");
configEnableQuickbolt = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableQuickbolt", true, "Force enable quickbolt for all bolt-action rifles");
configAllowSlamfireInSemiAutoMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowSlamfireInSemiAutoMode", false, "Allow slamfire in semi-auto tubefed shotguns (this will make them full-auto, blame anton on this)");
Logger = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(BoltPumpQuickShooterPatch), (string)null);
Logger.LogMessage((object)("Fuck this world! Sent from Niko666.BoltPumpQuickShooter " + Version));
}
}
internal class BoltPumpQuickShooterPatch : MonoBehaviour
{
[HarmonyPatch(typeof(BoltActionRifle_Handle), "Awake")]
[HarmonyPostfix]
public static void BoltActionRifle_ForceQuickbolt(BoltActionRifle_Handle __instance)
{
if (BoltPumpQuickShooter.configEnableSlamfire.Value && !__instance.UsesQuickRelease)
{
__instance.UsesQuickRelease = true;
}
}
[HarmonyPatch(typeof(TubeFedShotgun), "FVRUpdate")]
[HarmonyPostfix]
public static void TubeFedShotgun_ForceSlamfire(TubeFedShotgun __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
bool flag = false;
if (0 == 0)
{
flag = __instance.UsesSlamFireTrigger;
}
if (BoltPumpQuickShooter.configEnableSlamfire.Value)
{
if (flag)
{
return;
}
if ((int)__instance.Mode == 1)
{
if (BoltPumpQuickShooter.configAllowSlamfireInSemiAutoMode.Value)
{
__instance.UsesSlamFireTrigger = true;
}
else
{
__instance.UsesSlamFireTrigger = false;
}
}
else
{
__instance.UsesSlamFireTrigger = true;
}
}
else
{
__instance.UsesSlamFireTrigger = flag;
}
}
}
}