Decompiled source of FreeBuildings v1.0.0

FreeBuildings.dll

Decompiled 3 months ago
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Korppis")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4fcda239bdcbf86e3e23b36020b97ca66c1b7d81")]
[assembly: AssemblyProduct("FreeBuildings")]
[assembly: AssemblyTitle("FreeBuildings")]
[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 FreeBuildPieces
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "FreeBuildings";

		public const string PLUGIN_NAME = "FreeBuildings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FreeBuildings
{
	[HarmonyPatch]
	public class Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(ObjectDB), "Awake")]
		public static void PatchBuildingPieceCost(ref ObjectDB __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Invalid comparison between Unknown and I4
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject));
			Piece val = default(Piece);
			for (int i = 0; i < array.Length; i++)
			{
				if (((GameObject)array[i]).TryGetComponent<Piece>(ref val) && ((int)val.m_category == 2 || (int)val.m_category == 3))
				{
					for (int j = 0; j < val.m_resources.Length; j++)
					{
						val.m_resources[j].m_amount = 0;
					}
				}
			}
		}
	}
	[BepInPlugin("org.bepinex.plugins.free-buildings", "Free Buildings", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("org.bepinex.plugins.free-buildings");

		private void Awake()
		{
			_harmony.PatchAll();
		}
	}
}