Decompiled source of RavenwoodRome v1.0.0
plugins/RavenwoodRome/RavenwoodRome.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; 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.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using RavenwoodRome.Managers; using RavenwoodRome.Solution; using RustyBuildPieces.Managers; using ServerSync; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [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: AssemblyProduct("RavenwoodRome")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyCompany("JamesJonesTV")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<be9f1c2f-a7a7-43ba-ab9c-3d8041960d74>Embedded] internal sealed class <be9f1c2f-a7a7-43ba-ab9c-3d8041960d74>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<be9f1c2f-a7a7-43ba-ab9c-3d8041960d74>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <e08014dc-49be-410b-9722-caad0ff6c683>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <e08014dc-49be-410b-9722-caad0ff6c683>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <e08014dc-49be-410b-9722-caad0ff6c683>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<be9f1c2f-a7a7-43ba-ab9c-3d8041960d74>Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContextAttribute : Attribute { public readonly byte Flag; public <9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RavenwoodRome { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [BepInPlugin("JamesJonesTV.RavenwoodRome", "RavenwoodRome", "1.0.0")] public class RavenwoodRomePlugin : BaseUnityPlugin { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] public enum Toggle { On = 1, Off = 0 } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] [UsedImplicitly] public string Category; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer; } internal const string ModName = "RavenwoodRome"; internal const string ModVersion = "1.0.0"; 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; private readonly Harmony _harmony = new Harmony("JamesJonesTV.RavenwoodRome"); public static readonly ManualLogSource RavenwoodRomeLogger; private static readonly ConfigSync ConfigSync; private static ConfigEntry<Toggle> _serverConfigLocked; private void InitConfigs() { _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); } public void Awake() { InitConfigs(); Localizer.Load(); Load.Setup(); 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<[<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] 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<[<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] 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.0", MinimumRequiredVersion = "1.0.0" }; _serverConfigLocked = null; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] 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.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.0.0"); peer.m_rpc.Invoke("RavenwoodRome_VersionCheck", new object[1] { val }); } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] 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 { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] 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 { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] 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); } } } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] 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.0, remote: " + text)); if (text != "1.0.0") { RavenwoodRomePlugin.ConnectionError = "RavenwoodRome Installed: 1.0.0\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); } } public static string ComputeHashForMod() { using SHA256 sHA = SHA256.Create(); byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location)); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("X2")); } return stringBuilder.ToString(); } } } namespace RavenwoodRome.Solution { [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] public static class Load { [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] private class PieceData { [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] public class Recipe { public readonly string Prefab; public readonly int Amount; public Recipe(string prefab, int amount) { Prefab = prefab; Amount = amount; } } public readonly string PrefabName; public readonly string Name; public readonly string Description; public readonly List<Recipe> RequiredItems; public PieceData(string prefab, string name, List<Recipe> requiredItems, string description = "") { PrefabName = prefab; Name = name; Description = description; RequiredItems = requiredItems; } } private static readonly List<PieceData> m_buildings = new List<PieceData> { new PieceData("Amphitheatre_JJ", "Amphitheatre", new List<PieceData.Recipe> { new PieceData.Recipe("Coins", 4000), new PieceData.Recipe("Stone", 1000), new PieceData.Recipe("BronzeNails", 500) }), new PieceData("Arch_JJ", "Victory Arch", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Building_1_JJ", "Roman Building 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Building_2_JJ", "Roman Building 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Building_3_JJ", "Roman Building 3", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("House_1_JJ", "Roman House 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 80), new PieceData.Recipe("Stone", 80), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("House_2_JJ", "Roman House 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 100), new PieceData.Recipe("Stone", 100), new PieceData.Recipe("RoundLog", 50), new PieceData.Recipe("BronzeNails", 25) }), new PieceData("Senate_JJ", "Senate", new List<PieceData.Recipe> { new PieceData.Recipe("Coins", 1500), new PieceData.Recipe("Stone", 500), new PieceData.Recipe("FineWood", 500), new PieceData.Recipe("BronzeNails", 250) }), new PieceData("Temple_1_JJ", "Roman Temple 1", new List<PieceData.Recipe> { new PieceData.Recipe("Coins", 500), new PieceData.Recipe("Stone", 250), new PieceData.Recipe("FineWood", 250), new PieceData.Recipe("BronzeNails", 125) }), new PieceData("Temple_2_JJ", "Roman Temple 2", new List<PieceData.Recipe> { new PieceData.Recipe("Coins", 1000), new PieceData.Recipe("Stone", 400), new PieceData.Recipe("FineWood", 400), new PieceData.Recipe("BronzeNails", 200) }), new PieceData("Tower_1_JJ", "Roman Tower 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Tower_2_JJ", "Roman Tower 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_3_JJ", "Roman Tower 3", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_4_JJ", "Roman Tower 4", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_5_JJ", "Roman Tower 5", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }) }; private static readonly List<PieceData> AltBuilds = new List<PieceData> { new PieceData("Building_1_JJ", "Roman Building 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Building_2_JJ", "Roman Building 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Building_3_JJ", "Roman Building 3", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("House_1_JJ", "Roman House 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 80), new PieceData.Recipe("Stone", 80), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("House_2_JJ", "Roman House 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 100), new PieceData.Recipe("Stone", 100), new PieceData.Recipe("RoundLog", 50), new PieceData.Recipe("BronzeNails", 25) }), new PieceData("Tower_1_JJ", "Roman Tower 1", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 40), new PieceData.Recipe("BronzeNails", 20) }), new PieceData("Tower_2_JJ", "Roman Tower 2", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_3_JJ", "Roman Tower 3", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_4_JJ", "Roman Tower 4", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }), new PieceData("Tower_5_JJ", "Roman Tower 5", new List<PieceData.Recipe> { new PieceData.Recipe("FineWood", 200), new PieceData.Recipe("Stone", 200), new PieceData.Recipe("RoundLog", 100), new PieceData.Recipe("BronzeNails", 50) }) }; public static void Setup() { LoadBuildings(); LoadStatues(); LoadBanners(); LoadPillars(); LoadPedestals(); LoadStairs(); LoadFloors(); LoadDoors(); LoadWalls(); LoadProps(); LoadRailings(); LoadShields(); LoadTrees(); LoadCandles(); LoadTents(); LoadFires(); } private static void LoadFires() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Fire_1"); buildPiece.Name.English("Roman Fireplace"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("FineWood", 10, recover: true); buildPiece.RequiredItems.Add("Bronze", 2, recover: true); buildPiece.RequiredItems.Add("Coal", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece.PlaceEffects.Add("sfx_build_hammer_wood"); buildPiece.Prefab.AddComponent<ToggleLight>(); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Fire_2"); buildPiece2.Name.English("Roman Pole Lantern"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.RequiredItems.Add("Bronze", 2, recover: true); buildPiece2.RequiredItems.Add("Coal", 10, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_wood"); buildPiece2.Prefab.AddComponent<ToggleLight>(); } private static void LoadTents() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Tent_1"); buildPiece.Name.English("Roman Tent 1"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("FineWood", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.VegetationShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Tent_2"); buildPiece2.Name.English("Roman Tent 2"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.VegetationShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Tent_3"); buildPiece3.Name.English("Roman Tent 3"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("FineWood", 10, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.VegetationShader); BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Tent_4"); buildPiece4.Name.English("Roman Tent 4"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("FineWood", 10, recover: true); buildPiece4.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece4.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.VegetationShader); } private static void LoadCandles() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Candle_1"); buildPiece.Name.English("Roman Candle 1"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Honey", 10, recover: true); buildPiece.PlaceEffects.Add("sfx_build_hammer_wood"); buildPiece.Prefab.AddComponent<ToggleLight>(); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Candle_2"); buildPiece2.Name.English("Roman Candle 2"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Honey", 10, recover: true); buildPiece2.PlaceEffects.Add("sfx_build_hammer_wood"); buildPiece2.Prefab.AddComponent<ToggleLight>(); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Candle_3"); buildPiece3.Name.English("Roman Candle 3"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("Honey", 10, recover: true); buildPiece3.PlaceEffects.Add("sfx_build_hammer_wood"); buildPiece3.Prefab.AddComponent<ToggleLight>(); } private static void LoadTrees() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Tree_1"); buildPiece.Name.English("Roman Tree 1"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.None); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("FineWood", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Tree_2"); buildPiece2.Name.English("Roman Tree 2"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.None); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Tree_3"); buildPiece3.Name.English("Roman Tree 3"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.None); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("FineWood", 10, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadShields() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Shield_1"); buildPiece.Name.English("Roman Square Shield"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Forge); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("FineWood", 10, recover: true); buildPiece.RequiredItems.Add("Bronze", 2, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Shield_2"); buildPiece2.Name.English("Roman Round Shield"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Forge); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.RequiredItems.Add("Bronze", 2, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadProps() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Prop_1"); buildPiece.Name.English("Roman Pole"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("FineWood", 10, recover: true); buildPiece.RequiredItems.Add("Bronze", 2, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Bed_1"); buildPiece2.Name.English("Roman Bed"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("FineWood", 10, recover: true); buildPiece2.RequiredItems.Add("Bronze", 2, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Chair_1"); buildPiece3.Name.English("Roman Chair"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("FineWood", 10, recover: true); buildPiece3.RequiredItems.Add("Bronze", 2, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Table_1"); buildPiece4.Name.English("Roman Desk"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("FineWood", 10, recover: true); buildPiece4.RequiredItems.Add("Bronze", 2, recover: true); buildPiece4.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece4.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece5 = new BuildPiece("romebundle", "JJ_Cupboard_1"); buildPiece5.Name.English("Roman Cupboard"); buildPiece5.Description.English(""); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("Ravenwood Rome"); buildPiece5.RequiredItems.Add("FineWood", 10, recover: true); buildPiece5.RequiredItems.Add("Bronze", 2, recover: true); buildPiece5.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece5.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece6 = new BuildPiece("romebundle", "JJ_Prop_2"); buildPiece6.Name.English("Roman Hanging Cloth 1"); buildPiece6.Description.English(""); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("Ravenwood Rome"); buildPiece6.RequiredItems.Add("FineWood", 10, recover: true); buildPiece6.RequiredItems.Add("Bronze", 2, recover: true); buildPiece6.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece6.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece6.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece7 = new BuildPiece("romebundle", "JJ_Prop_3"); buildPiece7.Name.English("Roman Hanging Fruit"); buildPiece7.Description.English(""); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("Ravenwood Rome"); buildPiece7.RequiredItems.Add("FineWood", 10, recover: true); buildPiece7.RequiredItems.Add("Bronze", 2, recover: true); buildPiece7.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece7.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece7.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece8 = new BuildPiece("romebundle", "JJ_Prop_4"); buildPiece8.Name.English("Roman Pottery Stand"); buildPiece8.Description.English(""); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("Ravenwood Rome"); buildPiece8.RequiredItems.Add("FineWood", 10, recover: true); buildPiece8.RequiredItems.Add("Bronze", 2, recover: true); buildPiece8.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece8.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece8.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece9 = new BuildPiece("romebundle", "JJ_Prop_5"); buildPiece9.Name.English("Roman Shield Stand 1"); buildPiece9.Description.English(""); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("Ravenwood Rome"); buildPiece9.RequiredItems.Add("FineWood", 10, recover: true); buildPiece9.RequiredItems.Add("Bronze", 2, recover: true); buildPiece9.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece9.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece9.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece10 = new BuildPiece("romebundle", "JJ_Prop_6"); buildPiece10.Name.English("Roman Cloth Stand"); buildPiece10.Description.English(""); buildPiece10.Crafting.Set(CraftingTable.Workbench); buildPiece10.Category.Set("Ravenwood Rome"); buildPiece10.RequiredItems.Add("FineWood", 10, recover: true); buildPiece10.RequiredItems.Add("Bronze", 2, recover: true); buildPiece10.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece10.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece10.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece11 = new BuildPiece("romebundle", "JJ_Prop_7"); buildPiece11.Name.English("Roman Shield Stand 2"); buildPiece11.Description.English(""); buildPiece11.Crafting.Set(CraftingTable.Workbench); buildPiece11.Category.Set("Ravenwood Rome"); buildPiece11.RequiredItems.Add("FineWood", 10, recover: true); buildPiece11.RequiredItems.Add("Bronze", 2, recover: true); buildPiece11.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece11.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece11.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece12 = new BuildPiece("romebundle", "JJ_Prop_8"); buildPiece12.Name.English("Roman Hanging Cloth 2"); buildPiece12.Description.English(""); buildPiece12.Crafting.Set(CraftingTable.Workbench); buildPiece12.Category.Set("Ravenwood Rome"); buildPiece12.RequiredItems.Add("FineWood", 10, recover: true); buildPiece12.RequiredItems.Add("Bronze", 2, recover: true); buildPiece12.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece12.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece12.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece13 = new BuildPiece("romebundle", "JJ_Prop_9"); buildPiece13.Name.English("Roman Hanging Cloth 3"); buildPiece13.Description.English(""); buildPiece13.Crafting.Set(CraftingTable.Workbench); buildPiece13.Category.Set("Ravenwood Rome"); buildPiece13.RequiredItems.Add("FineWood", 10, recover: true); buildPiece13.RequiredItems.Add("Bronze", 2, recover: true); buildPiece13.PlaceEffects.Add("vfx_Place_wood_pole"); buildPiece13.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece13.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadWalls() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Wall_1"); buildPiece.Name.English("White Roman Wall"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 50, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Wall_2"); buildPiece2.Name.English("Beige Roman Wall"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.StoneCutter); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Stone", 50, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Wall_3"); buildPiece3.Name.English("Large White Stone Wall"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.StoneCutter); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("Stone", 200, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Wall_4"); buildPiece4.Name.English("Small Interior Wall"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.StoneCutter); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("Stone", 25, recover: true); buildPiece4.RequiredItems.Add("FineWood", 5, recover: true); buildPiece4.RequiredItems.Add("Coins", 5, recover: true); buildPiece4.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece4.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece5 = new BuildPiece("romebundle", "JJ_Wall_5"); buildPiece5.Name.English("Large Interior Wall"); buildPiece5.Description.English(""); buildPiece5.Crafting.Set(CraftingTable.StoneCutter); buildPiece5.Category.Set("Ravenwood Rome"); buildPiece5.RequiredItems.Add("Stone", 100, recover: true); buildPiece5.RequiredItems.Add("FineWood", 20, recover: true); buildPiece5.RequiredItems.Add("Coins", 20, recover: true); buildPiece5.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece5.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece6 = new BuildPiece("romebundle", "JJ_Wall_6"); buildPiece6.Name.English("White Stone Wall"); buildPiece6.Description.English(""); buildPiece6.Crafting.Set(CraftingTable.StoneCutter); buildPiece6.Category.Set("Ravenwood Rome"); buildPiece6.RequiredItems.Add("Stone", 50, recover: true); buildPiece6.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece6.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece6.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece7 = new BuildPiece("romebundle", "JJ_Wall_7"); buildPiece7.Name.English("Grey Roman Wall"); buildPiece7.Description.English(""); buildPiece7.Crafting.Set(CraftingTable.StoneCutter); buildPiece7.Category.Set("Ravenwood Rome"); buildPiece7.RequiredItems.Add("Stone", 50, recover: true); buildPiece7.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece7.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece7.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece8 = new BuildPiece("romebundle", "JJ_Wall_8"); buildPiece8.Name.English("Grey Stone Wall"); buildPiece8.Description.English(""); buildPiece8.Crafting.Set(CraftingTable.StoneCutter); buildPiece8.Category.Set("Ravenwood Rome"); buildPiece8.RequiredItems.Add("Stone", 10, recover: true); buildPiece8.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece8.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece8.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece9 = new BuildPiece("romebundle", "JJ_Wall_9"); buildPiece9.Name.English("Large Grey Stone Wall"); buildPiece9.Description.English(""); buildPiece9.Crafting.Set(CraftingTable.StoneCutter); buildPiece9.Category.Set("Ravenwood Rome"); buildPiece9.RequiredItems.Add("Stone", 10, recover: true); buildPiece9.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece9.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece9.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadRailings() { for (int i = 1; i < 3; i++) { BuildPiece buildPiece = new BuildPiece("romebundle", $"JJ_Rail_{i}"); buildPiece.Name.English($"Fence {i}"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); } } private static void LoadDoors() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Door_1"); buildPiece.Name.English("Stone Gate Left"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 10, recover: true); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Door_2"); buildPiece2.Name.English("Wood Gate Left"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Stone", 10, recover: true); buildPiece2.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece2.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Door_3"); buildPiece3.Name.English("Large Door Right"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("Stone", 10, recover: true); buildPiece3.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece3.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Door_4"); buildPiece4.Name.English("Small Door Right"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("Stone", 10, recover: true); buildPiece4.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece4.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece5 = new BuildPiece("romebundle", "JJ_Door_5"); buildPiece5.Name.English("Stone Fence Door"); buildPiece5.Description.English(""); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("Ravenwood Rome"); buildPiece5.RequiredItems.Add("Stone", 10, recover: true); buildPiece5.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece5.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece6 = new BuildPiece("romebundle", "JJ_Door_6"); buildPiece6.Name.English("Stone Gate Right"); buildPiece6.Description.English(""); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("Ravenwood Rome"); buildPiece6.RequiredItems.Add("Stone", 10, recover: true); buildPiece6.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece6.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece6.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece7 = new BuildPiece("romebundle", "JJ_Door_7"); buildPiece7.Name.English("Wood Gate Right"); buildPiece7.Description.English(""); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("Ravenwood Rome"); buildPiece7.RequiredItems.Add("Stone", 10, recover: true); buildPiece7.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece7.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece7.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece8 = new BuildPiece("romebundle", "JJ_Door_8"); buildPiece8.Name.English("Large Door Left"); buildPiece8.Description.English(""); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("Ravenwood Rome"); buildPiece8.RequiredItems.Add("Wood", 10, recover: true); buildPiece8.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece8.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece8.CloneDoorEffectsFrom = "darkwood_gate"; BuildPiece buildPiece9 = new BuildPiece("romebundle", "JJ_Door_9"); buildPiece9.Name.English("Small Door Left"); buildPiece9.Description.English(""); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("Ravenwood Rome"); buildPiece9.RequiredItems.Add("Wood", 10, recover: true); buildPiece9.PlaceEffects.Add("sfx_build_hammer_wood"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece9.Prefab, MaterialReplacer.ShaderType.PieceShader); buildPiece9.CloneDoorEffectsFrom = "darkwood_gate"; } private static void LoadFloors() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Road"); buildPiece.Name.English("Sidewalk"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Road_2"); buildPiece2.Name.English("Gray Sidewalk"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.StoneCutter); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Stone", 10, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadStairs() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Stair_1"); buildPiece.Name.English("Stair 1"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 50, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Stair_2"); buildPiece2.Name.English("Stair 2"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.StoneCutter); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Stone", 50, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Stair_3"); buildPiece3.Name.English("Stair 3"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.StoneCutter); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("Stone", 50, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Stair_4"); buildPiece4.Name.English("Stair 4"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.StoneCutter); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("Stone", 50, recover: true); buildPiece4.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece4.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece5 = new BuildPiece("romebundle", "JJ_Stair_5"); buildPiece5.Name.English("Stair 5"); buildPiece5.Description.English(""); buildPiece5.Crafting.Set(CraftingTable.StoneCutter); buildPiece5.Category.Set("Ravenwood Rome"); buildPiece5.RequiredItems.Add("Stone", 50, recover: true); buildPiece5.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece5.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader); } private static void LoadPedestals() { for (int i = 1; i < 3; i++) { BuildPiece buildPiece = new BuildPiece("romebundle", $"JJ_Pedestal_{i}"); buildPiece.Name.English($"Pedestal {i}"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); } } private static void LoadPillars() { for (int i = 1; i < 10; i++) { BuildPiece buildPiece = new BuildPiece("romebundle", $"JJ_Pillar_{i}"); buildPiece.Name.English($"Pillar {i}"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 20, recover: true); buildPiece.PlaceEffects.Add("sfx_build_hammer_metal"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); } } private static void LoadBanners() { for (int i = 1; i < 7; i++) { BuildPiece buildPiece = new BuildPiece("romebundle", $"JJ_Banner_{i}"); buildPiece.Name.English($"Banner {i}"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Tin", 1, recover: true); buildPiece.RequiredItems.Add("Wood", 10, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.CustomCreature); } } private static void LoadBuildings() { foreach (PieceData building in m_buildings) { BuildPiece buildPiece = new BuildPiece("romebundle", building.PrefabName); buildPiece.Name.English(building.Name); buildPiece.Description.English(building.Description); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); foreach (PieceData.Recipe requiredItem in building.RequiredItems) { buildPiece.RequiredItems.Add(requiredItem.Prefab, requiredItem.Amount, recover: true); } buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); } foreach (PieceData altBuild in AltBuilds) { BuildPiece buildPiece2 = new BuildPiece("romebundle", altBuild.PrefabName + "_alt"); buildPiece2.Name.English(altBuild.Name); buildPiece2.Description.English(altBuild.Description); buildPiece2.Crafting.Set(CraftingTable.StoneCutter); buildPiece2.Category.Set("Ravenwood Rome"); foreach (PieceData.Recipe requiredItem2 in altBuild.RequiredItems) { buildPiece2.RequiredItems.Add(requiredItem2.Prefab, requiredItem2.Amount, recover: true); } buildPiece2.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); } } private static void LoadStatues() { BuildPiece buildPiece = new BuildPiece("romebundle", "JJ_Statue_1"); buildPiece.Name.English("Athena"); buildPiece.Description.English(""); buildPiece.Crafting.Set(CraftingTable.StoneCutter); buildPiece.Category.Set("Ravenwood Rome"); buildPiece.RequiredItems.Add("Stone", 20, recover: true); buildPiece.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece2 = new BuildPiece("romebundle", "JJ_Statue_2"); buildPiece2.Name.English("Augustus"); buildPiece2.Description.English(""); buildPiece2.Crafting.Set(CraftingTable.StoneCutter); buildPiece2.Category.Set("Ravenwood Rome"); buildPiece2.RequiredItems.Add("Stone", 20, recover: true); buildPiece2.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece2.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece3 = new BuildPiece("romebundle", "JJ_Statue_3"); buildPiece3.Name.English("Roman General"); buildPiece3.Description.English(""); buildPiece3.Crafting.Set(CraftingTable.StoneCutter); buildPiece3.Category.Set("Ravenwood Rome"); buildPiece3.RequiredItems.Add("Stone", 20, recover: true); buildPiece3.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece3.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece4 = new BuildPiece("romebundle", "JJ_Statue_4"); buildPiece4.Name.English("Roman Goddess"); buildPiece4.Description.English(""); buildPiece4.Crafting.Set(CraftingTable.StoneCutter); buildPiece4.Category.Set("Ravenwood Rome"); buildPiece4.RequiredItems.Add("Stone", 20, recover: true); buildPiece4.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece4.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece5 = new BuildPiece("romebundle", "JJ_Statue_5"); buildPiece5.Name.English("Roman Man"); buildPiece5.Description.English(""); buildPiece5.Crafting.Set(CraftingTable.StoneCutter); buildPiece5.Category.Set("Ravenwood Rome"); buildPiece5.RequiredItems.Add("Stone", 20, recover: true); buildPiece5.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece5.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece6 = new BuildPiece("romebundle", "JJ_Statue_6"); buildPiece6.Name.English("Midathrias"); buildPiece6.Description.English(""); buildPiece6.Crafting.Set(CraftingTable.StoneCutter); buildPiece6.Category.Set("Ravenwood Rome"); buildPiece6.RequiredItems.Add("Stone", 20, recover: true); buildPiece6.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece6.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece6.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece7 = new BuildPiece("romebundle", "JJ_Statue_7"); buildPiece7.Name.English("Putti 1"); buildPiece7.Description.English(""); buildPiece7.Crafting.Set(CraftingTable.StoneCutter); buildPiece7.Category.Set("Ravenwood Rome"); buildPiece7.RequiredItems.Add("Stone", 10, recover: true); buildPiece7.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece7.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece7.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece8 = new BuildPiece("romebundle", "JJ_Statue_8"); buildPiece8.Name.English("Putti 2"); buildPiece8.Description.English(""); buildPiece8.Crafting.Set(CraftingTable.StoneCutter); buildPiece8.Category.Set("Ravenwood Rome"); buildPiece8.RequiredItems.Add("Stone", 10, recover: true); buildPiece8.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece8.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece8.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece9 = new BuildPiece("romebundle", "JJ_Statue_9"); buildPiece9.Name.English("Putti 3"); buildPiece9.Description.English(""); buildPiece9.Crafting.Set(CraftingTable.StoneCutter); buildPiece9.Category.Set("Ravenwood Rome"); buildPiece9.RequiredItems.Add("Stone", 10, recover: true); buildPiece9.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece9.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece9.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece10 = new BuildPiece("romebundle", "JJ_Statue_10"); buildPiece10.Name.English("Putti 4"); buildPiece10.Description.English(""); buildPiece10.Crafting.Set(CraftingTable.StoneCutter); buildPiece10.Category.Set("Ravenwood Rome"); buildPiece10.RequiredItems.Add("Stone", 10, recover: true); buildPiece10.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece10.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece10.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece11 = new BuildPiece("romebundle", "JJ_Statue_11"); buildPiece11.Name.English("Putti 5"); buildPiece11.Description.English(""); buildPiece11.Crafting.Set(CraftingTable.StoneCutter); buildPiece11.Category.Set("Ravenwood Rome"); buildPiece11.RequiredItems.Add("Stone", 10, recover: true); buildPiece11.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece11.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece11.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece12 = new BuildPiece("romebundle", "JJ_Statue_12"); buildPiece12.Name.English("Roman Soldier"); buildPiece12.Description.English(""); buildPiece12.Crafting.Set(CraftingTable.StoneCutter); buildPiece12.Category.Set("Ravenwood Rome"); buildPiece12.RequiredItems.Add("Stone", 10, recover: true); buildPiece12.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece12.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece12.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece13 = new BuildPiece("romebundle", "JJ_Statue_13"); buildPiece13.Name.English("Roman Woman"); buildPiece13.Description.English(""); buildPiece13.Crafting.Set(CraftingTable.StoneCutter); buildPiece13.Category.Set("Ravenwood Rome"); buildPiece13.RequiredItems.Add("Stone", 10, recover: true); buildPiece13.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece13.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece13.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece14 = new BuildPiece("romebundle", "JJ_Statue_14"); buildPiece14.Name.English("Roman Goddess Large"); buildPiece14.Description.English(""); buildPiece14.Crafting.Set(CraftingTable.StoneCutter); buildPiece14.Category.Set("Ravenwood Rome"); buildPiece14.RequiredItems.Add("Stone", 50, recover: true); buildPiece14.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece14.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece14.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece15 = new BuildPiece("romebundle", "JJ_Statue_15"); buildPiece15.Name.English("Roman Soldier Large"); buildPiece15.Description.English(""); buildPiece15.Crafting.Set(CraftingTable.StoneCutter); buildPiece15.Category.Set("Ravenwood Rome"); buildPiece15.RequiredItems.Add("Stone", 50, recover: true); buildPiece15.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece15.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece15.Prefab, MaterialReplacer.ShaderType.PieceShader); BuildPiece buildPiece16 = new BuildPiece("romebundle", "JJ_Statue_16"); buildPiece16.Name.English("Roman General Large"); buildPiece16.Description.English(""); buildPiece16.Crafting.Set(CraftingTable.StoneCutter); buildPiece16.Category.Set("Ravenwood Rome"); buildPiece16.RequiredItems.Add("Stone", 50, recover: true); buildPiece16.PlaceEffects.Add("vfx_Place_stone_wall_2x1"); buildPiece16.PlaceEffects.Add("sfx_build_hammer_stone"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece16.Prefab, MaterialReplacer.ShaderType.PieceShader); } } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] public class ToggleLight : MonoBehaviour, Interactable, Hoverable { public ZNetView m_nview = null; private readonly string m_enabledKey = "RustyEnabled"; public List<GameObject> m_objectsToEnable = new List<GameObject>(); public void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown m_nview = ((Component)this).GetComponent<ZNetView>(); if (!m_nview.IsValid()) { return; } foreach (Transform item in ((Component)this).transform) { Transform val = item; if (!((Component)val).gameObject.activeInHierarchy) { m_objectsToEnable.Add(((Component)val).gameObject); } } m_nview.Register<bool>("RPC_Enable", (Action<long, bool>)RPC_Enable); SetEnable(m_nview.GetZDO().GetBool(m_enabledKey, false)); } private void SetEnable(bool enable) { foreach (GameObject item in m_objectsToEnable) { item.SetActive(enable); } } private void RPC_Enable(long sender, bool enable) { m_nview.GetZDO().Set(m_enabledKey, enable); SetEnable(enable); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold || alt) { return false; } if (!m_nview.IsValid()) { return false; } m_nview.InvokeRPC("RPC_Enable", new object[1] { !m_nview.GetZDO().GetBool(m_enabledKey, false) }); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } public string GetHoverText() { if (!m_nview.IsValid()) { return ""; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("[<color=yellow>$KEY_Use</color>] {0}", m_nview.GetZDO().GetBool(m_enabledKey, false) ? "$hover_off" : "$hover_on"); return Localization.instance.Localize(stringBuilder.ToString()); } public string GetHoverName() { return ""; } } } namespace RavenwoodRome.Managers { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [PublicAPI] public static class MaterialReplacer { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader } 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; static MaterialReplacer() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown CachedShaders = new HashSet<Shader>(); hasRun = false; 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 (!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); } 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([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Material material) => ReplaceMaterial(material, isJotunnMock)).ToArray(); val.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { 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 var 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("_ValueNoise")) { val2.SetFloat("_ValueNoise", 0f); } } } } } private 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.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, Custom } [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] 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; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] public string custom; } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [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; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] public string custom; } [PublicAPI] public enum BuildPieceCategory { Misc = 0, Crafting = 1, BuildingWorkbench = 2, BuildingStonecutter = 3, Furniture = 4, All = 100, Custom = 99 } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [PublicAPI] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] 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 { [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(1)] 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; } [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [PublicAPI] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] 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; } } [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] [PublicAPI] public class PieceTool { public readonly HashSet<string> Tools = new HashSet<string>(); public void Add(string tool) { Tools.Add(tool); } } [PublicAPI] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(1)] public class BuildPiece { [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] internal class PieceConfig { public ConfigEntry<string> craft = null; public ConfigEntry<BuildPieceCategory> category = null; public ConfigEntry<string> customCategory = 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; } [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] public string Category; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer; } [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(0)] 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([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (string r) => { string[] array = r.Split(new char[1] { ':' }); Requirement result = default(Requirement); result.itemName = array[0]; result.amount = ((array.Length <= 1 || !int.TryParse(array[1], out var result2)) ? 1 : result2); bool result3 = default(bool); result.recover = array.Length <= 2 || !bool.TryParse(array[2], out result3) || result3; return result; }).ToList(); } public override string ToString() { return string.Join(",", Reqs.Select([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}")); } [return: <e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] 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>)([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Requirement r) => { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDrop val = ResItem(r); return (val == null) ? ((Requirement)null) : new Requirement { m_amount = r.amount, m_resItem = val, m_recover = r.recover }; })); return dictionary.Values.Where([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Requirement v) => v != null).ToArray(); [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(2)] static ItemDrop ResItem(Requirement r) { return fetchByName(ObjectDB.instance, r.itemName); } } } public List<string> PlaceEffects = new List<string>(); public List<string> HitEffects = new List<string>(); public List<string> DestroyedEffects = new List<string>(); public List<string> SwitchEffects = new List<string>(); public List<string> RandomSpeakEffects = new List<string>(); public string CloneDoorEffectsFrom = ""; internal static readonly List<BuildPiece> registeredPieces = new List<BuildPiece>(); private static readonly Dictionary<Piece, BuildPiece> pieceMap = new Dictionary<Piece, BuildPiece>(); internal static Dictionary<BuildPiece, PieceConfig> pieceConfigs = new Dictionary<BuildPiece, PieceConfig>(); internal List<Conversion> Conversions = new List<Conversion>(); internal List<ItemConversion> conversions = new List<ItemConversion>(); [Description("Disables generation of the configs for your pieces. This is global, this turns it off for all pieces in your mod.")] public static bool ConfigurationEnabled = true; public readonly GameObject Prefab; [Description("Specifies the resources needed to craft the piece.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the building piece should need.")] public readonly RequiredResourcesList RequiredItems = new RequiredResourcesList(); [Description("Sets the category for the building piece.")] public readonly BuildingPieceCategory Category = new BuildingPieceCategory(); [Description("Specifies the tool needed to build your piece.\nUse .Add to add a tool.")] public readonly PieceTool Tool = new PieceTool(); [Description("Specifies the crafting station needed to build your piece.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.")] public CraftingStationList Crafting = new CraftingStationList(); [Description("Makes this piece a station extension")] public ExtensionList Extension = new ExtensionList(); [Description("Change the extended/special properties of your build piece.")] public SpecialProperties SpecialProperties; [Description("Specifies a config entry which toggles whether a recipe is active.")] [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] public ConfigEntryBase RecipeIsActive = null; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private LocalizeKey _name; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private LocalizeKey _description; internal string[] activeTools = null; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private static object configManager; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private static Localization _english; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] internal static BaseUnityPlugin _plugin = null; private static bool hasConfigSync = true; [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private static object _configSync; public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_name.StartsWith("$")) { _name = new LocalizeKey(component.m_name); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(component.m_name); component.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_description.StartsWith("$")) { _description = new LocalizeKey(component.m_description); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_") + "_description"; _description = new LocalizeKey(text).English(component.m_description); component.m_description = text; } return _description; } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); internal static BaseUnityPlugin plugin { get { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (_plugin != null) { return _plugin; } IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); return _plugin; } } [<e08014dc-49be-410b-9722-caad0ff6c683>Nullable(2)] private static object configSync { [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(2)] get { if (_configSync != null || !hasConfigSync) { return _configSync; } Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " PieceManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } return _configSync; } } public BuildPiece(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PiecePrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public BuildPiece(AssetBundle bundle, string prefabName) { Prefab = PiecePrefabManager.RegisterPrefab(bundle, prefabName); registeredPieces.Add(this); } internal static void Patch_FejdStartup(FejdStartup __instance) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Expected O, but got Unknown //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Expected O, but got Unknown //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Expected O, but got Unknown //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Expected O, but got Unknown //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Expected O, but got Unknown Type configManagerType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((configManagerType == null) ? null : Chainloader.ManagerObject.GetComponent(configManagerType)); foreach (BuildPiece registeredPiece in registeredPieces) { registeredPiece.activeTools = registeredPiece.Tool.Tools.DefaultIfEmpty("Hammer").ToArray(); if (registeredPiece.Category.Category != BuildPieceCategory.Custom) { registeredPiece.Prefab.GetComponent<Piece>().m_category = (PieceCategory)registeredPiece.Category.Category; } else { registeredPiece.Prefab.GetComponent<Piece>().m_category = PiecePrefabManager.GetCategory(registeredPiece.Category.custom); } } if (!ConfigurationEnabled) { return; } bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (BuildPiece registeredPiece2 in registeredPieces) { BuildPiece piece = registeredPiece2; if (piece.SpecialProperties.NoConfig) { continue; } PieceConfig pieceConfig2 = (pieceConfigs[piece] = new PieceConfig()); PieceConfig cfg = pieceConfig2; Piece piecePrefab2 = piece.Prefab.GetComponent<Piece>(); string pieceName = piecePrefab2.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(pieceName), "").Trim(); string localizedName = Localization.instance.Localize(pieceName).Trim(); int order = 0; cfg.category = config(englishName, "Build Table Category", piece.Category.Category, new ConfigDescription("Build Category where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = (cfg.category.Value == BuildPieceCategory.Custom), Category = localizedName }; cfg.customCategory = config(englishName, "Custom Build Category", piece.Category.custom, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.category.SettingChanged += BuildTableConfigChanged; cfg.customCategory.SettingChanged += BuildTableConfigChanged; if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab2.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab2.m_category = (PieceCategory)cfg.category.Value; } cfg.tools = config(englishName, "Tools", string.Join(", ", piece.activeTools), new ConfigDescription("Comma separated list of tools where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { customTableAttributes })); piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); cfg.tools.SettingChanged += [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (object _, EventArgs _) => { Inventory[] source = (from c in Player.s_players.Select([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType<Container>() select c.GetInventory()) where c != null select c).ToArray(); Dictionary<string, List<PieceTable>> dictionary = (from kv in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent<ItemDrop>() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent<ZNetView>()) select c).Concat(ItemDrop.s_instances) select new KeyValuePair<string, ItemData>(Utils.GetPrefabName(((Component)i).gameObject), i.m_itemData)).Concat(from i in source.SelectMany([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (Inventory i) => i.GetAllItems()) select new KeyValuePair<string, ItemData>(((Object)i.m_dropPrefab).name, i)) where Object.op_Implicit((Object)(object)kv.Value.m_shared.m_buildPieces) group kv by kv.Key).ToDictionary([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Key, [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Select([<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (KeyValuePair<string, ItemData> kv) => kv.Value.m_shared.m_buildPieces).Distinct().ToList()); string[] array5 = piece.activeTools; foreach (string key in array5) { if (dictionary.TryGetValue(key, out var value3)) { foreach (PieceTable item3 in value3) { item3.m_pieces.Remove(piece.Prefab); } } } piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { string[] array6 = piece.activeTools; foreach (string key2 in array6) { if (dictionary.TryGetValue(key2, out var value4)) { foreach (PieceTable item4 in value4) { if (!item4.m_pieces.Contains(piece.Prefab)) { item4.m_pieces.Add(piece.Prefab); } } } } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { ((Humanoid)Player.m_localPlayer).SetPlaceMode(Player.m_localPlayer.m_buildPieces); } } }; StationExtension pieceExtensionComp; List<ConfigurationManagerAttributes> hideWhenNoneAttributes2; if (piece.Extension.ExtensionStations.Count > 0) { pieceExtensionComp = piece.Prefab.GetOrAddComponent<StationExtension>(); PieceConfig pieceConfig3 = cfg; string group = englishName; CraftingTable table = piece.Extension.ExtensionStations.First().Table; string text = "Crafting station that " + localizedName + " extends."; object[] array = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes.Order = num; array[0] = configurationManagerAttributes; pieceConfig3.extensionTable = config(group, "Extends Station", table, new ConfigDescription(text, (AcceptableValueBase)null, array)); cfg.customExtentionTable = config(englishName, "Custom Extend Station", piece.Extension.ExtensionStations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); PieceConfig pieceConfig4 = cfg; string group2 = englishName; float maxStationDistance = piece.Extension.ExtensionStations.First().maxStationDistance; string text2 = "Distance from the station that " + localizedName + " can be placed."; object[] array2 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes2.Order = num; array2[0] = configurationManagerAttributes2; pieceConfig4.maxStationDistance = config(group2, "Max Station Distance", maxStationDistance, new ConfigDescription(text2, (AcceptableValueBase)null, array2)); hideWhenNoneAttributes2 = new List<ConfigurationManagerAttributes>(); cfg.extensionTable.SettingChanged += ExtensionTableConfigChanged; cfg.customExtentionTable.SettingChanged += ExtensionTableConfigChanged; cfg.maxStationDistance.SettingChanged += ExtensionTableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes3.Order = num; configurationManagerAttributes3.Browsable = cfg.extensionTable.Value != CraftingTable.None; ConfigurationManagerAttributes item = configurationManagerAttributes3; hideWhenNoneAttributes2.Add(item); } List<ConfigurationManagerAttributes> hideWhenNoneAttributes; if (piece.Crafting.Stations.Count > 0) { hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>(); PieceConfig pieceConfig5 = cfg; string group3 = englishName; CraftingTable table2 = piece.Crafting.Stations.First().Table; string text3 = "Crafting station where " + localizedName + " is available."; object[] array3 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes4 = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes4.Order = num; array3[0] = configurationManagerAttributes4; pieceConfig5.table = config(group3, "Crafting Station", table2, new ConfigDescription(text3, (AcceptableValueBase)null, array3)); cfg.customTable = config(englishName, "Custom Crafting Station", piece.Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes5 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes5.Order = num; configurationManagerAttributes5.Browsable = cfg.table.Value != CraftingTable.None; ConfigurationManagerAttributes item2 = configurationManagerAttributes5; hideWhenNoneAttributes.Add(item2); } cfg.craft = itemConfig("Crafting Costs", new SerializedRequirements(piece.RequiredItems.Requirements).ToString(), "Item costs to craft " + localizedName); cfg.craft.SettingChanged += [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (object _, EventArgs _) => { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab2.m_resources = resources; Piece[] array4 = Object.FindObjectsOfType<Piece>(); foreach (Piece val in array4) { if (val.m_name == pieceName) { val.m_resources = resources; } } } }; for (int j = 0; j < piece.Conversions.Count; j++) { string text4 = ((piece.Conversions.Count > 1) ? $"{j + 1}. " : ""); Conversion conversion = piece.Conversions[j]; conversion.config = new Conversion.ConversionConfig(); int index = j; conversion.config.input = config(englishName, text4 + "Conversion Input Item", conversion.Input, new ConfigDescription("Conversion input item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.input.SettingChanged += [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance2 = ObjectDB.instance; if (instance2 != null) { ItemDrop from = SerializedRequirements.fetchByName(instance2, conversion.config.input.Value); piece.conversions[index].m_from = from; } } }; conversion.config.output = config(englishName, text4 + "Conversion Output Item", conversion.Output, new ConfigDescription("Conversion output item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.output.SettingChanged += [<9f80df68-5a08-404f-860a-1bbfb0bd4b5a>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop to = SerializedRequirements.fetchByName(instance, conversion.config.output.Value); piece.conversions[index].m_to = to; } } }; } void BuildTableConfigChanged(object o, EventArgs e) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) if (registeredPieces.Count > 0) { if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab2.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab2.m_category = (PieceCategory)cfg.category.Value; } if (Object.op_Implicit((Object)(object)Hud.instance))