Decompiled source of CraftFree v1.0.0

CraftFree.dll

Decompiled 2 days ago
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace CraftFree;

[BepInPlugin("yuri.CraftFree", "CraftFree", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<bool> Ligado;

	private void Awake()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		Ligado = ((BaseUnityPlugin)this).Config.Bind<bool>("Geral", "Ligado", true, "Nas mesas de craft, a receita sai sem o material. So no seu jogo.");
		new Harmony("yuri.CraftFree").PatchAll();
	}
}
public static class Mesa
{
	public static bool fabricando;

	public static bool NaMesa(Recipe recipe)
	{
		if (!Plugin.Ligado.Value || (Object)(object)recipe == (Object)null || (Object)(object)recipe.m_craftingStation == (Object)null)
		{
			return false;
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			return false;
		}
		CraftingStation currentCraftingStation = localPlayer.GetCurrentCraftingStation();
		if ((Object)(object)currentCraftingStation == (Object)null)
		{
			return false;
		}
		return currentCraftingStation.m_name == recipe.m_craftingStation.m_name;
	}
}
[HarmonyPatch(typeof(Player), "HaveRequirementItems")]
public static class SemMaterial
{
	private static void Postfix(Recipe piece, ref bool __result)
	{
		if (Mesa.NaMesa(piece))
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
public static class Craftando
{
	private static void Prefix()
	{
		Mesa.fabricando = true;
	}

	private static void Postfix()
	{
		Mesa.fabricando = false;
	}
}
[HarmonyPatch(typeof(Player), "ConsumeResources")]
public static class NaoGasta
{
	private static bool Prefix()
	{
		if (!Mesa.fabricando)
		{
			return true;
		}
		return false;
	}
}