using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Gameplay.Perks;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UI.Token;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoPerkConfirm")]
[assembly: AssemblyProduct("NoPerkConfirm")]
[assembly: AssemblyDescription("Remove confirmation popup for perk selection")]
[assembly: AssemblyCompany("Runtime Evil Inc")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 NoPerkConfirm
{
[BepInPlugin("dev.zkxs.voidcrew.noperkconfirm", "NoPerkConfirm", "1.0.0")]
public class NoPerkConfirm : BaseUnityPlugin
{
private static class HarmonyPatches
{
internal static bool PerkBuffTryPurchase(PerkBuff buff, TokenTerminalEvents ___events)
{
if (!modEnabled.Value)
{
return true;
}
if (!PerkBuffExtensions.CanAfford(buff) || !PerkBuffExtensions.RequirementsMet(buff) || PerkBuffExtensions.Completed(buff))
{
return false;
}
___events.TryBuffUpgrade(buff);
return false;
}
}
internal const string GUID = "dev.zkxs.voidcrew.noperkconfirm";
internal const string MOD_NAME = "NoPerkConfirm";
internal const string MOD_VERSION = "1.0.0";
internal static ManualLogSource? Logger;
private static ConfigEntry<bool>? modEnabled;
private void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
try
{
Logger = ((BaseUnityPlugin)this).Logger;
modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable", true, "Enable skipping the perk confirmation popup");
new Harmony("dev.zkxs.voidcrew.noperkconfirm").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(PerkBuffTreeVE), "TryPurchase", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(HarmonyPatches), "PerkBuffTryPurchase", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"successfully installed patches!");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"Something has gone terribly wrong:\n{ex}");
throw ex;
}
}
}
}