Decompiled source of ClayBuildPieces v1.2.3
ClayBuildPieces.dll
Decompiled 3 days 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.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ClayBuildPieces.Functions; using HarmonyLib; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using SoftReferenceableAssets; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("1.2.3")] [assembly: Guid("F9F89EF2-3A57-45D0-AA9B-331723E04513")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: CompilationRelaxations(8)] [assembly: AssemblyProduct("ClayBuildPieces")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("https://valheim.thunderstore.io/package/blacks7ar/ClayBuildPieces/")] [assembly: AssemblyTitle("ClayBuildPieces")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.3.0")] [module: UnverifiableCode] [module: <c864fc9d-af70-4770-8e26-4684bc5c89e1>RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [<fff0977d-3eaa-4672-a1ab-5bf403a14ff5>Embedded] [CompilerGenerated] internal sealed class <fff0977d-3eaa-4672-a1ab-5bf403a14ff5>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [<fff0977d-3eaa-4672-a1ab-5bf403a14ff5>Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class <c864fc9d-af70-4770-8e26-4684bc5c89e1>RefSafetyRulesAttribute : Attribute { public readonly int Version; public <c864fc9d-af70-4770-8e26-4684bc5c89e1>RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ClayBuildPieces { [BepInIncompatibility("blacks7ar.FineWoodPieces")] [BepInPlugin("blacks7ar.ClayBuildPieces", "ClayBuildPieces", "1.2.3")] public class Plugin : BaseUnityPlugin { private const string modGUID = "blacks7ar.ClayBuildPieces"; public const string modName = "ClayBuildPieces"; public const string modAuthor = "blacks7ar"; public const string modVersion = "1.2.3"; public const string modLink = "https://valheim.thunderstore.io/package/blacks7ar/ClayBuildPieces/"; private static readonly Harmony _harmony = new Harmony("blacks7ar.ClayBuildPieces"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.ClayBuildPieces") { DisplayName = "ClayBuildPieces", CurrentVersion = "1.2.3", MinimumRequiredVersion = "1.2.3" }; private static ConfigEntry<Toggle> _serverConfigLocked; public static ConfigEntry<Toggle> _enableClay; public static ConfigEntry<float> _clayGroupRadius; public static ConfigEntry<int> _clayGroupSizeMin; public static ConfigEntry<int> _clayGroupSizeMax; public static ConfigEntry<float> _clayMax; public static ConfigEntry<Toggle> _enableClayBig; public static ConfigEntry<float> _clayBigGroupRadius; public static ConfigEntry<int> _clayBigGroupSizeMin; public static ConfigEntry<int> _clayBigGroupSizeMax; public static ConfigEntry<float> _clayBigMax; public static ConfigEntry<float> _secPerUnit; public static ConfigEntry<int> _maxClay; public static ConfigEntry<int> _clayStackSize; private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedConfig = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedConfig ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); _configSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedConfig; return val2; } public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown Localizer.Load(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; _serverConfigLocked = config("1- ServerSync", "Lock Configuration", Toggle.On, new ConfigDescription("If On, the configuration is locked and can be changed by server admins only.", (AcceptableValueBase)null, Array.Empty<object>())); _configSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); _clayStackSize = config("7- Clay", "Max Stack Size", 50, new ConfigDescription("Clay max stack size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), Array.Empty<object>())); _enableClay = config("2- Clay-Pickable", "Enable", Toggle.On, new ConfigDescription("If On, pickable clays will spawn to all biomes except ashlands and deepnorth.", (AcceptableValueBase)null, Array.Empty<object>())); _clayGroupRadius = config("2- Clay-Pickable", "Group Radius", 2f, new ConfigDescription("Group radius.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); _clayGroupSizeMin = config("2- Clay-Pickable", "Group Size Min", 2, new ConfigDescription("Minimum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _clayGroupSizeMax = config("2- Clay-Pickable", "Group Size Max", 6, new ConfigDescription("Maximum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _clayMax = config("2- Clay-Pickable", "Max", 20f, new ConfigDescription("Maximum amount per zone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); _enableClayBig = config("3- Clay-Cluster", "Enable", Toggle.On, new ConfigDescription("If On, a giant cluster of clays will spawn to all biomes except ashlands and deepnorth.", (AcceptableValueBase)null, Array.Empty<object>())); _clayBigGroupRadius = config("3- Clay-Cluster", "Group Radius", 20f, new ConfigDescription("Group radius.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); _clayBigGroupSizeMin = config("3- Clay-Cluster", "Group Size Min", 1, new ConfigDescription("Minimum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _clayBigGroupSizeMax = config("3- Clay-Cluster", "Group Size Max", 1, new ConfigDescription("Maximum group size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); _clayBigMax = config("3- Clay-Cluster", "Max", 5f, new ConfigDescription("Maximum amount per zone.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); _secPerUnit = config("4- Collector", "Duration", 120f, new ConfigDescription("How long does the collector would take to collect clays from pits in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(30f, 300f), Array.Empty<object>())); _maxClay = config("4- Collector", "Max Capacity", 10, new ConfigDescription("Maximum Capacity.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); SetupPrefabs.Init(); SetupNewPrefabs.Init(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } } } namespace ClayBuildPieces.Patches { [HarmonyPatch] public class ClayCollectorPatch { [HarmonyPrefix] [HarmonyPatch(typeof(ClayCollector), "Awake")] private static void Awake_Prefix(ref float ___m_secPerUnit, ref int ___m_maxClay, ClayCollector __instance) { Plugin._secPerUnit.SettingChanged += delegate { __instance.m_secPerUnit = Plugin._secPerUnit.Value; }; ___m_secPerUnit = Plugin._secPerUnit.Value; Plugin._maxClay.SettingChanged += delegate { __instance.m_maxClay = Plugin._maxClay.Value; }; ___m_maxClay = Plugin._maxClay.Value; } [HarmonyPostfix] [HarmonyPatch(typeof(ClayCollector), "UpdateEffects")] private static void UpdateEffects_Postfix(ClayCollector __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_nview == (Object)null || !__instance.m_nview.IsValid() || !((Object)((Component)__instance).gameObject).name.StartsWith("BCP_Clay")) { return; } Transform val = Utils.FindChild(((Component)__instance).gameObject.transform, "refinery_high", (IterativeSearchType)0); Transform val2 = Utils.FindChild(((Component)__instance).gameObject.transform, "refinery_high_worn", (IterativeSearchType)0); Transform val3 = Utils.FindChild(((Component)__instance).gameObject.transform, "refineryBroken", (IterativeSearchType)0); if (__instance.GetStatusText() == __instance.m_collectingText) { if (((Component)val).gameObject.activeInHierarchy) { ((Component)val).gameObject.GetComponent<Animator>().speed = 1f; } else if (((Component)val2).gameObject.activeInHierarchy) { ((Component)val2).gameObject.GetComponent<Animator>().speed = 1f; } else if (((Component)val3).gameObject.activeInHierarchy) { ((Component)val3).gameObject.GetComponent<Animator>().speed = 1f; } } else if (((Component)val).gameObject.activeInHierarchy) { ((Component)val).gameObject.GetComponent<Animator>().speed = 0f; } else if (((Component)val2).gameObject.activeInHierarchy) { ((Component)val2).gameObject.GetComponent<Animator>().speed = 0f; } else if (((Component)val3).gameObject.activeInHierarchy) { ((Component)val3).gameObject.GetComponent<Animator>().speed = 0f; } } } [HarmonyPatch(typeof(ItemDrop), "Awake")] public class ItemDropPatch { private static void Postfix(ItemDrop __instance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!(((Scene)(ref activeScene)).name != "main") && !((Object)(object)__instance == (Object)null) && __instance.m_itemData.m_shared.m_name == "$bfp_clay") { ObjectDBPatch.StackSize(__instance); } } } [HarmonyPatch] public class ObjectDBPatch { [HarmonyPriority(800)] [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "Awake")] private static void Awake_Postfix(ObjectDB __instance) { __instance.AddGameObject(SetupPrefabs._clay); StackSize(SetupPrefabs._clay.GetComponent<ItemDrop>()); __instance.UpdateRegisters(); } [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] [HarmonyPriority(800)] private static void CopyOtherDB_Postfix(ObjectDB __instance) { __instance.AddGameObject(SetupPrefabs._clay); StackSize(SetupPrefabs._clay.GetComponent<ItemDrop>()); __instance.UpdateRegisters(); } public static void StackSize(ItemDrop item) { Plugin._clayStackSize.SettingChanged += delegate { item.m_itemData.m_shared.m_maxStackSize = Plugin._clayStackSize.Value; }; item.m_itemData.m_shared.m_maxStackSize = Plugin._clayStackSize.Value; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public class ZNetScenePatch { private static void Postfix(ZNetScene __instance) { SetupPrefabs.SetupCollector(__instance); SetupPrefabs.SetupArmorStand(__instance); SetupPrefabs.SetupLightPost(__instance); } } [HarmonyPatch] public class ZoneSystemPatch { private static readonly List<ZoneVegetation> _resourceList = new List<ZoneVegetation>(); [HarmonyPrefix] [HarmonyPatch(typeof(ZoneSystem), "ValidateVegetation")] private static void ValidateVegetation_Prefix(ZoneSystem __instance) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown foreach (ZoneVegetation resource in _resourceList) { __instance.m_vegetation.Remove(resource); } _resourceList.Clear(); ZoneVegetation item = new ZoneVegetation { m_enable = (Plugin._enableClay.Value == Toggle.On), m_groupRadius = Plugin._clayGroupRadius.Value, m_groupSizeMin = Plugin._clayGroupSizeMin.Value, m_groupSizeMax = Plugin._clayGroupSizeMax.Value, m_max = Plugin._clayMax.Value, m_chanceToUseGroundTilt = 1f, m_biome = (Biome)539, m_minAltitude = -0.5f, m_maxAltitude = 2f, m_maxTerrainDelta = 2f, m_prefab = SetupPrefabs._pickableClay }; _resourceList.Add(item); ZoneVegetation item2 = new ZoneVegetation { m_enable = (Plugin._enableClayBig.Value == Toggle.On), m_groupRadius = Plugin._clayBigGroupRadius.Value, m_groupSizeMin = Plugin._clayBigGroupSizeMin.Value, m_groupSizeMax = Plugin._clayBigGroupSizeMax.Value, m_max = Plugin._clayBigMax.Value, m_chanceToUseGroundTilt = 1f, m_biome = (Biome)539, m_minAltitude = -0.5f, m_maxAltitude = 2f, m_maxTerrainDelta = 2f, m_prefab = SetupPrefabs._clusterClay }; _resourceList.Add(item2); foreach (ZoneVegetation resource2 in _resourceList) { __instance.m_vegetation.Add(resource2); } } } } namespace ClayBuildPieces.Functions { public class ClayCollector : MonoBehaviour, Hoverable, Interactable { public string m_name; public Transform m_spawnPoint; public float m_secPerUnit = 10f; public int m_maxClay = 4; public ItemDrop m_clayItem; public EffectList m_spawnEffect = new EffectList(); public GameObject m_enabledObject; public Biome m_biome; [Header("Texts")] public string m_extractText = "$bcp_claycollector_extract"; public string m_collectingText = "$bcp_claycollector_collecting"; public string m_notConnectedText = "$bcp_claycollector_notconnected"; public string m_fullText = "$bcp_claycollector_full"; public ZNetView m_nview; private Collider m_collider; private Piece m_piece; private bool m_connected; private Collider[] m_sphereResults = (Collider[])(object)new Collider[32]; public void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); m_collider = ((Component)this).GetComponentInChildren<Collider>(); m_piece = ((Component)this).GetComponent<Piece>(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, 0L) == 0L) { m_nview.GetZDO().Set(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks); } m_nview.Register("RPC_Extract", (Action<long>)RPC_Extract); m_nview.Register("RPC_UpdateEffects", (Action<long>)RPC_UpdateEffects); ((MonoBehaviour)this).InvokeRepeating("UpdateTicks", Random.Range(0f, 2f), 5f); } } public string GetHoverText() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false)) { return Localization.instance.Localize(m_name + "\n$bcp_noaccess"); } int tarLevel = GetTarLevel(); string statusText = GetStatusText(); string text = ((!m_connected) ? (m_name + "\n( " + statusText + ", " + tarLevel + " / " + m_maxClay + " ) ") : (m_name + "\n( " + statusText + ", " + tarLevel + " / " + m_maxClay + " ) <color=orange>" + TimeLeft() + "</color>")); if (tarLevel > 0) { text = text + "\n[<color=yellow><b>$KEY_Use</b></color>] " + m_extractText; } return Localization.instance.Localize(text); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (GetTarLevel() <= 0) { return false; } Extract(); return true; } public string GetStatusText() { if (GetTarLevel() >= m_maxClay) { return m_fullText; } if (!m_connected) { return m_notConnectedText; } return m_collectingText; } public bool UseItem(Humanoid user, ItemData item) { return false; } public void Extract() { m_nview.InvokeRPC("RPC_Extract", Array.Empty<object>()); } public void RPC_Extract(long caller) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) int tarLevel = GetTarLevel(); if (tarLevel > 0) { m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1); for (int i = 0; i < tarLevel; i++) { Vector2 val = Random.insideUnitCircle * 0.5f; Vector3 val2 = m_spawnPoint.position + new Vector3(val.x, 0.25f * (float)i, val.y); Object.Instantiate<ItemDrop>(m_clayItem, val2, Quaternion.identity); } ResetLevel(); m_nview.InvokeRPC(ZNetView.Everybody, "RPC_UpdateEffects", Array.Empty<object>()); } } private float GetTimeSinceLastUpdate() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks)); DateTime time = ZNet.instance.GetTime(); TimeSpan timeSpan = time - dateTime; m_nview.GetZDO().Set(ZDOVars.s_lastTime, time.Ticks); double num = timeSpan.TotalSeconds; if (num < 0.0) { num = 0.0; } return (float)num; } public void ResetLevel() { m_nview.GetZDO().Set(ZDOVars.s_level, 0, false); } public void IncreaseLevel(int i) { int tarLevel = GetTarLevel(); tarLevel += i; tarLevel = Mathf.Clamp(tarLevel, 0, m_maxClay); m_nview.GetZDO().Set(ZDOVars.s_level, tarLevel, false); } private int GetTarLevel() { if (m_nview.GetZDO() != null) { return m_nview.GetZDO().GetInt(ZDOVars.s_level, 0); } return 0; } public void UpdateTicks() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (CheckBiome() && !m_connected) { int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, 0.2f, m_sphereResults); for (int i = 0; i < num; i++) { if (((Component)m_sphereResults[i]).gameObject.layer == 4) { m_connected = true; } } } bool flag = CheckBiome() && m_connected; if (m_nview.IsOwner() && flag) { float timeSinceLastUpdate = GetTimeSinceLastUpdate(); if (GetTarLevel() < m_maxClay) { float @float = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f); @float += timeSinceLastUpdate; if (@float > m_secPerUnit) { int i2 = (int)(@float / m_secPerUnit); IncreaseLevel(i2); @float = 0f; } m_nview.GetZDO().Set(ZDOVars.s_product, @float); } } UpdateEffects(); } public void RPC_UpdateEffects(long caller) { UpdateEffects(); } public void UpdateEffects() { bool active = GetTarLevel() < m_maxClay && m_connected && GetStatusText() == m_collectingText; m_enabledObject.SetActive(active); } private bool CheckBiome() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 return (Heightmap.FindBiome(((Component)this).transform.position) & m_biome) > 0; } private string TimeLeft() { string result = ""; if (GetTarLevel() == m_maxClay) { return result; } if (!m_nview.IsValid() || !m_nview.IsOwner()) { return result; } float @float = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f); float num = m_secPerUnit - @float; int num2 = Mathf.FloorToInt((float)((int)num / 60)); int num3 = Mathf.FloorToInt((float)((int)num % 60)); return $"[ {num2:00}:{num3:00} ]"; } } public static class Helper { public static void AddGameObject(this ObjectDB objectDB, GameObject gameObject, bool overWrite = true) { GameObject itemPrefab; if ((Object)(object)(itemPrefab = objectDB.GetItemPrefab(((Object)gameObject).name)) != (Object)null) { if (!overWrite) { return; } objectDB.m_items.Remove(itemPrefab); objectDB.m_itemByHash.Remove(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name)); } objectDB.m_items.Add(gameObject); objectDB.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)gameObject).name), gameObject); } public static bool ZNetSceneAwake() { if ((Object)(object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs.Count != 0) { return (Object)(object)ZNetScene.instance.GetPrefab("piece_workbench") != (Object)null; } return false; } } public static class SetupNewPrefabs { public static void Init() { BuildPiece buildPiece = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("ClayBuildPieces"); buildPiece.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); BuildPiece buildPiece2 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45_Corner"); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("ClayBuildPieces"); buildPiece2.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece2.Prefab); BuildPiece buildPiece3 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45_Corner2"); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("ClayBuildPieces"); buildPiece3.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece3.Prefab); BuildPiece buildPiece4 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45Arch"); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("ClayBuildPieces"); buildPiece4.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece4.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece4.Prefab); BuildPiece buildPiece5 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45Arch_Corner"); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("ClayBuildPieces"); buildPiece5.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece5.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece5.Prefab); BuildPiece buildPiece6 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_Clay2_Roof45Arch_Corner2"); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("ClayBuildPieces"); buildPiece6.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece6.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece6.Prefab); BuildPiece buildPiece7 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayArch_Big"); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("ClayBuildPieces"); buildPiece7.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece7.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece7.Prefab); BuildPiece buildPiece8 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayArch_Bottom"); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("ClayBuildPieces"); buildPiece8.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece8.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece8.Prefab); BuildPiece buildPiece9 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayArch_Top"); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("ClayBuildPieces"); buildPiece9.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece9.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece9.Prefab); BuildPiece buildPiece10 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayBeam1m"); buildPiece10.Crafting.Set(CraftingTable.Workbench); buildPiece10.Category.Set("ClayBuildPieces"); buildPiece10.RequiredItems.Add("BFP_Clay", 1, recover: true); buildPiece10.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece10.Prefab); BuildPiece buildPiece11 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayBeam2m"); buildPiece11.Crafting.Set(CraftingTable.Workbench); buildPiece11.Category.Set("ClayBuildPieces"); buildPiece11.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece11.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece11.Prefab); BuildPiece buildPiece12 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayDeco_Floor"); buildPiece12.Crafting.Set(CraftingTable.Workbench); buildPiece12.Category.Set("ClayBuildPieces"); buildPiece12.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece12.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece12.Prefab); BuildPiece buildPiece13 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayDecoWall_2x2"); buildPiece13.Crafting.Set(CraftingTable.Workbench); buildPiece13.Category.Set("ClayBuildPieces"); buildPiece13.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece13.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece13.Prefab); BuildPiece buildPiece14 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayDecoWall_Divider"); buildPiece14.Crafting.Set(CraftingTable.Workbench); buildPiece14.Category.Set("ClayBuildPieces"); buildPiece14.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece14.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece14.Prefab); BuildPiece buildPiece15 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayDecoWall_Tree"); buildPiece15.Crafting.Set(CraftingTable.Workbench); buildPiece15.Category.Set("ClayBuildPieces"); buildPiece15.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece15.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece15.Prefab); BuildPiece buildPiece16 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayFloor_1x1"); buildPiece16.Crafting.Set(CraftingTable.Workbench); buildPiece16.Category.Set("ClayBuildPieces"); buildPiece16.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece16.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece16.Prefab); BuildPiece buildPiece17 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayFloor_2x2"); buildPiece17.Crafting.Set(CraftingTable.Workbench); buildPiece17.Category.Set("ClayBuildPieces"); buildPiece17.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece17.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece17.Prefab); BuildPiece buildPiece18 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayHalfWall_1x2"); buildPiece18.Crafting.Set(CraftingTable.Workbench); buildPiece18.Category.Set("ClayBuildPieces"); buildPiece18.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece18.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece18.Prefab); BuildPiece buildPiece19 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayLadder"); buildPiece19.Crafting.Set(CraftingTable.Workbench); buildPiece19.Category.Set("ClayBuildPieces"); buildPiece19.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece19.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece19.Prefab); BuildPiece buildPiece20 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarArch"); buildPiece20.Crafting.Set(CraftingTable.Workbench); buildPiece20.Category.Set("ClayBuildPieces"); buildPiece20.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece20.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece20.Prefab); BuildPiece buildPiece21 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarArch_Small"); buildPiece21.Crafting.Set(CraftingTable.Workbench); buildPiece21.Category.Set("ClayBuildPieces"); buildPiece21.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece21.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece21.Prefab); BuildPiece buildPiece22 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBase_Medium"); buildPiece22.Crafting.Set(CraftingTable.Workbench); buildPiece22.Category.Set("ClayBuildPieces"); buildPiece22.RequiredItems.Add("BFP_Clay", 5, recover: true); buildPiece22.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece22.Prefab); BuildPiece buildPiece23 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBase_Small"); buildPiece23.Crafting.Set(CraftingTable.Workbench); buildPiece23.Category.Set("ClayBuildPieces"); buildPiece23.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece23.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece23.Prefab); BuildPiece buildPiece24 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBase_Tapered"); buildPiece24.Crafting.Set(CraftingTable.Workbench); buildPiece24.Category.Set("ClayBuildPieces"); buildPiece24.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece24.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece24.Prefab); BuildPiece buildPiece25 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBase_TaperedInverted"); buildPiece25.Crafting.Set(CraftingTable.Workbench); buildPiece25.Category.Set("ClayBuildPieces"); buildPiece25.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece25.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece25.Prefab); BuildPiece buildPiece26 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBeam_Medium"); buildPiece26.Crafting.Set(CraftingTable.Workbench); buildPiece26.Category.Set("ClayBuildPieces"); buildPiece26.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece26.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece26.Prefab); BuildPiece buildPiece27 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPillarBeam_Small"); buildPiece27.Crafting.Set(CraftingTable.Workbench); buildPiece27.Category.Set("ClayBuildPieces"); buildPiece27.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece27.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece27.Prefab); BuildPiece buildPiece28 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPole1m"); buildPiece28.Crafting.Set(CraftingTable.Workbench); buildPiece28.Category.Set("ClayBuildPieces"); buildPiece28.RequiredItems.Add("BFP_Clay", 1, recover: true); buildPiece28.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece28.Prefab); BuildPiece buildPiece29 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayPole_2m"); buildPiece29.Crafting.Set(CraftingTable.Workbench); buildPiece29.Category.Set("ClayBuildPieces"); buildPiece29.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece29.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece29.Prefab); BuildPiece buildPiece30 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayQuarterWall_1x1"); buildPiece30.Crafting.Set(CraftingTable.Workbench); buildPiece30.Category.Set("ClayBuildPieces"); buildPiece30.RequiredItems.Add("BFP_Clay", 1, recover: true); buildPiece30.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece30.Prefab); BuildPiece buildPiece31 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayRoundDoor"); buildPiece31.Crafting.Set(CraftingTable.Workbench); buildPiece31.Category.Set("ClayBuildPieces"); buildPiece31.RequiredItems.Add("BFP_Clay", 12, recover: true); buildPiece31.RequiredItems.Add("Copper", 8, recover: true); buildPiece31.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece31.Prefab); BuildPiece buildPiece32 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayStair2"); buildPiece32.Crafting.Set(CraftingTable.Workbench); buildPiece32.Category.Set("ClayBuildPieces"); buildPiece32.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece32.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece32.Prefab); BuildPiece buildPiece33 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall1x2"); buildPiece33.Crafting.Set(CraftingTable.Workbench); buildPiece33.Category.Set("ClayBuildPieces"); buildPiece33.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece33.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece33.Prefab); BuildPiece buildPiece34 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall2x2"); buildPiece34.Crafting.Set(CraftingTable.Workbench); buildPiece34.Category.Set("ClayBuildPieces"); buildPiece34.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece34.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece34.Prefab); BuildPiece buildPiece35 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall4x2"); buildPiece35.Crafting.Set(CraftingTable.Workbench); buildPiece35.Category.Set("ClayBuildPieces"); buildPiece35.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece35.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece35.Prefab); BuildPiece buildPiece36 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_2x2"); buildPiece36.Crafting.Set(CraftingTable.Workbench); buildPiece36.Category.Set("ClayBuildPieces"); buildPiece36.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece36.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece36.Prefab); BuildPiece buildPiece37 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Arch"); buildPiece37.Crafting.Set(CraftingTable.Workbench); buildPiece37.Category.Set("ClayBuildPieces"); buildPiece37.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece37.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece37.Prefab); BuildPiece buildPiece38 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Arch2"); buildPiece38.Crafting.Set(CraftingTable.Workbench); buildPiece38.Category.Set("ClayBuildPieces"); buildPiece38.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece38.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece38.Prefab); BuildPiece buildPiece39 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_ArchInverted"); buildPiece39.Crafting.Set(CraftingTable.Workbench); buildPiece39.Category.Set("ClayBuildPieces"); buildPiece39.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece39.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece39.Prefab); BuildPiece buildPiece40 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Beam26"); buildPiece40.Crafting.Set(CraftingTable.Workbench); buildPiece40.Category.Set("ClayBuildPieces"); buildPiece40.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece40.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece40.Prefab); BuildPiece buildPiece41 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Beam26Alt"); buildPiece41.Crafting.Set(CraftingTable.Workbench); buildPiece41.Category.Set("ClayBuildPieces"); buildPiece41.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece41.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece41.Prefab); BuildPiece buildPiece42 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Beam45"); buildPiece42.Crafting.Set(CraftingTable.Workbench); buildPiece42.Category.Set("ClayBuildPieces"); buildPiece42.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece42.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece42.Prefab); BuildPiece buildPiece43 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Beam45Alt"); buildPiece43.Crafting.Set(CraftingTable.Workbench); buildPiece43.Category.Set("ClayBuildPieces"); buildPiece43.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece43.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece43.Prefab); BuildPiece buildPiece44 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Cross26"); buildPiece44.Crafting.Set(CraftingTable.Workbench); buildPiece44.Category.Set("ClayBuildPieces"); buildPiece44.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece44.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece44.Prefab); BuildPiece buildPiece45 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Cross26Alt"); buildPiece45.Crafting.Set(CraftingTable.Workbench); buildPiece45.Category.Set("ClayBuildPieces"); buildPiece45.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece45.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece45.Prefab); BuildPiece buildPiece46 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Cross45"); buildPiece46.Crafting.Set(CraftingTable.Workbench); buildPiece46.Category.Set("ClayBuildPieces"); buildPiece46.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece46.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece46.Prefab); BuildPiece buildPiece47 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Cross45Alt"); buildPiece47.Crafting.Set(CraftingTable.Workbench); buildPiece47.Category.Set("ClayBuildPieces"); buildPiece47.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece47.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece47.Prefab); BuildPiece buildPiece48 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Roof26"); buildPiece48.Crafting.Set(CraftingTable.Workbench); buildPiece48.Category.Set("ClayBuildPieces"); buildPiece48.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece48.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece48.Prefab); BuildPiece buildPiece49 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Roof26UpsideDown"); buildPiece49.Crafting.Set(CraftingTable.Workbench); buildPiece49.Category.Set("ClayBuildPieces"); buildPiece49.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece49.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece49.Prefab); BuildPiece buildPiece50 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Roof45"); buildPiece50.Crafting.Set(CraftingTable.Workbench); buildPiece50.Category.Set("ClayBuildPieces"); buildPiece50.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece50.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece50.Prefab); BuildPiece buildPiece51 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWall_Roof45UpsideDown"); buildPiece51.Crafting.Set(CraftingTable.Workbench); buildPiece51.Category.Set("ClayBuildPieces"); buildPiece51.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece51.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece51.Prefab); BuildPiece buildPiece52 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWindow2x2"); buildPiece52.Crafting.Set(CraftingTable.Workbench); buildPiece52.Category.Set("ClayBuildPieces"); buildPiece52.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece52.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece52.Prefab); BuildPiece buildPiece53 = new BuildPiece(SetupPrefabs._clayBundle, "BCP_ClayWindow4x2"); buildPiece53.Crafting.Set(CraftingTable.Workbench); buildPiece53.Category.Set("ClayBuildPieces"); buildPiece53.RequiredItems.Add("BFP_Clay", 8, recover: true); buildPiece53.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece53.Prefab); } } public static class SetupPrefabs { public static AssetBundle _clayBundle; public static GameObject _clay; public static GameObject _pickableClay; public static GameObject _clusterClay; private static GameObject _sfxPick; private static GameObject _vfxPick; public const string _category = "ClayBuildPieces"; public static void Init() { _clayBundle = PiecePrefabManager.RegisterAssetBundle("claybuildpieces"); ShaderReplacer.Replace(_clayBundle.LoadAsset<GameObject>("BCP_ClayPit")); ShaderReplacer.Replace(_clayBundle.LoadAsset<GameObject>("BCP_ClayPit1")); Others(); ClayCollector(); ClayPieces(); ArmorStand(); LightPost(); } private static void ClayCollector() { BuildPiece buildPiece = new BuildPiece(_clayBundle, "BCP_ClayCollector"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("CollectorSeries"); buildPiece.RequiredItems.Add("SurtlingCore", 5, recover: true); buildPiece.RequiredItems.Add("Bronze", 12, recover: true); buildPiece.RequiredItems.Add("RoundLog", 15, recover: true); buildPiece.RequiredItems.Add("Stone", 22, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; if (!Object.op_Implicit((Object)(object)buildPiece.Prefab.GetComponent<ClayCollector>())) { buildPiece.Prefab.AddComponent<ClayCollector>(); } ShaderReplacer.Replace(buildPiece.Prefab); } public static void SetupCollector(ZNetScene zNetScene) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (Helper.ZNetSceneAwake()) { ClayCollector component = _clayBundle.LoadAsset<GameObject>("BCP_ClayCollector").GetComponent<ClayCollector>(); component.m_name = "$bcp_claycollector"; component.m_spawnPoint = Utils.FindChild(((Component)component).gameObject.transform, "spawnpoint", (IterativeSearchType)0); component.m_secPerUnit = Plugin._secPerUnit.Value; component.m_maxClay = Plugin._maxClay.Value; component.m_clayItem = zNetScene.GetPrefab("BFP_Clay").GetComponent<ItemDrop>(); component.m_spawnEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = _sfxPick, m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = _vfxPick, m_enabled = true, m_variant = -1 } }; component.m_enabledObject = ((Component)Utils.FindChild(((Component)component).gameObject.transform, "_enabled", (IterativeSearchType)0)).gameObject; component.m_biome = (Biome)27; } } private static void Others() { _clay = PiecePrefabManager.RegisterPrefab(_clayBundle, "BFP_Clay"); ShaderReplacer.Replace(_clay); _pickableClay = PiecePrefabManager.RegisterPrefab(_clayBundle, "BFP_Pickable_Clay"); ShaderReplacer.Replace(_pickableClay); _clusterClay = PiecePrefabManager.RegisterPrefab(_clayBundle, "BFP_Pickable_ClayBig"); ShaderReplacer.Replace(_clusterClay); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_fx_ArmorStand_pick"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_fx_refinery_destroyed"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_build_hammer_default"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_build_hammer_stone"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_chest_close"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_chest_open"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_darkwood_door_close"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_darkwood_door_open"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_FireAddFuel"); _sfxPick = PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_pickable_pick"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_rock_destroyed"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_sfx_rock_hit"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_FireAddFuel"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_MarbleDestroyed"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_MarbleHit"); _vfxPick = PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_pickable_pick"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_Place_chest"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_Place_stone_floor"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_Place_stone_wall_2x1"); PiecePrefabManager.RegisterPrefab(_clayBundle, "bcp_vfx_SawDust"); } private static void ClayPieces() { BuildPiece buildPiece = new BuildPiece(_clayBundle, "BFP_ClayArch"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set("ClayBuildPieces"); buildPiece.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); BuildPiece buildPiece2 = new BuildPiece(_clayBundle, "BFP_ClayArch2"); buildPiece2.Crafting.Set(CraftingTable.Workbench); buildPiece2.Category.Set("ClayBuildPieces"); buildPiece2.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece2.Prefab); BuildPiece buildPiece3 = new BuildPiece(_clayBundle, "BFP_ClayBase1"); buildPiece3.Crafting.Set(CraftingTable.Workbench); buildPiece3.Category.Set("ClayBuildPieces"); buildPiece3.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece3.Prefab); BuildPiece buildPiece4 = new BuildPiece(_clayBundle, "BFP_ClayBase2"); buildPiece4.Crafting.Set(CraftingTable.Workbench); buildPiece4.Category.Set("ClayBuildPieces"); buildPiece4.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece4.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece4.Prefab); BuildPiece buildPiece5 = new BuildPiece(_clayBundle, "BFP_ClayBaseCorner"); buildPiece5.Crafting.Set(CraftingTable.Workbench); buildPiece5.Category.Set("ClayBuildPieces"); buildPiece5.RequiredItems.Add("BFP_Clay", 7, recover: true); buildPiece5.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece5.Prefab); BuildPiece buildPiece6 = new BuildPiece(_clayBundle, "BFP_ClayBlock1x1"); buildPiece6.Crafting.Set(CraftingTable.Workbench); buildPiece6.Category.Set("ClayBuildPieces"); buildPiece6.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece6.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece6.Prefab); BuildPiece buildPiece7 = new BuildPiece(_clayBundle, "BFP_ClayBlock2x1x1"); buildPiece7.Crafting.Set(CraftingTable.Workbench); buildPiece7.Category.Set("ClayBuildPieces"); buildPiece7.RequiredItems.Add("BFP_Clay", 5, recover: true); buildPiece7.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece7.Prefab); BuildPiece buildPiece8 = new BuildPiece(_clayBundle, "BFP_ClayBlock2x2_Enforced"); buildPiece8.Crafting.Set(CraftingTable.Workbench); buildPiece8.Category.Set("ClayBuildPieces"); buildPiece8.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece8.RequiredItems.Add("Copper", 2, recover: true); buildPiece8.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece8.Prefab); BuildPiece buildPiece9 = new BuildPiece(_clayBundle, "BFP_ClayBlock2x2x1"); buildPiece9.Crafting.Set(CraftingTable.Workbench); buildPiece9.Category.Set("ClayBuildPieces"); buildPiece9.RequiredItems.Add("BFP_Clay", 7, recover: true); buildPiece9.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece9.Prefab); BuildPiece buildPiece10 = new BuildPiece(_clayBundle, "BFP_ClayBlock2x2x2"); buildPiece10.Crafting.Set(CraftingTable.Workbench); buildPiece10.Category.Set("ClayBuildPieces"); buildPiece10.RequiredItems.Add("BFP_Clay", 9, recover: true); buildPiece10.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece10.Prefab); BuildPiece buildPiece11 = new BuildPiece(_clayBundle, "BFP_ClayBlock_OutCorner"); buildPiece11.Crafting.Set(CraftingTable.Workbench); buildPiece11.Category.Set("ClayBuildPieces"); buildPiece11.RequiredItems.Add("BFP_Clay", 7, recover: true); buildPiece11.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece11.Prefab); BuildPiece buildPiece12 = new BuildPiece(_clayBundle, "BFP_ClayBlock_SlopeInverted1x2"); buildPiece12.Crafting.Set(CraftingTable.Workbench); buildPiece12.Category.Set("ClayBuildPieces"); buildPiece12.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece12.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece12.Prefab); BuildPiece buildPiece13 = new BuildPiece(_clayBundle, "BFP_ClayBlockOut1"); buildPiece13.Crafting.Set(CraftingTable.Workbench); buildPiece13.Category.Set("ClayBuildPieces"); buildPiece13.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece13.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece13.Prefab); BuildPiece buildPiece14 = new BuildPiece(_clayBundle, "BFP_ClayBlockOut2"); buildPiece14.Crafting.Set(CraftingTable.Workbench); buildPiece14.Category.Set("ClayBuildPieces"); buildPiece14.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece14.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece14.Prefab); BuildPiece buildPiece15 = new BuildPiece(_clayBundle, "BFP_ClayBlockSlope1x2"); buildPiece15.Crafting.Set(CraftingTable.Workbench); buildPiece15.Category.Set("ClayBuildPieces"); buildPiece15.RequiredItems.Add("BFP_Clay", 2, recover: true); buildPiece15.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece15.Prefab); BuildPiece buildPiece16 = new BuildPiece(_clayBundle, "BFP_ClayChest"); buildPiece16.Crafting.Set(CraftingTable.Workbench); buildPiece16.Category.Set(BuildPieceCategory.Furniture); buildPiece16.RequiredItems.Add("BFP_Clay", 10, recover: true); buildPiece16.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece16.Prefab); BuildPiece buildPiece17 = new BuildPiece(_clayBundle, "BFP_ClayColumn1"); buildPiece17.Crafting.Set(CraftingTable.Workbench); buildPiece17.Category.Set("ClayBuildPieces"); buildPiece17.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece17.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece17.Prefab); BuildPiece buildPiece18 = new BuildPiece(_clayBundle, "BFP_ClayColumn2"); buildPiece18.Crafting.Set(CraftingTable.Workbench); buildPiece18.Category.Set("ClayBuildPieces"); buildPiece18.RequiredItems.Add("BFP_Clay", 5, recover: true); buildPiece18.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece18.Prefab); BuildPiece buildPiece19 = new BuildPiece(_clayBundle, "BFP_ClayCorgi"); buildPiece19.Crafting.Set(CraftingTable.Workbench); buildPiece19.Category.Set(BuildPieceCategory.Misc); buildPiece19.RequiredItems.Add("BFP_Clay", 18, recover: true); buildPiece19.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece19.Prefab); BuildPiece buildPiece20 = new BuildPiece(_clayBundle, "BFP_ClayDeer"); buildPiece20.Crafting.Set(CraftingTable.Workbench); buildPiece20.Category.Set(BuildPieceCategory.Misc); buildPiece20.RequiredItems.Add("BFP_Clay", 18, recover: true); buildPiece20.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece20.Prefab); BuildPiece buildPiece21 = new BuildPiece(_clayBundle, "BFP_ClayFloor"); buildPiece21.Crafting.Set(CraftingTable.Workbench); buildPiece21.Category.Set("ClayBuildPieces"); buildPiece21.RequiredItems.Add("BFP_Clay", 5, recover: true); buildPiece21.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece21.Prefab); BuildPiece buildPiece22 = new BuildPiece(_clayBundle, "BFP_ClayFloorLarge"); buildPiece22.Crafting.Set(CraftingTable.Workbench); buildPiece22.Category.Set("ClayBuildPieces"); buildPiece22.RequiredItems.Add("BFP_Clay", 9, recover: true); buildPiece22.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece22.Prefab); BuildPiece buildPiece23 = new BuildPiece(_clayBundle, "BFP_ClayFloorTriangle"); buildPiece23.Crafting.Set(CraftingTable.Workbench); buildPiece23.Category.Set("ClayBuildPieces"); buildPiece23.RequiredItems.Add("BFP_Clay", 4, recover: true); buildPiece23.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece23.Prefab); BuildPiece buildPiece24 = new BuildPiece(_clayBundle, "BFP_ClayHare"); buildPiece24.Crafting.Set(CraftingTable.Workbench); buildPiece24.Category.Set(BuildPieceCategory.Misc); buildPiece24.RequiredItems.Add("BFP_Clay", 18, recover: true); buildPiece24.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece24.Prefab); BuildPiece buildPiece25 = new BuildPiece(_clayBundle, "BFP_ClayHead1"); buildPiece25.Crafting.Set(CraftingTable.Workbench); buildPiece25.Category.Set("ClayBuildPieces"); buildPiece25.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece25.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece25.Prefab); BuildPiece buildPiece26 = new BuildPiece(_clayBundle, "BFP_ClayHead2"); buildPiece26.Crafting.Set(CraftingTable.Workbench); buildPiece26.Category.Set("ClayBuildPieces"); buildPiece26.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece26.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece26.Prefab); BuildPiece buildPiece27 = new BuildPiece(_clayBundle, "BFP_ClayPillar"); buildPiece27.Crafting.Set(CraftingTable.Workbench); buildPiece27.Category.Set("ClayBuildPieces"); buildPiece27.RequiredItems.Add("BFP_Clay", 12, recover: true); buildPiece27.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece27.Prefab); BuildPiece buildPiece28 = new BuildPiece(_clayBundle, "BFP_ClayRoof26"); buildPiece28.Crafting.Set(CraftingTable.Workbench); buildPiece28.Category.Set("ClayBuildPieces"); buildPiece28.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece28.RequiredItems.Add("Wood", 4, recover: true); buildPiece28.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece28.Prefab); BuildPiece buildPiece29 = new BuildPiece(_clayBundle, "BFP_ClayRoof45"); buildPiece29.Crafting.Set(CraftingTable.Workbench); buildPiece29.Category.Set("ClayBuildPieces"); buildPiece29.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece29.RequiredItems.Add("Wood", 4, recover: true); buildPiece29.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece29.Prefab); BuildPiece buildPiece30 = new BuildPiece(_clayBundle, "BFP_ClayRoofICorner26"); buildPiece30.Crafting.Set(CraftingTable.Workbench); buildPiece30.Category.Set("ClayBuildPieces"); buildPiece30.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece30.RequiredItems.Add("Wood", 4, recover: true); buildPiece30.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece30.Prefab); BuildPiece buildPiece31 = new BuildPiece(_clayBundle, "BFP_ClayRoofICorner45"); buildPiece31.Crafting.Set(CraftingTable.Workbench); buildPiece31.Category.Set("ClayBuildPieces"); buildPiece31.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece31.RequiredItems.Add("Wood", 4, recover: true); buildPiece31.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece31.Prefab); BuildPiece buildPiece32 = new BuildPiece(_clayBundle, "BFP_ClayRoofOCorner26"); buildPiece32.Crafting.Set(CraftingTable.Workbench); buildPiece32.Category.Set("ClayBuildPieces"); buildPiece32.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece32.RequiredItems.Add("Wood", 4, recover: true); buildPiece32.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece32.Prefab); BuildPiece buildPiece33 = new BuildPiece(_clayBundle, "BFP_ClayRoofOCorner45"); buildPiece33.Crafting.Set(CraftingTable.Workbench); buildPiece33.Category.Set("ClayBuildPieces"); buildPiece33.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece33.RequiredItems.Add("Wood", 4, recover: true); buildPiece33.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece33.Prefab); BuildPiece buildPiece34 = new BuildPiece(_clayBundle, "BFP_ClayRoofTop26"); buildPiece34.Crafting.Set(CraftingTable.Workbench); buildPiece34.Category.Set("ClayBuildPieces"); buildPiece34.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece34.RequiredItems.Add("Wood", 4, recover: true); buildPiece34.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece34.Prefab); BuildPiece buildPiece35 = new BuildPiece(_clayBundle, "BFP_ClayRoofTop45"); buildPiece35.Crafting.Set(CraftingTable.Workbench); buildPiece35.Category.Set("ClayBuildPieces"); buildPiece35.RequiredItems.Add("BFP_Clay", 6, recover: true); buildPiece35.RequiredItems.Add("Wood", 4, recover: true); buildPiece35.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece35.Prefab); BuildPiece buildPiece36 = new BuildPiece(_clayBundle, "BFP_ClayStair"); buildPiece36.Crafting.Set(CraftingTable.Workbench); buildPiece36.Category.Set("ClayBuildPieces"); buildPiece36.RequiredItems.Add("BFP_Clay", 9, recover: true); buildPiece36.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece36.Prefab); BuildPiece buildPiece37 = new BuildPiece(_clayBundle, "BFP_ClayTileFloor1x1"); buildPiece37.Crafting.Set(CraftingTable.Workbench); buildPiece37.Category.Set("ClayBuildPieces"); buildPiece37.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece37.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece37.Prefab); BuildPiece buildPiece38 = new BuildPiece(_clayBundle, "BFP_ClayTileFloor2x2"); buildPiece38.Crafting.Set(CraftingTable.Workbench); buildPiece38.Category.Set("ClayBuildPieces"); buildPiece38.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece38.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece38.Prefab); BuildPiece buildPiece39 = new BuildPiece(_clayBundle, "BFP_ClayTileWall1x1"); buildPiece39.Crafting.Set(CraftingTable.Workbench); buildPiece39.Category.Set("ClayBuildPieces"); buildPiece39.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece39.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece39.Prefab); BuildPiece buildPiece40 = new BuildPiece(_clayBundle, "BFP_ClayTileWall2x2"); buildPiece40.Crafting.Set(CraftingTable.Workbench); buildPiece40.Category.Set("ClayBuildPieces"); buildPiece40.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece40.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece40.Prefab); BuildPiece buildPiece41 = new BuildPiece(_clayBundle, "BFP_ClayTileWall2x4"); buildPiece41.Crafting.Set(CraftingTable.Workbench); buildPiece41.Category.Set("ClayBuildPieces"); buildPiece41.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece41.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece41.Prefab); BuildPiece buildPiece42 = new BuildPiece(_clayBundle, "BFP_ClayTip"); buildPiece42.Crafting.Set(CraftingTable.Workbench); buildPiece42.Category.Set("ClayBuildPieces"); buildPiece42.RequiredItems.Add("BFP_Clay", 3, recover: true); buildPiece42.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece42.Prefab); } private static void ArmorStand() { BuildPiece buildPiece = new BuildPiece(_clayBundle, "BFP_ClayArmorStand"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set(BuildPieceCategory.Furniture); buildPiece.RequiredItems.Add("BFP_Clay", 24, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); } public static void SetupArmorStand(ZNetScene zNetScene) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown if (Helper.ZNetSceneAwake()) { ArmorStand component = _clayBundle.LoadAsset<GameObject>("BFP_ClayArmorStand").GetComponent<ArmorStand>(); component.m_supports = new List<ArmorStandSupport>(1) { new ArmorStandSupport { m_items = new List<ItemDrop>(4) { zNetScene.GetPrefab("ArmorBronzeChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorIronChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorCarapaceChest").GetComponent<ItemDrop>(), zNetScene.GetPrefab("ArmorMageChest").GetComponent<ItemDrop>() }, m_supports = new List<GameObject>(2) { ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmLeft", (IterativeSearchType)0)).gameObject, ((Component)Utils.FindChild(((Component)component).gameObject.transform, "ArmRight", (IterativeSearchType)0)).gameObject } } }; } } private static void LightPost() { BuildPiece buildPiece = new BuildPiece(_clayBundle, "BFP_ClayLightPost"); buildPiece.Crafting.Set(CraftingTable.Workbench); buildPiece.Category.Set(BuildPieceCategory.Misc); buildPiece.RequiredItems.Add("BFP_Clay", 20, recover: true); buildPiece.RequiredItems.Add("Coal", 6, recover: true); buildPiece.RequiredItems.Add("Resin", 10, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; ShaderReplacer.Replace(buildPiece.Prefab); } public static void SetupLightPost(ZNetScene zNetScene) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) Fireplace component = _clayBundle.LoadAsset<GameObject>("BFP_ClayLightPost").GetComponent<Fireplace>(); component.m_fuelItem = zNetScene.GetPrefab("Coal").GetComponent<ItemDrop>(); FireworkItem[] array = new FireworkItem[1]; FireworkItem val = new FireworkItem { m_fireworkItemCount = 1, m_fireworkItem = zNetScene.GetPrefab("Resin").GetComponent<ItemDrop>() }; EffectList val2 = new EffectList(); val2.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { new EffectData { m_prefab = zNetScene.GetPrefab("vfx_Firework_Rocket") } }; val.m_fireworksEffects = val2; array[0] = val; component.m_fireworkItemList = (FireworkItem[])(object)array; } } public static class ShaderReplacer { private static readonly List<GameObject> GOToSwap; static ShaderReplacer() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown GOToSwap = new List<GameObject>(); new Harmony("blacks7ar.utilities.ShaderReplacer").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(ShaderReplacer), "ReplaceShaderPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void Replace(GameObject gameObject) { GOToSwap.Add(gameObject); } [HarmonyPriority(700)] private static void ReplaceShaderPatch() { foreach (Material item in from gameObject in GOToSwap select gameObject.GetComponentsInChildren<Renderer>(true) into renderers from renderer in renderers where (Object)(object)renderer != (Object)null from material in renderer.sharedMaterials where (Object)(object)material != (Object)null select material) { Shader[] array = Resources.FindObjectsOfTypeAll<Shader>(); foreach (Shader val in array) { if (((Object)item.shader).name == ((Object)val).name) { item.shader = val; } } } } } public enum Toggle { On = 1, Off = 0 } } namespace Microsoft.CodeAnalysis { [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] [CompilerGenerated] internal sealed class <b89b921d-8954-4084-bd4d-1feb826a594e>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] [CompilerGenerated] internal sealed class <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] [<b89b921d-8954-4084-bd4d-1feb826a594e>Embedded] internal sealed class <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute : Attribute { public readonly byte Flag; public <bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LocalizationManager { [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(1)] [PublicAPI] [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(0)] internal class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static BaseUnityPlugin _plugin; private static readonly List<string> fileExtensions; private static BaseUnityPlugin plugin { get { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown if (_plugin == null) { 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([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out var value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out var value2)) { text = value2.Aggregate(text, [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, [<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(new byte[] { 2, 1, 1 })] Func<T, string> convertConfigValue = null) { if (convertConfigValue == null) { convertConfigValue = [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key)) { PlaceholderProcessors[key] = new Dictionary<string, Func<string>>(); } config.SettingChanged += [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (object _, EventArgs _) => { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key][placeholder] = () => convertConfigValue(config.Value); UpdatePlaceholderText(Localization.instance, key); } } public static void AddText(string key, string text) { List<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.ContainsKey(language)) { text2 = File.ReadAllText(dictionary[language]); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.ContainsKey("English")) { text2 = File.ReadAllText(dictionary["English"]); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string> { ".json", ".yml" }; new Harmony("org.bepinex.helpers.LocalizationManager").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [return: <f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(2)] private static byte[] LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } [<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(2)] public static byte[] ReadEmbeddedFileBytes([<f6f8ff5f-fa45-43ba-9489-b740a9e7c98b>Nullable(1)] string resourceFileName, Assembly containingAssembly = null) { using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault([<bb5e3e5e-5c47-485a-88ef-ea5afd7f01c7>NullableContext(0)] (string str) => str.EndsWith(resourceFileName, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<00d86f6f-bb73-4fb6-a074-780689afd077>Embedded] internal sealed class <00d86f6f-bb73-4fb6-a074-780689afd077>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<00d86f6f-bb73-4fb6-a074-780689afd077>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <9c5d3118-21f7-47cf-acee-1f74b54779c6>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <9c5d3118-21f7-47cf-acee-1f74b54779c6>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <9c5d3118-21f7-47cf-acee-1f74b54779c6>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [<00d86f6f-bb73-4fb6-a074-780689afd077>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContextAttribute : Attribute { public readonly byte Flag; public <07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class AllowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] internal sealed class DisallowNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] internal sealed class DoesNotReturnAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class DoesNotReturnIfAttribute : Attribute { public bool ParameterValue { get; } public DoesNotReturnIfAttribute(bool parameterValue) { ParameterValue = parameterValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class MaybeNullAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class MaybeNullWhenAttribute : Attribute { public bool ReturnValue { get; } public MaybeNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)] internal sealed class NotNullAttribute : Attribute { } [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] internal sealed class NotNullIfNotNullAttribute : Attribute { public string ParameterName { get; } public NotNullIfNotNullAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] internal sealed class NotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public NotNullWhenAttribute(bool returnValue) { ReturnValue = returnValue; } } } namespace System.Collections.Generic { internal static class DeconstructionExtensions { [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] public static void Deconstruct<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] TKey, [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] TValue>([<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(new byte[] { 0, 1, 1 })] this KeyValuePair<TKey, TValue> pair, out TKey key, out TValue value) { key = pair.Key; value = pair.Value; } } } namespace YamlDotNet { [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] internal sealed class CultureInfoAdapter : CultureInfo { private readonly IFormatProvider provider; public CultureInfoAdapter(CultureInfo baseCulture, IFormatProvider provider) : base(baseCulture.LCID) { this.provider = provider; } [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(2)] public override object GetFormat(Type formatType) { return provider.GetFormat(formatType); } } [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] internal static class ReflectionExtensions { [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] private static readonly FieldInfo RemoteStackTraceField = typeof(Exception).GetField("_remoteStackTraceString", BindingFlags.Instance | BindingFlags.NonPublic); [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static Type BaseType(this Type type) { return type.BaseType; } public static bool IsValueType(this Type type) { return type.IsValueType; } public static bool IsGenericType(this Type type) { return type.IsGenericType; } public static bool IsGenericTypeDefinition(this Type type) { return type.IsGenericTypeDefinition; } public static bool IsInterface(this Type type) { return type.IsInterface; } public static bool IsEnum(this Type type) { return type.IsEnum; } public static bool IsDbNull(this object value) { return value is DBNull; } public static bool HasDefaultConstructor(this Type type) { if (!type.IsValueType) { return type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, null, Type.EmptyTypes, null) != null; } return true; } public static TypeCode GetTypeCode(this Type type) { return Type.GetTypeCode(type); } [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static PropertyInfo GetPublicProperty(this Type type, string name) { return type.GetProperty(name); } [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static FieldInfo GetPublicStaticField(this Type type, string name) { return type.GetField(name, BindingFlags.Static | BindingFlags.Public); } public static IEnumerable<PropertyInfo> GetProperties(this Type type, bool includeNonPublic) { BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public; if (includeNonPublic) { bindingFlags |= BindingFlags.NonPublic; } if (!type.IsInterface) { return type.GetProperties(bindingFlags); } return new Type[1] { type }.Concat(type.GetInterfaces()).SelectMany([<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(0)] (Type i) => i.GetProperties(bindingFlags)); } public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type) { return type.GetProperties(includeNonPublic: false); } public static IEnumerable<FieldInfo> GetPublicFields(this Type type) { return type.GetFields(BindingFlags.Instance | BindingFlags.Public); } public static IEnumerable<MethodInfo> GetPublicStaticMethods(this Type type) { return type.GetMethods(BindingFlags.Static | BindingFlags.Public); } public static MethodInfo GetPrivateStaticMethod(this Type type, string name) { return type.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic) ?? throw new MissingMethodException("Expected to find a method named '" + name + "' in '" + type.FullName + "'."); } [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static MethodInfo GetPublicStaticMethod(this Type type, string name, params Type[] parameterTypes) { return type.GetMethod(name, BindingFlags.Static | BindingFlags.Public, null, parameterTypes, null); } [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static MethodInfo GetPublicInstanceMethod(this Type type, string name) { return type.GetMethod(name, BindingFlags.Instance | BindingFlags.Public); } public static Exception Unwrap(this TargetInvocationException ex) { Exception innerException = ex.InnerException; if (innerException == null) { return ex; } if (RemoteStackTraceField != null) { RemoteStackTraceField.SetValue(innerException, innerException.StackTrace + "\r\n"); } return innerException; } public static bool IsInstanceOf(this Type type, object o) { return type.IsInstanceOfType(o); } public static Attribute[] GetAllCustomAttributes<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] TAttribute>(this PropertyInfo property) { return Attribute.GetCustomAttributes(property, typeof(TAttribute)); } } internal static class PropertyInfoExtensions { [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] [return: <9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] public static object ReadValue(this PropertyInfo property, object target) { return property.GetValue(target, null); } } internal static class StandardRegexOptions { public const RegexOptions Compiled = RegexOptions.Compiled; } } namespace YamlDotNet.Serialization { [<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] [<07afe4d2-3bab-48c8-b81d-03847125b7dc>NullableContext(1)] internal abstract class BuilderSkeleton<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] TBuilder> where TBuilder : BuilderSkeleton<TBuilder> { internal INamingConvention namingConvention = NullNamingConvention.Instance; internal ITypeResolver typeResolver; internal readonly YamlAttributeOverrides overrides; internal readonly LazyComponentRegistrationList<Nothing, IYamlTypeConverter> typeConverterFactories; internal readonly LazyComponentRegistrationList<ITypeInspector, ITypeInspector> typeInspectorFactories; private bool ignoreFields; private bool includeNonPublicProperties; protected abstract TBuilder Self { get; } internal BuilderSkeleton(ITypeResolver typeResolver) { overrides = new YamlAttributeOverrides(); typeConverterFactories = new LazyComponentRegistrationList<Nothing, IYamlTypeConverter> { { typeof(YamlDotNet.Serialization.Converters.GuidConverter), (Nothing _) => new YamlDotNet.Serialization.Converters.GuidConverter(jsonCompatible: false) }, { typeof(SystemTypeConverter), (Nothing _) => new SystemTypeConverter() } }; typeInspectorFactories = new LazyComponentRegistrationList<ITypeInspector, ITypeInspector>(); this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver"); } internal ITypeInspector BuildTypeInspector() { ITypeInspector typeInspector = new ReadablePropertiesTypeInspector(typeResolver, includeNonPublicProperties); if (!ignoreFields) { typeInspector = new CompositeTypeInspector(new ReadableFieldsTypeInspector(typeResolver), typeInspector); } return typeInspectorFactories.BuildComponentChain(typeInspector); } public TBuilder IgnoreFields() { ignoreFields = true; return Self; } public TBuilder IncludeNonPublicProperties() { includeNonPublicProperties = true; return Self; } public TBuilder WithNamingConvention(INamingConvention namingConvention) { this.namingConvention = namingConvention ?? throw new ArgumentNullException("namingConvention"); return Self; } public TBuilder WithTypeResolver(ITypeResolver typeResolver) { this.typeResolver = typeResolver ?? throw new ArgumentNullException("typeResolver"); return Self; } public abstract TBuilder WithTagMapping(TagName tag, Type type); public TBuilder WithAttributeOverride<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(2)] TClass>(Expression<Func<TClass, object>> propertyAccessor, Attribute attribute) { overrides.Add(propertyAccessor, attribute); return Self; } public TBuilder WithAttributeOverride(Type type, string member, Attribute attribute) { overrides.Add(type, member, attribute); return Self; } public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter) { return WithTypeConverter(typeConverter, delegate(IRegistrationLocationSelectionSyntax<IYamlTypeConverter> w) { w.OnTop(); }); } public TBuilder WithTypeConverter(IYamlTypeConverter typeConverter, Action<IRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) { if (typeConverter == null) { throw new ArgumentNullException("typeConverter"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeConverterFactories.CreateRegistrationLocationSelector(typeConverter.GetType(), (Nothing _) => typeConverter)); return Self; } public TBuilder WithTypeConverter<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] TYamlTypeConverter>(WrapperFactory<IYamlTypeConverter, IYamlTypeConverter> typeConverterFactory, Action<ITrackingRegistrationLocationSelectionSyntax<IYamlTypeConverter>> where) where TYamlTypeConverter : IYamlTypeConverter { if (typeConverterFactory == null) { throw new ArgumentNullException("typeConverterFactory"); } if (where == null) { throw new ArgumentNullException("where"); } where(typeConverterFactories.CreateTrackingRegistrationLocationSelector(typeof(TYamlTypeConverter), (IYamlTypeConverter wrapped, Nothing _) => typeConverterFactory(wrapped))); return Self; } public TBuilder WithoutTypeConverter<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] TYamlTypeConverter>() where TYamlTypeConverter : IYamlTypeConverter { return WithoutTypeConverter(typeof(TYamlTypeConverter)); } public TBuilder WithoutTypeConverter(Type converterType) { if (converterType == null) { throw new ArgumentNullException("converterType"); } typeConverterFactories.Remove(converterType); return Self; } public TBuilder WithTypeInspector<[<9c5d3118-21f7-47cf-acee-1f74b54779c6>Nullable(0)] T