Decompiled source of BuyPatrons v1.0.6

BuyShells.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BuyShells")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BuyShells")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68a41436-9a6f-492d-a4ba-2cf49b801cf4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BuyPatrons;

[BepInPlugin("Venom.BuyPatrons", "BuyPatrons", "1.0.4")]
public class Plugin : BaseUnityPlugin
{
	private const string modGUID = "Venom.BuyPatrons";

	private const string modName = "BuyPatrons";

	private const string modVersion = "1.0.4";

	private readonly Harmony harmony = new Harmony("Venom.BuyPatrons");

	internal static Plugin Instance;

	public static ManualLogSource mls;

	public bool added;

	public static ConfigEntry<int> ShellPrice;

	public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList();

	public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "GunAmmo"));

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		if ((Object)Instance == (Object)null)
		{
			Instance = this;
		}
		harmony.PatchAll(typeof(Plugin));
		mls = Logger.CreateLogSource("Venom.BuyPatrons");
		SceneManager.sceneLoaded += OnSceneLoaded;
		ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 20, "How many credits the shotgun shell costs");
		mls.LogInfo((object)"BuyPatrons started successfull");
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		if (!added)
		{
			Scene val = scene;
			if (((Scene)(ref val)).name == "MainMenu")
			{
				added = true;
				ShotgunShell.itemName = "Shells";
				ShotgunShell.creditsWorth = 0;
				Items.RegisterShopItem(ShotgunShell, ShellPrice.Value);
			}
		}
	}
}