Decompiled source of MarsarahMod v5.2.7

MarsarahMod.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using JetBrains.Annotations;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MarsarahMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MarsarahMod")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5ef8741-f8ae-4520-90e7-70f066991530")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MarsarahMod;

internal class MMArmorStats
{
	[HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })]
	public class eitrFromMageGear_Patch
	{
		public static void Prefix(Player __instance)
		{
			if (!((Object)(object)__instance != (Object)null))
			{
				return;
			}
			if (MMConfigManager.mageGearGivesEitrEnabled)
			{
				eitrFromGear = 0f;
				Inventory inventory = ((Humanoid)__instance).GetInventory();
				List<ItemData> equippedItems = inventory.GetEquippedItems();
				foreach (ItemData item in equippedItems)
				{
					switch (item.m_shared.m_name)
					{
					case "$item_helmet_mage":
						eitrFromGear += mageHeadEitr;
						break;
					case "$item_chest_mage":
						eitrFromGear += mageChestEitr;
						break;
					case "$item_legs_mage":
						eitrFromGear += mageLegsEitr;
						break;
					case "$item_helmet_mage_ashlands":
						eitrFromGear += mageHeadEitrAshlands;
						break;
					case "$item_chest_mage_ashlands":
						eitrFromGear += mageChestEitrAshlands;
						break;
					case "$item_legs_mage_ashlands":
						eitrFromGear += mageLegsEitrAshlands;
						break;
					}
				}
			}
			if (!MMConfigManager.moreArmorStatsEnabled)
			{
				return;
			}
			hpFromGear = 0f;
			staminaFromGear = 0f;
			Inventory inventory2 = ((Humanoid)__instance).GetInventory();
			List<ItemData> equippedItems2 = inventory2.GetEquippedItems();
			foreach (ItemData item2 in equippedItems2)
			{
				switch (item2.m_shared.m_name)
				{
				case "$item_helmet_bronze":
					hpFromGear += bronzeHeadHP;
					break;
				case "$item_chest_bronze":
					hpFromGear += bronzeChestHP;
					break;
				case "$item_legs_bronze":
					hpFromGear += bronzeLegsHP;
					break;
				case "$item_helmet_iron":
					hpFromGear += ironHeadHP;
					break;
				case "$item_chest_iron":
					hpFromGear += ironChestHP;
					break;
				case "$item_legs_iron":
					hpFromGear += ironLegsHP;
					break;
				case "$item_helmet_drake":
					hpFromGear += silverHeadHP;
					break;
				case "$item_chest_wolf":
					hpFromGear += silverChestHP;
					break;
				case "$item_legs_wolf":
					hpFromGear += silverLegsHP;
					break;
				case "$item_helmet_padded":
					hpFromGear += paddedHeadHP;
					break;
				case "$item_chest_pcuirass":
					hpFromGear += paddedChestHP;
					break;
				case "$item_legs_pgreaves":
					hpFromGear += paddedLegsHP;
					break;
				case "$item_helmet_carapace":
					hpFromGear += carapaceHeadHP;
					break;
				case "$item_chest_carapace":
					hpFromGear += carapaceChestHP;
					break;
				case "$item_legs_carapace":
					hpFromGear += carapaceLegsHP;
					break;
				case "$item_helmet_flametal":
					hpFromGear += flametalHeadHP;
					break;
				case "$item_chest_flametal":
					hpFromGear += flametalChestHP;
					break;
				case "$item_legs_flametal":
					hpFromGear += flametalLegsHP;
					break;
				case "$item_helmet_medium_ashlands":
					hpFromGear += askHeadHP;
					staminaFromGear += askHeadStamina;
					break;
				case "$item_chest_medium_ashlands":
					hpFromGear += askChestHP;
					staminaFromGear += askChestStamina;
					break;
				case "$item_legs_medium_ashlands":
					hpFromGear += askLegsHP;
					staminaFromGear += askLegsStamina;
					break;
				case "$item_helmet_trollleather":
					staminaFromGear += trollHeadStamina;
					break;
				case "$item_chest_trollleather":
					staminaFromGear += trollChestStamina;
					break;
				case "$item_legs_trollleather":
					staminaFromGear += trollLegsStamina;
					break;
				case "$item_helmet_root":
					staminaFromGear += rootHeadStamina;
					break;
				case "$item_chest_root":
					staminaFromGear += rootChestStamina;
					break;
				case "$item_legs_root":
					staminaFromGear += rootLegsStamina;
					break;
				case "$item_helmet_fenris":
					staminaFromGear += fenrisHeadStamina;
					break;
				case "$item_chest_fenris":
					staminaFromGear += fenrisChestStamina;
					break;
				case "$item_legs_fenris":
					staminaFromGear += fenrisLegsStamina;
					break;
				}
			}
		}
	}

	[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
	public class BaseEitr_Patch
	{
		public static void Postfix(ref float hp, ref float stamina, ref float eitr)
		{
			if (MMConfigManager.mageGearGivesEitrEnabled)
			{
				eitr += eitrFromGear;
			}
			if (MMConfigManager.moreArmorStatsEnabled)
			{
				hp += hpFromGear;
				stamina += staminaFromGear;
			}
		}
	}

	private static float hpFromGear;

	private static float staminaFromGear;

	private static float eitrFromGear;

	private static int bronzeHeadHP;

	private static int bronzeChestHP;

	private static int bronzeLegsHP;

	private static int ironHeadHP;

	private static int ironChestHP;

	private static int ironLegsHP;

	private static int silverHeadHP;

	private static int silverChestHP;

	private static int silverLegsHP;

	private static int paddedHeadHP;

	private static int paddedChestHP;

	private static int paddedLegsHP;

	private static int carapaceHeadHP;

	private static int carapaceChestHP;

	private static int carapaceLegsHP;

	private static int flametalHeadHP;

	private static int flametalChestHP;

	private static int flametalLegsHP;

	private static int askHeadHP;

	private static int askChestHP;

	private static int askLegsHP;

	private static int trollHeadStamina;

	private static int trollChestStamina;

	private static int trollLegsStamina;

	private static int rootHeadStamina;

	private static int rootChestStamina;

	private static int rootLegsStamina;

	private static int fenrisHeadStamina;

	private static int fenrisChestStamina;

	private static int fenrisLegsStamina;

	private static int askHeadStamina;

	private static int askChestStamina;

	private static int askLegsStamina;

	private static int mageHeadEitr;

	private static int mageChestEitr;

	private static int mageLegsEitr;

	private static int mageHeadEitrAshlands;

	private static int mageChestEitrAshlands;

	private static int mageLegsEitrAshlands;

	public static void InitializeArmorStatsData()
	{
		hpFromGear = 0f;
		staminaFromGear = 0f;
		eitrFromGear = 0f;
		bronzeHeadHP = 2;
		bronzeChestHP = 4;
		bronzeLegsHP = 4;
		ironHeadHP = 4;
		ironChestHP = 8;
		ironLegsHP = 8;
		silverHeadHP = 8;
		silverChestHP = 12;
		silverLegsHP = 10;
		paddedHeadHP = 10;
		paddedChestHP = 16;
		paddedLegsHP = 14;
		carapaceHeadHP = 12;
		carapaceChestHP = 20;
		carapaceLegsHP = 18;
		flametalHeadHP = 14;
		flametalChestHP = 24;
		flametalLegsHP = 22;
		askHeadHP = 5;
		askChestHP = 10;
		askLegsHP = 10;
		trollHeadStamina = 1;
		trollChestStamina = 2;
		trollLegsStamina = 2;
		rootHeadStamina = 3;
		rootChestStamina = 4;
		rootLegsStamina = 3;
		fenrisHeadStamina = 4;
		fenrisChestStamina = 6;
		fenrisLegsStamina = 5;
		askHeadStamina = 5;
		askChestStamina = 8;
		askLegsStamina = 7;
		mageHeadEitr = 10;
		mageChestEitr = 20;
		mageLegsEitr = 20;
		mageHeadEitrAshlands = 15;
		mageChestEitrAshlands = 30;
		mageLegsEitrAshlands = 30;
	}
}
internal class MMArrowSlots
{
	[HarmonyPatch(typeof(InventoryGrid), "UpdateGui", new Type[]
	{
		typeof(Player),
		typeof(ItemData)
	})]
	public static class ArrowSlots_Patch
	{
	}
}
internal class MMClearMistlands
{
	[HarmonyPatch(typeof(ZoneSystem), "Update")]
	private class ClearMistlandsQueenCheck_Patch
	{
		private static void Prefix(ZoneSystem __instance)
		{
			queenDefeated = false;
			if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null)
			{
				List<string> globalKeys = __instance.GetGlobalKeys();
				if (globalKeys.Contains("defeated_queen"))
				{
					queenDefeated = true;
				}
			}
		}
	}

	[HarmonyPatch(typeof(MistEmitter), "Update")]
	private class ClearMistlandsEmitter_Patch
	{
		private static void Prefix(MistEmitter __instance)
		{
			if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null && queenDefeated)
			{
				((Component)__instance).gameObject.SetActive(false);
			}
		}
	}

	[HarmonyPatch(typeof(ParticleMist), "Update")]
	private class ClearMistlandsParticle_Patch
	{
		private static void Postfix(ParticleMist __instance)
		{
			if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null && queenDefeated)
			{
				((Component)__instance).gameObject.SetActive(false);
			}
		}
	}

	private static bool queenDefeated;
}
internal class MMCraftableChain
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private class CraftableChain_Patch
	{
		private static void Postfix(ObjectDB __instance)
		{
			if (!MMConfigManager.craftableChainEnabled || !((Object)(object)__instance != (Object)null))
			{
				return;
			}
			Recipe val = __instance.m_recipes.Find((Recipe r) => ((Object)r).name == "Recipe_Chain");
			if ((Object)(object)val == (Object)null)
			{
				val = CreateChainRecipe(ref __instance);
				if ((Object)(object)val != (Object)null)
				{
					__instance.m_recipes.Add(val);
				}
			}
		}
	}

	private static Recipe CreateChainRecipe(ref ObjectDB objDB)
	{
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		Recipe val = null;
		GameObject val2 = objDB.m_items.Find((GameObject i) => ((Object)i).name == "Chain");
		GameObject val3 = objDB.m_items.Find((GameObject i) => ((Object)i).name == "Iron");
		Recipe val4 = objDB.m_recipes.Find((Recipe r) => ((Object)r).name == "Recipe_Lantern");
		if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
		{
			val = ScriptableObject.CreateInstance<Recipe>();
			val.m_item = val2.GetComponent<ItemDrop>();
			val.m_amount = 2;
			val.m_minStationLevel = 1;
			val.m_resources = (Requirement[])(object)new Requirement[1];
			val.m_resources[0] = new Requirement();
			val.m_resources[0].m_amount = 1;
			val.m_resources[0].m_amountPerLevel = 1;
			val.m_resources[0].m_recover = true;
			val.m_resources[0].m_resItem = val3.GetComponent<ItemDrop>();
			((Object)val).hideFlags = ((Object)val4).hideFlags;
			val.m_craftingStation = val4.m_craftingStation;
			val.m_repairStation = val4.m_repairStation;
			((Object)val).name = "Recipe_Chain";
			val.m_enabled = true;
		}
		return val;
	}
}
internal class MMCreatureUnleveler
{
	[HarmonyPatch(typeof(ZoneSystem), "Update")]
	private class ClearMistlandsQueenCheck_Patch
	{
		private static void Prefix(ZoneSystem __instance)
		{
			eikthyrDefeated = false;
			elderDefeated = false;
			bonemassDefeated = false;
			moderDefeated = false;
			yagluthDefeated = false;
			queenDefeated = false;
			faderDefeated = false;
			if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null)
			{
				List<string> globalKeys = __instance.GetGlobalKeys();
				if (globalKeys.Contains("defeated_eikthyr"))
				{
					eikthyrDefeated = true;
				}
				if (globalKeys.Contains("defeated_gdking"))
				{
					elderDefeated = true;
				}
				if (globalKeys.Contains("defeated_bonemass"))
				{
					bonemassDefeated = true;
				}
				if (globalKeys.Contains("defeated_dragon"))
				{
					moderDefeated = true;
				}
				if (globalKeys.Contains("defeated_goblinking"))
				{
					yagluthDefeated = true;
				}
				if (globalKeys.Contains("defeated_queen"))
				{
					queenDefeated = true;
				}
				if (globalKeys.Contains("defeated_fader"))
				{
					faderDefeated = true;
				}
			}
		}
	}

	[HarmonyPatch(typeof(SpawnSystem), "Awake")]
	private static class RemoveMinimumDistanceForStars
	{
		private static void Postfix(SpawnSystem __instance)
		{
			if (!((Object)(object)__instance != (Object)null) || !MMConfigManager.creatureUnlevelerEnabled)
			{
				return;
			}
			foreach (SpawnSystemList spawnList in __instance.m_spawnLists)
			{
				foreach (SpawnData spawner in spawnList.m_spawners)
				{
					if (eikthyrDefeated)
					{
						switch (spawner.m_name)
						{
						case "deer":
							spawner.m_overrideLevelupChance = 15f;
							break;
						case "Boar":
						case "Neck lakes":
						case "Neck IN RAIN":
							spawner.m_overrideLevelupChance = 15f;
							spawner.m_levelUpMinCenterDistance = 400f;
							break;
						case "Greyling":
							spawner.m_overrideLevelupChance = 15f;
							spawner.m_maxLevel = 2;
							break;
						}
					}
					if (elderDefeated)
					{
						switch (spawner.m_name)
						{
						case "greydwarf DAY":
						case "greydwarf Night":
							spawner.m_overrideLevelupChance = 20f;
							break;
						case "Boar":
						case "Neck lakes":
						case "Neck IN RAIN":
						case "greydwarf ELITE":
						case "Troll":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_levelUpMinCenterDistance = 0f;
							break;
						case "Greyling":
						case "greydwarf After boss":
						case "Greydwarf Elite":
						case "Greydwarf Shaman":
						case "Greydwarf":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						}
					}
					if (bonemassDefeated)
					{
						switch (spawner.m_name)
						{
						case "Marsh draugr":
						case "Leech":
							spawner.m_overrideLevelupChance = 20f;
							break;
						case "Skeleton":
						case "Draugr":
						case "Draugr Elite":
						case "Marsh surtling":
						case "Surtling":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						case "Boar":
						case "Neck lakes":
						case "Neck IN RAIN":
						case "greydwarf ELITE":
						case "greydwarf DAY":
						case "greydwarf Night":
						case "Greyling":
						case "greydwarf After boss":
						case "Greydwarf Elite":
						case "Greydwarf Shaman":
						case "Greydwarf":
							spawner.m_overrideLevelupChance = 30f;
							break;
						}
					}
					if (moderDefeated)
					{
						switch (spawner.m_name)
						{
						case "Fenring":
							spawner.m_overrideLevelupChance = 10f;
							spawner.m_maxLevel = 2;
							break;
						case "Wolf":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						case "Troll":
							spawner.m_overrideLevelupChance = 30f;
							break;
						case "Skeleton":
						case "Marsh draugr":
						case "Draugr":
						case "Draugr Elite":
						case "Marsh surtling":
						case "Surtling":
							spawner.m_overrideLevelupChance = 30f;
							break;
						}
					}
					if (yagluthDefeated)
					{
						switch (spawner.m_name)
						{
						case "GoblinBrute":
							spawner.m_overrideLevelupChance = 20f;
							break;
						case "Goblin":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						case "Blob":
						case "BlobElite":
						case "Wraith":
						case "Abomination":
						case "StoneGolem":
						case "Hatchling":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 2;
							break;
						case "Fenring":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						case "Wolf":
							spawner.m_overrideLevelupChance = 30f;
							break;
						}
					}
					if (queenDefeated)
					{
						switch (spawner.m_name)
						{
						case "Dverger":
						case "Seeker Brute":
						case "Tick defeated queen other biomes":
							spawner.m_overrideLevelupChance = 20f;
							break;
						case "Seeker defeated queen other biomes":
						case "SeekerBrood  defeated queen other biomes":
							spawner.m_overrideLevelupChance = 10f;
							spawner.m_maxLevel = 2;
							break;
						case "Seeker":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 3;
							break;
						case "Lox":
						case "Deathsquito":
							spawner.m_overrideLevelupChance = 20f;
							spawner.m_maxLevel = 2;
							break;
						case "Goblin":
						case "GoblinBrute":
							spawner.m_overrideLevelupChance = 30f;
							break;
						}
					}
					if (faderDefeated)
					{
						switch (spawner.m_name)
						{
						case "Dverger":
							spawner.m_overrideLevelupChance = 30f;
							break;
						case "Charred Melee [Other biomes when Fader is defeated]":
						case "Charred Archer [Other biomes when Fader is defeated]":
							spawner.m_overrideLevelupChance = 10f;
							spawner.m_maxLevel = 2;
							break;
						}
					}
				}
			}
		}
	}

	private static bool eikthyrDefeated;

	private static bool elderDefeated;

	private static bool bonemassDefeated;

	private static bool moderDefeated;

	private static bool yagluthDefeated;

	private static bool queenDefeated;

	private static bool faderDefeated;
}
internal class MMGearSpeedChanges
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private class GearSpeed_Patch
	{
		private static List<ItemDrop> chestItems;

		private static List<ItemDrop> legsItems;

		private static List<ItemDrop> twoHWItems;

		private static List<ItemDrop> shieldItems;

		private static void Prefix(ref ObjectDB __instance)
		{
			if (MMConfigManager.altGearSpeedModifiersEnabled)
			{
				GetItems(ref __instance);
				ModifySpeed();
			}
		}

		private static void GetItems(ref ObjectDB objDB)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType));
			ItemType val = (ItemType)0;
			ItemType val2 = (ItemType)0;
			ItemType val3 = (ItemType)0;
			ItemType val4 = (ItemType)0;
			ItemType[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				ItemType val5 = array2[i];
				if (((object)(ItemType)(ref val5)).ToString() == "Chest")
				{
					val = val5;
				}
				if (((object)(ItemType)(ref val5)).ToString() == "Legs")
				{
					val2 = val5;
				}
				if (((object)(ItemType)(ref val5)).ToString() == "TwoHandedWeapon")
				{
					val3 = val5;
				}
				if (((object)(ItemType)(ref val5)).ToString() == "Shield")
				{
					val4 = val5;
				}
			}
			chestItems = objDB.GetAllItems(val, "");
			legsItems = objDB.GetAllItems(val2, "");
			twoHWItems = objDB.GetAllItems(val3, "");
			shieldItems = objDB.GetAllItems(val4, "");
		}

		private static void ModifySpeed()
		{
			foreach (ItemDrop chestItem in chestItems)
			{
				switch (((Object)chestItem).name)
				{
				case "ArmorBronzeChest":
				case "ArmorIronChest":
				case "ArmorWolfChest":
				case "ArmorPaddedCuirass":
				case "ArmorCarapaceChest":
				case "ArmorFlametalChest":
				case "ArmorMageChest":
				case "ArmorMageChest_Ashlands":
					chestItem.m_itemData.m_shared.m_movementModifier = 0f;
					break;
				case "ArmorTrollLeatherChest":
				case "ArmorAshlandsMediumChest":
					chestItem.m_itemData.m_shared.m_movementModifier = 0.02f;
					break;
				case "ArmorRootChest":
					chestItem.m_itemData.m_shared.m_movementModifier = 0.01f;
					break;
				}
			}
			foreach (ItemDrop legsItem in legsItems)
			{
				switch (((Object)legsItem).name)
				{
				case "ArmorBronzeLegs":
				case "ArmorIronLegs":
				case "ArmorWolfLegs":
				case "ArmorPaddedGreaves":
				case "ArmorCarapaceLegs":
				case "ArmorFlametalLegs":
				case "ArmorMageLegs":
				case "ArmorMageLegs_Ashlands":
					legsItem.m_itemData.m_shared.m_movementModifier = 0f;
					break;
				case "ArmorTrollLeatherLegs":
				case "ArmorAshlandsMediumlegs":
					legsItem.m_itemData.m_shared.m_movementModifier = 0.02f;
					break;
				case "ArmorRootLegs":
					legsItem.m_itemData.m_shared.m_movementModifier = 0.01f;
					break;
				}
			}
			foreach (ItemDrop twoHWItem in twoHWItems)
			{
				string name = ((Object)twoHWItem).name;
				string text = name;
				if (text == "Battleaxe" || text == "BattleaxeCrystal")
				{
					twoHWItem.m_itemData.m_shared.m_movementModifier = -0.05f;
				}
			}
			foreach (ItemDrop shieldItem in shieldItems)
			{
				switch (((Object)shieldItem).name)
				{
				case "ShieldFlametalTower":
				case "ShieldBlackmetalTower":
				case "ShieldBoneTower":
				case "ShieldIronTower":
				case "ShieldWoodTower":
					shieldItem.m_itemData.m_shared.m_movementModifier = -0.1f;
					break;
				case "ShieldSerpentscale":
					shieldItem.m_itemData.m_shared.m_movementModifier = -0.05f;
					break;
				}
			}
		}
	}
}
internal class MMGearUpgradeUnlocker
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private class GearUpgradeUnlock_Patch
	{
		private static void Prefix(ref ObjectDB __instance)
		{
			if (!MMConfigManager.gearUpgradeUnlockEnabled)
			{
				return;
			}
			foreach (Recipe recipe in __instance.m_recipes)
			{
				switch (((Object)recipe).name)
				{
				case "Recipe_HelmetBronze":
				case "Recipe_ArmorBronzeChest":
				case "Recipe_ArmorBronzeLegs":
				case "Recipe_AtgeirBronze":
				case "Recipe_AxeBronze":
				case "Recipe_KnifeCopper":
				case "Recipe_MaceBronze":
				case "Recipe_PickaxeBronze":
				case "Recipe_SpearBronze":
				case "Recipe_SwordBronze":
				case "Recipe_HelmetMage":
				case "Recipe_ArmorMageChest":
				case "Recipe_ArmorMageLegs":
				case "Recipe_CapeFeather":
				case "Recipe_StaffFireball":
				case "Recipe_StaffIceShards":
				case "Recipe_StaffShield":
				case "Recipe_StaffSkeleton":
				case "Recipe_ArmorCarapaceChest":
				case "Recipe_ArmorCarapaceLegs":
				case "Recipe_HelmetCarapace":
				case "Recipe_AxeJotunBane":
				case "Recipe_SpearCarapace":
				case "Recipe_SwordMistwalker":
				case "Recipe_AtgeirHimminAfl":
				case "Recipe_KnifeSkollAndHati":
				case "Recipe_SledgeDemolisher":
				case "Recipe_SwordKrom":
				case "Recipe_BowSpineSnap":
				case "Recipe_CrossbowArbalest":
					recipe.m_minStationLevel = 0;
					break;
				case "Recipe_HelmetLeather":
				case "Recipe_ArmorLeatherChest":
				case "Recipe_ArmorLeatherLegs":
				case "Recipe_CapeDeerHide":
				case "Recipe_HelmetTrollLeather":
				case "Recipe_ArmorTrollLeatherChest":
				case "Recipe_ArmorTrollLeatherLegs":
				case "Recipe_CapeTrollHide":
				case "Recipe_SledgeStagbreaker":
				case "Recipe_HelmetMage_Ashlands":
				case "Recipe_ArmorMageChest_Ashlands":
				case "Recipe_ArmorMageLegs_Ashlands":
				case "Recipe_CapeAsksvin":
				case "Recipe_StaffClusterbomb":
				case "Recipe_StaffGreenRoots":
				case "Recipe_StaffLightning":
				case "Recipe_StaffRedTroll":
					recipe.m_minStationLevel = 1;
					break;
				case "Recipe_HelmetMedium_Ashlands":
				case "Recipe_ArmorMediumChest_Ashlands":
				case "Recipe_ArmorMediumLegs_Ashlands":
				case "Recipe_HelmetFlametal":
				case "Recipe_ArmorFlametalChest":
				case "Recipe_ArmorFlametalLegs":
				case "Recipe_CapeAsh":
				case "Recipe_MaceEldner":
				case "Recipe_SpearSplitner":
				case "Recipe_SwordNiedhogg":
				case "Recipe_AxeBerzerkr":
				case "Recipe_SwordSlayer":
				case "Recipe_BowAshlands":
				case "Recipe_CrossbowRipper":
					recipe.m_minStationLevel = 2;
					break;
				case "Recipe_MaceEldner_Blood":
				case "Recipe_MaceEldner_Lightning":
				case "Recipe_MaceEldner_Nature":
				case "Recipe_SpearSplitner_Blood":
				case "Recipe_SpearSplitner_Lightning":
				case "Recipe_SpearSplitner_Nature":
				case "Recipe_SwordNiedhogg_Blood":
				case "Recipe_SwordNiedhogg_Lightning":
				case "Recipe_SwordNiedhogg_Nature":
				case "Recipe_AxeBerzerkr_Blood":
				case "Recipe_AxeBerzerkr_Lightning":
				case "Recipe_AxeBerzerkr_Nature":
				case "Recipe_SwordSlayer_Blood":
				case "Recipe_SwordSlayer_Lightning":
				case "Recipe_SwordSlayer_Nature":
				case "Recipe_BowAshlands_Blood":
				case "Recipe_BowAshlands_Lightning":
				case "Recipe_BowAshlands_Nature":
				case "Recipe_CrossbowRipper_Blood":
				case "Recipe_CrossbowRipper_Lightning":
				case "Recipe_CrossbowRipper_Nature":
				case "Recipe_SwordFire":
					recipe.m_minStationLevel = 3;
					break;
				case "Recipe_CapeLinen":
					if (MMConfigManager.altLinenCapeEnabled)
					{
						recipe.m_minStationLevel = 1;
					}
					else
					{
						recipe.m_minStationLevel = 2;
					}
					break;
				}
			}
		}
	}

	[HarmonyPatch(typeof(Recipe), "GetRequiredStationLevel")]
	private class GearUpgradeUnlockStationLevel_Patch
	{
		private static bool Prefix(int quality, ref int ___m_minStationLevel, ref int __result, ref bool __runOriginal)
		{
			if (MMConfigManager.gearUpgradeUnlockEnabled)
			{
				__runOriginal = false;
				__result = Mathf.Max(0, ___m_minStationLevel) + (quality - 1);
				return false;
			}
			__runOriginal = true;
			__result = Mathf.Max(1, ___m_minStationLevel) + (quality - 1);
			return true;
		}
	}
}
internal class MMLessAshlandsEnemies
{
	[HarmonyPatch(typeof(SpawnSystem), "Awake")]
	private class LessAshlandsEnemiesAwake_Patch
	{
		private static void Postfix(SpawnSystem __instance)
		{
			if (!MMConfigManager.lessAshlandsEnemiesEnabled || !Object.op_Implicit((Object)(object)__instance))
			{
				return;
			}
			foreach (SpawnSystemList spawnList in __instance.m_spawnLists)
			{
				foreach (SpawnData spawner in spawnList.m_spawners)
				{
					switch (spawner.m_name)
					{
					case "Fallen Valkyrie":
						spawner.m_spawnChance = 15f;
						break;
					case "Asksvin [DAY]":
						spawner.m_maxSpawned = 1;
						spawner.m_groupSizeMin = 1;
						spawner.m_groupSizeMax = 2;
						spawner.m_spawnChance = 20f;
						break;
					case "Asksvin [NIGHT]":
						spawner.m_maxSpawned = 2;
						spawner.m_groupSizeMin = 1;
						spawner.m_groupSizeMax = 3;
						spawner.m_spawnChance = 35f;
						break;
					case "Volture":
						spawner.m_maxSpawned = 2;
						spawner.m_groupSizeMin = 1;
						spawner.m_groupSizeMax = 2;
						spawner.m_spawnChance = 20f;
						break;
					case "Charred Twitcher [DAY]":
						spawner.m_maxSpawned = 2;
						spawner.m_groupSizeMin = 1;
						spawner.m_groupSizeMax = 2;
						spawner.m_spawnChance = 35f;
						break;
					case "Charred Twitcher [NIGHT]":
						spawner.m_maxSpawned = 3;
						spawner.m_groupSizeMin = 2;
						spawner.m_groupSizeMax = 3;
						spawner.m_spawnChance = 45f;
						break;
					case "Charred Archer":
						spawner.m_maxSpawned = 2;
						spawner.m_groupSizeMax = 2;
						spawner.m_spawnChance = 30f;
						break;
					case "Charred Melee":
						spawner.m_maxSpawned = 2;
						spawner.m_groupSizeMax = 2;
						spawner.m_spawnChance = 30f;
						break;
					case "Lava Blob":
						spawner.m_maxSpawned = 1;
						spawner.m_groupSizeMax = 1;
						spawner.m_spawnChance = 20f;
						break;
					}
				}
			}
		}
	}
}
internal class MMLinenAndLoxCapeChanges
{
	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private class AlternateLinenAndLoxCape_Patch
	{
		private static void Postfix(ref ObjectDB __instance)
		{
			if (MMConfigManager.altLinenCapeEnabled)
			{
				if (MMShared.itemDropSuccess)
				{
					ApplyRecipeChanges(ref __instance);
				}
				ApplyPoisonResist(ref __instance);
			}
		}

		private static void ApplyRecipeChanges(ref ObjectDB objDB)
		{
			foreach (Recipe recipe in objDB.m_recipes)
			{
				string name = ((Object)recipe).name;
				string text = name;
				if (!(text == "Recipe_CapeLinen"))
				{
					continue;
				}
				Requirement[] resources = recipe.m_resources;
				foreach (Requirement val in resources)
				{
					switch (((Object)val.m_resItem).name)
					{
					case "LinenThread":
						val.m_amount = 5;
						val.m_amountPerLevel = 2;
						val.m_resItem = MMShared.deerHideID;
						break;
					case "Silver":
					case "BlackMetal":
						val.m_amount = 1;
						val.m_amountPerLevel = 0;
						val.m_resItem = MMShared.ironID;
						break;
					}
				}
			}
		}

		private static void ApplyPoisonResist(ref ObjectDB objDB)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType));
			ItemType val = (ItemType)0;
			ItemType[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				ItemType val2 = array2[i];
				if (((object)(ItemType)(ref val2)).ToString() == "Shoulder")
				{
					val = val2;
					break;
				}
			}
			List<ItemDrop> allItems = objDB.GetAllItems(val, "");
			foreach (ItemDrop item2 in allItems)
			{
				string name = ((Object)item2).name;
				string text = name;
				if (text == "CapeLinen" || text == "CapeLox")
				{
					DamageModPair item = default(DamageModPair);
					item.m_modifier = (DamageModifier)1;
					item.m_type = (DamageType)256;
					if (!item2.m_itemData.m_shared.m_damageModifiers.Contains(item))
					{
						item2.m_itemData.m_shared.m_damageModifiers.Add(item);
					}
				}
			}
		}
	}
}
internal class MMBuildPieceChanges
{
	[HarmonyPatch(typeof(PieceTable), "UpdateAvailable")]
	private class BuildPiecesModifications_Patch
	{
		private static void Postfix(ref List<GameObject> ___m_pieces)
		{
			foreach (GameObject ___m_piece in ___m_pieces)
			{
				Piece component = ___m_piece.GetComponent<Piece>();
				Requirement[] requirements = component.m_resources;
				string name = component.m_name;
				if (MMConfigManager.extensionsChangesEnabled && component.m_spaceRequirement >= 2f)
				{
					component.m_spaceRequirement = 1f;
				}
				if (MMConfigManager.cheaperBuildPiecesEnabled)
				{
					updateBuildPiecesAmounts(ref requirements, ref name);
				}
				if (MMConfigManager.altBuildPiecesMaterialsEnabled && MMShared.itemDropSuccess)
				{
					updateBuildPiecesMaterials(ref requirements, ref name);
				}
			}
		}
	}

	[HarmonyPatch(typeof(Piece), "DropResources")]
	private class BuildPieceReturn_Patch
	{
		private static void Prefix([NotNull] ref Requirement[] ___m_resources, [NotNull] ref string ___m_name)
		{
			if (MMConfigManager.cheaperBuildPiecesEnabled)
			{
				updateBuildPiecesAmounts(ref ___m_resources, ref ___m_name);
			}
			if (MMConfigManager.altBuildPiecesMaterialsEnabled && MMShared.itemDropSuccess)
			{
				updateBuildPiecesMaterials(ref ___m_resources, ref ___m_name);
			}
		}
	}

	private static void updateBuildPiecesAmounts(ref Requirement[] requirements, ref string name)
	{
		switch (name)
		{
		case "$piece_cookingstation_iron":
		{
			Requirement[] array62 = requirements;
			foreach (Requirement val62 in array62)
			{
				string name62 = ((Object)val62.m_resItem).name;
				string text61 = name62;
				if (!(text61 == "Iron"))
				{
					if (text61 == "Chain")
					{
						val62.m_amount = 2;
					}
				}
				else
				{
					val62.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_itemstand":
		{
			Requirement[] array94 = requirements;
			foreach (Requirement val94 in array94)
			{
				string name94 = ((Object)val94.m_resItem).name;
				string text93 = name94;
				if (text93 == "FineWood")
				{
					val94.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_blastfurnace":
		{
			Requirement[] array30 = requirements;
			foreach (Requirement val30 in array30)
			{
				string name30 = ((Object)val30.m_resItem).name;
				string text29 = name30;
				if (text29 == "Iron")
				{
					val30.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_oven":
		{
			Requirement[] array78 = requirements;
			foreach (Requirement val78 in array78)
			{
				string name78 = ((Object)val78.m_resItem).name;
				string text77 = name78;
				if (text77 == "Iron")
				{
					val78.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_forge_ext3":
		{
			Requirement[] array46 = requirements;
			foreach (Requirement val46 in array46)
			{
				string name46 = ((Object)val46.m_resItem).name;
				string text45 = name46;
				if (text45 == "Wood")
				{
					val46.m_amount = 15;
				}
			}
			break;
		}
		case "$piece_forge_ext4":
		{
			Requirement[] array14 = requirements;
			foreach (Requirement val14 in array14)
			{
				string name14 = ((Object)val14.m_resItem).name;
				string text13 = name14;
				if (text13 == "Iron")
				{
					val14.m_amount = 7;
				}
			}
			break;
		}
		case "$piece_forge_ext5":
		{
			Requirement[] array86 = requirements;
			foreach (Requirement val86 in array86)
			{
				string name86 = ((Object)val86.m_resItem).name;
				string text85 = name86;
				if (text85 == "FineWood")
				{
					val86.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_forge_ext6":
		{
			Requirement[] array70 = requirements;
			foreach (Requirement val70 in array70)
			{
				string name70 = ((Object)val70.m_resItem).name;
				string text69 = name70;
				if (text69 == "Iron")
				{
					val70.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_woodwindowshutter":
		{
			Requirement[] array54 = requirements;
			foreach (Requirement val54 in array54)
			{
				string name54 = ((Object)val54.m_resItem).name;
				string text53 = name54;
				if (text53 == "Wood")
				{
					val54.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_darkwoodgate":
		{
			Requirement[] array38 = requirements;
			foreach (Requirement val38 in array38)
			{
				string name38 = ((Object)val38.m_resItem).name;
				string text37 = name38;
				if (text37 == "Iron")
				{
					val38.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_irongate":
		{
			Requirement[] array22 = requirements;
			foreach (Requirement val22 in array22)
			{
				string name22 = ((Object)val22.m_resItem).name;
				string text21 = name22;
				if (text21 == "Iron")
				{
					val22.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_chest":
		{
			Requirement[] array6 = requirements;
			foreach (Requirement val6 in array6)
			{
				string name7 = ((Object)val6.m_resItem).name;
				string text6 = name7;
				if (text6 == "Iron")
				{
					val6.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_chestprivate":
		{
			Requirement[] array90 = requirements;
			foreach (Requirement val90 in array90)
			{
				string name90 = ((Object)val90.m_resItem).name;
				string text89 = name90;
				if (text89 == "Iron")
				{
					val90.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_chestblackmetal":
		{
			Requirement[] array82 = requirements;
			foreach (Requirement val82 in array82)
			{
				string name82 = ((Object)val82.m_resItem).name;
				string text81 = name82;
				if (text81 == "BlackMetal")
				{
					val82.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_brazierceiling01":
		{
			Requirement[] array74 = requirements;
			foreach (Requirement val74 in array74)
			{
				string name74 = ((Object)val74.m_resItem).name;
				string text73 = name74;
				if (text73 == "Bronze")
				{
					val74.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_sconce":
		{
			Requirement[] array66 = requirements;
			foreach (Requirement val66 in array66)
			{
				string name66 = ((Object)val66.m_resItem).name;
				string text65 = name66;
				if (text65 == "Copper")
				{
					val66.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_groundtorchwood":
		{
			Requirement[] array58 = requirements;
			foreach (Requirement val58 in array58)
			{
				string name58 = ((Object)val58.m_resItem).name;
				string text57 = name58;
				if (text57 == "Wood")
				{
					val58.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_groundtorch":
		case "$piece_groundtorchgreen":
		case "$piece_groundtorchblue":
		{
			Requirement[] array50 = requirements;
			foreach (Requirement val50 in array50)
			{
				string name50 = ((Object)val50.m_resItem).name;
				string text49 = name50;
				if (text49 == "Iron")
				{
					val50.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_portal":
		{
			Requirement[] array42 = requirements;
			foreach (Requirement val42 in array42)
			{
				string name42 = ((Object)val42.m_resItem).name;
				string text41 = name42;
				if (text41 == "FineWood")
				{
					val42.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_portal_stone":
		{
			Requirement[] array34 = requirements;
			foreach (Requirement val34 in array34)
			{
				string name34 = ((Object)val34.m_resItem).name;
				string text33 = name34;
				if (text33 == "Grausten")
				{
					val34.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_rug_lox":
		{
			Requirement[] array26 = requirements;
			foreach (Requirement val26 in array26)
			{
				string name26 = ((Object)val26.m_resItem).name;
				string text25 = name26;
				if (text25 == "LoxPelt")
				{
					val26.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_rug_wolf":
		{
			Requirement[] array18 = requirements;
			foreach (Requirement val18 in array18)
			{
				string name18 = ((Object)val18.m_resItem).name;
				string text17 = name18;
				if (text17 == "WolfPelt")
				{
					val18.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_rug_deer":
		{
			Requirement[] array10 = requirements;
			foreach (Requirement val10 in array10)
			{
				string name10 = ((Object)val10.m_resItem).name;
				string text9 = name10;
				if (text9 == "DeerHide")
				{
					val10.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_banner01":
		case "$piece_banner02":
		case "$piece_banner03":
		case "$piece_banner04":
		case "$piece_banner05":
		case "$piece_banner06":
		case "$piece_banner07":
		case "$piece_banner08":
		case "$piece_banner09":
		case "$piece_banner10":
		case "$piece_banner11":
		{
			Requirement[] array2 = requirements;
			foreach (Requirement val2 in array2)
			{
				string name3 = ((Object)val2.m_resItem).name;
				string text2 = name3;
				if (text2 == "LeatherScraps")
				{
					val2.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_fermenter":
		{
			Requirement[] array92 = requirements;
			foreach (Requirement val92 in array92)
			{
				string name92 = ((Object)val92.m_resItem).name;
				string text91 = name92;
				if (text91 == "FineWood")
				{
					val92.m_amount = 15;
				}
			}
			break;
		}
		case "$piece_bathtub":
		{
			Requirement[] array88 = requirements;
			foreach (Requirement val88 in array88)
			{
				string name88 = ((Object)val88.m_resItem).name;
				string text87 = name88;
				if (text87 == "Iron")
				{
					val88.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_crystalwall1x1":
		{
			Requirement[] array84 = requirements;
			foreach (Requirement val84 in array84)
			{
				string name84 = ((Object)val84.m_resItem).name;
				string text83 = name84;
				if (text83 == "Crystal")
				{
					val84.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_incinerator":
		{
			Requirement[] array80 = requirements;
			foreach (Requirement val80 in array80)
			{
				string name80 = ((Object)val80.m_resItem).name;
				string text79 = name80;
				if (text79 == "Iron")
				{
					val80.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_stonewall1x1":
		{
			Requirement[] array76 = requirements;
			foreach (Requirement val76 in array76)
			{
				string name76 = ((Object)val76.m_resItem).name;
				string text75 = name76;
				if (text75 == "Stone")
				{
					val76.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_stonewall2x1":
		{
			Requirement[] array72 = requirements;
			foreach (Requirement val72 in array72)
			{
				string name72 = ((Object)val72.m_resItem).name;
				string text71 = name72;
				if (text71 == "Stone")
				{
					val72.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_stonepillar":
		{
			Requirement[] array68 = requirements;
			foreach (Requirement val68 in array68)
			{
				string name68 = ((Object)val68.m_resItem).name;
				string text67 = name68;
				if (text67 == "Stone")
				{
					val68.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_stonearch":
		{
			Requirement[] array64 = requirements;
			foreach (Requirement val64 in array64)
			{
				string name64 = ((Object)val64.m_resItem).name;
				string text63 = name64;
				if (text63 == "Stone")
				{
					val64.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_stonefloor2x2":
		{
			Requirement[] array60 = requirements;
			foreach (Requirement val60 in array60)
			{
				string name60 = ((Object)val60.m_resItem).name;
				string text59 = name60;
				if (text59 == "Stone")
				{
					val60.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_stonestair":
		{
			Requirement[] array56 = requirements;
			foreach (Requirement val56 in array56)
			{
				string name56 = ((Object)val56.m_resItem).name;
				string text55 = name56;
				if (text55 == "Stone")
				{
					val56.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_blackmarble2x1x1":
		{
			Requirement[] array52 = requirements;
			foreach (Requirement val52 in array52)
			{
				string name52 = ((Object)val52.m_resItem).name;
				string text51 = name52;
				if (text51 == "BlackMarble")
				{
					val52.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_blackmarble_stair":
		{
			Requirement[] array48 = requirements;
			foreach (Requirement val48 in array48)
			{
				string name48 = ((Object)val48.m_resItem).name;
				string text47 = name48;
				if (text47 == "BlackMarble")
				{
					val48.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_blackmarble_base1":
		{
			Requirement[] array44 = requirements;
			foreach (Requirement val44 in array44)
			{
				string name44 = ((Object)val44.m_resItem).name;
				string text43 = name44;
				if (text43 == "BlackMarble")
				{
					val44.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_blackmarble_basecorner":
		{
			Requirement[] array40 = requirements;
			foreach (Requirement val40 in array40)
			{
				string name40 = ((Object)val40.m_resItem).name;
				string text39 = name40;
				if (text39 == "BlackMarble")
				{
					val40.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_blackmarble_out1":
		{
			Requirement[] array36 = requirements;
			foreach (Requirement val36 in array36)
			{
				string name36 = ((Object)val36.m_resItem).name;
				string text35 = name36;
				if (text35 == "BlackMarble")
				{
					val36.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_blackmarble_outcorner":
		{
			Requirement[] array32 = requirements;
			foreach (Requirement val32 in array32)
			{
				string name32 = ((Object)val32.m_resItem).name;
				string text31 = name32;
				if (text31 == "BlackMarble")
				{
					val32.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_blackmarble_arch":
		{
			Requirement[] array28 = requirements;
			foreach (Requirement val28 in array28)
			{
				string name28 = ((Object)val28.m_resItem).name;
				string text27 = name28;
				if (text27 == "BlackMarble")
				{
					val28.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_dvergr_stake_wall":
		{
			Requirement[] array24 = requirements;
			foreach (Requirement val24 in array24)
			{
				string name24 = ((Object)val24.m_resItem).name;
				string text23 = name24;
				if (!(text23 == "YggdrasilWood"))
				{
					if (text23 == "Iron")
					{
						val24.m_amount = 2;
					}
				}
				else
				{
					val24.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_sharpstakes":
		{
			Requirement[] array20 = requirements;
			foreach (Requirement val20 in array20)
			{
				string name20 = ((Object)val20.m_resItem).name;
				string text19 = name20;
				if (!(text19 == "Wood"))
				{
					if (text19 == "RoundLog")
					{
						val20.m_amount = 2;
					}
				}
				else
				{
					val20.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_dvergr_sharpstakes":
		{
			Requirement[] array16 = requirements;
			foreach (Requirement val16 in array16)
			{
				string name16 = ((Object)val16.m_resItem).name;
				string text15 = name16;
				if (!(text15 == "YggdrasilWood"))
				{
					if (text15 == "Iron")
					{
						val16.m_amount = 1;
					}
				}
				else
				{
					val16.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_trap":
		{
			Requirement[] array12 = requirements;
			foreach (Requirement val12 in array12)
			{
				string name12 = ((Object)val12.m_resItem).name;
				string text11 = name12;
				if (!(text11 == "BlackMetal"))
				{
					if (text11 == "BronzeNails")
					{
						val12.m_amount = 5;
					}
				}
				else
				{
					val12.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_turret":
		{
			Requirement[] array8 = requirements;
			foreach (Requirement val8 in array8)
			{
				switch (((Object)val8.m_resItem).name)
				{
				case "BlackMetal":
					val8.m_amount = 7;
					break;
				case "YggdrasilWood":
					val8.m_amount = 7;
					break;
				case "MechanicalSpring":
					val8.m_amount = 2;
					break;
				}
			}
			break;
		}
		case "$piece_eitrrefinery":
		{
			Requirement[] array4 = requirements;
			foreach (Requirement val4 in array4)
			{
				string name5 = ((Object)val4.m_resItem).name;
				string text4 = name5;
				if (text4 == "BlackMarble")
				{
					val4.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_blackforge_ext2":
		{
			Requirement[] array95 = requirements;
			foreach (Requirement val95 in array95)
			{
				string name95 = ((Object)val95.m_resItem).name;
				string text94 = name95;
				if (text94 == "Copper")
				{
					val95.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_sapcollector":
		{
			Requirement[] array93 = requirements;
			foreach (Requirement val93 in array93)
			{
				string name93 = ((Object)val93.m_resItem).name;
				string text92 = name93;
				if (!(text92 == "YggdrasilWood"))
				{
					if (text92 == "BlackMetal")
					{
						val93.m_amount = 3;
					}
				}
				else
				{
					val93.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_magetable":
		{
			Requirement[] array91 = requirements;
			foreach (Requirement val91 in array91)
			{
				string name91 = ((Object)val91.m_resItem).name;
				string text90 = name91;
				if (!(text90 == "YggdrasilWood"))
				{
					if (text90 == "BlackMetal")
					{
						val91.m_amount = 5;
					}
				}
				else
				{
					val91.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_magetable_ext":
		{
			Requirement[] array89 = requirements;
			foreach (Requirement val89 in array89)
			{
				string name89 = ((Object)val89.m_resItem).name;
				string text88 = name89;
				if (!(text88 == "BlackMarble"))
				{
					if (text88 == "Eitr")
					{
						val89.m_amount = 5;
					}
				}
				else
				{
					val89.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_magetable_ext2":
		{
			Requirement[] array87 = requirements;
			foreach (Requirement val87 in array87)
			{
				string name87 = ((Object)val87.m_resItem).name;
				string text86 = name87;
				if (!(text86 == "BlackMarble"))
				{
					if (text86 == "Eitr")
					{
						val87.m_amount = 5;
					}
				}
				else
				{
					val87.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_magetable_ext3":
		{
			Requirement[] array85 = requirements;
			foreach (Requirement val85 in array85)
			{
				string name85 = ((Object)val85.m_resItem).name;
				string text84 = name85;
				if (text84 == "Eitr")
				{
					val85.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_hexagonalgate":
		{
			Requirement[] array83 = requirements;
			foreach (Requirement val83 in array83)
			{
				string name83 = ((Object)val83.m_resItem).name;
				string text82 = name83;
				if (text82 == "Copper")
				{
					val83.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_dvergr_spiralstair":
		{
			Requirement[] array81 = requirements;
			foreach (Requirement val81 in array81)
			{
				string name81 = ((Object)val81.m_resItem).name;
				string text80 = name81;
				if (!(text80 == "YggdrasilWood"))
				{
					if (text80 == "Copper")
					{
						val81.m_amount = 1;
					}
				}
				else
				{
					val81.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_dvergr_spiralstair_right":
		{
			Requirement[] array79 = requirements;
			foreach (Requirement val79 in array79)
			{
				string name79 = ((Object)val79.m_resItem).name;
				string text78 = name79;
				if (!(text78 == "YggdrasilWood"))
				{
					if (text78 == "Copper")
					{
						val79.m_amount = 1;
					}
				}
				else
				{
					val79.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_blackmarble_bench":
		{
			Requirement[] array77 = requirements;
			foreach (Requirement val77 in array77)
			{
				string name77 = ((Object)val77.m_resItem).name;
				string text76 = name77;
				if (!(text76 == "BlackMarble"))
				{
					if (text76 == "Copper")
					{
						val77.m_amount = 2;
					}
				}
				else
				{
					val77.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_table_round":
		{
			Requirement[] array75 = requirements;
			foreach (Requirement val75 in array75)
			{
				string name75 = ((Object)val75.m_resItem).name;
				string text74 = name75;
				if (text74 == "IronNails")
				{
					val75.m_amount = 10;
				}
			}
			break;
		}
		case "$piece_blackmarble_table":
		{
			Requirement[] array73 = requirements;
			foreach (Requirement val73 in array73)
			{
				string name73 = ((Object)val73.m_resItem).name;
				string text72 = name73;
				if (!(text72 == "BlackMarble"))
				{
					if (text72 == "Copper")
					{
						val73.m_amount = 2;
					}
				}
				else
				{
					val73.m_amount = 5;
				}
			}
			break;
		}
		case "$piece_brazierfloor01":
		{
			Requirement[] array71 = requirements;
			foreach (Requirement val71 in array71)
			{
				string name71 = ((Object)val71.m_resItem).name;
				string text70 = name71;
				if (text70 == "Bronze")
				{
					val71.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_brazierfloor02":
		{
			Requirement[] array69 = requirements;
			foreach (Requirement val69 in array69)
			{
				string name69 = ((Object)val69.m_resItem).name;
				string text68 = name69;
				if (!(text68 == "Bronze"))
				{
					if (text68 == "GreydwarfEye")
					{
						val69.m_amount = 2;
					}
				}
				else
				{
					val69.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_jute_carpet":
		{
			Requirement[] array67 = requirements;
			foreach (Requirement val67 in array67)
			{
				string name67 = ((Object)val67.m_resItem).name;
				string text66 = name67;
				if (text66 == "JuteRed")
				{
					val67.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_juteblue_carpet":
		{
			Requirement[] array65 = requirements;
			foreach (Requirement val65 in array65)
			{
				string name65 = ((Object)val65.m_resItem).name;
				string text64 = name65;
				if (text64 == "JuteBlue")
				{
					val65.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_rug_hare":
		{
			Requirement[] array63 = requirements;
			foreach (Requirement val63 in array63)
			{
				string name63 = ((Object)val63.m_resItem).name;
				string text62 = name63;
				if (text62 == "ScaleHide")
				{
					val63.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_dvergr_lantern":
		{
			Requirement[] array61 = requirements;
			foreach (Requirement val61 in array61)
			{
				string name61 = ((Object)val61.m_resItem).name;
				string text60 = name61;
				if (text60 == "Copper")
				{
					val61.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_dvergr_lantern_pole":
		{
			Requirement[] array59 = requirements;
			foreach (Requirement val59 in array59)
			{
				string name59 = ((Object)val59.m_resItem).name;
				string text58 = name59;
				if (text58 == "Copper")
				{
					val59.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_clothdoor":
		{
			Requirement[] array57 = requirements;
			foreach (Requirement val57 in array57)
			{
				string name57 = ((Object)val57.m_resItem).name;
				string text56 = name57;
				if (text56 == "JuteRed")
				{
					val57.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_hanging_cloth_blue1":
		{
			Requirement[] array55 = requirements;
			foreach (Requirement val55 in array55)
			{
				string name55 = ((Object)val55.m_resItem).name;
				string text54 = name55;
				if (text54 == "JuteBlue")
				{
					val55.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_hanging_cloth_blue2":
		{
			Requirement[] array53 = requirements;
			foreach (Requirement val53 in array53)
			{
				string name53 = ((Object)val53.m_resItem).name;
				string text52 = name53;
				if (text52 == "JuteBlue")
				{
					val53.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_ashwood_archedwall":
		{
			Requirement[] array51 = requirements;
			foreach (Requirement val51 in array51)
			{
				string name51 = ((Object)val51.m_resItem).name;
				string text50 = name51;
				if (text50 == "Blackwood")
				{
					val51.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_ashwood_floor_2x2":
		{
			Requirement[] array49 = requirements;
			foreach (Requirement val49 in array49)
			{
				string name49 = ((Object)val49.m_resItem).name;
				string text48 = name49;
				if (text48 == "Blackwood")
				{
					val49.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_ashwood_floor_1x1":
		{
			Requirement[] array47 = requirements;
			foreach (Requirement val47 in array47)
			{
				string name47 = ((Object)val47.m_resItem).name;
				string text46 = name47;
				if (text46 == "Blackwood")
				{
					val47.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_ashwood_floor_deco":
		{
			Requirement[] array45 = requirements;
			foreach (Requirement val45 in array45)
			{
				string name45 = ((Object)val45.m_resItem).name;
				string text44 = name45;
				if (text44 == "Blackwood")
				{
					val45.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_ashwood_beam_1m":
		{
			Requirement[] array43 = requirements;
			foreach (Requirement val43 in array43)
			{
				string name43 = ((Object)val43.m_resItem).name;
				string text42 = name43;
				if (text42 == "Blackwood")
				{
					val43.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_ashwood_beam_2m":
		{
			Requirement[] array41 = requirements;
			foreach (Requirement val41 in array41)
			{
				string name41 = ((Object)val41.m_resItem).name;
				string text40 = name41;
				if (text40 == "Blackwood")
				{
					val41.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_ashwood_pole_1m":
		{
			Requirement[] array39 = requirements;
			foreach (Requirement val39 in array39)
			{
				string name39 = ((Object)val39.m_resItem).name;
				string text38 = name39;
				if (text38 == "Blackwood")
				{
					val39.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_ashwood_pole_2m":
		{
			Requirement[] array37 = requirements;
			foreach (Requirement val37 in array37)
			{
				string name37 = ((Object)val37.m_resItem).name;
				string text36 = name37;
				if (text36 == "Blackwood")
				{
					val37.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_ashwoodstair":
		{
			Requirement[] array35 = requirements;
			foreach (Requirement val35 in array35)
			{
				string name35 = ((Object)val35.m_resItem).name;
				string text34 = name35;
				if (text34 == "Blackwood")
				{
					val35.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_grausten_stoneladder":
		{
			Requirement[] array33 = requirements;
			foreach (Requirement val33 in array33)
			{
				string name33 = ((Object)val33.m_resItem).name;
				string text32 = name33;
				if (text32 == "Grausten")
				{
					val33.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_grausten_stair":
		{
			Requirement[] array31 = requirements;
			foreach (Requirement val31 in array31)
			{
				string name31 = ((Object)val31.m_resItem).name;
				string text30 = name31;
				if (text30 == "Grausten")
				{
					val31.m_amount = 3;
				}
			}
			break;
		}
		case "$piece_grausten_floor1x1":
		{
			Requirement[] array29 = requirements;
			foreach (Requirement val29 in array29)
			{
				string name29 = ((Object)val29.m_resItem).name;
				string text28 = name29;
				if (text28 == "Grausten")
				{
					val29.m_amount = 1;
				}
			}
			break;
		}
		case "$piece_grausten_pillarmedium":
		{
			Requirement[] array27 = requirements;
			foreach (Requirement val27 in array27)
			{
				string name27 = ((Object)val27.m_resItem).name;
				string text26 = name27;
				if (text26 == "Grausten")
				{
					val27.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_grausten_pillartapered":
		{
			Requirement[] array25 = requirements;
			foreach (Requirement val25 in array25)
			{
				string name25 = ((Object)val25.m_resItem).name;
				string text24 = name25;
				if (text24 == "Grausten")
				{
					val25.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_pillartaperedinverted":
		{
			Requirement[] array23 = requirements;
			foreach (Requirement val23 in array23)
			{
				string name23 = ((Object)val23.m_resItem).name;
				string text22 = name23;
				if (text22 == "Grausten")
				{
					val23.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_beammedium":
		{
			Requirement[] array21 = requirements;
			foreach (Requirement val21 in array21)
			{
				string name21 = ((Object)val21.m_resItem).name;
				string text20 = name21;
				if (text20 == "Grausten")
				{
					val21.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_grausten_wall1x2":
		{
			Requirement[] array19 = requirements;
			foreach (Requirement val19 in array19)
			{
				string name19 = ((Object)val19.m_resItem).name;
				string text18 = name19;
				if (text18 == "Grausten")
				{
					val19.m_amount = 2;
				}
			}
			break;
		}
		case "$piece_grausten_wall2x2":
		{
			Requirement[] array17 = requirements;
			foreach (Requirement val17 in array17)
			{
				string name17 = ((Object)val17.m_resItem).name;
				string text16 = name17;
				if (text16 == "Grausten")
				{
					val17.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_wall4x2":
		{
			Requirement[] array15 = requirements;
			foreach (Requirement val15 in array15)
			{
				string name15 = ((Object)val15.m_resItem).name;
				string text14 = name15;
				if (text14 == "Grausten")
				{
					val15.m_amount = 8;
				}
			}
			break;
		}
		case "$piece_grausten_window4x2":
		{
			Requirement[] array13 = requirements;
			foreach (Requirement val13 in array13)
			{
				string name13 = ((Object)val13.m_resItem).name;
				string text12 = name13;
				if (text12 == "Grausten")
				{
					val13.m_amount = 8;
				}
			}
			break;
		}
		case "$piece_grausten_roof45_corner":
		{
			Requirement[] array11 = requirements;
			foreach (Requirement val11 in array11)
			{
				string name11 = ((Object)val11.m_resItem).name;
				string text10 = name11;
				if (text10 == "Grausten")
				{
					val11.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_roof45_corner2":
		{
			Requirement[] array9 = requirements;
			foreach (Requirement val9 in array9)
			{
				string name9 = ((Object)val9.m_resItem).name;
				string text8 = name9;
				if (text8 == "Grausten")
				{
					val9.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_roof45_archcorner":
		{
			Requirement[] array7 = requirements;
			foreach (Requirement val7 in array7)
			{
				string name8 = ((Object)val7.m_resItem).name;
				string text7 = name8;
				if (text7 == "Grausten")
				{
					val7.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_grausten_roof45_archcorner2":
		{
			Requirement[] array5 = requirements;
			foreach (Requirement val5 in array5)
			{
				string name6 = ((Object)val5.m_resItem).name;
				string text5 = name6;
				if (text5 == "Grausten")
				{
					val5.m_amount = 4;
				}
			}
			break;
		}
		case "$piece_flametalgate":
		{
			Requirement[] array3 = requirements;
			foreach (Requirement val3 in array3)
			{
				string name4 = ((Object)val3.m_resItem).name;
				string text3 = name4;
				if (text3 == "FlametalNew")
				{
					val3.m_amount = 8;
				}
			}
			break;
		}
		case "$piece_rug_asksvin":
		{
			Requirement[] array = requirements;
			foreach (Requirement val in array)
			{
				string name2 = ((Object)val.m_resItem).name;
				string text = name2;
				if (text == "AskHide")
				{
					val.m_amount = 3;
				}
			}
			break;
		}
		}
	}

	private static void updateBuildPiecesMaterials(ref Requirement[] requirements, ref string name)
	{
		switch (name)
		{
		case "$piece_workbench_ext4":
		{
			Requirement[] array2 = requirements;
			foreach (Requirement val2 in array2)
			{
				string name3 = ((Object)val2.m_resItem).name;
				string text2 = name3;
				if (text2 == "Obsidian")
				{
					val2.m_resItem = MMShared.coalID;
				}
			}
			break;
		}
		case "$piece_darkwoodgate":
		{
			Requirement[] array3 = requirements;
			foreach (Requirement val3 in array3)
			{
				string name4 = ((Object)val3.m_resItem).name;
				string text3 = name4;
				if (text3 == "Iron")
				{
					val3.m_resItem = MMShared.blackMetalID;
				}
			}
			break;
		}
		case "$piece_bathtub":
		{
			Requirement[] array = requirements;
			foreach (Requirement val in array)
			{
				string name2 = ((Object)val.m_resItem).name;
				string text = name2;
				if (text == "Iron")
				{
					val.m_resItem = MMShared.blackMetalID;
				}
			}
			break;
		}
		}
	}
}
internal class MMConfigManager
{
	public static ConfigFile config;

	public static bool modEnabled;

	public static bool cheaperGearEnabled;

	public static bool doubleBronzeEnabled;

	public static bool altGearRecipesEnabled;

	public static bool altLinenCapeEnabled;

	public static bool altGearSpeedModifiersEnabled;

	public static bool cheaperBuildPiecesEnabled;

	public static bool altBuildPiecesMaterialsEnabled;

	public static bool altForsakenPowersEnabled;

	public static bool fasterCharacterSpeedEnabled;

	public static bool lighterMetalWeightEnabled;

	public static bool largerPickupAreaEnabled;

	public static bool noSkillLowerOnDeathEnabled;

	public static bool altStatusEffectsEnabled;

	public static bool largerBoatExploreRadiusEnabled;

	public static bool showInventoryWeight;

	public static bool showInventorySlots;

	public static bool showBoatSpeed;

	public static bool lessStaminaUsageEnabled;

	public static bool showTimeAndDay;

	public static bool timeFormat24H;

	public static bool smartBiomeEnabled;

	public static bool altLoadingTipsEnabled;

	public static bool showEnemyDetector;

	public static bool showSummonCounter;

	public static bool showOnlinePartyIndicator;

	public static bool partyIndicatorUnderMinimap;

	public static bool hideOnlineIndicatorWhenSolo;

	public static bool craftingRecipesReorderEnabled;

	public static bool altCookingRecipesEnabled;

	public static bool altMeadRecipesEnabled;

	public static bool moreFoodStacksEnabled;

	public static bool moreArmorStatsEnabled;

	public static bool biggerWhispRadiusEnabled;

	public static bool friendlyBallistasEnabled;

	public static bool betterDeathRaiserEnabled;

	public static bool betterSummonedSkeletonGearEnabled;

	public static bool mageGearGivesEitrEnabled;

	public static bool betterFrostStaffAccuracyEnabled;

	public static bool lessFallDamageEnabled;

	public static bool reducedCrossbowsReloadTimeEnabled;

	public static bool lessAshlandsEnemiesEnabled;

	public static bool gearUpgradeUnlockEnabled;

	public static bool permanentLightsEnabled;

	public static bool clearMistlandsEnabled;

	public static bool craftableChainEnabled;

	public static bool brighterLanternsEnabled;

	public static bool lessFogEnabled;

	public static bool creatureUnlevelerEnabled;

	public static bool minibossWeightEnabled;

	public static bool fasterResourceDropsEnabled;

	public static bool extensionsChangesEnabled;

	public static bool noFleeEnabled;

	public static bool otherEnabled;

	public static bool ReadConfigFile()
	{
		modEnabled = config.Bind<bool>("1 - Main Mod", "Enable Main Mod", true, "Enable Marsarah Mod").Value;
		if (modEnabled)
		{
			cheaperGearEnabled = config.Bind<bool>("2 - Grindyness Reduction", "Cheaper Gear Recipes", true, "Reduces costs for crafting and upgrading gear (especially metal)").Value;
			doubleBronzeEnabled = config.Bind<bool>("2 - Grindyness Reduction", "Double Bronze Crafting", true, "Doubles the amount of crafted Bronze at the Forge").Value;
			cheaperBuildPiecesEnabled = config.Bind<bool>("2 - Grindyness Reduction", "Cheaper Build Pieces", true, "Reduces costs for build pieces").Value;
			altCookingRecipesEnabled = config.Bind<bool>("2 - Grindyness Reduction", "Alternate Cooking Recipes", true, "Modifies food recipes costs and crafted amounts").Value;
			altMeadRecipesEnabled = config.Bind<bool>("2 - Grindyness Reduction", "Alternate Mead Recipes", true, "Modifies mead recipes costs and crafted amounts").Value;
			moreFoodStacksEnabled = config.Bind<bool>("2 - Grindyness Reduction", "More Food Stacks", true, "Increases food item stacks to make them more uniform").Value;
			altGearRecipesEnabled = config.Bind<bool>("3 - Features", "Alt Gear Recipes", true, "Modifies gear recipe materials for some items (use more materials from current biomes)").Value;
			altLinenCapeEnabled = config.Bind<bool>("3 - Features", "Alt Linen & Lox Cape", true, "Moves Linen Cape to Swamp Era and adds poison resist to both capes").Value;
			altBuildPiecesMaterialsEnabled = config.Bind<bool>("3 - Features", "Alt Build Piece Materials", true, "Modifies build pieces materials (more materials from current biome)").Value;
			altGearSpeedModifiersEnabled = config.Bind<bool>("3 - Features", "Alt Gear Speed Modifiers", true, "Gear speed penalty reduced (light armors have increased move speed, heavy armors have no penalty)").Value;
			altForsakenPowersEnabled = config.Bind<bool>("3 - Features", "Alt Forsaken Powers", true, "Reduce Forsaken Powers cooldowns and increase durations").Value;
			fasterCharacterSpeedEnabled = config.Bind<bool>("3 - Features", "Faster Character Speed", true, "Faster character jog, walk, swim and crouch speeds (run excluded)").Value;
			altStatusEffectsEnabled = config.Bind<bool>("3 - Features", "Alt Status Effects", true, "Wet effect and HP potions reduced to 1 min").Value;
			lessStaminaUsageEnabled = config.Bind<bool>("3 - Features", "Less Stamina Usage", true, "Less stamina usage in general").Value;
			moreArmorStatsEnabled = config.Bind<bool>("3 - Features", "More Armor Stats", true, "Heavy armor gives extra HP, light armor gives extra stamina").Value;
			betterDeathRaiserEnabled = config.Bind<bool>("3 - Features", "Better Death Raiser", true, "Increases chance of summoning archers, and increases summoned skeleton speed").Value;
			betterSummonedSkeletonGearEnabled = config.Bind<bool>("3 - Features", "Better Summoned Skeleton Gear", true, "Summoned Skeletons have better gear (stats not affected)").Value;
			mageGearGivesEitrEnabled = config.Bind<bool>("3 - Features", "Mage Gear Eitr", true, "Mage Gear Provides Base Eitr").Value;
			betterFrostStaffAccuracyEnabled = config.Bind<bool>("3 - Features", "Better Frost Staff Accuracy", true, "Improves Staff of Frost Accuracy").Value;
			reducedCrossbowsReloadTimeEnabled = config.Bind<bool>("3 - Features", "Reduced Crossbows Reload Time", true, "Crossbows Reload Time Reduced").Value;
			lessAshlandsEnemiesEnabled = config.Bind<bool>("3 - Features", "Less Ashlands Enemies", false, "Less Enemies in Ashlands").Value;
			gearUpgradeUnlockEnabled = config.Bind<bool>("3 - Features", "Gear Upgrade Unlock", true, "Unlock max levels for upgrading Mistlands and Ashlands gear").Value;
			permanentLightsEnabled = config.Bind<bool>("3 - Features", "Permanent Lights", true, "Makes all light sources permanent, but the build costs use max fuel type").Value;
			clearMistlandsEnabled = config.Bind<bool>("3 - Features", "Clear Mistlands", true, "Clear Mistlands mist after defeating the Queen").Value;
			craftableChainEnabled = config.Bind<bool>("3 - Features", "Craftable Chain", true, "Chain craftable at Black Forge").Value;
			brighterLanternsEnabled = config.Bind<bool>("3 - Features", "Brighter Lanterns", true, "Dvergr lanterns are brighter").Value;
			lessFogEnabled = config.Bind<bool>("3 - Features", "Clearer Weather", true, "Reduces chance for mist and snowstorms").Value;
			creatureUnlevelerEnabled = config.Bind<bool>("3 - Features", "Creature Unleveler By Boss", true, "Increases chance of creatures to spawn with a star or two after defeating their relevant biome boss").Value;
			minibossWeightEnabled = config.Bind<bool>("3 - Features", "Hildir Weight Rewards", true, "Increases base carry weight by 50 when turning in hildir chests (for each chest)").Value;
			extensionsChangesEnabled = config.Bind<bool>("3 - Features", "Station Extensions Changes", true, "Decreases space requirement for workstation extensions and increases build distance to workstation").Value;
			noFleeEnabled = config.Bind<bool>("3 - Features", "Stop Running Away", true, "Boars and Necks won't flee when alerted").Value;
			otherEnabled = config.Bind<bool>("3 - Features", "Other Section", true, "Tankard costs reduced and Iron Nails crafting doubled").Value;
			lighterMetalWeightEnabled = config.Bind<bool>("4 - QOL", "Lighter Metal Weight", true, "All metal (ore and bar) weight decreased to 8 (equal to Tin Ore)").Value;
			largerPickupAreaEnabled = config.Bind<bool>("4 - QOL", "Larger PickupArea", true, "Item pickup area increased").Value;
			noSkillLowerOnDeathEnabled = config.Bind<bool>("4 - QOL", "No Skill Lower On Death", true, "Skills won't go down the current level upon death (progress in that skill is still lost)").Value;
			largerBoatExploreRadiusEnabled = config.Bind<bool>("4 - QOL", "Larger Boat Explore Radius", true, "Larger explore radius on a boat").Value;
			craftingRecipesReorderEnabled = config.Bind<bool>("4 - QOL", "Crafting Recipes Reorder", true, "Reorders crafting recipes (food by biome, gear by biome)").Value;
			biggerWhispRadiusEnabled = config.Bind<bool>("4 - QOL", "Bigger Wisp Radius", true, "Increases wisp radius").Value;
			friendlyBallistasEnabled = config.Bind<bool>("4 - QOL", "Friendly Ballistas", true, "Ballistas won't target players and tame animals").Value;
			lessFallDamageEnabled = config.Bind<bool>("4 - QOL", "Less Fall Damage", true, "Fall damage reduced by 40%").Value;
			fasterResourceDropsEnabled = config.Bind<bool>("4 - QOL", "Faster Resource Drops", true, "Enemies drop resources faster when dying").Value;
			altLoadingTipsEnabled = config.Bind<bool>("5 - UI", "Alt Loading Tips", true, "More loading screen tips").Value;
			showInventoryWeight = config.Bind<bool>("5 - UI", "Show Inventory Weight", true, "Show inventory weight").Value;
			showInventorySlots = config.Bind<bool>("5 - UI", "Show Inventory Slots", true, "Show free inventory slots").Value;
			showBoatSpeed = config.Bind<bool>("5 - UI", "Show Boat Speed", true, "Show boat speed (only when driving a boat)").Value;
			showTimeAndDay = config.Bind<bool>("5 - UI", "Show Time And Day", true, "Show time and day").Value;
			timeFormat24H = config.Bind<bool>("5 - UI", "Show Time And Day - 24 Hour Format", false, "Use 24 Hour time format").Value;
			smartBiomeEnabled = config.Bind<bool>("5 - UI", "Show Smart Biome", true, "Show smart biome text on minimap (colored according to armor value)").Value;
			showEnemyDetector = config.Bind<bool>("5 - UI", "Show Enemy Detector", true, "Show enemy detector").Value;
			showSummonCounter = config.Bind<bool>("5 - UI", "Show Summon Counter", true, "Show number of summoned skeletons from the Dead Raiser").Value;
			showOnlinePartyIndicator = config.Bind<bool>("5 - UI", "Show Online Party Indicator", true, "Show online players").Value;
			partyIndicatorUnderMinimap = config.Bind<bool>("5 - UI", "Show Online Party Indicator - Indicator Under Minimap", false, "Show online players under minimap").Value;
			hideOnlineIndicatorWhenSolo = config.Bind<bool>("5 - UI", "Show Online Party Indicator - Hide Online Indicator When Solo", true, "Hide online players when alone in world").Value;
		}
		return true;
	}
}
[BepInPlugin("marsarah.MarsarahMod", "Marsarah Mod", "5.2.7")]
public class MarsarahMod : BaseUnityPlugin
{
	private readonly Harmony harmony = new Harmony("marsarah.MarsarahMod");

	private void Awake()
	{
		MMConfigManager.config = ((BaseUnityPlugin)this).Config;
		MMConfigManager.ReadConfigFile();
		if (MMConfigManager.modEnabled)
		{
			MMShared.InitializeSharedSata();
			MMDeathRaiserChanges.InitializeDeathRaiserData();
			MMArmorStats.InitializeArmorStatsData();
			MMUIChanges.InitializeUIData();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "marsarah.MarsarahMod");
		}
	}

	private void Update()
	{
		UpdateUIDisplay();
		UpdateEnemyDetector();
		UpdateSummonsCounter();
		UpdatePlayerArmor();
		UpdateUITime();
	}

	private void UpdateUIDisplay()
	{
		if (MMConfigManager.modEnabled && Input.GetKeyDown((KeyCode)277))
		{
			MMShared.showUI = !MMShared.showUI;
		}
	}

	private void UpdateEnemyDetector()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Invalid comparison between Unknown and I4
		if (!MMConfigManager.modEnabled || !MMConfigManager.showEnemyDetector || !Object.op_Implicit((Object)(object)Player.m_localPlayer))
		{
			return;
		}
		int num = 0;
		int num2 = 0;
		List<Character> list = new List<Character>();
		Character.GetCharactersInRange(((Component)Player.m_localPlayer).transform.position, 30f, list);
		foreach (Character item in list)
		{
			if ((int)item.GetFaction() == 10 && (Object)(object)item.GetBaseAI() != (Object)null && !item.GetBaseAI().IsAggravated())
			{
				num2++;
			}
			if (item.m_name.ToString() == "Human" || item.m_name.ToString() == "$enemy_deer" || item.m_name.ToString() == "$enemy_hare" || item.m_name.ToString() == "$enemy_summonedroot" || item.IsTamed())
			{
				num++;
			}
		}
		MMShared.numEnemies = list.Count - num - num2;
		MMShared.numEnemiesPassive = num2;
	}

	private void UpdateSummonsCounter()
	{
		if (!MMConfigManager.modEnabled || !MMConfigManager.showSummonCounter || !Object.op_Implicit((Object)(object)Player.m_localPlayer))
		{
			return;
		}
		List<Character> allCharacters = Character.GetAllCharacters();
		int num = 0;
		foreach (Character item in allCharacters)
		{
			if (!item.IsTamed())
			{
				continue;
			}
			MonsterAI component = ((Component)item).GetComponent<MonsterAI>();
			if (component == null)
			{
				continue;
			}
			GameObject followTarget = component.GetFollowTarget();
			if (followTarget != null)
			{
				Player component2 = followTarget.GetComponent<Player>();
				if (component2 != null && component2.GetPlayerName() == Player.m_localPlayer.GetPlayerName())
				{
					num++;
				}
			}
		}
		MMShared.numSummons = num;
	}

	private void UpdatePlayerArmor()
	{
		if (MMConfigManager.modEnabled && Object.op_Implicit((Object)(object)Player.m_localPlayer) && MMConfigManager.smartBiomeEnabled && MMShared.showUI)
		{
			MMShared.playerArmor = ((Character)Player.m_localPlayer).GetBodyArmor();
		}
	}

	private void UpdateUITime()
	{
		if (!MMConfigManager.showTimeAndDay)
		{
			return;
		}
		float num = 0f;
		if (Object.op_Implicit((Object)(object)EnvMan.instance))
		{
			num = (float)typeof(EnvMan).GetField("m_smoothDayFraction", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(EnvMan.instance);
			MMShared.currentDay = Traverse.Create((object)EnvMan.instance).Method("GetCurrentDay", Array.Empty<object>()).GetValue<int>();
		}
		if (!MMConfigManager.timeFormat24H)
		{
			if (num < 0.2f)
			{
				MMShared.dayString = "Night";
			}
			else if (num < 0.25f)
			{
				MMShared.dayString = "Dawn";
			}
			else if (num < 0.33f)
			{
				MMShared.dayString = "Morning";
			}
			else if (num < 0.5f)
			{
				MMShared.dayString = "Day";
			}
			else if (num < 0.66f)
			{
				MMShared.dayString = "Afternoon";
			}
			else if (num < 0.75f)
			{
				MMShared.dayString = "Evening";
			}
			else if (num < 0.8f)
			{
				MMShared.dayString = "Dusk";
			}
			else
			{
				MMShared.dayString = "Night";
			}
		}
		else
		{
			int num2 = (int)(num * 24f);
			int num3 = (int)((num * 24f - (float)num2) * 60f);
			string text = ((num2 < 10) ? ("0" + num2) : num2.ToString());
			string text2 = ((num3 < 10) ? ("0" + num3) : num3.ToString());
			MMShared.dayString = "Time " + text + ":" + text2;
		}
	}

	public static void MModLog(string log, bool header = false, bool footer = false)
	{
		if (header)
		{
			Debug.Log((object)"===================================================");
		}
		Debug.Log((object)("[Marsarah Mod] : " + log));
		if (footer)
		{
			Debug.Log((object)"===================================================");
		}
	}
}
internal class MMCraftingRecipesReorder
{
	[HarmonyPatch(typeof(InventoryGui), "UpdateRecipeList")]
	private class CraftingRecipesReorder_Patch
	{
		private static void Prefix(ref List<Recipe> recipes)
		{
			if (!MMConfigManager.craftingRecipesReorderEnabled)
			{
				return;
			}
			List<Recipe> list = new List<Recipe>();
			List<Recipe> list2 = new List<Recipe>();
			List<Recipe> list3 = new List<Recipe>();
			List<Recipe> list4 = new List<Recipe>();
			List<Recipe> list5 = new List<Recipe>();
			List<Recipe> list6 = new List<Recipe>();
			List<Recipe> list7 = new List<Recipe>();
			List<Recipe> list8 = new List<Recipe>();
			List<Recipe> list9 = new List<Recipe>();
			List<Recipe> list10 = new List<Recipe>();
			List<Recipe> list11 = new List<Recipe>();
			List<Recipe> list12 = new List<Recipe>();
			List<Recipe> list13 = new List<Recipe>();
			List<Recipe> list14 = new List<Recipe>();
			List<Recipe> list15 = new List<Recipe>();
			List<Recipe> list16 = new List<Recipe>();
			List<Recipe> list17 = new List<Recipe>();
			List<Recipe> list18 = new List<Recipe>();
			List<Recipe> list19 = new List<Recipe>();
			List<Recipe> list20 = new List<Recipe>();
			List<Recipe> list21 = new List<Recipe>();
			List<Recipe> list22 = new List<Recipe>();
			List<Recipe> list23 = new List<Recipe>();
			List<Recipe> list24 = new List<Recipe>();
			List<Recipe> list25 = new List<Recipe>();
			List<Recipe> list26 = new List<Recipe>();
			List<Recipe> list27 = new List<Recipe>();
			List<Recipe> list28 = new List<Recipe>();
			List<Recipe> list29 = new List<Recipe>();
			List<Recipe> list30 = new List<Recipe>();
			List<Recipe> list31 = new List<Recipe>();
			List<Recipe> list32 = new List<Recipe>();
			List<Recipe> list33 = new List<Recipe>();
			List<Recipe> list34 = new List<Recipe>();
			List<Recipe> list35 = new List<Recipe>();
			List<Recipe> list36 = new List<Recipe>();
			List<Recipe> list37 = new List<Recipe>();
			List<Recipe> list38 = new List<Recipe>();
			List<Recipe> list39 = new List<Recipe>();
			List<Recipe> list40 = new List<Recipe>();
			List<Recipe> list41 = new List<Recipe>();
			List<Recipe> list42 = new List<Recipe>();
			List<Recipe> list43 = new List<Recipe>();
			List<Recipe> list44 = new List<Recipe>();
			List<Recipe> list45 = new List<Recipe>();
			List<Recipe> list46 = new List<Recipe>();
			List<Recipe> list47 = new List<Recipe>();
			List<Recipe> list48 = new List<Recipe>();
			List<Recipe> list49 = new List<Recipe>();
			List<Recipe> list50 = new List<Recipe>();
			List<Recipe> list51 = new List<Recipe>();
			List<Recipe> list52 = new List<Recipe>();
			List<Recipe> list53 = new List<Recipe>();
			List<Recipe> list54 = new List<Recipe>();
			List<Recipe> list55 = new List<Recipe>();
			List<Recipe> list56 = new List<Recipe>();
			List<Recipe> list57 = new List<Recipe>();
			List<Recipe> list58 = new List<Recipe>();
			List<Recipe> list59 = new List<Recipe>();
			List<Recipe> list60 = new List<Recipe>();
			List<Recipe> list61 = new List<Recipe>();
			List<Recipe> list62 = new List<Recipe>();
			foreach (Recipe recipe in recipes)
			{
				switch (((object)(ItemType)(ref recipe.m_item.m_itemData.m_shared.m_itemType)).ToString())
				{
				case "Helmet":
					switch (((Object)recipe).name)
					{
					case "Recipe_HelmetLeather":
						list2.Insert(0, recipe);
						break;
					case "Recipe_HelmetTrollLeather":
						list3.Insert(0, recipe);
						break;
					case "Recipe_HelmetBronze":
						list4.Insert(0, recipe);
						break;
					case "Recipe_HelmetRoot":
						list5.Insert(0, recipe);
						break;
					case "Recipe_HelmetIron":
						list6.Insert(0, recipe);
						break;
					case "Recipe_HelmetFenrir":
						list7.Insert(0, recipe);
						break;
					case "Recipe_HelmetDrake":
						list8.Insert(0, recipe);
						break;
					case "Recipe_HelmetPadded":
						list9.Insert(0, recipe);
						break;
					case "Recipe_HelmetCarapace":
						list10.Insert(0, recipe);
						break;
					case "Recipe_HelmetMage":
						list11.Insert(0, recipe);
						break;
					case "Recipe_HelmetFlametal":
						list12.Insert(0, recipe);
						break;
					case "Recipe_HelmetMedium_Ashlands":
						list13.Insert(0, recipe);
						break;
					case "Recipe_HelmetMage_Ashlands":
						list14.Insert(0, recipe);
						break;
					default:
						list15.Insert(0, recipe);
						break;
					}
					break;
				case "Chest":
					switch (((Object)recipe).name)
					{
					case "Recipe_ArmorRagsChest":
						list.Add(recipe);
						break;
					case "Recipe_ArmorLeatherChest":
						list2.Add(recipe);
						break;
					case "Recipe_ArmorTrollLeatherChest":
						list3.Add(recipe);
						break;
					case "Recipe_ArmorBronzeChest":
						list4.Add(recipe);
						break;
					case "Recipe_ArmorRootChest":
						list5.Add(recipe);
						break;
					case "Recipe_ArmorIronChest":
						list6.Add(recipe);
						break;
					case "Recipe_ArmorFenrirChest":
						list7.Add(recipe);
						break;
					case "Recipe_ArmorWolfChest":
						list8.Add(recipe);
						break;
					case "Recipe_ArmorPaddedCuirass":
						list9.Add(recipe);
						break;
					case "Recipe_ArmorCarapaceChest":
						list10.Add(recipe);
						break;
					case "Recipe_ArmorMageChest":
						list11.Add(recipe);
						break;
					case "Recipe_ArmorFlametalChest":
						list12.Add(recipe);
						break;
					case "Recipe_ArmorMediumChest_Ashlands":
						list13.Add(recipe);
						break;
					case "Recipe_ArmorMageChest_Ashlands":
						list14.Add(recipe);
						break;
					default:
						list16.Add(recipe);
						break;
					}
					break;
				case "Legs":
					switch (((Object)recipe).name)
					{
					case "Recipe_ArmorRagsLegs":
						list.Add(recipe);
						break;
					case "Recipe_ArmorLeatherLegs":
						list2.Add(recipe);
						break;
					case "Recipe_ArmorTrollLeatherLegs":
						list3.Add(recipe);
						break;
					case "Recipe_ArmorBronzeLegs":
						list4.Add(recipe);
						break;
					case "Recipe_ArmorRootLegs":
						list5.Add(recipe);
						break;
					case "Recipe_ArmorIronLegs":
						list6.Add(recipe);
						break;
					case "Recipe_ArmorFenrirLegs":
						list7.Add(recipe);
						break;
					case "Recipe_ArmorWolfLegs":
						list8.Add(recipe);
						break;
					case "Recipe_ArmorPaddedGreaves":
						list9.Add(recipe);
						break;
					case "Recipe_ArmorCarapaceLegs":
						list10.Add(recipe);
						break;
					case "Recipe_ArmorMageLegs":
						list11.Add(recipe);
						break;
					case "Recipe_ArmorFlametalLegs":
						list12.Add(recipe);
						break;
					case "Recipe_ArmorMediumLegs_Ashlands":
						list13.Add(recipe);
						break;
					case "Recipe_ArmorMageLegs_Ashlands":
						list14.Add(recipe);
						break;
					default:
						list17.Add(recipe);
						break;
					}
					break;
				case "Shoulder":
					list18.Add(recipe);
					break;
				case "OneHandedWeapon":
					switch (((Object)recipe).name)
					{
					case "Recipe_KnifeFlint":
					case "Recipe_SpearFlint":
					case "Recipe_Club":
					case "Recipe_AxeStone":
					case "Recipe_AxeFlint":
						list19.Add(recipe);
						break;
					case "Recipe_KnifeButcher":
					case "Recipe_KnifeCopper":
					case "Recipe_SpearBronze":
					case "Recipe_SwordBronze":
					case "Recipe_MaceBronze":
					case "Recipe_AxeBronze":
						list20.Add(recipe);
						break;
					case "Recipe_SpearElderbark":
					case "Recipe_SwordIron":
					case "Recipe_MaceIron":
					case "Recipe_AxeIron":
						list21.Add(recipe);
						break;
					case "Recipe_KnifeSilver":
					case "Recipe_KnifeChitin":
					case "Recipe_SpearWolfFang":
					case "Recipe_SpearChitin":
					case "Recipe_SwordSilver":
					case "Recipe_MaceSilver":
						list22.Add(recipe);
						break;
					case "Recipe_KnifeBlackmetal":
					case "Recipe_SwordBlackmetal":
					case "Recipe_MaceNeedle":
					case "Recipe_AxeBlackMetal":
						list23.Add(recipe);
						break;
					case "Recipe_SpearCarapace":
					case "Recipe_SwordMistwalker":
					case "Recipe_AxeJotunBane":
						list24.Add(recipe);
						break;
					case "Recipe_SpearSplitner":
					case "Recipe_SpearSplitner_Blood":
					case "Recipe_SpearSplitner_Lightning":
					case "Recipe_SpearSplitner_Nature":
					case "Recipe_SwordFire":
					case "Recipe_SwordNiedhogg":
					case "Recipe_SwordNiedhogg_Blood":
					case "Recipe_SwordNiedhogg_Lightning":
					case "Recipe_SwordNiedhogg_Nature":
					case "Recipe_MaceEldner":
					case "Recipe_MaceEldner_Blood":
					case "Recipe_MaceEldner_Lightning":
					case "Recipe_MaceEldner_Nature":
						list33.Add(recipe);
						break;
					default:
						list26.Add(recipe);
						break;
					}
					break;
				case "TwoHandedWeapon":
				case "TwoHandedWeaponLeft":
					switch (((Object)recipe).name)
					{
					case "Recipe_PickaxeAntler":
						list27.Add(recipe);
						break;
					case "Recipe_AtgeirBronze":
					case "Recipe_SledgeStagbreaker":
					case "Recipe_PickaxeBronze":
						list28.Add(recipe);
						break;
					case "Recipe_AtgeirIron":
					case "Recipe_Battleaxe":
					case "Recipe_SledgeIron":
					case "Recipe_PickaxeIron":
						list29.Add(recipe);
						break;
					case "Recipe_FistFenrirClaw":
					case "Recipe_Battleaxe_Crystal":
						list30.Add(recipe);
						break;
					case "Recipe_AtgeirBlackmetal":
					case "Recipe_PickaxeBlackMetal":
						list31.Add(recipe);
						break;
					case "Recipe_KnifeSkollAndHati":
					case "Recipe_AtgeirHimminAfl":
					case "Recipe_SwordKrom":
					case "Recipe_SledgeDemolisher":
						list32.Add(recipe);
						break;
					case "Recipe_AxeBerzerkr":
					case "Recipe_AxeBerzerkr_Blood":
					case "Recipe_AxeBerzerkr_Lightning":
					case "Recipe_AxeBerzerkr_Nature":
					case "Recipe_SwordSlayer":
					case "Recipe_SwordSlayer_Blood":
					case "Recipe_SwordSlayer_Lightning":
					case "Recipe_SwordSlayer_Nature":
						list33.Add(recipe);
						break;
					case "Recipe_StaffFireball":
					case "Recipe_StaffIceShards":
					case "Recipe_StaffShield":
					case "Recipe_StaffSkeleton":
						list44.Add(recipe);
						break;
					case "Recipe_StaffClusterbomb":
					case "Recipe_StaffLightning":
					case "Recipe_StaffGreenRoots":
					case "Recipe_StaffRedTroll":
						list45.Add(recipe);
						break;
					default:
						list34.Add(recipe);
						break;
					}
					break;
				case "Shield":
					switch (((Object)recipe).name)
					{
					case "Recipe_ShieldWood":
					case "Recipe_ShieldWoodTower":
						list35.Add(recipe);
						break;
					case "Recipe_ShieldBronzeBuckler":
					case "Recipe_ShieldBoneTower":
						list36.Add(recipe);
						break;
					case "Recipe_ShieldIronSquare":
					case "Recipe_ShieldIronBuckler":
					case "Recipe_ShieldBanded":
					case "Recipe_ShieldIronTower":
						list37.Add(recipe);
						break;
					case "Recipe_ShieldSilver":
					case "Recipe_ShieldSerpentscale":
						list38.Add(recipe);
						break;
					case "Recipe_ShieldBlackmetal":
					case "Recipe_ShieldBlackmetalTower":
						list39.Add(recipe);
						break;
					case "Recipe_ShieldCarapaceBuckler":
					case "Recipe_ShieldCarapace":
						list40.Add(recipe);
						break;
					case "Recipe_ShieldFlametal":
					case "Recipe_ShieldFlametalTower":
						list41.Add(recipe);
						break;
					default:
						list42.Add(recipe);
						break;
					}
					break;
				case "Bow":
					list43.Add(recipe);
					break;
				case "Ammo":
					list46.Add(recipe);
					break;
				case "Tool":
					list47.Add(recipe);
					break;
				case "Torch":
					list48.Add(recipe);
					break;
				case "Misc":
					list49.Add(recipe);
					break;
				case "Consumable":
					switch (((Object)recipe).name)
					{
					case "Recipe_BoarJerky":
						list51.Add(recipe);
						break;
					case "Recipe_CarrotSoup":
						list51.Add(recipe);
						break;
					case "Recipe_DeerStew":
						list51.Add(recipe);
						break;
					case "Recipe_MinceMeatSauce":
						list51.Add(recipe);
						break;
					case "Recipe_QueensJam":
						list51.Add(recipe);
						break;
					case "Recipe_Blacksoup":
						list52.Add(recipe);
						break;
					case "Recipe_Sausages":
						list52.Add(recipe);
						break;
					case "Recipe_ShocklateSmoothie":
						list52.Add(recipe);
						break;
					case "Recipe_TurnipStew":
						list52.Add(recipe);
						break;
					case "Recipe_SerpentStew":
						list52.Add(recipe);
						break;
					case "Recipe_Eyescream":
						list53.Add(recipe);
						break;
					case "Recipe_Onionsoup":
						list53.Add(recipe);
						break;
					case "Recipe_WolfJerky":
						list53.Add(recipe);
						break;
					case "Recipe_WolfSkewer":
						list53.Add(recipe);
						break;
					case "Recipe_BloodPudding":
						list54.Add(recipe);
						break;
					case "Recipe_FishWraps":
						list54.Add(recipe);
						break;
					case "Recipe_CookedEgg":
						list56.Add(recipe);
						break;
					case "Recipe_MushroomOmelette":
						list56.Add(recipe);
						break;
					case "Recipe_Salad":
						list56.Add(recipe);
						break;
					case "Recipe_SeekerAspic":
						list56.Add(recipe);
						break;
					case "Recipe_YggdrasilPorridge":
						list56.Add(recipe);
						break;
					case "Recipe_MashedMeat":
						list58.Add(recipe);
						break;
					case "Recipe_FierySvinstew":
						list58.Add(recipe);
						break;
					case "Recipe_ScorchingMedley":
						list58.Add(recipe);
						break;
					case "Recipe_SpiceInducedMarmalade":
						list58.Add(recipe);
						break;
					case "Recipe_MarinatedGreens":
						list58.Add(recipe);
						break;
					case "Recipe_SizzlingBerryBroth":
						list58.Add(recipe);
						break;
					case "Recipe_SparklingShroomshake":
						list58.Add(recipe);
						break;
					default:
						list61.Add(recipe);
						break;
					}
					break;
				case "Material":
					switch (((Object)recipe).name)
					{
					case "Recipe_Bread":
						list55.Add(recipe);
						break;
					case "Recipe_FishAndBread":
						list55.Add(recipe);
						break;
					case "Recipe_LoxPie":
						list55.Add(recipe);
						break;
					case "Recipe_HoneyGlazedChicken":
						list57.Add(recipe);
						break;
					case "Recipe_MagicallyStuffedShroom":
						list57.Add(recipe);
						break;
					case "Recipe_MeatPlatter":
						list57.Add(recipe);
						break;
					case "Recipe_MisthareSupreme":
						list57.Add(recipe);
						break;
					case "Recipe_PiquantPie":
						list59.Add(recipe);
						break;
					case "Recipe_RoastedCrustPie":
						list59.Add(recipe);
						break;
					case "Recipe_BarleyWineBase":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseFrostResist":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBasePoisonResist":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseEitrLingering":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseEitrMinor":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseHealthLingering":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseHealthMajor":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseHealthMedium":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseHealthMinor":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseStaminaLingering":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseStaminaMedium":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseStaminaMinor":
						list60.Add(recipe);
						break;
					case "Recipe_MeadBaseTasty":
						list60.Add(recipe);
						break;
					default:
						list62.Add(recipe);
						break;
					}
					break;
				default:
					list50.Add(recipe);
					break;
				}
			}
			recipes.Clear();
			foreach (Recipe item in list50)
			{
				recipes.Add(item);
			}
			foreach (Recipe item2 in list61)
			{
				recipes.Add(item2);
			}
			foreach (Recipe item3 in list62)
			{
				recipes.Add(item3);
			}
			foreach (Recipe item4 in list47)
			{
				recipes.Add(item4);
			}
			foreach (Recipe item5 in list48)
			{
				recipes.Add(item5);
			}
			foreach (Recipe item6 in list26)
			{
				recipes.Add(item6);
			}
			foreach (Recipe item7 in list)
			{
				recipes.Add(item7);
			}
			foreach (Recipe item8 in list2)
			{
				recipes.Add(item8);
			}
			foreach (Recipe item9 in list3)
			{
				recipes.Add(item9);
			}
			foreach (Recipe item10 in list4)
			{
				recipes.Add(item10);
			}
			foreach (Recipe item11 in list5)
			{
				recipes.Add(item11);
			}
			foreach (Recipe item12 in list6)
			{
				recipes.Add(item12);
			}
			foreach (Recipe item13 in list7)
			{
				recipes.Add(item13);
			}
			foreach (Recipe item14 in list8)
			{
				recipes.Add(item14);
			}
			foreach (Recipe item15 in list9)
			{
				recipes.Add(item15);
			}
			foreach (Recipe item16 in list11)
			{
				recipes.Add(item16);
			}
			foreach (Recipe item17 in list10)
			{
				recipes.Add(item17);
			}
			foreach (Recipe item18 in list14)
			{
				recipes.Add(item18);
			}
			foreach (Recipe item19 in list13)
			{
				recipes.Add(item19);
			}
			foreach (Recipe item20 in list12)
			{
				recipes.Add(item20);
			}
			foreach (Recipe item21 in list15)
			{
				recipes.Add(item21);
			}
			foreach (Recipe item22 in list16)
			{
				recipes.Add(item22);
			}
			foreach (Recipe item23 in list17)
			{
				recipes.Add(item23);
			}
			foreach (Recipe item24 in list18)
			{
				recipes.Add(item24);
			}
			foreach (Recipe item25 in list19)
			{
				recipes.Add(item25);
			}
			foreach (Recipe item26 in list20)
			{
				recipes.Add(item26);
			}
			foreach (Recipe item27 in list21)
			{
				recipes.Add(item27);
			}
			foreach (Recipe item28 in list22)
			{
				recipes.Add(item28);
			}
			foreach (Recipe item29 in list23)
			{
				recipes.Add(item29);
			}
			foreach (Recipe item30 in list24)
			{
				recipes.Add(item30);
			}
			foreach (Recipe item31 in list25)
			{
				recipes.Add(item31);
			}
			foreach (Recipe item32 in list27)
			{
				recipes.Add(item32);
			}
			foreach (Recipe item33 in list28)
			{
				recipes.Add(item33);
			}
			foreach (Recipe item34 in list29)
			{
				recipes.Add(item34);
			}
			foreach (Recipe item35 in list30)
			{
				recipes.Add(item35);
			}
			foreach (Recipe item36 in list31)
			{
				recipes.Add(item36);
			}
			foreach (Recipe item37 in list32)
			{
				recipes.Add(item37);
			}
			foreach (Recipe item38 in list33)
			{
				recipes.Add(item38);
			}
			foreach (Recipe item39 in list34)
			{
				recipes.Add(item39);
			}
			foreach (Recipe item40 in list35)
			{
				recipes.Add(item40);
			}
			foreach (Recipe item41 in list36)
			{
				recipes.Add(item41);
			}
			foreach (Recipe item42 in list37)
			{
				recipes.Add(item42);
			}
			foreach (Recipe item43 in list38)
			{
				recipes.Add(item43);
			}
			foreach (Recipe item44 in list39)
			{
				recipes.Add(item44);
			}
			foreach (Recipe item45 in list40)
			{
				recipes.Add(item45);
			}
			foreach (Recipe item46 in list41)
			{
				recipes.Add(item46);
			}
			foreach (Recipe item47 in list42)
			{
				recipes.Add(item47);
			}
			foreach (Recipe item48 in list43)
			{
				recipes.Add(item48);
			}
			foreach (Recipe item49 in list44)
			{
				recipes.Add(item49);
			}
			foreach (Recipe item50 in list45)
			{
				recipes.Add(item50);
			}
			foreach (Recipe item51 in list51)
			{
				recipes.Add(item51);
			}
			foreach (Recipe item52 in list52)
			{
				recipes.Add(item52);
			}
			foreach (Recipe item53 in list53)
			{
				recipes.Add(item53);
			}
			foreach (Recipe item54 in list54)
			{
				recipes.Add(item54);
			}
			foreach (Recipe item55 in list55)
			{
				recipes.Add(item55);
			}
			foreach (Recipe item56 in list56)
			{
				recipes.Add(item56);
			}
			foreach (Recipe item57 in list57)
			{
				recipes.Add(item57);
			}
			foreach (Recipe item58 in list58)
			{
				recipes.Add(item58);
			}
			foreach (Recipe item59 in list59)
			{
				recipes.Add(item59);
			}
			foreach (Recipe item60 in list60)
			{
				recipes.Add(item60);
			}
			foreach (Recipe item61 in list46)
			{
				recipes.Add(item61);
			}
			foreach (Recipe item62 in list49)
			{
				recipes.Add(item62);
			}
		}
	}
}
internal class MMDeathRaiserChanges
{
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	private static class BetterDeathRaiser_Equipment_Patch
	{
		private static void Postfix(ZNetScene __instance)
		{
			if (!Object.op_Implicit((Object)(object)__instance) || !MMConfigManager.betterSummonedSkeletonGearEnabled)
			{
				return;
			}
			for (int i = 0; i < summonedSkeletonArmorsWarrior.Length; i++)
			{
				if ((Object)(object)summonedSkeletonArmorWarriorObjects[i] == (Object)null)
				{
					summonedSkeletonArmorWarriorObjects[i] = ZNetScene.instance.GetPrefab(summonedSkeletonArmorsWarrior[i]);
				}
			}
			for (int j = 0; j < summonedSkeletonArmorsBowman.Length; j++)
			{
				if ((Object)(object)summonedSkeletonArmorBowmanObjects[j] == (Object)null)
				{
					summonedSkeletonArmorBowmanObjects[j] = ZNetScene.instance.GetPrefab(summonedSkeletonArmorsBowman[j]);
				}
			}
			for (int k = 0; k < summonedSkeletonWeapons.Length; k++)
			{
				if ((Object)(object)summonedSkeletonWeaponsObjects[k] == (Object)null)
				{
					summonedSkeletonWeaponsObjects[k] = ZNetScene.instance.GetPrefab(summonedSkeletonWeapons[k]);
				}
			}
			for (int l = 0; l < summonedSkeletonShields.Length; l++)
			{
				if ((Object)(object)summonedSkeletonShieldsObjects[l] == (Object)null)
				{
					summonedSkeletonShieldsObjects[l] = ZNetScene.instance.GetPrefab(summonedSkeletonShields[l]);
				}
			}
			for (int m = 0; m < summonedSkeletonBows.Length; m++)
			{
				if ((Object)(object)summonedSkeletonBowsObjects[m] == (Object)null)
				{
					summonedSkeletonBowsObjects[m] = ZNetScene.instance.GetPrefab(summonedSkeletonBows[m]);
				}
			}
			GameObject prefab = ZNetScene.instance.GetPrefab("skeleton_bow2");
			if ((Object)(object)prefab != (Object)null)
			{
				bowAi = prefab.GetComponent<ItemDrop>();
			}
			GameObject prefab2 = ZNetScene.instance.GetPrefab("skeleton_sword2");
			if ((Object)(object)prefab != (Object)null)
			{
				swordAi = prefab2.GetComponent<ItemDrop>();
			}
		}
	}

	[HarmonyPatch(typeof(ObjectDB), "Awake")]
	private class BetterDeathRaiserHPPercent_Patch
	{
		private static void Prefix(ref ObjectDB __instance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (!MMConfigManager.betterDeathRaiserEnabled)
			{
				return;
			}
			ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType));
			ItemType val = (ItemType)0;
			bool flag = false;
			ItemType[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				ItemType val2 = array2[i];
				if (((object)(ItemType)(ref val2)).ToString() == "TwoHandedWeaponLeft")
				{
					val = val2;
					flag = true;
				}
				if (flag)
				{
					break;
				}
			}
			List<ItemDrop> allItems = __instance.GetAllItems(val, "");
			foreach (ItemDrop item in allItems)
			{
				if (item.m_itemData.m_shared.m_name == "$item_staffskeleton")
				{
					item.m_itemData.m_shared.m_attack.m_attackHealthPercentage = 30f;
					break;
				}
			}
		}
	}

	[HarmonyPatch(typeof(Humanoid), "Awake")]
	private class BetterDeathRaiserSkeletonStatsAndRatio_Patch
	{
		private static void Prefix(Humanoid __instance, ref GameObject[] ___m_randomWeapon, ref GameObject[] ___m_randomShield)
		{
			if (!Object.op_Implicit((