using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using RecipeTweaks;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SeedDuplication")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SeedDuplication")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cbc0dbcc-efcc-457a-9c30-56557a01d9f0")]
[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 SeedDuplication
{
[BepInPlugin("com.equinox.SeedDuplication", "SeedDuplication", "1.0.1")]
public class SeedDuplicationPlugin : BaseUnityPlugin
{
private const string MyGUID = "com.equinox.SeedDuplication";
private const string PluginName = "SeedDuplication";
private const string VersionString = "1.0.1";
private static readonly Harmony Harmony = new Harmony("com.equinox.SeedDuplication");
public static ManualLogSource Log = new ManualLogSource("SeedDuplication");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SeedDuplication, VersionString: 1.0.1 is loading...");
Harmony.PatchAll();
ModUtils.GameDefinesLoaded += OnGameDefinesLoaded;
((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SeedDuplication, VersionString: 1.0.1 is loaded.");
Log = ((BaseUnityPlugin)this).Logger;
}
private void Update()
{
if (!ModUtils.hasGameStateLoaded)
{
ModUtils.CheckIfGameStateLoaded();
}
if (!ModUtils.hasGameDefinesLoaded)
{
ModUtils.CheckIfGameDefinesLoaded();
}
if (!ModUtils.hasSaveStateLoaded)
{
ModUtils.CheckIfSaveStateLoaded();
}
if (!ModUtils.hasTechTreeStateLoaded)
{
ModUtils.CheckIfTechTreeStateLoaded();
}
}
private void OnGameDefinesLoaded(object sender, EventArgs e)
{
SchematicsRecipeData val = ModUtils.FindThresherRecipeFromOutputs("Kindlevine Seed", "Kindlevine Stems");
if ((Object)(object)val != (Object)null)
{
val.outputQuantities[0] = 2;
}
SchematicsRecipeData val2 = ModUtils.FindThresherRecipeFromOutputs("Shiverthorn Seed", "Shiverthorn Buds");
if ((Object)(object)val2 != (Object)null)
{
val2.outputQuantities[0] = 2;
}
}
}
}
namespace SeedDuplication.Patches
{
public class ThresherInstancePatch
{
[HarmonyPatch(typeof(ThresherInstance), "UpdateCrafting")]
[HarmonyPrefix]
private static void duplicateSeed()
{
}
}
}
namespace RecipeTweaks
{
public static class ModUtils
{
public static class ResourceNames
{
public const string Accumulator = "Accumulator";
public const string AdvancedCircuit = "Advanced Circuit";
public const string Assembler = "Assembler";
public const string AssemblerMKII = "Assembler MKII";
public const string AtlantumIngot = "Atlantum Ingot";
public const string AtlantumMixture = "Atlantum Mixture";
public const string AtlantumOre = "Atlantum Ore";
public const string AtlantumPowder = "Atlantum Powder";
public const string AtlantumInfusedLimestone = "Atlantum-Infused Limestone";
public const string Beacon = "Beacon";
public const string Biobrick = "Biobrick";
public const string BlueLightStick = "Blue Light Stick";
public const string CharacterModel = "CharacterModel";
public const string Container = "Container";
public const string ConveyorBelt = "Conveyor Belt";
public const string ConveyorBeltMKII = "Conveyor Belt MKII";
public const string CoolingSystem = "Cooling System";
public const string CopperComponents = "Copper Components";
public const string CopperFrame = "Copper Frame";
public const string CopperIngot = "Copper Ingot";
public const string CopperOre = "Copper Ore";
public const string CopperWire = "Copper Wire";
public const string CopperInfusedLimestone = "Copper-Infused Limestone";
public const string CoreComposer = "Core Composer";
public const string CrankGenerator = "Crank Generator";
public const string CrankGeneratorMKII = "Crank Generator MKII";
public const string Crate = "Crate";
public const string ElectricalComponents = "Electrical Components";
public const string FastInserter = "Fast Inserter";
public const string FilterInserter = "Filter Inserter";
public const string GreenLightStick = "Green Light Stick";
public const string HighVoltageCable = "High Voltage Cable";
public const string HoverPack = "Hover Pack";
public const string Inserter = "Inserter";
public const string IronComponents = "Iron Components";
public const string IronFrame = "Iron Frame";
public const string IronIngot = "Iron Ingot";
public const string IronOre = "Iron Ore";
public const string IronInfusedLimestone = "Iron-Infused Limestone";
public const string Kindlevine = "Kindlevine";
public const string KindlevineExtract = "Kindlevine Extract";
public const string KindlevineSeed = "Kindlevine Seed";
public const string KindlevineStems = "Kindlevine Stems";
public const string LightStick = "Light Stick";
public const string Lima = "Lima";
public const string Limestone = "Limestone";
public const string LongInserter = "Long Inserter";
public const string MechanicalComponents = "Mechanical Components";
public const string MiningCharge = "Mining Charge";
public const string MiningDrill = "Mining Drill";
public const string MiningDrillMKII = "Mining Drill MKII";
public const string MonorailDepot = "Monorail Depot";
public const string MonorailPole = "Monorail Pole";
public const string MonorailTrack = "Monorail Track";
public const string Omniseeker = "Omniseeker";
public const string OverheadLight = "Overhead Light";
public const string Planter = "Planter";
public const string Plantmatter = "Plantmatter";
public const string PlantmatterFiber = "Plantmatter Fiber";
public const string PlantmatterFrame = "Plantmatter Frame";
public const string PowerFloor = "Power Floor";
public const string ProcessorUnit = "Processor Unit";
public const string Railrunner = "Railrunner";
public const string RedLightStick = "Red Light Stick";
public const string ResearchCore380nmPurple = "Research Core 380nm (Purple)";
public const string ResearchCore480nmBlue = "Research Core 480nm (Blue)";
public const string Scanner = "Scanner";
public const string Shiverthorn = "Shiverthorn";
public const string ShiverthornBuds = "Shiverthorn Buds";
public const string ShiverthornCoolant = "Shiverthorn Coolant";
public const string ShiverthornExtract = "Shiverthorn Extract";
public const string ShiverthornSeed = "Shiverthorn Seed";
public const string Sierra = "Sierra";
public const string Smelter = "Smelter";
public const string SmelterMKII = "Smelter MKII";
public const string Soil = "Soil";
public const string SpectralCubeEmerald = "Spectral Cube (Emerald)";
public const string SpectralCubeGarnet = "Spectral Cube (Garnet)";
public const string StackInserter = "Stack Inserter";
public const string Stairs = "Stairs";
public const string StandardPickaxe = "Standard Pickaxe";
public const string TheMOLE = "The M.O.L.E.";
public const string Thresher = "Thresher";
public const string ThresherMKII = "Thresher MKII";
public const string Victor = "Victor";
public const string VoltageStepper = "Voltage Stepper";
public const string WaterWheel = "Water Wheel";
}
public static bool hasGameStateLoaded;
public static bool hasGameDefinesLoaded;
public static bool hasSaveStateLoaded;
public static bool hasTechTreeStateLoaded;
public static event EventHandler GameStateLoaded;
public static event EventHandler GameDefinesLoaded;
public static event EventHandler SaveStateLoaded;
public static event EventHandler TechTreeStateLoaded;
public static ResourceInfo GetResourceInfoByName(string name)
{
if (hasGameDefinesLoaded)
{
foreach (ResourceInfo resource in GameDefines.instance.resources)
{
if (resource.displayName == name)
{
return resource;
}
}
}
return null;
}
public static int? GetResourceIDByName(string name)
{
ResourceInfo resourceInfoByName = GetResourceInfoByName(name);
if ((Object)(object)resourceInfoByName != (Object)null)
{
return SaveState.GetIdForResInfo(resourceInfoByName);
}
return null;
}
public static SchematicsRecipeData FindThresherRecipeFromOutputs(string output1Name, string output2Name)
{
if (!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)))
{
return schematicsRecipeEntry;
}
}
return null;
}
public static bool IsTechUnlocked(string name)
{
if (hasTechTreeStateLoaded)
{
foreach (Unlock unlockedTech in TechTreeState.instance.unlockedTechs)
{
if (unlockedTech.displayName == name)
{
return true;
}
}
}
return false;
}
public static void CheckIfGameStateLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && GameState.instance != null)
{
hasGameStateLoaded = true;
ModUtils.GameStateLoaded?.Invoke(GameState.instance, EventArgs.Empty);
}
}
public static void CheckIfGameDefinesLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && (Object)(object)GameDefines.instance != (Object)null)
{
hasGameDefinesLoaded = true;
ModUtils.GameDefinesLoaded?.Invoke(GameDefines.instance, EventArgs.Empty);
}
}
public static void CheckIfSaveStateLoaded()
{
if (!((Object)(object)GameLogic.instance == (Object)null) && SaveState.instance != null)
{
hasSaveStateLoaded = true;
ModUtils.SaveStateLoaded?.Invoke(SaveState.instance, EventArgs.Empty);
}
}
public static void CheckIfTechTreeStateLoaded()
{
if (MachineManager.instance != null && TechTreeState.instance != null)
{
hasTechTreeStateLoaded = true;
ModUtils.TechTreeStateLoaded?.Invoke(TechTreeState.instance, EventArgs.Empty);
}
}
}
}