Decompiled source of Ranensols Craft Blueprints v1.0.2

Ranensol.BepInEx.Aska.CraftBlueprints.dll

Decompiled 3 weeks ago
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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.Json.Serialization;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Ranensol.BepInEx.Aska.CraftBlueprints.Blueprints;
using Ranensol.BepInEx.Aska.CraftBlueprints.FileIO;
using Ranensol.BepInEx.Aska.CraftBlueprints.GameData;
using Ranensol.BepInEx.Aska.CraftBlueprints.Recipes;
using Ranensol.BepInEx.Aska.CraftBlueprints.Recipes.Models;
using SSSGame;
using SandSailorStudio.Attributes;
using SandSailorStudio.Inventory;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Ranensol.BepInEx.Aska.CraftBlueprints")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: AssemblyInformationalVersion("1.0.2+7d46b992dc6f8448609cfcc45541fa7168a319c8")]
[assembly: AssemblyProduct("Ranensol Craft Blueprints")]
[assembly: AssemblyTitle("Ranensol.BepInEx.Aska.CraftBlueprints")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints
{
	internal static class Constants
	{
		public const string RECIPES_FOLDER_NAME = "Recipes";

		public const string REFERENCE_FOLDER_NAME = "Reference";

		public const string EXAMPLES_FILE_NAME = "Examples.json";

		public const string CUSTOM_RECIPES_FILE_NAME = "CustomRecipes.json";

		public const string JSON_FILE_PATTERN = "*.json";

		public const string CONFIG_SECTION_FILES = "Files";

		public const string CONFIG_KEY_CREATE_EXAMPLES = "CreateExampleFile";

		public const string CONFIG_KEY_CREATE_CUSTOM = "CreateCustomRecipeFile";

		public const string CONFIG_KEY_DUMP_REFERENCES = "DumpReferenceFiles";

		public const string CONFIG_DESC_CREATE_EXAMPLES = "Whether to create Examples.json on launch if it doesn't exist. Set to false to prevent recreation.";

		public const string CONFIG_DESC_CREATE_CUSTOM = "Whether to create CustomRecipes.json on launch if it doesn't exist. Set to false to prevent recreation.";

		public const string CONFIG_DESC_DUMP_REFERENCES = "Whether to dump game reference files (Items.txt, MenuLists.txt, etc.) on launch. Useful for recipe creation.";
	}
	[BepInPlugin("Ranensol.BepInEx.Aska.CraftBlueprints", "Ranensol Craft Blueprints", "1.0.2")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Log;

		internal static List<CraftBlueprintInfo> CustomBlueprints;

		private static string _pluginFolder;

		public override void Load()
		{
			InitializePlugin();
			InitializeConfig();
			DumpGameReferences();
			ApplyHarmonyPatches();
			LoadAndBuildBlueprints();
		}

		private void InitializePlugin()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Ranensol.BepInEx.Aska.CraftBlueprints");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loading");
			}
			log.LogInfo(val);
			_pluginFolder = Path.Combine(Paths.PluginPath, "Ranensol Craft Blueprints");
			Directory.CreateDirectory(_pluginFolder);
			ResourceInfoHelper.CreateResourceInfos();
		}

		private void InitializeConfig()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			PluginConfig.Initialize(((BasePlugin)this).Config);
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(75, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] Config loaded - CreateExamples: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(PluginConfig.ConfigCreateExamples.Value);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", CreateCustom: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(PluginConfig.ConfigCreateCustom.Value);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", DumpReferences: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(PluginConfig.ConfigDumpReferences.Value);
			}
			log.LogInfo(val);
		}

		private static void DumpGameReferences()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (PluginConfig.ConfigDumpReferences.Value)
			{
				ReferenceDumper.DumpAllReferences(_pluginFolder);
				return;
			}
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(50, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] Reference file dumping disabled in config");
			}
			log.LogInfo(val);
		}

		private static void ApplyHarmonyPatches()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] Applying Harmony patches");
			}
			log.LogInfo(val);
			new Harmony("Ranensol.BepInEx.Aska.CraftBlueprints").PatchAll();
		}

		private static void LoadAndBuildBlueprints()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			List<BlueprintSpec> list = RecipeLoader.LoadAll(_pluginFolder);
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (list.Count == 0)
			{
				CustomBlueprints = new List<CraftBlueprintInfo>();
				ManualLogSource log = Log;
				val = new BepInExInfoLogInterpolatedStringHandler(77, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] No recipes to build. Mod loaded successfully but no blueprints added");
				}
				log.LogInfo(val);
				return;
			}
			CustomBlueprints = BlueprintBuilder.BuildAll(list);
			if (CustomBlueprints.Count == 0)
			{
				ManualLogSource log2 = Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(69, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Plugin] All blueprints failed to build. No blueprints added to game.");
				}
				log2.LogWarning(val2);
				return;
			}
			int num = BlueprintMenuIntegration.AddToMenus(BlueprintBuilder.AllSpecs, CustomBlueprints);
			ManualLogSource log3 = Log;
			val = new BepInExInfoLogInterpolatedStringHandler(59, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Plugin] Successfully loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(CustomBlueprints.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" blueprints with ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" menu entries");
			}
			log3.LogInfo(val);
		}
	}
	public static class PluginConfig
	{
		public static ConfigEntry<bool> ConfigCreateExamples { get; private set; }

		public static ConfigEntry<bool> ConfigCreateCustom { get; private set; }

		public static ConfigEntry<bool> ConfigDumpReferences { get; private set; }

		public static ConfigEntry<string> ItemsIncludePrefixes { get; private set; }

		public static ConfigEntry<string> ItemsExcludePrefixes { get; private set; }

		public static ConfigEntry<string> CategoriesIncludePrefixes { get; private set; }

		public static ConfigEntry<string> CategoriesExcludePrefixes { get; private set; }

		public static ConfigEntry<string> MenuListsIncludePrefixes { get; private set; }

		public static ConfigEntry<string> MenuListsExcludePrefixes { get; private set; }

		public static ConfigEntry<string> InteractionsIncludePrefixes { get; private set; }

		public static ConfigEntry<string> InteractionsExcludePrefixes { get; private set; }

		public static ConfigEntry<string> RulesIncludePrefixes { get; private set; }

		public static ConfigEntry<string> RulesExcludePrefixes { get; private set; }

		public static void Initialize(ConfigFile config)
		{
			ConfigCreateExamples = config.Bind<bool>("Files", "CreateExampleFile", true, "Whether to create Examples.json on launch if it doesn't exist. Set to false to prevent recreation.");
			ConfigCreateCustom = config.Bind<bool>("Files", "CreateCustomRecipeFile", true, "Whether to create CustomRecipes.json on launch if it doesn't exist. Set to false to prevent recreation.");
			ConfigDumpReferences = config.Bind<bool>("Files", "DumpReferenceFiles", true, "Whether to dump game reference files (Items.txt, MenuLists.txt, etc.) on launch. Useful for recipe creation.");
			ItemsIncludePrefixes = config.Bind<string>("Filters - Items", "IncludePrefixes", "Item_Arrows_,Item_Axes_,Item_Bait_,Item_Boots_,Item_Bows_,Item_Cape_,Item_Chest_,Item_DrawKnives_,Item_Dyes_,Item_FishingRods_,Item_Gloves_,Item_Hammers_,Item_Hammers_,Item_Hoes_,Item_Iron_IronBloom,Item_Iron_Ore,Item_Junk_,Item_Knives_,Item_Magic_,Item_Materials_,Item_Misc_BoneFragments,Item_Misc_CrawlerSack,Item_Misc_Feathers,Item_Misc_SmolkrHornRaw,Item_OneHanded_,Item_PaintBrushes_ThatchBrush,Item_Pants_,Item_Pickaxes_,Item_Rakes_,Item_Seeds_,Item_Shields_,Item_Shoulders_,Item_Shovels_,Item_Special,Item_Stone_Raw,Item_Stone_SmallRaw,Item_Torches_SimpleTorch,Item_TwoHanded_,Item_WaterSkins,Item_Wood_Bark,Item_Wood_BarkFibres,Item_Wood_Beam,Item_Wood_Coal,Item_Wood_Firewood,Item_Wood_HardWoodLog,Item_Wood_HardWoodLongStick,Item_Wood_Plank,Item_Wood_Post,Item_Wood_RawLog,Item_Wood_RawLongStick,Item_Wood_Resin,Item_Wood_Shaft,Item_Wood_Sticks,Item_Wood_Thatch,Item_YuleTree_", "Comma-separated list of prefixes. If set, only items starting with these will appear in reference files. Leave empty to include all.");
			ItemsExcludePrefixes = config.Bind<string>("Filters - Items", "ExcludePrefixes", "Item_Arrows_DraugarArrowRef,Item_Bait_MaggotBP,Item_Boots_BaseBoots,Item_Bows_DraugarBowRef,Item_Chest_BaseChest,Item_Gloves_BaseGloves,Item_Helmets_BaseHelmet,Item_Magic_BrokenCore,Item_Magic_ExplodingSackBP,Item_Magic_Jotun,Item_Magic_RavenMagicBP,Item_OneHanded_1HDraugarBattleAxeRef,Item_OneHanded_1HDraugarBattleHammerRef,Item_OneHanded_1HDraugarSwordRef,Item_Pants_BasePants,Item_Shields_ShieldDraugarRef,Item_Shoulders_BaseShoulders,Item_TwoHanded_2HDraugarBattleAxeRef,Item_TwoHanded_2HDraugarBattleHammerRef,Item_TwoHanded_DraugarGreatswordRef,Item_SpecialBags_,Item_FishingRods_2HWoodFishingRod", "Comma-separated list of prefixes. Items starting with these will be excluded from reference files.");
			CategoriesIncludePrefixes = config.Bind<string>("Filters - Categories", "IncludePrefixes", "Categ_Blueprints_", "Comma-separated list of prefixes. If set, only categories starting with these will appear in reference files.");
			CategoriesExcludePrefixes = config.Bind<string>("Filters - Categories", "ExcludePrefixes", "", "Comma-separated list of prefixes. Categories starting with these will be excluded from reference files.");
			MenuListsIncludePrefixes = config.Bind<string>("Filters - MenuLists", "IncludePrefixes", "ArmorsmithBlueprints,DyerBlueprints,LeatherworkerBlueprints,RavenTotemBlueprints,StartBlueprints,WeaverBlueprints,WorkshopBlueprints", "Comma-separated list of prefixes. If set, only menu lists starting with these will appear in reference files.");
			MenuListsExcludePrefixes = config.Bind<string>("Filters - MenuLists", "ExcludePrefixes", "", "Comma-separated list of prefixes. Menu lists starting with these will be excluded from reference files.");
			InteractionsIncludePrefixes = config.Bind<string>("Filters - Interactions", "IncludePrefixes", "", "Comma-separated list of prefixes. If set, only interactions starting with these will appear in reference files.");
			InteractionsExcludePrefixes = config.Bind<string>("Filters - Interactions", "ExcludePrefixes", "Anvil,Carpent,CraftingTable_,craftInteraction", "Comma-separated list of prefixes. Interactions starting with these will be excluded from reference files.");
			RulesIncludePrefixes = config.Bind<string>("Filters - Rules", "IncludePrefixes", "", "Comma-separated list of prefixes. If set, only rules starting with these will appear in reference files.");
			RulesExcludePrefixes = config.Bind<string>("Filters - Rules", "ExcludePrefixes", "", "Comma-separated list of prefixes. Rules starting with these will be excluded from reference files.");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Ranensol.BepInEx.Aska.CraftBlueprints";

		public const string PLUGIN_NAME = "Ranensol Craft Blueprints";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.Recipes
{
	internal static class ExampleRecipeDefinitions
	{
		public static RecipeCollection GetExampleRecipes()
		{
			return new RecipeCollection
			{
				Recipes = new List<JsonRecipeSpec>(5)
				{
					new JsonRecipeSpec
					{
						Id = 900000001,
						ResultItem = "Item_Materials_Linen",
						Name = "Linen Cloth",
						Ingredients = new List<JsonIngredient>(1)
						{
							new JsonIngredient
							{
								Item = "Item_Wood_BarkFibres",
								Quantity = 20
							}
						},
						Quantity = 5,
						MenuLists = new List<string>(1) { "WeaverBlueprints_T1" },
						Rules = new List<string>(1) { "Weaver_Rule" },
						Interaction = "WeaverInteraction",
						Category = "Categ_Blueprints_Materials",
						Description = "Craft 5 Linen cloth",
						Lore = "Use the loom to make flax fibers bidimensional"
					},
					new JsonRecipeSpec
					{
						Id = 900000002,
						ResultItem = "Item_Materials_LinenThread",
						Name = "Linen Thread",
						Ingredients = new List<JsonIngredient>(1)
						{
							new JsonIngredient
							{
								Item = "Item_Wood_BarkFibres",
								Quantity = 10
							}
						},
						Quantity = 5,
						MenuLists = new List<string>(1) { "WeaverBlueprints_T1" },
						Rules = new List<string>(1) { "Weaver_Rule" },
						Interaction = "WeaverInteraction",
						Category = "Categ_Blueprints_Materials",
						Description = "Craft 5 Linen thread",
						Lore = "Use the loom to make flax fibers bidimensional"
					},
					new JsonRecipeSpec
					{
						Id = 900000003,
						ResultItem = "Item_Materials_LeatherCuredHide",
						Name = "Cured Leather Hide",
						Ingredients = new List<JsonIngredient>(2)
						{
							new JsonIngredient
							{
								Item = "Item_Materials_LeatherScraps",
								Quantity = 10
							},
							new JsonIngredient
							{
								Item = "Item_Materials_LinenThread",
								Quantity = 2
							}
						},
						Quantity = 1,
						MenuLists = new List<string>(1) { "LeatherworkerBlueprints_T1" },
						Rules = new List<string>(1) { "LeatherWorkerL1_Rule" },
						Interaction = "LeatherworkerTableInteraction",
						Category = "Categ_Blueprints_Materials",
						Description = "Craft a Cured Leather Hide",
						Lore = "Stitch scraps together at the Leatherworker"
					},
					new JsonRecipeSpec
					{
						Id = 900000004,
						ResultItem = "Item_Torches_SimpleTorch",
						Name = "Simple Torch - Fish Oil",
						Ingredients = new List<JsonIngredient>(3)
						{
							new JsonIngredient
							{
								Item = "Item_Wood_Sticks",
								Quantity = 1
							},
							new JsonIngredient
							{
								Item = "Item_Materials_BasicRope",
								Quantity = 4
							},
							new JsonIngredient
							{
								Item = "Item_Food_FishOil",
								Quantity = 1
							}
						},
						Quantity = 1,
						MenuLists = new List<string>(3) { "WorkshopBlueprints_T0", "WorkshopBlueprints_T1", "WorkshopBlueprints_T2" },
						Rules = new List<string>(3) { "WorkshopL0_Rule", "WorkshopL1_Rule", "WorkshopL2_Rule" },
						Interaction = "WorkstationInteraction",
						Category = "Categ_Blueprints_Tools",
						Description = "Craft a Simple Torch using Fish Oil",
						Lore = "A portable source of light that smells faintly of fish."
					},
					new JsonRecipeSpec
					{
						Id = 900000005,
						ResultItem = "Item_Bows_SimpleBow",
						Name = "Simple Bow",
						Ingredients = new List<JsonIngredient>(3)
						{
							new JsonIngredient
							{
								Item = "Item_Wood_Sticks",
								Quantity = 5
							},
							new JsonIngredient
							{
								Item = "Item_Materials_BasicRope",
								Quantity = 3
							},
							new JsonIngredient
							{
								Item = "Item_Misc_BoneFragments",
								Quantity = 5
							}
						},
						Quantity = 1,
						MenuLists = new List<string>(1) { "StartBlueprints" },
						Rules = new List<string>(),
						Interaction = "VirtualCraftingStation",
						Category = "Categ_Blueprints_Weaponry",
						Description = "Ranged Weapon",
						Lore = "A simple and reliable bow"
					}
				}
			};
		}
	}
	internal static class RecipeFileReader
	{
		public static List<(string fileName, RecipeCollection collection)> ReadAllRecipeFiles(string pluginFolder)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			string[] files = Directory.GetFiles(GetRecipesFolderPath(pluginFolder), "*.json");
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeFileReader] Found ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(files.Length);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" recipe file(s)");
			}
			log.LogInfo(val);
			List<(string, RecipeCollection)> list = new List<(string, RecipeCollection)>();
			string[] array = files;
			foreach (string text in array)
			{
				try
				{
					string fileName = Path.GetFileName(text);
					RecipeCollection item = ReadRecipeFile(text);
					list.Add((fileName, item));
				}
				catch (Exception ex)
				{
					ManualLogSource log2 = Plugin.Log;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(38, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[RecipeFileReader] Failed to read '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(Path.GetFileName(text));
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("': ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					}
					log2.LogError(val2);
				}
			}
			return list;
		}

		public static string GetRecipesFolderPath(string pluginFolder)
		{
			return Path.Combine(pluginFolder, "Recipes");
		}

		private static RecipeCollection ReadRecipeFile(string filePath)
		{
			return JsonSerializer.Deserialize<RecipeCollection>(File.ReadAllText(filePath), new JsonSerializerOptions
			{
				PropertyNameCaseInsensitive = true,
				ReadCommentHandling = JsonCommentHandling.Skip,
				AllowTrailingCommas = true
			}) ?? new RecipeCollection();
		}
	}
	internal static class RecipeLoader
	{
		public static List<BlueprintSpec> LoadAll(string pluginFolder)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			RecipeValidator.ResetIdTracking();
			EnsureRecipesFolderExists(pluginFolder);
			EnsureRecipeFilesExist(pluginFolder);
			List<BlueprintSpec> list = ProcessAllRecipeFiles(RecipeFileReader.ReadAllRecipeFiles(pluginFolder));
			bool flag = default(bool);
			if (list.Count == 0)
			{
				ManualLogSource log = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] No recipes found.");
				}
				log.LogInfo(val);
			}
			else
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(48, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] Loaded ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" recipe(s) from JSON files");
				}
				log2.LogInfo(val);
			}
			return list;
		}

		private static void EnsureRecipesFolderExists(string pluginFolder)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(79, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] Checking if recipe folder exists in '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(pluginFolder);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and creating if necessary");
			}
			log.LogInfo(val);
			Directory.CreateDirectory(RecipeFileReader.GetRecipesFolderPath(pluginFolder));
		}

		private static void EnsureRecipeFilesExist(string pluginFolder)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			string recipesFolderPath = RecipeFileReader.GetRecipesFolderPath(pluginFolder);
			bool flag = default(bool);
			if (PluginConfig.ConfigCreateExamples.Value)
			{
				string text = Path.Combine(recipesFolderPath, "Examples.json");
				if (!File.Exists(text))
				{
					RecipeFileWriter.Write(ExampleRecipeDefinitions.GetExampleRecipes(), text);
					ManualLogSource log = Plugin.Log;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] Created ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Examples.json");
					}
					log.LogInfo(val);
				}
			}
			if (!PluginConfig.ConfigCreateCustom.Value)
			{
				return;
			}
			string text2 = Path.Combine(recipesFolderPath, "CustomRecipes.json");
			if (!File.Exists(text2))
			{
				RecipeFileWriter.Write(new RecipeCollection
				{
					Recipes = new List<JsonRecipeSpec>()
				}, text2);
				ManualLogSource log2 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] Created ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CustomRecipes.json");
				}
				log2.LogInfo(val);
			}
		}

		private static List<BlueprintSpec> ProcessAllRecipeFiles(List<(string fileName, RecipeCollection collection)> recipeFiles)
		{
			List<BlueprintSpec> list = new List<BlueprintSpec>();
			foreach (var (fileName, collection) in recipeFiles)
			{
				ProcessRecipeFile(fileName, collection, list);
			}
			return list;
		}

		private static void ProcessRecipeFile(string fileName, RecipeCollection collection, List<BlueprintSpec> specs)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (collection?.Recipes == null || collection.Recipes.Count == 0)
			{
				ManualLogSource log = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(37, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] '");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(fileName);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' contains no recipes");
				}
				log.LogInfo(val);
				return;
			}
			int num = 0;
			int num2 = 0;
			foreach (JsonRecipeSpec recipe in collection.Recipes)
			{
				try
				{
					RecipeValidator.ValidateRecipe(recipe);
					BlueprintSpec item = ConvertToBlueprintSpec(recipe);
					specs.Add(item);
					num++;
				}
				catch (Exception ex)
				{
					ManualLogSource log2 = Plugin.Log;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(38, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[RecipeLoader] '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(fileName);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' - Recipe '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(recipe?.Name ?? "Unknown");
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' failed: ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					}
					log2.LogError(val2);
					num2++;
				}
			}
			ManualLogSource log3 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[RecipeLoader] '");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(fileName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" succeeded, ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" failed");
			}
			log3.LogInfo(val);
		}

		private static BlueprintSpec ConvertToBlueprintSpec(JsonRecipeSpec json)
		{
			(string, int)[] ingredients = json.Ingredients.Select((JsonIngredient i) => (i.Item, i.Quantity)).ToArray();
			BlueprintSpec result = default(BlueprintSpec);
			result.Id = json.Id;
			result.ResultItem = json.ResultItem;
			result.Name = json.Name;
			result.Ingredients = ingredients;
			result.Quantity = json.Quantity;
			result.MenuLists = json.MenuLists.ToArray();
			result.Rules = json.Rules.ToArray();
			result.Interaction = json.Interaction;
			result.Category = json.Category;
			result.Description = json.Description;
			result.Lore = json.Lore;
			return result;
		}
	}
	internal static class RecipeValidator
	{
		private const int RECOMMENDED_ID_START = 900000001;

		private static readonly HashSet<int> _usedIds = new HashSet<int>();

		public static void ResetIdTracking()
		{
			_usedIds.Clear();
		}

		public static void ValidateRecipe(JsonRecipeSpec json)
		{
			ValidateId(json.Id);
			ValidateResultItem(json.ResultItem);
			ValidateName(json.Name);
			ValidateIngredients(json.Ingredients);
			ValidateQuantity(json.Quantity);
			ValidateMenuLists(json.MenuLists);
			ValidateRules(json.Rules);
			ValidateInteraction(json.Interaction);
			ValidateCategory(json.Category);
		}

		private static void ValidateId(int id)
		{
			if (id <= 0)
			{
				throw new ArgumentException($"id is required and must be > 0. Recommended range: {900000001}+");
			}
			if (_usedIds.Contains(id))
			{
				throw new ArgumentException($"id {id} is already used by another recipe. Each recipe must have a unique ID");
			}
			_usedIds.Add(id);
		}

		private static void ValidateResultItem(string resultItem)
		{
			if (string.IsNullOrWhiteSpace(resultItem))
			{
				throw new ArgumentException("resultItem is required");
			}
			if (!ResourceInfoHelper.ItemExists(resultItem))
			{
				throw new ArgumentException("resultItem '" + resultItem + "' not found. Check Reference/Items.txt");
			}
		}

		private static void ValidateName(string name)
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				throw new ArgumentException("name is required");
			}
		}

		private static void ValidateIngredients(List<JsonIngredient> ingredients)
		{
			if (ingredients == null || ingredients.Count == 0)
			{
				throw new ArgumentException("at least one ingredient is required");
			}
			foreach (JsonIngredient ingredient in ingredients)
			{
				ValidateIngredient(ingredient);
			}
		}

		private static void ValidateIngredient(JsonIngredient ingredient)
		{
			if (string.IsNullOrWhiteSpace(ingredient.Item))
			{
				throw new ArgumentException("ingredient item name is required");
			}
			if (!ResourceInfoHelper.ItemExists(ingredient.Item))
			{
				throw new ArgumentException("ingredient '" + ingredient.Item + "' not found. Check Reference/Items.txt");
			}
			if (ingredient.Quantity <= 0)
			{
				throw new ArgumentException("ingredient '" + ingredient.Item + "' quantity must be > 0");
			}
		}

		private static void ValidateQuantity(int quantity)
		{
			if (quantity <= 0)
			{
				throw new ArgumentException("quantity must be > 0");
			}
		}

		private static void ValidateMenuLists(List<string> menuLists)
		{
			if (menuLists == null || menuLists.Count == 0)
			{
				throw new ArgumentException("at least one menuList is required");
			}
			foreach (string menuList in menuLists)
			{
				if (!ResourceInfoHelper.MenuListExists(menuList))
				{
					throw new ArgumentException("menuList '" + menuList + "' not found. Check Reference/MenuLists.txt");
				}
			}
		}

		private static void ValidateRules(List<string> rules)
		{
			if (rules == null)
			{
				return;
			}
			foreach (string rule in rules)
			{
				if (!ResourceInfoHelper.RuleExists(rule))
				{
					throw new ArgumentException("rule '" + rule + "' not found. Check Reference/Rules.txt");
				}
			}
		}

		private static void ValidateInteraction(string interaction)
		{
			if (string.IsNullOrWhiteSpace(interaction))
			{
				throw new ArgumentException("interaction is required");
			}
			if (!ResourceInfoHelper.InteractionExists(interaction))
			{
				throw new ArgumentException("interaction '" + interaction + "' not found. Check Reference/Stations.txt");
			}
		}

		private static void ValidateCategory(string category)
		{
			if (string.IsNullOrWhiteSpace(category))
			{
				throw new ArgumentException("category is required");
			}
			if (!ResourceInfoHelper.CategoryExists(category))
			{
				throw new ArgumentException("category '" + category + "' not found. Check Reference/Categories.txt");
			}
		}
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.Recipes.Models
{
	internal class JsonIngredient
	{
		[JsonPropertyName("item")]
		public string Item { get; set; }

		[JsonPropertyName("quantity")]
		public int Quantity { get; set; }
	}
	internal class JsonRecipeSpec
	{
		[JsonPropertyName("id")]
		public int Id { get; set; }

		[JsonPropertyName("resultItem")]
		public string ResultItem { get; set; }

		[JsonPropertyName("name")]
		public string Name { get; set; }

		[JsonPropertyName("ingredients")]
		public List<JsonIngredient> Ingredients { get; set; } = new List<JsonIngredient>();


		[JsonPropertyName("quantity")]
		public int Quantity { get; set; }

		[JsonPropertyName("menuLists")]
		public List<string> MenuLists { get; set; } = new List<string>();


		[JsonPropertyName("rules")]
		public List<string> Rules { get; set; } = new List<string>();


		[JsonPropertyName("interaction")]
		public string Interaction { get; set; }

		[JsonPropertyName("category")]
		public string Category { get; set; }

		[JsonPropertyName("description")]
		public string Description { get; set; }

		[JsonPropertyName("lore")]
		public string Lore { get; set; }
	}
	internal class RecipeCollection
	{
		[JsonPropertyName("recipes")]
		public List<JsonRecipeSpec> Recipes { get; set; } = new List<JsonRecipeSpec>();

	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.Patches
{
	[HarmonyPatch(typeof(ItemInfoDatabase), "Initialize")]
	internal class ItemInfoDatabase_Initialize_Patch
	{
		[HarmonyPostfix]
		private static void Postfix(ItemInfoDatabase __instance)
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			Plugin.Log.LogInfo((object)"[ItemInfoDatabase_Initialize_Patch] - Injecting custom blueprints");
			bool flag = default(bool);
			try
			{
				if (((__instance != null) ? __instance._itemsMap : null) != null)
				{
					Dictionary<int, ItemInfo> itemsMap = __instance._itemsMap;
					if (itemsMap != null)
					{
						{
							foreach (CraftBlueprintInfo customBlueprint in Plugin.CustomBlueprints)
							{
								itemsMap[((ItemInfo)customBlueprint).id] = (ItemInfo)(object)customBlueprint;
								ManualLogSource log = Plugin.Log;
								BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(79, 2, ref flag);
								if (flag)
								{
									((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ItemInfoDatabase_Initialize_Patch] Added blueprint to ItemInfoDatabase: ");
									((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((ItemInfo)customBlueprint).Name);
									((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ID: ");
									((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(((ItemInfo)customBlueprint).id);
								}
								log.LogInfo(val);
							}
							return;
						}
					}
				}
				Plugin.Log.LogError((object)"[ItemInfoDatabase_Initialize_Patch] _itemsMap is null!");
			}
			catch (Exception ex)
			{
				ManualLogSource log2 = Plugin.Log;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(70, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[ItemInfoDatabase_Initialize_Patch] Error in ItemInfoDatabase patch: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace);
				}
				log2.LogError(val2);
			}
		}
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.GameData
{
	internal static class ResourceInfoHelper
	{
		private static Dictionary<string, ItemInfo> _allItemInfos = new Dictionary<string, ItemInfo>();

		private static Dictionary<string, ItemInfoList> _allItemInfoLists = new Dictionary<string, ItemInfoList>();

		private static Dictionary<string, BlueprintConditionsRule> _allBlueprintConditionRules = new Dictionary<string, BlueprintConditionsRule>();

		private static Dictionary<string, ItemCategoryInfo> _allItemCategoryInfos = new Dictionary<string, ItemCategoryInfo>();

		private static Dictionary<string, CraftInteraction> _allCraftInteractions = new Dictionary<string, CraftInteraction>();

		private static Dictionary<string, ItemStorageClass> _allItemStorageClasses = new Dictionary<string, ItemStorageClass>();

		public static IReadOnlyDictionary<string, ItemInfo> AllItemInfos => _allItemInfos;

		public static IReadOnlyDictionary<string, ItemInfoList> AllItemInfoLists => _allItemInfoLists;

		public static IReadOnlyDictionary<string, BlueprintConditionsRule> AllBlueprintConditionRules => _allBlueprintConditionRules;

		public static IReadOnlyDictionary<string, ItemCategoryInfo> AllItemCategoryInfos => _allItemCategoryInfos;

		public static IReadOnlyDictionary<string, CraftInteraction> AllCraftInteractions => _allCraftInteractions;

		public static IReadOnlyDictionary<string, ItemStorageClass> AllItemStorageClasses => _allItemStorageClasses;

		public static void CreateResourceInfos()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Creating resource info");
			}
			log.LogInfo(val);
			PreloadUnityResources();
			LoadItemInfos();
			LoadBlueprintConditionRules();
			LoadItemCategoryInfos();
			LoadCraftInteractions();
			LoadItemInfoLists();
			LoadItemStorageClasses();
		}

		private static void PreloadUnityResources()
		{
			Resources.LoadAll("", Type.GetType("SSSGame.ResourceInfo, Assembly-CSharp"));
		}

		private static void LoadItemInfos()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allItemInfos = new Dictionary<string, ItemInfo>();
			foreach (ItemInfo item in Resources.FindObjectsOfTypeAll<ItemInfo>())
			{
				if (!_allItemInfos.ContainsKey(((Object)item).name))
				{
					_allItemInfos.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allItemInfos.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ItemInfos");
			}
			log.LogInfo(val);
		}

		private static void LoadBlueprintConditionRules()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allBlueprintConditionRules = new Dictionary<string, BlueprintConditionsRule>();
			foreach (BlueprintConditionsRule item in Resources.FindObjectsOfTypeAll<BlueprintConditionsRule>())
			{
				if (!_allBlueprintConditionRules.ContainsKey(((Object)item).name))
				{
					_allBlueprintConditionRules.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allBlueprintConditionRules.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" BlueprintConditionsRules");
			}
			log.LogInfo(val);
		}

		private static void LoadItemCategoryInfos()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allItemCategoryInfos = new Dictionary<string, ItemCategoryInfo>();
			foreach (ItemCategoryInfo item in Resources.FindObjectsOfTypeAll<ItemCategoryInfo>())
			{
				if (!_allItemCategoryInfos.ContainsKey(((Object)item).name))
				{
					_allItemCategoryInfos.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allItemCategoryInfos.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ItemCategoryInfos");
			}
			log.LogInfo(val);
		}

		private static void LoadCraftInteractions()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allCraftInteractions = new Dictionary<string, CraftInteraction>();
			foreach (CraftInteraction item in Resources.FindObjectsOfTypeAll<CraftInteraction>())
			{
				if (!_allCraftInteractions.ContainsKey(((Object)item).name))
				{
					_allCraftInteractions.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allCraftInteractions.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" CraftInteractions");
			}
			log.LogInfo(val);
		}

		private static void LoadItemInfoLists()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allItemInfoLists = new Dictionary<string, ItemInfoList>();
			foreach (ItemInfoList item in Resources.FindObjectsOfTypeAll<ItemInfoList>())
			{
				if (!_allItemInfoLists.ContainsKey(((Object)item).name))
				{
					_allItemInfoLists.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allItemInfoLists.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ItemInfoLists");
			}
			log.LogInfo(val);
		}

		private static void LoadItemStorageClasses()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			_allItemStorageClasses = new Dictionary<string, ItemStorageClass>();
			foreach (ItemStorageClass item in Resources.FindObjectsOfTypeAll<ItemStorageClass>())
			{
				if (!_allItemStorageClasses.ContainsKey(((Object)item).name))
				{
					_allItemStorageClasses.Add(((Object)item).name, item);
				}
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ResourceInfoHelper] Loaded ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_allItemStorageClasses.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ItemStorageClasses");
			}
			log.LogInfo(val);
		}

		public static bool ItemExists(string name)
		{
			return _allItemInfos.ContainsKey(name);
		}

		public static bool MenuListExists(string name)
		{
			return _allItemInfoLists.ContainsKey(name);
		}

		public static bool RuleExists(string name)
		{
			return _allBlueprintConditionRules.ContainsKey(name);
		}

		public static bool CategoryExists(string name)
		{
			return _allItemCategoryInfos.ContainsKey(name);
		}

		public static bool InteractionExists(string name)
		{
			return _allCraftInteractions.ContainsKey(name);
		}
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.FileIO
{
	internal static class RecipeFileWriter
	{
		public static void Write(RecipeCollection collection, string filePath)
		{
			string contents = JsonSerializer.Serialize(collection, new JsonSerializerOptions
			{
				WriteIndented = true,
				DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
			});
			File.WriteAllText(filePath, contents);
		}
	}
	internal static class ReferenceDumper
	{
		private static string _referenceFolder;

		public static void DumpAllReferences(string pluginFolder)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			_referenceFolder = Path.Combine(pluginFolder, "Reference");
			Directory.CreateDirectory(_referenceFolder);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumping reference files to: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(_referenceFolder);
			}
			log.LogInfo(val);
			DumpItems();
			DumpMenuLists();
			DumpRules();
			DumpCategories();
			DumpInteractions();
			ManualLogSource log2 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(42, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Reference dump complete!");
			}
			log2.LogInfo(val);
		}

		private static void DumpItems()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string path = Path.Combine(_referenceFolder, "Items.txt");
			List<string> list = ResourceInfoHelper.AllItemInfos.Keys.OrderBy((string k) => k).ToList();
			List<string> list2 = ReferenceFilterUtility.FilterItems(list);
			File.WriteAllLines(path, list2);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumped ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list2.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" items (filtered from ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			log.LogInfo(val);
		}

		private static void DumpMenuLists()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string path = Path.Combine(_referenceFolder, "MenuLists.txt");
			List<string> list = ResourceInfoHelper.AllItemInfoLists.Keys.OrderBy((string k) => k).ToList();
			List<string> list2 = ReferenceFilterUtility.FilterMenuLists(list);
			File.WriteAllLines(path, list2);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumped ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list2.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" menu lists (filtered from ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			log.LogInfo(val);
		}

		private static void DumpRules()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string path = Path.Combine(_referenceFolder, "Rules.txt");
			List<string> list = ResourceInfoHelper.AllBlueprintConditionRules.Keys.OrderBy((string k) => k).ToList();
			List<string> list2 = ReferenceFilterUtility.FilterRules(list);
			File.WriteAllLines(path, list2);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumped ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list2.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" rules (filtered from ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			log.LogInfo(val);
		}

		private static void DumpCategories()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string path = Path.Combine(_referenceFolder, "Categories.txt");
			List<string> list = ResourceInfoHelper.AllItemCategoryInfos.Keys.OrderBy((string k) => k).ToList();
			List<string> list2 = ReferenceFilterUtility.FilterCategories(list);
			File.WriteAllLines(path, list2);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumped ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list2.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" categories (filtered from ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			log.LogInfo(val);
		}

		private static void DumpInteractions()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string path = Path.Combine(_referenceFolder, "Interactions.txt");
			List<string> list = ResourceInfoHelper.AllCraftInteractions.Keys.OrderBy((string k) => k).ToList();
			List<string> list2 = ReferenceFilterUtility.FilterInteractions(list);
			File.WriteAllLines(path, list2);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(55, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ReferenceDumper] Dumped ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list2.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" interactions (filtered from ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			log.LogInfo(val);
		}
	}
	public static class ReferenceFilterUtility
	{
		public static List<string> ParsePrefixList(string configValue)
		{
			if (!string.IsNullOrWhiteSpace(configValue))
			{
				return (from s in configValue.Split(',')
					select s.Trim().ToLower() into s
					where !string.IsNullOrEmpty(s)
					select s).ToList();
			}
			return new List<string>();
		}

		public static List<string> FilterByPrefixes(List<string> items, List<string> includePrefixes, List<string> excludePrefixes)
		{
			if (items == null || items.Count == 0)
			{
				return new List<string>();
			}
			List<string> list = ((includePrefixes == null || includePrefixes.Count <= 0) ? items.ToList() : items.Where((string item) => includePrefixes.Any((string prefix) => item.ToLower().StartsWith(prefix))).ToList());
			if (excludePrefixes != null && excludePrefixes.Count > 0)
			{
				list = list.Where((string item) => !excludePrefixes.Any((string prefix) => item.ToLower().StartsWith(prefix))).ToList();
			}
			return list;
		}

		public static List<string> FilterItems(List<string> items)
		{
			List<string> includePrefixes = ParsePrefixList(PluginConfig.ItemsIncludePrefixes.Value);
			List<string> excludePrefixes = ParsePrefixList(PluginConfig.ItemsExcludePrefixes.Value);
			return FilterByPrefixes(items, includePrefixes, excludePrefixes);
		}

		public static List<string> FilterCategories(List<string> categories)
		{
			List<string> includePrefixes = ParsePrefixList(PluginConfig.CategoriesIncludePrefixes.Value);
			List<string> excludePrefixes = ParsePrefixList(PluginConfig.CategoriesExcludePrefixes.Value);
			return FilterByPrefixes(categories, includePrefixes, excludePrefixes);
		}

		public static List<string> FilterMenuLists(List<string> menuLists)
		{
			List<string> includePrefixes = ParsePrefixList(PluginConfig.MenuListsIncludePrefixes.Value);
			List<string> excludePrefixes = ParsePrefixList(PluginConfig.MenuListsExcludePrefixes.Value);
			return FilterByPrefixes(menuLists, includePrefixes, excludePrefixes);
		}

		public static List<string> FilterInteractions(List<string> interactions)
		{
			List<string> includePrefixes = ParsePrefixList(PluginConfig.InteractionsIncludePrefixes.Value);
			List<string> excludePrefixes = ParsePrefixList(PluginConfig.InteractionsExcludePrefixes.Value);
			return FilterByPrefixes(interactions, includePrefixes, excludePrefixes);
		}

		public static List<string> FilterRules(List<string> rules)
		{
			List<string> includePrefixes = ParsePrefixList(PluginConfig.RulesIncludePrefixes.Value);
			List<string> excludePrefixes = ParsePrefixList(PluginConfig.RulesExcludePrefixes.Value);
			return FilterByPrefixes(rules, includePrefixes, excludePrefixes);
		}
	}
}
namespace Ranensol.BepInEx.Aska.CraftBlueprints.Blueprints
{
	internal static class BlueprintBuilder
	{
		public static List<BlueprintSpec> AllSpecs { get; private set; }

		public static List<CraftBlueprintInfo> BuildAll(List<BlueprintSpec> specs)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			AllSpecs = specs;
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BlueprintBuilder] Building ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(specs.Count);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" blueprints...");
			}
			log.LogInfo(val);
			List<CraftBlueprintInfo> list = new List<CraftBlueprintInfo>();
			int num = 0;
			int num2 = 0;
			foreach (BlueprintSpec spec in specs)
			{
				try
				{
					CraftBlueprintInfo item = BlueprintFactory.Create(spec);
					list.Add(item);
					num++;
				}
				catch (Exception ex)
				{
					ManualLogSource log2 = Plugin.Log;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(39, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BlueprintBuilder] Failed to build '");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(spec.Name);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("': ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
					}
					log2.LogError(val2);
					num2++;
				}
			}
			ManualLogSource log3 = Plugin.Log;
			val = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BlueprintBuilder] Complete: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" succeeded, ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" failed");
			}
			log3.LogInfo(val);
			return list;
		}
	}
	internal static class BlueprintFactory
	{
		private const float DEFAULT_CRAFT_VOLUME = 1f;

		private const int DEFAULT_STACK_SIZE = 1;

		private const int DEFAULT_SPAWN_HEIGHT = 1;

		private const string VIRTUAL_ITEM_STORAGE_CLASS = "VirtualItem";

		private const string BLUEPRINT_NAME_PREFIX = "BPNAME_Ranensol_";

		public static CraftBlueprintInfo Create(BlueprintSpec spec)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			ItemInfo resultItem = GetResultItem(spec.ResultItem);
			List<ItemInfoQuantity> ingredients = BuildIngredients(spec.Ingredients);
			CraftBlueprintInfo val = CreateBlueprintObject(spec, resultItem, ingredients);
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(36, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BlueprintFactory] Created '");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((ItemInfo)val).Name);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' (ID: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(((ItemInfo)val).id);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")");
			}
			log.LogInfo(val2);
			return val;
		}

		private static ItemInfo GetResultItem(string itemName)
		{
			if (ResourceInfoHelper.AllItemInfos.TryGetValue(itemName, out var value))
			{
				return value;
			}
			throw new ArgumentException("Result item '" + itemName + "' not found in game");
		}

		private static List<ItemInfoQuantity> BuildIngredients((string, int)[] ingredientSpecs)
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			List<ItemInfoQuantity> list = new List<ItemInfoQuantity>();
			for (int i = 0; i < ingredientSpecs.Length; i++)
			{
				var (text, quantity) = ingredientSpecs[i];
				if (!ResourceInfoHelper.AllItemInfos.TryGetValue(text, out var value))
				{
					throw new ArgumentException("Ingredient '" + text + "' not found in game");
				}
				list.Add(new ItemInfoQuantity
				{
					quantity = quantity,
					itemInfo = value
				});
			}
			return list;
		}

		private static CraftBlueprintInfo CreateBlueprintObject(BlueprintSpec spec, ItemInfo resultItem, List<ItemInfoQuantity> ingredients)
		{
			CraftBlueprintInfo obj = ScriptableObject.CreateInstance<CraftBlueprintInfo>();
			SetBasicProperties(obj, spec);
			SetRecipeData(obj, spec, resultItem, ingredients);
			SetUnlockRules(obj, spec);
			SetCategoryAndInteraction(obj, spec);
			SetLocalization(obj, spec, resultItem);
			SetVisualProperties(obj, resultItem);
			SetStorageProperties(obj);
			InitializeEmptyCollections(obj);
			return obj;
		}

		private static void SetBasicProperties(CraftBlueprintInfo blueprint, BlueprintSpec spec)
		{
			((Object)blueprint).name = $"{"BPNAME_Ranensol_"}{spec.Quantity}{spec.Name.Replace(" ", "")}";
			((ItemInfo)blueprint).unique = true;
			((ItemInfo)blueprint).id = spec.Id;
			blueprint.availableInTrialVersion = true;
			((ItemInfo)blueprint).showTier = false;
		}

		private static void SetRecipeData(CraftBlueprintInfo blueprint, BlueprintSpec spec, ItemInfo resultItem, List<ItemInfoQuantity> ingredients)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			((BlueprintInfo)blueprint).parts = Il2CppReferenceArray<ItemInfoQuantity>.op_Implicit(ingredients.ToArray());
			((BlueprintInfo)blueprint).result = resultItem;
			((BlueprintInfo)blueprint).quantity = spec.Quantity;
			((BlueprintInfo)blueprint).cost = new ItemInfoQuantity
			{
				itemInfo = null,
				quantity = 0
			};
		}

		private static void SetUnlockRules(CraftBlueprintInfo blueprint, BlueprintSpec spec)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			List<BlueprintConditionsRule> val = new List<BlueprintConditionsRule>();
			string[] rules = spec.Rules;
			bool flag = default(bool);
			foreach (string text in rules)
			{
				if (ResourceInfoHelper.AllBlueprintConditionRules.TryGetValue(text, out var value))
				{
					val.Add(value);
					continue;
				}
				ManualLogSource log = Plugin.Log;
				BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(44, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BlueprintFactory] Rule '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' not found in game");
				}
				log.LogWarning(val2);
			}
			blueprint.blueprintConditionsRules = val;
		}

		private static void SetCategoryAndInteraction(CraftBlueprintInfo blueprint, BlueprintSpec spec)
		{
			ItemCategoryInfo category = GetCategory(spec.Category);
			CraftInteraction interaction = GetInteraction(spec.Interaction);
			((ItemInfo)blueprint).category = category;
			blueprint.interaction = interaction;
			blueprint.craftVolume = 1f;
		}

		private static ItemCategoryInfo GetCategory(string categoryName)
		{
			if (ResourceInfoHelper.AllItemCategoryInfos.TryGetValue(categoryName, out var value))
			{
				return value;
			}
			throw new ArgumentException("Category '" + categoryName + "' not found in game");
		}

		private static CraftInteraction GetInteraction(string interactionName)
		{
			if (ResourceInfoHelper.AllCraftInteractions.TryGetValue(interactionName, out var value))
			{
				return value;
			}
			throw new ArgumentException("Interaction '" + interactionName + "' not found in game");
		}

		private static void SetLocalization(CraftBlueprintInfo blueprint, BlueprintSpec spec, ItemInfo resultItem)
		{
			((ItemInfo)blueprint).Localized = false;
			((ItemInfo)blueprint)._localized = true;
			((ItemInfo)blueprint).localizedName = spec.Name;
			((ItemInfo)blueprint).localizedDescription = ((!string.IsNullOrWhiteSpace(spec.Description)) ? spec.Description : (resultItem.localizedDescription ?? ("Craft " + spec.Name.ToLower())));
			((ItemInfo)blueprint).localizedLore = ((!string.IsNullOrWhiteSpace(spec.Lore)) ? spec.Lore : (resultItem.localizedLore ?? string.Empty));
		}

		private static void SetVisualProperties(CraftBlueprintInfo blueprint, ItemInfo resultItem)
		{
			((ItemInfo)blueprint).icon = resultItem.icon;
			((ItemInfo)blueprint).previewImage = resultItem.previewImage;
			((ItemInfo)blueprint).spawnObject = null;
		}

		private static void SetStorageProperties(CraftBlueprintInfo blueprint)
		{
			((ItemInfo)blueprint).storageClass = ResourceInfoHelper.AllItemStorageClasses["VirtualItem"];
			((ItemInfo)blueprint).stackSize = 1;
			((ItemInfo)blueprint).spawnHeight = 1f;
		}

		private static void InitializeEmptyCollections(CraftBlueprintInfo blueprint)
		{
			((ItemInfo)blueprint)._cachedComponents = new List<ItemInfo>();
			((ItemInfo)blueprint)._cachedComponentsTable = new Dictionary<ItemInfo, ValueTuple<int, int>>();
			((ItemInfo)blueprint).components = Il2CppReferenceArray<ItemInfoChance>.op_Implicit(Array.Empty<ItemInfoChance>());
			((ItemInfo)blueprint).attributes = Il2CppReferenceArray<AttributeData>.op_Implicit(Array.Empty<AttributeData>());
			((ItemInfo)blueprint).networkedInventoryAttributes = Il2CppReferenceArray<AttributeConfig>.op_Implicit(Array.Empty<AttributeConfig>());
			((ItemInfo)blueprint).processes = Il2CppReferenceArray<ItemProcess>.op_Implicit(Array.Empty<ItemProcess>());
		}
	}
	internal static class BlueprintMenuIntegration
	{
		public static int AddToMenus(List<BlueprintSpec> specs, List<CraftBlueprintInfo> blueprints)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			int num = 0;
			int num2 = Math.Min(specs.Count, blueprints.Count);
			for (int i = 0; i < num2; i++)
			{
				num += AddToMenus(specs[i], blueprints[i]);
			}
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BlueprintMenuIntegration] Total menu entries added: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
			}
			log.LogInfo(val);
			return num;
		}

		private static int AddToMenus(BlueprintSpec spec, CraftBlueprintInfo blueprint)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			int num = 0;
			string[] menuLists = spec.MenuLists;
			bool flag = default(bool);
			foreach (string text in menuLists)
			{
				if (!ResourceInfoHelper.AllItemInfoLists.TryGetValue(text, out var value))
				{
					ManualLogSource log = Plugin.Log;
					BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[BlueprintMenuIntegration] Menu '");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' not found in game");
					}
					log.LogWarning(val);
					continue;
				}
				value.itemInfoList.Add((ItemInfo)(object)blueprint);
				num++;
				ManualLogSource log2 = Plugin.Log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BlueprintMenuIntegration] Added '");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((ItemInfo)blueprint).Name);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' to ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
				}
				log2.LogInfo(val2);
			}
			return num;
		}
	}
	internal struct BlueprintSpec
	{
		public int Id { get; set; }

		public string ResultItem { get; set; }

		public string Name { get; set; }

		public (string, int)[] Ingredients { get; set; }

		public int Quantity { get; set; }

		public string[] MenuLists { get; set; }

		public string[] Rules { get; set; }

		public string Interaction { get; set; }

		public string Category { get; set; }

		public string Description { get; set; }

		public string Lore { get; set; }
	}
}