Decompiled source of Fantasy Armoury v0.1.8

FantasyArmoury.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FantasyArmoury")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FantasyArmoury")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5aaa456c-cbf4-4538-a960-91cc2a514da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FantasyArmoury;

[BepInPlugin("horemvore.FantasyArmoury", "FantasyArmoury", "0.1.8")]
[BepInIncompatibility("Azumatt.AzuDevMod")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class fantasyArmoury : BaseUnityPlugin
{
	public const string PluginGUID = "horemvore.FantasyArmoury";

	public const string PluginName = "FantasyArmoury";

	public const string PluginVersion = "0.1.8";

	public static bool isModded = true;

	private CustomLocalization Localization;

	public AssetBundle FAAssets;

	public AssetBundle FAAdditions;

	public GameObject furnacePiece;

	public GameObject firepitPiece;

	public GameObject pressPiece;

	public GameObject troughPiece;

	public string[] itemList = new string[42]
	{
		"Staff_2H_03_FA", "Staff_2H_04_FA", "Staff_2H_05_FA", "Sword_1H_01_FA", "Sword_1H_02_FA", "Sword_1H_03_FA", "Sword_1H_04_FA", "Sword_1H_05_FA", "Sword_2H_01_FA", "Sword_2H_02_FA",
		"Sword_2H_03_FA", "Sword_2H_04_FA", "Sword_2H_05_FA", "Sword_2H_06_FA", "Axe_1H_01_FA", "Axe_1H_02_FA", "Axe_1H_03_FA", "Axe_1H_04_FA", "Axe_1H_05_FA", "Axe_1H_06_FA",
		"Axe_1H_07_FA", "Axe2H_01_FA", "Axe2H_02_FA", "Axe2H_03_FA", "Axe2H_04_FA", "Axe2H_05_FA", "Axe2H_06_FA", "Hammer_2H_01_FA", "Hammer_2H_02_FA", "Hammer_2H_03_FA",
		"Scythe2H_01_FA", "Shield_01_FA", "Shield_02_FA", "Shield_03_FA", "Shield_04_FA", "Shield_05_FA", "Shield_06_FA", "Shield_07_FA", "Shield_08_FA", "Shield_09_FA",
		"Staff_2H_01_FA", "Staff_2H_02_FA"
	};

	private void Awake()
	{
		AddLocalizations();
		LoadBundle();
		CreateItems();
		AddForgeExtensions();
		PrefabManager.OnPrefabsRegistered += AddRecipesFromJson;
	}

	private void AddLocalizations()
	{
		try
		{
			Localization = LocalizationManager.Instance.GetLocalization();
			CustomLocalization localization = Localization;
			CustomLocalization localization2 = Localization;
			string text = "English";
			localization2.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "firepit_fa", "Firepit" },
				{ "firepit_desc_fa", "Adds 1 level to the Forge" },
				{ "furnace_fa", "Furnace" },
				{ "furnace_desc_fa", "Adds 1 level to the Forge" },
				{ "press_fa", "Press" },
				{ "press_desc_fa", "Adds 1 level to the Forge" },
				{ "trough_fa", "Trough" },
				{ "trough_desc_fa", "Adds 1 level to the Forge" },
				{ "item_sword2h_01_fa", "Frostsoul" },
				{ "item_sword2h_01_fa_description", "A weapon of ice and death." },
				{ "item_sword2h_02_fa", "The Unclean" },
				{ "item_sword2h_02_fa_description", "Blighted. They are all blighted." },
				{ "item_sword2h_03_fa", "Torment" },
				{ "item_sword2h_03_fa_description", "A weapon designed to cause anguishing pain." },
				{ "item_sword2h_04_fa", "Crystal Edge" },
				{ "item_sword2h_04_fa_description", "A sword with a rough blade of crystal, designed to both bludgeon and slice." },
				{ "item_sword2h_05_fa", "Silverwing" },
				{ "item_sword2h_05_fa_description", "Silver and ruby singing in harmony." },
				{ "item_sword2h_06_fa", "The Betrayer" },
				{ "item_sword2h_06_fa_description", "Cold-forged steel and a shaft of withered bone." },
				{ "item_sword1h_01_fa", "Fortune's Edge" },
				{ "item_sword1h_01_fa_description", "Gold runes bestow great luck upon the bearer of this weapon... for a price." },
				{ "item_sword1h_02_fa", "Soul Piercer" },
				{ "item_sword1h_02_fa_description", "Flesh can be mended, the soul cannot." },
				{ "item_sword1h_03_fa", "The Spellblade" },
				{ "item_sword1h_03_fa_description", "Infused with the elements by an unknown force." },
				{ "item_sword1h_04_fa", "Divine Light" },
				{ "item_sword1h_04_fa_description", "A gift from Asgard, engraved with fiery runes of power." },
				{ "item_sword1h_05_fa", "Ravenblade" },
				{ "item_sword1h_05_fa_description", "A cold blade empowered, they say, in the cover of night." },
				{ "item_staff2h_01_fa", "Arm of the Ent" },
				{ "item_staff2h_01_fa_description", "Ripped from an Ent and fashioned into a conduit for the very spirit of nature itself." },
				{ "item_staff2h_02_fa", "Greydwarf's Bane" },
				{ "item_staff2h_02_fa_description", "It sees the things they see. Eyes, the magic is in their eyes." },
				{ "item_staff2h_03_fa", "Talon" },
				{ "item_staff2h_03_fa_description", "Wicked sharp and viciously fast." },
				{ "item_staff2h_04_fa", "Dirty Pike" },
				{ "item_staff2h_04_fa_description", "The tip of this pike is laced with disease. Woe befalls those into whom's flesh it pierces." },
				{ "item_staff2h_05_fa", "The Martyr" },
				{ "item_staff2h_05_fa_description", "Blessed by seers from Midgard, this weapon found its way into the tenth world. Use it wisely." },
				{ "item_scythe2h_01_fa", "Pestilence" },
				{ "item_scythe2h_01_fa_description", "Decay, suffering, disease..." },
				{ "item_hammer2h_01_fa", "Rocksmasher" },
				{ "item_hammer2h_01_fa_description", "Anything can be smashed with the right tool. This is that tool." },
				{ "item_hammer2h_02_fa", "The Willbreaker" },
				{ "item_hammer2h_02_fa_description", "This hammer reigns down fiery judgement upon any and all who are deemed unclean." },
				{ "item_hammer2h_03_fa", "Shockpiercer" },
				{ "item_hammer2h_03_fa_description", "A gift, they say, left to the tenth world by Thor himself." },
				{ "item_axe1h_01_fa", "The Blood Spiller" },
				{ "item_axe1h_01_fa_description", "This axe is layered with spikes that both rend and puncture its target. It is a weapon of bloody death." },
				{ "item_axe1h_02_fa", "Moonsong" },
				{ "item_axe1h_02_fa_description", "With every swing, a song of violence." },
				{ "item_axe1h_03_fa", "Roughcut" },
				{ "item_axe1h_03_fa_description", "Built using scraps of metal and stone, this axe cuts deep and dirty." },
				{ "item_axe1h_04_fa", "Frozen Justice" },
				{ "item_axe1h_04_fa_description", "Justice, but colder!" },
				{ "item_axe1h_05_fa", "Ashes" },
				{ "item_axe1h_05_fa_description", "Everything burns, all will be ashen in the end." },
				{ "item_axe1h_06_fa", "The Harvester" },
				{ "item_axe1h_06_fa_description", "It thirst for souls; It is never sated." },
				{ "item_axe1h_07_fa", "Dryad Bane" },
				{ "item_axe1h_07_fa_description", "A blade grafted from the bark of the oldest of trees." },
				{ "item_axe2h_06_fa", "Ghoulblade, The Defiler" },
				{ "item_axe2h_06_fa_description", "Each swing cries with the voices of the long dead." },
				{ "item_axe2h_05_fa", "Spirit Sapling" },
				{ "item_axe2h_05_fa_description", "An axe they say is forged from a splinter of Yggdrasill itself." },
				{ "item_axe2h_04_fa", "Demonbite" },
				{ "item_axe2h_04_fa_description", "Laced with the living ooze of the swamplands, this blade inflicts wounds beyond flesh." },
				{ "item_axe2h_03_fa", "Scourgeborne" },
				{ "item_axe2h_03_fa_description", "This weapon was cast into the depths of the tenth world for being an abomination of nature. It is here you discovered the recipe. It is here you will wield its will." },
				{ "item_axe2h_02_fa", "Vengeance" },
				{ "item_axe2h_02_fa_description", "Vengeance persists, even through death. Of course, this axe can help with the death part." },
				{ "item_axe2h_01_fa", "Dire Axe" },
				{ "item_axe2h_01_fa_description", "A dirty weapon, designed to inflict unsealable wounds that both pierce and rend flesh." },
				{ "item_shield_09_tower_fa", "Pride" },
				{ "item_shield_09_tower_fa_description", "Courage and light fill the bearer of this shield." },
				{ "item_shield_08_tower_fa", "Rambore's Likeness" },
				{ "item_shield_08_tower_fa_description", "A shield carved to mimic the visage of Rambore." },
				{ "item_shield_07_tower_fa", "Cryptkeeper" },
				{ "item_shield_07_tower_fa_description", "The dead stay dead at the sight of The Cryptkeeper" },
				{ "item_shield_06_tower_fa", "Righteous Indignation" },
				{ "item_shield_06_tower_fa_description", "A holy glow emanates from the gem welded into this shield." },
				{ "item_shield_05_tower_fa", "Entwood Shield" },
				{ "item_shield_05_tower_fa_description", "This shield is crafted with the wood of the Ents themselves." },
				{ "item_shield_04_tower_fa", "The Watchful Eye" },
				{ "item_shield_04_tower_fa_description", "Heed its whispers for it sees all before it." },
				{ "item_shield_03_tower_fa", "Devil's Screech" },
				{ "item_shield_03_tower_fa_description", "Carved in the likeness of the devil himself from reagents of fire and fury." },
				{ "item_shield_02_tower_fa", "Skull, The Unbreaking" },
				{ "item_shield_02_tower_fa_description", "They say the skull is the hardest bone in the body, this shield puts that to the test." },
				{ "item_shield_01_tower_fa", "Talgane's Tear" },
				{ "item_shield_01_tower_fa_description", "Carved from the scales of dragons, this shield has unworldly durability to the elements." }
			});
			CustomLocalization localization3 = Localization;
			text = "Turkish";
			localization3.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "firepit_fa", "Firepit" },
				{ "firepit_desc_fa", "Adds 1 level to the Forge" },
				{ "furnace_fa", "Furnace" },
				{ "furnace_desc_fa", "Adds 1 level to the Forge" },
				{ "press_fa", "Press" },
				{ "press_desc_fa", "Adds 1 level to the Forge" },
				{ "trough_fa", "Trough" },
				{ "trough_desc_fa", "Adds 1 level to the Forge" },
				{ "item_sword2h_01_fa", "İnançbekleyen, Aydınlatılmış Rüyaların Ağıtı" },
				{ "item_sword2h_01_fa_description", "İnançbekleyen, çift elli bir kılıçtır." },
				{ "item_sword2h_02_fa", "Arındırançizik, Kayıp Seslerin Kılıcı" },
				{ "item_sword2h_02_fa_description", "Arındırançizik, çift elli bir kılıçtır." },
				{ "item_sword2h_03_fa", "Habiskovan" },
				{ "item_sword2h_03_fa_description", "Habiskovan, çift elli bir kılıçtır." },
				{ "item_sword2h_04_fa", "Kindarbüyü Kılıcı" },
				{ "item_sword2h_04_fa_description", "Kindarbüyü Kılıcı, çift elli bir kılıçtır." },
				{ "item_sword2h_05_fa", "Hesapkesen, Güneşgezen'in Hediyesi" },
				{ "item_sword2h_05_fa_description", "Hesapkesen, çift elli bir kılıçtır." },
				{ "item_sword2h_06_fa", "İhanetgezen" },
				{ "item_sword2h_06_fa_description", "İhanetgezen, çift elli bir kılıçtır." },
				{ "item_sword1h_01_fa", "Talih Kılıcı" },
				{ "item_sword1h_01_fa_description", "Talih Kılıcı, tek elli bir kılıçtır." },
				{ "item_sword1h_02_fa", "Ayinbozan" },
				{ "item_sword1h_02_fa_description", "Ayinbozan, tek elli bir kılıçtır." },
				{ "item_sword1h_03_fa", "Bilenmiş Büyükılıcı" },
				{ "item_sword1h_03_fa_description", "Bilenmiş Büyükılıcı, tek elli bir kılıçtır." },
				{ "item_sword1h_04_fa", "İlahiışık" },
				{ "item_sword1h_04_fa_description", "İlahiışık, tek elli bir kılıçtır." },
				{ "item_sword1h_05_fa", "Şehvetli Gümüş Dilimleyen" },
				{ "item_sword1h_05_fa_description", "Şehvetli Gümüş Dilimleyen, tek elli bir kılıçtır." },
				{ "item_staff2h_01_fa", "Yaraizi" },
				{ "item_staff2h_01_fa_description", "Yaraizi, çift elli bir asadır." },
				{ "item_staff2h_02_fa", "Kader" },
				{ "item_staff2h_02_fa_description", "Kader, çift elli bir asadır." },
				{ "item_staff2h_03_fa", "Sismoloji" },
				{ "item_staff2h_03_fa_description", "Sismoloji, çift elli bir asadır." },
				{ "item_staff2h_04_fa", "Kuyruklu Yıldız" },
				{ "item_staff2h_04_fa_description", "Kuyruklu Yıldız, çift elli bir asadır." },
				{ "item_staff2h_05_fa", "Uyurgezer" },
				{ "item_staff2h_05_fa_description", "Uyurgezer, çift elli bir asadır." },
				{ "item_scythe2h_01_fa", "Nesiltüketen" },
				{ "item_scythe2h_01_fa_description", "Nesiltüketen, çift elli bir tırpandır." },
				{ "item_hammer2h_01_fa", "Gözkarartan" },
				{ "item_hammer2h_01_fa_description", "Gözkarartan, çift elli bir balyozdur." },
				{ "item_hammer2h_02_fa", "İradekıran" },
				{ "item_hammer2h_02_fa_description", "İradekıran, çift elli bir balyozdur." },
				{ "item_hammer2h_03_fa", "Hesapezen" },
				{ "item_hammer2h_03_fa_description", "Hesapezen, çift elli bir balyozdur." },
				{ "item_axe1h_01_fa", "Azapçeken" },
				{ "item_axe1h_01_fa_description", "Azapçeken, tek elli bir baltadır." },
				{ "item_axe1h_02_fa", "Celeste" },
				{ "item_axe1h_02_fa_description", "Celeste, tek elli bir baltadır." },
				{ "item_axe1h_03_fa", "Nirvana" },
				{ "item_axe1h_03_fa_description", "Nirvana, tek elli bir baltadır." },
				{ "item_axe1h_04_fa", "İspatyırtan" },
				{ "item_axe1h_04_fa_description", "İspatyırtan, tek elli bir baltadır." },
				{ "item_axe1h_05_fa", "Küldiyar" },
				{ "item_axe1h_05_fa_description", "Küldiyar, tek elli bir baltadır." },
				{ "item_axe1h_06_fa", "Biçerdöver" },
				{ "item_axe1h_06_fa_description", "Biçerdöver, tek elli bir baltadır." },
				{ "item_axe1h_07_fa", "Umut Yağmalayan" },
				{ "item_axe1h_07_fa_description", "Umut Yağmalayan, tek elli bir baltadır." },
				{ "item_axe2h_06_fa", "Ruhkesen" },
				{ "item_axe2h_06_fa_description", "Ruhkesen, çift elli bir baltadır." },
				{ "item_axe2h_05_fa", "Omurgabiçen" },
				{ "item_axe2h_05_fa_description", "Omurgabiçen, çift elli bir baltadır." },
				{ "item_axe2h_04_fa", "Narkoleptik" },
				{ "item_axe2h_04_fa_description", "Narkoleptik, çift elli bir baltadır." },
				{ "item_axe2h_03_fa", "Belakesik" },
				{ "item_axe2h_03_fa_description", "Belakesik, çift elli bir baltadır." },
				{ "item_axe2h_02_fa", "Sözkesen" },
				{ "item_axe2h_02_fa_description", "Sözkesen, çift elli bir baltadır." },
				{ "item_axe2h_01_fa", "Korkunç Balta" },
				{ "item_axe2h_01_fa_description", "Korkunç Balta, çift elli bir baltadır." },
				{ "item_shield_09_tower_fa", "Barış Muhafızı" },
				{ "item_shield_09_tower_fa_description", "Barış Muhafızı, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_08_tower_fa", "Zehir Kesen Kalkan" },
				{ "item_shield_08_tower_fa_description", "Zehir Kesen Kalkan, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_07_tower_fa", "Susamış İskelet Kalkanı" },
				{ "item_shield_07_tower_fa_description", "Susamış İskelet Kalkanı, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_06_tower_fa", "Lejyoner Kalkanı" },
				{ "item_shield_06_tower_fa_description", "Lejyoner Kalkanı, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_05_tower_fa", "Arzunun Söğüt Kalkanı" },
				{ "item_shield_05_tower_fa_description", "Arzunun Söğüt Kalkanı, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_04_tower_fa", "Şehvetli Muhafız" },
				{ "item_shield_04_tower_fa_description", "Şehvetli Muhafız, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_03_tower_fa", "Kanlı Büyük Kalkan" },
				{ "item_shield_03_tower_fa_description", "Kanlı Büyük Kalkan, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_02_tower_fa", "Kirlenmiş Kalkan Duvar" },
				{ "item_shield_02_tower_fa_description", "Kirlenmiş Kalkan Duvar, sizi saldırılardan koruyan bir kalkandır." },
				{ "item_shield_01_tower_fa", "Hüzün Koruyucusu" },
				{ "item_shield_01_tower_fa_description", "Hüzün Koruyucusu, sizi saldırılardan koruyan bir kalkandır." }
			});
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding Localication for Deds Army: {arg}");
		}
	}

	public void LoadBundle()
	{
		FAAssets = AssetUtils.LoadAssetBundleFromResources("fabundle", Assembly.GetExecutingAssembly());
		FAAdditions = AssetUtils.LoadAssetBundleFromResources("smithfa", Assembly.GetExecutingAssembly());
	}

	private void AddForgeExtensions()
	{
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Expected O, but got Unknown
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Expected O, but got Unknown
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Expected O, but got Unknown
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Expected O, but got Unknown
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Expected O, but got Unknown
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Expected O, but got Unknown
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Expected O, but got Unknown
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Expected O, but got Unknown
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Expected O, but got Unknown
		try
		{
			furnacePiece = FAAdditions.LoadAsset<GameObject>("Furnace_FA");
			firepitPiece = FAAdditions.LoadAsset<GameObject>("Firepit_FA");
			pressPiece = FAAdditions.LoadAsset<GameObject>("Press_FA");
			troughPiece = FAAdditions.LoadAsset<GameObject>("Trough_FA");
			GameObject obj = furnacePiece;
			PieceConfig val = new PieceConfig();
			val.PieceTable = "_HammerPieceTable";
			val.Category = "Armoury";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "BlackMetal",
					Amount = 35,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "Coal",
					Amount = 20,
					Recover = true
				}
			};
			CustomPiece val2 = new CustomPiece(obj, false, val);
			PieceManager.Instance.AddPiece(val2);
			GameObject obj2 = pressPiece;
			val = new PieceConfig();
			val.PieceTable = "_HammerPieceTable";
			val.Category = "Armoury";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "BlackMetal",
					Amount = 25,
					Recover = true
				}
			};
			CustomPiece val3 = new CustomPiece(obj2, false, val);
			PieceManager.Instance.AddPiece(val3);
			GameObject obj3 = troughPiece;
			val = new PieceConfig();
			val.PieceTable = "_HammerPieceTable";
			val.Category = "Armoury";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "BlackMetal",
					Amount = 20,
					Recover = true
				}
			};
			CustomPiece val4 = new CustomPiece(obj3, false, val);
			PieceManager.Instance.AddPiece(val4);
			GameObject obj4 = firepitPiece;
			val = new PieceConfig();
			val.PieceTable = "_HammerPieceTable";
			val.Category = "Armoury";
			val.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "Stone",
					Amount = 25,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "Coal",
					Amount = 20,
					Recover = true
				}
			};
			CustomPiece val5 = new CustomPiece(obj4, false, val);
			PieceManager.Instance.AddPiece(val5);
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding Items: {arg}");
		}
		finally
		{
			UnloadBundleAdditions();
		}
	}

	private void CreateItems()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		try
		{
			string[] array = itemList;
			foreach (string text in array)
			{
				GameObject prefab = PrefabManager.Instance.GetPrefab(text);
				if ((Object)(object)prefab == (Object)null)
				{
					GameObject val = FAAssets.LoadAsset<GameObject>(text);
					CustomItem val2 = new CustomItem(val, true);
					ItemManager.Instance.AddItem(val2);
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding class items: {arg}");
		}
		finally
		{
			UnloadBundleAssets();
		}
	}

	private void AddRecipesFromJson()
	{
		try
		{
			string[] files = Directory.GetFiles(Path.Combine(Paths.ConfigPath, "Horem/FantasyArmoury/Recipes"), "*.json", SearchOption.AllDirectories);
			foreach (string text in files)
			{
				if (text != null)
				{
					ItemManager.Instance.AddRecipesFromJson(text);
				}
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while adding recipes from json files: {arg}");
		}
		finally
		{
			PrefabManager.OnPrefabsRegistered -= AddRecipesFromJson;
		}
	}

	public void UnloadBundleAdditions()
	{
		try
		{
			AssetBundle fAAdditions = FAAdditions;
			if (fAAdditions != null)
			{
				fAAdditions.Unload(false);
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while unloading Bundle: {arg}");
		}
	}

	public void UnloadBundleAssets()
	{
		try
		{
			AssetBundle fAAssets = FAAssets;
			if (fAAssets != null)
			{
				fAAssets.Unload(false);
			}
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)$"Exception caught while unloading Bundle: {arg}");
		}
	}
}