using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sodalite;
using Sodalite.Api;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Because people don't know there's a Infinite Ammo Powerup Sausage...")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Niko666.InfiniteAmmo")]
[assembly: AssemblyTitle("InfiniteAmmo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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.InfiniteAmmo", "InfiniteAmmo", "1.0.1")]
public class InfiniteAmmo : BaseUnityPlugin
{
private static class InfiniteAmmoPatch
{
[HarmonyPatch(typeof(FVRWristMenu2), "Awake")]
[HarmonyPostfix]
public static void MenuButton(FVRWristMenu2 __instance)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)(__instance = null)))
{
Logger.LogMessage((object)"No FVRWristMenu2");
return;
}
bool flag = false;
foreach (WristMenuButton button in WristMenuAPI.CustomButtonsSection.Buttons)
{
if (button.Text == "InfiniteAmmoToggle")
{
flag = true;
break;
}
}
if (!flag)
{
WristMenuAPI.CustomButtonsSection.Buttons.Add(new WristMenuButton("InfiniteAmmoToggle", new ButtonClickEvent(InfAmmo)));
}
}
public static void InfAmmo(object sender, ButtonClickEventArgs args)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
FVRPlayerBody val = Object.FindObjectOfType<FVRPlayerBody>();
if ((Object)(object)val != (Object)null)
{
if (!val.IsInfiniteAmmo)
{
SM.PlayGlobalUISound((GlobalUISound)1, ((Component)val).transform.position);
val.m_isInfiniteAmmo = true;
val.m_isAmmoDrain = false;
val.DeActivateDeBuff(2);
val.m_buffTime_InfiniteAmmo = 2.1474836E+09f;
}
else
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
val.DeActivateBuff(2);
val.m_buffTime_InfiniteAmmo = 0f;
val.m_isInfiniteAmmo = false;
}
}
}
}
public const string Id = "Niko666.InfiniteAmmo";
internal static ManualLogSource Logger { get; private set; }
public static string Name => "InfiniteAmmo";
public static string Version => "1.0.1";
public void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(InfiniteAmmoPatch), (string)null);
Logger.LogMessage((object)("Fuck this world! Sent from Niko666.InfiniteAmmo " + Version));
}
}
}