Decompiled source of ShotgunShellsInStore v1.0.1

ShotgunShellsInStore.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ShotgunShellsInStore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("The mod adds the ability to buy shotgun cartridges for 40 credits in Lethal Company. This mod will work if YOU are the server host, otherwise, the delivery rocket will simply not open.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6bb74bbd0cca73564fa1253264145a8c1bfd6ae7")]
[assembly: AssemblyProduct("ShotgunShellsInStore")]
[assembly: AssemblyTitle("ShotgunShellsInStore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 ShotgunShellsInStore
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ShotgunShellsInStore";

		public const string PLUGIN_NAME = "ShotgunShellsInStore";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace BuyableShells
{
	[BepInPlugin("PC_Principal.ShotgunShellsInStore", "ShotgunShellsInStore", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "PC_Principal.ShotgunShellsInStore";

		private const string modName = "ShotgunShellsInStore";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("PC_Principal.ShotgunShellsInStore");

		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("PC_Principal.ShotgunShellsInStore");
			SceneManager.sceneLoaded += OnSceneLoaded;
			ShellPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "Shell Price", 40, "How many credits the shotgun shell costs");
			mls.LogInfo((object)"ShotgunShellsInStore 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 for Shotgun";
					ShotgunShell.creditsWorth = 0;
					Items.RegisterShopItem(ShotgunShell, ShellPrice.Value);
				}
			}
		}
	}
}