Decompiled source of RavenwoodRome v2.0.0

plugins/RavenwoodRome/RavenwoodRome.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using PieceManager;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RavenwoodRome")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JamesJonesTV")]
[assembly: AssemblyProduct("RavenwoodRome")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("E0E2F92E-557C-4A05-9D89-AA92A0BD75C4")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RavenwoodRome
{
	[BepInPlugin("JamesJonesTV.RavenwoodRome", "RavenwoodRome", "1.0.2")]
	public class RavenwoodRomePlugin : BaseUnityPlugin
	{
		public enum Toggle
		{
			On = 1,
			Off = 0
		}

		internal const string ModName = "RavenwoodRome";

		internal const string ModVersion = "1.0.2";

		internal const string Author = "JamesJonesTV";

		private const string ModGUID = "JamesJonesTV.RavenwoodRome";

		private static readonly string ConfigFileName = "JamesJonesTV.RavenwoodRome.cfg";

		private static readonly string ConfigFileFullPath;

		internal static string ConnectionError;

		public readonly Harmony _harmony = new Harmony("JamesJonesTV.RavenwoodRome");

		public static readonly ManualLogSource RavenwoodRomeLogger;

		private static readonly ConfigSync ConfigSync;

		public static RavenwoodRomePlugin instance;

		private static ConfigEntry<Toggle> _serverConfigLocked;

		private static GameObject root;

		public static Transform rt => root.transform;

		public void Awake()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			instance = this;
			_serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			root = new GameObject("root");
			Object.DontDestroyOnLoad((Object)(object)root);
			root.SetActive(false);
			Assets.LoadBuildings();
			Assets.LoadSculptures();
			Assets.LoadBanners();
			Assets.LoadBaskets();
			Assets.LoadCandles();
			Assets.LoadChairs();
			Assets.LoadContainers();
			Assets.LoadDoors();
			Assets.LoadFireProps();
			Assets.LoadMetalProps();
			Assets.LoadProps();
			Assets.LoadArchitectures();
			Assets.LoadStands();
			Assets.LoadNature();
			Assets.LoadClayPottery();
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			SetupWatcher();
		}

		private void OnDestroy()
		{
			((BaseUnityPlugin)this).Config.Save();
		}

		private void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				RavenwoodRomeLogger.LogDebug((object)"ReadConfigValues called");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				RavenwoodRomeLogger.LogError((object)("There was an issue loading your " + ConfigFileName));
				RavenwoodRomeLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		private ConfigEntry<T> config<T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		static RavenwoodRomePlugin()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConnectionError = "";
			RavenwoodRomeLogger = Logger.CreateLogSource("RavenwoodRome");
			ConfigSync = new ConfigSync("JamesJonesTV.RavenwoodRome")
			{
				DisplayName = "RavenwoodRome",
				CurrentVersion = "1.0.2",
				MinimumRequiredVersion = "1.0.2"
			};
			_serverConfigLocked = null;
		}
	}
	public static class Assets
	{
		public class RomanCandle : MonoBehaviour, Interactable
		{
			public ZNetView m_nview;

			public GameObject m_fire;

			public void Awake()
			{
				m_nview = ((Component)this).GetComponent<ZNetView>();
				if (Object.op_Implicit((Object)(object)m_nview) && m_nview.GetZDO() != null)
				{
					m_nview.Register("RPC_UpdateState", (Action<long>)RPC_UpdateState);
				}
			}

			public void RPC_UpdateState(long sender)
			{
				bool active = m_nview.GetZDO().GetBool(ZDOVars.s_state, false);
				m_fire.SetActive(active);
			}

			public void Start()
			{
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null)
				{
					GameObject prefab = ZNetScene.instance.GetPrefab("Candle_resin");
					if (prefab != null)
					{
						GameObject gameObject = ((Component)prefab.transform.Find("high")).gameObject;
						Transform val = ((Component)this).transform.Find("fire");
						GameObject val2 = Object.Instantiate<GameObject>(gameObject, ((Component)val).transform);
						val2.transform.localPosition = new Vector3(0f, -0.057f, 0f);
						((Component)val).gameObject.SetActive(m_nview.GetZDO().GetBool(ZDOVars.s_state, false));
						m_fire = ((Component)val).gameObject;
					}
				}
			}

			public bool Interact(Humanoid user, bool hold, bool alt)
			{
				bool flag = m_nview.GetZDO().GetBool(ZDOVars.s_state, false);
				m_nview.GetZDO().Set(ZDOVars.s_state, !flag);
				m_nview.InvokeRPC(ZNetView.Everybody, "RPC_UpdateState", Array.Empty<object>());
				return true;
			}

			public bool UseItem(Humanoid user, ItemData item)
			{
				return false;
			}
		}

		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class Setup_Roman_Doors_SFX
		{
			private static void Postfix(ZNetScene __instance)
			{
				GameObject prefab = __instance.GetPrefab("darkwood_gate");
				Door val = default(Door);
				if (prefab != null && prefab.TryGetComponent<Door>(ref val))
				{
					for (int i = 0; i < doors.Count; i++)
					{
						GameObject val2 = doors[i];
						Door component = val2.GetComponent<Door>();
						component.m_openEffects = val.m_openEffects;
						component.m_closeEffects = val.m_closeEffects;
						component.m_name = val2.GetComponent<Piece>().m_name;
					}
				}
			}
		}

		public class RomanFire : MonoBehaviour, Interactable
		{
			public ZNetView m_nview;

			public GameObject m_fire;

			public void Awake()
			{
				m_nview = ((Component)this).GetComponent<ZNetView>();
				if (Object.op_Implicit((Object)(object)m_nview) && m_nview.GetZDO() != null)
				{
					m_nview.Register("RPC_UpdateState", (Action<long>)RPC_UpdateState);
				}
			}

			public void Start()
			{
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)m_nview) && m_nview.GetZDO() != null)
				{
					Transform val = ((Component)this).transform.Find("MOCK_piece_brazierfloor01");
					GameObject prefab = ZNetScene.instance.GetPrefab("piece_brazierfloor01");
					GameObject gameObject = ((Component)prefab.transform.Find("ashlayer")).gameObject;
					GameObject gameObject2 = ((Component)prefab.transform.Find("_enabled_high")).gameObject;
					GameObject gameObject3 = ((Component)prefab.transform.Find("_enabled")).gameObject;
					GameObject val2 = Object.Instantiate<GameObject>(gameObject, val);
					val2.transform.localPosition = new Vector3(0f, -0.321f, 0f);
					GameObject val3 = Object.Instantiate<GameObject>(gameObject3, val);
					val3.transform.localPosition = new Vector3(0f, -0.34f, 0f);
					val3.SetActive(true);
					GameObject val4 = Object.Instantiate<GameObject>(gameObject2, val);
					val4.transform.localPosition = new Vector3(0f, -0.34f, 0f);
					val4.SetActive(m_nview.GetZDO().GetBool(ZDOVars.s_state, false));
					m_fire = val4;
				}
			}

			public void RPC_UpdateState(long sender)
			{
				bool active = m_nview.GetZDO().GetBool(ZDOVars.s_state, false);
				m_fire.SetActive(active);
			}

			public bool Interact(Humanoid user, bool hold, bool alt)
			{
				bool flag = m_nview.GetZDO().GetBool(ZDOVars.s_state, false);
				m_nview.GetZDO().Set(ZDOVars.s_state, !flag);
				m_nview.InvokeRPC(ZNetView.Everybody, "RPC_UpdateState", Array.Empty<object>());
				return true;
			}

			public bool UseItem(Humanoid user, ItemData item)
			{
				return false;
			}
		}

		private static Dictionary<string, string> architectures = new Dictionary<string, string>
		{
			["piece_rome_marble_fence"] = "Marble Fence",
			["piece_rome_podest_1"] = "Pedestal 1",
			["piece_rome_podest_2"] = "Pedestal 2",
			["piece_rome_stone_fence"] = "Stone Fence"
		};

		private static Dictionary<string, string> immuneStuff = new Dictionary<string, string>
		{
			["piece_rome_side_walk_1"] = "Side Walk",
			["piece_rome_side_walk_2"] = "Long Side Walk"
		};

		private static Dictionary<string, string> stairs = new Dictionary<string, string>
		{
			["piece_rome_stair_1"] = "Roman Stairs 1",
			["piece_rome_stair_2"] = "Roman Stairs 2",
			["piece_rome_stair_3"] = "Roman Stairs 3"
		};

		private static Dictionary<string, string> walls = new Dictionary<string, string>
		{
			["piece_rome_wall_1"] = "Roman Wall 1",
			["piece_rome_wall_2"] = "Roman Wall 2",
			["piece_rome_wall_3"] = "Roman Wall 3",
			["piece_rome_wall_5"] = "Roman Wall 4",
			["piece_rome_wall_6"] = "Large Roman Wall",
			["piece_rome_wall_7"] = "Large Roman Wall"
		};

		private static Dictionary<string, string> frescos = new Dictionary<string, string>
		{
			["piece_rome_wall_8"] = "Large Fresco Wall Cap",
			["piece_rome_wall_9"] = "Fresco Wall 2",
			["piece_rome_wall_10"] = "Fresco Wall Cap"
		};

		private static Dictionary<string, string> pillars = new Dictionary<string, string>
		{
			["piece_rome_column_1"] = "Pillar 1",
			["piece_rome_column_2"] = "Pillar 2",
			["piece_rome_column_3"] = "Pillar 3",
			["piece_rome_column_4"] = "Pillar 4",
			["piece_rome_column_5"] = "Pillar 5",
			["piece_rome_column_6"] = "Pillar 6",
			["piece_rome_column_7"] = "Pillar 7",
			["piece_rome_column_8"] = "Pillar 8",
			["piece_rome_column_9"] = "Pillar 9"
		};

		private static Dictionary<string, string> banners = new Dictionary<string, string>
		{
			["piece_banner_rome_1"] = "Roman Banner 1",
			["piece_banner_rome_2"] = "Roman Banner 2",
			["piece_banner_rome_3"] = "Roman Banner 3",
			["piece_banner_rome_4"] = "Roman Banner 4",
			["piece_banner_rome_5"] = "Roman Banner 5",
			["piece_banner_rome_6"] = "Roman Banner 6"
		};

		private static Dictionary<string, string> baskets = new Dictionary<string, string>
		{
			["piece_basket_berries"] = "Berry Basket",
			["piece_basket_empty"] = "Basket",
			["piece_basket_fruit"] = "Fruit Basket",
			["piece_basket_grains"] = "Grains Basket"
		};

		private static readonly Dictionary<string, string> buildings = new Dictionary<string, string>
		{
			["piece_rome_house_1"] = "Roman House 1",
			["piece_rome_house_2"] = "Roman House 2",
			["piece_rome_house_3"] = "Roman House 3",
			["piece_rome_house_4"] = "Roman House 4",
			["piece_rome_house_5"] = "Roman House 5",
			["piece_rome_house_6"] = "Roman House 6",
			["piece_rome_house_7"] = "Roman House 7",
			["piece_rome_house_8"] = "Roman House 8",
			["piece_rome_house_9"] = "Roman House 9",
			["piece_rome_house_10"] = "Roman House 10",
			["piece_rome_house_11"] = "Roman House 11",
			["piece_rome_house_12"] = "Roman House 12",
			["piece_rome_house_13"] = "Roman House 13",
			["piece_rome_house_14"] = "Roman House 14",
			["piece_rome_house_15"] = "Roman House 15",
			["piece_rome_house_16"] = "Roman House 16",
			["piece_rome_house_17"] = "Roman House 17",
			["piece_rome_house_18"] = "Roman House 18",
			["piece_rome_house_19"] = "Roman House 19",
			["piece_rome_house_20"] = "Roman House 20"
		};

		private static Dictionary<string, string> candles = new Dictionary<string, string>
		{
			["piece_rome_candle_1"] = "Roman Candle 1",
			["piece_rome_candle_2"] = "Roman Candle 2",
			["piece_rome_candle_3"] = "Roman Candle 3",
			["piece_rome_candle_4"] = "Roman Candle 4",
			["piece_rome_candle_5"] = "Roman Candle 5",
			["piece_rome_candle_6"] = "Roman Candle 6"
		};

		private static Dictionary<string, string> chairs = new Dictionary<string, string>
		{
			["piece_rome_chair_1"] = "Roman Chair 1",
			["piece_rome_chair_2"] = "Roman Chair 2"
		};

		private static Dictionary<string, string> clayPots = new Dictionary<string, string>
		{
			["piece_amphora_1"] = "Amphora 1",
			["piece_amphora_2"] = "Amphora 2",
			["piece_amphora_3"] = "Amphora 3",
			["piece_amphora_4"] = "Amphora 4",
			["piece_rome_pottery_1"] = "Pottery 1",
			["piece_rome_pottery_2"] = "Pottery 2",
			["piece_rome_pottery_3"] = "Pottery 3",
			["piece_rome_pottery_4"] = "Pottery 4",
			["piece_rome_pottery_5"] = "Pottery 5",
			["piece_rome_pottery_6"] = "Pottery 6",
			["piece_rome_pottery_7"] = "Pottery 7",
			["piece_rome_pottery_8"] = "Pottery 8",
			["piece_rome_pottery_9"] = "Pottery 9",
			["piece_rome_pottery_10"] = "Pottery 10",
			["piece_rome_pottery_11"] = "Pottery 11",
			["piece_rome_pottery_12"] = "Pottery 12",
			["piece_rome_pottery_13"] = "Pottery 13",
			["piece_rome_vase_4"] = "Roman Vase 4",
			["piece_rome_vase_5"] = "Roman Vase 5",
			["piece_rome_vase_6"] = "Roman Vase 6"
		};

		private static Dictionary<string, string> containers = new Dictionary<string, string>
		{
			["piece_rome_barrel_1"] = "Roman Barrel 1",
			["piece_rome_barrel_2"] = "Roman Barrel 2",
			["piece_rome_small_crate_1"] = "Roman Crate 1",
			["piece_rome_small_crate_2"] = "Roman Crate 2",
			["piece_rome_small_crate_3"] = "Roman Crate 3",
			["piece_rome_small_crate_4"] = "Roman Crate 4"
		};

		private static Dictionary<string, string> doorObjs = new Dictionary<string, string>
		{
			["piece_rome_door_1"] = "Roman Door 1",
			["piece_rome_door_2"] = "Roman Door 2",
			["piece_rome_door_3"] = "Roman Door 3",
			["piece_rome_door_4"] = "Roman Door 4",
			["piece_rome_door_5"] = "Roman Door 5",
			["piece_rome_door_6"] = "Roman Door 6"
		};

		private static readonly List<GameObject> doors = new List<GameObject>();

		private static Dictionary<string, string> fireProps = new Dictionary<string, string>
		{
			["piece_rome_firebowl"] = "Roman Fire Bowl",
			["piece_rome_light_post"] = "Roman Street Lamp"
		};

		private static Dictionary<string, string> metalProps = new Dictionary<string, string>
		{
			["piece_rome_bronze_pot"] = "Bronze Pot",
			["piece_rome_door_knob_lion"] = "Door Knob",
			["piece_rome_post_1"] = "Roman Post",
			["piece_rome_shield_1"] = "Roman Shield 1",
			["piece_rome_shield_2"] = "Roman Shield 2",
			["piece_rome_spear_1"] = "Roman Spear",
			["piece_rome_sword_1"] = "Roman Sword",
			["piece_rome_vase_1"] = "Metal Vase 1",
			["piece_rome_vase_2"] = "Metal Vase 2",
			["piece_rome_vase_3"] = "Metal Vase 3",
			["piece_rome_weapon_stand_2"] = "Roman Weapon Stand 1",
			["piece_rome_weapon_stand_3"] = "Roman Weapon Stand 2"
		};

		private static Dictionary<string, string> bushes = new Dictionary<string, string> { ["piece_rome_bush_1"] = "Roman Bush" };

		private static Dictionary<string, string> grasses = new Dictionary<string, string> { ["piece_rome_grass"] = "Roman Grass" };

		private static Dictionary<string, string> rocks = new Dictionary<string, string>
		{
			["piece_rome_rock_1"] = "Roman Rock 1",
			["piece_rome_rock_2"] = "Roman Rock 2",
			["piece_rome_rock_3"] = "Roman Rock 3",
			["piece_rome_rock_4"] = "Roman Rock 4",
			["piece_rome_rock_5"] = "Roman Rock 5",
			["piece_rome_rock_6"] = "Roman Rock 6",
			["piece_rome_rock_7"] = "Roman Rock 7",
			["piece_rome_rock_8"] = "Roman Rock 8",
			["piece_rome_rock_9"] = "Roman Rock 9",
			["piece_rome_rock_10"] = "Roman Rock 10"
		};

		private static Dictionary<string, string> trees = new Dictionary<string, string>
		{
			["piece_rome_tree_1"] = "Roman Tree 1",
			["piece_rome_tree_2"] = "Roman Tree 2",
			["piece_rome_tree_3"] = "Roman Tree 3",
			["piece_rome_tree_4"] = "Roman Tree 4",
			["piece_rome_tree_5"] = "Roman Tree 5"
		};

		private static Dictionary<string, string> props = new Dictionary<string, string>
		{
			["piece_apple_green"] = "Roman Apple 1",
			["piece_apple_red"] = "Roman Apple 2",
			["piece_rome_book_1"] = "Roman Book 1",
			["piece_rome_book_2"] = "Roman Book 2",
			["piece_rome_bread_1"] = "Roman Bread 1",
			["piece_rome_bread_2"] = "Roman Bread 2",
			["piece_rome_cloth_folded_1"] = "Roman Cloth 1",
			["piece_rome_cloth_folded_2"] = "Roman Cloth 2",
			["piece_rome_cloth_folded_3"] = "Roman Cloth 3",
			["piece_rome_hanging_cloth_1"] = "Roman Hanging Cloth",
			["piece_rome_hanging_cloth_2"] = "Roman Hanging Cloth",
			["piece_rome_hanging_cloth_3"] = "Roman Hanging Cloth",
			["piece_rome_hanging_fruit_1"] = "Roman Hanging Fruits",
			["piece_rome_hanging_fruit_2"] = "Roman Hanging Fruits",
			["piece_rome_peach"] = "Roman Peach",
			["piece_rome_rope_1"] = "Roman Rope 1",
			["piece_rome_rope_2"] = "Roman Rope 2",
			["piece_rome_rope_3"] = "Roman Rope 3",
			["piece_rome_rope_4"] = "Roman Rope 4",
			["piece_rome_rope_5"] = "Cloth Line 1",
			["piece_rome_rope_6"] = "Cloth Line 2",
			["piece_rome_scroll_1"] = "Roman Scroll 1",
			["piece_rome_scroll_2"] = "Roman Scroll 2",
			["piece_rome_scroll_3"] = "Roman Scroll 3",
			["piece_rome_weapon_stand_1"] = "Roman Weapon Stand",
			["piece_rome_window_cover_1"] = "Roman Window Cover 1",
			["piece_rome_window_cover_2"] = "Roman Window Cover 2"
		};

		private static Dictionary<string, string> shelves = new Dictionary<string, string>
		{
			["piece_rome_shelf_1"] = "Roman Shelf 1",
			["piece_rome_shelf_2"] = "Roman Shelf 2",
			["piece_rome_shelf_3"] = "Roman Shelf 3",
			["piece_rome_shelf_4"] = "Roman Shelf 4",
			["piece_rome_shelf_5"] = "Roman Shelf 5"
		};

		private static Dictionary<string, string> tables = new Dictionary<string, string>
		{
			["piece_rome_desk"] = "Roman Desk",
			["piece_rome_table_1"] = "Roman Table 1",
			["piece_rome_table_2"] = "Roman Table 2",
			["piece_rome_table_3"] = "Roman Table 3",
			["piece_rome_table_4"] = "Roman Table 4",
			["piece_rome_table_5"] = "Roman Table 5",
			["piece_rome_table_6"] = "Roman Table 6"
		};

		private static Dictionary<string, string> fences = new Dictionary<string, string>
		{
			["piece_rome_wood_fence_1"] = "Roman Fence 1",
			["piece_rome_wood_fence_2"] = "Roman Fence 2"
		};

		private static Dictionary<string, string> beds = new Dictionary<string, string> { ["piece_rome_bed_1"] = "Roman Bed" };

		private static Dictionary<string, string> stands = new Dictionary<string, string>
		{
			["piece_market_stand_1"] = "Market Stand 1",
			["piece_market_stand_2"] = "Market Stand 2",
			["piece_market_stand_3"] = "Market Stand 3",
			["piece_market_stand_4"] = "Market Stand 4",
			["piece_rome_cloth_stand"] = "Cloth Stand",
			["piece_rome_fruit_stand"] = "Fruit Stand"
		};

		private static Dictionary<string, string> sculptures = new Dictionary<string, string>
		{
			["piece_sculpture_athena_gold"] = "Athena 1",
			["piece_sculpture_athena_stone"] = "Athena 2",
			["piece_sculpture_augustus_gold"] = "Augustus 1",
			["piece_sculpture_augustus_stone"] = "Augustus 2",
			["piece_sculpture_goddess_gold"] = "Goddess 1",
			["piece_sculpture_goddess_stone"] = "Goddess 2",
			["piece_sculpture_man_gold"] = "Man 1",
			["piece_sculpture_man_stone"] = "Man 2",
			["piece_sculpture_midathrias_gold"] = "Midathrias 1",
			["piece_sculpture_midathrias_stone"] = "Midathrias 2",
			["piece_sculpture_putti_1_gold"] = "Putti 1",
			["piece_sculpture_putti_1_stone"] = "Putti 2",
			["piece_sculpture_putti_2_gold"] = "Putti 3",
			["piece_sculpture_putti_2_stone"] = "Putti 4",
			["piece_sculpture_putti_3_gold"] = "Putti 5",
			["piece_sculpture_putti_3_stone"] = "Putti 6",
			["piece_sculpture_putti_4_gold"] = "Putti 7",
			["piece_sculpture_putti_4_stone"] = "Putti 8",
			["piece_sculpture_putti_5_gold"] = "Putti 9",
			["piece_sculpture_putti_5_stone"] = "Putti 10",
			["piece_sculpture_soldier_gold"] = "Soldier 1",
			["piece_sculpture_soldier_stone"] = "Soldier 2",
			["piece_sculpture_woman_gold"] = "Woman 1",
			["piece_sculpture_woman_stone"] = "Woman 2"
		};

		private static void LoadFescoWall()
		{
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_wall_4");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			component2.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_HitSparks");
			component2.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
			buildPiece.Name.English("Fesco Wall");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Stone", 25, recover: true);
			buildPiece.RequiredItems.Add("FineWood", 5, recover: true);
			buildPiece.RequiredItems.Add("Coins", 5, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
			MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
			Material material = ((Renderer)componentInChildren).sharedMaterials[3];
			MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.TwoSided);
			MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			foreach (KeyValuePair<string, string> fresco in frescos)
			{
				string key = fresco.Key;
				string value = fresco.Value;
				BuildPiece buildPiece2 = new BuildPiece("ravenwood_rome", key);
				Piece component3 = buildPiece2.Prefab.GetComponent<Piece>();
				WearNTear component4 = buildPiece2.Prefab.GetComponent<WearNTear>();
				component3.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component4.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_RockHit");
				component4.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				component4.m_damages = new DamageModifiers
				{
					m_blunt = (DamageModifier)3,
					m_slash = (DamageModifier)3,
					m_pierce = (DamageModifier)3,
					m_pickaxe = (DamageModifier)3,
					m_chop = (DamageModifier)3,
					m_fire = (DamageModifier)3,
					m_frost = (DamageModifier)3,
					m_lightning = (DamageModifier)3,
					m_poison = (DamageModifier)3,
					m_spirit = (DamageModifier)3
				};
				buildPiece2.Name.English(value);
				buildPiece2.Category.Set("Ravenwood");
				buildPiece2.Usage.Set((UsageTagFlags)64);
				buildPiece.RequiredItems.Add("Stone", 25, recover: true);
				buildPiece.RequiredItems.Add("FineWood", 5, recover: true);
				buildPiece.RequiredItems.Add("Coins", 5, recover: true);
				buildPiece2.Crafting.Set(CraftingTable.Workbench);
				buildPiece2.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		private static void LoadLargePlatform()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_large_platform_preset");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Large Platform");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Stone", 500, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
			MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
		}

		public static void LoadArchitectures()
		{
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			LoadLargePlatform();
			foreach (KeyValuePair<string, string> architecture in architectures)
			{
				string key = architecture.Key;
				string value = architecture.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component2.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_HitSparks");
				component2.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)64);
				buildPiece.RequiredItems.Add("Stone", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> item in immuneStuff)
			{
				string key2 = item.Key;
				string value2 = item.Value;
				BuildPiece buildPiece2 = new BuildPiece("ravenwood_rome", key2);
				Piece component3 = buildPiece2.Prefab.GetComponent<Piece>();
				WearNTear component4 = buildPiece2.Prefab.GetComponent<WearNTear>();
				component3.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				Object.DestroyImmediate((Object)(object)component4);
				buildPiece2.Prefab.AddComponent<Highlightable>();
				buildPiece2.Name.English(value2);
				buildPiece2.Category.Set("Ravenwood");
				buildPiece2.Usage.Set((UsageTagFlags)64);
				buildPiece2.RequiredItems.Add("Stone", 10, recover: true);
				buildPiece2.Crafting.Set(CraftingTable.Workbench);
				buildPiece2.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> wall in walls)
			{
				string key3 = wall.Key;
				string value3 = wall.Value;
				BuildPiece buildPiece3 = new BuildPiece("ravenwood_rome", key3);
				Piece component5 = buildPiece3.Prefab.GetComponent<Piece>();
				WearNTear component6 = buildPiece3.Prefab.GetComponent<WearNTear>();
				component5.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component6.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_RockHit");
				component6.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				component6.m_damages = new DamageModifiers
				{
					m_blunt = (DamageModifier)3,
					m_slash = (DamageModifier)3,
					m_pierce = (DamageModifier)3,
					m_pickaxe = (DamageModifier)3,
					m_chop = (DamageModifier)3,
					m_fire = (DamageModifier)3,
					m_frost = (DamageModifier)3,
					m_lightning = (DamageModifier)3,
					m_poison = (DamageModifier)3,
					m_spirit = (DamageModifier)3
				};
				buildPiece3.Name.English(value3);
				buildPiece3.Category.Set("Ravenwood");
				buildPiece3.Usage.Set((UsageTagFlags)64);
				buildPiece3.RequiredItems.Add("Stone", 50, recover: true);
				buildPiece3.Crafting.Set(CraftingTable.Workbench);
				buildPiece3.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			LoadFescoWall();
			foreach (KeyValuePair<string, string> pillar in pillars)
			{
				string key4 = pillar.Key;
				string value4 = pillar.Value;
				BuildPiece buildPiece4 = new BuildPiece("ravenwood_rome", key4);
				Piece component7 = buildPiece4.Prefab.GetComponent<Piece>();
				WearNTear component8 = buildPiece4.Prefab.GetComponent<WearNTear>();
				component7.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component8.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_RockHit");
				component8.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				buildPiece4.Name.English(value4);
				buildPiece4.Category.Set("Ravenwood");
				buildPiece4.Usage.Set((UsageTagFlags)64);
				buildPiece4.RequiredItems.Add("Stone", 20, recover: true);
				buildPiece4.Crafting.Set(CraftingTable.Workbench);
				buildPiece4.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> stair in stairs)
			{
				string key5 = stair.Key;
				string value5 = stair.Value;
				BuildPiece buildPiece5 = new BuildPiece("ravenwood_rome", key5);
				Piece component9 = buildPiece5.Prefab.GetComponent<Piece>();
				WearNTear component10 = buildPiece5.Prefab.GetComponent<WearNTear>();
				component9.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component10.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_RockHit");
				component10.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				buildPiece5.Name.English(value5);
				buildPiece5.Category.Set("Ravenwood");
				buildPiece5.Usage.Set((UsageTagFlags)64);
				buildPiece5.RequiredItems.Add("Stone", 50, recover: true);
				buildPiece5.Crafting.Set(CraftingTable.Workbench);
				buildPiece5.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadBanners()
		{
			bool flag = false;
			foreach (KeyValuePair<string, string> banner in banners)
			{
				string key = banner.Key;
				string value = banner.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_hitEffect = new EffectListRef("sfx_wood_hit");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Wood", 10, recover: true);
				buildPiece.RequiredItems.Add("Tin", 1, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				if (!flag)
				{
					MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
					Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
					Material material = sharedMaterials[0];
					Material material2 = sharedMaterials[1];
					MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.RockShader);
					MaterialData materialData2 = new MaterialData(material2, MaterialReplacer.ShaderType.TwoSided);
					flag = true;
				}
			}
		}

		public static void LoadBaskets()
		{
			foreach (KeyValuePair<string, string> basket in baskets)
			{
				string key = basket.Key;
				string value = basket.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_smallitem", "sfx_build_hammer_default");
				component2.m_hitEffect = new EffectListRef("sfx_hit");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_hit");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Wood", 1, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		private static void LoadSenate()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_senate");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Senate");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Coins", 1500, recover: true);
			buildPiece.RequiredItems.Add("Stone", 500, recover: true);
			buildPiece.RequiredItems.Add("FineWood", 500, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 250, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
		}

		private static void LoadLargeTemple()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_large_temple");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Large Temple");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Coins", 1000, recover: true);
			buildPiece.RequiredItems.Add("Stone", 400, recover: true);
			buildPiece.RequiredItems.Add("FineWood", 400, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 200, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
		}

		private static void LoadSmallTemple()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_small_temple");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Small Temple");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Coins", 500, recover: true);
			buildPiece.RequiredItems.Add("Stone", 250, recover: true);
			buildPiece.RequiredItems.Add("FineWood", 250, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 125, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
		}

		private static void LoadAmphitheatre()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_amphitheatre");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Amphitheatre");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("Coins", 4000, recover: true);
			buildPiece.RequiredItems.Add("Stone", 1000, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 500, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
		}

		private static void LoadTriumphantArch()
		{
			BuildPiece buildPiece = new BuildPiece("ravenwood_rome", "piece_rome_arch_build");
			Piece component = buildPiece.Prefab.GetComponent<Piece>();
			WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
			component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
			Object.DestroyImmediate((Object)(object)component2);
			buildPiece.Prefab.AddComponent<Highlightable>();
			buildPiece.Name.English("Triumphant Arch");
			buildPiece.Category.Set("Ravenwood");
			buildPiece.Usage.Set((UsageTagFlags)64);
			buildPiece.RequiredItems.Add("FineWood", 200, recover: true);
			buildPiece.RequiredItems.Add("Stone", 200, recover: true);
			buildPiece.RequiredItems.Add("RoundLog", 100, recover: true);
			buildPiece.RequiredItems.Add("BronzeNails", 50, recover: true);
			buildPiece.Crafting.Set(CraftingTable.Workbench);
			buildPiece.Snapshot();
		}

		public static void LoadBuildings()
		{
			LoadAmphitheatre();
			LoadLargeTemple();
			LoadSmallTemple();
			LoadSenate();
			LoadTriumphantArch();
			foreach (KeyValuePair<string, string> building in buildings)
			{
				string key = building.Key;
				string value = building.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				Object.DestroyImmediate((Object)(object)component2);
				buildPiece.Prefab.AddComponent<Highlightable>();
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)64);
				buildPiece.RequiredItems.Add("FineWood", 200, recover: true);
				buildPiece.RequiredItems.Add("Stone", 200, recover: true);
				buildPiece.RequiredItems.Add("RoundLog", 40, recover: true);
				buildPiece.RequiredItems.Add("BronzeNails", 20, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadCandles()
		{
			foreach (KeyValuePair<string, string> candle in candles)
			{
				string key = candle.Key;
				string value = candle.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_build_hammer_default", "fx_candle_off");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Honey", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				buildPiece.Prefab.AddComponent<RomanCandle>();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadChairs()
		{
			foreach (KeyValuePair<string, string> chair in chairs)
			{
				string key = chair.Key;
				string value = chair.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				Chair component3 = buildPiece.Prefab.GetComponent<Chair>();
				component3.m_name = "$" + ((Object)buildPiece.Prefab).name.Replace(" ", "_");
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.RequiredItems.Add("Bronze", 2, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadClayPottery()
		{
			Container val = default(Container);
			foreach (KeyValuePair<string, string> clayPot in clayPots)
			{
				string key = clayPot.Key;
				string value = clayPot.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_clay_pot_break");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				if (buildPiece.Prefab.TryGetComponent<Container>(ref val))
				{
					val.m_openEffects = new EffectListRef("sfx_chest_open");
					val.m_closeEffects = new EffectListRef("sfx_chest_close");
					val.m_name = "$" + ((Object)buildPiece.Prefab).name.Replace(" ", "_");
				}
				MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
				foreach (Material material in sharedMaterials)
				{
					MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.RockShader);
					materialData.floatProps["_MossAlpha"] = 0f;
				}
			}
		}

		public static void LoadContainers()
		{
			foreach (KeyValuePair<string, string> container in containers)
			{
				string key = container.Key;
				string value = container.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				Container component3 = buildPiece.Prefab.GetComponent<Container>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				component3.m_openEffects = new EffectListRef("sfx_chest_open");
				component3.m_closeEffects = new EffectListRef("sfx_chest_close");
				component3.m_name = "$" + ((Object)buildPiece.Prefab).name.Replace(" ", "_");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadDoors()
		{
			foreach (KeyValuePair<string, string> doorObj in doorObjs)
			{
				string key = doorObj.Key;
				string value = doorObj.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				doors.Add(buildPiece.Prefab);
				MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
				foreach (Material material in sharedMaterials)
				{
					MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.RockShader);
					materialData.floatProps["_MossAlpha"] = 0f;
				}
			}
		}

		public static void LoadFireProps()
		{
			foreach (KeyValuePair<string, string> fireProp in fireProps)
			{
				string key = fireProp.Key;
				string value = fireProp.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_build_hammer_default", "fx_candle_off");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.RequiredItems.Add("Bronze", 2, recover: true);
				buildPiece.RequiredItems.Add("Coal", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				buildPiece.Prefab.AddComponent<RomanFire>();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadMetalProps()
		{
			foreach (KeyValuePair<string, string> metalProp in metalProps)
			{
				string key = metalProp.Key;
				string value = metalProp.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_metal");
				component2.m_destroyedEffect = new EffectListRef("sfx_metal_blocked", "sfx_SawDust");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Wood", 10, recover: true);
				buildPiece.RequiredItems.Add("Bronze", 1, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
				foreach (Material material in sharedMaterials)
				{
					MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.RockShader);
					materialData.floatProps["_MossAlpha"] = 0f;
					materialData.floatProps["_MetalGloss"] = 1f;
					materialData.floatProps["_Metallic"] = 0.75f;
				}
			}
		}

		public static void LoadNature()
		{
			foreach (KeyValuePair<string, string> bush in bushes)
			{
				string key = bush.Key;
				string value = bush.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_hitEffect = new EffectListRef("sfx_bush_hit", "vfx_bush_puff");
				component2.m_destroyedEffect = new EffectListRef("vfx_bush_destroyed", "sfx_bush_hit");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Wood", 1, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.VegetationShader);
			}
			foreach (KeyValuePair<string, string> grass in grasses)
			{
				string key2 = grass.Key;
				string value2 = grass.Value;
				BuildPiece buildPiece2 = new BuildPiece("ravenwood_rome", key2);
				Piece component3 = buildPiece2.Prefab.GetComponent<Piece>();
				WearNTear component4 = buildPiece2.Prefab.GetComponent<WearNTear>();
				component3.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component4.m_hitEffect = new EffectListRef("sfx_bush_hit", "vfx_bush_puff");
				component4.m_destroyedEffect = new EffectListRef("vfx_bush_destroyed", "sfx_bush_hit");
				buildPiece2.Name.English(value2);
				buildPiece2.Category.Set("Ravenwood");
				buildPiece2.Usage.Set((UsageTagFlags)512);
				buildPiece2.RequiredItems.Add("Wood", 1, recover: true);
				buildPiece2.Crafting.Set(CraftingTable.Workbench);
				buildPiece2.Snapshot();
				MeshRenderer componentInChildren = buildPiece2.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
				Material material = sharedMaterials[0];
				MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.VegetationShader);
				materialData.floatProps["_Height"] = 5f;
				materialData.floatProps["_SwaySpeed"] = 10f;
				materialData.floatProps["_SwayDistance"] = 25f;
				materialData.floatProps["_RippleSpeed"] = 150f;
				materialData.floatProps["_RippleDistance"] = 2f;
				materialData.floatProps["_RippleDeadzoneMin"] = 2f;
				materialData.floatProps["_RippleDeadzoneMax"] = 3f;
				materialData.floatProps["_AddSnow"] = 1f;
				materialData.floatProps["_AddRain"] = 1f;
				materialData.floatProps["_PushDistance"] = 0.4f;
				materialData.floatProps["_PushClothMode"] = 1f;
			}
			foreach (KeyValuePair<string, string> rock in rocks)
			{
				string key3 = rock.Key;
				string value3 = rock.Value;
				BuildPiece buildPiece3 = new BuildPiece("ravenwood_rome", key3);
				Piece component5 = buildPiece3.Prefab.GetComponent<Piece>();
				WearNTear component6 = buildPiece3.Prefab.GetComponent<WearNTear>();
				component5.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component6.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_RockHit");
				component6.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				buildPiece3.Name.English(value3);
				buildPiece3.Category.Set("Ravenwood");
				buildPiece3.Usage.Set((UsageTagFlags)512);
				buildPiece3.RequiredItems.Add("Stone", 1, recover: true);
				buildPiece3.Crafting.Set(CraftingTable.Workbench);
				buildPiece3.Snapshot();
				MeshRenderer componentInChildren2 = buildPiece3.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials2 = ((Renderer)componentInChildren2).sharedMaterials;
				Material[] array = sharedMaterials2;
				foreach (Material material2 in array)
				{
					MaterialData materialData2 = new MaterialData(material2, MaterialReplacer.ShaderType.RockShader);
					materialData2.floatProps["_MossAlpha"] = 0f;
				}
			}
			foreach (KeyValuePair<string, string> tree in trees)
			{
				string key4 = tree.Key;
				string value4 = tree.Value;
				BuildPiece buildPiece4 = new BuildPiece("ravenwood_rome", key4);
				Piece component7 = buildPiece4.Prefab.GetComponent<Piece>();
				WearNTear component8 = buildPiece4.Prefab.GetComponent<WearNTear>();
				component7.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component8.m_hitEffect = new EffectListRef("vfx_beech_cut", "sfx_tree_hit");
				component8.m_destroyedEffect = new EffectListRef("vfx_beech_small1_destroy", "sfx_tree_fall");
				buildPiece4.Name.English(value4);
				buildPiece4.Category.Set("Ravenwood");
				buildPiece4.Usage.Set((UsageTagFlags)512);
				buildPiece4.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece4.Crafting.Set(CraftingTable.Workbench);
				buildPiece4.Snapshot();
				MeshRenderer componentInChildren3 = buildPiece4.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials3 = ((Renderer)componentInChildren3).sharedMaterials;
				Material material3 = sharedMaterials3[0];
				Material material4 = sharedMaterials3[1];
				MaterialData materialData3 = new MaterialData(material3, MaterialReplacer.ShaderType.VegetationShader);
				materialData3.floatProps["_Height"] = 35f;
				materialData3.floatProps["_SwaySpeed"] = 10f;
				materialData3.floatProps["_SwayDistance"] = 25f;
				materialData3.floatProps["_RippleSpeed"] = 100f;
				materialData3.floatProps["_RippleDistance"] = 0f;
				materialData3.floatProps["_RippleDeadzoneMin"] = 0.47f;
				materialData3.floatProps["_RippleDeadzoneMax"] = 2.65f;
				materialData3.floatProps["_AddSnow"] = 1f;
				materialData3.floatProps["_AddRain"] = 1f;
				MaterialData materialData4 = new MaterialData(material4, MaterialReplacer.ShaderType.VegetationShader);
				materialData4.floatProps["_Height"] = 35f;
				materialData4.floatProps["_SwaySpeed"] = 10f;
				materialData4.floatProps["_SwayDistance"] = 25f;
				materialData4.floatProps["_RippleSpeed"] = 150f;
				materialData4.floatProps["_RippleDistance"] = 2f;
				materialData4.floatProps["_RippleDeadzoneMin"] = 2f;
				materialData4.floatProps["_RippleDeadzoneMax"] = 3f;
				materialData4.floatProps["_AddSnow"] = 1f;
				materialData4.floatProps["_AddRain"] = 1f;
			}
		}

		public static void LoadProps()
		{
			foreach (KeyValuePair<string, string> prop in props)
			{
				string key = prop.Key;
				string value = prop.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 2, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> shelf in shelves)
			{
				string key2 = shelf.Key;
				string value2 = shelf.Value;
				BuildPiece buildPiece2 = new BuildPiece("ravenwood_rome", key2);
				Piece component3 = buildPiece2.Prefab.GetComponent<Piece>();
				WearNTear component4 = buildPiece2.Prefab.GetComponent<WearNTear>();
				component3.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component4.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece2.Name.English(value2);
				buildPiece2.Category.Set("Ravenwood");
				buildPiece2.Usage.Set((UsageTagFlags)512);
				buildPiece2.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece2.RequiredItems.Add("BronzeNails", 2, recover: true);
				buildPiece2.Crafting.Set(CraftingTable.Workbench);
				buildPiece2.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> table in tables)
			{
				string key3 = table.Key;
				string value3 = table.Value;
				BuildPiece buildPiece3 = new BuildPiece("ravenwood_rome", key3);
				Piece component5 = buildPiece3.Prefab.GetComponent<Piece>();
				WearNTear component6 = buildPiece3.Prefab.GetComponent<WearNTear>();
				component5.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component6.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece3.Name.English(value3);
				buildPiece3.Category.Set("Ravenwood");
				buildPiece3.Usage.Set((UsageTagFlags)512);
				buildPiece3.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece3.RequiredItems.Add("BronzeNails", 2, recover: true);
				buildPiece3.Crafting.Set(CraftingTable.Workbench);
				buildPiece3.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> fence in fences)
			{
				string key4 = fence.Key;
				string value4 = fence.Value;
				BuildPiece buildPiece4 = new BuildPiece("ravenwood_rome", key4);
				Piece component7 = buildPiece4.Prefab.GetComponent<Piece>();
				WearNTear component8 = buildPiece4.Prefab.GetComponent<WearNTear>();
				component7.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component8.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece4.Name.English(value4);
				buildPiece4.Category.Set("Ravenwood");
				buildPiece4.Usage.Set((UsageTagFlags)512);
				buildPiece4.RequiredItems.Add("Wood", 10, recover: true);
				buildPiece4.Crafting.Set(CraftingTable.Workbench);
				buildPiece4.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
			foreach (KeyValuePair<string, string> bed in beds)
			{
				string key5 = bed.Key;
				string value5 = bed.Value;
				BuildPiece buildPiece5 = new BuildPiece("ravenwood_rome", key5);
				Piece component9 = buildPiece5.Prefab.GetComponent<Piece>();
				WearNTear component10 = buildPiece5.Prefab.GetComponent<WearNTear>();
				component9.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component10.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece5.Name.English(value5);
				buildPiece5.Category.Set("Ravenwood");
				buildPiece5.Usage.Set((UsageTagFlags)512);
				buildPiece5.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece5.RequiredItems.Add("Bronze", 2, recover: true);
				buildPiece5.Crafting.Set(CraftingTable.Workbench);
				buildPiece5.Snapshot();
				MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader);
			}
		}

		public static void LoadStands()
		{
			foreach (KeyValuePair<string, string> stand in stands)
			{
				string key = stand.Key;
				string value = stand.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_default");
				component2.m_destroyedEffect = new EffectListRef("sfx_wood_destroyed", "vfx_SawDust");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("FineWood", 10, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
				Material material = ((Renderer)componentInChildren).sharedMaterials[0];
				Material material2 = ((Renderer)componentInChildren).sharedMaterials[1];
				MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.PieceShader);
				MaterialData materialData2 = new MaterialData(material2, MaterialReplacer.ShaderType.TwoSided);
			}
		}

		public static void LoadSculptures()
		{
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, GameObject> dictionary = new Dictionary<string, GameObject>();
			foreach (KeyValuePair<string, string> sculpture in sculptures)
			{
				string key = sculpture.Key;
				string value = sculpture.Value;
				BuildPiece buildPiece = new BuildPiece("ravenwood_rome", key);
				Piece component = buildPiece.Prefab.GetComponent<Piece>();
				WearNTear component2 = buildPiece.Prefab.GetComponent<WearNTear>();
				component.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component2.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_HitSparks");
				component2.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed");
				buildPiece.Name.English(value);
				buildPiece.Category.Set("Ravenwood");
				buildPiece.Usage.Set((UsageTagFlags)512);
				buildPiece.RequiredItems.Add("Stone", 20, recover: true);
				buildPiece.Crafting.Set(CraftingTable.Workbench);
				buildPiece.Snapshot();
				MeshRenderer componentInChildren = buildPiece.Prefab.GetComponentInChildren<MeshRenderer>();
				Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials;
				Material[] array = sharedMaterials;
				foreach (Material material in array)
				{
					MaterialData materialData = new MaterialData(material, MaterialReplacer.ShaderType.RockShader);
					materialData.floatProps["_MossAlpha"] = 0f;
				}
				GameObject val = Object.Instantiate<GameObject>(buildPiece.Prefab, RavenwoodRomePlugin.rt);
				((Object)val).name = ((Object)buildPiece.Prefab).name + "_large";
				for (int j = 0; j < val.transform.childCount; j++)
				{
					Transform child = val.transform.GetChild(j);
					child.localScale *= 2f;
				}
				dictionary[value] = val;
			}
			foreach (KeyValuePair<string, GameObject> item in dictionary)
			{
				string key2 = "Large " + item.Key;
				BuildPiece buildPiece2 = new BuildPiece(item.Value);
				Piece component3 = buildPiece2.Prefab.GetComponent<Piece>();
				component3.m_name += "_large";
				WearNTear component4 = buildPiece2.Prefab.GetComponent<WearNTear>();
				component3.m_placeEffect = new EffectListRef("vfx_Place_wood_pole", "sfx_build_hammer_stone");
				component4.m_hitEffect = new EffectListRef("sfx_rock_hit", "vfx_HitSparks");
				component4.m_destroyedEffect = new EffectListRef("sfx_rock_destroyed", "vfx_RockDestroyed_large");
				buildPiece2.Name.English(key2);
				buildPiece2.Category.Set("Ravenwood");
				buildPiece2.Usage.Set((UsageTagFlags)512);
				buildPiece2.RequiredItems.Add("Stone", 40, recover: true);
				buildPiece2.Crafting.Set(CraftingTable.Workbench);
				buildPiece2.Snapshot();
			}
		}
	}
	public class EffectListRef
	{
		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetScene_Awake_Patch
		{
			private static void Postfix()
			{
				LoadAll();
			}
		}

		private static readonly List<EffectListRef> m_effectListRefs = new List<EffectListRef>();

		public readonly EffectList m_effectList = new EffectList();

		public readonly EffectRef[] m_effectRefs;

		public static void LoadAll()
		{
			for (int i = 0; i < m_effectListRefs.Count; i++)
			{
				EffectListRef effectListRef = m_effectListRefs[i];
				effectListRef.Load();
			}
		}

		public static implicit operator EffectList(EffectListRef elf)
		{
			return elf.m_effectList;
		}

		public EffectListRef(params string[] effectNames)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			List<EffectRef> list = new List<EffectRef>();
			foreach (string prefabName in effectNames)
			{
				EffectRef item = new EffectRef(prefabName);
				list.Add(item);
			}
			m_effectRefs = list.ToArray();
			m_effectListRefs.Add(this);
		}

		public EffectListRef(params EffectRef[] effectRefs)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			m_effectRefs = effectRefs;
			m_effectListRefs.Add(this);
		}

		private void Load()
		{
			List<EffectData> list = new List<EffectData>();
			for (int i = 0; i < m_effectRefs.Length; i++)
			{
				EffectRef effectRef = m_effectRefs[i];
				effectRef.Load();
				if (effectRef.m_isValid)
				{
					list.Add(effectRef.m_data);
				}
			}
			m_effectList.m_effectPrefabs = list.ToArray();
		}
	}
	public class EffectRef
	{
		public readonly EffectData m_data = new EffectData
		{
			m_enabled = enabled,
			m_variant = variant,
			m_attach = attach,
			m_follow = follow,
			m_inheritParentRotation = inheritParentRot,
			m_inheritParentScale = inheritParentScale,
			m_multiplyParentVisualScale = multiplyParentVisualScale,
			m_randomRotation = randomRotation,
			m_scale = scale,
			m_childTransform = childTransform
		};

		public bool m_isValid = false;

		public readonly string m_prefabName;

		public readonly Action<EffectRef> m_onLoad;

		public bool m_loaded;

		public EffectRef(string prefabName, bool attach = false, bool follow = false, bool inheritParentRot = false, bool inheritParentScale = false, bool multiplyParentVisualScale = false, bool randomRotation = false, bool scale = false, string childTransform = "", int variant = -1, bool enabled = true, Action<EffectRef> onLoad = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			m_prefabName = prefabName;
			m_onLoad = onLoad;
			base..ctor();
		}

		public void Load()
		{
			if (m_loaded)
			{
				return;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(m_prefabName);
			if (!((Object)(object)prefab == (Object)null))
			{
				m_data.m_prefab = prefab;
				if (m_onLoad != null)
				{
					m_onLoad(this);
				}
				m_isValid = (Object)(object)m_data.m_prefab != (Object)null;
				m_loaded = true;
			}
		}
	}
	public static class Extensions
	{
		public static void Remove<T>(this GameObject prefab) where T : Component
		{
			T val = default(T);
			if (prefab.TryGetComponent<T>(ref val))
			{
				Object.DestroyImmediate((Object)(object)val);
			}
		}
	}
	public class Highlightable : MonoBehaviour
	{
		[HarmonyPatch(typeof(Player), "UpdateWearNTearHover")]
		private static class Player_UpdateWearNTearHover
		{
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				MethodInfo methodInfo = AccessTools.Method(typeof(Player_UpdateWearNTearHover), "GetWearNTearOrHighlight", (Type[])null, (Type[])null);
				return new CodeMatcher(instructions, (ILGenerator)null).MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ins) => ins.opcode == OpCodes.Callvirt && ins.operand is MethodInfo { Name: "GetComponent", IsGenericMethod: not false } methodInfo2 && methodInfo2.GetGenericArguments()[0] == typeof(WearNTear)), (string)null)
				}).ThrowIfInvalid("Could not find GetComponent<WearNTear>() in UpdateWearNTearHover").SetInstruction(new CodeInstruction(OpCodes.Call, (object)methodInfo))
					.InstructionEnumeration();
			}

			private static WearNTear GetWearNTearOrHighlight(Piece piece)
			{
				WearNTear component = ((Component)piece).GetComponent<WearNTear>();
				Highlightable highlightable = default(Highlightable);
				if ((Object)(object)component == (Object)null && ((Component)piece).TryGetComponent<Highlightable>(ref highlightable))
				{
					highlightable.Highlight();
				}
				return component;
			}
		}

		public Color color = new Color(0.6f, 0.8f, 1f);

		public void Highlight()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			MaterialMan.instance.SetValue<Color>(((Component)this).gameObject, ShaderProps._EmissionColor, color * 0.4f, false);
			MaterialMan.instance.SetValue<Color>(((Component)this).gameObject, ShaderProps._Color, color, false);
			((MonoBehaviour)this).CancelInvoke("ResetHighlight");
			((MonoBehaviour)this).Invoke("ResetHighlight", 0.2f);
		}

		public void ResetHighlight()
		{
			MaterialMan.instance.ResetValue(((Component)this).gameObject, ShaderProps._Color);
			MaterialMan.instance.ResetValue(((Component)this).gameObject, ShaderProps._EmissionColor);
		}
	}
	public static class IconExport
	{
		public static void ExportSprite(Sprite sprite, string path, string filename)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sprite == (Object)null || (Object)(object)sprite.texture == (Object)null)
			{
				return;
			}
			string path2 = Path.Combine(path, filename + ".png");
			if (File.Exists(path2))
			{
				return;
			}
			try
			{
				Texture2D texture = sprite.texture;
				Rect textureRect = sprite.textureRect;
				if (((Rect)(ref textureRect)).x == 0f && ((Rect)(ref textureRect)).y == 0f && Mathf.Approximately(((Rect)(ref textureRect)).width, (float)((Texture)sprite.texture).width) && Mathf.Approximately(((Rect)(ref textureRect)).height, (float)((Texture)sprite.texture).height))
				{
					Export((Texture)(object)texture, path, filename);
					return;
				}
				RenderTexture temporary = RenderTexture.GetTemporary(((Texture)texture).width, ((Texture)texture).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)2);
				Graphics.Blit((Texture)(object)texture, temporary);
				RenderTexture active = RenderTexture.active;
				RenderTexture.active = temporary;
				Texture2D val = new Texture2D((int)((Rect)(ref textureRect)).width, (int)((Rect)(ref textureRect)).height);
				val.ReadPixels(textureRect, 0, 0);
				val.Apply();
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
				byte[] bytes = ImageConversion.EncodeToPNG(val);
				File.WriteAllBytes(path2, bytes);
			}
			catch
			{
				Debug.LogWarning((object)("Faild to export texture: " + filename));
			}
		}

		private static void Export(Texture texture, string path, string filename)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			string path2 = Path.Combine(path, filename + ".png");
			if (File.Exists(path2))
			{
				return;
			}
			try
			{
				RenderTexture temporary = RenderTexture.GetTemporary(texture.width, texture.height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)2);
				Graphics.Blit(texture, temporary);
				RenderTexture active = RenderTexture.active;
				RenderTexture.active = temporary;
				Texture2D val = new Texture2D(texture.width, texture.height);
				val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
				val.Apply();
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
				byte[] bytes = ImageConversion.EncodeToPNG(val);
				File.WriteAllBytes(path2, bytes);
			}
			catch
			{
				Debug.LogWarning((object)("Failed to export atlas texture: " + filename));
			}
		}
	}
	public static class ReadMeBuilder
	{
		private static bool buildReadme;

		private static bool exportSprites;

		static ReadMeBuilder()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			buildReadme = false;
			exportSprites = false;
			RavenwoodRomePlugin.instance._harmony.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNetScene), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(ReadMeBuilder), "Build", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void Init(bool exportIcons = true)
		{
			buildReadme = true;
			exportSprites = exportIcons;
		}

		public static void ExportLocalization()
		{
			string text = Path.Combine(Paths.ConfigPath, "RavenwoodRome");
			Directory.CreateDirectory(text);
			StringBuilder stringBuilder = new StringBuilder();
			foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces)
			{
				string name = registeredPiece.Prefab.GetComponent<Piece>().m_name;
				string text2 = Localization.instance.Localize(name);
				stringBuilder.AppendLine(name.Replace("$", string.Empty) + ": " + text2);
			}
			File.WriteAllText(Path.Combine(text, "English.yml"), stringBuilder.ToString());
		}

		public static void Build()
		{
			ExportLocalization();
			BuildAlt();
		}

		public static void BuildTable()
		{
			if (!buildReadme)
			{
				return;
			}
			string text = Path.Combine(Paths.ConfigPath, "RavenwoodRome");
			Directory.CreateDirectory(text);
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("# Ravenwood Rome");
			stringBuilder.AppendLine();
			foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces)
			{
				Piece component = registeredPiece.Prefab.GetComponent<Piece>();
				string name = ((Object)component).name;
				string name2 = component.m_name;
				string description = component.m_description;
				string text2 = ((Object)component).name + ".png";
				string text3 = "https://github.com/RustyMods/RavenwoodRome/blob/master/Icons/" + text2;
				IEnumerable<string> enumerable = registeredPiece.RequiredItems.Requirements.Select((Requirement r) => $"<li>{r.itemName} x {r.amount}</li>");
				if (exportSprites)
				{
					IconExport.ExportSprite(component.m_icon, text, ((Object)component).name);
				}
				stringBuilder.AppendLine("<table width=\"100%\">");
				stringBuilder.AppendLine("  <tr>");
				stringBuilder.AppendLine("    <td rowspan=\"4\" width=\"128\" align=\"center\" valign=\"middle\"><img src=\"" + text3 + "\" width=\"128\" height=\"128\" alt=\"" + name + "\"></td>");
				stringBuilder.AppendLine("    <td><b>Internal ID:</b> <code>" + name + "</code></td>");
				stringBuilder.AppendLine("  </tr>");
				stringBuilder.AppendLine("  <tr><td><b>Name:</b> " + name2 + "</td></tr>");
				stringBuilder.AppendLine("  <tr><td><b>Description:</b> " + description + "</td></tr>");
				stringBuilder.AppendLine("  <tr><td><b>Resources:</b>");
				stringBuilder.AppendLine("    <ul>");
				foreach (string item in enumerable)
				{
					stringBuilder.AppendLine("      " + item);
				}
				stringBuilder.AppendLine("    </ul>");
				stringBuilder.AppendLine("  </td></tr>");
				stringBuilder.AppendLine("</table>");
				stringBuilder.AppendLine();
			}
			File.WriteAllText(Path.Combine(text, "README.md"), stringBuilder.ToString());
		}

		public static void BuildAlt()
		{
			if (!buildReadme)
			{
				return;
			}
			string text = Path.Combine(Paths.ConfigPath, "RavenwoodRome");
			Directory.CreateDirectory(text);
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("# Ravenwood Rome");
			stringBuilder.AppendLine();
			stringBuilder.AppendLine("| Icon | Internal ID | Name | Description | Resources |");
			stringBuilder.AppendLine("|:---:|:---|:---|:---|:---|");
			foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces)
			{
				Piece component = registeredPiece.Prefab.GetComponent<Piece>();
				string name = ((Object)component).name;
				string name2 = component.m_name;
				string description = component.m_description;
				string text2 = "https://raw.githubusercontent.com/RustyMods/RavenwoodRome/master/Icons/" + ((Object)component).name + ".png";
				string text3 = string.Join(", ", registeredPiece.RequiredItems.Requirements.Select((Requirement r) => $"{r.itemName} x {r.amount}"));
				if (exportSprites)
				{
					IconExport.ExportSprite(component.m_icon, text, ((Object)component).name);
				}
				stringBuilder.AppendLine("| ![" + name + "](" + text2 + ") | `" + name + "` | " + Clean(name2) + " | " + Clean(description) + " | " + Clean(text3) + " |");
			}
			File.WriteAllText(Path.Combine(text, "README.md"), stringBuilder.ToString());
		}

		private static string Clean(string text)
		{
			return string.IsNullOrEmpty(text) ? "" : text.Replace("|", "\\|").Replace("\r", "").Replace("\n", " ");
		}
	}
	[HarmonyPatch(typeof(ZNet), "OnNewConnection")]
	public static class RegisterAndCheckVersion
	{
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			RavenwoodRomePlugin.RavenwoodRomeLogger.LogDebug((object)"Registering version RPC handler");
			peer.m_rpc.Register<ZPackage>("RavenwoodRome_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_RavenwoodRome_Version);
			RavenwoodRomePlugin.RavenwoodRomeLogger.LogDebug((object)"Invoking version check");
			ZPackage val = new ZPackage();
			val.Write("1.0.2");
			peer.m_rpc.Invoke("RavenwoodRome_VersionCheck", new object[1] { val });
		}
	}
	[HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")]
	public static class VerifyClient
	{
		private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance)
		{
			if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc))
			{
				return true;
			}
			RavenwoodRomePlugin.RavenwoodRomeLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting"));
			rpc.Invoke("Error", new object[1] { 3 });
			return false;
		}

		private static void Postfix(ZNet __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "RavenwoodRomeRequestAdminSync", new object[1] { (object)new ZPackage() });
		}
	}
	[HarmonyPatch(typeof(FejdStartup), "ShowConnectError")]
	public class ShowConnectionError
	{
		private static void Postfix(FejdStartup __instance)
		{
			if (__instance.m_connectionFailedPanel.activeSelf)
			{
				__instance.m_connectionFailedError.fontSizeMax = 25f;
				__instance.m_connectionFailedError.fontSizeMin = 15f;
				TMP_Text connectionFailedError = __instance.m_connectionFailedError;
				connectionFailedError.text = connectionFailedError.text + "\n" + RavenwoodRomePlugin.ConnectionError;
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Disconnect")]
	public static class RemoveDisconnectedPeerFromVerified
	{
		private static void Prefix(ZNetPeer peer, ref ZNet __instance)
		{
			if (__instance.IsServer())
			{
				RavenwoodRomePlugin.RavenwoodRomeLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list"));
				RpcHandlers.ValidatedPeers.Remove(peer.m_rpc);
			}
		}
	}
	public static class RpcHandlers
	{
		public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>();

		public static void RPC_RavenwoodRome_Version(ZRpc rpc, ZPackage pkg)
		{
			string text = pkg.ReadString();
			RavenwoodRomePlugin.RavenwoodRomeLogger.LogInfo((object)("Version check, local: 1.0.2,  remote: " + text));
			if (text != "1.0.2")
			{
				RavenwoodRomePlugin.ConnectionError = "RavenwoodRome Installed: 1.0.2\n Needed: " + text;
				if (ZNet.instance.IsServer())
				{
					RavenwoodRomePlugin.RavenwoodRomeLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting..."));
					rpc.Invoke("Error", new object[1] { 3 });
				}
			}
			else if (!ZNet.instance.IsServer())
			{
				RavenwoodRomePlugin.RavenwoodRomeLogger.LogInfo((object)"Received same version from server!");
			}
			else
			{
				RavenwoodRomePlugin.RavenwoodRomeLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list"));
				ValidatedPeers.Add(rpc);
			}
		}
	}
}
namespace PieceManager
{
	public class MaterialData
	{
		private static readonly List<Material> processedMaterials = new List<Material>();

		private static readonly int MetallicGlossMap = Shader.PropertyToID("_MetallicGlossMap");

		private static readonly int MetallicTex = Shader.PropertyToID("_MetallicTex");

		[CompilerGenerated]
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private static Texture <_noiseTex>k__BackingField;

		public Material material;

		public MaterialReplacer.ShaderType shaderType;

		public Dictionary<string, float> floatProps = new Dictionary<string, float>();

		public Texture metallicGlossMap;

		public static Texture _noiseTex
		{
			get
			{
				if ((Object)(object)<_noiseTex>k__BackingField != (Object)null)
				{
					return <_noiseTex>k__BackingField;
				}
				Texture[] source = Resources.FindObjectsOfTypeAll<Texture>();
				<_noiseTex>k__BackingField = ((IEnumerable<Texture>)source).FirstOrDefault((Func<Texture, bool>)((Texture t) => ((Object)t).name == "Noise"));
				return <_noiseTex>k__BackingField;
			}
		}

		public MaterialData(Material material, MaterialReplacer.ShaderType shaderType)
		{
			this.material = material;
			this.shaderType = shaderType;
			metallicGlossMap = (material.HasProperty(MetallicGlossMap) ? material.GetTexture(MetallicGlossMap) : null);
			MaterialReplacer.materialsToSet.Add(this);
		}

		public void Process()
		{
			if (processedMaterials.Contains(material))
			{
				return;
			}
			material.shader = MaterialReplacer.GetShaderForType(material.shader, shaderType, ((Object)material.shader).name);
			if (material.HasProperty("_NoiseTex"))
			{
				material.SetTexture("_NoiseTex", _noiseTex);
			}
			if (material.HasProperty(MetallicTex))
			{
				material.SetTexture(MetallicTex, metallicGlossMap);
			}
			foreach (KeyValuePair<string, float> floatProp in floatProps)
			{
				if (material.HasProperty(floatProp.Key))
				{
					material.SetFloat(floatProp.Key, floatProp.Value);
				}
			}
			processedMaterials.Add(material);
		}
	}
	[PublicAPI]
	public static class MaterialReplacer
	{
		public enum ShaderType
		{
			PieceShader,
			VegetationShader,
			RockShader,
			RugShader,
			GrassShader,
			CustomCreature,
			UseUnityShader,
			TwoSided
		}

		private static readonly Dictionary<GameObject, bool> ObjectToSwap;

		private static readonly Dictionary<string, Material> OriginalMaterials;

		private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace;

		private static readonly HashSet<Shader> CachedShaders;

		private static bool hasRun;

		public static List<MaterialData> materialsToSet;

		static MaterialReplacer()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			CachedShaders = new HashSet<Shader>();
			hasRun = false;
			materialsToSet = new List<MaterialData>();
			OriginalMaterials = new Dictionary<string, Material>();
			ObjectToSwap = new Dictionary<GameObject, bool>();
			ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>();
			Harmony val = new Harmony("org.bepinex.helpers.PieceManager");
			val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type)
		{
			if (!ObjectsForShaderReplace.ContainsKey(go))
			{
				ObjectsForShaderReplace.Add(go, type);
			}
		}

		public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false)
		{
			if (!((Object)(object)go == (Object)null) && !ObjectToSwap.ContainsKey(go))
			{
				ObjectToSwap.Add(go, isJotunnMock);
			}
		}

		private static void GetAllMaterials()
		{
			Material[] array = Resources.FindObjectsOfTypeAll<Material>();
			foreach (Material val in array)
			{
				OriginalMaterials[((Object)val).name] = val;
			}
		}

		[HarmonyPriority(700)]
		private static void ReplaceAllMaterialsWithOriginal()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun)
			{
				return;
			}
			if (OriginalMaterials.Count == 0)
			{
				GetAllMaterials();
			}
			foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap)
			{
				GameObject key = item.Key;
				bool value = item.Value;
				ProcessGameObjectMaterials(key, value);
			}
			AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>();
			AssetBundle[] array2 = array;
			foreach (AssetBundle val in array2)
			{
				IEnumerable<Shader> enumerable3;
				try
				{
					IEnumerable<Shader> enumerable2;
					if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val))
					{
						IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>();
						enumerable2 = enumerable;
					}
					else
					{
						enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>)
							where (Object)(object)shader != (Object)null
							select shader;
					}
					enumerable3 = enumerable2;
				}
				catch (Exception)
				{
					continue;
				}
				if (enumerable3 == null)
				{
					continue;
				}
				foreach (Shader item2 in enumerable3)
				{
					CachedShaders.Add(item2);
				}
			}
			foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace)
			{
				GameObject key2 = item3.Key;
				ShaderType value2 = item3.Value;
				ProcessGameObjectShaders(key2, value2);
			}
			foreach (MaterialData item4 in materialsToSet)
			{
				item4.Process();
			}
			hasRun = true;
		}

		private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock)
		{
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] sharedMaterials = val.sharedMaterials.Select((Material material) => ((Object)(object)material == (Object)null) ? null : ReplaceMaterial(material, isJotunnMock)).ToArray();
				val.sharedMaterials = sharedMaterials;
			}
		}

		private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock)
		{
			if ((Object)(object)originalMaterial == (Object)null)
			{
				return null;
			}
			string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_");
			if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal))
			{
				return originalMaterial;
			}
			string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, "");
			if (OriginalMaterials.TryGetValue(text2, out Material value))
			{
				return value;
			}
			Debug.LogWarning((object)("No suitable material found to replace: " + text2));
			return originalMaterial;
		}

		private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType)
		{
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 != (Object)null)
					{
						val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name);
						if (val2.HasProperty("_NoiseTex"))
						{
							val2.SetTexture("_NoiseTex", MaterialData._noiseTex);
						}
					}
				}
			}
		}

		public static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName)
		{
			return (Shader)(shaderType switch
			{
				ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), 
				ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), 
				ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), 
				ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), 
				ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), 
				ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), 
				ShaderType.TwoSided => FindShaderWithName(orig, "Standard TwoSided"), 
				ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), 
				_ => FindShaderWithName(orig, "Standard"), 
			});
		}

		public static Shader FindShaderWithName(Shader origShader, string name)
		{
			foreach (Shader cachedShader in CachedShaders)
			{
				if (((Object)cachedShader).name == name)
				{
					return cachedShader;
				}
			}
			return origShader;
		}
	}
	[PublicAPI]
	public enum CraftingTable
	{
		None,
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("piece_magetable")]
		MageTable,
		[InternalName("blackforge")]
		BlackForge,
		[InternalName("piece_preptable")]
		FoodPreparationTable,
		[InternalName("piece_MeadCauldron")]
		MeadKetill,
		Custom
	}
	public class InternalName : Attribute
	{
		public readonly string internalName;

		public InternalName(string internalName)
		{
			this.internalName = internalName;
		}
	}
	[PublicAPI]
	public class ExtensionList
	{
		public readonly List<ExtensionConfig> ExtensionStations = new List<ExtensionConfig>();

		public void Set(CraftingTable table, int maxStationDistance = 5)
		{
			ExtensionStations.Add(new ExtensionConfig
			{
				Table = table,
				maxStationDistance = maxStationDistance
			});
		}

		public void Set(string customTable, int maxStationDistance = 5)
		{
			ExtensionStations.Add(new ExtensionConfig
			{
				Table = CraftingTable.Custom,
				custom = customTable,
				maxStationDistance = maxStationDistance
			});
		}
	}
	public struct ExtensionConfig
	{
		public CraftingTable Table;

		public float maxStationDistance;

		public string? custom;
	}
	[PublicAPI]
	public class CraftingStationList
	{
		public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>();

		public void Set(CraftingTable table)
		{
			Stations.Add(new CraftingStationConfig
			{
				Table = table
			});
		}

		public void Set(string customTable)
		{
			Stations.Add(new CraftingStationConfig
			{
				Table = CraftingTable.Custom,
				custom = customTable
			});
		}
	}
	public struct CraftingStationConfig
	{
		public CraftingTable Table;

		public int level;

		public string? custom;
	}
	[PublicAPI]
	public enum BuildPieceCategory
	{
		Misc = 0,
		Crafting = 1,
		BuildingWorkbench = 2,
		BuildingStonecutter = 3,
		Furniture = 4,
		DeepNorth = 5,
		Feasts = 6,
		Food = 7,
		Meads = 8,
		All = 100,
		Custom = 99
	}
	[PublicAPI]
	public class PieceUsage
	{
		public UsageTagFlags Tags;

		public void Add(UsageTagFlags tag)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Tags |= tag;
		}

		public void Set(UsageTagFlags tags)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Tags = tags;
		}
	}
	[PublicAPI]
	public class RequiredResourcesList
	{
		public readonly List<Requirement> Requirements = new List<Requirement>();

		public void Add(string item, int amount, bool recover)
		{
			Requirements.Add(new Requirement
			{
				itemName = item,
				amount = amount,
				recover = recover
			});
		}
	}
	public struct Requirement
	{
		public string itemName;

		public int amount;

		public bool recover;
	}
	public struct SpecialProperties
	{
		[Description("Admins should be the only ones that can build this piece.")]
		public bool AdminOnly;

		[Description("Turns off generating a config for this build piece.")]
		public bool NoConfig;
	}
	[PublicAPI]
	public class BuildingPieceCategory
	{
		public BuildPieceCategory Category;

		public string custom = "";

		public void Set(BuildPieceCategory category)
		{
			Category = category;
		}

		public void Set(string customCategory)
		{
			Category = BuildPieceCategory.Custom;
			custom = customCategory;
		}
	}
	[PublicAPI]
	public class PieceTool
	{
		public readonly HashSet<string> Tools = new HashSet<string>();

		public void Add(string tool)
		{
			Tools.Add(tool);
		}
	}
	[PublicAPI]
	public class BuildPiece
	{
		internal class PieceConfig
		{
			public ConfigEntry<string> craft = null;

			public ConfigEntry<BuildPieceCategory> category = null;

			public ConfigEntry<string> customCategory = null;

			public ConfigEntry<UsageTagFlags> usage = null;

			public ConfigEntry<string> tools = null;

			public ConfigEntry<CraftingTable> extensionTable = null;

			public ConfigEntry<string> customExtentionTable = null;

			public ConfigEntry<float> maxStationDistance = null;

			public ConfigEntry<CraftingTable> table = null;

			public ConfigEntry<string> customTable = null;

			public ConfigEntry<float> health = null;

			public ConfigEntry<bool> supports = null;

			public ConfigEntry<MaterialType> material = null;
		}

		private class ConfigurationManagerAttributes
		{
			[UsedImplicitly]
			public int? Order;

			[UsedImplicitly]
			public bool? Browsable;

			[UsedImplicitly]
			public string? Category;

			[UsedImplicitly]
			public Action<ConfigEntryBase>? CustomDrawer;
		}

		private class SerializedRequirements
		{
			public readonly List<Requirement> Reqs;

			public SerializedRequirements(List<Requirement> reqs)
			{
				Reqs = reqs;
			}

			public SerializedRequirements(string reqs)
			{
				Reqs = reqs.Split(new char[1] { ',' }).Select(delegate(string r)
				{
					string[] array = r.Split(new char[1] { ':' });
					int result;
					bool result2 = default(bool);
					return new Requirement
					{
						itemName = array[0],
						amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result),
						recover = (array.Length <= 2 || !bool.TryParse(array[2], out result2) || result2)
					};
				}).ToList();
			}

			public override string ToString()
			{
				return string.Join(",", Reqs.Select((Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}"));
			}

			public static ItemDrop? fetchByName(ObjectDB objectDB, string name)
			{
				GameObject itemPrefab = objectDB.GetItemPrefab(name);
				ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)(((!string.IsNullOrWhiteSpace(((Object)plugin).name)) ? ("[" + ((Object)plugin).name + "]") : "") + " The required item '" + name + "' does not exist."));
				}
				return val;
			}

			public static Requirement[] toPieceReqs(SerializedRequirements craft)
			{
				Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>