Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Mithril Workshop v420.101.1
Forteca_Mithril_Forge.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Forteca_Mithril_Forge; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using LocalizationManager; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("420.101.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("420.101.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServerSync { internal sealed class ConfigSync { internal sealed class Entry { private readonly ConfigSync _owner; private readonly ConfigurationManagerAttributes _tag; private bool _synchronized = true; public bool SynchronizedConfig { get { return _synchronized; } set { _synchronized = value; Refresh(); } } internal Entry(ConfigSync owner, ConfigurationManagerAttributes tag) { _owner = owner; _tag = tag; } internal void Refresh() { _tag.IsAdminOnly = _synchronized && _owner._locked; } } private readonly Dictionary<ConfigEntryBase, Entry> _entries = new Dictionary<ConfigEntryBase, Entry>(); private bool _locked = true; public string DisplayName { get; set; } public string CurrentVersion { get; set; } public string MinimumRequiredVersion { get; set; } public ConfigSync(string guid) { } public Entry AddConfigEntry<T>(ConfigEntry<T> configEntry) { if (_entries.TryGetValue((ConfigEntryBase)(object)configEntry, out var value)) { return value; } ConfigurationManagerAttributes val = ((ConfigEntryBase)configEntry).Description.Tags.OfType<ConfigurationManagerAttributes>().FirstOrDefault(); if (val == null) { throw new InvalidOperationException("Missing Jotunn sync tag for " + (object)((ConfigEntryBase)configEntry).Definition); } Entry entry = new Entry(this, val); _entries.Add((ConfigEntryBase)(object)configEntry, entry); return entry; } public Entry AddLockingConfigEntry<T>(ConfigEntry<T> lockingConfig) where T : IConvertible { Entry result = AddConfigEntry<T>(lockingConfig); lockingConfig.SettingChanged += delegate { UpdateLock(); }; UpdateLock(); return result; void UpdateLock() { _locked = Convert.ToInt32(lockingConfig.Value) != 0; foreach (Entry value in _entries.Values) { value.Refresh(); } } } } } namespace ItemManager { public static class PrefabManager { private static readonly Dictionary<string, AssetBundle> Bundles = new Dictionary<string, AssetBundle>(); public static AssetBundle RegisterAssetBundle(string name) { if (Bundles.TryGetValue(name, out var value)) { return value; } using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Forteca_Mithril_Forge.assets." + name); if (stream == null) { throw new InvalidOperationException("Workshop AssetBundle resource missing: " + name); } AssetBundle val = AssetBundle.LoadFromStream(stream); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Workshop AssetBundle cannot be loaded: " + name); } Bundles.Add(name, val); return val; } public static GameObject Load(string bundleName, string prefabId) { if (!Bundles.TryGetValue(bundleName, out var value)) { throw new InvalidOperationException("Unregistered bundle: " + bundleName); } GameObject val = value.LoadAsset<GameObject>(prefabId); if ((Object)(object)val == (Object)null || ((Object)val).name != prefabId) { throw new InvalidOperationException("Missing Workshop prefab: " + prefabId); } return val; } public static GameObject RegisterPrefab(AssetBundle bundle, string prefabId) { GameObject val = bundle.LoadAsset<GameObject>(prefabId); if ((Object)(object)val == (Object)null || ((Object)val).name != prefabId) { throw new InvalidOperationException("Missing Workshop prefab: " + prefabId); } PrefabManager.Instance.AddPrefab(val); return val; } } public sealed class Item { private static readonly List<Item> Items = new List<Item>(); public GameObject Prefab { get; } public RecipeSet Crafting { get; } = new RecipeSet(); public RequirementSet RequiredItems { get; } = new RequirementSet(); public RequirementSet RequiredUpgradeItems { get; } = new RequirementSet(); public int CraftAmount { get; set; } = 1; public ConfigEntryBase RecipeIsActive { get; set; } public Item(string bundleName, string prefabId) { Prefab = PrefabManager.Load(bundleName, prefabId); if ((Object)(object)Prefab.GetComponent<ItemDrop>() == (Object)null) { throw new InvalidOperationException("Missing ItemDrop: " + prefabId); } Items.Add(this); } public static void RegisterAll() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown foreach (Item item in Items) { if (!ItemManager.Instance.AddItem(new CustomItem(item.Prefab, true))) { throw new InvalidOperationException("Jotunn rejected Workshop item: " + ((Object)item.Prefab).name); } foreach (var station in item.Crafting.Stations) { List<string> list = new List<string>(); foreach (KeyValuePair<string, int> value2 in item.RequiredItems.Values) { if (IsMithrilMineItem(value2.Key)) { GameObject prefab = PrefabManager.Instance.GetPrefab(value2.Key); if ((Object)(object)prefab == (Object)null || (Object)(object)prefab.GetComponent<ItemDrop>() == (Object)null) { list.Add(value2.Key); } } } if (list.Count != 0) { Forteca_Mithril_ForgePlugin.Forteca_Mithril_ForgeLogger.LogWarning((object)("Recipe " + ((Object)item.Prefab).name + " requires MithrilMine ItemDrop prefabs: " + string.Join(", ", list) + ". Recipe not registered.")); continue; } RecipeConfig val = new RecipeConfig { Name = ((Object)item.Prefab).name + "_Recipe_Custom", Item = ((Object)item.Prefab).name, Amount = item.CraftAmount, CraftingStation = station.Station, MinStationLevel = station.Level, Enabled = (item.RecipeIsActive == null || Convert.ToInt32(item.RecipeIsActive.BoxedValue) == 1) }; foreach (KeyValuePair<string, int> value3 in item.RequiredItems.Values) { item.RequiredUpgradeItems.Values.TryGetValue(value3.Key, out var value); val.AddRequirement(value3.Key, value3.Value, value); } foreach (KeyValuePair<string, int> value4 in item.RequiredUpgradeItems.Values) { if (!item.RequiredItems.Values.ContainsKey(value4.Key)) { val.AddRequirement(new RequirementConfig(value4.Key, 0, value4.Value, false)); } } CustomRecipe recipe = new CustomRecipe(val); if (!ItemManager.Instance.AddRecipe(recipe)) { throw new InvalidOperationException("Jotunn rejected recipe: " + val.Name); } ConfigEntryBase recipeIsActive = item.RecipeIsActive; ConfigEntry<Forteca_Mithril_ForgePlugin.Toggle> toggle = recipeIsActive as ConfigEntry<Forteca_Mithril_ForgePlugin.Toggle>; if (toggle != null) { toggle.SettingChanged += delegate { recipe.Recipe.m_enabled = toggle.Value == Forteca_Mithril_ForgePlugin.Toggle.On; }; } } } } private static bool IsMithrilMineItem(string prefabName) { switch (prefabName) { case "BMM_Mithril": case "BMM_Warpstone": case "BMM_Meteorite": case "BMM_CorpseBonePowder": case "BMM_MithrilOre": return true; default: return false; } } } public sealed class RecipeSet { internal readonly List<(string Station, int Level)> Stations = new List<(string, int)>(); public void Add(string station, int level) { Stations.Add((station, level)); } } public sealed class RequirementSet { internal readonly Dictionary<string, int> Values = new Dictionary<string, int>(); public void Add(string item, int amount) { Values[item] = amount; } } } namespace LocalizationManager { public static class Localizer { public static void Load() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Forteca_Mithril_Forge.translations.English.yml"); using StreamReader streamReader = new StreamReader(stream ?? throw new InvalidOperationException("Workshop English localization is missing")); LocalizationManager.Instance.GetLocalization().AddYamlFile("English", streamReader.ReadToEnd()); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All)] internal sealed class _003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullableAttribute : Attribute { public _003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullableAttribute(byte value) { } public _003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullableAttribute(byte[] value) { } } [AttributeUsage(AttributeTargets.All)] internal sealed class _003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContextAttribute : Attribute { public _003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContextAttribute(byte value) { } } [AttributeUsage(AttributeTargets.All)] internal sealed class _003C74548e95_002D8ca9_002D4e21_002D8c3f_002D4112d795d976_003ENullableAttribute : Attribute { public _003C74548e95_002D8ca9_002D4e21_002D8c3f_002D4112d795d976_003ENullableAttribute(byte value) { } public _003C74548e95_002D8ca9_002D4e21_002D8c3f_002D4112d795d976_003ENullableAttribute(byte[] value) { } } [AttributeUsage(AttributeTargets.All)] internal sealed class _003C1b9dd524_002Dc7b9_002D4694_002D9d9a_002D4be22e370085_003ENullableContextAttribute : Attribute { public _003C1b9dd524_002Dc7b9_002D4694_002D9d9a_002D4be22e370085_003ENullableContextAttribute(byte value) { } } } namespace YourModNamespace { [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] [HarmonyPatch(typeof(ZDOMan), "GetPortals")] public static class PortalCustomAdd_GetPortals_Postfix { private static readonly string[] CustomPortalNames = new string[1] { "PortalFehu_Forteca" }; private const bool EnableDebug = true; private static void Postfix(ZDOMan __instance, Dictionary<SectorIndex, List<ZDO>> __result) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (__instance == null || __result == null) { return; } HashSet<ZDOID> hashSet = new HashSet<ZDOID>(); int num = 0; foreach (List<ZDO> value2 in __result.Values) { foreach (ZDO item in value2) { hashSet.Add(item.m_uid); num++; } } string[] customPortalNames = CustomPortalNames; foreach (string text in customPortalNames) { List<ZDO> list = new List<ZDO>(); int num2 = 0; while (!__instance.GetAllZDOsWithPrefabIterative(text, list, ref num2)) { } foreach (ZDO item2 in list) { if (hashSet.Add(item2.m_uid)) { SectorIndex sectorIndex = item2.GetSectorIndex(); if (!__result.TryGetValue(sectorIndex, out var value)) { value = new List<ZDO>(); __result.Add(sectorIndex, value); } value.Add(item2); } } } int num3 = hashSet.Count - num; if (num3 > 0) { Debug.Log((object)$"[PortalCustomAdd] GetPortals(): added {num3} custom portal ZDO(s). Total now: {hashSet.Count}"); } } } } namespace PieceManager { [PublicAPI] [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] public static class MaterialReplacer { [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(0)] public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader } private static readonly Dictionary<GameObject, bool> ObjectToSwap; private static readonly Dictionary<string, Material> OriginalMaterials; private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace; private static readonly HashSet<Shader> CachedShaders; private static bool hasRun; static MaterialReplacer() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown CachedShaders = new HashSet<Shader>(); hasRun = false; OriginalMaterials = new Dictionary<string, Material>(); ObjectToSwap = new Dictionary<GameObject, bool>(); ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>(); new Harmony("org.bepinex.helpers.PieceManager").Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type) { if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, type); } } public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false) { if (!ObjectToSwap.ContainsKey(go)) { ObjectToSwap.Add(go, isJotunnMock); } } private static void GetAllMaterials() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val in array) { OriginalMaterials[((Object)val).name] = val; } } [HarmonyPriority(700)] private static void ReplaceAllMaterialsWithOriginal() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun) { return; } if (OriginalMaterials.Count == 0) { GetAllMaterials(); } foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap) { GameObject key = item.Key; bool value = item.Value; ProcessGameObjectMaterials(key, value); } AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>(); foreach (AssetBundle val in array) { IEnumerable<Shader> enumerable2; try { IEnumerable<Shader> enumerable = ((val.isStreamedSceneAssetBundle && Object.op_Implicit((Object)(object)val)) ? (from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>) where (Object)shader != (Object)null select shader) : val.LoadAllAssets<Shader>()); enumerable2 = enumerable; } catch (Exception) { continue; } if (enumerable2 == null) { continue; } foreach (Shader item2 in enumerable2) { CachedShaders.Add(item2); } } foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace) { GameObject key2 = item3.Key; ShaderType value2 = item3.Value; ProcessGameObjectShaders(key2, value2); } hasRun = true; } private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); foreach (Renderer obj in componentsInChildren) { Material[] sharedMaterials = obj.sharedMaterials.Select([_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(0)] (Material material) => ReplaceMaterial(material, isJotunnMock)).ToArray(); obj.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_"); if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal)) { return originalMaterial; } string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, ""); if (OriginalMaterials.TryGetValue(text2, out var value)) { return value; } Debug.LogWarning((object)("No suitable material found to replace: " + text2)); return originalMaterial; } private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val in sharedMaterials) { if ((Object)val != (Object)null) { val.shader = GetShaderForType(val.shader, shaderType, ((Object)val.shader).name); } } } } private static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown return (Shader)(shaderType switch { ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), _ => FindShaderWithName(orig, "Standard"), }); } public static Shader FindShaderWithName(Shader origShader, string name) { foreach (Shader cachedShader in CachedShaders) { if (((Object)cachedShader).name == name) { return cachedShader; } } return origShader; } } public sealed class BuildPiece { private static readonly List<BuildPiece> Pieces = new List<BuildPiece>(); public static bool ConfigurationEnabled { get; set; } public GameObject Prefab { get; } public CategorySet Category { get; } = new CategorySet(); public RequirementSet RequiredItems { get; } = new RequirementSet(); public BuildPiece(string bundleName, string prefabId) { Prefab = PrefabManager.Load(bundleName, prefabId); if ((Object)(object)Prefab.GetComponent<Piece>() == (Object)null) { throw new InvalidOperationException("Missing Piece: " + prefabId); } Pieces.Add(this); } public static void RegisterAll() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown foreach (BuildPiece piece in Pieces) { Piece component = piece.Prefab.GetComponent<Piece>(); PieceConfig val = new PieceConfig { PieceTable = "_HammerPieceTable", Category = piece.Category.Value, Enabled = component.m_enabled, AllowedInDungeons = component.m_allowedInDungeons }; foreach (var value in piece.RequiredItems.Values) { val.AddRequirement(value.Item, value.Amount, value.Recover); } if (!PieceManager.Instance.AddPiece(new CustomPiece(piece.Prefab, true, val))) { throw new InvalidOperationException("Jotunn rejected Workshop piece: " + ((Object)piece.Prefab).name); } } } } public sealed class CategorySet { public string Value; public void Set(string value) { Value = value; } } public sealed class RequirementSet { internal readonly List<(string Item, int Amount, bool Recover)> Values = new List<(string, int, bool)>(); public void Add(string item, int amount, bool recover) { Values.Add((item, amount, recover)); } } } namespace Forteca_Mithril_Forge { [BepInPlugin("Forteca.Forteca_Mithril_Forge", "Forteca_Mithril_Forge", "420.101.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] public class Forteca_Mithril_ForgePlugin : BaseUnityPlugin { [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(0)] public enum Toggle { On = 1, Off = 0 } [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] private class AcceptableShortcuts : AcceptableValueBase { public AcceptableShortcuts() : base(typeof(KeyboardShortcut)) { } public override object Clamp(object value) { return value; } public override bool IsValid(object value) { return true; } public override string ToDescriptionString() { return "# Acceptable values: " + string.Join(", ", Enum.GetNames(typeof(KeyCode))); } } internal const string ModName = "Forteca_Mithril_Forge"; internal const string ModVersion = "420.101.1"; internal const string Author = "Forteca"; private const string ModGUID = "Forteca.Forteca_Mithril_Forge"; private static string ConfigFileName = "Forteca.Forteca_Mithril_Forge.cfg"; private static string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony; public static readonly ManualLogSource Forteca_Mithril_ForgeLogger; private static readonly ConfigSync ConfigSync; private static ConfigEntry<Toggle> _serverConfigLocked; private ConfigEntryBase _recipeIsActiveConfig; public void Awake() { //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Expected O, but got Unknown //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Expected O, but got Unknown //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Expected O, but got Unknown //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Expected O, but got Unknown //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Expected O, but got Unknown //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Expected O, but got Unknown //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Expected O, but got Unknown //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Expected O, but got Unknown //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Expected O, but got Unknown //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Expected O, but got Unknown //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Expected O, but got Unknown //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0785: Expected O, but got Unknown //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Expected O, but got Unknown //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Expected O, but got Unknown //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_0915: Expected O, but got Unknown //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09b9: Expected O, but got Unknown //IL_0a53: Unknown result type (might be due to invalid IL or missing references) //IL_0a5d: Expected O, but got Unknown //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0b03: Expected O, but got Unknown //IL_0b9f: Unknown result type (might be due to invalid IL or missing references) //IL_0ba9: Expected O, but got Unknown //IL_0c45: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Expected O, but got Unknown //IL_0ceb: Unknown result type (might be due to invalid IL or missing references) //IL_0cf5: Expected O, but got Unknown //IL_0d91: Unknown result type (might be due to invalid IL or missing references) //IL_0d9b: Expected O, but got Unknown //IL_0e37: Unknown result type (might be due to invalid IL or missing references) //IL_0e41: Expected O, but got Unknown //IL_0eff: Unknown result type (might be due to invalid IL or missing references) //IL_0f09: Expected O, but got Unknown //IL_0fc7: Unknown result type (might be due to invalid IL or missing references) //IL_0fd1: Expected O, but got Unknown //IL_108f: Unknown result type (might be due to invalid IL or missing references) //IL_1099: Expected O, but got Unknown //IL_1157: Unknown result type (might be due to invalid IL or missing references) //IL_1161: Expected O, but got Unknown //IL_121e: Unknown result type (might be due to invalid IL or missing references) //IL_1228: Expected O, but got Unknown //IL_12e5: Unknown result type (might be due to invalid IL or missing references) //IL_12ef: Expected O, but got Unknown //IL_13ad: Unknown result type (might be due to invalid IL or missing references) //IL_13b7: Expected O, but got Unknown //IL_1475: Unknown result type (might be due to invalid IL or missing references) //IL_147f: Expected O, but got Unknown //IL_153d: Unknown result type (might be due to invalid IL or missing references) //IL_1547: Expected O, but got Unknown //IL_1604: Unknown result type (might be due to invalid IL or missing references) //IL_160e: Expected O, but got Unknown //IL_16aa: Unknown result type (might be due to invalid IL or missing references) //IL_16b4: Expected O, but got Unknown Localizer.Load(); _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); AssetBundle bundle = PrefabManager.RegisterAssetBundle("forteca_mithril_forge"); BuildPiece.ConfigurationEnabled = true; PrefabManager.RegisterPrefab(bundle, "vfx_horn_staff_shield_sphere_Forteca"); PrefabManager.RegisterPrefab(bundle, "fx_horn_staff_shield_hit_Forteca"); PrefabManager.RegisterPrefab(bundle, "sfx_horn_staff_shield_break_Forteca"); PrefabManager.RegisterPrefab(bundle, "fx_horn_staff_shield_start_Forteca"); BuildPiece buildPiece = new BuildPiece("forteca_mithril_forge", "MithrilForge_Forteca"); buildPiece.RequiredItems.Add("Copper", 20, recover: true); buildPiece.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece2 = new BuildPiece("forteca_mithril_forge", "MithrilForge_ext1_Forteca"); buildPiece2.RequiredItems.Add("Copper", 20, recover: true); buildPiece2.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece2.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece2.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece3 = new BuildPiece("forteca_mithril_forge", "MithrilForge_ext2_Forteca"); buildPiece3.RequiredItems.Add("Copper", 20, recover: true); buildPiece3.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece3.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece3.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece4 = new BuildPiece("forteca_mithril_forge", "MithrilForge_ext3_Forteca"); buildPiece4.RequiredItems.Add("Copper", 30, recover: true); buildPiece4.RequiredItems.Add("RoundLog", 30, recover: true); buildPiece4.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece4.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece5 = new BuildPiece("forteca_mithril_forge", "PortalFehu_Forteca"); buildPiece5.RequiredItems.Add("Copper", 20, recover: true); buildPiece5.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece5.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece5.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece6 = new BuildPiece("forteca_mithril_forge", "ChestFehu_Forteca"); buildPiece6.RequiredItems.Add("Copper", 20, recover: true); buildPiece6.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece6.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece6.Prefab, MaterialReplacer.ShaderType.UseUnityShader); BuildPiece buildPiece7 = new BuildPiece("forteca_mithril_forge", "StatueOdin_Forteca"); buildPiece7.RequiredItems.Add("Copper", 20, recover: true); buildPiece7.RequiredItems.Add("RoundLog", 20, recover: true); buildPiece7.Category.Set("Mithril Forge"); MaterialReplacer.RegisterGameObjectForShaderSwap(buildPiece7.Prefab, MaterialReplacer.ShaderType.UseUnityShader); Item item = new Item("forteca_mithril_forge", "BMM_Sunstone"); item.Crafting.Add("MithrilForge_ext2_Forteca", 1); item.RequiredItems.Add("BMM_Mithril", 1); item.RequiredItems.Add("BMM_Warpstone", 1); item.RequiredItems.Add("BMM_Meteorite", 1); item.RequiredItems.Add("BMM_CorpseBonePowder", 1); item.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Sunstone", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item.RecipeIsActive = _recipeIsActiveConfig; Item item2 = new Item("forteca_mithril_forge", "BMM_Black_Mitril"); item2.Crafting.Add("MithrilForge_ext2_Forteca", 1); item2.RequiredItems.Add("BMM_MithrilOre", 1); item2.RequiredItems.Add("BlackMetalScrap", 1); item2.RequiredItems.Add("Ectoplasm", 3); item2.RequiredItems.Add("BMM_CorpseBonePowder", 4); item2.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item2.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Black Mitril", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item2.RecipeIsActive = _recipeIsActiveConfig; Item item3 = new Item("forteca_mithril_forge", "TokenCopper_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item3.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Copper", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item3.RecipeIsActive = _recipeIsActiveConfig; Item item4 = new Item("forteca_mithril_forge", "TokenTin_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item4.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Tin", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item4.RecipeIsActive = _recipeIsActiveConfig; Item item5 = new Item("forteca_mithril_forge", "TokenBronze_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item5.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Bronze", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item5.RecipeIsActive = _recipeIsActiveConfig; Item item6 = new Item("forteca_mithril_forge", "TokenIron_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item6.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Iron", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item6.RecipeIsActive = _recipeIsActiveConfig; Item item7 = new Item("forteca_mithril_forge", "TokenSilver_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item7.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Silver", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item7.RecipeIsActive = _recipeIsActiveConfig; Item item8 = new Item("forteca_mithril_forge", "TokenGold_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item8.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Gold", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item8.RecipeIsActive = _recipeIsActiveConfig; Item item9 = new Item("forteca_mithril_forge", "TokenBlackmetal_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item9.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Black Metal", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item9.RecipeIsActive = _recipeIsActiveConfig; Item item10 = new Item("forteca_mithril_forge", "TokenEitr_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item10.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Eitr", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item10.RecipeIsActive = _recipeIsActiveConfig; Item item11 = new Item("forteca_mithril_forge", "TokenFlametal_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item11.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Flametal", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item11.RecipeIsActive = _recipeIsActiveConfig; Item item12 = new Item("forteca_mithril_forge", "TokenAncientmetal_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item12.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Ancient Metal", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item12.RecipeIsActive = _recipeIsActiveConfig; Item item13 = new Item("forteca_mithril_forge", "TokenMithril_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item13.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Mithril", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item13.RecipeIsActive = _recipeIsActiveConfig; Item item14 = new Item("forteca_mithril_forge", "TokenMeteorite_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item14.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Meteorite", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item14.RecipeIsActive = _recipeIsActiveConfig; Item item15 = new Item("forteca_mithril_forge", "TokenWarpstone_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item15.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Warpstone", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item15.RecipeIsActive = _recipeIsActiveConfig; Item item16 = new Item("forteca_mithril_forge", "TokenSunstone_Forteca"); MaterialReplacer.RegisterGameObjectForShaderSwap(item16.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Token Warpstone", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item16.RecipeIsActive = _recipeIsActiveConfig; Item item17 = new Item("forteca_mithril_forge", "LeatherHardenedBlack_Forteca"); item17.Crafting.Add("MithrilForge_Forteca", 1); item17.RequiredItems.Add("TrollHide", 1); item17.RequiredItems.Add("DeerHide", 2); item17.RequiredItems.Add("LeatherScraps", 3); item17.RequiredItems.Add("Coal", 3); item17.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item17.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Hardened Leather Black", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item17.RecipeIsActive = _recipeIsActiveConfig; Item item18 = new Item("forteca_mithril_forge", "LeatherHardenedWhite_Forteca"); item18.Crafting.Add("MithrilForge_Forteca", 1); item18.RequiredItems.Add("TrollHide", 1); item18.RequiredItems.Add("DeerHide", 2); item18.RequiredItems.Add("LeatherScraps", 3); item18.RequiredItems.Add("BMM_CorpseBonePowder", 2); item18.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item18.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Hardened Leather Black", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item18.RecipeIsActive = _recipeIsActiveConfig; Item item19 = new Item("forteca_mithril_forge", "LeatherHardenedGrey_Forteca"); item19.Crafting.Add("MithrilForge_Forteca", 1); item19.RequiredItems.Add("TrollHide", 1); item19.RequiredItems.Add("DeerHide", 2); item19.RequiredItems.Add("LeatherScraps", 3); item19.RequiredItems.Add("Coal", 3); item19.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item19.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Hardened Leather Black", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item19.RecipeIsActive = _recipeIsActiveConfig; Item item20 = new Item("forteca_mithril_forge", "LeatherHardenedBrown_Forteca"); item20.Crafting.Add("MithrilForge_Forteca", 1); item20.RequiredItems.Add("TrollHide", 1); item20.RequiredItems.Add("DeerHide", 2); item20.RequiredItems.Add("LeatherScraps", 3); item20.RequiredItems.Add("Coal", 3); item20.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item20.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Hardened Leather Black", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item20.RecipeIsActive = _recipeIsActiveConfig; Item item21 = new Item("forteca_mithril_forge", "ArmorMirrorHelmetForteca"); item21.Crafting.Add("MithrilForge_Forteca", 2); item21.RequiredItems.Add("TrophyDragonQueen", 1); item21.RequiredItems.Add("Silver", 20); item21.RequiredUpgradeItems.Add("FreezeGland", 5); item21.RequiredUpgradeItems.Add("Silver", 10); item21.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item21.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorMirrorHelmetForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item21.RecipeIsActive = _recipeIsActiveConfig; Item item22 = new Item("forteca_mithril_forge", "ArmorMirrorChestForteca"); item22.Crafting.Add("MithrilForge_Forteca", 2); item22.RequiredItems.Add("TrophyDragonQueen", 1); item22.RequiredItems.Add("Silver", 20); item22.RequiredUpgradeItems.Add("FreezeGland", 5); item22.RequiredUpgradeItems.Add("Silver", 10); item22.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item22.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorMirrorChestForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item22.RecipeIsActive = _recipeIsActiveConfig; Item item23 = new Item("forteca_mithril_forge", "ArmorMirrorLegsForteca"); item23.Crafting.Add("MithrilForge_Forteca", 2); item23.RequiredItems.Add("TrophyDragonQueen", 1); item23.RequiredItems.Add("Silver", 20); item23.RequiredUpgradeItems.Add("FreezeGland", 5); item23.RequiredUpgradeItems.Add("Silver", 10); item23.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item23.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorMirrorLegsForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item23.RecipeIsActive = _recipeIsActiveConfig; Item item24 = new Item("forteca_mithril_forge", "ArmorMirrorCapeForteca"); item24.Crafting.Add("MithrilForge_Forteca", 2); item24.RequiredItems.Add("TrophyDragonQueen", 1); item24.RequiredItems.Add("Silver", 20); item24.RequiredUpgradeItems.Add("FreezeGland", 5); item24.RequiredUpgradeItems.Add("Silver", 10); item24.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item24.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorMirrorCapeForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item24.RecipeIsActive = _recipeIsActiveConfig; Item item25 = new Item("forteca_mithril_forge", "ShieldMirrorForteca"); item25.Crafting.Add("MithrilForge_Forteca", 2); item25.RequiredItems.Add("TrophyDragonQueen", 1); item25.RequiredItems.Add("Silver", 20); item25.RequiredUpgradeItems.Add("FreezeGland", 5); item25.RequiredUpgradeItems.Add("Silver", 10); item25.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item25.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ShieldMirrorForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item25.RecipeIsActive = _recipeIsActiveConfig; Item item26 = new Item("forteca_mithril_forge", "SwordMirrorForteca"); item26.Crafting.Add("MithrilForge_Forteca", 2); item26.RequiredItems.Add("TrophyDragonQueen", 1); item26.RequiredItems.Add("Silver", 20); item26.RequiredUpgradeItems.Add("FreezeGland", 5); item26.RequiredUpgradeItems.Add("Silver", 10); item26.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item26.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("SwordMirrorForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item26.RecipeIsActive = _recipeIsActiveConfig; Item item27 = new Item("forteca_mithril_forge", "ArmorJarlChestForteca"); item27.Crafting.Add("MithrilForge_Forteca", 2); item27.RequiredItems.Add("ArmorPaddedCuirass", 1); item27.RequiredItems.Add("BlackMetal", 20); item27.RequiredItems.Add("TrophyGoblinShaman", 1); item27.RequiredItems.Add("LoxPelt", 1); item27.RequiredUpgradeItems.Add("BlackMetal", 10); item27.RequiredUpgradeItems.Add("LinenThread", 5); item27.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item27.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorJarlChestForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item27.RecipeIsActive = _recipeIsActiveConfig; Item item28 = new Item("forteca_mithril_forge", "ArmorJarlLegsForteca"); item28.Crafting.Add("MithrilForge_Forteca", 2); item28.RequiredItems.Add("ArmorPaddedGreaves", 1); item28.RequiredItems.Add("BlackMetal", 20); item28.RequiredItems.Add("TrophyGrowth", 1); item28.RequiredItems.Add("LoxPelt", 1); item28.RequiredUpgradeItems.Add("BlackMetal", 10); item28.RequiredUpgradeItems.Add("LinenThread", 5); item28.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item28.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorJarlLegsForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item28.RecipeIsActive = _recipeIsActiveConfig; Item item29 = new Item("forteca_mithril_forge", "ArmorJarlHelmetForteca"); item29.Crafting.Add("MithrilForge_Forteca", 2); item29.RequiredItems.Add("HelmetPadded", 1); item29.RequiredItems.Add("BlackMetal", 20); item29.RequiredItems.Add("TrophyGoblin", 1); item29.RequiredItems.Add("LoxPelt", 1); item29.RequiredUpgradeItems.Add("BlackMetal", 10); item29.RequiredUpgradeItems.Add("LinenThread", 5); item29.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item29.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorJarlHelmetForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item29.RecipeIsActive = _recipeIsActiveConfig; Item item30 = new Item("forteca_mithril_forge", "ArmorJarlCrownForteca"); item30.Crafting.Add("MithrilForge_Forteca", 2); item30.RequiredItems.Add("HelmetPadded", 1); item30.RequiredItems.Add("BlackMetal", 20); item30.RequiredItems.Add("TrophyGoblin", 1); item30.RequiredItems.Add("LoxPelt", 1); item30.RequiredUpgradeItems.Add("BlackMetal", 10); item30.RequiredUpgradeItems.Add("LinenThread", 5); item30.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item30.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorJarlCrownForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item30.RecipeIsActive = _recipeIsActiveConfig; Item item31 = new Item("forteca_mithril_forge", "ArmorJarlCapeForteca"); item31.Crafting.Add("MithrilForge_Forteca", 2); item31.RequiredItems.Add("CapeLox", 1); item31.RequiredItems.Add("BlackMetal", 10); item31.RequiredItems.Add("TrophyLox", 1); item31.RequiredItems.Add("LoxPelt", 1); item31.RequiredUpgradeItems.Add("BlackMetal", 5); item31.RequiredUpgradeItems.Add("LinenThread", 5); item31.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item31.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorJarlCapeForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item31.RecipeIsActive = _recipeIsActiveConfig; Item item32 = new Item("forteca_mithril_forge", "AxeDualJarlForteca"); item32.Crafting.Add("MithrilForge_Forteca", 2); item32.RequiredItems.Add("CapeLox", 1); item32.RequiredItems.Add("BlackMetal", 10); item32.RequiredItems.Add("TrophyLox", 1); item32.RequiredItems.Add("LoxPelt", 1); item32.RequiredUpgradeItems.Add("BlackMetal", 5); item32.RequiredUpgradeItems.Add("LinenThread", 5); item32.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item32.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("AxeDualJarlForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item32.RecipeIsActive = _recipeIsActiveConfig; Item item33 = new Item("forteca_mithril_forge", "ArmorFehuChestForteca"); item33.Crafting.Add("MithrilForge_Forteca", 2); item33.RequiredItems.Add("ArmorPaddedCuirass", 1); item33.RequiredItems.Add("BlackMetal", 20); item33.RequiredItems.Add("TrophyGoblinShaman", 1); item33.RequiredItems.Add("LoxPelt", 1); item33.RequiredUpgradeItems.Add("BlackMetal", 10); item33.RequiredUpgradeItems.Add("LinenThread", 5); item33.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item33.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorFehuChestForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item33.RecipeIsActive = _recipeIsActiveConfig; Item item34 = new Item("forteca_mithril_forge", "ArmorFehuLegsForteca"); item34.Crafting.Add("MithrilForge_Forteca", 2); item34.RequiredItems.Add("ArmorPaddedGreaves", 1); item34.RequiredItems.Add("BlackMetal", 20); item34.RequiredItems.Add("TrophyGrowth", 1); item34.RequiredItems.Add("LoxPelt", 1); item34.RequiredUpgradeItems.Add("BlackMetal", 10); item34.RequiredUpgradeItems.Add("LinenThread", 5); item34.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item34.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorFehuLegsForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item34.RecipeIsActive = _recipeIsActiveConfig; Item item35 = new Item("forteca_mithril_forge", "ArmorFehuHelmetForteca"); item35.Crafting.Add("MithrilForge_Forteca", 2); item35.RequiredItems.Add("HelmetPadded", 1); item35.RequiredItems.Add("BlackMetal", 20); item35.RequiredItems.Add("TrophyGoblin", 1); item35.RequiredItems.Add("LoxPelt", 1); item35.RequiredUpgradeItems.Add("BlackMetal", 10); item35.RequiredUpgradeItems.Add("LinenThread", 5); item35.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item35.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorFehuHelmetForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item35.RecipeIsActive = _recipeIsActiveConfig; Item item36 = new Item("forteca_mithril_forge", "ArmorFehuCapeForteca"); item36.Crafting.Add("MithrilForge_Forteca", 2); item36.RequiredItems.Add("CapeLox", 1); item36.RequiredItems.Add("BlackMetal", 10); item36.RequiredItems.Add("TrophyLox", 1); item36.RequiredItems.Add("LoxPelt", 1); item36.RequiredUpgradeItems.Add("BlackMetal", 5); item36.RequiredUpgradeItems.Add("LinenThread", 5); item36.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item36.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("ArmorFehuCapeForteca", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item36.RecipeIsActive = _recipeIsActiveConfig; Item item37 = new Item("forteca_mithril_forge", "StaffHornShield_Forteca"); item37.Crafting.Add("MithrilForge_Forteca", 1); item37.RequiredItems.Add("TrophyDragonQueen", 1); item37.RequiredItems.Add("Silver", 20); item37.RequiredUpgradeItems.Add("FreezeGland", 5); item37.RequiredUpgradeItems.Add("Silver", 10); item37.CraftAmount = 1; MaterialReplacer.RegisterGameObjectForShaderSwap(item37.Prefab, MaterialReplacer.ShaderType.UseUnityShader); _recipeIsActiveConfig = (ConfigEntryBase)config("Horn Shield", "IsRecipeEnabled", Toggle.On, "Determines if the recipe is enabled for this prefab"); item37.RecipeIsActive = _recipeIsActiveConfig; Item.RegisterAll(); BuildPiece.RegisterAll(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { ((BaseUnityPlugin)this).Config.Reload(); } catch { Forteca_Mithril_ForgeLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); Forteca_Mithril_ForgeLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<[_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown object[] array = new object[description.Tags.Length + 1]; Array.Copy(description.Tags, array, description.Tags.Length); array[^1] = (object)new ConfigurationManagerAttributes { IsAdminOnly = synchronizedSetting }; ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, array); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); ConfigSync.AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<[_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } public Forteca_Mithril_ForgePlugin() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown _harmony = new Harmony("Forteca.Forteca_Mithril_Forge"); } static Forteca_Mithril_ForgePlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; Forteca_Mithril_ForgeLogger = Logger.CreateLogSource("Forteca_Mithril_Forge"); ConfigSync = new ConfigSync("Forteca.Forteca_Mithril_Forge") { DisplayName = "Forteca_Mithril_Forge", CurrentVersion = "420.101.1", MinimumRequiredVersion = "420.101.1" }; _serverConfigLocked = null; } } public static class KeyboardExtensions { public static bool IsKeyDown(this KeyboardShortcut shortcut) { //IL_0002: 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) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey); } return false; } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //IL_0002: 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) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey)) { return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey); } return false; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown peer.m_rpc.Register<ZPackage>("Forteca_Mithril_Forge_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_Forteca_Mithril_Forge_Version); ZPackage val = new ZPackage(); val.Write("420.101.1"); peer.m_rpc.Invoke("Forteca_Mithril_Forge_VersionCheck", new object[1] { val }); } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] public static class RpcHandlers { public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>(); public static void RPC_Forteca_Mithril_Forge_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); if (text != "420.101.1") { Forteca_Mithril_ForgePlugin.ConnectionError = "Forteca_Mithril_Forge Installed: 420.101.1\n Needed: " + text; if (ZNet.instance.IsServer()) { Forteca_Mithril_ForgePlugin.Forteca_Mithril_ForgeLogger.LogWarning((object)("Peer (" + rpc.GetSocket().GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (ZNet.instance.IsServer()) { ValidatedPeers.Add(rpc); } } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMin = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + Forteca_Mithril_ForgePlugin.ConnectionError; } } } [_003Ccd08f64f_002Df709_002D4359_002D93ed_002Df403cd525eb9_003ENullableContext(1)] [_003Ca2ff485d_002D5194_002D49ac_002D941d_002D246281eaf05f_003ENullable(0)] [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } Forteca_Mithril_ForgePlugin.Forteca_Mithril_ForgeLogger.LogWarning((object)("Peer (" + rpc.GetSocket().GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting")); rpc.Invoke("Error", new object[1] { 3 }); return false; } } }