Decompiled source of Unfinish the Gun v1.0.0

UnfinishTheGun.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UnfinishTheGun")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("N/A")]
[assembly: AssemblyProduct("UnfinishTheGun")]
[assembly: AssemblyCopyright("Copyright © N/A 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("63604401-d1ee-4748-99ce-aea7cfde9287")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace UnfinishTheGun;

[BepInPlugin("spapi.etg.unfinishthegun", "Unfinish the Gun", "1.0.0")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
	public const string GUID = "spapi.etg.unfinishthegun";

	public const string NAME = "Unfinish the Gun";

	public const string VERSION = "1.0.0";

	public static MethodInfo utg_u = AccessTools.Method(typeof(Plugin), "UnfinishTheGun_Unfinish", (Type[])null, (Type[])null);

	public void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("spapi.etg.unfinishthegun").PatchAll();
	}

	[HarmonyPatch(typeof(RewardManager), "ExcludeUnfinishedGunIfNecessary")]
	[HarmonyPatch(typeof(RewardManager), "BuildExcludedShopList")]
	[HarmonyPatch(typeof(PickupObjectDatabase), "GetRandomGunOfQualities")]
	[HarmonyPatch(typeof(LootData), "GetItemsForPlayer")]
	[HarmonyPatch(typeof(LootEngine), "SpawnItem")]
	[HarmonyPatch(typeof(LootEngine), "SpewLoot", new Type[]
	{
		typeof(GameObject),
		typeof(Vector3)
	})]
	[HarmonyILManipulator]
	public static void UnfinishTheGun_Transpiler(ILContext ctx)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(ctx);
		while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameStatsManager>(x, "GetFlag")
		}))
		{
			val.Emit(OpCodes.Call, (MethodBase)utg_u);
		}
	}

	public static bool UnfinishTheGun_Unfinish(bool _)
	{
		return false;
	}
}