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 HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using LocationManager; using Microsoft.CodeAnalysis; using MithrilMine.Functions; using PieceManager; using ServerSync; using SoftReferenceableAssets; using TMPro; using UnityEngine; 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: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MithrilMine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("blacks7ar")] [assembly: AssemblyProduct("MithrilMine")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8A93715A-276C-4B6A-BF7F-C593AA8FD600")] [assembly: AssemblyFileVersion("420.101.5")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("420.101.5.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; } } } public class MBeacon : MonoBehaviour { public float m_range = 20f; public static List m_instances = new List(); public void Awake() { m_instances.Add(this); } public void OnDestroy() { m_instances.Remove(this); } public static MBeacon FindClosestBeaconInRange(Vector3 point) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown MBeacon mBeacon = null; float num = 999999f; foreach (MBeacon instance in m_instances) { float num2 = Vector3.Distance(point, ((Component)instance).transform.position); if (num2 < instance.m_range && ((Object)mBeacon == (Object)null || num2 < num)) { mBeacon = instance; num = num2; } } return mBeacon; } public static void FindBeaconsInRange(Vector3 point, List beacons) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) foreach (MBeacon instance in m_instances) { if (Vector3.Distance(point, ((Component)instance).transform.position) < instance.m_range) { beacons.Add(instance); } } } } public class ElevatorShaft : MonoBehaviour { public bool m_canMove = true; public float m_speed = 2f; public int m_startPoint; public Transform[] m_points; private int i; private bool m_reverse; public void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = m_points[m_startPoint].position; i = m_startPoint; } public void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)this).transform.position, m_points[i].position) < 0.01f) { m_canMove = false; if (i == m_points.Length - 1) { m_reverse = true; i--; return; } if (i == 0) { m_reverse = false; i++; return; } if (m_reverse) { i--; } else { i++; } } if (m_canMove) { ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, m_points[i].position, m_speed * Time.deltaTime); } } } public class ElevatorShaftSwitch : MonoBehaviour, Hoverable, Interactable { public ElevatorShaft m_elevator; private string m_name = "$bmm_elevatorshaft"; public string GetHoverText() { return Localization.instance.Localize(m_name + "\n[$KEY_Use] $bmm_activate"); } public string GetHoverName() { return m_name; } public float GetHoverOffset() { return 0f; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if (m_elevator.m_canMove) { return true; } m_elevator.m_canMove = true; return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } public class ParentPlatformShaft : MonoBehaviour { private void OnCollisionEnter(Collision other) { other.transform.SetParent(((Component)this).transform); other.gameObject.GetComponent().interpolation = (RigidbodyInterpolation)0; } private void OnCollisionExit(Collision other) { other.transform.SetParent((Transform)null); other.gameObject.GetComponent().interpolation = (RigidbodyInterpolation)1; } } namespace MithrilMine { [BepInPlugin("blacks7ar.MithrilMine", "MithrilMine", "420.101.5")] public class Plugin : BaseUnityPlugin { private enum Toggle { On = 1, Off = 0 } [HarmonyPatch] private static class Patches { private static readonly List _vegetationList = new List(); [HarmonyPostfix] [HarmonyPatch(typeof(ZNetScene), "Awake")] private static void ZNetSceneAwake_Postfix(ZNetScene __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown if (!((Object)(object)__instance == (Object)null) && __instance.m_prefabs.Count > 0) { InitMine(__instance); __instance.GetPrefab("smelter").GetComponent().m_conversion.AddRange(new List { new ItemConversion { m_from = __instance.GetPrefab("BMM_MithrilOre").GetComponent(), m_to = __instance.GetPrefab("BMM_Mithril").GetComponent() }, new ItemConversion { m_from = __instance.GetPrefab("BMM_MeteoriteOre").GetComponent(), m_to = __instance.GetPrefab("BMM_Meteorite").GetComponent() }, new ItemConversion { m_from = __instance.GetPrefab("BMM_WarpstoneOre").GetComponent(), m_to = __instance.GetPrefab("BMM_Warpstone").GetComponent() } }); ItemDrop component = __instance.GetPrefab("BMM_MithrilCultivator").GetComponent(); GameObject val = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((GameObject x) => ((Object)x).name == "_CultivatorPieceTable")); component.m_itemData.m_shared.m_buildPieces = ((val != null) ? val.GetComponent() : null); ItemDrop component2 = __instance.GetPrefab("BMM_MithrilHammer").GetComponent(); GameObject val2 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((GameObject x) => ((Object)x).name == "_HammerPieceTable")); component2.m_itemData.m_shared.m_buildPieces = ((val2 != null) ? val2.GetComponent() : null); ItemDrop component3 = __instance.GetPrefab("BMM_MithrilHoe").GetComponent(); GameObject val3 = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)((GameObject x) => ((Object)x).name == "_HoePieceTable")); component3.m_itemData.m_shared.m_buildPieces = ((val3 != null) ? val3.GetComponent() : null); ItemDrop component4 = __instance.GetPrefab("BMM_MithrilPickaxe").GetComponent(); ItemDrop component5 = __instance.GetPrefab("PickaxeBlackMetal").GetComponent(); component4.m_itemData.m_shared.m_spawnOnHitTerrain = component5?.m_itemData.m_shared.m_spawnOnHitTerrain; } } [HarmonyPostfix] [HarmonyPatch(typeof(EnvMan), "OnMorning")] private static void OnMorning_Postfix(EnvMan __instance) { if (_enableReset.Value == Toggle.Off) { return; } List list = new List(); for (int i = 1; i <= 1000 / _resetDay.Value; i++) { int item = _resetDay.Value * i; list.Add(item); } int currentDay = __instance.GetDay(); foreach (int item2 in list.Where((int num2) => num2 == currentDay)) { ResetMines(); Debug.Log((object)("MithrilMine reset day! Current Day: " + currentDay + " / Reset Day: " + item2)); } } [HarmonyPrefix] [HarmonyPatch(typeof(Terminal), "InputText")] private static bool InputText_Prefix(Terminal __instance) { if (((TMP_InputField)__instance.m_input).text.TrimEnd(Array.Empty()).ToLower() != "/mithrilmines reset") { return true; } ResetMines(); __instance.AddString("Resetting mines.. Done!"); return false; } [HarmonyPrefix] [HarmonyPatch(typeof(ZoneSystem), "ValidateVegetation")] private static void ValidateVegetation_Prefix(ZoneSystem __instance) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: 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_00ca: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown foreach (ZoneVegetation vegetation in _vegetationList) { __instance.m_vegetation.Remove(vegetation); } _vegetationList.Clear(); ZoneVegetation item = new ZoneVegetation { m_prefab = _mithrilDeposit, m_enable = true, m_min = _mithrilDepositMin.Value, m_max = _mithrilDepositMax.Value, m_scaleMin = 1f, m_scaleMax = 1.2f, m_biome = _mithrilDepositBiome.Value, m_biomeArea = (BiomeArea)2, m_blockCheck = true, m_minAltitude = -0.5f, m_maxAltitude = 1000f, m_maxTerrainDelta = 2f, m_groundOffset = _mithrilDepositGroundOffset.Value, m_groupSizeMin = _mithrilDepositGroupSizeMin.Value, m_groupSizeMax = _mithrilDepositGroupSizeMax.Value, m_groupRadius = _mithrilDepositGroupRadius.Value }; ZoneVegetation item2 = new ZoneVegetation { m_prefab = _warpstoneDeposit, m_enable = true, m_min = _warpstoneDepositMin.Value, m_max = _warpstoneDepositMax.Value, m_scaleMin = 1f, m_scaleMax = 1.2f, m_biome = _warpstoneDepositBiome.Value, m_biomeArea = (BiomeArea)2, m_blockCheck = true, m_minAltitude = -0.5f, m_maxAltitude = 1000f, m_maxTerrainDelta = 2f, m_groundOffset = _warpstoneDepositGroundOffset.Value, m_groupSizeMin = _warpstoneDepositGroupSizeMin.Value, m_groupSizeMax = _warpstoneDepositGroupSizeMax.Value, m_groupRadius = _warpstoneDepositGroupRadius.Value }; ZoneVegetation item3 = new ZoneVegetation { m_prefab = _meteoriteDeposit, m_enable = true, m_min = _meteoriteDepositMin.Value, m_max = _meteoriteDepositMax.Value, m_scaleMin = 1f, m_scaleMax = 1.2f, m_biome = _meteoriteDepositBiome.Value, m_biomeArea = (BiomeArea)2, m_blockCheck = true, m_minAltitude = -0.5f, m_maxAltitude = 1000f, m_maxTerrainDelta = 2f, m_groundOffset = _meteoriteDepositGroundOffset.Value, m_groupSizeMin = _meteoriteDepositGroupSizeMin.Value, m_groupSizeMax = _meteoriteDepositGroupSizeMax.Value, m_groupRadius = _meteoriteDepositGroupRadius.Value }; _vegetationList.Add(item); _vegetationList.Add(item2); _vegetationList.Add(item3); foreach (ZoneVegetation vegetation2 in _vegetationList) { __instance.m_vegetation.Add(vegetation2); } } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] private static void GetTotalFoodValue_Postfix(ref Player __instance, ref float eitr) { if (!((Object)(object)__instance == (Object)null)) { SetEitr(__instance, "bmm_eitrbelt_se", _eitrBeltEitrBonus.Value, ref eitr); SetEitr(__instance, "bmm_mithril_earring", _eitr.Value, ref eitr); } } private static void ResetMines() { DestroyAllVeins(); if (!(AccessTools.Field(typeof(Location), "s_allLocations")?.GetValue(null) is List source)) { return; } foreach (RandomSpawn[] item in from location in source where ((Object)((Component)location).gameObject).name.Contains("MithrilMine") select ((Component)location).GetComponentsInChildren(true)) { if (item == null || item.Length <= 0) { continue; } RandomSpawn[] array = item; foreach (RandomSpawn val in array) { Destructible[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (Destructible val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { ((Component)val2).gameObject.SetActive(true); } } MineRock[] componentsInChildren2 = ((Component)val).GetComponentsInChildren(true); foreach (MineRock val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null)) { ((Component)val3).gameObject.SetActive(true); } } CreatureSpawner[] components = ((Component)val).GetComponents(); foreach (CreatureSpawner val4 in components) { if (!((Object)(object)val4 == (Object)null)) { ((Component)val4).gameObject.SetActive(true); val4.m_respawnTimeMinuts = 0f; } } val.m_chanceToSpawn = _oreSpawnChance.Value; val.Prepare(); bool flag = Random.Range(0f, 100f) <= val.m_chanceToSpawn; AccessTools.Method(typeof(RandomSpawn), "SetSpawned", (Type[])null, (Type[])null)?.Invoke(val, new object[1] { flag }); } } } private static void DestroyAllVeins() { if (!(AccessTools.Field(typeof(Location), "s_allLocations")?.GetValue(null) is List source)) { return; } foreach (RandomSpawn[] item in from location in source where ((Object)((Component)location).gameObject).name.Contains("MithrilMine") select ((Component)location).GetComponentsInChildren(true)) { if (item == null || item.Length <= 0) { continue; } RandomSpawn[] array = item; foreach (RandomSpawn val in array) { Destructible[] componentsInChildren = ((Component)val).GetComponentsInChildren(false); foreach (Destructible val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && ((Behaviour)val2).isActiveAndEnabled) { ZNetScene.instance.Destroy(((Component)val2).gameObject); } } MineRock[] componentsInChildren2 = ((Component)val).GetComponentsInChildren(false); foreach (MineRock val3 in componentsInChildren2) { if (!((Object)(object)val3 == (Object)null) && ((Behaviour)val3).isActiveAndEnabled) { ZNetScene.instance.Destroy(((Component)val3).gameObject); } } } } } } private const string modGUID = "blacks7ar.MithrilMine"; public const string modName = "MithrilMine"; public const string modAuthor = "blacks7ar"; public const string modVersion = "420.101.5"; public const string modLink = ""; private static readonly Harmony _harmony = new Harmony("blacks7ar.MithrilMine"); private static readonly ConfigSync _configSync = new ConfigSync("blacks7ar.MithrilMine") { DisplayName = "MithrilMine", CurrentVersion = "420.101.5", MinimumRequiredVersion = "420.101.5", ModRequired = true }; private static ConfigEntry _serverConfigLocked; private static ConfigEntry _resetDay; private static ConfigEntry _enableReset; private static ConfigEntry _oreSpawnChance; private static ConfigEntry _mithrilMineDropMin; private static ConfigEntry _mithrilMineDropMax; private static ConfigEntry _mithrilMineMaxCount; private static ConfigEntry _eitr; private static ConfigEntry _mithrilDepositMin; private static ConfigEntry _mithrilDepositMax; private static ConfigEntry _mithrilDepositBiome; private static ConfigEntry _mithrilDepositGroundOffset; private static ConfigEntry _mithrilDepositGroupSizeMin; private static ConfigEntry _mithrilDepositGroupSizeMax; private static ConfigEntry _mithrilDepositGroupRadius; private static ConfigEntry _warpstoneDepositMin; private static ConfigEntry _warpstoneDepositMax; private static ConfigEntry _warpstoneDepositBiome; private static ConfigEntry _warpstoneDepositGroundOffset; private static ConfigEntry _warpstoneDepositGroupSizeMin; private static ConfigEntry _warpstoneDepositGroupSizeMax; private static ConfigEntry _warpstoneDepositGroupRadius; private static ConfigEntry _meteoriteDepositMin; private static ConfigEntry _meteoriteDepositMax; private static ConfigEntry _meteoriteDepositBiome; private static ConfigEntry _meteoriteDepositGroundOffset; private static ConfigEntry _meteoriteDepositGroupSizeMin; private static ConfigEntry _meteoriteDepositGroupSizeMax; private static ConfigEntry _meteoriteDepositGroupRadius; public static ConfigEntry _dvergrBeltEitrRegen; public static ConfigEntry _eitrBeltEitrBonus; public static ConfigEntry _elementalistBeltSkillBonus; public static ConfigEntry _hogwartsBeltDmgMultiplier; public static ConfigEntry _necromancerBeltSkillBonus; private static AssetBundle _mithrilBundle; private static GameObject _mithrilMine01; private static GameObject _mithrilMine02; private static GameObject _mithrilDeposit; private static GameObject _warpstoneDeposit; private static GameObject _meteoriteDeposit; private ConfigEntry config(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 val2 = ((BaseUnityPlugin)this).Config.Bind(group, name, value, val); _configSync.AddConfigEntry(val2).SynchronizedConfig = synchronizedConfig; return val2; } public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Expected O, but got Unknown //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Expected O, but got Unknown //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Expected O, but got Unknown //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Expected O, but got Unknown //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Expected O, but got Unknown //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Expected O, but got Unknown //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Expected O, but got Unknown //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Expected O, but got Unknown //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Expected O, but got Unknown //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Expected O, but got Unknown //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Expected O, but got Unknown //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Expected O, but got Unknown //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Expected O, but got Unknown //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Expected O, but got Unknown //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0edc: Unknown result type (might be due to invalid IL or missing references) //IL_0ee3: Unknown result type (might be due to invalid IL or missing references) //IL_1899: Unknown result type (might be due to invalid IL or missing references) //IL_18a3: Unknown result type (might be due to invalid IL or missing references) //IL_18ab: Unknown result type (might be due to invalid IL or missing references) //IL_18b0: Unknown result type (might be due to invalid IL or missing references) //IL_1966: Unknown result type (might be due to invalid IL or missing references) //IL_1970: Unknown result type (might be due to invalid IL or missing references) //IL_1978: Unknown result type (might be due to invalid IL or missing references) //IL_197d: Unknown result type (might be due to invalid IL or missing references) //IL_2320: Unknown result type (might be due to invalid IL or missing references) //IL_2400: Unknown result type (might be due to invalid IL or missing references) //IL_241a: Unknown result type (might be due to invalid IL or missing references) //IL_2493: Unknown result type (might be due to invalid IL or missing references) //IL_2495: Unknown result type (might be due to invalid IL or missing references) //IL_25d6: Unknown result type (might be due to invalid IL or missing references) 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())); _configSync.AddLockingConfigEntry(_serverConfigLocked); _enableReset = config("2- General", "Enable Mine Reset", Toggle.On, new ConfigDescription("If On, mines contents will be reset according to Reset Day value.", (AcceptableValueBase)null, Array.Empty())); _resetDay = config("2- General", "Reset Day", 15, new ConfigDescription("How many in-game days needed to reset the content of the mine.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 200), Array.Empty())); _oreSpawnChance = config("2- General", "Ore Veins Spawn Chance", 50f, new ConfigDescription("Percentage chance that the ore veins will spawn upon mine generation and reset.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 100f), Array.Empty())); _mithrilMineDropMin = config("3- OreDeposits Drop Settings", "CoalMine DropMin", 6, new ConfigDescription("Minimum drops from coal deposits.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _mithrilMineDropMax = config("3- OreDeposits Drop Settings", "CoalMine DropMax", 8, new ConfigDescription("Maximum drops from coal deposits.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 15), Array.Empty())); _mithrilMineMaxCount = config("2- General", "Mine Max Count", 50, new ConfigDescription("Maximum number of mines to be spawned per biome.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), Array.Empty())); _mithrilBundle = Location.PrefabManager.RegisterAssetBundle("mithrilbundle"); _eitr = config("2- General", "Earrings Eitr", 34f, new ConfigDescription("Additional eitr given to player when equip.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 100f), Array.Empty())); _mithrilDepositMin = config("3- Mithril Deposit", "Minimum", 3, new ConfigDescription("Minimum amount of mithril deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _mithrilDepositMax = config("3- Mithril Deposit", "Maximum", 5, new ConfigDescription("Maximum amount of mithril deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _mithrilDepositBiome = config("3- Mithril Deposit", "Biome", (Biome)895, new ConfigDescription("Which biome does mithril deposits spawns to.", (AcceptableValueBase)null, Array.Empty())); _mithrilDepositGroundOffset = config("3- Mithril Deposit", "Ground Offset", -5f, new ConfigDescription("How deep the mithril deposit will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(-5f, 0f), Array.Empty())); _mithrilDepositGroupSizeMin = config("3- Mithril Deposit", "Group Size Min", 1, new ConfigDescription("Minimum amount of mithril deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _mithrilDepositGroupSizeMax = config("3- Mithril Deposit", "Group Size Max", 3, new ConfigDescription("Maximum amount of mithril deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _mithrilDepositGroupRadius = config("3- Mithril Deposit", "Group Radius", 666f, new ConfigDescription("How far each group will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 1000f), Array.Empty())); _warpstoneDepositMin = config("4- Warpstone Deposit", "Minimum", 3, new ConfigDescription("Minimum amount of warpstone deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _warpstoneDepositMax = config("4- Warpstone Deposit", "Maximum", 5, new ConfigDescription("Maximum amount of warpstone deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _warpstoneDepositBiome = config("4- Warpstone Deposit", "Biome", (Biome)895, new ConfigDescription("Which biome does warpstone deposits spawns to.", (AcceptableValueBase)null, Array.Empty())); _warpstoneDepositGroundOffset = config("4- Warpstone Deposit", "Ground Offset", -5f, new ConfigDescription("How deep the warpstone deposit will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(-5f, 0f), Array.Empty())); _warpstoneDepositGroupSizeMin = config("4- Warpstone Deposit", "Group Size Min", 1, new ConfigDescription("Minimum amount of warpstone deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _warpstoneDepositGroupSizeMax = config("4- Warpstone Deposit", "Group Size Max", 3, new ConfigDescription("Maximum amount of warpstone deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _warpstoneDepositGroupRadius = config("4- Warpstone Deposit", "Group Radius", 666f, new ConfigDescription("How far each group will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 1000f), Array.Empty())); _meteoriteDepositMin = config("5- Meteorite Deposit", "Minimum", 3, new ConfigDescription("Minimum amount of meteorite deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _meteoriteDepositMax = config("5- Meteorite Deposit", "Maximum", 5, new ConfigDescription("Maximum amount of meteorite deposit to be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 20), Array.Empty())); _meteoriteDepositBiome = config("5- Meteorite Deposit", "Biome", (Biome)895, new ConfigDescription("Which biome does meteorite deposits spawns to.", (AcceptableValueBase)null, Array.Empty())); _meteoriteDepositGroundOffset = config("5- Meteorite Deposit", "Ground Offset", -5f, new ConfigDescription("How deep the meteorite deposit will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(-5f, 0f), Array.Empty())); _meteoriteDepositGroupSizeMin = config("5- Meteorite Deposit", "Group Size Min", 1, new ConfigDescription("Minimum amount of meteorite deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _meteoriteDepositGroupSizeMax = config("Meteorite Deposit", "Group Size Max", 3, new ConfigDescription("Maximum amount of meteorite deposit to be spawned in a group.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 10), Array.Empty())); _meteoriteDepositGroupRadius = config("5- Meteorite Deposit", "Group Radius", 666f, new ConfigDescription("How far each group will be spawned.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 1000f), Array.Empty())); _dvergrBeltEitrRegen = config("6- Belts", "Dvergr Belt Eitr Regen", 1f, new ConfigDescription("Dvergr belt eitr regen bonus.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); _eitrBeltEitrBonus = config("6- Belts", "Eitr Belt Eitr Bonus", 72f, new ConfigDescription("Eitr belt eitr bonus.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 200f), Array.Empty())); _elementalistBeltSkillBonus = config("6- Belts", "Elementalist Belt Skill Bonus", 30f, new ConfigDescription("Skill bonus added to ElementalMagic skill level.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 50f), Array.Empty())); _hogwartsBeltDmgMultiplier = config("6- Belts", "Hogwarts Belt Damage Multiplier", 3f, new ConfigDescription("Hogwarts belt elemental damage multiplier.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 5f), Array.Empty())); _necromancerBeltSkillBonus = config("6- Belts", "Necromancer Belt Skill Bonus", 30f, new ConfigDescription("Skill bonus added to BloodMagic skill level.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 50f), Array.Empty())); Location.ConfigurationEnabled = false; _mithrilMine01 = _mithrilBundle.LoadAsset("BMM_MithrilMine01"); Location obj = new Location(_mithrilMine01) { CanSpawn = true, ClearArea = true, Biome = (Biome)64, SpawnArea = (BiomeArea)3, Count = _mithrilMineMaxCount.Value, GroupName = "OreMines", MinimumDistanceFromGroup = 500f, Rotation = Rotation.Slope, HeightDelta = new LocationManager.Range(0f, 40f), ForestThreshold = new LocationManager.Range(0f, 1f), SpawnAltitude = new LocationManager.Range(0.5f, 150f), SpawnDistance = new LocationManager.Range(500f, 10000f) }; ShaderReplacer.Replace(_mithrilMine01); obj.CreatureSpawner.Add("Spawner_Ulv", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (1)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (2)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (3)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (4)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (5)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (6)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (7)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (8)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (9)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (10)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (11)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (12)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (13)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (14)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (15)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (16)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (17)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (18)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (19)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (20)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (21)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (22)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (23)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (24)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (25)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (26)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (27)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (28)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (29)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (30)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (31)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (32)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (33)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (34)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (35)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (36)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (37)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (38)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (39)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (40)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (41)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (42)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (43)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (44)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (45)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (46)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (47)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (48)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (49)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (50)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (51)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (52)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (54)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (55)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (56)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (57)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (58)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (59)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (60)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (61)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Ulv (62)", "Wolf"); obj.CreatureSpawner.Add("Spawner_Cultist", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (1)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (2)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (3)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (4)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (5)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (6)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (7)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (8)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (9)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (10)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (11)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (12)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (13)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (14)", "Fenring_Cultist"); obj.CreatureSpawner.Add("Spawner_Cultist (15)", "Fenring_Cultist"); obj.CreatureSpawner.Add("ExteriorSpawner_Fenring", "Fenring"); obj.CreatureSpawner.Add("ExteriorSpawner_Fenring (1)", "Fenring"); obj.CreatureSpawner.Add("ExteriorSpawner_Fenring (2)", "Fenring"); obj.CreatureSpawner.Add("ExteriorSpawner_Fenring (3)", "Fenring"); obj.CreatureSpawner.Add("ExteriorSpawner_Fenring (4)", "Fenring"); obj.CreatureSpawner.Add("ExteriorSpawner_Cultist", "Fenring_Cultist"); obj.CreatureSpawner.Add("ExteriorSpawner_Cultist (1)", "Fenring_Cultist"); obj.CreatureSpawner.Add("ExteriorSpawner_Cultist (2)", "Fenring_Cultist"); _mithrilMine02 = _mithrilBundle.LoadAsset("BMM_MithrilMine02"); Location obj2 = new Location(_mithrilMine02) { CanSpawn = true, ClearArea = true, Biome = (Biome)16, SpawnArea = (BiomeArea)3, Count = _mithrilMineMaxCount.Value, GroupName = "OreMines", MinimumDistanceFromGroup = 500f, Rotation = Rotation.Slope, HeightDelta = new LocationManager.Range(0f, 40f), ForestThreshold = new LocationManager.Range(0f, 1f), SpawnAltitude = new LocationManager.Range(0.5f, 1000f), SpawnDistance = new LocationManager.Range(500f, 10000f) }; ShaderReplacer.Replace(_mithrilMine02); obj2.CreatureSpawner.Add("Spawner_Goblin", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (1)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (2)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (3)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (4)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (5)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (6)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (7)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (8)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (9)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (10)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (11)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (12)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (13)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (14)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (15)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (16)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (17)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (18)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (19)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (20)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (21)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (22)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (23)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (24)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (25)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (26)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (27)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (28)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (29)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (30)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (31)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (32)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (33)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (34)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (35)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (36)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (37)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (38)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (39)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (40)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (41)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (42)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (43)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (44)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (45)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (46)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (47)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (48)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (49)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (50)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (51)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (52)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (53)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (54)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (55)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (56)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (57)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (58)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (59)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_Goblin (60)", "Goblin"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (1)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (2)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (3)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (4)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (5)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (6)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (7)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (8)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (9)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (10)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (11)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (12)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (13)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (14)", "GoblinShaman"); obj2.CreatureSpawner.Add("Spawner_GoblinShaman (15)", "GoblinShaman"); obj2.CreatureSpawner.Add("ExteriorSpawner_Goblin", "Goblin"); obj2.CreatureSpawner.Add("ExteriorSpawner_Goblin (1)", "Goblin"); obj2.CreatureSpawner.Add("ExteriorSpawner_Goblin (2)", "Goblin"); obj2.CreatureSpawner.Add("ExteriorSpawner_Goblin (3)", "Goblin"); obj2.CreatureSpawner.Add("ExteriorSpawner_GoblinBrute", "GoblinBrute"); obj2.CreatureSpawner.Add("ExteriorSpawner_GoblinBrute (1)", "GoblinBrute"); obj2.CreatureSpawner.Add("ExteriorSpawner_GoblinShaman", "GoblinShaman"); obj2.CreatureSpawner.Add("ExteriorSpawner_GoblinShaman (1)", "GoblinShaman"); new Item(_mithrilBundle, "BMM_Mithril").Configurable = Configurability.Disabled; Item item = new Item(_mithrilBundle, "BMM_MithrilCoins"); item.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item.RequiredItems.Add("BMM_Mithril", 1); item.CraftAmount = 10; item.Configurable = Configurability.Recipe; new Item(_mithrilBundle, "BMM_MithrilOre").Configurable = Configurability.Disabled; Item item2 = new Item(_mithrilBundle, "BMM_Earring_Eitr"); item2.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item2.RequiredItems.Add("BMM_Mithril", 15); item2.RequiredItems.Add("Copper", 10); item2.Configurable = Configurability.Recipe; ItemData itemData = item2.Prefab.GetComponent().m_itemData; SE_AddEitr statEffect = ScriptableObject.CreateInstance(); ((Object)statEffect).name = "bmm_mithril_earring"; ((StatusEffect)statEffect).m_name = "$bmm_earring_eitr"; ((StatusEffect)statEffect).m_icon = itemData.GetIcon(); _eitr.SettingChanged += delegate { statEffect.SetEitr(_eitr.Value); }; statEffect.SetEitr(_eitr.Value); itemData.m_shared.m_equipStatusEffect = (StatusEffect)(object)statEffect; Item item3 = new Item(_mithrilBundle, "BMM_Earring_EitrRegen"); item3.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item3.RequiredItems.Add("BMM_Mithril", 25); item3.RequiredItems.Add("Bronze", 20); item3.Configurable = Configurability.Recipe | Configurability.Stats; Item item4 = new Item(_mithrilBundle, "BMM_Earring_FireResist"); item4.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item4.RequiredItems.Add("BMM_Mithril", 35); item4.RequiredItems.Add("Iron", 30); item4.Configurable = Configurability.Recipe; ItemData itemData2 = item4.Prefab.GetComponent().m_itemData; SE_Stats val = ScriptableObject.CreateInstance(); ((Object)val).name = "bmm_mithrilearring_fireresist"; ((StatusEffect)val).m_name = itemData2.m_shared.m_name; ((StatusEffect)val).m_icon = itemData2.GetIcon(); val.m_mods = new List(1) { new DamageModPair { m_type = (DamageType)32, m_modifier = (DamageModifier)5 } }; itemData2.m_shared.m_equipStatusEffect = (StatusEffect)(object)val; Item item5 = new Item(_mithrilBundle, "BMM_Earring_FrostResist"); item5.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item5.RequiredItems.Add("BMM_Mithril", 45); item5.RequiredItems.Add("Silver", 40); item5.Configurable = Configurability.Recipe; ItemData itemData3 = item5.Prefab.GetComponent().m_itemData; SE_Stats val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "bmm_mithrilearring_frostresist"; ((StatusEffect)val2).m_name = itemData3.m_shared.m_name; ((StatusEffect)val2).m_icon = itemData3.GetIcon(); val2.m_mods = new List(1) { new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)5 } }; itemData3.m_shared.m_equipStatusEffect = (StatusEffect)(object)val2; Item item6 = new Item(_mithrilBundle, "BMM_MithrilGreatSword"); item6.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item6.RequiredItems.Add("BMM_Mithril", 35); item6.RequiredItems.Add("Silver", 40); item6.RequiredItems.Add("Iron", 34); item6.RequiredUpgradeItems.Add("BMM_Mithril", 17); item6.RequiredUpgradeItems.Add("Silver", 20); item6.Configurable = Configurability.Recipe | Configurability.Stats; Item item7 = new Item(_mithrilBundle, "BMM_MithrilKnife"); item7.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item7.RequiredItems.Add("BMM_Mithril", 22); item7.RequiredItems.Add("Silver", 16); item7.RequiredItems.Add("Iron", 12); item7.RequiredUpgradeItems.Add("BMM_Mithril", 11); item7.RequiredUpgradeItems.Add("Silver", 8); item7.RequiredUpgradeItems.Add("Iron", 6); item7.Configurable = Configurability.Recipe | Configurability.Stats; Item item8 = new Item(_mithrilBundle, "BMM_MithrilSword"); item8.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item8.RequiredItems.Add("BMM_Mithril", 28); item8.RequiredItems.Add("Silver", 34); item8.RequiredItems.Add("Iron", 26); item8.RequiredUpgradeItems.Add("BMM_Mithril", 14); item8.RequiredUpgradeItems.Add("Silver", 17); item8.RequiredUpgradeItems.Add("Iron", 13); item8.Configurable = Configurability.Recipe | Configurability.Stats; Item item9 = new Item(_mithrilBundle, "BMM_MithrilAxe"); item9.Crafting.Add(ItemManager.CraftingTable.Forge, 4); item9.RequiredItems.Add("AxeBlackMetal", 1); item9.RequiredItems.Add("BMM_Mithril", 55); item9.RequiredItems.Add("BlackMetal", 35); item9.RequiredItems.Add("Silver", 40); item9.Configurable = Configurability.Recipe | Configurability.Stats; Item item10 = new Item(_mithrilBundle, "BMM_MithrilCultivator"); item10.Crafting.Add(ItemManager.CraftingTable.Forge, 4); item10.RequiredItems.Add("Cultivator", 1); item10.RequiredItems.Add("BMM_Mithril", 30); item10.RequiredItems.Add("Silver", 20); item10.RequiredItems.Add("Iron", 15); item10.Configurable = Configurability.Recipe | Configurability.Stats; Item item11 = new Item(_mithrilBundle, "BMM_MithrilHammer"); item11.Crafting.Add(ItemManager.CraftingTable.Forge, 4); item11.RequiredItems.Add("Hammer", 1); item11.RequiredItems.Add("BMM_Mithril", 25); item11.RequiredItems.Add("Silver", 15); item11.RequiredItems.Add("Iron", 10); item11.Configurable = Configurability.Recipe | Configurability.Stats; Item item12 = new Item(_mithrilBundle, "BMM_MithrilHoe"); item12.Crafting.Add(ItemManager.CraftingTable.Forge, 4); item12.RequiredItems.Add("Hoe", 1); item12.RequiredItems.Add("BMM_Mithril", 15); item12.RequiredItems.Add("Silver", 10); item12.RequiredItems.Add("Iron", 10); item12.Configurable = Configurability.Recipe | Configurability.Stats; Item item13 = new Item(_mithrilBundle, "BMM_MithrilPickaxe"); item13.Crafting.Add(ItemManager.CraftingTable.Forge, 4); item13.RequiredItems.Add("PickaxeBlackMetal", 1); item13.RequiredItems.Add("BMM_Mithril", 40); item13.RequiredItems.Add("BlackMetal", 25); item13.RequiredItems.Add("Silver", 30); item13.Configurable = Configurability.Recipe | Configurability.Stats; Item item14 = new Item(_mithrilBundle, "BMM_GoldenWishbone"); ItemData itemData4 = item14.Prefab.GetComponent().m_itemData; SE_MithrilFinder sE_MithrilFinder = ScriptableObject.CreateInstance(); ((StatusEffect)sE_MithrilFinder).m_icon = itemData4.GetIcon(); itemData4.m_shared.m_equipStatusEffect = (StatusEffect)(object)sE_MithrilFinder; item14.DropsFrom.Add("Eikthyr", 1f, 1, 1, levelMultiplier: false); item14.Trade.Trader = Trader.Haldor; item14.Trade.Price = 2500u; item14.Trade.Stack = 1u; item14.Trade.RequiredGlobalKey = "defeated_eikthyr"; ShaderReplacer.Replace(item14.Prefab); BuildPiece buildPiece = new BuildPiece(_mithrilBundle, "BMM_MithrilStack"); buildPiece.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece.Category.Set(BuildPieceCategory.Misc); buildPiece.RequiredItems.Add("BMM_Mithril", 30, recover: true); buildPiece.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece2 = new BuildPiece(_mithrilBundle, "BMM_MeteoriteStack"); buildPiece2.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece2.Category.Set(BuildPieceCategory.Misc); buildPiece2.RequiredItems.Add("BMM_Meteorite", 30, recover: true); buildPiece2.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; BuildPiece buildPiece3 = new BuildPiece(_mithrilBundle, "BMM_WarpstoneStack"); buildPiece3.Crafting.Set(PieceManager.CraftingTable.Workbench); buildPiece3.Category.Set(BuildPieceCategory.Misc); buildPiece3.RequiredItems.Add("BMM_Warpstone", 30, recover: true); buildPiece3.SpecialProperties = new SpecialProperties { AdminOnly = false, NoConfig = false }; new Item(_mithrilBundle, "BMM_WarpstoneOre").Configurable = Configurability.Disabled; new Item(_mithrilBundle, "BMM_MeteoriteOre").Configurable = Configurability.Disabled; Item item15 = new Item(_mithrilBundle, "BMM_CorpseBonePowder"); item15["Corpse Bone Powder (BoneFragments)"].Crafting.Add(ItemManager.CraftingTable.Workbench, 1); item15["Corpse Bone Powder (BoneFragments)"].RequiredItems.Add("BoneFragments", 1); item15["Corpse Bone Powder (Chitin)"].Crafting.Add("BMM_MithrilTable", 1); item15["Corpse Bone Powder (Chitin)"].RequiredItems.Add("Chitin", 1); item15["Corpse Bone Powder (Chitin)"].CraftAmount = 2; item15.Configurable = Configurability.Recipe; Item item16 = new Item(_mithrilBundle, "BMM_MeteoriteDust"); item16.Crafting.Add(ItemManager.CraftingTable.Workbench, 1); item16.RequiredItems.Add("BMM_MeteoriteOre", 1); item16.RequiredItems.Add("BMM_CorpseBonePowder", 1); item16.Configurable = Configurability.Recipe; Item item17 = new Item(_mithrilBundle, "BMM_MithrilDust"); item17.Crafting.Add(ItemManager.CraftingTable.Workbench, 1); item17.RequiredItems.Add("BMM_MithrilOre", 1); item17.RequiredItems.Add("BMM_CorpseBonePowder", 1); item17.Configurable = Configurability.Recipe; Item item18 = new Item(_mithrilBundle, "BMM_WarpstoneDust"); item18.Crafting.Add(ItemManager.CraftingTable.Workbench, 1); item18.RequiredItems.Add("BMM_WarpstoneOre", 1); item18.RequiredItems.Add("BMM_CorpseBonePowder", 1); item18.Configurable = Configurability.Recipe; Item item19 = new Item(_mithrilBundle, "BMM_DvergrBelt"); item19.Crafting.Add(ItemManager.CraftingTable.ArtisanTable, 1); item19.RequiredItems.Add("Thunderstone", 6); item19.RequiredItems.Add("Amber", 10); item19.RequiredItems.Add("BlackMetal", 12); item19.RequiredItems.Add("YggdrasilWood", 18); item19.Configurable = Configurability.Recipe; DvergrBelt(item19.Prefab.GetComponent().m_itemData); Item item20 = new Item(_mithrilBundle, "BMM_EitrBelt"); item20.Crafting.Add(ItemManager.CraftingTable.ArtisanTable, 1); item20.RequiredItems.Add("Thunderstone", 6); item20.RequiredItems.Add("AmberPearl", 10); item20.RequiredItems.Add("BlackMetal", 12); item20.RequiredItems.Add("Eitr", 18); item20.Configurable = Configurability.Recipe; ItemData itemData5 = item20.Prefab.GetComponent().m_itemData; SE_AddEitr statEffect5 = ScriptableObject.CreateInstance(); ((Object)statEffect5).name = "bmm_eitrbelt_se"; ((StatusEffect)statEffect5).m_name = "Wizards Belt"; ((StatusEffect)statEffect5).m_icon = itemData5.GetIcon(); _eitrBeltEitrBonus.SettingChanged += delegate { statEffect5.SetEitr(_eitrBeltEitrBonus.Value); }; statEffect5.SetEitr(_eitrBeltEitrBonus.Value); itemData5.m_shared.m_equipStatusEffect = (StatusEffect)(object)statEffect5; Item item21 = new Item(_mithrilBundle, "BMM_ElementalistBelt"); item21.Crafting.Add(ItemManager.CraftingTable.ArtisanTable, 1); item21.RequiredItems.Add("Thunderstone", 6); item21.RequiredItems.Add("Ruby", 10); item21.RequiredItems.Add("BlackMetal", 12); item21.RequiredItems.Add("ElderBark", 18); item21.Configurable = Configurability.Recipe; ItemData itemData6 = item21.Prefab.GetComponent().m_itemData; SE_Stats val3 = ScriptableObject.CreateInstance(); ((Object)val3).name = "bmm_eitrbelt_se"; ((StatusEffect)val3).m_name = itemData6.m_shared.m_name; ((StatusEffect)val3).m_icon = itemData6.GetIcon(); val3.m_skillLevel = (SkillType)9; val3.m_skillLevelModifier = _elementalistBeltSkillBonus.Value; itemData6.m_shared.m_equipStatusEffect = (StatusEffect)(object)val3; Item item22 = new Item(_mithrilBundle, "BMM_HogwartsBelt"); item22.Crafting.Add(ItemManager.CraftingTable.ArtisanTable, 1); item22.RequiredItems.Add("Thunderstone", 6); item22.RequiredItems.Add("Ruby", 10); item22.RequiredItems.Add("BlackMetal", 12); item22.RequiredItems.Add("Eitr", 18); item22.Configurable = Configurability.Recipe; ItemData itemData7 = item22.Prefab.GetComponent().m_itemData; SE_Stats val4 = ScriptableObject.CreateInstance(); ((Object)val4).name = "bmm_hogwartsbelt_se"; ((StatusEffect)val4).m_name = itemData7.m_shared.m_name; ((StatusEffect)val4).m_icon = itemData7.GetIcon(); val4.m_modifyAttackSkill = (SkillType)9; val4.m_damageModifier = _hogwartsBeltDmgMultiplier.Value; val4.m_percentigeDamageModifiers = new DamageTypes { m_fire = _hogwartsBeltDmgMultiplier.Value / 10f, m_frost = _hogwartsBeltDmgMultiplier.Value / 10f, m_lightning = _hogwartsBeltDmgMultiplier.Value / 10f, m_poison = _hogwartsBeltDmgMultiplier.Value / 10f, m_spirit = _hogwartsBeltDmgMultiplier.Value / 10f }; itemData7.m_shared.m_equipStatusEffect = (StatusEffect)(object)val4; Item item23 = new Item(_mithrilBundle, "BMM_LightBelt"); item23.Crafting.Add(ItemManager.CraftingTable.Workbench, 1); item23.RequiredItems.Add("SurtlingCore", 4); item23.RequiredItems.Add("GreydwarfEye", 20); item23.RequiredItems.Add("Bronze", 22); item23.RequiredItems.Add("Resin", 28); item23.Configurable = Configurability.Recipe; Item item24 = new Item(_mithrilBundle, "BMM_NecromancerBelt"); item24.Crafting.Add(ItemManager.CraftingTable.ArtisanTable, 1); item24.RequiredItems.Add("YmirRemains", 6); item24.RequiredItems.Add("Eitr", 18); item24.RequiredItems.Add("BlackMetal", 12); item24.RequiredItems.Add("YggdrasilWood", 18); item24.Configurable = Configurability.Recipe; ItemData itemData8 = item24.Prefab.GetComponent().m_itemData; SE_Stats val5 = ScriptableObject.CreateInstance(); ((Object)val5).name = "bmm_necromancer_se"; ((StatusEffect)val5).m_name = itemData8.m_shared.m_name; ((StatusEffect)val5).m_icon = itemData8.GetIcon(); val5.m_skillLevel = (SkillType)10; val5.m_skillLevelModifier = _necromancerBeltSkillBonus.Value; itemData8.m_shared.m_equipStatusEffect = (StatusEffect)(object)val5; new Item(_mithrilBundle, "BMM_Meteorite").Configurable = Configurability.Disabled; Item item25 = new Item(_mithrilBundle, "BMM_MeteoriteCoins"); item25.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item25.RequiredItems.Add("BMM_Meteorite", 1); item25.CraftAmount = 10; item25.Configurable = Configurability.Recipe; new Item(_mithrilBundle, "BMM_Warpstone").Configurable = Configurability.Disabled; Item item26 = new Item(_mithrilBundle, "BMM_WarpstoneCoins"); item26.Crafting.Add(ItemManager.CraftingTable.Forge, 1); item26.RequiredItems.Add("BMM_Warpstone", 1); item26.CraftAmount = 10; item26.Configurable = Configurability.Recipe; _mithrilDeposit = PrefabManager.RegisterPrefab(_mithrilBundle, "BMM_MineRock_Mithril"); _warpstoneDeposit = PrefabManager.RegisterPrefab(_mithrilBundle, "BMM_MineRock_Warpstone"); _meteoriteDeposit = PrefabManager.RegisterPrefab(_mithrilBundle, "BMM_MineRock_Meteorite"); ShaderReplacer.Replace(PrefabManager.RegisterPrefab(_mithrilBundle, "bmm_InteriorEnvironmentZoneForce")); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_fx_block_camshake"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_fx_hit_camshake"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_fx_hit_camshake_knife"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_fx_swing_camshake"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_arrow_hit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_axe_hit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_axe_swing"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_build_cultivator"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_build_hammer_default"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_build_hammer_metal"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_build_hoe"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_knife_swing"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_kromsword_swing"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_metal_blocked"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_metalgate_close"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_metalgate_open"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_pickaxe_hit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_pickaxe_swing"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_rock_destroyed"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_rock_hit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_sword_hit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_sfx_sword_swing"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_blocked"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_clubhit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_HitSparks"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_Place_stone_floor"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_RockDestroyed"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_RockDestroyed_Obsidian"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_RockHit"); PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_RockHit_Obsidian"); ShaderReplacer.Replace(PrefabManager.RegisterPrefab(_mithrilBundle, "_bmm_vfx_WishbonePing")); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; ((BaseUnityPlugin)this).Config.Save(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private static void InitMine(ZNetScene zNetScene) { MineRock[] componentsInChildren = _mithrilMine01.GetComponentsInChildren(true); MineRock[] componentsInChildren2 = _mithrilMine02.GetComponentsInChildren(true); int mineDropMin; _mithrilMineDropMin.SettingChanged += delegate { mineDropMin = _mithrilMineDropMin.Value; }; mineDropMin = _mithrilMineDropMin.Value; int mineDropMax; _mithrilMineDropMax.SettingChanged += delegate { mineDropMax = _mithrilMineDropMax.Value; }; mineDropMax = _mithrilMineDropMax.Value; LinkDrop(zNetScene, componentsInChildren, mineDropMin, mineDropMax); LinkDrop(zNetScene, componentsInChildren2, mineDropMin, mineDropMax); } private static void LinkDrop(ZNetScene zNetScene, MineRock[] mineRock, int dropMin, int dropMax) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (mineRock != null) { foreach (MineRock obj in mineRock) { obj.m_dropItems.m_drops = new List(2) { new DropData { m_item = zNetScene.GetPrefab("BMM_MithrilOre"), m_stackMin = 1, m_stackMax = 1, m_weight = 0.85f }, new DropData { m_item = zNetScene.GetPrefab("Stone"), m_stackMin = 1, m_stackMax = 1, m_weight = 1f } }; obj.m_dropItems.m_dropMin = dropMin; obj.m_dropItems.m_dropMax = dropMax; } } } private static void DvergrBelt(ItemData item) { _dvergrBeltEitrRegen.SettingChanged += delegate { item.m_shared.m_eitrRegenModifier = _dvergrBeltEitrRegen.Value; }; item.m_shared.m_eitrRegenModifier = _dvergrBeltEitrRegen.Value; } private static void SetEitr(Player player, string statEffect, float amount, ref float eitr) { if (((Character)player).GetSEMan().HaveStatusEffect(StringExtensionMethods.GetStableHashCode(statEffect))) { eitr += amount; } } } } namespace MithrilMine.Functions { public class SE_AddEitr : StatusEffect { public float m_eitr; public void Awake() { base.m_tooltip = $"Boost wearer's Eitr by +{m_eitr}."; } public void SetEitr(float eitr) { m_eitr = eitr; base.m_tooltip = $"Boost wearer's Eitr by +{m_eitr}."; } } public class SE_MithrilFinder : StatusEffect { public EffectList m_pingEffectNear = new EffectList(); public EffectList m_pingEffectMed = new EffectList(); public EffectList m_pingEffectFar = new EffectList(); public float m_closeTriggerDistance = 2f; public float m_furtherTriggerDistance = 4f; public float m_closeFrequency = 0.5f; public float m_distantFrequency = 5f; public float m_updateBeaconTimer; public float m_pingTimer; public MBeacon m_beacon; public float m_lastDistance; public void Awake() { ((Object)this).name = "SE_MithrilFinder"; base.m_name = "$bmm_mithrilfinder"; base.m_tooltip = "$bmm_mithrilfinder_tooltip"; } public override void Setup(Character character) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown m_pingEffectNear.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("_bmm_vfx_WishbonePing"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_WishbonePing_near"), m_enabled = true, m_variant = -1 } }; m_pingEffectMed.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("_bmm_vfx_WishbonePing"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_WishbonePing_med"), m_enabled = true, m_variant = -1 } }; m_pingEffectFar.m_effectPrefabs = (EffectData[])(object)new EffectData[2] { new EffectData { m_prefab = ZNetScene.instance.GetPrefab("_bmm_vfx_WishbonePing"), m_enabled = true, m_variant = -1 }, new EffectData { m_prefab = ZNetScene.instance.GetPrefab("sfx_WishbonePing_far"), m_enabled = true, m_variant = -1 } }; ((StatusEffect)this).Setup(character); } public override void UpdateStatusEffect(float dt) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) m_updateBeaconTimer += dt; if (m_updateBeaconTimer > 1f) { m_updateBeaconTimer = 0f; MBeacon mBeacon = MBeacon.FindClosestBeaconInRange(((Component)base.m_character).transform.position); if ((Object)(object)mBeacon != (Object)(object)m_beacon) { m_beacon = mBeacon; if (Object.op_Implicit((Object)(object)m_beacon)) { m_lastDistance = Utils.DistanceXZ(((Component)base.m_character).transform.position, ((Component)mBeacon).transform.position); m_pingTimer = 0f; } } } if (!((Object)(object)m_beacon != (Object)null)) { return; } float num = Mathf.Clamp01(Utils.DistanceXZ(((Component)base.m_character).transform.position, ((Component)m_beacon).transform.position) / m_beacon.m_range); float num2 = Mathf.Lerp(m_closeFrequency, m_distantFrequency, num); m_pingTimer += dt; if (!(m_pingTimer > num2)) { return; } m_pingTimer = 0f; if (!(num < 0.2f)) { if (num < 0.6f) { m_pingEffectMed.Create(((Component)base.m_character).transform.position, ((Component)base.m_character).transform.rotation, ((Component)base.m_character).transform, 1f, -1, default(ZDOID)); } else { m_pingEffectNear.Create(((Component)base.m_character).transform.position, ((Component)base.m_character).transform.rotation, ((Component)base.m_character).transform, 1f, -1, default(ZDOID)); } } else { m_pingEffectNear.Create(((Component)base.m_character).transform.position, ((Component)base.m_character).transform.rotation, ((Component)base.m_character).transform, 1f, -1, default(ZDOID)); } } } public static class ShaderReplacer { private static readonly List 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(); new Harmony("blacks7ar.utilities.ShaderReplacer").Patch((MethodBase)AccessTools.Method(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(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(); foreach (Shader val in array) { if (((Object)item.shader).name == ((Object)val).name) { item.shader = val; } } } } } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace ItemManager { [PublicAPI] internal enum CraftingTable { Disabled, Inventory, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("blackforge")] BlackForge, [InternalName("piece_preptable")] FoodPreparationTable, [InternalName("piece_MeadCauldron")] MeadKetill, Custom } [PublicAPI] internal enum ConversionPiece { Disabled, [InternalName("smelter")] Smelter, [InternalName("charcoal_kiln")] CharcoalKiln, [InternalName("blastfurnace")] BlastFurnace, [InternalName("windmill")] Windmill, [InternalName("piece_spinningwheel")] SpinningWheel, [InternalName("eitrrefinery")] EitrRefinery, Custom } internal class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] internal class RequiredResourceList { public readonly List Requirements = new List(); public bool Free; public void Add(string itemName, int amount, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amount = amount, quality = quality }); } public void Add(string itemName, ConfigEntry amountConfig, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amountConfig = amountConfig, quality = quality }); } } [PublicAPI] internal class CraftingStationList { public readonly List Stations = new List(); public void Add(CraftingTable table, int level) { Stations.Add(new CraftingStationConfig { Table = table, level = level }); } public void Add(string customTable, int level) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, level = level, custom = customTable }); } } [PublicAPI] internal class ItemRecipe { public readonly RequiredResourceList RequiredItems = new RequiredResourceList(); public readonly RequiredResourceList RequiredUpgradeItems = new RequiredResourceList(); public readonly CraftingStationList Crafting = new CraftingStationList(); public int CraftAmount = 1; public bool RequireOnlyOneIngredient; public float QualityResultAmountMultiplier = 1f; public ConfigEntryBase? RecipeIsActive; } [PublicAPI] internal class Trade { public Trader Trader; public uint Price; public uint Stack = 1u; public string? RequiredGlobalKey; } [PublicAPI] [Flags] internal enum Trader { None = 0, Haldor = 1, Hildir = 2 } internal struct Requirement { public string itemName; public int amount; public ConfigEntry? amountConfig; [Description("Set to a non-zero value to apply the requirement only for a specific quality")] public int quality; } internal struct CraftingStationConfig { public CraftingTable Table; public int level; public string? custom; } [Flags] internal enum Configurability { Disabled = 0, Recipe = 1, Stats = 2, Drop = 4, Trader = 8, Full = 0xF } [PublicAPI] internal class DropTargets { public readonly List Drops = new List(); public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true) { Drops.Add(new DropTarget { creature = creatureName, chance = chance, min = min, max = (max ?? min), levelMultiplier = levelMultiplier }); } } internal struct DropTarget { public string creature; public int min; public int max; public float chance; public bool levelMultiplier; } internal enum Toggle { On = 1, Off = 0 } [PublicAPI] internal class Item { private class ItemConfig { public ConfigEntry? craft; public ConfigEntry? upgrade; public ConfigEntry table; public ConfigEntry tableLevel; public ConfigEntry customTable; public ConfigEntry? maximumTableLevel; public ConfigEntry requireOneIngredient; public ConfigEntry qualityResultAmountMultiplier; } private class TraderConfig { public ConfigEntry trader; public ConfigEntry price; public ConfigEntry stack; public ConfigEntry requiredGlobalKey; } private class RequirementQuality { public int quality; } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; public Func? browsability; } [PublicAPI] public enum DamageModifier { Normal, Resistant, Weak, Immune, Ignore, VeryResistant, VeryWeak, None } private delegate void setDmgFunc(ref DamageTypes dmg, float value); private class SerializedRequirements { public readonly List Reqs; public SerializedRequirements(List reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) : this(reqs.Split(new char[1] { ',' }).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); int result; int result2; return new Requirement { itemName = array[0], amount = ((array.Length <= 1 || !int.TryParse(array[1], out result)) ? 1 : result), quality = ((array.Length > 2 && int.TryParse(array[2], out result2)) ? result2 : 0) }; }).ToList()) { } public override string ToString() { return string.Join(",", Reqs.Select((Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : ""))); } public static ItemDrop? fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop obj = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if ((Object)(object)obj == (Object)null) { Debug.LogWarning((object)("The required item '" + name + "' does not exist.")); } return obj; } public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0194: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown Dictionary dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func)((Requirement r) => r.itemName), (Func)delegate(Requirement r) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown ItemDrop val6 = ResItem(r); return (val6 != null) ? new Requirement { m_amount = (r.amountConfig?.Value ?? r.amount), m_resItem = val6, m_amountPerLevel = 0 } : ((Requirement)null); }); List list = dictionary.Values.Where((Requirement v) => v != null).ToList(); foreach (Requirement item in upgrade.Reqs.Where((Requirement r) => r.itemName != "")) { if (item.quality > 0) { ItemDrop val = ResItem(item); if (val != null) { Requirement val2 = new Requirement { m_resItem = val, m_amountPerLevel = (item.amountConfig?.Value ?? item.amount), m_amount = 0 }; list.Add(val2); requirementQuality.Add(val2, new RequirementQuality { quality = item.quality }); } continue; } if (!dictionary.TryGetValue(item.itemName, out var value) || value == null) { ItemDrop val3 = ResItem(item); if (val3 != null) { string itemName = item.itemName; Requirement val4 = new Requirement { m_resItem = val3, m_amount = 0 }; Requirement val5 = val4; dictionary[itemName] = val4; value = val5; list.Add(value); } } if (value != null) { value.m_amountPerLevel = item.amountConfig?.Value ?? item.amount; } } return list.ToArray(); ItemDrop? ResItem(Requirement r) { return fetchByName(objectDB, r.itemName); } } } private class SerializedDrop { public readonly List Drops; public SerializedDrop(List drops) { Drops = drops; } public SerializedDrop(string drops) { Drops = ((drops == "") ? ((IEnumerable)Array.Empty()) : ((IEnumerable)drops.Split(new char[1] { ',' }))).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); if (array.Length <= 2 || !int.TryParse(array[2], out var result)) { result = 1; } if (array.Length <= 3 || !int.TryParse(array[3], out var result2)) { result2 = result; } bool levelMultiplier = array.Length <= 4 || array[4] != "0"; float result3; return new DropTarget { creature = array[0], chance = ((array.Length > 1 && float.TryParse(array[1], out result3)) ? result3 : 1f), min = result, max = result2, levelMultiplier = levelMultiplier }; }).ToList(); } public override string ToString() { return string.Join(",", Drops.Select((DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0"))); } private static Character? fetchByName(ZNetScene netScene, string name) { GameObject prefab = netScene.GetPrefab(name); Character obj = ((prefab != null) ? prefab.GetComponent() : null); if ((Object)(object)obj == (Object)null) { Debug.LogWarning((object)("The drop target character '" + name + "' does not exist.")); } return obj; } public Dictionary toCharacterDrops(ZNetScene netScene, GameObject item) { //IL_002e: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown Dictionary dictionary = new Dictionary(); foreach (DropTarget drop in Drops) { Character val = fetchByName(netScene, drop.creature); if (val != null) { dictionary[val] = new Drop { m_prefab = item, m_amountMin = drop.min, m_amountMax = drop.max, m_chance = drop.chance, m_levelMultiplier = drop.levelMultiplier }; } } return dictionary; } } private static readonly List registeredItems = new List(); private static readonly Dictionary itemDropMap = new Dictionary(); private static Dictionary>> activeRecipes = new Dictionary>>(); private static Dictionary hiddenCraftRecipes = new Dictionary(); private static Dictionary hiddenUpgradeRecipes = new Dictionary(); private static Dictionary> itemCraftConfigs = new Dictionary>(); private static Dictionary> itemDropConfigs = new Dictionary>(); private Dictionary characterDrops = new Dictionary(); private readonly Dictionary statsConfigs = new Dictionary(); private static readonly ConditionalWeakTable requirementQuality = new ConditionalWeakTable(); public static Configurability DefaultConfigurability = Configurability.Full; public Configurability? Configurable; private Configurability configurationVisible = Configurability.Full; private TraderConfig? traderConfig; public readonly GameObject Prefab; [Description("Specifies the maximum required crafting station level to upgrade and repair the item.\nDefault is calculated from crafting station level and maximum quality.")] public int MaximumRequiredStationLevel = int.MaxValue; [Description("Assigns the item as a drop item to a creature.\nUses a creature name, a drop chance and a minimum and maximum amount.")] public readonly DropTargets DropsFrom = new DropTargets(); [Description("Configures whether the item can be bought at the trader.\nDon't forget to set cost to something above 0 or the item will be sold for free.")] public readonly Trade Trade = new Trade(); internal List Conversions = new List(); internal List conversions = new List(); public Dictionary Recipes = new Dictionary(); private static object? configManager; private static Localization? _english; private static BaseUnityPlugin? _plugin; private static bool hasConfigSync = true; private static object? _configSync; private Configurability configurability => Configurable ?? DefaultConfigurability; [Description("Specifies the resources needed to craft the item.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the item should need.")] public RequiredResourceList RequiredItems => this[""].RequiredItems; [Description("Specifies the resources needed to upgrade the item.\nUse .Add to add resources with their internal ID and an amount. This amount will be multipled by the item quality level.\nUse one .Add for each resource type the upgrade should need.")] public RequiredResourceList RequiredUpgradeItems => this[""].RequiredUpgradeItems; [Description("Specifies the crafting station needed to craft the item.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.\nUse one .Add for each crafting station.")] public CraftingStationList Crafting => this[""].Crafting; [Description("Specifies a config entry which toggles whether a recipe is active.")] public ConfigEntryBase? RecipeIsActive { get { return this[""].RecipeIsActive; } set { this[""].RecipeIsActive = value; } } [Description("Specifies the number of items that should be given to the player with a single craft of the item.\nDefaults to 1.")] public int CraftAmount { get { return this[""].CraftAmount; } set { this[""].CraftAmount = value; } } public bool RequireOnlyOneIngredient { get { return this[""].RequireOnlyOneIngredient; } set { this[""].RequireOnlyOneIngredient = value; } } public float QualityResultAmountMultiplier { get { return this[""].QualityResultAmountMultiplier; } set { this[""].QualityResultAmountMultiplier = value; } } public ItemRecipe this[string name] { get { if (Recipes.TryGetValue(name, out ItemRecipe value)) { return value; } return Recipes[name] = new ItemRecipe(); } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); 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 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((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static object? configSync { get { if (_configSync == null && hasConfigSync) { Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " ItemManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } } return _configSync; } } public Item(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public Item(AssetBundle bundle, string prefabName) : this(PrefabManager.RegisterPrefab(bundle, prefabName, addToObjectDb: true), skipRegistering: true) { } public Item(GameObject prefab, bool skipRegistering = false) { if (!skipRegistering) { PrefabManager.RegisterPrefab(prefab, addToObjectDb: true); } Prefab = prefab; registeredItems.Add(this); itemDropMap[Prefab.GetComponent()] = this; Prefab.GetComponent().m_itemData.m_dropPrefab = Prefab; } public void ToggleConfigurationVisibility(Configurability visible) { configurationVisible = visible; if (itemDropConfigs.TryGetValue(this, out ConfigEntry value)) { Toggle((ConfigEntryBase)(object)value, Configurability.Drop); } if (itemCraftConfigs.TryGetValue(this, out Dictionary value2)) { foreach (ItemConfig value4 in value2.Values) { ToggleObj(value4, Configurability.Recipe); } } foreach (Conversion conversion in Conversions) { if (conversion.config != null) { ToggleObj(conversion.config, Configurability.Recipe); } } foreach (KeyValuePair statsConfig in statsConfigs) { Toggle(statsConfig.Key, Configurability.Stats); if ((visible & Configurability.Stats) != Configurability.Disabled) { statsConfig.Value(); } } reloadConfigDisplay(); void Toggle(ConfigEntryBase cfg, Configurability check) { object[] tags = cfg.Description.Tags; for (int i = 0; i < tags.Length; i++) { if (tags[i] is ConfigurationManagerAttributes configurationManagerAttributes) { configurationManagerAttributes.Browsable = (visible & check) != Configurability.Disabled && (configurationManagerAttributes.browsability == null || configurationManagerAttributes.browsability()); } } } void ToggleObj(object obj, Configurability check) { FieldInfo[] fields = obj.GetType().GetFields(); for (int i = 0; i < fields.Length; i++) { object? value3 = fields[i].GetValue(obj); ConfigEntryBase val = (ConfigEntryBase)((value3 is ConfigEntryBase) ? value3 : null); if (val != null) { Toggle(val, check); } } } } internal static void reloadConfigDisplay() { object obj = configManager?.GetType().GetProperty("DisplayingWindow").GetValue(configManager); if (obj is bool && (bool)obj) { configManager.GetType().GetMethod("BuildSettingList").Invoke(configManager, Array.Empty()); } } private void UpdateItemTableConfig(string recipeKey, CraftingTable table, string customTableValue) { if (activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(recipeKey, out List value)) { value.First().m_enabled = table != CraftingTable.Disabled; if ((uint)table <= 1u) { value.First().m_craftingStation = null; } else if (table == CraftingTable.Custom) { Recipe obj = value.First(); GameObject prefab = ZNetScene.instance.GetPrefab(customTableValue); obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent() : null); } else { value.First().m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName(table)).GetComponent(); } } } private void UpdateCraftConfig(string recipeKey, SerializedRequirements craftRequirements, SerializedRequirements upgradeRequirements) { if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || !activeRecipes.ContainsKey(this) || !activeRecipes[this].TryGetValue(recipeKey, out List value)) { return; } foreach (Recipe item in value) { item.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, craftRequirements, upgradeRequirements); } } internal static void Patch_FejdStartup() { //IL_0f3d: Unknown result type (might be due to invalid IL or missing references) //IL_0f42: Unknown result type (might be due to invalid IL or missing references) //IL_2208: Unknown result type (might be due to invalid IL or missing references) //IL_2212: Expected O, but got Unknown //IL_1006: Unknown result type (might be due to invalid IL or missing references) //IL_1009: Unknown result type (might be due to invalid IL or missing references) //IL_105f: Expected I4, but got Unknown //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Expected O, but got Unknown //IL_1193: Unknown result type (might be due to invalid IL or missing references) //IL_1196: Unknown result type (might be due to invalid IL or missing references) //IL_1198: Invalid comparison between Unknown and I4 //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Expected O, but got Unknown //IL_119a: Unknown result type (might be due to invalid IL or missing references) //IL_119e: Invalid comparison between Unknown and I4 //IL_0d4f: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Expected O, but got Unknown //IL_0dfa: Unknown result type (might be due to invalid IL or missing references) //IL_0e04: Expected O, but got Unknown //IL_11a0: Unknown result type (might be due to invalid IL or missing references) //IL_11a4: Invalid comparison between Unknown and I4 //IL_0eae: Unknown result type (might be due to invalid IL or missing references) //IL_0eb8: Expected O, but got Unknown //IL_139f: Unknown result type (might be due to invalid IL or missing references) //IL_13a2: Unknown result type (might be due to invalid IL or missing references) //IL_13a4: Invalid comparison between Unknown and I4 //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_13a6: Unknown result type (might be due to invalid IL or missing references) //IL_13aa: Unknown result type (might be due to invalid IL or missing references) //IL_13ac: Invalid comparison between Unknown and I4 //IL_13ae: Unknown result type (might be due to invalid IL or missing references) //IL_13b2: Invalid comparison between Unknown and I4 //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Expected O, but got Unknown //IL_1487: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_148e: Unknown result type (might be due to invalid IL or missing references) //IL_1491: Invalid comparison between Unknown and I4 //IL_1493: Unknown result type (might be due to invalid IL or missing references) //IL_1497: Invalid comparison between Unknown and I4 //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown //IL_1506: Unknown result type (might be due to invalid IL or missing references) //IL_1509: Unknown result type (might be due to invalid IL or missing references) //IL_150b: Invalid comparison between Unknown and I4 //IL_150d: Unknown result type (might be due to invalid IL or missing references) //IL_1511: Unknown result type (might be due to invalid IL or missing references) //IL_1513: Invalid comparison between Unknown and I4 //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Expected O, but got Unknown //IL_1515: Unknown result type (might be due to invalid IL or missing references) //IL_1519: Invalid comparison between Unknown and I4 //IL_1656: Unknown result type (might be due to invalid IL or missing references) //IL_1659: Invalid comparison between Unknown and I4 //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Expected O, but got Unknown //IL_1856: Unknown result type (might be due to invalid IL or missing references) //IL_185d: Invalid comparison between Unknown and I4 //IL_1926: Unknown result type (might be due to invalid IL or missing references) //IL_192b: Unknown result type (might be due to invalid IL or missing references) //IL_192d: Unknown result type (might be due to invalid IL or missing references) //IL_1931: Unknown result type (might be due to invalid IL or missing references) //IL_1933: Invalid comparison between Unknown and I4 //IL_19a2: Unknown result type (might be due to invalid IL or missing references) //IL_19a5: Unknown result type (might be due to invalid IL or missing references) //IL_19a7: Invalid comparison between Unknown and I4 //IL_15cc: Unknown result type (might be due to invalid IL or missing references) //IL_15d1: Unknown result type (might be due to invalid IL or missing references) //IL_19a9: Unknown result type (might be due to invalid IL or missing references) //IL_19ad: Invalid comparison between Unknown and I4 //IL_19af: Unknown result type (might be due to invalid IL or missing references) //IL_19b3: Invalid comparison between Unknown and I4 //IL_1e20: Unknown result type (might be due to invalid IL or missing references) //IL_1e23: Invalid comparison between Unknown and I4 Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); if (DefaultConfigurability != Configurability.Disabled) { bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (Item item3 in registeredItems.Where((Item i) => i.configurability != Configurability.Disabled)) { Item item = item3; string name = item.Prefab.GetComponent().m_itemData.m_shared.m_name; string englishName = new Regex("['\\[\"\\]]").Replace(english.Localize(name), "").Trim(); string localizedName = Localization.instance.Localize(name).Trim(); int order = 0; if ((item.configurability & Configurability.Recipe) != Configurability.Disabled) { itemCraftConfigs[item] = new Dictionary(); foreach (string item4 in item.Recipes.Keys.DefaultIfEmpty("")) { string configKey = item4; string text = ((configKey == "") ? "" : (" (" + configKey + ")")); if (configKey == "") { Configurability? configurable = item.Configurable; if (configurable.HasValue && item.Crafting.Stations.Count == 0) { item.Crafting.Add(CraftingTable.Disabled, 1); } } if (!item.Recipes.ContainsKey(configKey) || item.Recipes[configKey].Crafting.Stations.Count <= 0) { continue; } ItemConfig itemConfig = (itemCraftConfigs[item][configKey] = new ItemConfig()); ItemConfig cfg = itemConfig; List hideWhenNoneAttributes = new List(); cfg.table = config(englishName, "Crafting Station" + text, item.Recipes[configKey].Crafting.Stations.First().Table, new ConfigDescription("Crafting station where " + englishName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = ((item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = CustomTableBrowsability, Browsable = (CustomTableBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.customTable = config(englishName, "Custom Crafting Station" + text, item.Recipes[configKey].Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TableLevelBrowsability, Browsable = (TableLevelBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes); cfg.tableLevel = config(englishName, "Crafting Station Level" + text, item.Recipes[configKey].Crafting.Stations.First().level, new ConfigDescription("Required crafting station level to craft " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); cfg.tableLevel.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { value.First().m_minStationLevel = cfg.tableLevel.Value; } }; if (item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality > 1) { cfg.maximumTableLevel = config(englishName, "Maximum Crafting Station Level" + text, (item.MaximumRequiredStationLevel == int.MaxValue) ? (item.Recipes[configKey].Crafting.Stations.First().level + item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality - 1) : item.MaximumRequiredStationLevel, new ConfigDescription("Maximum crafting station level to upgrade and repair " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); } cfg.requireOneIngredient = config(englishName, "Require only one resource" + text, item.Recipes[configKey].RequireOnlyOneIngredient ? Toggle.On : Toggle.Off, new ConfigDescription("Whether only one of the ingredients is needed to craft " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TableLevelBrowsability, Browsable = (TableLevelBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName } })); ConfigurationManagerAttributes qualityResultAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = QualityResultBrowsability, Browsable = (QualityResultBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.requireOneIngredient.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { foreach (Recipe item5 in value) { item5.m_requireOnlyOneIngredient = cfg.requireOneIngredient.Value == Toggle.On; } } qualityResultAttributes.Browsable = QualityResultBrowsability(); reloadConfigDisplay(); }; cfg.qualityResultAmountMultiplier = config(englishName, "Quality Multiplier" + text, item.Recipes[configKey].QualityResultAmountMultiplier, new ConfigDescription("Multiplies the crafted amount based on the quality of the resources when crafting " + englishName + ". Only works, if Require Only One Resource is true.", (AcceptableValueBase)null, new object[1] { qualityResultAttributes })); cfg.qualityResultAmountMultiplier.SettingChanged += delegate { if (activeRecipes.ContainsKey(item) && activeRecipes[item].TryGetValue(configKey, out List value)) { foreach (Recipe item6 in value) { item6.m_qualityResultAmountMultiplier = cfg.qualityResultAmountMultiplier.Value; } } }; if ((!item.Recipes[configKey].RequiredItems.Free || item.Recipes[configKey].RequiredItems.Requirements.Count > 0) && item.Recipes[configKey].RequiredItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.craft = itemConfig3("Crafting Costs" + text, new SerializedRequirements(item.Recipes[configKey].RequiredItems.Requirements).ToString(), "Item costs to craft " + englishName, isUpgrade: false); } if (item.Prefab.GetComponent().m_itemData.m_shared.m_maxQuality > 1 && (!item.Recipes[configKey].RequiredUpgradeItems.Free || item.Recipes[configKey].RequiredUpgradeItems.Requirements.Count > 0) && item.Recipes[configKey].RequiredUpgradeItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.upgrade = itemConfig3("Upgrading Costs" + text, new SerializedRequirements(item.Recipes[configKey].RequiredUpgradeItems.Requirements).ToString(), "Item costs per level to upgrade " + englishName, isUpgrade: true); } if (cfg.craft != null) { cfg.craft.SettingChanged += ConfigChanged; } if (cfg.upgrade != null) { cfg.upgrade.SettingChanged += ConfigChanged; } void ConfigChanged(object o, EventArgs e) { item.UpdateCraftConfig(configKey, new SerializedRequirements(cfg.craft?.Value ?? ""), new SerializedRequirements(cfg.upgrade?.Value ?? "")); } bool CustomTableBrowsability() { return cfg.table.Value == CraftingTable.Custom; } bool ItemBrowsability() { return cfg.table.Value != CraftingTable.Disabled; } bool QualityResultBrowsability() { return cfg.requireOneIngredient.Value == Toggle.On; } void TableConfigChanged(object o, EventArgs e) { item.UpdateItemTableConfig(configKey, cfg.table.Value, cfg.customTable.Value); customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item7 in hideWhenNoneAttributes) { item7.Browsable = cfg.table.Value != CraftingTable.Disabled; } reloadConfigDisplay(); } bool TableLevelBrowsability() { return cfg.table.Value != CraftingTable.Disabled; } ConfigEntry itemConfig3(string name2, string value, string desc, bool isUpgrade) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { CustomDrawer = drawRequirementsConfigTable(item, isUpgrade), Order = (order -= 1), browsability = ItemBrowsability, Browsable = (ItemBrowsability() && (item.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes2); return config(englishName, name2, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 })); } } if ((item.configurability & Configurability.Drop) != Configurability.Disabled) { ConfigEntry val = (itemDropConfigs[item] = config(englishName, "Drops from", new SerializedDrop(item.DropsFrom.Drops).ToString(), new ConfigDescription(englishName + " drops from this creature.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = drawDropsConfigTable, Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Drop) != 0) } }))); val.SettingChanged += delegate { item.UpdateCharacterDrop(); }; } for (int num = 0; num < item.Conversions.Count; num++) { string text2 = ((item.Conversions.Count > 1) ? $"{num + 1}. " : ""); Conversion conversion = item.Conversions[num]; conversion.config = new Conversion.ConversionConfig(); int index = num; conversion.config.input = config(englishName, text2 + "Conversion Input Item", conversion.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.input.SettingChanged += delegate { if (index < item.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop val3 = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); item.conversions[index].m_from = val3; UpdatePiece(); } } }; conversion.config.piece = config(englishName, text2 + "Conversion Piece", conversion.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.piece.SettingChanged += delegate { UpdatePiece(); }; conversion.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.customPiece.SettingChanged += delegate { UpdatePiece(); }; void UpdatePiece() { if (index < item.conversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance)) { string text3 = ((conversion.config.piece.Value == ConversionPiece.Disabled) ? null : ((conversion.config.piece.Value == ConversionPiece.Custom) ? conversion.config.customPiece.Value : getInternalName(conversion.config.piece.Value))); string activePiece = conversion.config.activePiece; if (conversion.config.activePiece != null) { int num4 = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent().m_conversion.IndexOf(item.conversions[index]); if (num4 >= 0) { Smelter[] array3 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val3 in array3) { if (Utils.GetPrefabName(((Component)val3).gameObject) == activePiece) { val3.m_conversion.RemoveAt(num4); } } } conversion.config.activePiece = null; } if (item.conversions[index].m_from != null && conversion.config.piece.Value != ConversionPiece.Disabled) { GameObject prefab = ZNetScene.instance.GetPrefab(text3); if (((prefab != null) ? prefab.GetComponent() : null) != null) { conversion.config.activePiece = text3; Smelter[] array3 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val4 in array3) { if (Utils.GetPrefabName(((Component)val4).gameObject) == text3) { val4.m_conversion.Add(item.conversions[index]); } } } } } } } } if ((item.configurability & Configurability.Stats) != Configurability.Disabled) { item.statsConfigs.Clear(); SharedData shared = item.Prefab.GetComponent().m_itemData.m_shared; ItemType itemType = shared.m_itemType; statcfg("Weight", "Weight of " + englishName + ".", (SharedData val3) => val3.m_weight, delegate(SharedData val3, float value) { val3.m_weight = value; }); statcfg("Trader Value", "Trader value of " + englishName + ".", (SharedData val3) => val3.m_value, delegate(SharedData val3, int value) { val3.m_value = value; }); bool flag; switch (itemType - 3) { case 0: case 1: case 2: case 3: case 4: case 8: case 9: case 11: case 14: case 16: case 19: flag = true; break; default: flag = false; break; } if (flag) { statcfg("Durability", "Durability of " + englishName + ".", (SharedData val3) => val3.m_maxDurability, delegate(SharedData val3, float value) { val3.m_maxDurability = value; }); statcfg("Durability per Level", "Durability gain per level of " + englishName + ".", (SharedData val3) => val3.m_durabilityPerLevel, delegate(SharedData val3, float value) { val3.m_durabilityPerLevel = value; }); statcfg("Movement Speed Modifier", "Movement speed modifier of " + englishName + ".", (SharedData val3) => val3.m_movementModifier, delegate(SharedData val3, float value) { val3.m_movementModifier = value; }); } if ((itemType - 3 <= 2 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg("Block Armor", "Block armor of " + englishName + ".", (SharedData val3) => val3.m_blockPower, delegate(SharedData val3, float value) { val3.m_blockPower = value; }); statcfg("Block Armor per Level", "Block armor per level for " + englishName + ".", (SharedData val3) => val3.m_blockPowerPerLevel, delegate(SharedData val3, float value) { val3.m_blockPowerPerLevel = value; }); statcfg("Block Force", "Block force of " + englishName + ".", (SharedData val3) => val3.m_deflectionForce, delegate(SharedData val3, float value) { val3.m_deflectionForce = value; }); statcfg("Block Force per Level", "Block force per level for " + englishName + ".", (SharedData val3) => val3.m_deflectionForcePerLevel, delegate(SharedData val3, float value) { val3.m_deflectionForcePerLevel = value; }); statcfg("Parry Bonus", "Parry bonus of " + englishName + ".", (SharedData val3) => val3.m_timedBlockBonus, delegate(SharedData val3, float value) { val3.m_timedBlockBonus = value; }); } else if ((itemType - 6 <= 1 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { statcfg("Armor", "Armor of " + englishName + ".", (SharedData val3) => val3.m_armor, delegate(SharedData val3, float value) { val3.m_armor = value; }); statcfg("Armor per Level", "Armor per level for " + englishName + ".", (SharedData val3) => val3.m_armorPerLevel, delegate(SharedData val3, float value) { val3.m_armorPerLevel = value; }); } SkillType skillType = shared.m_skillType; if (((int)skillType == 7 || (int)skillType == 12) ? true : false) { statcfg("Tool tier", "Tool tier of " + englishName + ".", (SharedData val3) => val3.m_toolTier, delegate(SharedData val3, int value) { val3.m_toolTier = value; }); } if ((itemType - 5 <= 2 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { Dictionary modifiers = shared.m_damageModifiers.ToDictionary((DamageModPair d) => d.m_type, (DamageModPair d) => (DamageModifier)d.m_modifier); DamageType[] first = (DamageType[])Enum.GetValues(typeof(DamageType)); DamageType[] array = new DamageType[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); foreach (DamageType damageType in first.Except((IEnumerable)(object)array)) { statcfg(((object)Unsafe.As(ref damageType)/*cast due to .constrained prefix*/).ToString() + " Resistance", ((object)Unsafe.As(ref damageType)/*cast due to .constrained prefix*/).ToString() + " resistance of " + englishName + ".", (SharedData _) => (!modifiers.TryGetValue(damageType, out var value)) ? DamageModifier.None : value, delegate(SharedData val4, DamageModifier value) { //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) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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_001e: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) DamageModPair val3 = new DamageModPair { m_type = damageType, m_modifier = (DamageModifier)value }; for (int i = 0; i < val4.m_damageModifiers.Count; i++) { if (val4.m_damageModifiers[i].m_type == damageType) { if (value == DamageModifier.None) { val4.m_damageModifiers.RemoveAt(i); } else { val4.m_damageModifiers[i] = val3; } return; } } if (value != DamageModifier.None) { val4.m_damageModifiers.Add(val3); } }); } } if ((int)itemType == 2 && shared.m_food > 0f) { statcfg("Health", "Health value of " + englishName + ".", (SharedData val3) => val3.m_food, delegate(SharedData val3, float value) { val3.m_food = value; }); statcfg("Stamina", "Stamina value of " + englishName + ".", (SharedData val3) => val3.m_foodStamina, delegate(SharedData val3, float value) { val3.m_foodStamina = value; }); statcfg("Eitr", "Eitr value of " + englishName + ".", (SharedData val3) => val3.m_foodEitr, delegate(SharedData val3, float value) { val3.m_foodEitr = value; }); statcfg("Duration", "Duration of " + englishName + ".", (SharedData val3) => val3.m_foodBurnTime, delegate(SharedData val3, float value) { val3.m_foodBurnTime = value; }); statcfg("Health Regen", "Health regen value of " + englishName + ".", (SharedData val3) => val3.m_foodRegen, delegate(SharedData val3, float value) { val3.m_foodRegen = value; }); } if ((int)shared.m_skillType == 10) { statcfg("Health Cost", "Health cost of " + englishName + ".", (SharedData val3) => val3.m_attack.m_attackHealth, delegate(SharedData val3, float value) { val3.m_attack.m_attackHealth = value; }); statcfg("Health Cost Percentage", "Health cost percentage of " + englishName + ".", (SharedData val3) => val3.m_attack.m_attackHealthPercentage, delegate(SharedData val3, float value) { val3.m_attack.m_attackHealthPercentage = value; }); } skillType = shared.m_skillType; if (skillType - 9 <= 1) { statcfg("Eitr Cost", "Eitr cost of " + englishName + ".", (SharedData val3) => val3.m_attack.m_attackEitr, delegate(SharedData val3, float value) { val3.m_attack.m_attackEitr = value; }); } if ((itemType - 3 <= 1 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg("Knockback", "Knockback of " + englishName + ".", (SharedData val3) => val3.m_attackForce, delegate(SharedData val3, float value) { val3.m_attackForce = value; }); statcfg("Backstab Bonus", "Backstab bonus of " + englishName + ".", (SharedData val3) => val3.m_backstabBonus, delegate(SharedData val3, float value) { val3.m_backstabBonus = value; }); statcfg("Attack Stamina", "Attack stamina of " + englishName + ".", (SharedData val3) => val3.m_attack.m_attackStamina, delegate(SharedData val3, float value) { val3.m_attack.m_attackStamina = value; }); SetDmg("True", (DamageTypes dmg) => dmg.m_damage, delegate(ref DamageTypes dmg, float damage) { dmg.m_damage = damage; }); SetDmg("Slash", (DamageTypes dmg) => dmg.m_slash, delegate(ref DamageTypes dmg, float slash) { dmg.m_slash = slash; }); SetDmg("Pierce", (DamageTypes dmg) => dmg.m_pierce, delegate(ref DamageTypes dmg, float pierce) { dmg.m_pierce = pierce; }); SetDmg("Blunt", (DamageTypes dmg) => dmg.m_blunt, delegate(ref DamageTypes dmg, float blunt) { dmg.m_blunt = blunt; }); SetDmg("Chop", (DamageTypes dmg) => dmg.m_chop, delegate(ref DamageTypes dmg, float chop) { dmg.m_chop = chop; }); SetDmg("Pickaxe", (DamageTypes dmg) => dmg.m_pickaxe, delegate(ref DamageTypes dmg, float pickaxe) { dmg.m_pickaxe = pickaxe; }); SetDmg("Fire", (DamageTypes dmg) => dmg.m_fire, delegate(ref DamageTypes dmg, float fire) { dmg.m_fire = fire; }); SetDmg("Poison", (DamageTypes dmg) => dmg.m_poison, delegate(ref DamageTypes dmg, float poison) { dmg.m_poison = poison; }); SetDmg("Frost", (DamageTypes dmg) => dmg.m_frost, delegate(ref DamageTypes dmg, float frost) { dmg.m_frost = frost; }); SetDmg("Lightning", (DamageTypes dmg) => dmg.m_lightning, delegate(ref DamageTypes dmg, float lightning) { dmg.m_lightning = lightning; }); SetDmg("Spirit", (DamageTypes dmg) => dmg.m_spirit, delegate(ref DamageTypes dmg, float spirit) { dmg.m_spirit = spirit; }); if ((int)itemType == 4) { statcfg("Projectiles", "Number of projectiles that " + englishName + " shoots at once.", (SharedData val3) => val3.m_attack.m_projectileBursts, delegate(SharedData val3, int value) { val3.m_attack.m_projectileBursts = value; }); statcfg("Burst Interval", "Time between the projectiles " + englishName + " shoots at once.", (SharedData val3) => val3.m_attack.m_burstInterval, delegate(SharedData val3, float value) { val3.m_attack.m_burstInterval = value; }); statcfg("Minimum Accuracy", "Minimum accuracy for " + englishName + ".", (SharedData val3) => val3.m_attack.m_projectileAccuracyMin, delegate(SharedData val3, float value) { val3.m_attack.m_projectileAccuracyMin = value; }); statcfg("Accuracy", "Accuracy for " + englishName + ".", (SharedData val3) => val3.m_attack.m_projectileAccuracy, delegate(SharedData val3, float value) { val3.m_attack.m_projectileAccuracy = value; }); statcfg("Minimum Velocity", "Minimum velocity for " + englishName + ".", (SharedData val3) => val3.m_attack.m_projectileVelMin, delegate(SharedData val3, float value) { val3.m_attack.m_projectileVelMin = value; }); statcfg("Velocity", "Velocity for " + englishName + ".", (SharedData val3) => val3.m_attack.m_projectileVel, delegate(SharedData val3, float value) { val3.m_attack.m_projectileVel = value; }); statcfg("Maximum Draw Time", "Time until " + englishName + " is fully drawn at skill level 0.", (SharedData val3) => val3.m_attack.m_drawDurationMin, delegate(SharedData val3, float value) { val3.m_attack.m_drawDurationMin = value; }); statcfg("Stamina Drain", "Stamina drain per second while drawing " + englishName + ".", (SharedData val3) => val3.m_attack.m_drawStaminaDrain, delegate(SharedData val3, float value) { val3.m_attack.m_drawStaminaDrain = value; }); } } } List traderAttributes; if ((item.configurability & Configurability.Trader) != Configurability.Disabled) { traderAttributes = new List(); item.traderConfig = new TraderConfig { trader = config(englishName, "Trader Selling", item.Trade.Trader, new ConfigDescription("Which traders sell " + englishName + ".", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = ((item.configurationVisible & Configurability.Trader) != 0), Category = localizedName } })) }; item.traderConfig.trader.SettingChanged += delegate { item.ReloadTraderConfiguration(); foreach (ConfigurationManagerAttributes item8 in traderAttributes) { item8.Browsable = TraderBrowsability(); } reloadConfigDisplay(); }; item.traderConfig.price = traderConfig("Trader Price", item.Trade.Price, "Price of " + englishName + " at the trader."); item.traderConfig.stack = traderConfig("Trader Stack", item.Trade.Stack, "Stack size of " + englishName + " in the trader. Also known as the number of items sold by a trader in one transaction."); item.traderConfig.requiredGlobalKey = traderConfig("Trader Required Global Key", item.Trade.RequiredGlobalKey ?? "", "Required global key to unlock " + englishName + " at the trader."); if (item.traderConfig.trader.Value != Trader.None) { PrefabManager.AddItemToTrader(item.Prefab, item.traderConfig.trader.Value, item.traderConfig.price.Value, item.traderConfig.stack.Value, item.traderConfig.requiredGlobalKey.Value); } } else if (item.Trade.Trader != Trader.None) { PrefabManager.AddItemToTrader(item.Prefab, item.Trade.Trader, item.Trade.Price, item.Trade.Stack, item.Trade.RequiredGlobalKey); } void SetDmg(string dmgType, Func readDmg, setDmgFunc setDmg) { statcfg(dmgType + " Damage", dmgType + " damage dealt by " + englishName + ".", (SharedData val3) => readDmg(val3.m_damages), delegate(SharedData val3, float value) { setDmg(ref val3.m_damages, value); }); statcfg(dmgType + " Damage Per Level", dmgType + " damage dealt increase per level for " + englishName + ".", (SharedData val3) => readDmg(val3.m_damagesPerLevel), delegate(SharedData val3, float value) { setDmg(ref val3.m_damagesPerLevel, value); }); } bool TraderBrowsability() { return item.traderConfig.trader.Value != Trader.None; } void statcfg(string configName, string description, Func readDefault, Action setValue) where T : notnull { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown SharedData shared2 = item.Prefab.GetComponent().m_itemData.m_shared; ConfigEntry cfg2 = config(englishName, configName, readDefault(shared2), new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item.configurationVisible & Configurability.Stats) != 0) } })); if ((item.configurationVisible & Configurability.Stats) != Configurability.Disabled) { setValue(shared2, cfg2.Value); } item.statsConfigs.Add((ConfigEntryBase)(object)cfg2, ApplyConfig); cfg2.SettingChanged += delegate { if ((item.configurationVisible & Configurability.Stats) != Configurability.Disabled) { ApplyConfig(); } }; void ApplyConfig() { item.ApplyToAllInstances(delegate(ItemData val3) { setValue(val3.m_shared, cfg2.Value); }); } } ConfigEntry traderConfig(string name2, T value, string desc) where T : notnull { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TraderBrowsability, Browsable = (TraderBrowsability() && (item.configurationVisible & Configurability.Trader) != 0), Category = localizedName }; traderAttributes.Add(configurationManagerAttributes2); ConfigEntry obj = config(englishName, name2, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 })); obj.SettingChanged += delegate { item.ReloadTraderConfiguration(); }; return obj; } } if (saveOnConfigSet) { plugin.Config.SaveOnConfigSet = true; plugin.Config.Save(); } } configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); foreach (Item registeredItem in registeredItems) { Item item2 = registeredItem; foreach (KeyValuePair recipe in item2.Recipes) { KeyValuePair kv = recipe; RequiredResourceList[] array2 = new RequiredResourceList[2] { kv.Value.RequiredItems, kv.Value.RequiredUpgradeItems }; foreach (RequiredResourceList requiredResourceList in array2) { for (int num3 = 0; num3 < requiredResourceList.Requirements.Count; num3++) { ConfigEntry amountCfg; int resourceIndex; if ((item2.configurability & Configurability.Recipe) != Configurability.Disabled) { amountCfg = requiredResourceList.Requirements[num3].amountConfig; if (amountCfg != null) { resourceIndex = num3; amountCfg.SettingChanged += ConfigChanged2; } } void ConfigChanged2(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(kv.Key, out List value)) { foreach (Recipe item9 in value) { item9.m_resources[resourceIndex].m_amount = amountCfg.Value; } } } } } } item2.InitializeNewRegisteredItem(); } } private void InitializeNewRegisteredItem() { foreach (KeyValuePair recipe in Recipes) { KeyValuePair kv = recipe; ConfigEntryBase enabledCfg = kv.Value.RecipeIsActive; if (enabledCfg != null) { ((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged)); } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(kv.Key, out List value)) { foreach (Recipe item in value) { item.m_enabled = (int)enabledCfg.BoxedValue != 0; } } } } } public void ReloadCraftingConfiguration() { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name)) == null) { registerRecipesInObjectDB(ObjectDB.instance); ObjectDB.instance.m_items.Add(Prefab); ObjectDB.instance.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); ZNetScene.instance.m_prefabs.Add(Prefab); ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); } foreach (string item in Recipes.Keys.DefaultIfEmpty("")) { if (Recipes.TryGetValue(item, out ItemRecipe value) && value.Crafting.Stations.Count > 0) { UpdateItemTableConfig(item, value.Crafting.Stations.First().Table, value.Crafting.Stations.First().custom ?? ""); UpdateCraftConfig(item, new SerializedRequirements(value.RequiredItems.Requirements), new SerializedRequirements(value.RequiredUpgradeItems.Requirements)); } } } private void ReloadTraderConfiguration() { if (traderConfig.trader.Value == Trader.None) { PrefabManager.RemoveItemFromTrader(Prefab); } else { PrefabManager.AddItemToTrader(Prefab, traderConfig.trader.Value, traderConfig.price.Value, traderConfig.stack.Value, traderConfig.requiredGlobalKey.Value); } } public static void ApplyToAllInstances(GameObject prefab, Action callback) { callback(prefab.GetComponent().m_itemData); string name = prefab.GetComponent().m_itemData.m_shared.m_name; Inventory[] source = (from c in Player.s_players.Select((Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType() select c.GetInventory()) where c != null select c).ToArray(); foreach (ItemData item in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent()) select c).Concat(ItemDrop.s_instances) select i.m_itemData).Concat(source.SelectMany((Inventory i) => i.GetAllItems()))) { if (item.m_shared.m_name == name) { callback(item); } } } public void ApplyToAllInstances(Action callback) { ApplyToAllInstances(Prefab, callback); } private static string getInternalName(T value) where T : struct { return ((InternalName)typeof(T).GetMember(value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName; } private void registerRecipesInObjectDB(ObjectDB objectDB) { //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Expected O, but got Unknown activeRecipes[this] = new Dictionary>(); itemCraftConfigs.TryGetValue(this, out Dictionary value); foreach (KeyValuePair recipe in Recipes) { List list = new List(); foreach (CraftingStationConfig station in recipe.Value.Crafting.Stations) { ItemConfig itemConfig = value?[recipe.Key]; Recipe val = ScriptableObject.CreateInstance(); string name = ((Object)Prefab).name; CraftingTable table = station.Table; ((Object)val).name = name + "_Recipe_" + table; val.m_amount = recipe.Value.CraftAmount; ConfigEntryBase? recipeIsActive = recipe.Value.RecipeIsActive; val.m_enabled = (int)(((recipeIsActive != null) ? recipeIsActive.BoxedValue : null) ?? ((object)1)) != 0 && (itemConfig == null || itemConfig.table.Value != CraftingTable.Disabled); val.m_item = Prefab.GetComponent(); val.m_resources = SerializedRequirements.toPieceReqs(objectDB, (itemConfig?.craft == null) ? new SerializedRequirements(recipe.Value.RequiredItems.Requirements) : new SerializedRequirements(itemConfig.craft.Value), (itemConfig?.upgrade == null) ? new SerializedRequirements(recipe.Value.RequiredUpgradeItems.Requirements) : new SerializedRequirements(itemConfig.upgrade.Value)); table = ((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value); if ((uint)table <= 1u) { val.m_craftingStation = null; } else if (((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value) == CraftingTable.Custom) { GameObject prefab = ZNetScene.instance.GetPrefab((itemConfig == null || list.Count > 0) ? station.custom : itemConfig.customTable.Value); if (prefab != null) { val.m_craftingStation = prefab.GetComponent(); } else { LogCustomStationWarning("Custom crafting station '" + ((itemConfig == null || list.Count > 0) ? station.custom : itemConfig.customTable.Value) + "' does not exist"); } } else { val.m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value)).GetComponent(); } val.m_minStationLevel = ((itemConfig == null || list.Count > 0) ? station.level : itemConfig.tableLevel.Value); val.m_requireOnlyOneIngredient = ((itemConfig == null) ? recipe.Value.RequireOnlyOneIngredient : (itemConfig.requireOneIngredient.Value == Toggle.On)); val.m_qualityResultAmountMultiplier = itemConfig?.qualityResultAmountMultiplier.Value ?? recipe.Value.QualityResultAmountMultiplier; list.Add(val); RequiredResourceList requiredItems; if (station.Table != CraftingTable.Disabled) { requiredItems = recipe.Value.RequiredItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenCraftRecipes.Add(val, recipe.Value.RecipeIsActive); } } } requiredItems = recipe.Value.RequiredUpgradeItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenUpgradeRecipes.Add(val, recipe.Value.RecipeIsActive); } } } activeRecipes[this].Add(recipe.Key, list); objectDB.m_recipes.AddRange(list); } conversions = new List(); for (int i = 0; i < Conversions.Count; i++) { Conversion conversion = Conversions[i]; conversions.Add(new ItemConversion { m_from = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.input.Value ?? conversion.Input), m_to = Prefab.GetComponent() }); ConversionPiece conversionPiece = conversion.config?.piece.Value ?? conversion.Piece; string text = null; if (conversionPiece != ConversionPiece.Disabled && conversions[i].m_from != null) { text = ((conversionPiece != ConversionPiece.Custom) ? getInternalName(conversionPiece) : (conversion.config?.customPiece.Value ?? conversion.customPiece)); GameObject prefab2 = ZNetScene.instance.GetPrefab(text); Smelter val2 = ((prefab2 != null) ? prefab2.GetComponent() : null); if (val2 != null) { val2.m_conversion.Add(conversions[i]); } else { text = null; } } if (conversion.config != null) { conversion.config.activePiece = text; } } } [HarmonyPriority(0)] internal static void Patch_ObjectDBInit(ObjectDB __instance) { if ((Object)(object)__instance.GetItemPrefab("Wood") == (Object)null) { return; } hiddenCraftRecipes.Clear(); hiddenUpgradeRecipes.Clear(); foreach (Item registeredItem in registeredItems) { registeredItem.registerRecipesInObjectDB(__instance); } } internal static void Patch_TraderGetAvailableItems(Trader __instance, ref List __result) { string prefabName = Utils.GetPrefabName(((Component)__instance).gameObject); Trader trader = ((prefabName == "Haldor") ? Trader.Haldor : ((prefabName == "Hildir") ? Trader.Hildir : Trader.None)); Trader trader2 = trader; __result.AddRange(from tuple in PrefabManager.CustomTradeItems.Values where (tuple.Item1 & trader2) != 0 select tuple.Item2 into tradeItem where string.IsNullOrEmpty(tradeItem.m_requiredGlobalKey) || ZoneSystem.instance.GetGlobalKey(tradeItem.m_requiredGlobalKey) select tradeItem); } internal static void Patch_OnAddSmelterInput(ItemData item, bool __result) { if (__result) { ((Humanoid)Player.m_localPlayer).UnequipItem(item, true); } } internal static void Patch_MaximumRequiredStationLevel(Recipe __instance, ref int __result, int quality) { if (!itemDropMap.TryGetValue(__instance.m_item, out Item value)) { return; } IEnumerable source; if (!itemCraftConfigs.TryGetValue(value, out Dictionary value2)) { source = Enumerable.Empty(); } else { CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if (currentCraftingStation != null) { string stationName = Utils.GetPrefabName(((Component)currentCraftingStation).gameObject); source = from c in value2.Where(delegate(KeyValuePair c) { switch (c.Value.table.Value) { case CraftingTable.Disabled: case CraftingTable.Inventory: return false; case CraftingTable.Custom: return c.Value.customTable.Value == stationName; default: return getInternalName(c.Value.table.Value) == stationName; } }) select c.Value; } else { source = value2.Values; } } __result = Mathf.Min(Mathf.Max(1, __instance.m_minStationLevel) + (quality - 1), (from cfg in source where cfg.maximumTableLevel != null select cfg.maximumTableLevel.Value).DefaultIfEmpty(value.MaximumRequiredStationLevel).Max()); } internal static void Patch_GetAvailableRecipesPrefix(ref Dictionary>? __state) { if (__state == null) { __state = new Dictionary>(); } Dictionary source; if (InventoryGui.instance.InCraftTab()) { source = hiddenCraftRecipes; } else { if (!InventoryGui.instance.InUpradeTab()) { return; } source = hiddenUpgradeRecipes; } List list = (from kv in source select kv.Key into r where r.m_enabled select r).ToList(); __state[Assembly.GetExecutingAssembly()] = list; foreach (Recipe item in list) { item.m_enabled = false; } } internal static void Patch_GetAvailableRecipesFinalizer(Dictionary> __state) { if (!__state.TryGetValue(Assembly.GetExecutingAssembly(), out List value)) { return; } foreach (Recipe item in value) { item.m_enabled = true; } } internal static IEnumerable Transpile_SetupRequirementList(IEnumerable instructionsEnumerable, ILGenerator ilg) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown List list = instructionsEnumerable.ToList(); MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(InventoryGui), "SetupRequirement", (Type[])null, (Type[])null); CodeInstruction val = null; CodeInstruction val2 = null; LocalBuilder localBuilder = ilg.DeclareLocal(typeof(int)); Dictionary dictionary = new Dictionary(); bool flag = false; int num = 0; int value = 0; Label? label = default(Label?); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], methodInfo)) { val = list[i + 2]; val2 = list[i + 5]; flag = true; } if (flag) { if (CodeInstructionExtensions.Branches(list[i], ref label) && dictionary.TryGetValue(label.Value, out value)) { num = i; break; } continue; } foreach (Label label4 in list[i].labels) { dictionary[label4] = i; } } if (list[value - 3].opcode == OpCodes.Dup) { return list; } Label label2 = ilg.DefineLabel(); Label label3 = ilg.DefineLabel(); list[num + 1].labels.Add(label2); list.InsertRange(num + 1, (IEnumerable)(object)new CodeInstruction[11] { new CodeInstruction(OpCodes.Ldloc, (object)localBuilder), new CodeInstruction(OpCodes.Brfalse, (object)label2), val.Clone(), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.DeclaredField(typeof(InventoryGui), "m_recipeRequirementList")), new CodeInstruction(OpCodes.Ldlen, (object)null), new CodeInstruction(OpCodes.Bgt, (object)label2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), val2.Clone(), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Br, (object)label3) }); list.InsertRange(value - 2, (IEnumerable)(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Dup, (object)null) { labels = new List