Decompiled source of Skill Cap Mod v1.0.23

ValheimSkillCapMod.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ValheimSkillCapMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValheimSkillCapMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("19F0E6BA-DE2B-4504-9801-0F9360E3D9EB")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MyBepInExPlugin;

[BepInPlugin("com.example.GUID", "MyPlugin", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch]
	private static class ChangeRaiseSkillMethod
	{
		public static Player vagonUser;

		public static bool hasDoubleJumped = false;

		public static bool grantInvuln = false;

		public static int invulnTimer = 0;

		public static bool timerGoesDown = false;

		public static float moveTimer;

		public static bool canBeInvisible;

		public static HashSet<string> autoPickables = new HashSet<string> { "Pickable_Dandelion(Clone)", "RaspberryBush(Clone)", "Pickable_Mushroom(Clone)", "BlueberryBush(Clone)", "Pickable_Thistle(Clone)", "Pickable_Mushroom_yellow(Clone)", "CloudberryBush(Clone)", "Pickable_Fiddlehead(Clone)", "Pickable_SmokePuff(Clone)" };

		public const string RPCNAME_RPC_ApplyEffectsToOtherPlayers = "Lelouis";

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Skills), "RaiseSkill")]
		public static bool RaiseSkill(Skills __instance, SkillType skillType, float factor = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((int)skillType == 0)
			{
				return false;
			}
			float skillLevel = __instance.GetSkillLevel(skillType);
			float num = skillLevel;
			float num2 = num;
			if (num2 >= 10f && num2 < 20f)
			{
				if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_eikthyr"))
				{
					return false;
				}
			}
			else
			{
				float num3 = num2;
				if (num3 >= 20f && num3 < 30f)
				{
					if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_gdking"))
					{
						return false;
					}
				}
				else
				{
					float num4 = num2;
					if (num4 >= 30f && num4 < 40f)
					{
						if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_bonemass"))
						{
							return false;
						}
					}
					else
					{
						float num5 = num2;
						if (num5 >= 40f && num5 < 50f)
						{
							if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_dragon"))
							{
								return false;
							}
						}
						else
						{
							float num6 = num2;
							if (num6 >= 50f && num6 < 60f)
							{
								if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_goblinking"))
								{
									return false;
								}
							}
							else
							{
								float num7 = num2;
								if (num7 >= 60f && num7 < 75f)
								{
									if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_queen"))
									{
										return false;
									}
								}
								else
								{
									float num8 = num2;
									if (num8 >= 75f && num8 < 100f && !ZoneSystem.instance.GetGlobalKeys().Contains("defeated_fader"))
									{
										return false;
									}
								}
							}
						}
					}
				}
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Skills), "OnDeath")]
		public static bool DoNotLowerSkills()
		{
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Vagon), "FixedUpdate")]
		public static void RaiseCarrierSpeed(Vagon __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			if (!(((Object)((Component)__instance).gameObject).name == "TurboCart(Clone)"))
			{
				return;
			}
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_attachedObject", BindingFlags.Instance | BindingFlags.NonPublic);
			GameObject val = (GameObject)field.GetValue(__instance);
			if ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)vagonUser != (Object)(object)val.GetComponent<Player>())
				{
					vagonUser = val.GetComponent<Player>();
					((Character)vagonUser).m_runSpeed = 21f;
					((Character)vagonUser).m_walkSpeed = 12f;
				}
			}
			else if ((Object)(object)vagonUser != (Object)null)
			{
				((Character)vagonUser).m_runSpeed = 7f;
				((Character)vagonUser).m_walkSpeed = 4f;
				vagonUser = null;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
		public static void AddBonusItem()
		{
			SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan();
			InventoryGui.instance.m_craftBonusChance = 0.25f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (((Object)statusEffect).name == "SetEffect_ChefHat")
				{
					InventoryGui.instance.m_craftBonusChance = 0.5f;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CookingStation), "OnInteract")]
		public static void AddBonusItemCooking()
		{
			SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan();
			InventoryGui.instance.m_craftBonusChance = 0.25f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (((Object)statusEffect).name == "SetEffect_ChefHat")
				{
					InventoryGui.instance.m_craftBonusChance = 0.5f;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "Awake")]
		public static void ChangeEikthyrHP(Humanoid __instance)
		{
			if (((Object)__instance).name == "Eikthyr(Clone)")
			{
				((Character)__instance).m_health = 1000f;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "Jump")]
		public static void DoubleJump(Character __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (!hasDoubleJumped && !__instance.IsOnGround() && __instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && __instance.GetSkillFactor((SkillType)100) >= 0.5f && ((Component)__instance).GetComponent<Player>().GetStamina() > 10f)
			{
				hasDoubleJumped = true;
				__instance.ForceJump(new Vector3(0f, 10f, 0f), true);
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_maxAirAltitude", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(__instance, __instance.GetHeight());
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "UpdateTeleport")]
		public static void InvulnAfterTP(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			if (((Character)__instance).IsTeleporting())
			{
				grantInvuln = true;
				invulnTimer = 300;
			}
			else if (grantInvuln && !((Character)__instance).IsTeleporting())
			{
				grantInvuln = false;
				timerGoesDown = true;
				__instance.SetGodMode(true);
				logger.LogInfo((object)"god mode = true");
			}
			if (timerGoesDown)
			{
				invulnTimer--;
				if (invulnTimer == 0)
				{
					timerGoesDown = false;
					__instance.SetGodMode(false);
					logger.LogInfo((object)"god mode = false");
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "ApplyDamage")]
		public static bool TrueGodMode(Character __instance)
		{
			if (__instance.InGodMode())
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "UpdateGroundContact")]
		public static void ResetDoubleJump(Character __instance)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && __instance.GetSkillFactor((SkillType)100) >= 0.3f)
			{
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_maxAirAltitude", BindingFlags.Instance | BindingFlags.NonPublic);
				float num = Mathf.Max(0f, (float)field.GetValue(__instance) - ((Component)__instance).transform.position.y);
				if (num < 8f)
				{
					SEMan sEMan = __instance.GetSEMan();
					sEMan.AddStatusEffect(newHaldorAssetBundle.LoadAsset<StatusEffect>("SetEffect_SlowFall"), false, 0, 0f);
				}
			}
			if (__instance.IsPlayer() && __instance.IsOnGround() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				hasDoubleJumped = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "UpdateGroundContact")]
		public static void RemoveSlowFall(Character __instance)
		{
			if (!__instance.IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = __instance.GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects.Count <= 0)
			{
				return;
			}
			bool flag = false;
			StatusEffect val = ScriptableObject.CreateInstance<StatusEffect>();
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "SlowFall")
				{
					flag = true;
					val = item;
				}
			}
			if (flag)
			{
				sEMan.RemoveStatusEffect(val, false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "UpdateWalking")]
		public static void IncreaseSneakSpeed(Character __instance)
		{
			if (__instance.IsPlayer() && __instance.IsOnGround() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && !__instance.IsEncumbered() && __instance.GetSkillFactor((SkillType)101) >= 0.2f)
			{
				__instance.m_crouchSpeed = 4.5f;
			}
			else if (__instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				__instance.m_crouchSpeed = 2f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		public static void ActivateMagicShield(Humanoid __instance)
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer) || !((Character)__instance).HaveEitr(10f) || !((Character)__instance).IsBlocking())
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<Player> list = new List<Player>();
			float num = 4f;
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (statusEffect.m_name == "Extended Buffing Range")
				{
					num = 8f;
				}
			}
			foreach (StatusEffect statusEffect2 in sEMan.GetStatusEffects())
			{
				if (!(statusEffect2.m_name == "Magic Shield"))
				{
					continue;
				}
				((Character)__instance).UseEitr(10f);
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, num, -1, (QueryTriggerInteraction)1);
				if (array.Length == 0 || array == null)
				{
					continue;
				}
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
					{
						list.Add(((Component)val).GetComponentInParent<Player>());
					}
				}
			}
			foreach (Player item in list)
			{
				SEMan sEMan2 = ((Character)item).GetSEMan();
				sEMan2.AddStatusEffect(ItemManager.Instance.GetItem("WoodCopy1").ItemDrop.m_itemData.m_shared.m_attackStatusEffect, false, 0, 0f);
				sEMan2.AddStatusEffect((StatusEffect)(object)newHaldorAssetBundle.LoadAsset<SE_Stats>("StatusEffect_MagicShieldActivatedEffect"), false, 0, 0f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "CustomFixedUpdate")]
		public static void Dive(Humanoid __instance)
		{
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			((Character)__instance).m_swimDepth = 2f;
			if (((Character)__instance).IsSwimming() && ((Character)__instance).IsBlocking() && ((Character)__instance).GetStaminaPercentage() > 0.01f && ((Character)__instance).GetSkillFactor((SkillType)103) >= 0.2f)
			{
				((Character)__instance).m_swimDepth = 10f;
				((Character)__instance).UseStamina(Mathf.Lerp(0.4f, 0.1f, ((Character)__instance).GetSkillFactor((SkillType)103)));
			}
			if (!((Character)__instance).IsSwimming())
			{
				return;
			}
			Inventory inventory = __instance.GetInventory();
			if (!inventory.ContainsItemByName("Empty Bucket"))
			{
				return;
			}
			List<ItemData> allItems = inventory.GetAllItems();
			List<ItemData> list = new List<ItemData>();
			foreach (ItemData item2 in allItems)
			{
				if (item2.m_shared.m_name == "Empty Bucket")
				{
					list.Add(item2);
				}
			}
			foreach (ItemData item3 in list)
			{
				CustomItem item = ItemManager.Instance.GetItem("WaterBucket");
				inventory.AddItem(item.ItemDrop.m_itemData.m_dropPrefab, item3.m_stack);
				inventory.RemoveItem("Empty Bucket", item3.m_stack, -1, true);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "GetStealthFactor")]
		public static void SetInvisible(Player __instance)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (((Character)__instance).GetSkillFactor((SkillType)101) >= 0.5f && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && ((Character)__instance).IsCrouching() && canBeInvisible)
			{
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_stealthFactor", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(__instance, 0f);
			}
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				goto IL_00a3;
			}
			if (!((Character)__instance).InDodge())
			{
				Vector3 velocity = ((Character)__instance).GetVelocity();
				if (!(((Vector3)(ref velocity)).magnitude > 0.01f))
				{
					goto IL_00a3;
				}
			}
			moveTimer = 180f;
			canBeInvisible = false;
			goto IL_00b5;
			IL_00b5:
			if (moveTimer <= 0f)
			{
				canBeInvisible = true;
			}
			return;
			IL_00a3:
			moveTimer -= 1f;
			goto IL_00b5;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "HideHandItems")]
		public static bool AttackWhileSwimming(Humanoid __instance)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Invalid comparison between Unknown and I4
			if (((Character)__instance).IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				int num = 0;
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_leftItem", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance) == null)
				{
					num++;
				}
				type = ((object)__instance).GetType();
				field = type.GetField("m_rightItem", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance) == null)
				{
					num++;
				}
				if (num == 2)
				{
					return false;
				}
				if (__instance.RightItem != null && (int)__instance.RightItem.m_shared.m_skillType == 2 && ((Character)__instance).GetSkillFactor((SkillType)103) >= 0.3f)
				{
					if (__instance.LeftItem != null)
					{
						__instance.UnequipItem(__instance.LeftItem, true);
					}
					return false;
				}
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TombStone), "Start")]
		public static void ChangeCorpseRunWeight(TombStone __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			SE_Stats val = (SE_Stats)__instance.m_lootStatusEffect;
			val.m_addMaxCarryWeight = 700f;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public static void IncreaseWorldExp(Character __instance)
		{
			if (__instance.IsBoss())
			{
				ConfigEntry<float> worldExpModifier = Main.worldExpModifier;
				worldExpModifier.Value += 0.2f;
				logger.LogInfo((object)Main.worldExpModifier.Value);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Game), "UpdateWorldRates")]
		public static void ForceSetWorldExpRate()
		{
			Game.m_skillGainRate = worldExpModifier.Value;
		}

		[HarmonyPatch(typeof(Trader), "Start")]
		[HarmonyPrefix]
		public static void SwapHaldor(Trader __instance)
		{
			if (((Object)((Component)__instance).gameObject).name == "Haldor(Clone)")
			{
				__instance.m_items = PrefabManager.Instance.GetPrefab("newhaldor").GetComponent<Trader>().m_items;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Tameable), "Interact")]
		public static void GiveMilk(Tameable __instance)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.m_saddleItem != (Object)null) || !(__instance.m_saddleItem.m_itemData.m_shared.m_name == "$item_saddlelox"))
			{
				return;
			}
			Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
			if (array.Length == 0 || array == null)
			{
				return;
			}
			List<Player> list = new List<Player>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
				{
					list.Add(((Component)val).GetComponentInParent<Player>());
				}
			}
			foreach (Player item2 in list)
			{
				Inventory inventory = ((Humanoid)item2).GetInventory();
				if (!inventory.ContainsItemByName("Empty Bucket"))
				{
					continue;
				}
				List<ItemData> allItems = inventory.GetAllItems();
				List<ItemData> list2 = new List<ItemData>();
				foreach (ItemData item3 in allItems)
				{
					if (item3.m_shared.m_name == "Empty Bucket")
					{
						list2.Add(item3);
					}
				}
				foreach (ItemData item4 in list2)
				{
					CustomItem item = ItemManager.Instance.GetItem("MilkBucket");
					inventory.AddItem(item.ItemDrop.m_itemData.m_dropPrefab, item4.m_stack);
					inventory.RemoveItem("Empty Bucket", item4.m_stack, -1, true);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "UpdateCover")]
		public static void HasWaxedCape(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects == null || statusEffects.Count <= 0)
			{
				return;
			}
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "Waterproof" || item.m_name == "WaterproofSlowFall" || item.m_name == "WaterproofWindRun")
				{
					Type type = ((object)__instance).GetType();
					FieldInfo field = type.GetField("m_underRoof", BindingFlags.Instance | BindingFlags.NonPublic);
					field.SetValue(__instance, true);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Update")]
		public static void AutoPickBerries(Player __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			_ = ((Component)__instance).transform.position;
			if (((Character)__instance).GetSEMan() == null)
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			__instance.m_autoPickupRange = 2f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (!(((Object)statusEffect).name == "SetEffect_GathererGloves"))
				{
					continue;
				}
				__instance.m_autoPickupRange = 4f;
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
				if (array.Length == 0 || array == null)
				{
					continue;
				}
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if ((Object)(object)((Component)val).GetComponentInParent<Pickable>() != (Object)null)
					{
						Pickable componentInParent = ((Component)val).GetComponentInParent<Pickable>();
						if (autoPickables.Contains(((Object)componentInParent).name))
						{
							componentInParent.Interact((Humanoid)(object)__instance, false, false);
						}
					}
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Aoe), "OnHit")]
		public static bool RemoveDuplicateHEaling(Aoe __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.m_name == "Healing AoE")
			{
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
				if (array.Length != 0 && array != null)
				{
					List<Player> list = new List<Player>();
					Collider[] array2 = array;
					foreach (Collider val in array2)
					{
						if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
						{
							list.Add(((Component)val).GetComponentInParent<Player>());
						}
					}
					foreach (Player item in list)
					{
						SEMan sEMan = ((Character)item).GetSEMan();
						List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
						foreach (StatusEffect item2 in statusEffects)
						{
							if (item2.m_name == "Healing")
							{
								return false;
							}
						}
					}
				}
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "DoAreaAttack")]
		public static void ApplyAoEBuffs(Attack __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_character", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field.GetValue(__instance).GetType() == typeof(Player)))
			{
				return;
			}
			Player val = (Player)field.GetValue(__instance);
			if (!((Object)(object)val == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)val).GetSEMan();
			float num = 4f;
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (statusEffect.m_name == "Extended Buffing Range")
				{
					num = 8f;
				}
			}
			if (__instance.GetWeapon().m_shared.m_name == "Odin's Tankard")
			{
				Collider[] array = Physics.OverlapSphere(((Component)val).transform.position, num, -1, (QueryTriggerInteraction)1);
				if (array.Length != 0 && array != null)
				{
					List<Player> list = new List<Player>();
					Collider[] array2 = array;
					foreach (Collider val2 in array2)
					{
						if ((Object)(object)((Component)val2).GetComponentInParent<Player>() != (Object)null)
						{
							list.Add(((Component)val2).GetComponentInParent<Player>());
						}
					}
					foreach (Player item in list)
					{
						SEMan sEMan2 = ((Character)item).GetSEMan();
						List<StatusEffect> statusEffects = sEMan2.GetStatusEffects();
						List<StatusEffect> list2 = new List<StatusEffect>();
						foreach (StatusEffect item2 in statusEffects)
						{
							if (item2.m_name == "Attack Buff Visual" || item2.m_name == "Attack Buff")
							{
								list2.Add(item2);
							}
						}
						if (list2.Count > 0)
						{
							foreach (StatusEffect item3 in list2)
							{
								ZRoutedRpc.instance.InvokeRoutedRPC(item.GetPlayerID(), "RPC_RemoveEffectsFromOtherPlayers", new object[2] { item, item3 });
							}
						}
						ZRoutedRpc.instance.InvokeRoutedRPC(item.GetPlayerID(), "RPC_ApplyEffectsToOtherPlayers", new object[2]
						{
							item,
							ItemManager.Instance.GetItem("WoodCopy2").ItemDrop.m_itemData.m_shared.m_attackStatusEffect
						});
						ZRoutedRpc.instance.InvokeRoutedRPC(item.GetPlayerID(), "RPC_ApplyEffectsToOtherPlayers", new object[2]
						{
							item,
							newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_AttackBuff")
						});
						if ((Object)(object)item != (Object)(object)Player.m_localPlayer)
						{
							((Character)val).RaiseSkill((SkillType)9, 1f);
						}
					}
				}
			}
			if (!(__instance.GetWeapon().m_shared.m_name == "French Horn"))
			{
				return;
			}
			Collider[] array3 = Physics.OverlapSphere(((Component)val).transform.position, num, -1, (QueryTriggerInteraction)1);
			if (array3.Length == 0 || array3 == null)
			{
				return;
			}
			List<Player> list3 = new List<Player>();
			Collider[] array4 = array3;
			foreach (Collider val3 in array4)
			{
				if ((Object)(object)((Component)val3).GetComponentInParent<Player>() != (Object)null)
				{
					list3.Add(((Component)val3).GetComponentInParent<Player>());
				}
			}
			foreach (Player item4 in list3)
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(item4.GetPlayerID(), "RPC_ApplyEffectsToOtherPlayers", new object[2]
				{
					item4,
					newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_StaminaBoost")
				});
				if ((Object)(object)item4 != (Object)(object)Player.m_localPlayer)
				{
					((Character)val).RaiseSkill((SkillType)9, 1f);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Start")]
		public static void RemovePieceDuplicates()
		{
			if (PieceManager.Instance.GetPiece("Smelter") != null)
			{
				PieceManager.Instance.RemovePiece("Smelter");
			}
			if (PieceManager.Instance.GetPiece("cartCopy") != null)
			{
				PieceManager.Instance.RemovePiece("cartCopy");
			}
			if (PieceManager.Instance.GetPiece("roofCopy") != null)
			{
				PieceManager.Instance.RemovePiece("roofCopy");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Game), "Start")]
		public static void Remove5PlayersLimit(Game __instance)
		{
			__instance.m_difficultyScaleMaxPlayers = 99;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Pickable), "Awake")]
		public static void AddFarmingToDandelion(Pickable __instance)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)__instance).gameObject).name == "Pickable_Dandelion(Clone)" || ((Object)((Component)__instance).gameObject).name == "Pickable_SmokePuff(Clone)" || ((Object)((Component)__instance).gameObject).name == "Pickable_Thistle(Clone)")
			{
				__instance.m_pickRaiseSkill = (SkillType)106;
			}
			if (((Object)((Component)__instance).gameObject).name == "Pickable_MeatPile(Clone)")
			{
				DropData item = new DropData
				{
					m_item = ZNetScene.instance.GetPrefab("RottenMeat"),
					m_weight = 0.8f,
					m_stackMin = 1,
					m_stackMax = 1
				};
				DropTable extraDrops = ((Component)__instance).GetComponent<Pickable>().m_extraDrops;
				extraDrops.m_dropMax = 4;
				extraDrops.m_drops.Add(item);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Dodge")]
		public static void RefillTorch(Player __instance)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			SE_Stats val = null;
			if (statusEffects.Count > 0)
			{
				foreach (StatusEffect item in statusEffects)
				{
					if (item.m_name == "Auto Replant Trees")
					{
						val = (SE_Stats)item;
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				sEMan.RemoveStatusEffect((StatusEffect)(object)val, false);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "UpdateEquipment")]
		public static void RefillTorch(Humanoid __instance)
		{
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			if (__instance.RightItem != null && __instance.RightItem.m_shared.m_useDurability && __instance.RightItem.m_shared.m_name == "Refillable Torch" && __instance.RightItem.m_durability <= 1f)
			{
				Inventory inventory = __instance.GetInventory();
				if (inventory.ContainsItemByName("$item_resin"))
				{
					inventory.RemoveItem("$item_resin", 1, -1, true);
					__instance.RightItem.m_durability = 20f;
				}
			}
			if (__instance.LeftItem != null && __instance.LeftItem.m_shared.m_useDurability && __instance.LeftItem.m_shared.m_name == "Refillable Torch" && __instance.LeftItem.m_durability <= 10f)
			{
				Inventory inventory2 = __instance.GetInventory();
				if (inventory2.ContainsItemByName("$item_resin"))
				{
					inventory2.RemoveItem("$item_resin", 1, -1, true);
					__instance.LeftItem.m_durability = 20f;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "UpdateEquipment")]
		public static void ChangeReloadSpeed(Humanoid __instance)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Invalid comparison between Unknown and I4
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "Improved Realoding Speed" && __instance.LeftItem != null && (int)__instance.LeftItem.m_shared.m_skillType == 14)
				{
					__instance.LeftItem.m_shared.m_attack.m_reloadTime = 1.75f;
					return;
				}
			}
			if (__instance.LeftItem != null && (int)__instance.LeftItem.m_shared.m_skillType == 14)
			{
				__instance.LeftItem.m_shared.m_attack.m_reloadTime = 3.5f;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ZNet), "SetPublicReferencePosition")]
		public static bool ForcePublic(ZNet __instance)
		{
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_publicReferencePosition", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(__instance, true);
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "ProjectileAttackTriggered")]
		public static void ShootSecondProjectile(Attack __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_ammoItem", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field.GetValue(__instance) == null || !(field.GetValue(__instance).GetType() == typeof(ItemData)))
			{
				return;
			}
			ItemData val = (ItemData)field.GetValue(__instance);
			if ((int)__instance.m_attackType != 2 || (int)val.m_shared.m_skillType != 8)
			{
				return;
			}
			type = ((object)__instance).GetType();
			field = type.GetField("m_character", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field.GetValue(__instance).GetType() == typeof(Player)))
			{
				return;
			}
			Player val2 = (Player)field.GetValue(__instance);
			if ((Object)(object)val2 == (Object)(object)Player.m_localPlayer)
			{
				Random random = new Random();
				if (((Character)val2).GetSkillFactor((SkillType)8) >= 0.5f && random.Next(10) < 1)
				{
					MethodInfo method = typeof(Attack).GetMethod("FireProjectileBurst", BindingFlags.Instance | BindingFlags.NonPublic);
					method.Invoke(__instance, Array.Empty<object>());
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Projectile), "SpawnOnHit")]
		public static bool SpearRaycast(Projectile __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0024: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			if ((int)__instance.m_type == 64)
			{
				ItemDrop component = Object.Instantiate<GameObject>(__instance.m_spawnItem.m_dropPrefab, ((Component)__instance).transform.position + ((Component)__instance).transform.TransformDirection(__instance.m_spawnOffset), Quaternion.identity).GetComponent<ItemDrop>();
				component.m_itemData = __instance.m_spawnItem.Clone();
				if (component.m_itemData.m_quality > 1)
				{
					component.SetQuality(component.m_itemData.m_quality);
				}
				bool flag = true;
				component.m_itemData.m_stack = 1;
				if (component.m_onDrop != null)
				{
					component.m_onDrop(component);
				}
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_owner", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance).GetType() == typeof(Player))
				{
					object? value = field.GetValue(__instance);
					Player val = (Player)((value is Player) ? value : null);
					if ((Object)(object)val == (Object)(object)Player.m_localPlayer && ((Character)val).GetSkillFactor((SkillType)5) >= 0.3f)
					{
						LineRenderer val2 = ((Component)component).gameObject.AddComponent<LineRenderer>();
						val2.positionCount = 2;
						Vector3 val3 = default(Vector3);
						((Vector3)(ref val3))..ctor(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 5f, ((Component)__instance).transform.position.z);
						Vector3 val4 = default(Vector3);
						((Vector3)(ref val4))..ctor(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y - 100f, ((Component)__instance).transform.position.z);
						Vector3[] positions = (Vector3[])(object)new Vector3[2] { val3, val4 };
						val2.SetPositions(positions);
						val2.SetPositions(positions);
						Material material = ((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/smoke (1)")).GetComponent<Renderer>().material;
						((Renderer)val2).material.shader = material.shader;
						((Renderer)val2).material.color = new Color(1f, 1f, 1f, 0.25f);
						val2.widthMultiplier = 0.5f;
					}
				}
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "CheckRun")]
		public static void ActivateSecondWind(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer) || ((Character)__instance).HaveStamina(0f))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects != null && statusEffects.Count > 0)
			{
				foreach (StatusEffect item in statusEffects)
				{
					if (item.m_name == newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_SecondWind").m_name)
					{
						return;
					}
				}
			}
			sEMan.AddStatusEffect(newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_SecondWind"), false, 0, 0f);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DropOnDestroyed), "OnDestroyed")]
		public static void ReplantTree(DropOnDestroyed __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 2f, -1, (QueryTriggerInteraction)1);
			List<Player> list = new List<Player>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
				{
					list.Add(((Component)val).GetComponentInParent<Player>());
				}
			}
			bool flag = false;
			Player val2 = null;
			Inventory val3 = null;
			bool flag2 = false;
			foreach (Player item in list)
			{
				foreach (StatusEffect statusEffect in ((Character)item).GetSEMan().GetStatusEffects())
				{
					if (statusEffect.m_name == "Auto Replant Trees")
					{
						flag2 = true;
					}
				}
				if (((Character)item).GetSkillFactor((SkillType)13) >= 0.3f && flag2)
				{
					flag = true;
					val2 = item;
					val3 = ((Humanoid)item).GetInventory();
					break;
				}
			}
			if (!flag)
			{
				return;
			}
			switch (((Object)__instance).name)
			{
			case "Beech_Stub(Clone)":
				if (val3.ContainsItemByName("$item_beechseeds"))
				{
					val3.RemoveItem("$item_beechseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Beech_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "BirchStub(Clone)":
				if (val3.ContainsItemByName("$item_birchseeds"))
				{
					val3.RemoveItem("$item_birchseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Birch_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "OakStub(Clone)":
				if (val3.ContainsItemByName("$item_oakseeds"))
				{
					val3.RemoveItem("$item_oakseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Oak_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "FirTree_Stub(Clone)":
				if (val3.ContainsItemByName("$item_fircone"))
				{
					val3.RemoveItem("$item_fircone", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("FirTree_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "Pinetree_01_Stub(Clone)":
				if (val3.ContainsItemByName("$item_pinecone"))
				{
					val3.RemoveItem("$item_pinecone", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("PineTree_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Beehive), "RPC_Extract")]
		public static void GenerateWax(Beehive __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			CustomItem item = ItemManager.Instance.GetItem("wax");
			ItemDrop itemDrop = item.ItemDrop;
			Random random = new Random();
			MethodInfo method = typeof(Beehive).GetMethod("GetHoneyLevel", BindingFlags.Instance | BindingFlags.NonPublic);
			int num = (int)method.Invoke(__instance, Array.Empty<object>());
			if (num <= 0)
			{
				return;
			}
			for (int i = 0; i < num; i++)
			{
				if (random.Next(10) == 0)
				{
					__instance.m_spawnEffect.Create(__instance.m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1);
					Vector3 position = __instance.m_spawnPoint.position;
					ItemDrop component = ((Component)Object.Instantiate<ItemDrop>(itemDrop, position, Quaternion.identity)).GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						component.SetStack(Game.instance.ScaleDrops(item.ItemDrop.m_itemData, 1));
					}
				}
			}
		}

		private static void RPC_ApplyEffectsToOtherPlayers(long sender, Player target, StatusEffect effect)
		{
			SEMan sEMan = ((Character)target).GetSEMan();
			sEMan.AddStatusEffect(effect, false, 0, 0f);
		}

		private static void RPC_RemoveEffectsFromOtherPlayers(long sender, Player target, StatusEffect effect)
		{
			SEMan sEMan = ((Character)target).GetSEMan();
			sEMan.AddStatusEffect(effect, false, 0, 0f);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Load")]
		public static void PatchRPCsPlayers(Player __instance)
		{
			try
			{
				ZRoutedRpc.instance.Register<Player, StatusEffect>("Lelouis", (Action<long, Player, StatusEffect>)RPC_ApplyEffectsToOtherPlayers);
			}
			catch
			{
				logger.LogInfo((object)"The RPC has already been registered!\nThis can happen if you are hosting without a dedicated server");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ZoneSystem), "Load")]
		public static void PatchRPCsServer()
		{
			if (ZNet.instance.IsServer())
			{
				try
				{
					ZRoutedRpc.instance.Register<Player, StatusEffect>("Lelouis", (Action<long, Player, StatusEffect>)RPC_ApplyEffectsToOtherPlayers);
				}
				catch
				{
					logger.LogInfo((object)"The RPC has already been registered!\nThis can happen if you are hosting without a dedicated server");
				}
			}
		}
	}

	private const string pluginGUID = "com.example.GUID";

	private const string pluginName = "MyPlugin";

	private const string pluginVersion = "1.0.0";

	private readonly Harmony HarmonyInstance = new Harmony("com.example.GUID");

	public static ManualLogSource logger = Logger.CreateLogSource("MyPlugin");

	public AssetBundle waxAsset;

	public GameObject waxPrefab;

	public AssetBundle capesBundle;

	public GameObject capeDeer;

	public GameObject capeTroll;

	public GameObject capeWolfWaterproof;

	public GameObject capeLoxWaterproof;

	public GameObject capeLinenWaterproof;

	public GameObject capeFeatherWaterproof;

	public GameObject capeAsksvinWaterproof;

	public GameObject capeAshWaterproof;

	public static AssetBundle newHaldorAssetBundle;

	public GameObject newHaldor;

	public AssetBundle foodsAssetBundle;

	public static ConfigEntry<float> worldExpModifier;

	public Shader standardSurface2;

	public Shader CustomParticleUnlit;

	public Shader CustomCreature;

	public Shader CustomGrass;

	public Shader CustomPlayer;

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		HarmonyInstance.PatchAll(executingAssembly);
		LoadAssets();
		AddRecipes();
		PrefabManager.OnVanillaPrefabsAvailable += CreateWax;
		PrefabManager.OnVanillaPrefabsAvailable += CreateCapes;
		PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
		PrefabManager.OnVanillaPrefabsAvailable += FixShaders;
		PrefabManager.OnVanillaPrefabsAvailable += CreateNewHaldor;
	}

	private void LoadAssets()
	{
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Expected O, but got Unknown
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Expected O, but got Unknown
		string location = Assembly.GetExecutingAssembly().Location;
		location = location.Substring(0, location.Length - 22);
		location = location.Replace('\\', '/');
		string text = location;
		string text2 = location;
		string text3 = location;
		string text4 = location;
		string text5 = location;
		waxAsset = AssetUtils.LoadAssetBundle(text += "wax");
		waxPrefab = waxAsset.LoadAsset<GameObject>("wax");
		capesBundle = AssetUtils.LoadAssetBundle(text2 += "capes");
		capeDeer = capesBundle.LoadAsset<GameObject>("capeDeer");
		capeTroll = capesBundle.LoadAsset<GameObject>("capeTroll");
		capeWolfWaterproof = capesBundle.LoadAsset<GameObject>("capeWolfWaterproof");
		capeLoxWaterproof = capesBundle.LoadAsset<GameObject>("capeLoxWaterproof");
		capeLinenWaterproof = capesBundle.LoadAsset<GameObject>("capeLinenWaterproof");
		capeFeatherWaterproof = capesBundle.LoadAsset<GameObject>("capeFeatherWaterproof");
		capeAsksvinWaterproof = capesBundle.LoadAsset<GameObject>("capeAsksvinWaterproof");
		capeAshWaterproof = capesBundle.LoadAsset<GameObject>("capeAshWaterproof");
		newHaldorAssetBundle = AssetUtils.LoadAssetBundle(text3 += "newhaldor");
		newHaldor = newHaldorAssetBundle.LoadAsset<GameObject>("newhaldor");
		foodsAssetBundle = AssetUtils.LoadAssetBundle(text4 += "foods");
		worldExpModifier = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "FloatValue1", 1f, new ConfigDescription("Server side float", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
	}

	private void CreateCorrectShaders()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Expected O, but got Unknown
		PieceConfig val = new PieceConfig();
		val.Name = "Standard Surface 2";
		CustomPiece val2 = new CustomPiece("piece_cauldroncopy", "piece_cauldron", val);
		standardSurface2 = ((Renderer)((Component)val2.PiecePrefab.transform.Find("HaveFire/Waterplane")).GetComponent<MeshRenderer>()).material.shader;
		ItemConfig val3 = new ItemConfig();
		val3.Name = "foobar";
		CustomItem val4 = new CustomItem("MeadBaseHealthMediumcopy", "MeadBaseHealthMedium", val3);
		CustomParticleUnlit = ((Component)val4.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect.m_startEffects.m_effectPrefabs[0].m_prefab.transform.Find("trails")).GetComponent<Renderer>().materials[0].shader;
		ItemConfig val5 = new ItemConfig();
		val5.Name = "creatureshader";
		CustomItem val6 = new CustomItem("CreatureShader", "CapeDeerHide", val5);
		CustomCreature = ((Renderer)((Component)((Component)val6.ItemDrop).transform.Find("attach_skin/cape2")).GetComponent<SkinnedMeshRenderer>()).material.shader;
		PieceConfig val7 = new PieceConfig();
		val7.Name = "grass";
		CustomPiece val8 = new CustomPiece("piece_barleycopy", "sapling_barley", val7);
		CustomGrass = ((Renderer)((Component)val8.PiecePrefab.transform.Find("healthy/barley_sapling")).GetComponent<MeshRenderer>()).material.shader;
		ItemConfig val9 = new ItemConfig();
		val9.Name = "player";
		CustomItem val10 = new CustomItem("PlayerShader", "ArmorTrollLeatherChest", val9);
		CustomPlayer = ((Renderer)((Component)((Component)val10.ItemDrop).transform.Find("attach_skin/shorts")).GetComponent<SkinnedMeshRenderer>()).materials[0].shader;
	}

	private void AddClonedItems()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Expected O, but got Unknown
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Expected O, but got Unknown
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Expected O, but got Unknown
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Expected O, but got Unknown
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Expected O, but got Unknown
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Expected O, but got Unknown
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Expected O, but got Unknown
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Expected O, but got Unknown
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Expected O, but got Unknown
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Expected O, but got Unknown
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Expected O, but got Unknown
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Expected O, but got Unknown
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Expected O, but got Unknown
		//IL_0898: Unknown result type (might be due to invalid IL or missing references)
		//IL_089f: Expected O, but got Unknown
		//IL_0909: Unknown result type (might be due to invalid IL or missing references)
		//IL_0913: Expected O, but got Unknown
		//IL_0c3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c42: Expected O, but got Unknown
		//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c70: Expected O, but got Unknown
		//IL_0f94: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fa6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fad: Expected O, but got Unknown
		//IL_0fd4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fdb: Expected O, but got Unknown
		//IL_12ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_1311: Unknown result type (might be due to invalid IL or missing references)
		//IL_1318: Expected O, but got Unknown
		//IL_133f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1346: Expected O, but got Unknown
		//IL_16e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_16fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_1701: Expected O, but got Unknown
		//IL_1728: Unknown result type (might be due to invalid IL or missing references)
		//IL_172f: Expected O, but got Unknown
		//IL_1ad1: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ae3: Unknown result type (might be due to invalid IL or missing references)
		//IL_1aea: Expected O, but got Unknown
		//IL_1b11: Unknown result type (might be due to invalid IL or missing references)
		//IL_1b18: Expected O, but got Unknown
		//IL_1eba: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ecc: Unknown result type (might be due to invalid IL or missing references)
		//IL_1ed3: Expected O, but got Unknown
		//IL_1efa: Unknown result type (might be due to invalid IL or missing references)
		//IL_1f01: Expected O, but got Unknown
		//IL_231b: Unknown result type (might be due to invalid IL or missing references)
		//IL_232d: Unknown result type (might be due to invalid IL or missing references)
		//IL_2334: Expected O, but got Unknown
		//IL_235b: Unknown result type (might be due to invalid IL or missing references)
		//IL_2362: Expected O, but got Unknown
		//IL_26fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_2710: Unknown result type (might be due to invalid IL or missing references)
		//IL_2717: Expected O, but got Unknown
		//IL_273e: Unknown result type (might be due to invalid IL or missing references)
		//IL_2745: Expected O, but got Unknown
		//IL_2ae1: Unknown result type (might be due to invalid IL or missing references)
		//IL_2af3: Unknown result type (might be due to invalid IL or missing references)
		//IL_2afa: Expected O, but got Unknown
		//IL_2b77: Unknown result type (might be due to invalid IL or missing references)
		//IL_2b7e: Expected O, but got Unknown
		//IL_2bf2: Unknown result type (might be due to invalid IL or missing references)
		//IL_2bf9: Expected O, but got Unknown
		//IL_2c45: Unknown result type (might be due to invalid IL or missing references)
		//IL_2c4c: Expected O, but got Unknown
		//IL_2c79: Unknown result type (might be due to invalid IL or missing references)
		//IL_2c80: Expected O, but got Unknown
		//IL_2cee: Unknown result type (might be due to invalid IL or missing references)
		//IL_2cf5: Expected O, but got Unknown
		//IL_2d69: Unknown result type (might be due to invalid IL or missing references)
		//IL_2d70: Expected O, but got Unknown
		//IL_2dbc: Unknown result type (might be due to invalid IL or missing references)
		//IL_2dc3: Expected O, but got Unknown
		//IL_2df0: Unknown result type (might be due to invalid IL or missing references)
		//IL_2df7: Expected O, but got Unknown
		//IL_2e43: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e4a: Expected O, but got Unknown
		//IL_2e9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_2ea5: Expected O, but got Unknown
		//IL_2f1c: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f23: Expected O, but got Unknown
		//IL_2f4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f9d: Unknown result type (might be due to invalid IL or missing references)
		//IL_3027: Unknown result type (might be due to invalid IL or missing references)
		//IL_302e: Expected O, but got Unknown
		//IL_30a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_30ae: Expected O, but got Unknown
		//IL_3104: Unknown result type (might be due to invalid IL or missing references)
		//IL_310b: Expected O, but got Unknown
		//IL_3184: Unknown result type (might be due to invalid IL or missing references)
		//IL_318b: Expected O, but got Unknown
		//IL_31b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_31ba: Expected O, but got Unknown
		//IL_321f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3226: Expected O, but got Unknown
		//IL_327b: Unknown result type (might be due to invalid IL or missing references)
		//IL_32b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_3345: Unknown result type (might be due to invalid IL or missing references)
		//IL_334c: Expected O, but got Unknown
		//IL_3372: Unknown result type (might be due to invalid IL or missing references)
		//IL_3379: Expected O, but got Unknown
		//IL_33ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_33b2: Expected O, but got Unknown
		//IL_3460: Unknown result type (might be due to invalid IL or missing references)
		//IL_3467: Expected O, but got Unknown
		//IL_356a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3571: Expected O, but got Unknown
		//IL_3601: Unknown result type (might be due to invalid IL or missing references)
		//IL_3608: Expected O, but got Unknown
		//IL_3666: Unknown result type (might be due to invalid IL or missing references)
		//IL_366d: Expected O, but got Unknown
		//IL_36ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_36f5: Expected O, but got Unknown
		//IL_3753: Unknown result type (might be due to invalid IL or missing references)
		//IL_375a: Expected O, but got Unknown
		//IL_37db: Unknown result type (might be due to invalid IL or missing references)
		//IL_37e2: Expected O, but got Unknown
		//IL_385b: Unknown result type (might be due to invalid IL or missing references)
		//IL_3862: Expected O, but got Unknown
		//IL_38e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_38e9: Expected O, but got Unknown
		//IL_3962: Unknown result type (might be due to invalid IL or missing references)
		//IL_3969: Expected O, but got Unknown
		//IL_39e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_39f0: Expected O, but got Unknown
		//IL_3a69: Unknown result type (might be due to invalid IL or missing references)
		//IL_3a70: Expected O, but got Unknown
		//IL_3ad8: Unknown result type (might be due to invalid IL or missing references)
		//IL_3adf: Expected O, but got Unknown
		//IL_3b6a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3b71: Expected O, but got Unknown
		//IL_3bbb: Unknown result type (might be due to invalid IL or missing references)
		//IL_3bc2: Expected O, but got Unknown
		//IL_3c4d: Unknown result type (might be due to invalid IL or missing references)
		//IL_3c54: Expected O, but got Unknown
		//IL_3cb6: Unknown result type (might be due to invalid IL or missing references)
		//IL_3cbd: Expected O, but got Unknown
		//IL_3cca: Unknown result type (might be due to invalid IL or missing references)
		//IL_3cd1: Expected O, but got Unknown
		//IL_3d39: Unknown result type (might be due to invalid IL or missing references)
		//IL_3d40: Expected O, but got Unknown
		//IL_3db9: Unknown result type (might be due to invalid IL or missing references)
		//IL_3dc0: Expected O, but got Unknown
		//IL_3e0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3e11: Expected O, but got Unknown
		//IL_3e1e: Unknown result type (might be due to invalid IL or missing references)
		//IL_3e25: Expected O, but got Unknown
		//IL_3e6f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3e76: Expected O, but got Unknown
		//IL_3e88: Unknown result type (might be due to invalid IL or missing references)
		//IL_3e9a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3ea1: Expected O, but got Unknown
		//IL_3f09: Unknown result type (might be due to invalid IL or missing references)
		//IL_3f10: Expected O, but got Unknown
		//IL_3f22: Unknown result type (might be due to invalid IL or missing references)
		//IL_3f34: Unknown result type (might be due to invalid IL or missing references)
		//IL_3f3b: Expected O, but got Unknown
		//IL_3f85: Unknown result type (might be due to invalid IL or missing references)
		//IL_3f8c: Expected O, but got Unknown
		//IL_3fef: Unknown result type (might be due to invalid IL or missing references)
		//IL_4018: Unknown result type (might be due to invalid IL or missing references)
		//IL_401f: Expected O, but got Unknown
		//IL_40b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_40bb: Expected O, but got Unknown
		//IL_40cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_40f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_40fd: Expected O, but got Unknown
		//IL_4174: Unknown result type (might be due to invalid IL or missing references)
		//IL_417b: Expected O, but got Unknown
		//IL_41f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_41fb: Expected O, but got Unknown
		//IL_4273: Unknown result type (might be due to invalid IL or missing references)
		//IL_427a: Expected O, but got Unknown
		//IL_428c: Unknown result type (might be due to invalid IL or missing references)
		//IL_42b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_42bc: Expected O, but got Unknown
		//IL_4325: Unknown result type (might be due to invalid IL or missing references)
		//IL_432c: Expected O, but got Unknown
		//IL_438a: Unknown result type (might be due to invalid IL or missing references)
		//IL_4391: Expected O, but got Unknown
		//IL_43f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_43fb: Expected O, but got Unknown
		//IL_4408: Unknown result type (might be due to invalid IL or missing references)
		//IL_440f: Expected O, but got Unknown
		//IL_4435: Unknown result type (might be due to invalid IL or missing references)
		//IL_443c: Expected O, but got Unknown
		//IL_4449: Unknown result type (might be due to invalid IL or missing references)
		//IL_4450: Expected O, but got Unknown
		//IL_44aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_44b1: Expected O, but got Unknown
		//IL_44be: Unknown result type (might be due to invalid IL or missing references)
		//IL_44c5: Expected O, but got Unknown
		//IL_4503: Unknown result type (might be due to invalid IL or missing references)
		//IL_450a: Expected O, but got Unknown
		//IL_458e: Unknown result type (might be due to invalid IL or missing references)
		//IL_4595: Expected O, but got Unknown
		//IL_45ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_45b3: Expected O, but got Unknown
		//IL_45ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_45d1: Expected O, but got Unknown
		//IL_45e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_45ef: Expected O, but got Unknown
		//IL_4606: Unknown result type (might be due to invalid IL or missing references)
		//IL_460d: Expected O, but got Unknown
		//IL_4624: Unknown result type (might be due to invalid IL or missing references)
		//IL_462b: Expected O, but got Unknown
		//IL_4642: Unknown result type (might be due to invalid IL or missing references)
		//IL_4649: Expected O, but got Unknown
		//IL_4660: Unknown result type (might be due to invalid IL or missing references)
		//IL_4667: Expected O, but got Unknown
		//IL_467e: Unknown result type (might be due to invalid IL or missing references)
		//IL_4685: Expected O, but got Unknown
		//IL_469c: Unknown result type (might be due to invalid IL or missing references)
		//IL_46a3: Expected O, but got Unknown
		//IL_46b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_46b7: Expected O, but got Unknown
		//IL_4702: Unknown result type (might be due to invalid IL or missing references)
		//IL_4709: Expected O, but got Unknown
		//IL_472e: Unknown result type (might be due to invalid IL or missing references)
		//IL_4735: Expected O, but got Unknown
		//IL_47a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_47aa: Expected O, but got Unknown
		//IL_4901: Unknown result type (might be due to invalid IL or missing references)
		//IL_4908: Expected O, but got Unknown
		//IL_4986: Unknown result type (might be due to invalid IL or missing references)
		//IL_498d: Expected O, but got Unknown
		//IL_4a01: Unknown result type (might be due to invalid IL or missing references)
		//IL_4a08: Expected O, but got Unknown
		//IL_4a94: Unknown result type (might be due to invalid IL or missing references)
		//IL_4a9b: Expected O, but got Unknown
		//IL_4b66: Unknown result type (might be due to invalid IL or missing references)
		//IL_4b6d: Expected O, but got Unknown
		//IL_4bec: Unknown result type (might be due to invalid IL or missing references)
		//IL_4bf3: Expected O, but got Unknown
		//IL_4c9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_4ca5: Expected O, but got Unknown
		//IL_4d23: Unknown result type (might be due to invalid IL or missing references)
		//IL_4d2a: Expected O, but got Unknown
		//IL_4df0: Unknown result type (might be due to invalid IL or missing references)
		//IL_4df7: Expected O, but got Unknown
		//IL_4e80: Unknown result type (might be due to invalid IL or missing references)
		//IL_4e87: Expected O, but got Unknown
		//IL_5064: Unknown result type (might be due to invalid IL or missing references)
		//IL_506b: Expected O, but got Unknown
		//IL_50d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_50dc: Expected O, but got Unknown
		//IL_5257: Unknown result type (might be due to invalid IL or missing references)
		//IL_525e: Expected O, but got Unknown
		//IL_52c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_52cf: Expected O, but got Unknown
		//IL_5439: Unknown result type (might be due to invalid IL or missing references)
		//IL_5440: Expected O, but got Unknown
		//IL_54aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_54b1: Expected O, but got Unknown
		//IL_55c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_55d1: Expected O, but got Unknown
		//IL_55d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_55d9: Expected O, but got Unknown
		//IL_564e: Unknown result type (might be due to invalid IL or missing references)
		//IL_5655: Expected O, but got Unknown
		//IL_5690: Unknown result type (might be due to invalid IL or missing references)
		//IL_5697: Expected O, but got Unknown
		//IL_56eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_56f2: Expected O, but got Unknown
		//IL_5708: Unknown result type (might be due to invalid IL or missing references)
		//IL_570f: Expected O, but got Unknown
		//IL_5742: Unknown result type (might be due to invalid IL or missing references)
		//IL_5749: Expected O, but got Unknown
		//IL_57c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_57ca: Expected O, but got Unknown
		//IL_5849: Unknown result type (might be due to invalid IL or missing references)
		//IL_5850: Expected O, but got Unknown
		//IL_5876: Unknown result type (might be due to invalid IL or missing references)
		//IL_587d: Expected O, but got Unknown
		//IL_59a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_59ac: Expected O, but got Unknown
		//IL_59f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_59f8: Expected O, but got Unknown
		//IL_5a11: Unknown result type (might be due to invalid IL or missing references)
		//IL_5a18: Expected O, but got Unknown
		//IL_5a45: Unknown result type (might be due to invalid IL or missing references)
		//IL_5a4f: Expected O, but got Unknown
		//IL_5b3d: Unknown result type (might be due to invalid IL or missing references)
		//IL_5b44: Expected O, but got Unknown
		//IL_5b89: Unknown result type (might be due to invalid IL or missing references)
		//IL_5b90: Expected O, but got Unknown
		//IL_5ba9: Unknown result type (might be due to invalid IL or missing references)
		//IL_5bb0: Expected O, but got Unknown
		//IL_5bdd: Unknown result type (might be due to invalid IL or missing references)
		//IL_5be7: Expected O, but got Unknown
		//IL_5be8: Unknown result type (might be due to invalid IL or missing references)
		//IL_5bef: Expected O, but got Unknown
		//IL_5c09: Unknown result type (might be due to invalid IL or missing references)
		//IL_5c10: Expected O, but got Unknown
		//IL_5ca7: Unknown result type (might be due to invalid IL or missing references)
		//IL_5cae: Expected O, but got Unknown
		//IL_5d03: Unknown result type (might be due to invalid IL or missing references)
		//IL_5d0a: Expected O, but got Unknown
		//IL_5d17: Unknown result type (might be due to invalid IL or missing references)
		//IL_5d1e: Expected O, but got Unknown
		//IL_5da7: Unknown result type (might be due to invalid IL or missing references)
		//IL_5dae: Expected O, but got Unknown
		//IL_5e47: Unknown result type (might be due to invalid IL or missing references)
		//IL_5e4e: Expected O, but got Unknown
		//IL_5e90: Unknown result type (might be due to invalid IL or missing references)
		//IL_5e97: Expected O, but got Unknown
		//IL_5ec9: Unknown result type (might be due to invalid IL or missing references)
		//IL_5ed0: Expected O, but got Unknown
		//IL_5f12: Unknown result type (might be due to invalid IL or missing references)
		//IL_5f19: Expected O, but got Unknown
		//IL_5f4b: Unknown result type (might be due to invalid IL or missing references)
		//IL_5f52: Expected O, but got Unknown
		//IL_5f94: Unknown result type (might be due to invalid IL or missing references)
		//IL_5f9b: Expected O, but got Unknown
		//IL_5fcd: Unknown result type (might be due to invalid IL or missing references)
		//IL_5fd4: Expected O, but got Unknown
		//IL_605d: Unknown result type (might be due to invalid IL or missing references)
		//IL_6064: Expected O, but got Unknown
		//IL_6171: Unknown result type (might be due to invalid IL or missing references)
		//IL_6178: Expected O, but got Unknown
		//IL_6201: Unknown result type (might be due to invalid IL or missing references)
		//IL_6208: Expected O, but got Unknown
		//IL_6315: Unknown result type (might be due to invalid IL or missing references)
		//IL_631c: Expected O, but got Unknown
		//IL_63a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_63ab: Expected O, but got Unknown
		//IL_64b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_64bf: Expected O, but got Unknown
		//IL_64f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_64fe: Expected O, but got Unknown
		//IL_6526: Unknown result type (might be due to invalid IL or missing references)
		//IL_652d: Expected O, but got Unknown
		//IL_6565: Unknown result type (might be due to invalid IL or missing references)
		//IL_656c: Expected O, but got Unknown
		CreateCorrectShaders();
		ItemConfig val = new ItemConfig();
		val.Name = "capeDeerHideCopy";
		CustomItem val2 = new CustomItem("CapeDeerHideCopy", "CapeDeerHide", val);
		ItemManager.Instance.AddItem(val2);
		ItemConfig val3 = new ItemConfig();
		val3.Name = "capeWolfCopy";
		CustomItem val4 = new CustomItem("CapeWolfCopy", "CapeWolf", val3);
		ItemManager.Instance.AddItem(val4);
		ItemConfig val5 = new ItemConfig();
		val5.Name = "TrollArmorCopy";
		CustomItem val6 = new CustomItem("TrollArmorCopy", "ArmorTrollLeatherChest", val5);
		ItemManager.Instance.AddItem(val6);
		PieceConfig val7 = new PieceConfig();
		val7.Name = "smelterCopy";
		val7.PieceTable = PieceTables.Hammer;
		CustomPiece val8 = new CustomPiece("Smelter", "smelter", val7);
		PieceManager.Instance.AddPiece(val8);
		PieceConfig val9 = new PieceConfig();
		val9.Name = "cartCopy";
		val9.PieceTable = PieceTables.Hammer;
		CustomPiece val10 = new CustomPiece("cartCopy", "Cart", val9);
		PieceManager.Instance.AddPiece(val10);
		PieceConfig val11 = new PieceConfig();
		val11.Name = "roofCopy";
		val11.PieceTable = PieceTables.Hammer;
		CustomPiece val12 = new CustomPiece("roofCopy", "wood_roof", val11);
		PieceManager.Instance.AddPiece(val12);
		PieceConfig val13 = new PieceConfig();
		val13.Name = "infiniteWoodTorch";
		val13.AddRequirement("Resin", 20, true);
		val13.AddRequirement("Wood", 2, true);
		PieceConfig val14 = new PieceConfig();
		val14.Name = "infiniteIronTorch";
		val14.AddRequirement("Resin", 20, true);
		val14.AddRequirement("Iron", 2, true);
		PieceConfig val15 = new PieceConfig();
		val15.Name = "infiniteGuckTorch";
		val15.AddRequirement("GreydwarfEye", 20, true);
		val15.AddRequirement("Iron", 2, true);
		PieceConfig val16 = new PieceConfig();
		val16.Name = "infiniteEyeTorch";
		val16.AddRequirement("Guck", 20, true);
		val16.AddRequirement("Iron", 2, true);
		CustomPiece val17 = new CustomPiece("InfiniteWoodTorch", "piece_groundtorch_wood", val13);
		val17.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(val17);
		CustomPiece val18 = new CustomPiece("InfiniteIronTorch", "piece_groundtorch", val14);
		val18.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(val18);
		CustomPiece val19 = new CustomPiece("InfiniteGuckTorch", "piece_groundtorch_green", val15);
		val19.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(val19);
		CustomPiece val20 = new CustomPiece("InfiniteEyeTorch", "piece_groundtorch_blue", val16);
		val20.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(val20);
		PieceConfig val21 = new PieceConfig();
		val21.Name = "infiniteSconce";
		val21.AddRequirement("Copper", 2, true);
		val21.AddRequirement("Wood", 2, true);
		val21.AddRequirement("Resin", 20, true);
		CustomPiece val22 = new CustomPiece("InfiniteSconce", "piece_walltorch", val21);
		val22.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(val22);
		Shader shader = ((Renderer)((Component)PieceManager.Instance.GetPiece("Smelter").PiecePrefab.transform.Find("New/default")).GetComponent<MeshRenderer>()).material.shader;
		Shader shader2 = ((Component)PieceManager.Instance.GetPiece("Smelter").PiecePrefab.transform.Find("_enabled/smoke (1)")).GetComponent<Renderer>().material.shader;
		Shader shader3 = ((Component)PieceManager.Instance.GetPiece("Smelter").PiecePrefab.transform.Find("_enabled/flames (1)")).GetComponent<Renderer>().material.shader;
		Shader shader4 = ((Component)PieceManager.Instance.GetPiece("Smelter").PiecePrefab.transform.Find("_enabled/flare (1)")).GetComponent<Renderer>().material.shader;
		PieceConfig val23 = new PieceConfig();
		val23.Name = "Supercharged Smelter";
		val23.Description = "If heat is too slow to melt metals, try extreme cold!";
		val23.AddRequirement("Stone", 20, true);
		val23.AddRequirement("SurtlingCore", 5, true);
		val23.AddRequirement("TrophyCultist_Hildir", 1, true);
		val23.PieceTable = PieceTables.Hammer;
		PieceManager.Instance.AddPiece(new CustomPiece(newHaldorAssetBundle, "SuperchargedSmelter", false, val23));
		((Renderer)((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("New/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/smoke (1)")).GetComponent<Renderer>().material.shader = shader2;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flames")).GetComponent<Renderer>().material.shader = shader3;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flames (1)")).GetComponent<Renderer>().material.shader = shader3;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flames (2)")).GetComponent<Renderer>().material.shader = shader3;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/SmokeSpawner")).GetComponent<SmokeSpawner>().m_smokePrefab = ((Component)PieceManager.Instance.GetPiece("Smelter").PiecePrefab.transform.Find("_enabled/SmokeSpawner")).GetComponent<SmokeSpawner>().m_smokePrefab;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flare (1)")).GetComponent<Renderer>().material.shader = shader4;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flare (2)")).GetComponent<Renderer>().material.shader = shader4;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flare (3)")).GetComponent<Renderer>().material.shader = shader4;
		((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/flare")).GetComponent<Renderer>().material.shader = shader4;
		PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.GetComponent<Smelter>().m_produceEffects.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("Smelter").PiecePrefab.GetComponent<Smelter>().m_produceEffects.m_effectPrefabs[0];
		PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.GetComponent<Smelter>().m_fuelAddedEffects.m_effectPrefabs[1] = PieceManager.Instance.GetPiece("Smelter").PiecePrefab.GetComponent<Smelter>().m_fuelAddedEffects.m_effectPrefabs[1];
		PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.GetComponent<Smelter>().m_oreAddedEffects.m_effectPrefabs[1] = PieceManager.Instance.GetPiece("Smelter").PiecePrefab.GetComponent<Smelter>().m_oreAddedEffects.m_effectPrefabs[1];
		PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("Smelter").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs[0];
		PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("Smelter").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs[0];
		MeshRenderer[] componentsInChildren = ((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("smelter_Destruction")).GetComponentsInChildren<MeshRenderer>();
		MeshRenderer[] array = componentsInChildren;
		foreach (MeshRenderer val24 in array)
		{
			((Renderer)val24).material.shader = shader;
		}
		PieceConfig val25 = new PieceConfig();
		val25.PieceTable = PieceTables.Hammer;
		val25.Name = "Turbo Cart";
		val25.AddRequirement("Wood", 20, true);
		val25.AddRequirement("BronzeNails", 10, true);
		val25.AddRequirement("TrophyGoblinBruteBrosShaman", 1, true);
		val25.AddRequirement("TrophyGoblinBruteBrosBrute", 1, true);
		PieceManager.Instance.AddPiece(new CustomPiece(newHaldorAssetBundle, "TurboCart", false, val25));
		((Renderer)((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("Vagon/new/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		((Renderer)((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("Wheel1/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		((Renderer)((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("Wheel2/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		((Renderer)((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("Vagon/worn/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		((Renderer)((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("Vagon/broken/default")).GetComponent<MeshRenderer>()).material.shader = shader;
		PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("cartCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs[0];
		PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("cartCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs[0];
		PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.GetComponent<WearNTear>().m_switchEffect.m_effectPrefabs[0] = PieceManager.Instance.GetPiece("cartCopy").PiecePrefab.GetComponent<WearNTear>().m_switchEffect.m_effectPrefabs[0];
		PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.GetComponent<ImpactEffect>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("cartCopy").PiecePrefab.GetComponent<ImpactEffect>().m_hitEffect.m_effectPrefabs;
		MeshRenderer[] componentsInChildren2 = ((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("cart_Destruction")).GetComponentsInChildren<MeshRenderer>();
		MeshRenderer[] array2 = componentsInChildren2;
		foreach (MeshRenderer val26 in array2)
		{
			((Renderer)val26).material.shader = shader;
		}
		PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("cartCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		componentsInChildren2 = ((Component)PieceManager.Instance.GetPiece("TurboCart").PiecePrefab.transform.Find("load")).GetComponentsInChildren<MeshRenderer>();
		MeshRenderer[] array3 = componentsInChildren2;
		foreach (MeshRenderer val27 in array3)
		{
			((Renderer)val27).material.shader = shader;
		}
		PieceConfig val28 = new PieceConfig();
		val28.PieceTable = PieceTables.Hammer;
		val28.Category = PieceCategories.HeavyBuild;
		CustomPiece val29 = new CustomPiece(newHaldorAssetBundle, "wood_roof_grass", true, val28);
		((Renderer)((Component)val29.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		val29.PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs;
		val29.PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs;
		val29.PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		GameObject[] combinedGameOjects = ((Component)val29.PiecePrefab.transform.Find("New/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val30 in combinedGameOjects)
		{
			((Renderer)val30.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects2 = ((Component)val29.PiecePrefab.transform.Find("Worn/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val31 in combinedGameOjects2)
		{
			((Renderer)val31.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects3 = ((Component)val29.PiecePrefab.transform.Find("Broken/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val32 in combinedGameOjects3)
		{
			((Renderer)val32.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		val29.Piece.m_name = "Grass Roof 26°";
		val29.Piece.m_description = "Keeps you cool in heat and warm in cold. +1 comfort.";
		val29.Piece.m_comfortGroup = (ComfortGroup)7;
		PieceManager.Instance.AddPiece(val29);
		PieceConfig val33 = new PieceConfig();
		val33.PieceTable = PieceTables.Hammer;
		val33.Category = PieceCategories.HeavyBuild;
		CustomPiece val34 = new CustomPiece(newHaldorAssetBundle, "wood_roof_45_grass", true, val33);
		((Renderer)((Component)val34.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val34.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val29.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		val34.PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs;
		val34.PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs;
		val34.PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		GameObject[] combinedGameOjects4 = ((Component)val34.PiecePrefab.transform.Find("New/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val35 in combinedGameOjects4)
		{
			((Renderer)val35.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects5 = ((Component)val34.PiecePrefab.transform.Find("Worn/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val36 in combinedGameOjects5)
		{
			((Renderer)val36.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects6 = ((Component)val34.PiecePrefab.transform.Find("Broken/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val37 in combinedGameOjects6)
		{
			((Renderer)val37.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		val34.Piece.m_name = "Grass Roof 45°";
		val34.Piece.m_description = "Keeps you cool in heat and warm in cold. +1 comfort.";
		val34.Piece.m_comfortGroup = (ComfortGroup)7;
		PieceManager.Instance.AddPiece(val34);
		PieceConfig val38 = new PieceConfig();
		val38.PieceTable = PieceTables.Hammer;
		val38.Category = PieceCategories.HeavyBuild;
		CustomPiece val39 = new CustomPiece(newHaldorAssetBundle, "wood_roof_icorner_45_grass", true, val38);
		((Renderer)((Component)val39.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val39.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		val39.PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs;
		val39.PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs;
		val39.PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		GameObject[] combinedGameOjects7 = ((Component)val39.PiecePrefab.transform.Find("New/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val40 in combinedGameOjects7)
		{
			((Renderer)val40.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects8 = ((Component)val39.PiecePrefab.transform.Find("Worn/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val41 in combinedGameOjects8)
		{
			((Renderer)val41.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects9 = ((Component)val39.PiecePrefab.transform.Find("Broken/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val42 in combinedGameOjects9)
		{
			((Renderer)val42.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		val39.Piece.m_name = "Grass Roof Interior Corner 45°";
		val39.Piece.m_description = "Keeps you cool in heat and warm in cold. +1 comfort.";
		val39.Piece.m_comfortGroup = (ComfortGroup)7;
		PieceManager.Instance.AddPiece(val39);
		PieceConfig val43 = new PieceConfig();
		val43.PieceTable = PieceTables.Hammer;
		val43.Category = PieceCategories.HeavyBuild;
		CustomPiece val44 = new CustomPiece(newHaldorAssetBundle, "wood_roof_icorner_grass", true, val43);
		((Renderer)((Component)val44.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val44.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		val44.PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs;
		val44.PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs;
		val44.PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		GameObject[] combinedGameOjects10 = ((Component)val44.PiecePrefab.transform.Find("New/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val45 in combinedGameOjects10)
		{
			((Renderer)val45.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects11 = ((Component)val44.PiecePrefab.transform.Find("Worn/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val46 in combinedGameOjects11)
		{
			((Renderer)val46.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects12 = ((Component)val44.PiecePrefab.transform.Find("Broken/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val47 in combinedGameOjects12)
		{
			((Renderer)val47.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		val44.Piece.m_name = "Grass Roof Interior Corner 26°";
		val44.Piece.m_description = "Keeps you cool in heat and warm in cold. +1 comfort.";
		val44.Piece.m_comfortGroup = (ComfortGroup)7;
		PieceManager.Instance.AddPiece(val44);
		PieceConfig val48 = new PieceConfig();
		val48.PieceTable = PieceTables.Hammer;
		val48.Category = PieceCategories.HeavyBuild;
		CustomPiece val49 = new CustomPiece(newHaldorAssetBundle, "wood_roof_ocorner_45_grass", true, val48);
		((Renderer)((Component)val49.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Worn/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[3].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val49.PiecePrefab.transform.Find("Broken/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[2].shader = shader;
		val49.PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_destroyedEffect.m_effectPrefabs;
		val49.PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<WearNTear>().m_hitEffect.m_effectPrefabs;
		val49.PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs = PieceManager.Instance.GetPiece("roofCopy").PiecePrefab.GetComponent<Piece>().m_placeEffect.m_effectPrefabs;
		GameObject[] combinedGameOjects13 = ((Component)val49.PiecePrefab.transform.Find("New/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val50 in combinedGameOjects13)
		{
			((Renderer)val50.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects14 = ((Component)val49.PiecePrefab.transform.Find("Worn/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val51 in combinedGameOjects14)
		{
			((Renderer)val51.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		GameObject[] combinedGameOjects15 = ((Component)val49.PiecePrefab.transform.Find("Broken/high")).GetComponent<SimpleMeshCombine>().combinedGameOjects;
		foreach (GameObject val52 in combinedGameOjects15)
		{
			((Renderer)val52.GetComponent<MeshRenderer>()).materials[0].shader = shader;
		}
		val49.Piece.m_name = "Grass Roof Outside Corner 45°";
		val49.Piece.m_description = "Keeps you cool in heat and warm in cold. +1 comfort.";
		val49.Piece.m_comfortGroup = (ComfortGroup)7;
		PieceManager.Instance.AddPiece(val49);
		PieceConfig val53 = new PieceConfig();
		val53.PieceTable = PieceTables.Hammer;
		val53.Category = PieceCategories.HeavyBuild;
		CustomPiece val54 = new CustomPiece(newHaldorAssetBundle, "wood_roof_ocorner_grass", true, val53);
		((Renderer)((Component)val54.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[0].shader = shader;
		((Renderer)((Component)val54.PiecePrefab.transform.Find("New/_Combined Mesh [high]")).GetComponent<MeshRenderer>()).materials[1].shader = shader;
		((Renderer)((Component)val54.PiecePrefab.transform.Find("New/_Combi