using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Logging;
using EquinoxsDebuggingTools;
using EquinoxsModUtils.Patches;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("EquinoxsModUtils")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EquinoxsModUtils")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("10cac0f2-892f-4b27-9f39-3a6a47279742")]
[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 EquinoxsModUtils
{
internal static class EMULogging
{
internal static void LogEMUInfo(string message)
{
ModUtils.Log.LogInfo((object)message);
}
internal static void LogEMUWarning(string message)
{
ModUtils.Log.LogWarning((object)message);
}
internal static void LogEMUError(string message)
{
ModUtils.Log.LogError((object)message);
}
}
internal static class InternalTools
{
internal static bool printResources;
internal static bool printUnlocks;
internal static bool isCursorFree;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int MessageBox(IntPtr hWnd, string text, string caption, int type);
internal static void PrintAllResourceNames()
{
EMULogging.LogEMUInfo("Printing all resources\n\n");
foreach (ResourceInfo resource in GameDefines.instance.resources)
{
EMULogging.LogEMUInfo(resource.displayName);
}
EMULogging.LogEMUInfo("\n\nPrinted all resources");
}
internal static void PrintAllUnlockNames()
{
EMULogging.LogEMUInfo("Printing all unlocks\n\n");
foreach (Unlock unlock in GameDefines.instance.unlocks)
{
EMULogging.LogEMUInfo(LocsUtility.TranslateStringFromHash(unlock.displayNameHash, (string)null, (Object)null));
}
EMULogging.LogEMUInfo("\n\nPrinted all unlocks");
}
internal static void CheckBepInExConfig()
{
string text = Environment.CurrentDirectory + "/BepInEx/config/BepInEx.cfg";
EMULogging.LogEMUInfo("Config file path: '" + text + "'");
if (File.Exists(text))
{
string text2 = File.ReadAllText(text);
if (!text2.Contains("HideManagerGameObject = true"))
{
text2 = text2.Replace("HideManagerGameObject = false", "HideManagerGameObject = true");
File.WriteAllText(text, text2);
MessageBox(IntPtr.Zero, "Techtonica needs to restart to activate mods, after it closes, please launch it again.", "Please Restart", 64);
Application.Quit();
}
else
{
EMULogging.LogEMUInfo("HideGameManagerObject has been correctly set to true");
}
}
else
{
EMULogging.LogEMUError("Couldn't check BepInEx.cfg - doesn't exist");
}
}
}
public static class EMU
{
public static class Events
{
public static event Action GameStateLoaded;
public static event Action GameDefinesLoaded;
public static event Action MachineManagerLoaded;
public static event EventHandler SaveStateLoaded;
public static event Action TechTreeStateLoaded;
public static event EventHandler GameSaved;
public static event Action GameLoaded;
public static event Action GameUnloaded;
internal static void FireGameStateLoaded()
{
EMULogging.LogEMUInfo("GameState.instance has loaded");
Events.GameStateLoaded?.Invoke();
}
internal static void FireGameDefinesLoaded()
{
EMULogging.LogEMUInfo("GameDefines.instance has loaded");
Events.GameDefinesLoaded?.Invoke();
}
internal static void FireMachineManagerLoaded()
{
EMULogging.LogEMUInfo("MachineManager.instance has loaded");
Events.MachineManagerLoaded?.Invoke();
}
internal static void FireSaveStateLoaded()
{
EMULogging.LogEMUInfo("SaveState.instance has loaded");
Events.SaveStateLoaded?.Invoke(SaveState.instance.metadata.worldName, EventArgs.Empty);
}
internal static void FireTechTreeStateLoaded()
{
EMULogging.LogEMUInfo("TechTreeState.instance has loaded");
Events.TechTreeStateLoaded?.Invoke();
}
internal static void FireGameSaved()
{
EMULogging.LogEMUInfo("Game has been saved");
Events.GameSaved?.Invoke(SaveState.instance.metadata.worldName, EventArgs.Empty);
}
internal static void FireGameLoaded()
{
EMULogging.LogEMUInfo("Game has loaded");
Events.GameLoaded?.Invoke();
}
internal static void FireGameUnloaded()
{
EMULogging.LogEMUInfo("Game has unloaded");
Events.GameUnloaded?.Invoke();
}
}
public static class Images
{
public static Texture2D GetImageForResource(string name, bool shouldLog = false)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
ResourceInfo resourceInfoByName = Resources.GetResourceInfoByName(name, shouldLog);
if ((Object)(object)resourceInfoByName == (Object)null)
{
return null;
}
if ((Object)(object)resourceInfoByName.sprite == (Object)null)
{
EMULogging.LogEMUWarning("Resource '" + resourceInfoByName.displayName + "' has no sprite. Returning null.");
return null;
}
Sprite sprite = resourceInfoByName.sprite;
Rect val = sprite.rect;
if (((Rect)(ref val)).width != (float)((Texture)sprite.texture).width)
{
val = sprite.rect;
int num = (int)((Rect)(ref val)).width;
val = sprite.rect;
Texture2D val2 = new Texture2D(num, (int)((Rect)(ref val)).height);
Texture2D texture = sprite.texture;
val = sprite.textureRect;
int num2 = (int)((Rect)(ref val)).x;
val = sprite.textureRect;
int num3 = (int)((Rect)(ref val)).y;
val = sprite.textureRect;
int num4 = (int)((Rect)(ref val)).width;
val = sprite.textureRect;
Color[] pixels = texture.GetPixels(num2, num3, num4, (int)((Rect)(ref val)).height);
val2.SetPixels(pixels);
val2.Apply();
return val2;
}
return sprite.texture;
}
public static Texture2D LoadTexture2DFromFile(string path, bool shouldLog = false, Assembly assembly = null)
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
if (assembly == null)
{
assembly = Assembly.GetCallingAssembly();
}
string[] manifestResourceNames = assembly.GetManifestResourceNames();
string text = Array.Find(manifestResourceNames, (string name) => name.EndsWith(path));
if (text == null)
{
EMULogging.LogEMUError("Could not find image resource '" + path + "' in mod assembly.");
EMULogging.LogEMUInfo("Available resources are: " + string.Join(", ", manifestResourceNames));
return null;
}
using Stream stream = assembly.GetManifestResourceStream(text);
if (stream == null)
{
EMULogging.LogEMUError("Could not load image resource '" + path + "' from mod assembly stream.");
return null;
}
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
byte[] array = memoryStream.ToArray();
Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
ImageConversion.LoadImage(val, array);
if (shouldLog)
{
EMULogging.LogEMUInfo("Created Texture2D from image resource '" + path + "'");
}
return val;
}
public static Sprite LoadSpriteFromFile(string path, bool shouldLog = false)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = LoadTexture2DFromFile(path, shouldLog, Assembly.GetCallingAssembly());
return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 512f);
}
}
public static class LoadingStates
{
internal static bool loadingUIObserved = false;
internal static bool shouldMonitorLoadingStates = true;
public static bool hasGameStateLoaded;
public static bool hasGameDefinesLoaded;
public static bool hasMachineManagerLoaded;
public static bool hasSaveStateLoaded;
public static bool hasTechTreeStateLoaded;
public static bool hasGameLoaded;
internal static void CheckLoadingStates()
{
if (!hasGameLoaded && shouldMonitorLoadingStates)
{
if (!hasGameStateLoaded)
{
CheckIfGameStateLoaded();
}
if (!hasGameDefinesLoaded)
{
CheckIfGameDefinesLoaded();
}
if (!hasSaveStateLoaded)
{
CheckIfSaveStateLoaded();
}
if (!hasTechTreeStateLoaded)
{
CheckIfTechTreeStateLoaded();
}
if (!hasMachineManagerLoaded)
{
CheckIfMachineManagerLoaded();
}
if (!hasGameLoaded)
{
CheckIfGameLoaded();
}
}
}
internal static void ResetLoadingStates()
{
loadingUIObserved = false;
hasGameStateLoaded = false;
hasGameDefinesLoaded = false;
hasMachineManagerLoaded = false;
hasSaveStateLoaded = false;
hasTechTreeStateLoaded = false;
hasGameLoaded = false;
}
private static void CheckIfGameStateLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && GameState.instance != null)
{
hasGameStateLoaded = true;
Events.FireGameStateLoaded();
}
}
private static void CheckIfGameDefinesLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && (Object)(object)GameDefines.instance != (Object)null)
{
hasGameDefinesLoaded = true;
Events.FireGameDefinesLoaded();
if (InternalTools.printResources)
{
InternalTools.PrintAllResourceNames();
}
if (InternalTools.printUnlocks)
{
InternalTools.PrintAllUnlockNames();
}
}
}
private static void CheckIfSaveStateLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && SaveState.instance != null && SaveState.instance.metadata != null && !string.IsNullOrEmpty(SaveState.instance.metadata.worldName))
{
hasSaveStateLoaded = true;
Events.FireSaveStateLoaded();
}
}
private static void CheckIfTechTreeStateLoaded()
{
if (MachineManager.instance != null && TechTreeState.instance != null)
{
hasTechTreeStateLoaded = true;
Events.FireTechTreeStateLoaded();
}
}
private static void CheckIfMachineManagerLoaded()
{
if (MachineManager.instance != null)
{
hasMachineManagerLoaded = true;
Events.FireMachineManagerLoaded();
}
}
private static void CheckIfGameLoaded()
{
if (!((Object)(object)LoadingUI.instance == (Object)null) || loadingUIObserved)
{
if ((Object)(object)LoadingUI.instance != (Object)null && !loadingUIObserved)
{
loadingUIObserved = true;
}
else if ((Object)(object)LoadingUI.instance == (Object)null && loadingUIObserved)
{
hasGameLoaded = true;
shouldMonitorLoadingStates = false;
Events.FireGameLoaded();
}
}
}
}
public static class Names
{
public static class Resources
{
public const string SpectralCubeGarnet = "Spectral Cube (Garnet)";
public const string SpectralCubeEmerald = "Spectral Cube (Emerald)";
public const string SpectralCubeRuby = "Spectral Cube (Ruby)";
public const string SpectralCubeColorless = "Spectral Cube (Colorless)";
public const string SpectralCubeColorlessX100 = "Spectral Cube (Colorless) X100";
public const string ResearchCore380nmPurple = "Research Core 380nm (Purple)";
public const string ResearchCore480nmBlue = "Research Core 480nm (Blue)";
public const string ResearchCore520nmGreen = "Research Core 520nm (Green)";
public const string ResearchCore590nmYellow = "Research Core 590nm (Yellow)";
public const string ExcavatorBitMKI = "Excavator Bit MKI";
public const string ExcavatorBitMKII = "Excavator Bit MKII";
public const string ExcavatorBitMKIII = "Excavator Bit MKIII";
public const string ExcavatorBitMKIV = "Excavator Bit MKIV";
public const string ExcavatorBitMKV = "Excavator Bit MKV";
public const string ExcavatorBitMKVI = "Excavator Bit MKVI";
public const string ExcavatorBitMKVII = "Excavator Bit MKVII";
public const string CoreComposer = "Core Composer";
public const string ConveyorBelt = "Conveyor Belt";
public const string ConveyorBeltMKII = "Conveyor Belt MKII";
public const string ConveyorBeltMKIII = "Conveyor Belt MKIII";
public const string Inserter = "Inserter";
public const string LongInserter = "Long Inserter";
public const string FilterInserter = "Filter Inserter";
public const string FastInserter = "Fast Inserter";
public const string StackInserter = "Stack Inserter";
public const string StackFilterInserter = "Stack Filter Inserter";
public const string LongStackFilterInserter = "Long Stack Filter Inserter";
public const string MonorailDepot = "Monorail Depot";
public const string MonorailPole = "Monorail Pole";
public const string MonorailTrack = "Monorail Track";
public const string Container = "Container";
public const string ContainerMKII = "Container MKII";
public const string MiningCharge = "Mining Charge";
public const string MiningDrill = "Mining Drill";
public const string BlastDrill = "Blast Drill";
public const string MiningDrillMKII = "Mining Drill MKII";
public const string SandPump = "Sand Pump";
public const string Smelter = "Smelter";
public const string SmelterMKII = "Smelter MKII";
public const string SmelterMKIII = "Smelter MKIII";
public const string BlastSmelter = "Blast Smelter";
public const string Planter = "Planter";
public const string PlanterMKII = "Planter MKII";
public const string Thresher = "Thresher";
public const string ThresherMKII = "Thresher MKII";
public const string Crusher = "Crusher";
public const string Assembler = "Assembler";
public const string AssemblerMKII = "Assembler MKII";
public const string CrankGenerator = "Crank Generator";
public const string CrankGeneratorMKII = "Crank Generator MKII";
public const string Accumulator = "Accumulator";
public const string WaterWheel = "Water Wheel";
public const string VoltageStepper = "Voltage Stepper";
public const string HighVoltageCable = "High Voltage Cable";
public const string Nexus = "Nexus";
public const string LightStick = "Light Stick";
public const string RedLightStick = "Red Light Stick";
public const string GreenLightStick = "Green Light Stick";
public const string BlueLightStick = "Blue Light Stick";
public const string OverheadLight = "Overhead Light";
public const string PowerFloor = "Power Floor";
public const string CalycitePlatform1x1 = "Calycite Platform (1x1)";
public const string CalycitePlatform3x3 = "Calycite Platform (3x3)";
public const string CalycitePlatform5x5 = "Calycite Platform (5x5)";
public const string MetalStairs1x1 = "Metal Stairs (1x1)";
public const string MetalStairs3x1 = "Metal Stairs (3x1)";
public const string MetalStairs3x3 = "Metal Stairs (3x3)";
public const string MetalStairs3x5 = "Metal Stairs (3x5)";
public const string CalyciteRamp1x1 = "Calycite Ramp (1x1)";
public const string CalyciteRamp1x3 = "Calycite Ramp (1x3)";
public const string CalyciteRamp1x5 = "Calycite Ramp (1x5)";
public const string Catwalk3x9 = "Catwalk (3x9)";
public const string Catwalk5x9 = "Catwalk (5x9)";
public const string DiscoBlock1x1 = "Disco Block (1x1)";
public const string GlowBlock1x1 = "Glow Block (1x1)";
public const string CalyciteWall3x3 = "Calycite Wall (3x3)";
public const string CalyciteWall5x3 = "Calycite Wall (5x3)";
public const string CalyciteWall5x5 = "Calycite Wall (5x5)";
public const string CalyciteGate5x2 = "Calycite Gate (5x2)";
public const string CalyciteGate5x5 = "Calycite Gate (5x5)";
public const string CalyciteGate10x5 = "Calycite Gate (10x5)";
public const string CalyciteWallCap3x1 = "Calycite Wall Cap (3x1)";
public const string CalyciteWallCap5x1 = "Calycite Wall Cap (5x1)";
public const string CalyciteWallCorner1x1 = "Calycite Wall Corner (1x1)";
public const string CalyciteVerticalWallCap3x1 = "Calycite Vertical Wall Cap (3x1)";
public const string CalyciteVerticalWallCap5x1 = "Calycite Vertical Wall Cap (5x1)";
public const string CalyciteVerticalWallCorner1x1 = "Calycite Vertical Wall Corner (1x1)";
public const string CalyciteWallCutaway2x2 = "Calycite Wall Cutaway (2x2)";
public const string CalyciteWallCutaway3x3 = "Calycite Wall Cutaway (3x3)";
public const string CalyciteWallCutaway5x3 = "Calycite Wall Cutaway (5x3)";
public const string CalyciteWallCutaway5x5 = "Calycite Wall Cutaway (5x5)";
public const string StandingLamp1x5 = "Standing Lamp (1x5)";
public const string WallLight1x1 = "Wall Light (1x1)";
public const string WallLight3x1 = "Wall Light (3x1)";
public const string HangingLamp1x1 = "Hanging Lamp (1x1)";
public const string FanLamp7x2 = "Fan Lamp (7x2)";
public const string Railing1x1 = "Railing (1x1)";
public const string Railing3x1 = "Railing (3x1)";
public const string Railing5x1 = "Railing (5x1)";
public const string RailingCorner1x1 = "Railing Corner (1x1)";
public const string RailingCorner3x3 = "Railing Corner (3x3)";
public const string MetalPillar1x1 = "Metal Pillar (1x1)";
public const string MetalPillar1x3 = "Metal Pillar (1x3)";
public const string MetalPillar1x5 = "Metal Pillar (1x5)";
public const string CalycitePillar1x1 = "Calycite Pillar (1x1)";
public const string CalycitePillar1x3 = "Calycite Pillar (1x3)";
public const string CalycitePillar1x5 = "Calycite Pillar (1x5)";
public const string CalyciteAngleSupport3x3 = "Calycite Angle Support (3x3)";
public const string MetalAngleSupport5x2 = "Metal Angle Support (5x2)";
public const string MetalRibBase1x2 = "Metal Rib Base (1x2)";
public const string MetalRibMiddle1x3 = "Metal Rib Middle (1x3)";
public const string CalyciteBeam1x1 = "Calycite Beam (1x1)";
public const string CalyciteBeam3x1 = "Calycite Beam (3x1)";
public const string CalyciteBeam5x1 = "Calycite Beam (5x1)";
public const string MetalBeam1x1 = "Metal Beam (1x1)";
public const string MetalBeam1x3 = "Metal Beam (1x3)";
public const string MetalBeam1x5 = "Metal Beam (1x5)";
public const string SmallFloorPot = "Small Floor Pot";
public const string WallPot = "Wall Pot";
public const string MediumFloorPot = "Medium Floor Pot";
public const string CeilingPlant1x1 = "Ceiling Plant (1x1)";
public const string CeilingPlant3x3 = "Ceiling Plant (3x3)";
public const string WallPlant1x1 = "Wall Plant (1x1)";
public const string WallPlant3x3 = "Wall Plant (3x3)";
public const string SectionalCorner2x2 = "Sectional Corner (2x2)";
public const string Crate = "Crate";
public const string UniversalSeedPod = "Universal Seed Pod";
public const string UnstableSeedPod = "Unstable Seed Pod";
public const string KindlevineSeed = "Kindlevine Seed";
public const string SesamiteSeed = "Sesamite Seed";
public const string ShiverthornSeed = "Shiverthorn Seed";
public const string Plantmatter = "Plantmatter";
public const string Biobrick = "Biobrick";
public const string KindlevineStems = "Kindlevine Stems";
public const string ShiverthornBuds = "Shiverthorn Buds";
public const string KindlevineStemsWashed = "Kindlevine Stems (Washed)";
public const string ShiverthornBudsNeutralized = "Shiverthorn Buds (Neutralized)";
public const string SesamiteStems = "Sesamite Stems";
public const string BiobrickDieselUnrefined = "Biobrick Diesel (Unrefined)";
public const string BiobrickDieselInfusionPack = "Biobrick Diesel Infusion Pack";
public const string BiobrickDieselImpure = "Biobrick Diesel (Impure)";
public const string Kindlevine = "Kindlevine";
public const string BiobrickDieselPure = "Biobrick Diesel (Pure)";
public const string Sesamite = "Sesamite";
public const string Shiverthorn = "Shiverthorn";
public const string KindlevineExtract = "Kindlevine Extract";
public const string SesamitePowder = "Sesamite Powder";
public const string ShiverthornExtract = "Shiverthorn Extract";
public const string CarbonPowder = "Carbon Powder";
public const string Quicklime = "Quicklime";
public const string Cement = "Cement";
public const string AtlantumPowder = "Atlantum Powder";
public const string Sand = "Sand";
public const string SesamiteSand = "Sesamite Sand";
public const string Gravel = "Gravel";
public const string SesamiteCrystal = "Sesamite Crystal";
public const string Limestone = "Limestone";
public const string PlantmatterFiber = "Plantmatter Fiber";
public const string Dirt = "Dirt";
public const string ScrapOre = "Scrap Ore";
public const string CondensedScrapOre = "Condensed Scrap Ore";
public const string IronOre = "Iron Ore";
public const string GoldOre = "Gold Ore";
public const string IronOrePowder = "Iron Ore Powder";
public const string IronChunk = "Iron Chunk";
public const string RefinedIronChunk = "Refined Iron Chunk";
public const string CopperOre = "Copper Ore";
public const string CopperOrePowder = "Copper Ore Powder";
public const string CopperChunk = "Copper Chunk";
public const string RefinedCopperChunk = "Refined Copper Chunk";
public const string AtlantumOre = "Atlantum Ore";
public const string AtlantumChunk = "Atlantum Chunk";
public const string IronIngot = "Iron Ingot";
public const string GoldIngot = "Gold Ingot";
public const string SesamiteIngot = "Sesamite Ingot";
public const string IronSlab = "Iron Slab";
public const string CopperIngot = "Copper Ingot";
public const string CopperSlab = "Copper Slab";
public const string SteelMixture = "Steel Mixture";
public const string SteelIngot = "Steel Ingot";
public const string SteelSlab = "Steel Slab";
public const string AtlantumMixture = "Atlantum Mixture";
public const string AtlantumIngot = "Atlantum Ingot";
public const string AtlantumSlab = "Atlantum Slab";
public const string LimestoneBrick = "Limestone Brick";
public const string CarbonPowderBrick = "Carbon Powder Brick";
public const string KindlevineExtractBrick = "Kindlevine Extract Brick";
public const string AtlantumPowderBrick = "Atlantum Powder Brick";
public const string AtlantumMixtureBrick = "Atlantum Mixture Brick";
public const string PlantmatterBrick = "Plantmatter Brick";
public const string Clay = "Clay";
public const string Concrete = "Concrete";
public const string DecorativeConcrete = "Decorative Concrete";
public const string Glass = "Glass";
public const string PlantmatterFrame = "Plantmatter Frame";
public const string CarbonFrame = "Carbon Frame";
public const string CeramicParts = "Ceramic Parts";
public const string IronFrame = "Iron Frame";
public const string IronComponents = "Iron Components";
public const string IronMechanism = "Iron Mechanism";
public const string CopperWire = "Copper Wire";
public const string CopperFrame = "Copper Frame";
public const string CopperComponents = "Copper Components";
public const string CopperMechanism = "Copper Mechanism";
public const string ShiverthornCoolant = "Shiverthorn Coolant";
public const string SesamiteCoolant = "Sesamite Coolant";
public const string CoolingSystem = "Cooling System";
public const string MechanicalComponents = "Mechanical Components";
public const string Actuator = "Actuator";
public const string SensorBlock = "Sensor Block";
public const string ElectricalComponents = "Electrical Components";
public const string ProcessorUnit = "Processor Unit";
public const string CeramicTiles = "Ceramic Tiles";
public const string SteelFrame = "Steel Frame";
public const string WireSpindle = "Wire Spindle";
public const string Gearbox = "Gearbox";
public const string ReinforcedIronFrame = "Reinforced Iron Frame";
public const string ReinforcedCopperFrame = "Reinforced Copper Frame";
public const string ElectricalSet = "Electrical Set";
public const string ElectricFrame = "Electric Frame";
public const string ElectricMotor = "Electric Motor";
public const string ProcessorArray = "Processor Array";
public const string AdvancedCircuit = "Advanced Circuit";
public const string RelayCircuit = "Relay Circuit";
public const string ShiverthornExtractGel = "Shiverthorn Extract Gel";
public const string SesamiteGel = "Sesamite Gel";
public const string IronInfusedLimestone = "Iron-Infused Limestone";
public const string CopperInfusedLimestone = "Copper-Infused Limestone";
public const string AtlantumInfusedLimestone = "Atlantum-Infused Limestone";
public const string StandardPickaxe = "Standard Pickaxe";
public const string Scanner = "Scanner";
public const string Omniseeker = "Omniseeker";
public const string TheMOLE = "The M.O.L.E.";
public const string Replacer = "Replacer";
public const string Beacon = "Beacon";
public const string LaserPistol = "Laser Pistol";
public const string Railrunner = "Railrunner";
public const string HoverPack = "Hover Pack";
public static readonly List<string> SafeResources = new List<string>
{
"Spectral Cube (Garnet)", "Spectral Cube (Emerald)", "Spectral Cube (Ruby)", "Spectral Cube (Colorless)", "Spectral Cube (Colorless) X100", "Research Core 380nm (Purple)", "Research Core 480nm (Blue)", "Research Core 520nm (Green)", "Research Core 590nm (Yellow)", "Excavator Bit MKI",
"Excavator Bit MKII", "Excavator Bit MKIII", "Excavator Bit MKIV", "Excavator Bit MKV", "Excavator Bit MKVI", "Excavator Bit MKVII", "Core Composer", "Conveyor Belt", "Conveyor Belt MKII", "Conveyor Belt MKIII",
"Inserter", "Long Inserter", "Filter Inserter", "Fast Inserter", "Stack Inserter", "Stack Filter Inserter", "Long Stack Filter Inserter", "Monorail Depot", "Monorail Pole", "Monorail Track",
"Container", "Container MKII", "Mining Charge", "Mining Drill", "Blast Drill", "Mining Drill MKII", "Sand Pump", "Smelter", "Smelter MKII", "Smelter MKIII",
"Blast Smelter", "Planter", "Planter MKII", "Thresher", "Thresher MKII", "Crusher", "Assembler", "Assembler MKII", "Crank Generator", "Crank Generator MKII",
"Accumulator", "Water Wheel", "Voltage Stepper", "High Voltage Cable", "Nexus", "Light Stick", "Red Light Stick", "Green Light Stick", "Blue Light Stick", "Overhead Light",
"Power Floor", "Calycite Platform (1x1)", "Calycite Platform (3x3)", "Calycite Platform (5x5)", "Metal Stairs (1x1)", "Metal Stairs (3x1)", "Metal Stairs (3x3)", "Metal Stairs (3x5)", "Calycite Ramp (1x1)", "Calycite Ramp (1x3)",
"Calycite Ramp (1x5)", "Catwalk (3x9)", "Catwalk (5x9)", "Disco Block (1x1)", "Glow Block (1x1)", "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 Wall Cutaway (2x2)", "Calycite Wall Cutaway (3x3)", "Calycite Wall Cutaway (5x3)", "Calycite Wall Cutaway (5x5)", "Standing Lamp (1x5)", "Wall Light (1x1)", "Wall Light (3x1)", "Hanging Lamp (1x1)", "Fan Lamp (7x2)",
"Railing (1x1)", "Railing (3x1)", "Railing (5x1)", "Railing Corner (1x1)", "Railing Corner (3x3)", "Metal Pillar (1x1)", "Metal Pillar (1x3)", "Metal Pillar (1x5)", "Calycite Pillar (1x1)", "Calycite Pillar (1x3)",
"Calycite Pillar (1x5)", "Calycite Angle Support (3x3)", "Metal Angle Support (5x2)", "Metal Rib Base (1x2)", "Metal Rib Middle (1x3)", "Calycite Beam (1x1)", "Calycite Beam (3x1)", "Calycite Beam (5x1)", "Metal Beam (1x1)", "Metal Beam (1x3)",
"Metal Beam (1x5)", "Small Floor Pot", "Wall Pot", "Medium Floor Pot", "Ceiling Plant (1x1)", "Ceiling Plant (3x3)", "Wall Plant (1x1)", "Wall Plant (3x3)", "Sectional Corner (2x2)", "Crate",
"Universal Seed Pod", "Unstable Seed Pod", "Kindlevine Seed", "Sesamite Seed", "Shiverthorn Seed", "Plantmatter", "Biobrick", "Kindlevine Stems", "Shiverthorn Buds", "Kindlevine Stems (Washed)",
"Shiverthorn Buds (Neutralized)", "Sesamite Stems", "Biobrick Diesel (Unrefined)", "Biobrick Diesel Infusion Pack", "Biobrick Diesel (Impure)", "Kindlevine", "Biobrick Diesel (Pure)", "Sesamite", "Shiverthorn", "Kindlevine Extract",
"Sesamite Powder", "Shiverthorn Extract", "Carbon Powder", "Quicklime", "Cement", "Atlantum Powder", "Sand", "Sesamite Sand", "Gravel", "Sesamite Crystal",
"Limestone", "Plantmatter Fiber", "Dirt", "Scrap Ore", "Condensed Scrap Ore", "Iron Ore", "Gold Ore", "Iron Ore Powder", "Iron Chunk", "Refined Iron Chunk",
"Copper Ore", "Copper Ore Powder", "Copper Chunk", "Refined Copper Chunk", "Atlantum Ore", "Atlantum Chunk", "Iron Ingot", "Gold Ingot", "Sesamite Ingot", "Iron Slab",
"Copper Ingot", "Copper Slab", "Steel Mixture", "Steel Ingot", "Steel Slab", "Atlantum Mixture", "Atlantum Ingot", "Atlantum Slab", "Limestone Brick", "Carbon Powder Brick",
"Kindlevine Extract Brick", "Atlantum Powder Brick", "Atlantum Mixture Brick", "Plantmatter Brick", "Clay", "Concrete", "Decorative Concrete", "Glass", "Plantmatter Frame", "Carbon Frame",
"Ceramic Parts", "Iron Frame", "Iron Components", "Iron Mechanism", "Copper Wire", "Copper Frame", "Copper Components", "Copper Mechanism", "Shiverthorn Coolant", "Sesamite Coolant",
"Cooling System", "Mechanical Components", "Actuator", "Sensor Block", "Electrical Components", "Processor Unit", "Ceramic Tiles", "Steel Frame", "Wire Spindle", "Gearbox",
"Reinforced Iron Frame", "Reinforced Copper Frame", "Electrical Set", "Electric Frame", "Electric Motor", "Processor Array", "Advanced Circuit", "Relay Circuit", "Shiverthorn Extract Gel", "Sesamite Gel",
"Iron-Infused Limestone", "Copper-Infused Limestone", "Atlantum-Infused Limestone", "Standard Pickaxe", "Scanner", "Omniseeker", "The M.O.L.E.", "Replacer", "Beacon", "Laser Pistol",
"Railrunner", "Hover Pack"
};
}
public static class Unlocks
{
public const string Accumulator = "Accumulator";
public const string AccumulationII = "Accumulation II";
public const string AccumulationIII = "Accumulation III";
public const string AccumulationIV = "Accumulation IV";
public const string AccumulationV = "Accumulation V";
public const string AccumulationVI = "Accumulation VI";
public const string AccumulationVII = "Accumulation VII";
public const string AccumulationVIII = "Accumulation VIII";
public const string AccumulationIX = "Accumulation IX";
public const string SmelterMKIII = "Smelter MKIII";
public const string Actuator = "Actuator";
public const string AssemblerMKII = "Assembler MKII";
public const string AtlantumSlab = "Atlantum Slab";
public const string AdvancedComponents = "Advanced Components";
public const string AdvancedElectronics = "Advanced Electronics";
public const string AdvancedForging = "Advanced Forging";
public const string AdvancedSlabThreshing = "Advanced Slab Threshing";
public const string AdvancedOptimization = "Advanced Optimization";
public const string AdvancedPowderBricks = "Advanced Powder Bricks";
public const string AdvancedBrickThreshing = "Advanced Brick Threshing";
public const string SteelSlab = "Steel Slab";
public const string AdvancedClayProduction = "Advanced Clay Production";
public const string Assembler = "Assembler";
public const string ASMPowerTrimII = "ASM PowerTrim II";
public const string ASMPowerTrimIII = "ASM PowerTrim III";
public const string ASMPowerTrimIV = "ASM PowerTrim IV";
public const string ASMPowerTrimV = "ASM PowerTrim V";
public const string AssemblingSpeedII = "Assembling Speed II";
public const string AssemblingSpeedIII = "Assembling Speed III";
public const string AtlantumOreThreshing = "Atlantum Ore Threshing";
public const string AtlantumIngot = "Atlantum Ingot";
public const string AtlantumMixture = "Atlantum Mixture";
public const string AtlantumPowderBricks = "Atlantum Powder Bricks";
public const string AtlantumThreshing = "Atlantum Threshing";
public const string AtlantumInfusion = "Atlantum Infusion";
public const string InfusedAtlantumThreshing = "Infused Atlantum Threshing";
public const string Smelter = "Smelter";
public const string CrankGenerator = "Crank Generator";
public const string CrankSpan = "CrankSpan";
public const string BasicForging = "Basic Forging";
public const string BasicSlabThreshing = "Basic Slab Threshing";
public const string BasicIncineration = "Basic Incineration";
public const string BasicLogistics = "Basic Logistics";
public const string BasicManufacturing = "Basic Manufacturing";
public const string BasicMechanisms = "Basic Mechanisms";
public const string BasicOptimization = "Basic Optimization";
public const string BasicPowderBricks = "Basic Powder Bricks";
public const string BasicBrickThreshing = "Basic Brick Threshing";
public const string BasicSlabs = "Basic Slabs";
public const string ScrapProcessingBasic = "Scrap Processing (Basic)";
public const string Beacon = "Beacon";
public const string VBHeightIII = "VB-Height III";
public const string VBHeightII = "VB-Height II";
public const string Biobrick = "Biobrick";
public const string BioDenseII = "BioDense II";
public const string BioDenseIII = "BioDense III";
public const string BioDenseIV = "BioDense IV";
public const string BioDenseV = "BioDense V";
public const string BDRMultiBlastIV = "BDR-MultiBlast IV";
public const string BDRMultiBlastV = "BDR-MultiBlast V";
public const string BDRMultiBlastII = "BDR-MultiBlast II";
public const string BDRMultiBlastIII = "BDR-MultiBlast III";
public const string BlastSmelter = "Blast Smelter";
public const string BSMMultiBlastIV = "BSM-MultiBlast IV";
public const string BSMMultiBlastV = "BSM-MultiBlast V";
public const string BSMMultiBlastII = "BSM-MultiBlast II";
public const string BSMMultiBlastIII = "BSM-MultiBlast III";
public const string CarbonPowder = "Carbon Powder";
public const string CarbonFrame = "Carbon Frame";
public const string StairsAndWalkwaysI = "Stairs & Walkways I";
public const string StairsAndWalkwaysII = "Stairs & Walkways II";
public const string StairsAndWalkwaysIII = "Stairs & Walkways III";
public const string Cement = "Cement";
public const string Ceramics = "Ceramics";
public const string CeramicsThreshing = "Ceramics Threshing";
public const string ContainerMKII = "Container MKII";
public const string LightStickPrimaryColors = "Light Stick (Primary Colors)";
public const string Concrete = "Concrete";
public const string FloraCompression = "Flora Compression";
public const string PlantmatterBrickThreshing = "Plantmatter Brick Threshing";
public const string CoolantCompression = "Coolant Compression";
public const string ShiverthornGelThreshing = "Shiverthorn Gel Threshing";
public const string CoolDenseII = "CoolDense II";
public const string CoolDenseIII = "CoolDense III";
public const string CoolDenseIV = "CoolDense IV";
public const string CoolDenseV = "CoolDense V";
public const string CoolingSystems = "Cooling Systems";
public const string CoreComposer = "Core Composer";
public const string CoreBoosting = "Core Boosting";
public const string CrusherMKI = "Crusher MKI";
public const string AtlantumMaxCrush = "Atlantum MaxCrush";
public const string MassProductionAtlantumInfusedLimestone = "Mass Production (Atlantum-Infused Limestone)";
public const string CopperMaxCrush = "Copper MaxCrush";
public const string MassProductionCopperInfusedLimestone = "Mass Production (Copper-Infused Limestone)";
public const string CementRapid = "Cement (Rapid)";
public const string GravelMixing = "Gravel Mixing";
public const string IronMaxCrush = "Iron MaxCrush";
public const string MassProductionIronInfusedLimestone = "Mass Production (Iron-Infused Limestone)";
public const string MassProductionConcrete = "Mass Production (Concrete)";
public const string SesamiteSandMixingRapid = "Sesamite Sand Mixing (Rapid)";
public const string CalyciteDeconstruction = "Calycite Deconstruction";
public const string RelayCircuitDeconstruction = "Relay Circuit Deconstruction";
public const string MechanismDisassemblyCopper = "Mechanism Disassembly (Copper)";
public const string ElectricalSetDeconstruction = "Electrical Set Deconstruction";
public const string GearboxDeconstruction = "Gearbox Deconstruction";
public const string MechanismDisassemblyIron = "Mechanism Disassembly (Iron)";
public const string ProcessorArrayDeconstruction = "Processor Array Deconstruction";
public const string SpindleDisassembly = "Spindle Disassembly";
public const string MassProcessingKindlevine = "Mass Processing (Kindlevine)";
public const string BiomassCompression = "Biomass Compression";
public const string PlantmatterCompression = "Plantmatter Compression";
public const string SesamiteCrystalSynthesis = "Sesamite Crystal Synthesis";
public const string SesamitePowderExtraction = "Sesamite Powder Extraction";
public const string CrushPowerPlus = "CrushPower+";
public const string GoldOreExtraction = "Gold Ore Extraction";
public const string AdvancedAtlantumProcessingInfused = "Advanced Atlantum Processing (Infused)";
public const string AdvancedCopperProcessingInfused = "Advanced Copper Processing (Infused)";
public const string AdvancedIronProcessingInfused = "Advanced Iron Processing (Infused)";
public const string CrusherScrapDipping = "Crusher Scrap Dipping";
public const string CrusherScrapWashing = "Crusher Scrap Washing";
public const string SesamiteSandFiltration = "Sesamite Sand Filtration";
public const string SesamitePowderProcessing = "Sesamite Powder Processing";
public const string SesamiteCrystalProcessing = "Sesamite Crystal Processing";
public const string MassProcessingShiverthorn = "Mass Processing (Shiverthorn)";
public const string SlabProcessingRapid = "Slab Processing (Rapid)";
public const string Decomposition = "Decomposition";
public const string DECOSeriesI = "DECO Series I";
public const string DECOSeriesII = "DECO Series II";
public const string DECOSeriesIII = "DECO Series III";
public const string DECODynamicLights = "DECO Dynamic Lights";
public const string DECOStaticLights = "DECO Static Lights";
public const string DECOPlantsAndCeilings = "DECO Plants & Ceilings";
public const string DECOPlantsAndWalls = "DECO Plants & Walls";
public const string DecorativeMaterials = "Decorative Materials";
public const string MiningCharge = "Mining Charge";
public const string MassProductionMiningCharge = "Mass Production (Mining Charge)";
public const string ExcavatorBitMKI = "Excavator Bit MKI";
public const string ExcavatorBitMKII = "Excavator Bit MKII";
public const string ExcavatorBitMKIII = "Excavator Bit MKIII";
public const string ExcavatorBitMKIV = "Excavator Bit MKIV";
public const string ExcavatorBitMKV = "Excavator Bit MKV";
public const string ExcavatorBitMKVI = "Excavator Bit MKVI";
public const string ExcavatorBitMKVII = "Excavator Bit MKVII";
public const string ElectricComponents = "Electric Components";
public const string MiningDrillMKII = "Mining Drill MKII";
public const string MDRPowerTrimII = "MDR PowerTrim II";
public const string MDRPowerTrimIII = "MDR PowerTrim III";
public const string MDRPowerTrimIV = "MDR PowerTrim IV";
public const string MDRPowerTrimV = "MDR PowerTrim V";
public const string ElectricMotor = "Electric Motor";
public const string SmelterMKII = "Smelter MKII";
public const string ThresherMKII = "Thresher MKII";
public const string THRPowerTrimII = "THR PowerTrim II";
public const string THRPowerTrimIII = "THR PowerTrim III";
public const string THRPowerTrimIV = "THR PowerTrim IV";
public const string THRPowerTrimV = "THR PowerTrim V";
public const string VerticalBelts = "Vertical Belts";
public const string SpectralCubeColorless = "Spectral Cube (Colorless)";
public const string BlastDrill = "Blast Drill";
public const string ConveyorBeltMKII = "Conveyor Belt MKII";
public const string ConveyorBeltMKIII = "Conveyor Belt MKIII";
public const string FastInserter = "Fast Inserter";
public const string Plantmatter = "Plantmatter";
public const string FiberExtraction = "Fiber Extraction";
public const string FilterInserter = "Filter Inserter";
public const string StackFilterInserter = "Stack Filter Inserter";
public const string CoreBoostAssembly = "Core Boost (Assembly)";
public const string CoreBoostMining = "Core Boost (Mining)";
public const string CoreBoostSmelting = "Core Boost (Smelting)";
public const string CoreBoostThreshing = "Core Boost (Threshing)";
public const string GatesI = "Gates I";
public const string GatesII = "Gates II";
public const string GatesIII = "Gates III";
public const string GatesIV = "Gates IV";
public const string Glass = "Glass";
public const string ResearchCoreYellow = "Research Core (Yellow)";
public const string AdvancedCircuitGold = "Advanced Circuit (Gold)";
public const string RelayCircuitGold = "Relay Circuit (Gold)";
public const string GoldIngot = "Gold Ingot";
public const string GravelThreshing = "Gravel Threshing";
public const string OptimizationBlueResearchCore = "Optimization (Blue Research Core)";
public const string ResearchCoreGreen = "Research Core (Green)";
public const string BiobrickDiesel = "Biobrick Diesel";
public const string BiobrickDieselSesamiteBase = "Biobrick Diesel (Sesamite Base)";
public const string BiobrickDieselInfusion = "Biobrick Diesel Infusion";
public const string BiobrickDieselRecycling = "Biobrick Diesel Recycling";
public const string BiobrickDieselRefinement = "Biobrick Diesel Refinement";
public const string HoverPack = "Hover Pack";
public const string HPGlideV = "HP-Glide V";
public const string HPGlideVI = "HP-Glide VI";
public const string HPGlideVII = "HP-Glide VII";
public const string HPGlideVIII = "HP-Glide VIII";
public const string HPGlideI = "HP-Glide I";
public const string HPGlideII = "HP-Glide II";
public const string HPGlideIII = "HP-Glide III";
public const string HPGlideIV = "HP-Glide IV";
public const string HighVoltageSystems = "High Voltage Systems";
public const string HVCReachII = "HVC Reach II";
public const string HVCReachIII = "HVC Reach III";
public const string HVCReachIV = "HVC Reach IV";
public const string HVCReachV = "HVC Reach V";
public const string PackSizeII = "PackSize II";
public const string PackSizeIII = "PackSize III";
public const string PackSizeIV = "PackSize IV";
public const string PackSizeV = "PackSize V";
public const string BlastIncineration = "Blast Incineration";
public const string HPVertJets = "HP-VertJets";
public const string KindlevineThreshing = "Kindlevine Threshing";
public const string StemThreshing = "Stem Threshing";
public const string LaserPistol = "Laser Pistol";
public const string LightStick = "Light Stick";
public const string LimestoneExtraction = "Limestone Extraction";
public const string LongStackFilterInserter = "Long Stack Filter Inserter";
public const string LongInserter = "Long Inserter";
public const string MassProductionBasicFrames = "Mass Production (Basic Frames)";
public const string MassProductionConveyorBelts = "Mass Production (Conveyor Belts)";
public const string MassProductionBiobrick = "Mass Production (Biobrick)";
public const string MassProductionClay = "Mass Production (Clay)";
public const string MassCollect = "MassCollect";
public const string MassCollectIII = "MassCollect III";
public const string MassCollectIV = "MassCollect IV";
public const string MassCollectII = "MassCollect II";
public const string MassProductionCoolant = "Mass Production (Coolant)";
public const string MassProductionCoolingSystem = "Mass Production (Cooling System)";
public const string MassDeconstruct = "MassDeconstruct";
public const string MassDeconstructIII = "MassDeconstruct III";
public const string MassDeconstructIV = "MassDeconstruct IV";
public const string MassDeconstructII = "MassDeconstruct II";
public const string MassProductionInserters = "Mass Production (Inserters)";
public const string MassProductionMonorailPole = "Mass Production (Monorail Pole)";
public const string MassProductionMonorailTrack = "Mass Production (Monorail Track)";
public const string MassProductionSteelFrames = "Mass Production (Steel Frames)";
public const string MHaulerCapII = "M-HaulerCap II";
public const string MHaulerCapIII = "M-HaulerCap III";
public const string MTrackReachII = "M-TrackReach II";
public const string MTrackReachIII = "M-TrackReach III";
public const string MTrackReachIV = "M-TrackReach IV";
public const string MTrackReachV = "M-TrackReach V";
public const string MonorailSystem = "Monorail System";
public const string MassProductionMonorailDepot = "Mass Production (Monorail Depot)";
public const string MetalPowderThreshing = "Metal Powder Threshing";
public const string MetalPowderSmelting = "Metal Powder Smelting";
public const string MDRSpeedII = "MDR Speed II";
public const string MDRSpeedIII = "MDR Speed III";
public const string MDRSpeedIV = "MDR Speed IV";
public const string MDRSpeedV = "MDR Speed V";
public const string TheMOLE = "The M.O.L.E.";
public const string MOLEMaximization = "M.O.L.E. Maximization";
public const string Nexus = "Nexus";
public const string OreInfusion = "Ore Infusion";
public const string InfusedOreThreshing = "Infused Ore Threshing";
public const string OverheadLight = "Overhead Light";
public const string OverheadLightII = "Overhead Light II";
public const string Planter = "Planter";
public const string PlanterMKII = "Planter MKII";
public const string PlantmatterFrames = "Plantmatter Frames";
public const string PlantmatterFramesOptimized = "Plantmatter Frames (Optimized)";
public const string PlantmatterFiberSeparation = "Plantmatter Fiber (Separation)";
public const string PlatformsI = "Platforms I";
public const string BasicSupports = "Basic Supports";
public const string PlatformsII = "Platforms II";
public const string Beams = "Beams";
public const string CraftSpeedII = "CraftSpeed II";
public const string CraftSpeedIII = "CraftSpeed III";
public const string CraftSpeedIV = "CraftSpeed IV";
public const string HPJumpII = "HP-Jump II";
public const string HPJumpIII = "HP-Jump III";
public const string CrankGeneratorMKII = "Crank Generator MKII";
public const string CrankConnect = "CrankConnect";
public const string BasicStairs = "Basic Stairs";
public const string PowerAmpII = "PowerAmp II";
public const string PowerAmpIII = "PowerAmp III";
public const string PowerAmpIV = "PowerAmp IV";
public const string PrecisionDisassembly = "Precision Disassembly";
public const string ProcessorUnit = "Processor Unit";
public const string ProductionOptimization = "Production Optimization";
public const string OptimizationPurpleResearchCore = "Optimization (Purple Research Core)";
public const string QuicklimeBlasting = "Quicklime Blasting";
public const string Quicklime = "Quicklime";
public const string MonorailSpikeTrim = "Monorail Spike Trim";
public const string MonorailSpikeTrimII = "Monorail Spike Trim II";
public const string MonorailSpikeTrimIII = "Monorail Spike Trim III";
public const string MonorailSpikeTrimIV = "Monorail Spike Trim IV";
public const string BasicScience = "Basic Science";
public const string BasicRefinement = "Basic Refinement";
public const string ReinforcedFrames = "Reinforced Frames";
public const string ReinforcedFramesThreshing = "Reinforced Frames Threshing";
public const string RelayCircuit = "Relay Circuit";
public const string Replacer = "Replacer";
public const string ResearchCoreBlue = "Research Core (Blue)";
public const string CoolingSystemsGold = "Cooling Systems (Gold)";
public const string ElectricalSetGold = "Electrical Set (Gold)";
public const string RelayCircuitSlow = "Relay Circuit (Slow)";
public const string SandThreshing = "Sand Threshing";
public const string SandFiltration = "Sand Filtration";
public const string SandPump = "Sand Pump";
public const string BioExtraction = "Bio Extraction";
public const string ScrapCompression = "Scrap Compression";
public const string ScrapSeparation = "Scrap Separation";
public const string SeedMultiplication = "Seed Multiplication";
public const string UnstablePodProcessing = "Unstable Pod Processing";
public const string SeedMutation = "Seed Mutation";
public const string SeedPodRestoration = "Seed Pod Restoration";
public const string Omniseeker = "Omniseeker";
public const string SensorBlock = "Sensor Block";
public const string SesamiteCoolant = "Sesamite Coolant";
public const string SesamiteEvaporation = "Sesamite Evaporation";
public const string SesamiteGel = "Sesamite Gel";
public const string SesamiteFarming = "Sesamite Farming";
public const string SesamiteIngot = "Sesamite Ingot";
public const string SesamiteMutation = "Sesamite Mutation";
public const string SesamiteSandMixing = "Sesamite Sand Mixing";
public const string SeedReversalSesamite = "Seed Reversal (Sesamite)";
public const string SesamiteStemCompression = "Sesamite Stem Compression";
public const string ShiverthornNeutralization = "Shiverthorn Neutralization";
public const string ShiverthornProcessing = "Shiverthorn Processing";
public const string ShiverthornCoolant = "Shiverthorn Coolant";
public const string Railrunner = "Railrunner";
public const string RailRushII = "RailRush II";
public const string RailRushIII = "RailRush III";
public const string RailRushIV = "RailRush IV";
public const string RailRushV = "RailRush V";
public const string SmeltingSpeedII = "Smelting Speed II";
public const string SmeltingSpeedIII = "Smelting Speed III";
public const string SmeltingSpeedIV = "Smelting Speed IV";
public const string SmeltingSpeedV = "Smelting Speed V";
public const string StackInserter = "Stack Inserter";
public const string StackCapII = "StackCap II";
public const string StackCapIII = "StackCap III";
public const string StackCapIV = "StackCap IV";
public const string SteelProduction = "Steel Production";
public const string StemWashing = "Stem Washing";
public const string SupportsI = "Supports I";
public const string SupportsII = "Supports II";
public const string SupportsIII = "Supports III";
public const string SupportsIV = "Supports IV";
public const string CoreReassignment = "Core Reassignment";
public const string TheMOLEFlatten = "The M.O.L.E. (Flatten)";
public const string MOLEF77Flatten = "M.O.L.E. F-77 (Flatten)";
public const string MOLEF99Flatten = "M.O.L.E. F-99 (Flatten)";
public const string MOLEF1212Flatten = "M.O.L.E. F-1212 (Flatten)";
public const string MOLESpeedII = "M.O.L.E. Speed II";
public const string MOLESpeedIII = "M.O.L.E. Speed III";
public const string MOLESpeedIV = "M.O.L.E. Speed IV";
public const string MOLET59Tunneling = "M.O.L.E. T-59 (Tunneling)";
public const string MOLET33Tunneling = "M.O.L.E. T-33 (Tunneling)";
public const string MOLET99Tunneling = "M.O.L.E. T-99 (Tunneling)";
public const string MiningDrill = "Mining Drill";
public const string Thresher = "Thresher";
public const string ThreshingSpeedII = "Threshing Speed II";
public const string ThreshingSpeedIII = "Threshing Speed III";
public const string ThreshingSpeedIV = "Threshing Speed IV";
public const string ThreshingSpeedV = "Threshing Speed V";
public const string ToolbeltII = "Toolbelt II";
public const string ToolbeltIII = "Toolbelt III";
public const string ToolbeltIV = "Toolbelt IV";
public const string SuitSpeedII = "SuitSpeed II";
public const string SuitSpeedIII = "SuitSpeed III";
public const string SuitSpeedIV = "SuitSpeed IV";
public const string WallLights = "Wall Lights";
public const string WallsI = "Walls I";
public const string WallsII = "Walls II";
public const string WallsIII = "Walls III";
public const string WaterWheel = "Water Wheel";
}
}
public static class Resources
{
private static Dictionary<string, int> resourceNameToIndexMap = new Dictionary<string, int>();
public static ResourceInfo GetResourceInfoByName(string name, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Looking for resource with name '" + name + "'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
if (resourceNameToIndexMap.ContainsKey(name))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found resource in cache");
}
return GameDefines.instance.resources[resourceNameToIndexMap[name]];
}
foreach (ResourceInfo resource in GameDefines.instance.resources)
{
if (resource.displayName == name)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found resource with name '" + name + "'");
}
if (!resourceNameToIndexMap.ContainsKey(name))
{
resourceNameToIndexMap.Add(name, GameDefines.instance.resources.IndexOf(resource));
}
return resource;
}
}
}
else
{
EMULogging.LogEMUWarning("GetResourceInfoByName() was called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
EMULogging.LogEMUWarning("Could not find resource with name '" + name + "'");
EMULogging.LogEMUWarning("Try using a name from EMU.Names.Resources");
return null;
}
public static ResourceInfo GetResourceInfoByNameUnsafe(string name, bool shouldLog = false)
{
if (resourceNameToIndexMap.ContainsKey(name))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found resource in cache");
}
return GameDefines.instance.resources[resourceNameToIndexMap[name]];
}
foreach (ResourceInfo resource in GameDefines.instance.resources)
{
if (resource.displayName == name)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found resource with name '" + name + "'");
}
if (!resourceNameToIndexMap.ContainsKey(name))
{
resourceNameToIndexMap.Add(name, GameDefines.instance.resources.IndexOf(resource));
}
return resource;
}
}
EMULogging.LogEMUWarning("Could not find resource with name '" + name + "'");
EMULogging.LogEMUWarning("Try using a name from EMU.Names.Resources");
return null;
}
public static int GetResourceIDByName(string name, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Looking for ID of resource with name '" + name + "'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
return ((UniqueIdScriptableObject)(GetResourceInfoByName(name)?)).uniqueId ?? (-1);
}
EMULogging.LogEMUError("GetResourceIDByName() was called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
return -1;
}
public static MachineTypeEnum GetMachineTypeFromResID(int resID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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)
if (!LoadingStates.hasSaveStateLoaded)
{
EMULogging.LogEMUError("GetMachineTypeFromResID() called before SaveState.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.SaveStateLoaded or checking with EMU.LoadingStates.hasSaveStateLoaded");
return (MachineTypeEnum)0;
}
try
{
return ((BuilderInfo)SaveState.GetResInfoFromId(resID)).GetInstanceType();
}
catch (Exception ex)
{
EMULogging.LogEMUError($"Error occurred during GetMachineTypeFromResID(resID = {resID})");
EMULogging.LogEMUError(ex.Message ?? "");
EMULogging.LogEMUError(ex.StackTrace ?? "");
return (MachineTypeEnum)0;
}
}
public static void UpdateResourceUnlock(string resourceName, string unlockName, bool shouldLog = false)
{
if (!LoadingStates.hasTechTreeStateLoaded)
{
EMULogging.LogEMUError("UpdateResourceUnlock() called before TechTreeState.instance has loaded.");
EMULogging.LogEMUWarning("Try using the event EMU.Events.TechTreeStateLoaded or checking with EMU.LoadingStates.hasTechTreeStateLoaded");
return;
}
ResourceInfo resourceInfoByName = GetResourceInfoByName(resourceName, shouldLog);
if (!EDT.NullCheck((object)resourceInfoByName, resourceName, false))
{
return;
}
Unlock unlockByName = Unlocks.GetUnlockByName(unlockName, shouldLog);
if (EDT.NullCheck((object)unlockByName, unlockName, false))
{
resourceInfoByName.unlock = unlockByName;
if (shouldLog)
{
EMULogging.LogEMUInfo("Successfully set .unlock for " + resourceInfoByName.displayName + " to Unlock '" + unlockName + "'");
}
}
}
public static void UpdateResourceHeaderType(string resourceName, SchematicsSubHeader header, bool shouldLog = false)
{
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUWarning("UPdateResourceHeaderType() was called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
return;
}
ResourceInfo resourceInfoByName = GetResourceInfoByName(resourceName, shouldLog);
if (EDT.NullCheck((object)resourceInfoByName, resourceName, false))
{
resourceInfoByName.headerType = header;
if (shouldLog)
{
EMULogging.LogEMUInfo("Successfully set .headerType for " + resourceInfoByName.displayName);
}
}
}
}
public static class Recipes
{
public static SchematicsRecipeData FindThresherRecipeFromOutputs(string output1Name, string output2Name, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Looking for thresher recipe with outputs: '" + output1Name + "', '" + output2Name + "'");
}
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUWarning("FindThresherRecipeFromOutputs() called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
return null;
}
foreach (SchematicsRecipeData schematicsRecipeEntry in GameDefines.instance.schematicsRecipeEntries)
{
if (schematicsRecipeEntry.outputTypes.Count() == 2 && ((schematicsRecipeEntry.outputTypes[0].displayName == output1Name && schematicsRecipeEntry.outputTypes[1].displayName == output2Name) || (schematicsRecipeEntry.outputTypes[0].displayName == output2Name && schematicsRecipeEntry.outputTypes[1].displayName == output1Name)))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found thresher recipe");
}
return schematicsRecipeEntry;
}
}
EMULogging.LogEMUWarning("Could not find thresher recipe");
EMULogging.LogEMUWarning("Try using the resource names in EMU.Names.Resources");
return null;
}
public static SchematicsRecipeData TryFindThresherRecipe(int ingredientResID, bool shouldLog = false)
{
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUError("TryFindThresherRecipe() called before GameDefines.instance loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking LoadingStates.hasGameDefinesLoaded.");
return null;
}
if (shouldLog)
{
EMULogging.LogEMUInfo($"Attempting to find thresher recipe with ingredient #{ingredientResID}");
}
foreach (SchematicsRecipeData schematicsRecipeEntry in GameDefines.instance.schematicsRecipeEntries)
{
if (((UniqueIdScriptableObject)schematicsRecipeEntry.ingTypes[0]).uniqueId == ingredientResID)
{
if (shouldLog)
{
EMULogging.LogEMUInfo($"Found Thresher recipe for resource #{ingredientResID}");
}
return schematicsRecipeEntry;
}
}
EMULogging.LogEMUError($"Could not find a recipe for resource #{ingredientResID}, please check this value.");
return null;
}
public static SchematicsRecipeData TryFindRecipe(List<int> ingredientIDs, List<int> resultIDs, bool shouldLog = false)
{
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUError("TryFindRecipe() called before GameDefines.instance loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking LoadingStates.hasGameDefinesLoaded.");
return null;
}
if (shouldLog)
{
EMULogging.LogEMUInfo("Attempting to find recipe");
}
foreach (SchematicsRecipeData schematicsRecipeEntry in GameDefines.instance.schematicsRecipeEntries)
{
List<int> second = schematicsRecipeEntry.ingTypes.Select((ResourceInfo item) => ((UniqueIdScriptableObject)item).uniqueId).ToList();
List<int> second2 = schematicsRecipeEntry.outputTypes.Select((ResourceInfo item) => ((UniqueIdScriptableObject)item).uniqueId).ToList();
if (AreListIntsEqual(ingredientIDs, second, sort: true) && AreListIntsEqual(resultIDs, second2, sort: true))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found recipe");
}
return schematicsRecipeEntry;
}
}
EMULogging.LogEMUError("Could not find recipe, please check the resource IDs passed in the arguments.");
return null;
}
public static SchematicsHeader GetSchematicsHeaderByTitle(string title, bool shouldLog = false)
{
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUError("GetSchematicsHeaderByTitle() called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking EMU.LoadingStates.hasGameDefinesLoaded.");
return null;
}
foreach (SchematicsHeader schematicsHeaderEntry in GameDefines.instance.schematicsHeaderEntries)
{
if (schematicsHeaderEntry.title == title)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found SchematicsHeader with title '" + title + "'");
}
return schematicsHeaderEntry;
}
}
EMULogging.LogEMUError("Could not find SchematicsHeader with title '" + title + "'");
return null;
}
public static SchematicsHeader GetSchematicsHeaderByTitleUnsafe(string title, bool shouldLog = false)
{
foreach (SchematicsHeader schematicsHeaderEntry in GameDefines.instance.schematicsHeaderEntries)
{
if (schematicsHeaderEntry.title == title)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found SchematicsHeader with title '" + title + "'");
}
return schematicsHeaderEntry;
}
}
EMULogging.LogEMUError("Could not find SchematicsHeader with title '" + title + "'");
return null;
}
public static SchematicsSubHeader GetSchematicsSubHeaderByTitle(string parentTitle, string title, bool shouldLog = false)
{
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUError("GetSchematicsSubHeaderByTitle() called before GameDefines.instance has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking EMU.LoadingStates.hasGameDefinesLoaded.");
return null;
}
foreach (SchematicsSubHeader schematicsSubHeaderEntry in GameDefines.instance.schematicsSubHeaderEntries)
{
if (schematicsSubHeaderEntry.title == title && schematicsSubHeaderEntry.filterTag.title == parentTitle)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found SchematicsSubHeader with title '" + title + "'");
}
return schematicsSubHeaderEntry;
}
}
EMULogging.LogEMUError("Could not find SchematicsSubHeader with title '" + title + "'");
return null;
}
public static SchematicsSubHeader GetSchematicsSubHeaderByTitleUnsafe(string parentTitle, string title, bool shouldLog = false)
{
foreach (SchematicsSubHeader schematicsSubHeaderEntry in GameDefines.instance.schematicsSubHeaderEntries)
{
if (schematicsSubHeaderEntry.title == title && schematicsSubHeaderEntry.filterTag.title == parentTitle)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found SchematicsSubHeader with title '" + title + "'");
}
return schematicsSubHeaderEntry;
}
}
EMULogging.LogEMUError("Could not find SchematicsSubHeader with title '" + title + "'");
return null;
}
private static bool AreListIntsEqual(List<int> first, List<int> second, bool sort)
{
if (first == null && second == null)
{
return true;
}
if (first == null || second == null)
{
return false;
}
if (first.Count != second.Count)
{
return false;
}
if (sort)
{
first.Sort();
second.Sort();
}
for (int i = 0; i < first.Count; i++)
{
if (first[i] != second[i])
{
return false;
}
}
return true;
}
}
public static class Unlocks
{
private static Dictionary<int, Unlock> unlockCache = new Dictionary<int, Unlock>();
private static Dictionary<string, int> unlockNameToIDMap = new Dictionary<string, int>();
public static Unlock GetUnlockByID(int id, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo($"Looking for Unlock with id '{id}'");
}
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUWarning("GetUnlockByID() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
return null;
}
if (unlockCache.ContainsKey(id))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found unlock in cache");
}
return unlockCache[id];
}
for (int i = 0; i < GameDefines.instance.unlocks.Count; i++)
{
Unlock val = GameDefines.instance.unlocks[i];
if (((UniqueIdScriptableObject)val).uniqueId == id)
{
if (shouldLog)
{
EMULogging.LogEMUInfo($"Found unlock with id '{id}'");
}
unlockCache.Add(id, val);
return val;
}
}
EMULogging.LogEMUWarning($"Couldn't find Unlock with id '{id}'");
return null;
}
public static Unlock GetUnlockByName(string name, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Looking for Unlock with name '" + name + "'");
}
if (!LoadingStates.hasGameDefinesLoaded)
{
EMULogging.LogEMUWarning("GetUnlockByName() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
return null;
}
if (unlockNameToIDMap.ContainsKey(name) && GameDefines.instance.unlocks.Count > unlockNameToIDMap[name])
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found unlock in cache");
}
return GameDefines.instance.unlocks[unlockNameToIDMap[name]];
}
foreach (Unlock unlock in GameDefines.instance.unlocks)
{
if (unlock.displayNameHash == LocsUtility.GetHashString(name))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found Unlock");
}
if (!unlockNameToIDMap.ContainsKey(unlock.displayNameHash))
{
unlockNameToIDMap.Add(unlock.displayNameHash, ((UniqueIdScriptableObject)unlock).uniqueId);
}
return unlock;
}
}
EMULogging.LogEMUWarning("Couldn't find Unlock with name '" + name + "'");
EMULogging.LogEMUWarning("Try using a name from EMU.Names.Unlocks");
return null;
}
public static Unlock GetUnlockByNameUnsafe(string name, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Looking for Unlock with name '" + name + "'");
}
if (unlockNameToIDMap.ContainsKey(name) && GameDefines.instance.unlocks.Count > unlockNameToIDMap[name])
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found unlock in cache");
}
return GameDefines.instance.unlocks[unlockNameToIDMap[name]];
}
foreach (Unlock unlock in GameDefines.instance.unlocks)
{
if (unlock.displayNameHash == LocsUtility.GetHashString(name))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found Unlock");
}
if (!unlockNameToIDMap.ContainsKey(unlock.displayNameHash))
{
unlockNameToIDMap.Add(unlock.displayNameHash, ((UniqueIdScriptableObject)unlock).uniqueId);
}
return unlock;
}
}
EMULogging.LogEMUWarning("Couldn't find Unlock with name '" + name + "'");
EMULogging.LogEMUWarning("Try using a name from EMU.Names.Unlocks");
return null;
}
public static void UpdateUnlockSprite(int unlockID, Sprite sprite, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo($"Trying to update sprite of Unlock with ID '{unlockID}'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
try
{
Unlock val = GameDefines.instance.unlocks[unlockID];
val.sprite = sprite;
if (shouldLog)
{
EMULogging.LogEMUInfo($"Updated sprite of Unlock with ID '{unlockID}'");
}
return;
}
catch (Exception ex)
{
EMULogging.LogEMUError($"Error occurred while trying to update sprite of Unlock with ID '{unlockID}'");
EMULogging.LogEMUError(ex.Message);
EMULogging.LogEMUError(ex.StackTrace);
return;
}
}
EMULogging.LogEMUError("UpdateUnlockSprite() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
public static void UpdateUnlockSprite(string displayName, Sprite sprite, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Trying to update sprite of Unlock '" + displayName + "'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
Unlock unlockByName = GetUnlockByName(displayName);
unlockByName.sprite = sprite;
if (shouldLog)
{
EMULogging.LogEMUInfo("Updated sprite of Unlock '" + displayName + "'");
}
}
else
{
EMULogging.LogEMUError("UpdateUnlockSprite() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
}
public static void UpdateUnlockTreePosition(int unlockID, float treePosition, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo($"Trying to update treePosition of Unlock with ID '{unlockID}'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
try
{
Unlock unlockByID = GetUnlockByID(unlockID);
unlockByID.treePosition = treePosition;
if (shouldLog)
{
EMULogging.LogEMUInfo($"Updated treePosition of Unlock with ID '{unlockID}'");
}
return;
}
catch (Exception ex)
{
EMULogging.LogEMUError($"Error occurred while trying to update treePosition of Unlock with ID '{unlockID}'");
EMULogging.LogEMUError(ex.Message);
EMULogging.LogEMUError(ex.StackTrace);
return;
}
}
EMULogging.LogEMUError("UpdateUnlocktreePosition() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
public static void UpdateUnlockTreePosition(string displayName, float treePosition, bool shouldLog = false)
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Trying to update treePosition of Unlock '" + displayName + "'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
Unlock unlockByName = GetUnlockByName(displayName);
if ((Object)(object)unlockByName != (Object)null)
{
unlockByName.treePosition = treePosition;
if (shouldLog)
{
EMULogging.LogEMUInfo($"Updated treePosition of Unlock '{displayName}' to {treePosition}");
}
}
else
{
EMULogging.LogEMUWarning("Could not update treePosition of unknown Unlock '" + displayName + "'");
}
}
else
{
EMULogging.LogEMUWarning("UpdateUnlockTreePosition() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
}
public static void UpdateUnlockTier(int unlockID, ResearchTier tier, bool shouldLog = false)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (shouldLog)
{
EMULogging.LogEMUInfo($"Trying to update tier of Unlock with ID '{unlockID}'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
try
{
Unlock unlockByID = GetUnlockByID(unlockID);
unlockByID.requiredTier = tier;
if (shouldLog)
{
EMULogging.LogEMUInfo($"Updated requiredTier of Unlock with ID '{unlockID}'");
}
return;
}
catch (Exception ex)
{
EMULogging.LogEMUError($"Error occurred while trying to update requiredTier of Unlock with ID '{unlockID}'");
EMULogging.LogEMUError(ex.Message);
EMULogging.LogEMUError(ex.StackTrace);
return;
}
}
EMULogging.LogEMUWarning("UpdateUnlockTier() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
public static void UpdateUnlockTier(string displayName, ResearchTier tier, bool shouldLog = false)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (shouldLog)
{
EMULogging.LogEMUInfo("Trying to update tier of Unlock '" + displayName + "'");
}
if (LoadingStates.hasGameDefinesLoaded)
{
try
{
Unlock unlockByName = GetUnlockByName(displayName);
unlockByName.requiredTier = tier;
if (shouldLog)
{
EMULogging.LogEMUInfo("Updated requiredTier of Unlock '" + displayName + "'");
}
return;
}
catch (Exception ex)
{
EMULogging.LogEMUError("Error occurred while trying to update requiredTier of Unlock '" + displayName + "'");
EMULogging.LogEMUError(ex.Message);
EMULogging.LogEMUError(ex.StackTrace);
return;
}
}
EMULogging.LogEMUError("UpdateUnlockTier() called before GameDefines has loaded");
EMULogging.LogEMUWarning("Try using the event EMU.Events.GameDefinesLoaded or checking with EMU.LoadingStates.hasGameDefinesLoaded");
}
}
public static object GetPrivateField<T>(string name, T instance)
{
FieldInfo field = typeof(T).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
EMULogging.LogEMUError($"Could not find the field '{name}' under type {typeof(T)}. Aborting attempt to get value");
return null;
}
return field.GetValue(instance);
}
public static void SetPrivateField<T>(string name, T instance, object value)
{
FieldInfo field = typeof(T).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
EMULogging.LogEMUError($"Could not find the field '{name}' under type {typeof(T)}. Aborting attempt to set value");
}
else
{
field.SetValue(instance, value);
}
}
public static void SetPrivateStaticField<T>(string name, T instance, object value)
{
FieldInfo field = typeof(T).GetField(name, BindingFlags.Static | BindingFlags.NonPublic);
if (field == null)
{
EMULogging.LogEMUError($"Could not find the static field '{name}' under type {typeof(T)}. Aborting attempt to set value");
}
else
{
field.SetValue(instance, value);
}
}
public static bool IsModInstalled(string dllName, bool shouldLog = false)
{
dllName = dllName.Replace(".dll", "");
string path = AppDomain.CurrentDomain.BaseDirectory + "BepInEx/plugins";
string[] files = Directory.GetFiles(path);
string[] array = files;
foreach (string text in array)
{
if (text.Contains(dllName))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found " + dllName + ".dll, mod is installed");
}
return true;
}
}
string[] directories = Directory.GetDirectories(path);
string[] array2 = directories;
foreach (string path2 in array2)
{
string[] files2 = Directory.GetFiles(path2);
string[] array3 = files2;
foreach (string text2 in array3)
{
if (text2.Contains(dllName))
{
if (shouldLog)
{
EMULogging.LogEMUInfo("Found " + dllName + ".dll, mod is installed");
}
return true;
}
}
}
EMULogging.LogEMUWarning("Could not find the file " + dllName + ".dll, mod is not installed");
return false;
}
public static void CloneObject<T>(T original, ref T target)
{
FieldInfo[] fields = target.GetType().GetFields();
foreach (FieldInfo fieldInfo in fields)
{
fieldInfo.SetValue(target, fieldInfo.GetValue(original));
}
}
public static void FreeCursor(bool free)
{
if ((!free || !InternalTools.isCursorFree) && (free || InternalTools.isCursorFree))
{
InputHandler.instance.uiInputBlocked = free;
InputHandler.instance.playerAimStickBlocked = free;
Cursor.lockState = (CursorLockMode)((!free) ? 1 : 0);
Cursor.visible = free;
UIManagerPatch.freeCursor = free;
InternalTools.isCursorFree = free;
}
}
public static void Notify(string message)
{
UIManager.instance.systemLog.FlashMessage((SystemMessageInfo)(object)new CustomSystemMessage(message));
}
}
internal class CustomSystemMessage : SystemMessageInfo
{
public override MessageType type => (MessageType)5;
public CustomSystemMessage(string message)
: base(message)
{
}
}
[BepInPlugin("com.equinox.EquinoxsModUtils", "EquinoxsModUtils", "6.1.3")]
public class ModUtils : BaseUnityPlugin
{
private const string MyGUID = "com.equinox.EquinoxsModUtils";
private const string PluginName = "EquinoxsModUtils";
private const string VersionString = "6.1.3";
private static readonly Harmony Harmony = new Harmony("com.equinox.EquinoxsModUtils");
internal static ManualLogSource Log = new ManualLogSource("EquinoxsModUtils");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: EquinoxsModUtils, VersionString: 6.1.3 is loading...");
Harmony.PatchAll();
InternalTools.CheckBepInExConfig();
Harmony.CreateAndPatchAll(typeof(FHG_UtilsPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(FlowManagerPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(SaveStatePatch), (string)null);
Harmony.CreateAndPatchAll(typeof(StringPatternsList), (string)null);
Harmony.CreateAndPatchAll(typeof(TechTreeGridPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(UIManagerPatch), (string)null);
Harmony.CreateAndPatchAll(typeof(UnlockPatch), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: EquinoxsModUtils, VersionString: 6.1.3 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
}
private void Update()
{
EMU.LoadingStates.CheckLoadingStates();
}
}
}
namespace EquinoxsModUtils.Patches
{
internal class FlowManagerPatch
{
[HarmonyPatch(typeof(FlowManager), "LoadSaveGame")]
[HarmonyPrefix]
private static async void OnLoadingSecondSave()
{
if (!EMU.LoadingStates.hasGameLoaded)
{
return;
}
EMU.LoadingStates.ResetLoadingStates();
await Task.Run(async delegate
{
while ((Object)(object)GameDefines.instance != (Object)null)
{
await Task.Delay(1);
Debug.Log((object)"Waiting for GameDefines to go null");
}
Debug.Log((object)"GameDefines went null");
EMU.LoadingStates.shouldMonitorLoadingStates = true;
});
EMU.Events.FireGameUnloaded();
}
[HarmonyPatch(typeof(FlowManager), "OnStartQuit")]
[HarmonyPrefix]
private static void OnGameQuitting()
{
EMU.Events.FireGameUnloaded();
}
}
internal class SaveStatePatch
{
[HarmonyPatch(typeof(SaveState), "SaveToFile")]
[HarmonyPostfix]
private static void saveMod(SaveState __instance, string saveLocation, bool saveToPersistent = true)
{
EMU.Events.FireGameSaved();
}
}
internal class FHG_UtilsPatch
{
[HarmonyPatch(typeof(FHG_Utils), "Inline")]
[HarmonyPostfix]
private static void ReplaceEmptySprite(ref string __result)
{
__result = __result.Replace("<sprite=\"\" index=0>", "");
}
}
internal class TechTreeGridPatch
{
[HarmonyPatch(typeof(TechTreeGrid), "InitForCategoryHelper")]
[HarmonyPrefix]
private static bool FixInitForCategoryHelper(TechTreeGrid __instance, TechCategory category, bool isPrimary)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
TechTreeCategoryContainer[] array = (TechTreeCategoryContainer[])EMU.GetPrivateField<TechTreeGrid>("categoryContainers", __instance);
List<int> categoryMapping = array[category].categoryMapping;
RectTransform nodesXfm = array[category].nodesXfm;
Vector2Int[] array2 = (Vector2Int[])EMU.GetPrivateField<TechTreeGrid>("tierIndices", __instance);
int num = -99;
if (isPrimary)
{
for (int i = 0; i < array2.Length; i++)
{
array2[i] = new Vector2Int(-1, -1);
}
}
Vector2Int val = default(Vector2Int);
((Vector2Int)(ref val))..ctor(-1, -1);
bool flag = false;
bool flag2 = false;
Dictionary<int, float> dictionary = (Dictionary<int, float>)EMU.GetPrivateField<TechTreeGrid>("_tierScrollPositions", __instance);
TechTreeNode[] array3 = (TechTreeNode[])EMU.GetPrivateField<TechTreeGrid>("techTreeNodes", __instance);
dictionary[0] = 0f;
for (int j = 0; j < categoryMapping.Count; j++)
{
int num2 = categoryMapping[j];
if ((Object)(object)array3[num2] == (Object)null)
{
array3[num2] = Object.Instantiate<TechTreeNode>(__instance.elementPrefab, (Transform)(object)nodesXfm);
array3[num2].Init(__instance, num2);
flag2 = true;
}
if (isPrimary)
{
if ((int)array3[num2].myUnlock.requiredTier == 0)
{
EMULogging.LogEMUWarning($"Setting Unlock #{((UniqueIdScriptableObject)array3[num2].myUnlock).uniqueId} requiredTier to Tier0");
array3[num2].myUnlock.requiredTier = (ResearchTier)1;
}
int num3 = Extension_TechTree.ToIndex(array3[num2].myUnlock.requiredTier);
if (num3 != num)
{
dictionary[num3] = array3[num2].xfm.anchoredPosition.y - 35f;
if (flag)
{
((Vector2Int)(ref val)).y = j - 1;
array2[num] = val;
}
num = num3;
((Vector2Int)(ref val)).x = j;
flag = true;
}
}
array3[num2].RefreshState(new CommonLocStrings());
}
if (num >= 0 && num < array2.Length)
{
((Vector2Int)(ref val)).y = categoryMapping.Count - 1;
array2[num] = val;
}
if (flag2)
{
array[category].InitDependencyLines(ref array3, ref categoryMapping);
}
EMU.SetPrivateField<TechTreeGrid>("tierIndices", __instance, array2);
EMU.SetPrivateField<TechTreeGrid>("_tierScrollPositions", __instance, dictionary);
EMU.SetPrivateField<TechTreeGrid>("techTreeNodes", __instance, array3);
return false;
}
}
internal class UIManagerPatch
{
public static bool freeCursor;
[HarmonyPatch(typeof(UIManager), "get_anyMenuOpen")]
[HarmonyPostfix]
private static void AnyMenuOpenPostfix(ref bool __result)
{
__result = UIManager.instance.hasOpenMenu || UIManager.instance.pauseMenuOpen || UIManager.instance.inventoryCraftingMenuOpen || UIManager.instance.craftingMenuOpen || UIManager.instance.assemblerMenuOpen || UIManager.instance.smelterMenuOpen || UIManager.instance.drillMenuOpen || UIManager.instance.researchLabMenuOpen || UIManager.instance.researchMenuOpen || UIManager.instance.editShortcutMenuOpen || UIManager.instance.sapTapMenuOpen || freeCursor;
}
}
internal class UnlockPatch
{
[HarmonyPatch(typeof(Unlock), "GetActivationEnergy")]
[HarmonyPrefix]
private static bool getEnergyFix(Unlock __instance, ref int __result)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected I4, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
List<int> coreActivationEnergyCosts = GameDefines.instance.coreActivationEnergyCosts;
for (int i = 0; i < __instance.coresNeeded.Count; i++)
{
int num2 = (int)__instance.coresNeeded[i].type;
if (num2 < 0)
{
num2 = 0;
}
int num3 = __instance.coresNeeded[i].number * coreActivationEnergyCosts[Math.Min(num2, coreActivationEnergyCosts.Count - 1)];
num += num3;
}
__result = num;
return false;
}
}
}