Decompiled source of PlacementUnlocked v1.0.2

TTC.PlacementUnlocked.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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("PlacementUnlocked")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlacementUnlocked")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b4567c1b-eda3-40f8-9ea0-611acb19a524")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PlacementUnlocked;

[HarmonyPatch(typeof(Fireplace))]
[HarmonyPatch("Awake")]
public class Fireplace_Patch
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Expected O, but got Unknown
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		list.InsertRange(0, new List<CodeInstruction>
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentPiece),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnFloorField),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.groundOnlyField),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnWoodField),
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentWearNTear),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.materialType)
		});
		return list.AsEnumerable();
	}
}
[BepInPlugin("TTC.PlacementUnlocked", "TTC PlacementUnlocked", "1.0.0.0")]
public class PlacementUnlocked : BaseUnityPlugin
{
	public static MethodInfo getComponentMethodInfo;

	public static MethodInfo getComponentPiece;

	public static MethodInfo getComponentWearNTear;

	public static FieldInfo notOnFloorField;

	public static FieldInfo groundOnlyField;

	public static FieldInfo notOnWoodField;

	public static FieldInfo materialType;

	private void Awake()
	{
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	static PlacementUnlocked()
	{
		getComponentMethodInfo = typeof(Component).GetMethod("GetComponent", new Type[0]);
		getComponentPiece = getComponentMethodInfo.MakeGenericMethod(typeof(Piece));
		getComponentWearNTear = getComponentMethodInfo.MakeGenericMethod(typeof(WearNTear));
		notOnFloorField = typeof(Piece).GetField("m_notOnFloor");
		groundOnlyField = typeof(Piece).GetField("m_groundOnly");
		notOnWoodField = typeof(Piece).GetField("m_notOnWood");
		materialType = typeof(WearNTear).GetField("m_materialType");
	}
}
[HarmonyPatch(typeof(Smelter))]
[HarmonyPatch("Awake")]
public class Smelter_Patch
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Expected O, but got Unknown
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		list.InsertRange(0, new List<CodeInstruction>
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentPiece),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnFloorField),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.groundOnlyField),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnWoodField),
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentWearNTear),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.materialType)
		});
		return list.AsEnumerable();
	}
}
[HarmonyPatch(typeof(Windmill))]
[HarmonyPatch("Start")]
public class Windmill_Patch
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Expected O, but got Unknown
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		list.InsertRange(0, new List<CodeInstruction>
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentPiece),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnFloorField),
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.groundOnlyField),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.notOnWoodField),
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Call, (object)PlacementUnlocked.getComponentWearNTear),
			new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
			new CodeInstruction(OpCodes.Stfld, (object)PlacementUnlocked.materialType)
		});
		return list.AsEnumerable();
	}
}