Decompiled source of EarlyBaseBuilding v1.0.0

plugins/EarlyBaseBuilding/EarlyBaseBuilding.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using EquinoxsModUtils;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EarlyBaseBuilding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EarlyBaseBuilding")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7ec88224-3d33-4228-89bc-bb8f8c84091f")]
[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 EarlyBaseBuilding;

[BepInPlugin("com.equinox.EarlyBaseBuilding", "EarlyBaseBuilding", "1.0.0")]
public class EarlyBaseBuildingPlugin : BaseUnityPlugin
{
	private const string MyGUID = "com.equinox.EarlyBaseBuilding";

	private const string PluginName = "EarlyBaseBuilding";

	private const string VersionString = "1.0.0";

	private static readonly Harmony Harmony = new Harmony("com.equinox.EarlyBaseBuilding");

	public static ManualLogSource Log = new ManualLogSource("EarlyBaseBuilding");

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: EarlyBaseBuilding, VersionString: 1.0.0 is loading...");
		Harmony.PatchAll();
		ModUtils.GameDefinesLoaded += OnGameDefinesLoaded;
		ModUtils.GameLoaded += OnGameLoaded;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: EarlyBaseBuilding, VersionString: 1.0.0 is loaded.");
		Log = ((BaseUnityPlugin)this).Logger;
	}

	private void OnGameDefinesLoaded(object sender, EventArgs e)
	{
		List<string> obj = new List<string>
		{
			"Calycite Platform (1x1)", "Calycite Platform (3x3)", "Calycite Platform (5x5)", "Catwalk (3x9)", "Catwalk (5x9)", "Calycite Wall (3x3)", "Calycite Wall (5x3)", "Calycite Wall (5x5)", "Calycite Gate (5x2)", "Calycite Gate (5x5)",
			"Calycite Gate (10x5)", "Calycite Wall Cap (3x1)", "Calycite Wall Cap (5x1)", "Calycite Wall Corner (1x1)", "Calycite Vertical Wall Cap (3x1)", "Calycite Vertical Wall Cap (5x1)", "Calycite Vertical Wall Corner (1x1)", "Calycite Wall Cutaway (2x2)", "Calycite Wall Cutaway (3x3)", "Calycite Wall Cutaway (5x3)",
			"Calycite Wall Cutaway (5x5)", "Calycite Pillar (1x1)", "Calycite Pillar (1x3)", "Calycite Pillar (1x5)", "Calycite Angle Support (3x3)", "Calycite Beam (1x1)", "Calycite Beam (3x1)", "Calycite Beam (5x1)"
		};
		List<string> list = new List<string>
		{
			"Metal Stairs (1x1)", "Metal Stairs (3x1)", "Metal Stairs (3x3)", "Metal Stairs (3x5)", "Railing (1x1)", "Railing (3x1)", "Railing (5x1)", "Railing Corner (1x1)", "Railing Corner (3x3)", "Metal Pillar (1x1)",
			"Metal Pillar (1x3)", "Metal Pillar (1x5)", "Metal Angle Support (5x2)", "Metal Rib Base (1x2)", "Metal Rib Middle (1x3)", "Metal Beam (1x1)", "Metal Beam (1x3)", "Metal Beam (1x5)"
		};
		List<string> list2 = new List<string> { "Small Floor Pot", "Wall Pot", "Medium Floor Pot", "Ceiling Plant (1x1)", "Ceiling Plant (3x3)", "Wall Plant (1x1)", "Wall Plant (3x3)" };
		List<string> list3 = new List<string> { "Light Stick", "Red Light Stick", "Green Light Stick", "Blue Light Stick", "Overhead Light", "Standing Lamp (1x5)", "Wall Light (1x1)", "Wall Light (3x1)", "Hanging Lamp (1x1)", "Fan Lamp (7x2)" };
		List<ResourceInfo> list4 = new List<ResourceInfo> { ModUtils.GetResourceInfoByName("Limestone", false) };
		List<ResourceInfo> list5 = new List<ResourceInfo> { ModUtils.GetResourceInfoByName("Iron Ingot", false) };
		List<ResourceInfo> list6 = new List<ResourceInfo> { ModUtils.GetResourceInfoByName("Plantmatter", false) };
		List<ResourceInfo> list7 = new List<ResourceInfo>
		{
			ModUtils.GetResourceInfoByName("Iron Ingot", false),
			ModUtils.GetResourceInfoByName("Copper Wire", false)
		};
		foreach (string item in obj)
		{
			SchematicsRecipeData recipeForBuildable = GetRecipeForBuildable(ModUtils.GetResourceInfoByName(item, false));
			ModUtils.NullCheck((object)recipeForBuildable, item + " Recipe", false);
			recipeForBuildable.ingTypes = list4.ToArray();
			recipeForBuildable.ingQuantities = new int[1] { 5 };
		}
		foreach (string item2 in list)
		{
			SchematicsRecipeData recipeForBuildable2 = GetRecipeForBuildable(ModUtils.GetResourceInfoByName(item2, false));
			ModUtils.NullCheck((object)recipeForBuildable2, item2 + " Recipe", false);
			recipeForBuildable2.ingTypes = list5.ToArray();
			recipeForBuildable2.ingQuantities = new int[1] { 2 };
		}
		foreach (string item3 in list2)
		{
			SchematicsRecipeData recipeForBuildable3 = GetRecipeForBuildable(ModUtils.GetResourceInfoByName(item3, false));
			ModUtils.NullCheck((object)recipeForBuildable3, item3 + " Recipe", false);
			recipeForBuildable3.ingTypes = list6.ToArray();
			recipeForBuildable3.ingQuantities = new int[1] { 5 };
		}
		foreach (string item4 in list3)
		{
			SchematicsRecipeData recipeForBuildable4 = GetRecipeForBuildable(ModUtils.GetResourceInfoByName(item4, false));
			ModUtils.NullCheck((object)recipeForBuildable4, item4 + " Recipe", false);
			recipeForBuildable4.ingTypes = list7.ToArray();
			recipeForBuildable4.ingQuantities = new int[2] { 1, 1 };
		}
	}

	private void OnGameLoaded(object sender, EventArgs e)
	{
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Expected O, but got Unknown
		//IL_017e: Expected O, but got Unknown
		foreach (string item in new List<string>
		{
			"Stairs & Walkways I", "Stairs & Walkways II", "Stairs & Walkways III", "Light Stick (Primary Colors)", "DECO Series I", "DECO Series II", "DECO Series III", "DECO Plants & Ceilings", "DECO Plants & Walls", "Gates I",
			"Gates II", "Gates III", "Gates IV", "Light Stick", "Overhead Light", "Overhead Light II", "Platforms I", "Beams I", "Platforms II", "Beams II",
			"Basic Construction", "Supports I", "Supports II", "Supports III", "Supports IV", "Wall Lights", "Walls I", "Walls II", "Walls III"
		})
		{
			Unlock unlockByName = ModUtils.GetUnlockByName(item, false);
			UnlockTechAction val = new UnlockTechAction
			{
				info = new UnlockTechInfo
				{
					unlockID = ((UniqueIdScriptableObject)unlockByName).uniqueId,
					drawPower = false
				}
			};
			NetworkMessageRelay.instance.SendNetworkAction((NetworkAction)(object)val);
		}
	}

	private SchematicsRecipeData GetRecipeForBuildable(ResourceInfo info)
	{
		return GameDefines.instance.schematicsRecipeEntries.Where((SchematicsRecipeData recipe) => recipe.outputTypes.Contains(info)).First();
	}
}