using System;
using System.Diagnostics;
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 BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using SSSGame;
using SandSailorStudio.Inventory;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FreeBuild")]
[assembly: AssemblyTitle("FreeBuild")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 FreeBuild
{
[BepInPlugin("blacks7ar.FreeBuild", "FreeBuild", "1.0.1")]
public class Plugin : BasePlugin
{
[HarmonyPatch]
private static class Patch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(NodeTemplate), "Configure")]
private static void Configure_Postfix(NodeTemplate __instance)
{
if (!((Object)(object)__instance == (Object)null))
{
List<BlueprintConditionsRule> blueprintConditionsRules = new List<BlueprintConditionsRule>();
__instance.blueprintConditionsRules = blueprintConditionsRules;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(NodeTemplate), "FillManifest")]
private static void FillManifest_Postfix(NodeTemplate __instance, ref ItemManifest manifest)
{
if (!((Object)(object)__instance == (Object)null))
{
manifest.Clear();
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ItemManifestContainer), "GetManifest")]
private static void GetManifest_Postfix(ItemManifestContainer __instance, ref ItemManifest __result)
{
ItemCollection inventory = ((ItemContainer)__instance)._inventory;
FarmCrop val = ((inventory != null) ? inventory.Owner.GetComponentInParent<FarmCrop>() : null);
if ((!((Object)(object)val != (Object)null) || !((Object)((Component)val).gameObject).name.Contains("_Crop")) && _freeBuild.Value)
{
__result.Clear();
}
}
}
private const string modGUID = "blacks7ar.FreeBuild";
public const string modName = "FreeBuild";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.1";
private static ManualLogSource CLogger;
private static ConfigEntry<bool> _freeBuild;
public override void Load()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
CLogger = ((BasePlugin)this).Log;
_freeBuild = ((BasePlugin)this).Config.Bind<bool>("General", "Free Build", true, "If true, buildings doesn't require materials to build.");
CLogger.LogInfo((object)"Mod loaded!");
new Harmony("blacks7ar.FreeBuild").PatchAll();
}
}
}