Decompiled source of SierraTech v1.0.0

SierraTech.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EquinoxsModUtils;
using EquinoxsModUtils.Additions;
using HarmonyLib;
using ReikaKalseki.DIANEXCAL;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace ReikaKalseki.SierraTech;

public class CrusherPowerTrimTech : CustomTech
{
	private static readonly List<CrusherPowerTrimTech> techs = new List<CrusherPowerTrimTech>();

	private readonly string techLink;

	public float efficiency { get; private set; }

	internal CrusherPowerTrimTech(string link)
		: base((TechCategory)4, link.Replace("ASM", "Crush"), "placeholder", (CoreType)0, 0)
	{
		((CustomTech)this).setSprite("Crusher MKI", true);
		((CustomTech)this).setDependencies(link, (techs.Count == 0) ? null : ((CustomTech)techs[techs.Count - 1]).name);
		base.finalFixes = delegate
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			Unlock unlock = ((CustomTech)this).unlock;
			Unlock unlock2 = TTUtil.getUnlock(techLink, true);
			TTUtil.log(string.Concat("Adjusting ", this, " to match ", techLink), (Assembly)null, 0);
			unlock.treePosition = unlock2.treePosition - 20f;
			unlock.requiredTier = unlock2.requiredTier;
			unlock.coresNeeded = unlock2.coresNeeded.Select(delegate(RequiredCores rc)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				RequiredCores result = default(RequiredCores);
				result.type = rc.type;
				result.number = rc.number;
				return result;
			}).ToList();
			DIExtensions.setDescription(unlock, DIExtensions.getDescription(unlock2).Replace("Assembler", "Crusher"));
			string text = unlock.description.Substring(unlock.description.LastIndexOf(' ')).Trim();
			efficiency = 1f - (float)int.Parse(text.Substring(0, 2)) / 100f;
			TTUtil.log("Adjustment complete: " + DIExtensions.toDebugString(unlock) + " and " + efficiency.ToString("0.00") + "x power", (Assembly)null, 0);
		};
		techs.Add(this);
		techLink = link;
	}
}
public class DrillCrushingRecipe : CustomRecipe
{
	private static int scrapID;

	private static int carbonFrameID;

	private static int sensorBlockID;

	private static int actuatorID;

	private static int drill6ID;

	private static int drill7ID;

	private static float scrapPerCarbonFrameDipping;

	private static float scrapPerActuator;

	private static float scrapPerSensorBlock;

	private static float scrapPerDrill6;

	private static float scrapPerDrill7;

	private static int scrapPerUnpacking;

	private static SchematicsRecipeData drill7Recipe;

	static DrillCrushingRecipe()
	{
		DIMod.onDefinesLoadedFirstTime += delegate
		{
			scrapID = Resources.GetResourceIDByName("Scrap Ore", false);
			carbonFrameID = Resources.GetResourceIDByName("Carbon Frame", false);
			sensorBlockID = Resources.GetResourceIDByName("Sensor Block", false);
			actuatorID = Resources.GetResourceIDByName("Actuator", false);
			drill6ID = Resources.GetResourceIDByName("Excavator Bit MKVI", false);
			drill7ID = Resources.GetResourceIDByName("Excavator Bit MKVII", false);
		};
		DIMod.onRecipesLoaded += delegate
		{
			SchematicsRecipeData val = GameDefines.instance.GetValidCrusherRecipes(new List<int>
			{
				scrapID,
				Resources.GetResourceIDByName("Shiverthorn Extract Gel", false)
			}, 9999, 9999, false)[0];
			SchematicsRecipeData val2 = GameDefines.instance.GetValidCrusherRecipes(new List<int> { Resources.GetResourceIDByName("Condensed Scrap Ore", false) }, 9999, 1, false)[0];
			scrapPerUnpacking = DIExtensions.getYield(val2, scrapID);
			SchematicsRecipeData val3 = TTUtil.getRecipesByOutput(sensorBlockID)[0];
			SchematicsRecipeData val4 = TTUtil.getRecipesByOutput(actuatorID)[0];
			SchematicsRecipeData val5 = TTUtil.getRecipesByOutput(drill6ID)[0];
			drill7Recipe = TTUtil.getRecipesByOutput(drill7ID)[0];
			scrapPerCarbonFrameDipping = (float)DIExtensions.getCost(val, scrapID) / (float)DIExtensions.getYield(val, carbonFrameID);
			scrapPerSensorBlock = (scrapPerCarbonFrameDipping * (float)DIExtensions.getCost(val3, carbonFrameID) + MachineScrapRecipe.getScrapPerRelay() * (float)DIExtensions.getCost(val3, "Relay Circuit")) / (float)(DIExtensions.getYield(val3, sensorBlockID) * 4);
			scrapPerActuator = scrapPerCarbonFrameDipping * (float)DIExtensions.getCost(val4, carbonFrameID) / (float)(DIExtensions.getYield(val4, actuatorID) * 4);
			scrapPerDrill6 = (scrapPerCarbonFrameDipping * (float)DIExtensions.getCost(val5, carbonFrameID) + scrapPerActuator * (float)DIExtensions.getCost(val5, actuatorID)) / (float)(DIExtensions.getYield(val5, drill6ID) * 4);
			scrapPerDrill7 = (scrapPerSensorBlock * (float)DIExtensions.getCost(drill7Recipe, sensorBlockID) + scrapPerDrill6 * (float)DIExtensions.getCost(drill7Recipe, drill6ID)) / (float)(DIExtensions.getYield(drill7Recipe, drill7ID) * 4);
			TTUtil.log("Computed the following scrap per item ratios:", (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(val2) + ": " + scrapPerUnpacking + "x", (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(val) + ": " + scrapPerCarbonFrameDipping.ToString("0.00"), (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(val3) + ": " + scrapPerSensorBlock.ToString("0.00"), (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(val4) + ": " + scrapPerActuator.ToString("0.00"), (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(val5) + ": " + scrapPerDrill6.ToString("0.00"), (Assembly)null, 0);
			TTUtil.log(DIExtensions.toDebugString(drill7Recipe) + ": " + scrapPerDrill7.ToString("0.00"), (Assembly)null, 0);
		};
	}

	internal DrillCrushingRecipe()
		: base("drill7_to_scrap", (CraftingMethod)6)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		((NewRecipeDetails)this).ingredients = new List<RecipeResourceInfo>
		{
			new RecipeResourceInfo
			{
				name = "Excavator Bit MKVII",
				quantity = 1
			},
			new RecipeResourceInfo
			{
				name = "Sesamite Crystal",
				quantity = 2
			}
		};
		((NewRecipeDetails)this).outputs = new List<RecipeResourceInfo>
		{
			new RecipeResourceInfo
			{
				name = "Condensed Scrap Ore",
				quantity = 1
			}
		};
		Action finalFixes = delegate
		{
			int num = MathUtil.roundUpToX(FHG_Utils.CeilToInt(scrapPerDrill7 * 1.2f * SierraTechMod.config.getFloat(STConfig.ConfigEntries.SCRAPCYCLERATIO)), 250);
			((CustomRecipe)this).recipe.outputQuantities[0] = num / scrapPerUnpacking;
			int num2 = num - FHG_Utils.FloorToInt(scrapPerDrill7);
			TTUtil.log("Computed dense scrap yield of " + ((CustomRecipe)this).recipe.outputQuantities[0] + " for " + DIExtensions.toDebugString(((CustomRecipe)this).recipe) + " (raw scrap amount " + num + ")", (Assembly)null, 0);
			TTUtil.log("Maximum achievable surplus scrap per cycle = " + num2, (Assembly)null, 0);
			if (((CustomRecipe)this).recipe.outputQuantities[0] > Resources.GetResourceInfoByName("Condensed Scrap Ore", false).maxStackCount)
			{
				TTUtil.log("Over max stack size!", (Assembly)null, 0);
			}
			SchematicsRecipeData val = GameDefines.instance.GetValidCrusherRecipes(new List<int> { Resources.GetResourceIDByName("Sesamite Crystal", false) }, 9999, 9999, false)[0];
			((CustomRecipe)this).recipe.chargeGeneratedWhenProcessed = DIExtensions.multiplyBy(val.chargeGeneratedWhenProcessed, 0.67);
			((CustomRecipe)this).recipe.maxChargeGenerated = DIExtensions.multiplyBy(val.maxChargeGenerated, 0.67);
			((CustomRecipe)this).recipe.chargeGenerationMultiplier = val.chargeGenerationMultiplier;
		};
		base.finalFixes = finalFixes;
		DIMod.onTechsLoadedFirstTime += delegate
		{
			Unlock unlock = TTUtil.getUnlock("Excavator Bit MKVII", true);
			TTUtil.setUnlockRecipes("Excavator Bit MKVII", new List<SchematicsRecipeData>(unlock.unlockedRecipes) { ((CustomRecipe)this).recipe }.ToArray());
		};
	}
}
public class MachineScrapRecipe : CustomRecipe
{
	private static readonly Dictionary<string, MachineScrapRecipe> recipeItems;

	private static int scrapID;

	private static int goldOreID;

	private static int goldID;

	private static int relayID;

	private static float scrapPerIngotShiverthorn;

	private static float scrapPerIngotSesamite;

	private static float goldOrePerIngot;

	private static float scrapPerRelayLeastEfficient;

	private static float scrapPerRelayMostEfficient;

	private static float weightedScrapPerRelay;

	public readonly string sourceItem;

	public static float getScrapPerRelay()
	{
		return weightedScrapPerRelay;
	}

	static MachineScrapRecipe()
	{
		recipeItems = new Dictionary<string, MachineScrapRecipe>();
		DIMod.onDefinesLoadedFirstTime += delegate
		{
			scrapID = Resources.GetResourceIDByName("Scrap Ore", false);
			goldOreID = Resources.GetResourceIDByName("Gold Ore", false);
			goldID = Resources.GetResourceIDByName("Gold Ingot", false);
			relayID = Resources.GetResourceIDByName("Relay Circuit", false);
		};
		DIMod.onRecipesLoaded += delegate
		{
			SchematicsRecipeData val = GameDefines.instance.GetValidCrusherRecipes(new List<int>
			{
				scrapID,
				Resources.GetResourceIDByName("Shiverthorn Extract", false)
			}, 9999, 9999, false)[0];
			SchematicsRecipeData val2 = GameDefines.instance.GetValidCrusherRecipes(new List<int>
			{
				scrapID,
				Resources.GetResourceIDByName("Sesamite Powder", false)
			}, 9999, 9999, false)[0];
			SchematicsRecipeData val3 = GameDefines.instance.GetValidSmelterRecipes(new List<int> { goldOreID }, 9999, 9999, false)[0];
			goldOrePerIngot = DIExtensions.getCost(val3, goldOreID) / DIExtensions.getYield(val3, goldID);
			scrapPerIngotShiverthorn = (float)(DIExtensions.getCost(val, scrapID) - DIExtensions.getYield(val, scrapID)) / (float)DIExtensions.getYield(val, goldOreID) * goldOrePerIngot;
			scrapPerIngotSesamite = (float)(DIExtensions.getCost(val2, scrapID) - DIExtensions.getYield(val2, scrapID)) / (float)DIExtensions.getYield(val2, goldOreID) * goldOrePerIngot;
			TTUtil.log("Computed scrap per ingot ratios of [" + scrapPerIngotShiverthorn.ToString("0.00") + ", " + scrapPerIngotSesamite.ToString("0.00") + " via " + DIExtensions.toDebugString(val) + " and " + DIExtensions.toDebugString(val2) + " through " + DIExtensions.toDebugString(val3), (Assembly)null, 0);
			List<SchematicsRecipeData> recipesByOutput = TTUtil.getRecipesByOutput(relayID);
			SchematicsRecipeData val4 = null;
			SchematicsRecipeData val5 = null;
			foreach (SchematicsRecipeData item in recipesByOutput)
			{
				if (isGoldAndScrapRecipe(item))
				{
					val4 = item;
				}
				else if (isGoldButNotScrapRecipe(item))
				{
					val5 = item;
				}
			}
			scrapPerRelayLeastEfficient = ((float)DIExtensions.getCost(val4, goldID) * scrapPerIngotShiverthorn + (float)DIExtensions.getCost(val4, scrapID)) / ((float)DIExtensions.getYield(val4, relayID) * 4f);
			scrapPerRelayMostEfficient = scrapPerIngotSesamite * (float)DIExtensions.getCost(val5, goldID) / ((float)DIExtensions.getYield(val4, relayID) * 4f);
			weightedScrapPerRelay = Mathf.Lerp(scrapPerRelayLeastEfficient, scrapPerRelayMostEfficient, 0.8f);
			TTUtil.log("Relay recipes are " + DIExtensions.toDebugString(val4) + " and " + DIExtensions.toDebugString(val5), (Assembly)null, 0);
			TTUtil.log("Computed scrap per relay ratio of [" + scrapPerRelayLeastEfficient.ToString("0.00") + ", " + scrapPerRelayMostEfficient.ToString("0.00") + "]=" + weightedScrapPerRelay.ToString("0.00"), (Assembly)null, 0);
		};
		Events.TechTreeStateLoaded += delegate
		{
			SierraTechMod.machineScrappingTech.setRecipes(recipeItems.Values.Select((MachineScrapRecipe rec) => ((CustomRecipe)rec).recipe).ToArray());
		};
	}

	private static bool isGoldAndScrapRecipe(SchematicsRecipeData rec)
	{
		return rec.ingTypes.Length == 2 && (((UniqueIdScriptableObject)rec.ingTypes[0]).uniqueId == scrapID || ((UniqueIdScriptableObject)rec.ingTypes[1]).uniqueId == goldID) && (((UniqueIdScriptableObject)rec.ingTypes[0]).uniqueId == scrapID || ((UniqueIdScriptableObject)rec.ingTypes[1]).uniqueId == goldID);
	}

	private static bool isGoldButNotScrapRecipe(SchematicsRecipeData rec)
	{
		return rec.ingTypes.Length == 3 && DIExtensions.getCost(rec, goldID) > 0 && DIExtensions.getCost(rec, "Processor Array") > 0 && DIExtensions.getCost(rec, "Atlantum Slab") > 0;
	}

	internal MachineScrapRecipe(string item)
		: base(item + "_to_scrap", (CraftingMethod)6)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		sourceItem = item;
		recipeItems[item] = this;
		((NewRecipeDetails)this).ingredients = new List<RecipeResourceInfo>
		{
			new RecipeResourceInfo
			{
				name = sourceItem,
				quantity = 1
			},
			new RecipeResourceInfo
			{
				name = "Sesamite Ingot",
				quantity = 1
			}
		};
		((NewRecipeDetails)this).outputs = new List<RecipeResourceInfo>
		{
			new RecipeResourceInfo
			{
				name = "Scrap Ore",
				quantity = 1
			}
		};
		Action finalFixes = delegate
		{
			float efficacy = ((sourceItem == "Research Core 520nm (Green)") ? 2.5f : 1f);
			((CustomRecipe)this).recipe.outputQuantities[0] = computeYield(sourceItem, out var surplus, efficacy);
			TTUtil.log("Computed scrap yield of " + ((CustomRecipe)this).recipe.outputQuantities[0] + " for " + DIExtensions.toDebugString(((CustomRecipe)this).recipe), (Assembly)null, 0);
			TTUtil.log("Maximum achievable surplus scrap per cycle = " + surplus + " (" + surplus * 2 + " if using gold crushing)", (Assembly)null, 0);
			if (((CustomRecipe)this).recipe.outputQuantities[0] > Resources.GetResourceInfoByName("Scrap Ore", false).maxStackCount)
			{
				TTUtil.log("Over max stack size!", (Assembly)null, 0);
			}
		};
		base.finalFixes = finalFixes;
	}

	private static int computeYield(string from, out int surplus, float efficacy = 1f)
	{
		SchematicsRecipeData val = TTUtil.getRecipesByOutput(from)[0];
		float num = (float)DIExtensions.getCost(val, relayID) / ((float)val.outputQuantities[0] * 4f);
		int num2 = MathUtil.roundUpToX(FHG_Utils.CeilToInt(weightedScrapPerRelay * num * efficacy * SierraTechMod.config.getFloat(STConfig.ConfigEntries.SCRAPCYCLERATIO)), 50);
		surplus = num2 - FHG_Utils.FloorToInt(scrapPerRelayMostEfficient * num);
		return num2;
	}
}
public class SandPumpTech : CustomTech
{
	internal class TechLevel
	{
		public readonly int level;

		public readonly int ptTier;

		public readonly CoreType coreType;

		public readonly int coreCount;

		public readonly float pumpMultiplier;

		public string description => "Increases pumping rate of all Sand Pumps by " + ((pumpMultiplier - 1f) * 100f).ToString("0") + "%. Does not increase sand production rate.";

		internal TechLevel(int l, CoreType c, int cc, float f, int tt)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			level = l;
			coreType = c;
			coreCount = cc;
			pumpMultiplier = f;
			ptTier = tt;
		}

		public override string ToString()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			return $"[TechLevel Level={level}, CoreType={coreType}, CoreCount={coreCount}, PumpMultiplier={pumpMultiplier}]";
		}
	}

	private static readonly Dictionary<int, SandPumpTech> levels = new Dictionary<int, SandPumpTech>();

	internal SandPumpTech(TechLevel t)
		: base((TechCategory)0, "Sand Pump Power " + RomanNumeral.getRomanNumeral(t.level), t.description, t.coreType, t.coreCount)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		levels[t.level] = this;
		((CustomTech)this).setSprite("Sand Pump", true);
		((CustomTech)this).setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, t.ptTier), (TechColumns)0);
		if (t.level > 1)
		{
			((CustomTech)this).setDependencies((CustomTech)(object)levels[t.level - 1], (CustomTech)null);
		}
	}
}
[BepInPlugin("ReikaKalseki.SierraTech", "SierraTech", "1.0.0")]
public class SierraTechMod : BaseUnityPlugin
{
	public static SierraTechMod instance;

	internal static SandPumpTech[] sandPumpBoostTechs;

	internal static CoreBoostTech sandPumpCoreTech;

	internal static CustomTech machineScrappingTech;

	internal static CustomTech sesamiteCarbonBrickTech;

	internal static CustomTech greenCoreEfficiencyTech;

	internal static CustomTech allCoreEfficiencyTech2;

	internal static CustomTech goldCrushingTech;

	internal static CoreBoostTech spectralYieldCoreTech;

	internal static CrusherPowerTrimTech crusherPowerTrim1;

	internal static CrusherPowerTrimTech crusherPowerTrim2;

	internal static CrusherPowerTrimTech crusherPowerTrim3;

	internal static CrusherPowerTrimTech crusherPowerTrim4;

	internal static CustomRecipe carbonBrickRecipe;

	internal static CustomRecipe goldCrushingRecipe;

	internal static CustomRecipe goldPowderSmeltingRecipe;

	internal static CustomItem goldPowder;

	internal static readonly TechColumns YELLOW_CORE_COLUMN = (TechColumns)0;

	internal static readonly TechColumns COREBOOST_COLUMN = (TechColumns)40;

	public static readonly Assembly modDLL = Assembly.GetExecutingAssembly();

	public static readonly Config<STConfig.ConfigEntries> config = new Config<STConfig.ConfigEntries>(modDLL);

	private static readonly SandPumpTech.TechLevel[] techLevels = new SandPumpTech.TechLevel[5]
	{
		new SandPumpTech.TechLevel(1, (CoreType)2, 100, 1.5f, 0),
		new SandPumpTech.TechLevel(2, (CoreType)1, 50, 2f, 1),
		new SandPumpTech.TechLevel(3, (CoreType)1, 100, 3f, 3),
		new SandPumpTech.TechLevel(4, (CoreType)3, 50, 4f, 5),
		new SandPumpTech.TechLevel(5, (CoreType)3, 100, 6f, 7)
	};

	public SierraTechMod()
	{
		instance = this;
		TTUtil.log("Constructed ST mod object", (Assembly)null, 0);
	}

	public void Awake()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Expected O, but got Unknown
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Expected O, but got Unknown
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Expected O, but got Unknown
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Expected O, but got Unknown
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d9: Expected O, but got Unknown
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Expected O, but got Unknown
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0482: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0508: Unknown result type (might be due to invalid IL or missing references)
		//IL_0512: Expected O, but got Unknown
		//IL_054c: Unknown result type (might be due to invalid IL or missing references)
		//IL_056b: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cb: Expected O, but got Unknown
		//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fe: Expected O, but got Unknown
		//IL_0605: Unknown result type (might be due to invalid IL or missing references)
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_065a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0664: Expected O, but got Unknown
		//IL_066b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0670: Unknown result type (might be due to invalid IL or missing references)
		TTUtil.log("Begin Initializing SierraTech", (Assembly)null, 0);
		try
		{
			config.load(false);
			Harmony val = new Harmony("SierraTech");
			Harmony.DEBUG = true;
			FileLog.logPath = Path.Combine(Path.GetDirectoryName(modDLL.Location), "harmony-log_" + Path.GetFileName(Assembly.GetExecutingAssembly().Location) + ".txt");
			FileLog.Log("Ran mod register, started harmony (harmony log)");
			TTUtil.log("Ran mod register, started harmony", (Assembly)null, 0);
			try
			{
				val.PatchAll(modDLL);
			}
			catch (Exception ex)
			{
				FileLog.Log("Caught exception when running patchers!");
				FileLog.Log(ex.Message);
				FileLog.Log(ex.StackTrace);
				FileLog.Log(ex.ToString());
			}
			sandPumpBoostTechs = new SandPumpTech[techLevels.Length];
			for (int i = 0; i < sandPumpBoostTechs.Length; i++)
			{
				sandPumpBoostTechs[i] = new SandPumpTech(techLevels[i]);
				((CustomTech)sandPumpBoostTechs[i]).register();
			}
			sandPumpCoreTech = new CoreBoostTech(config.getInt(STConfig.ConfigEntries.PUMPCOREEFFECT), (CoreType)3, 250, (string)null);
			sandPumpCoreTech.setText("Sand Pump", "speed of all Sand Pumps");
			((CustomTech)sandPumpCoreTech).setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 5), COREBOOST_COLUMN);
			((CustomTech)sandPumpCoreTech).setDependencies("Core Boosting", (string)null);
			((CustomTech)sandPumpCoreTech).setSprite("Sand Pump", true);
			((CustomTech)sandPumpCoreTech).register();
			crusherPowerTrim1 = new CrusherPowerTrimTech("ASM PowerTrim II");
			((CustomTech)crusherPowerTrim1).register();
			crusherPowerTrim2 = new CrusherPowerTrimTech("ASM PowerTrim III");
			((CustomTech)crusherPowerTrim2).register();
			crusherPowerTrim3 = new CrusherPowerTrimTech("ASM PowerTrim IV");
			((CustomTech)crusherPowerTrim3).register();
			crusherPowerTrim4 = new CrusherPowerTrimTech("ASM PowerTrim V");
			((CustomTech)crusherPowerTrim4).register();
			sesamiteCarbonBrickTech = new CustomTech((TechCategory)1, "Sesamite Blasting", "Enables blast smelting of carbon bricks from sesamite stems.", (CoreType)3, 250);
			sesamiteCarbonBrickTech.setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 7), (TechColumns)0);
			sesamiteCarbonBrickTech.setSprite("SesamiteBlasting", false);
			sesamiteCarbonBrickTech.register();
			carbonBrickRecipe = new CustomRecipe(sesamiteCarbonBrickTech.name, (CraftingMethod)4);
			((NewRecipeDetails)carbonBrickRecipe).unlockName = "Sesamite Stem Compression";
			((NewRecipeDetails)carbonBrickRecipe).duration = 1f;
			((NewRecipeDetails)carbonBrickRecipe).ingredients = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = "Sesamite Stems",
					quantity = config.getInt(STConfig.ConfigEntries.SESAMITEBLASTCOST)
				}
			};
			((NewRecipeDetails)carbonBrickRecipe).outputs = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = "Carbon Powder Brick",
					quantity = 1
				}
			};
			carbonBrickRecipe.register();
			sesamiteCarbonBrickTech.setRecipes((CustomRecipe[])(object)new CustomRecipe[1] { carbonBrickRecipe });
			machineScrappingTech = new CustomTech((TechCategory)1, "Machine Scrapping", "Allows the crushing of machines into scrap ore.", (CoreType)3, 250);
			machineScrappingTech.setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 7), (TechColumns)80);
			machineScrappingTech.setSprite("MachineScrapping", false);
			machineScrappingTech.register();
			goldPowder = new CustomItem("Gold Powder", "Pulverized Gold Ore.", "Copper Ore Powder", "GoldPowder");
			((NewResourceDetails)goldPowder).craftingMethod = (CraftingMethod)6;
			((NewResourceDetails)goldPowder).craftTierRequired = 0;
			((NewResourceDetails)goldPowder).headerTitle = "Logistics";
			((NewResourceDetails)goldPowder).subHeaderTitle = "Utility";
			((NewResourceDetails)goldPowder).unlockName = "Gold Ore Extraction";
			goldPowder.register();
			goldCrushingTech = new CustomTech((TechCategory)1, "Gold Refinement", "Getting more out of your gold ore.", (CoreType)3, 24);
			goldCrushingTech.setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 6), (TechColumns)40);
			((NewUnlockDetails)goldCrushingTech).sprite = ((NewResourceDetails)goldPowder).sprite;
			goldCrushingTech.setDependencies("Gold Ingot", (string)null);
			goldCrushingTech.register();
			goldCrushingRecipe = new CustomRecipe("goldcrushing", (CraftingMethod)6);
			((NewRecipeDetails)goldCrushingRecipe).duration = 30f / config.getFloat(STConfig.ConfigEntries.GOLDDUSTSPEED);
			((NewRecipeDetails)goldCrushingRecipe).unlockName = "Gold Ore Extraction";
			((NewRecipeDetails)goldCrushingRecipe).ingredients = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = "Gold Ore",
					quantity = 90
				},
				new RecipeResourceInfo
				{
					name = "Clay",
					quantity = 12
				}
			};
			((NewRecipeDetails)goldCrushingRecipe).outputs = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = ((NewResourceDetails)goldPowder).name,
					quantity = 60
				}
			};
			goldCrushingRecipe.register();
			goldPowderSmeltingRecipe = new CustomRecipe("goldpowdersmelting", (CraftingMethod)2);
			((NewRecipeDetails)goldPowderSmeltingRecipe).duration = 24f / config.getFloat(STConfig.ConfigEntries.GOLDDUSTSPEED);
			((NewRecipeDetails)goldPowderSmeltingRecipe).unlockName = "Gold Ore Extraction";
			((NewRecipeDetails)goldPowderSmeltingRecipe).ingredients = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = ((NewResourceDetails)goldPowder).name,
					quantity = 2
				}
			};
			((NewRecipeDetails)goldPowderSmeltingRecipe).outputs = new List<RecipeResourceInfo>
			{
				new RecipeResourceInfo
				{
					name = "Gold Ingot",
					quantity = 3
				}
			};
			goldPowderSmeltingRecipe.register();
			float @float = config.getFloat(STConfig.ConfigEntries.COREPOWERBOOSTCOST);
			if (@float > 0f)
			{
				greenCoreEfficiencyTech = new CustomTech((TechCategory)5, "Green Core Power Boost", "Boosts the power of green cores to 125%, matching blue and purple.", (CoreType)3, DIExtensions.multiplyBy(40, (double)@float));
				greenCoreEfficiencyTech.setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 6), YELLOW_CORE_COLUMN);
				greenCoreEfficiencyTech.setSprite("Research Core (Green)", true);
				greenCoreEfficiencyTech.setDependencies("Research Core (Yellow)", (string)null);
				greenCoreEfficiencyTech.register();
				allCoreEfficiencyTech2 = new CustomTech((TechCategory)5, "Research Core Power Boost II", "Boosts the power of all research cores to 150%.", (CoreType)3, DIExtensions.multiplyBy(500, (double)@float));
				allCoreEfficiencyTech2.setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 7), YELLOW_CORE_COLUMN);
				allCoreEfficiencyTech2.setSprite("Research Core (Yellow)", true);
				allCoreEfficiencyTech2.setDependencies(greenCoreEfficiencyTech, (CustomTech)null);
				allCoreEfficiencyTech2.register();
			}
			spectralYieldCoreTech = new CoreBoostTech(config.getInt(STConfig.ConfigEntries.CUBECOREEFFECT), (CoreType)3, config.getInt(STConfig.ConfigEntries.CUBECORECOST), (string)null);
			spectralYieldCoreTech.setText("Spectral Cubes", "spectral cube crafting yield");
			((CustomTech)spectralYieldCoreTech).setPosition(TTUtil.getTierAtStation((ProductionTerminal)3, 7), COREBOOST_COLUMN);
			((CustomTech)spectralYieldCoreTech).setSprite("Spectral Cube (Colorless)", true);
			((CustomTech)spectralYieldCoreTech).setDependencies("Spectral Cube (Colorless)", "Core Boosting");
			((CustomTech)spectralYieldCoreTech).register();
			goldCrushingTech.setRecipes((CustomRecipe[])(object)new CustomRecipe[2] { goldCrushingRecipe, goldPowderSmeltingRecipe });
			((CustomRecipe)new MachineScrapRecipe("Assembler MKII")).register();
			((CustomRecipe)new MachineScrapRecipe("Thresher MKII")).register();
			((CustomRecipe)new MachineScrapRecipe("Crank Generator MKII")).register();
			((CustomRecipe)new MachineScrapRecipe("Research Core 520nm (Green)")).register();
			((CustomRecipe)new DrillCrushingRecipe()).register();
			DIMod.onDefinesLoadedFirstTime += onDefinesLoaded;
			DIMod.onTechsLoadedFirstTime += onTechsLoaded;
			DIMod.onRecipesLoaded += onRecipesLoaded;
			DIMod.onTechActivatedEvent += onTechActivated;
			DIMod.onTechDeactivatedEvent += onTechDeactivated;
			Events.GameLoaded += onTechStatesChanged;
		}
		catch (Exception ex2)
		{
			TTUtil.log("Failed to load SierraTech: " + ex2, (Assembly)null, 0);
		}
		TTUtil.log("Finished Initializing SierraTech", (Assembly)null, 0);
	}

	private static void onDefinesLoaded()
	{
		if (config.getBoolean(STConfig.ConfigEntries.ELEVATORDRILLADJUST))
		{
			TTUtil.setDrillUsableUntil("Excavator Bit MKIV", (ElevatorLevels)12, true);
			TTUtil.setDrillUsableUntil("Excavator Bit MKV", (ElevatorLevels)13, true);
			ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName("Excavator Bit MKVI", false);
			resourceInfoByName.digFuelPoints = DIExtensions.multiplyBy(resourceInfoByName.digFuelPoints, 1.6);
			ResourceInfo resourceInfoByName2 = Resources.GetResourceInfoByName("Excavator Bit MKVII", false);
			resourceInfoByName2.digFuelPoints *= 2;
		}
	}

	private static void onTechsLoaded()
	{
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		Unlock unlock = TTUtil.getUnlock("Sesamite Crystal Synthesis", true);
		Unlock unlock2 = TTUtil.getUnlock("Sesamite Powder Extraction", true);
		if (config.getBoolean(STConfig.ConfigEntries.CRUSHERPOWERTECHCOST))
		{
			DIExtensions.adjustCoreCost(unlock, 0.333);
			DIExtensions.adjustCoreCost(unlock2, 0.5714285714285714);
		}
		string[] array = DIExtensions.getDescription(unlock).Split(new char[1] { '.' });
		string[] array2 = DIExtensions.getDescription(unlock2).Split(new char[1] { '.' });
		string text = array[^2];
		array[^2] = array2[^2];
		array2[^2] = text;
		DIExtensions.setDescription(unlock, string.Join(".", array));
		DIExtensions.setDescription(unlock2, string.Join(".", array2));
		TTUtil.getUnlock("Research Core (Yellow)", true).treePosition = (float)YELLOW_CORE_COLUMN;
		TTUtil.getUnlock("Core Boost (Assembly)", true).treePosition = 100f;
		TTUtil.moveUnlockChain(TTUtil.getUnlock("Relay Circuit Deconstruction", true), (TechCategory)6);
		TTUtil.getUnlock("Spindle Disassembly", true).treePosition = 60f;
		TTUtil.getUnlock("Mechanism Disassembly (Copper)", true).treePosition = 60f;
		if (config.getBoolean(STConfig.ConfigEntries.ELEVATORDRILLADJUST))
		{
			replaceRangeInDescription("Excavator Bit MKVI", "Excavator Bit MKVI");
			replaceRangeInDescription("Excavator Bit MKVII", "Excavator Bit MKVII");
		}
	}

	private static void replaceRangeInDescription(string name, string itemRef)
	{
		ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(itemRef, false);
		int digFuelPoints = resourceInfoByName.digFuelPoints;
		Unlock unlock = TTUtil.getUnlock(name, true);
		string description = DIExtensions.getDescription(unlock);
		int num = description.IndexOf("m Before", StringComparison.InvariantCultureIgnoreCase);
		int num2 = description.LastIndexOf(' ', num - 1);
		description = description.Substring(0, num2 + 1) + digFuelPoints + description.Substring(num);
		DIExtensions.setDescription(unlock, description);
		resourceInfoByName.description = description;
	}

	private static void onRecipesLoaded()
	{
		float @float = config.getFloat(STConfig.ConfigEntries.CRUSHERPOWERSCALE);
		SchematicsRecipeData val = GameDefines.instance.GetValidCrusherRecipes(new List<int>
		{
			Resources.GetResourceIDByName("Shiverthorn Extract", false),
			Resources.GetResourceIDByName("Sesamite Powder", false)
		}, 9999, 9999, false)[0];
		DIExtensions.scalePower(val, 2.0, (double)(2f * @float));
		SchematicsRecipeData val2 = GameDefines.instance.GetValidCrusherRecipes(new List<int> { Resources.GetResourceIDByName("Sesamite Crystal", false) }, 9999, 9999, false)[0];
		DIExtensions.scalePower(val2, 2.526315789473684, (double)(2f * @float));
		if (config.getBoolean(STConfig.ConfigEntries.ATLANTCUBE))
		{
			DIExtensions.replaceIngredient(TTUtil.getRecipesByOutput(Resources.GetResourceIDByName("Spectral Cube (Colorless) X100", false))[0], "Sesamite Ingot", "Atlantum Mixture Brick", 1);
		}
	}

	public static void onTechActivated(int id)
	{
		onTechStatesChanged();
	}

	public static void onTechDeactivated(int id)
	{
		onTechStatesChanged();
	}

	private static void onTechStatesChanged()
	{
		if (allCoreEfficiencyTech2 != null && allCoreEfficiencyTech2.isUnlocked)
		{
			TechTreeState.coreEffiencyMultipliers = new float[6] { 1.5f, 1.5f, 1.5f, 1.5f, 1f, 1f };
		}
		else if (greenCoreEfficiencyTech != null && greenCoreEfficiencyTech.isUnlocked)
		{
			TechTreeState.coreEffiencyMultipliers = new float[6] { 1.25f, 1.25f, 1.25f, 1f, 1f, 1f };
		}
		else
		{
			TechTreeState.coreEffiencyMultipliers = new float[6] { 1.25f, 1f, 1.25f, 1f, 1f, 1f };
		}
		CrusherPowerTrimTech crusherPowerTechLevel = getCrusherPowerTechLevel();
		PowerNetwork.powerConsumptionMultipliers[34] = crusherPowerTechLevel?.efficiency ?? 1f;
	}

	internal static CrusherPowerTrimTech getCrusherPowerTechLevel()
	{
		if (((CustomTech)crusherPowerTrim4).isUnlocked)
		{
			return crusherPowerTrim4;
		}
		if (((CustomTech)crusherPowerTrim3).isUnlocked)
		{
			return crusherPowerTrim3;
		}
		if (((CustomTech)crusherPowerTrim2).isUnlocked)
		{
			return crusherPowerTrim2;
		}
		if (((CustomTech)crusherPowerTrim1).isUnlocked)
		{
			return crusherPowerTrim1;
		}
		return null;
	}

	internal static SandPumpTech.TechLevel getHighestPumpLevelUnlocked()
	{
		for (int num = sandPumpBoostTechs.Length - 1; num >= 0; num--)
		{
			if (((CustomTech)sandPumpBoostTechs[num]).isUnlocked)
			{
				return techLevels[num];
			}
		}
		return null;
	}

	private static float getSandPumpRateFactor(float val)
	{
		SandPumpTech.TechLevel highestPumpLevelUnlocked = getHighestPumpLevelUnlocked();
		if (highestPumpLevelUnlocked != null)
		{
			val *= highestPumpLevelUnlocked.pumpMultiplier;
		}
		val *= 1f + sandPumpCoreTech.currentEffect;
		return val;
	}

	public static float getSandPumpRateDisplay(float val, SandPumpInspector insp, SandPumpInstance inst)
	{
		return getSandPumpRateFactor(val);
	}

	public static float getSandPumpRate(float val, SandVolume sand)
	{
		return getSandPumpRateFactor(val);
	}

	public static int getAssemblerYield(int amt, ref AssemblerInstance machine)
	{
		SchematicsRecipeData targetRecipe = machine.targetRecipe;
		int num = amt;
		if (((UniqueIdScriptableObject)targetRecipe.outputTypes[0]).uniqueId == Resources.GetResourceIDByName("Spectral Cube (Colorless)", false))
		{
			float num2 = spectralYieldCoreTech.currentEffect;
			while (num2 > 0f && (num2 >= 1f || Random.Range(0f, 1f) < num2))
			{
				amt += num;
				num2 -= 1f;
			}
		}
		return amt;
	}
}
public static class Patches
{
	[HarmonyPatch(typeof(SandVolume), new Type[]
	{
		typeof(byte),
		typeof(BakedSandVolume),
		typeof(float),
		typeof(float)
	})]
	[HarmonyPatch("Initialize")]
	public static class SandVolumeInitHook
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			try
			{
				int instruction = InstructionHandlers.getInstruction(list, 0, 0, OpCodes.Stfld, new object[2] { "SandVolume", "strataSandDigRateMultiplier" });
				list[instruction - 1] = new CodeInstruction(OpCodes.Ldc_R4, (object)1f);
				FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
			}
			catch (Exception ex)
			{
				FileLog.Log(string.Concat("Caught exception when running patch ", MethodBase.GetCurrentMethod().DeclaringType, "!"));
				FileLog.Log(ex.Message);
				FileLog.Log(ex.StackTrace);
				FileLog.Log(ex.ToString());
			}
			return list.AsEnumerable();
		}
	}

	[HarmonyPatch("Update")]
	[HarmonyPatch(typeof(SandVolume))]
	public static class SandVolumeRateHook
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			try
			{
				int instruction = InstructionHandlers.getInstruction(list, 0, 0, OpCodes.Ldfld, new object[2] { "GameDefines", "SandPumpDigAmount" });
				list.InsertRange(instruction + 1, new List<CodeInstruction>
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					InstructionHandlers.createMethodCall("ReikaKalseki.SierraTech.SierraTechMod", "getSandPumpRate", false, new Type[2]
					{
						typeof(float),
						typeof(SandVolume)
					})
				});
				list.Add(new CodeInstruction(OpCodes.Ret, (object)null));
				FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
			}
			catch (Exception ex)
			{
				FileLog.Log(string.Concat("Caught exception when running patch ", MethodBase.GetCurrentMethod().DeclaringType, "!"));
				FileLog.Log(ex.Message);
				FileLog.Log(ex.StackTrace);
				FileLog.Log(ex.ToString());
			}
			return list.AsEnumerable();
		}
	}

	[HarmonyPatch("SetInspector")]
	[HarmonyPatch(typeof(SandPumpInspector))]
	public static class SandInspectorRateHook
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			try
			{
				int instruction = InstructionHandlers.getInstruction(list, 0, 0, OpCodes.Ldfld, new object[2] { "GameDefines", "SandPumpDigAmount" });
				list.InsertRange(instruction + 1, new List<CodeInstruction>
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldarg_1, (object)null),
					InstructionHandlers.createMethodCall("ReikaKalseki.SierraTech.SierraTechMod", "getSandPumpRateDisplay", false, new Type[3]
					{
						typeof(float),
						typeof(SandPumpInspector),
						typeof(SandPumpInstance)
					})
				});
				list.Add(new CodeInstruction(OpCodes.Ret, (object)null));
				FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
			}
			catch (Exception ex)
			{
				FileLog.Log(string.Concat("Caught exception when running patch ", MethodBase.GetCurrentMethod().DeclaringType, "!"));
				FileLog.Log(ex.Message);
				FileLog.Log(ex.StackTrace);
				FileLog.Log(ex.ToString());
			}
			return list.AsEnumerable();
		}
	}

	[HarmonyPatch("GetOutputAmount")]
	[HarmonyPatch(typeof(AssemblerInstance))]
	public static class AssemblerCubeYield
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			try
			{
				InstructionHandlers.patchEveryReturnPre(list, (CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					InstructionHandlers.createMethodCall("ReikaKalseki.SierraTech.SierraTechMod", "getAssemblerYield", false, new Type[2]
					{
						typeof(int),
						typeof(AssemblerInstance).MakeByRefType()
					})
				});
				FileLog.Log("Done patch " + MethodBase.GetCurrentMethod().DeclaringType);
			}
			catch (Exception ex)
			{
				FileLog.Log(string.Concat("Caught exception when running patch ", MethodBase.GetCurrentMethod().DeclaringType, "!"));
				FileLog.Log(ex.Message);
				FileLog.Log(ex.StackTrace);
				FileLog.Log(ex.ToString());
			}
			return list.AsEnumerable();
		}
	}
}
public class STConfig
{
	public enum ConfigEntries
	{
		[ConfigEntry("Core Effectiveness Tech Cost multiplier", typeof(float), 1f, 0f, 100f, float.NaN)]
		COREPOWERBOOSTCOST,
		[ConfigEntry("Sand Pump Core Boost Effect", typeof(int), 10f, 1f, 50f, float.NaN)]
		PUMPCOREEFFECT,
		[ConfigEntry("Spectral Cube Core Boost Effect", typeof(int), 5f, 1f, 100f, float.NaN)]
		CUBECOREEFFECT,
		[ConfigEntry("Spectral Cube Core Boost Cost", typeof(int), 200f, 10f, 10000f, float.NaN)]
		CUBECORECOST,
		[ConfigEntry("Sesamite Blasting Cost", typeof(int), 8f, 1f, 200f, float.NaN)]
		SESAMITEBLASTCOST,
		[ConfigEntry("Scrap Recycling Loop Yield Multiplier", typeof(float), 1f, 0.5f, 5f, float.NaN)]
		SCRAPCYCLERATIO,
		[ConfigEntry("Gold Purification recipe speed multiplier", typeof(float), 1f, 0.1f, 25f, float.NaN)]
		GOLDDUSTSPEED,
		[ConfigEntry("Adjust excavator bit scaling", true, false)]
		ELEVATORDRILLADJUST,
		[ConfigEntry("Reduce Crusher Power Yield Recipe Tech Costs", true, false)]
		CRUSHERPOWERTECHCOST,
		[ConfigEntry("Crusher crystal-to-power multiplier", typeof(float), 1f, 0.1f, 25f, float.NaN)]
		CRUSHERPOWERSCALE,
		[ConfigEntry("Atlantum Prismatic Cubes", true, false)]
		ATLANTCUBE
	}
}