Decompiled source of FreeKnownRecipesMod v1.0.3

FreeKnownRecipesMod.dll

Decompiled 2 weeks ago
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 HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FreeKnownRecipesMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreeKnownRecipesMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a4017374-9f7d-4fa7-ac31-ae41d9ec3e2a")]
[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 MyFreeRecipesMod;

[BepInPlugin("com.yourname.myfreerecipemod", "Free Known Recipes", "1.0.3")]
public class FreeKnownRecipesMod : BaseUnityPlugin
{
	public static ConfigEntry<bool> ModEnabled;

	private static ConfigEntry<KeyboardShortcut> _toggleKey;

	private readonly Harmony _harmony = new Harmony("com.yourname.myfreerecipemod");

	private void Awake()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable/disable free crafting, building, and upgrading.");
		_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "Key to toggle the mod on/off.");
		_harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Free Known Recipes (Elegant Version) is loaded!");
	}

	private void Update()
	{
		//IL_0005: 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)
		KeyboardShortcut value = _toggleKey.Value;
		if (((KeyboardShortcut)(ref value)).IsDown())
		{
			ModEnabled.Value = !ModEnabled.Value;
			string text = (ModEnabled.Value ? "Free Known Recipes: ENABLED" : "Free Known Recipes: DISABLED");
			if ((Object)(object)MessageHud.instance != (Object)null)
			{
				MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false);
			}
		}
	}
}
[HarmonyPatch(typeof(Requirement), "GetAmount")]
public static class Requirement_GetAmount_Patch
{
	private static void Postfix(ref int __result)
	{
		if (FreeKnownRecipesMod.ModEnabled.Value)
		{
			__result = 0;
		}
	}
}