Decompiled source of CheaperShotgunShells v0.1.0

CheaperShotgunShells.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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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("CheaperShotgunShells")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CheaperShotgunShells")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f8177750-331a-43ab-a98d-e8c60cdc9569")]
[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 CheaperShotgunShells;

[BepInPlugin("randyknapp.mods.cheapershotgunshells", "Cheaper Shotgun Shells", "0.1.0")]
public class CheaperShotgunShells : BaseUnityPlugin
{
	public const string GUID = "randyknapp.mods.cheapershotgunshells";

	public const string NAME = "Cheaper Shotgun Shells";

	public const string VERSION = "0.1.0";

	public void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogWarning((object)"Cheaper Shotgun Shells Loaded");
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "randyknapp.mods.cheapershotgunshells");
	}
}
[HarmonyPatch]
public static class WorkstationPatch
{
	private static bool _patchComplete;

	[HarmonyPatch(typeof(Workstation), "Spawned")]
	[HarmonyPrefix]
	public static void Spawned_Prefix()
	{
		if (_patchComplete)
		{
			return;
		}
		Craftable val = ((IEnumerable<Craftable>)RM.code.AllCraftables).FirstOrDefault((Func<Craftable, bool>)((Craftable x) => ((Object)x).name == "Shotgun Ammo"));
		if ((Object)(object)val != (Object)null)
		{
			CraftingItemRequirement val2 = ((IEnumerable<CraftingItemRequirement>)val.itemRequirements).FirstOrDefault((Func<CraftingItemRequirement, bool>)((CraftingItemRequirement x) => ((Object)x.item).name == "A3_Components"));
			if (val2 != null)
			{
				val2.amount = 1;
				_patchComplete = true;
			}
		}
	}
}