Decompiled source of FishChum v1.0.3
FishChums.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; [assembly: AssemblyFileVersion("1.0.3")] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyProduct("FishChum")] [assembly: AssemblyCompany("RustyMods")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("FishChum")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<fcb15a03-b359-4d87-89b5-4ad73fd8ca36>Embedded] internal sealed class <fcb15a03-b359-4d87-89b5-4ad73fd8ca36>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] [<fcb15a03-b359-4d87-89b5-4ad73fd8ca36>Embedded] internal sealed class <294b9bed-7320-49dc-ad21-2b53b01b8cb1>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <294b9bed-7320-49dc-ad21-2b53b01b8cb1>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <294b9bed-7320-49dc-ad21-2b53b01b8cb1>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<fcb15a03-b359-4d87-89b5-4ad73fd8ca36>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [CompilerGenerated] internal sealed class <23306c63-723e-4b13-8de0-22af7cc43132>NullableContextAttribute : Attribute { public readonly byte Flag; public <23306c63-723e-4b13-8de0-22af7cc43132>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace FishChums { [BepInPlugin("RustyMods.FishChum", "FishChum", "1.0.3")] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] public class FishChumsPlugin : BaseUnityPlugin { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] public enum Toggle { On = 1, Off = 0 } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] [UsedImplicitly] public string Category; [UsedImplicitly] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 2, 1 })] public Action<ConfigEntryBase> CustomDrawer; } internal const string ModName = "FishChum"; internal const string ModVersion = "1.0.3"; internal const string Author = "RustyMods"; private const string ModGUID = "RustyMods.FishChum"; private static readonly string ConfigFileName = "RustyMods.FishChum.cfg"; private static readonly string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("RustyMods.FishChum"); public static readonly ManualLogSource FishChumsLogger; private static readonly ConfigSync ConfigSync; public static readonly AssetBundle _AssetBundle; private static ConfigEntry<Toggle> _serverConfigLocked; private void InitConfigs() { _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); } public void Awake() { InitConfigs(); Item item = new Item("fishingbaitbundle", "LeviathanChum"); item.Name.English("Leviathan Chum"); item.Description.English("Perfect for attracting leviathans"); item.Crafting.Add(CraftingTable.Forge, 4); item.RequiredItems.Add("FishingBait", 100); item.RequiredItems.Add("SerpentScale", 5); item.RequiredItems.Add("HardAntler", 10); item.RequiredItems.Add("Copper", 5); item.CraftAmount = 1; item.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "leviathanChumSpawner"); Item item2 = new Item("fishingbaitbundle", "FishChumMeadows"); item2.Name.English("Common Chum"); item2.Description.English("Perfect for attracting perch and pike."); item2.Crafting.Add(CraftingTable.Cauldron, 0); item2.RequiredItems.Add("FishingBait", 5); item2.RequiredItems.Add("Dandelion", 10); item2.RequiredItems.Add("LeatherScraps", 2); item2.CraftAmount = 10; item2.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumMeadowsSpawner"); Item item3 = new Item("fishingbaitbundle", "FishChumBlackforest"); item3.Name.English("Curious Chum"); item3.Description.English("Perfect for attracting trollfish."); item3.Crafting.Add(CraftingTable.Cauldron, 0); item3.RequiredItems.Add("FishingBait", 5); item3.RequiredItems.Add("Thistle", 3); item3.RequiredItems.Add("TrollHide", 1); item3.CraftAmount = 10; item3.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumBlackforestSpawner"); Item item4 = new Item("fishingbaitbundle", "FishChumSwamps"); item4.Name.English("Bloody Chum"); item4.Description.English("perfect for attracting giant herrings."); item4.Crafting.Add(CraftingTable.Cauldron, 1); item4.RequiredItems.Add("FishingBait", 5); item4.RequiredItems.Add("Bloodbag", 3); item4.RequiredItems.Add("Guck", 1); item4.CraftAmount = 10; item4.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumSwampsSpawner"); Item item5 = new Item("fishingbaitbundle", "FishChumMountains"); item5.Name.English("Frozen Chum"); item5.Description.English("perfect for attracting tetra fish."); item5.Crafting.Add(CraftingTable.Cauldron, 2); item5.RequiredItems.Add("FishingBait", 5); item5.RequiredItems.Add("FreezeGland", 3); item5.RequiredItems.Add("WolfPelt", 2); item5.CraftAmount = 10; item5.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumMountainsSpawner"); Item item6 = new Item("fishingbaitbundle", "FishChumPlains"); item6.Name.English("Dry Chum"); item6.Description.English("perfect for attracting groupers."); item6.Crafting.Add(CraftingTable.Cauldron, 2); item6.RequiredItems.Add("FishingBait", 5); item6.RequiredItems.Add("Barley", 5); item6.RequiredItems.Add("Flax", 5); item6.CraftAmount = 10; item6.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumPlainsSpawner"); Item item7 = new Item("fishingbaitbundle", "FishChumMistlands"); item7.Name.English("Mysterious Chum"); item7.Description.English("perfect for attracting anglerfish."); item7.Crafting.Add(CraftingTable.Cauldron, 3); item7.RequiredItems.Add("FishingBait", 5); item7.RequiredItems.Add("ChickenEgg", 1); item7.RequiredItems.Add("HareMeat", 1); item7.RequiredItems.Add("LinenThread", 2); item7.CraftAmount = 10; item7.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumMistlandsSpawner"); Item item8 = new Item("fishingbaitbundle", "FishChumAshlands"); item8.Name.English("Burnt Chum"); item8.Description.English("perfect for attracting magmafish."); item8.Crafting.Add(CraftingTable.Cauldron, 3); item8.RequiredItems.Add("FishingBait", 5); item8.RequiredItems.Add("SurtlingCore", 5); item8.RequiredItems.Add("Coal", 5); item8.RequiredItems.Add("LinenThread", 2); item8.CraftAmount = 10; item8.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumAshlandsSpawner"); Item item9 = new Item("fishingbaitbundle", "FishChumDeepnorth"); item9.Name.English("Frosted Chum"); item9.Description.English("perfect for attracting northern salmon."); item9.Crafting.Add(CraftingTable.Cauldron, 3); item9.RequiredItems.Add("FishingBait", 5); item9.RequiredItems.Add("BugMeat", 2); item9.RequiredItems.Add("MushroomJotunPuffs", 1); item9.RequiredItems.Add("LinenThread", 2); item9.CraftAmount = 10; item9.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumDeepnorthSpawner"); Item item10 = new Item("fishingbaitbundle", "FishChumOcean"); item10.Name.English("Deepsea Chum"); item10.Description.English("perfect for attracting tuna and coral cod."); item10.Crafting.Add(CraftingTable.Cauldron, 1); item10.RequiredItems.Add("FishingBait", 5); item10.RequiredItems.Add("Ooze", 3); item10.RequiredItems.Add("LeatherScraps", 2); item10.RequiredItems.Add("Dandelion", 5); item10.CraftAmount = 10; item10.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "FishChumOceanSpawner"); Item item11 = new Item("fishingbaitbundle", "SerpentChum"); item11.Name.English("Serpent chum"); item11.Description.English("Perfect for attracting serpents"); item11.Crafting.Add(CraftingTable.Cauldron, 3); item11.RequiredItems.Add("WolfMeat", 1); item11.RequiredItems.Add("Bloodbag", 2); item11.RequiredItems.Add("LeatherScraps", 3); item11.RequiredItems.Add("Thistle", 2); item11.CraftAmount = 1; item11.Configurable = Configurability.Recipe; PrefabManager.RegisterPrefab(PrefabManager.RegisterAssetBundle("fishingbaitbundle"), "SerpentChumSpawner"); Item item12 = new Item("fishingbaitbundle", "PerchStew"); item12.Name.English("Perch Stew"); item12.Description.English("Deliciously balanced"); item12.Crafting.Add(CraftingTable.Cauldron, 1); item12.RequiredItems.Add("Fish1", 1); item12.RequiredItems.Add("Carrot", 1); item12.RequiredItems.Add("Turnip", 1); item12.QualityResultAmountMultiplier = 2f; item12.CraftAmount = 1; Item item13 = new Item("fishingbaitbundle", "TrollfishMeat"); item13.Name.English("Trollfish Meat"); item13.Description.English("Juicy, slimy troll fish meat"); item13.Crafting.Add(CraftingTable.Cauldron, 0); item13.RequiredItems.Add("Fish5", 1); item13.CraftAmount = 1; Item item14 = new Item("fishingbaitbundle", "TrollfishMeatCooked"); item14.Name.English("Cooked Trollfish"); item14.Description.English("Still unusually slimy"); item14.Crafting.Add(CraftingTable.Cauldron, 0); item14.RequiredItems.Add("SwordCheat", 1); item14.CraftAmount = 1; item14.Configurable = Configurability.Stats; Item item15 = new Item("fishingbaitbundle", "PikeSoup"); item15.Name.English("Pike Soup"); item15.Description.English("Smells of the sea"); item15.Crafting.Add(CraftingTable.Cauldron, 0); item15.RequiredItems.Add("Fish2", 1); item15.RequiredItems.Add("Thistle", 2); item15.RequiredItems.Add("Turnip", 3); item15.CraftAmount = 1; Item item16 = new Item("fishingbaitbundle", "FishBallUncooked"); item16.Name.English("Uncooked fishballs"); item16.Description.English("Delicious breaded fishballs ready for the oven"); item16.Crafting.Add(CraftingTable.Cauldron, 2); item16.RequiredItems.Add("Fish7", 1); item16.RequiredItems.Add("BarleyFlour", 5); item16.RequiredItems.Add("Dandelion", 3); item16.CraftAmount = 1; Item item17 = new Item("fishingbaitbundle", "FishBallCooked"); item17.Name.English("Fishballs"); item17.Description.English("Delicious breaded fishballs"); item17.Crafting.Add(CraftingTable.Cauldron, 4); item17.RequiredItems.Add("SwordCheat", 1); item17.CraftAmount = 1; item17.Configurable = Configurability.Stats; Item item18 = new Item("fishingbaitbundle", "TunaSalad"); item18.Name.English("Tuna salad"); item18.Description.English("Surprisingly healthy"); item18.Crafting.Add(CraftingTable.Cauldron, 2); item18.RequiredItems.Add("Fish3", 1); item18.RequiredItems.Add("Thistle", 3); item18.RequiredItems.Add("Onion", 1); item18.RequiredItems.Add("Dandelion", 3); item18.CraftAmount = 1; Item item19 = new Item("fishingbaitbundle", "TetraStew"); item19.Name.English("Tetra stew"); item19.Description.English("Stewed to chilled perfection"); item19.Crafting.Add(CraftingTable.Cauldron, 2); item19.RequiredItems.Add("Fish4_cave", 1); item19.RequiredItems.Add("FreezeGland", 1); item19.RequiredItems.Add("Onion", 1); item19.RequiredItems.Add("Turnip", 3); item19.CraftAmount = 1; Item item20 = new Item("fishingbaitbundle", "SteamedHerring"); item20.Name.English("Steamed herring"); item20.Description.English("Steamed and ready to eat"); item20.Crafting.Add(CraftingTable.Cauldron, 2); item20.RequiredItems.Add("Fish6", 1); item20.RequiredItems.Add("Root", 1); item20.CraftAmount = 1; Item item21 = new Item("fishingbaitbundle", "CoralDelightUncooked"); item21.Name.English("Uncooked coral delight"); item21.Description.English("Dredged in egg yolk and barley flour"); item21.Crafting.Add(CraftingTable.Cauldron, 2); item21.RequiredItems.Add("Fish8", 1); item21.RequiredItems.Add("ChickenEgg", 1); item21.RequiredItems.Add("BarleyFlour", 10); item21.CraftAmount = 1; Item item22 = new Item("fishingbaitbundle", "CoralDelightCooked"); item22.Name.English("Coral Delight"); item22.Description.English("Baked to perfection"); item22.Crafting.Add(CraftingTable.Cauldron, 4); item22.RequiredItems.Add("SwordCheat", 1); item22.CraftAmount = 1; item22.Configurable = Configurability.Stats; Item item23 = new Item("fishingbaitbundle", "BakedSalmonUncooked"); item23.Name.English("Uncooked salmon"); item23.Description.English("Sliced and plated, ready for the oven"); item23.Crafting.Add(CraftingTable.Cauldron, 2); item23.RequiredItems.Add("Fish10", 1); item23.RequiredItems.Add("MushroomMagecap", 5); item23.RequiredItems.Add("Thistle", 10); item23.CraftAmount = 1; Item item24 = new Item("fishingbaitbundle", "BakedSalmonCooked"); item24.Name.English("Baked Salmon"); item24.Description.English("Smooth balanced flavors"); item24.Crafting.Add(CraftingTable.Cauldron, 4); item24.RequiredItems.Add("SwordCheat", 1); item24.CraftAmount = 1; item24.Configurable = Configurability.Stats; Item item25 = new Item("fishingbaitbundle", "BakedMagmafishUncooked"); item25.Name.English("Uncooked Magmafish"); item25.Description.English("Just plate it and toss it in the oven"); item25.Crafting.Add(CraftingTable.Cauldron, 2); item25.RequiredItems.Add("Fish11", 1); item25.RequiredItems.Add("Dandelion", 5); item25.RequiredItems.Add("Thistle", 5); item25.RequiredItems.Add("RoyalJelly", 10); item25.CraftAmount = 1; Item item26 = new Item("fishingbaitbundle", "BakedMagmafishCooked"); item26.Name.English("Baked Magmafish"); item26.Description.English("Spicy hot baked fish"); item26.Crafting.Add(CraftingTable.Cauldron, 4); item26.RequiredItems.Add("SwordCheat", 1); item26.CraftAmount = 1; item26.Configurable = Configurability.Stats; Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private static AssetBundle GetAssetBundle(string fileName) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (string str) => str.EndsWith(fileName)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { FishChumsLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { FishChumsLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); FishChumsLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<[<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<[<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } static FishChumsPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; FishChumsLogger = Logger.CreateLogSource("FishChum"); ConfigSync = new ConfigSync("RustyMods.FishChum") { DisplayName = "FishChum", CurrentVersion = "1.0.3", MinimumRequiredVersion = "1.0.3" }; _AssetBundle = GetAssetBundle("fishingbaitbundle"); _serverConfigLocked = null; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown FishChumsPlugin.FishChumsLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register<ZPackage>("FishChum_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_FishChums_Version); FishChumsPlugin.FishChumsLogger.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.0.3"); val.Write(RpcHandlers.ComputeHashForMod().Replace("-", "")); peer.m_rpc.Invoke("FishChum_VersionCheck", new object[1] { val }); } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } FishChumsPlugin.FishChumsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") never sent version or couldn't due to previous disconnect, disconnecting")); rpc.Invoke("Error", new object[1] { 3 }); return false; } private static void Postfix(ZNet __instance) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.instance.GetServerPeerID(), "FishChumRequestAdminSync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMax = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + FishChumsPlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { FishChumsPlugin.FishChumsLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list")); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] public static class RpcHandlers { public static readonly List<ZRpc> ValidatedPeers = new List<ZRpc>(); public static void RPC_FishChums_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); string text2 = pkg.ReadString(); string text3 = ComputeHashForMod().Replace("-", ""); FishChumsPlugin.FishChumsLogger.LogInfo((object)("Version check, local: 1.0.3, remote: " + text)); if (text2 != text3 || text != "1.0.3") { FishChumsPlugin.ConnectionError = "FishChum Installed: 1.0.3 " + text3 + "\n Needed: " + text + " " + text2; if (ZNet.instance.IsServer()) { FishChumsPlugin.FishChumsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { FishChumsPlugin.FishChumsLogger.LogInfo((object)"Received same version from server!"); } else { FishChumsPlugin.FishChumsLogger.LogInfo((object)("Adding peer (" + rpc.m_socket.GetHostName() + ") to validated list")); ValidatedPeers.Add(rpc); } } public static string ComputeHashForMod() { using SHA256 sHA = SHA256.Create(); byte[] array = sHA.ComputeHash(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location)); StringBuilder stringBuilder = new StringBuilder(); byte[] array2 = array; foreach (byte b in array2) { stringBuilder.Append(b.ToString("X2")); } return stringBuilder.ToString(); } } } namespace FishChums.Solution { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] public static class Patches { [HarmonyPatch(typeof(LootSpawner), "UpdateSpawner")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private static class LootSpawnerUpdateSpawnerPatch { private static bool Prefix(LootSpawner __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected I4, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)__instance)) { return false; } string name = ((Object)__instance).name; string setPrefabSharedName = getSetPrefabSharedName(name); Biome val = Heightmap.FindBiome(((Component)__instance).transform.position); Biome val2 = val; if ((int)val2 <= 32) { switch ((int)val2) { case 0: return false; case 1: goto IL_00b6; case 2: goto IL_00d3; case 4: goto IL_00f0; case 8: goto IL_010d; case 3: case 5: case 6: case 7: goto IL_019d; } if ((int)val2 != 16) { if ((int)val2 != 32) { goto IL_019d; } if (name == "FishChumAshlandsSpawner(Clone)") { return true; } } else if (name == "FishChumPlainsSpawner(Clone)") { return true; } } else if ((int)val2 != 64) { if ((int)val2 != 256) { if ((int)val2 != 512) { goto IL_019d; } if (name == "FishChumMistlandsSpawner(Clone)") { return true; } } else if (name == "FishChumOceanSpawner(Clone)") { return true; } } else if (name == "FishChumDeepnorthSpawner(Clone)") { return true; } goto IL_01a3; IL_010d: if (name == "FishChumBlackforestSpawner(Clone)") { return true; } goto IL_01a3; IL_01a3: MessageHud.instance.ShowMessage((MessageType)1, setPrefabSharedName + " is not attracting any fish in this area", 0, (Sprite)null); return false; IL_00b6: if (name == "FishChumMeadowsSpawner(Clone)") { return true; } goto IL_01a3; IL_019d: throw new ArgumentOutOfRangeException(); IL_00f0: if (name == "FishChumMountainsSpawner(Clone)") { return true; } goto IL_01a3; IL_00d3: if (name == "FishChumSwampsSpawner(Clone)") { return true; } goto IL_01a3; } private static string getSetPrefabSharedName(string objName) { return objName switch { "FishChumMeadowsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumMeadows"), "FishChumBlackforestSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumBlackforest"), "FishChumSwampsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumSwamps"), "FishChumMountainsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumMountains"), "FishChumOceanSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumOcean"), "FishChumPlainsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumPlains"), "FishChumMistlandsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumMistlands"), "FishChumAshlandsSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumAshlands"), "FishChumDeepnorthSpawner(Clone)" => getItemDropSharedName(ZNetScene.instance, "FishChumDeepnorth"), _ => "Fish Chum", }; } private static string getItemDropSharedName(ZNetScene scene, string gameObjectName) { ItemDrop component = scene.GetPrefab(gameObjectName).GetComponent<ItemDrop>(); return component.m_itemData.m_shared.m_name; } } [HarmonyPatch(typeof(SpawnArea), "UpdateSpawn")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private static class SpawnAreaUpdateSpawnPatch { private static bool Prefix(SpawnArea __instance) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_007b: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0092: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)__instance)) { return false; } string name = ((Object)__instance).name; if (isSerpentChumSpawner(name)) { Biome val = Heightmap.FindBiome(((Component)__instance).transform.position); Biome val2 = val; if ((int)val2 == 256) { return true; } MessageHud.instance.ShowMessage((MessageType)1, "Serpent Chum doesn't work in shallow waters", 0, (Sprite)null); return false; } if (name == "leviathanChumSpawner(Clone)") { Biome val3 = Heightmap.FindBiome(((Component)__instance).transform.position); Biome val4 = val3; if ((int)val4 == 256) { return true; } MessageHud.instance.ShowMessage((MessageType)1, "Leviathan Chum doesn't work in shallow waters", 0, (Sprite)null); return false; } return true; } private static bool isSerpentChumSpawner(string gameObjectName) { return gameObjectName == "SerpentChumSpawner(Clone)"; } } [HarmonyPatch(typeof(ZNetScene), "Awake")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private static class OvenPatch { public static void Postfix(ZNetScene __instance) { if (Object.op_Implicit((Object)(object)__instance)) { AddCookingStationConversion(__instance, "TrollfishMeat", "TrollfishMeatCooked", 25f, "piece_cookingstation", "piece_cookingstation_iron"); AddCookingStationConversion(__instance, "FishBallUncooked", "FishBallCooked", 10f, "piece_oven"); AddCookingStationConversion(__instance, "CoralDelightUncooked", "CoralDelightCooked", 10f, "piece_oven"); AddCookingStationConversion(__instance, "BakedSalmonUncooked", "BakedSalmonCooked", 10f, "piece_oven"); AddCookingStationConversion(__instance, "BakedMagmaFishUncooked", "BakedMagmaFishCooked", 10f, "piece_oven"); } } private static void AddCookingStationConversion(ZNetScene scene, string fromItemName, string toItemName, float cookTime, params string[] stationNames) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown GameObject prefab = scene.GetPrefab(fromItemName); if (!Object.op_Implicit((Object)(object)prefab)) { return; } GameObject prefab2 = scene.GetPrefab(toItemName); if (!Object.op_Implicit((Object)(object)prefab2)) { return; } foreach (string text in stationNames) { GameObject prefab3 = scene.GetPrefab(text); if (Object.op_Implicit((Object)(object)prefab3)) { CookingStation component = prefab3.GetComponent<CookingStation>(); ItemConversion item = new ItemConversion { m_from = prefab.GetComponent<ItemDrop>(), m_to = prefab2.GetComponent<ItemDrop>(), m_cookTime = cookTime }; component.m_conversion.Add(item); } } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] public static class LootSpawnerPatch { public static void Postfix(ZNetScene __instance) { AddLootSpawnerItemDrops(__instance, "FishChumMeadowsSpawner", 1, 1, 1f, "Fish1", "Fish2"); AddLootSpawnerItemDrops(__instance, "FishChumBlackforestSpawner", 1, 1, 1f, "Fish1", "Fish2", "Fish5"); AddLootSpawnerItemDrops(__instance, "FishChumSwampsSpawner", 1, 1, 1f, "Fish2", "Fish6"); AddLootSpawnerItemDrops(__instance, "FishChumOceanSpawner", 1, 1, 1f, "Fish3", "Fish8", "Fish12"); AddLootSpawnerItemDrops(__instance, "FishChumMountainsSpawner", 1, 1, 1f, "Fish4_cave"); AddLootSpawnerItemDrops(__instance, "FishChumPlainsSpawner", 1, 1, 1f, "Fish7", "Fish8"); AddLootSpawnerItemDrops(__instance, "FishChumMistlandsSpawner", 1, 1, 1f, "Fish9", "Fish12"); AddLootSpawnerItemDrops(__instance, "FishChumAshlandsSpawner", 1, 1, 1f, "Fish11", "Fish12"); AddLootSpawnerItemDrops(__instance, "FishChumDeepnorthSpawner", 1, 1, 1f, "Fish10", "Fish12"); } private static void AddLootSpawnerItemDrops(ZNetScene scene, string spawnerPrefabName, int stackMinValue = 1, int stackMaxValue = 1, float weightValue = 1f, params string[] itemPrefabNames) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) LootSpawner component = scene.GetPrefab(spawnerPrefabName).GetComponent<LootSpawner>(); if (!Object.op_Implicit((Object)(object)component)) { return; } foreach (string text in itemPrefabNames) { GameObject prefab = scene.GetPrefab(text); if (!Object.op_Implicit((Object)(object)prefab)) { return; } DropData val = default(DropData); val.m_item = prefab; val.m_weight = weightValue; val.m_stackMax = stackMaxValue; val.m_stackMin = stackMinValue; DropData item = val; component.m_items.m_drops.Add(item); } component.m_respawnTimeMinuts = 1f; } } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class RegisterPrefabs { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static void Postfix(ZNetScene __instance) { if (!Object.op_Implicit((Object)(object)__instance)) { return; } GameObject val = FishChumsPlugin._AssetBundle.LoadAsset<GameObject>("sfx_fishchum_throw"); if (Object.op_Implicit((Object)(object)val)) { val.AddComponent<ZNetView>(); if (!__instance.m_prefabs.Contains(val)) { __instance.m_prefabs.Add(val); } __instance.m_namedPrefabs[StringExtensionMethods.GetStableHashCode(((Object)val).name)] = val; } GameObject val2 = FishChumsPlugin._AssetBundle.LoadAsset<GameObject>("sfx_fishchum_explode"); if (Object.op_Implicit((Object)(object)val2)) { val2.AddComponent<ZNetView>(); if (!__instance.m_prefabs.Contains(val2)) { __instance.m_prefabs.Add(val2); } __instance.m_namedPrefabs[StringExtensionMethods.GetStableHashCode(((Object)val2).name)] = val2; } } } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class SpawnAreaPatch { public static void Postfix(ZNetScene __instance) { if (Object.op_Implicit((Object)(object)__instance)) { AddSpawnAreaSpawnData(__instance, "SerpentChumSpawner", "Serpent", 1f, 1, 2, 10); AddSpawnAreaSpawnData(__instance, "leviathanChumSpawner", "Leviathan", 1f, 1, 1, 40); } } private static void AddSpawnAreaSpawnData(ZNetScene scene, string spawnerAreaPrefabName, string gameObjectName, float weight = 1f, int minLevel = 1, int maxLevel = 1, int spawnIntervalSec = 30, int maxNear = 1, int maxTotal = 1) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)scene)) { return; } SpawnArea component = scene.GetPrefab(spawnerAreaPrefabName).GetComponent<SpawnArea>(); if (Object.op_Implicit((Object)(object)component)) { GameObject prefab = scene.GetPrefab(gameObjectName); if (Object.op_Implicit((Object)(object)prefab)) { SpawnData item = new SpawnData { m_prefab = prefab, m_weight = weight, m_minLevel = minLevel, m_maxLevel = maxLevel }; component.m_prefabs.Add(item); component.m_levelupChance = 0f; component.m_spawnIntervalSec = spawnIntervalSec; component.m_triggerDistance = 50f; component.m_setPatrolSpawnPoint = true; component.m_spawnRadius = 25f; component.m_nearRadius = 20f; component.m_farRadius = 1000f; component.m_maxNear = maxNear; component.m_maxTotal = maxTotal; component.m_onGroundOnly = false; } } } } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] [HarmonyPatch(typeof(SpawnArea), "SpawnOne")] private static class SpawnAreaSpawnOnePatch { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static bool Prefix(SpawnArea __instance) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance)) { return false; } if (__instance.m_prefabs.Find((SpawnData x) => ((Object)x.m_prefab).name == "Leviathan") == null) { return true; } SpawnData val = __instance.SelectWeightedPrefab(); Vector3 val2 = default(Vector3); if (val == null || !__instance.FindSpawnPoint(val.m_prefab, ref val2)) { return false; } Object.Instantiate<GameObject>(val.m_prefab, val2, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); return false; } } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] private static class DoCraftingPatch { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] private static void Postfix(InventoryGui __instance, Player player) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)player) || (Object)(object)__instance.m_craftRecipe == (Object)null || (int)__instance.m_craftRecipe.m_item.m_itemData.m_shared.m_itemType != 2) { return; } Requirement[] resources = __instance.m_craftRecipe.m_resources; foreach (Requirement val in resources) { if ((int)val.m_resItem.m_itemData.m_shared.m_itemType == 21) { ItemData item = ((Humanoid)player).GetInventory().GetItem(val.m_resItem.m_itemData.m_shared.m_name, -1, false); if (item != null && item.m_quality > 1) { ((Humanoid)player).GetInventory().AddItem(((Object)((Component)__instance.m_craftRecipe.m_item).gameObject).name, item.m_quality, 1, -1, player.GetPlayerID(), player.GetPlayerName(), false); break; } } } } } } } namespace ItemManager { [PublicAPI] public 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, Custom } [PublicAPI] public enum ConversionPiece { Disabled, [InternalName("smelter")] Smelter, [InternalName("charcoal_kiln")] CharcoalKiln, [InternalName("blastfurnace")] BlastFurnace, [InternalName("windmill")] Windmill, [InternalName("piece_spinningwheel")] SpinningWheel, [InternalName("eitrrefinery")] EitrRefinery, Custom } [PublicAPI] public enum CookingPiece { Disabled, [InternalName("piece_oven")] Oven, [InternalName("piece_cookingstation")] CookingStation, [InternalName("piece_cookingstation_iron")] IronCookingStation, Custom } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [PublicAPI] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] public class RequiredResourceList { public readonly List<Requirement> Requirements = new List<Requirement>(); public bool Free = false; 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<int> amountConfig, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amountConfig = amountConfig, quality = quality }); } } [PublicAPI] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] public class CraftingStationList { public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>(); 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 }); } } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [PublicAPI] public 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 = false; public float QualityResultAmountMultiplier = 1f; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public ConfigEntryBase RecipeIsActive = null; } [PublicAPI] public class Trade { public Trader Trader = Trader.None; public uint Price = 0u; public uint Stack = 1u; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public string RequiredGlobalKey = null; } [Flags] [PublicAPI] public enum Trader { None = 0, Haldor = 1, Hildir = 2 } public struct Requirement { [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(1)] public string itemName; public int amount; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public ConfigEntry<int> amountConfig; [Description("Set to a non-zero value to apply the requirement only for a specific quality")] public int quality; } public struct CraftingStationConfig { public CraftingTable Table; public int level; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public string custom; } [Flags] public enum Configurability { Disabled = 0, Recipe = 1, Stats = 2, Drop = 4, Trader = 8, Full = 0xF } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] [PublicAPI] public class DropTargets { public readonly List<DropTarget> Drops = new List<DropTarget>(); 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 }); } } public struct DropTarget { [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(1)] public string creature; public int min; public int max; public float chance; public bool levelMultiplier; } public enum Toggle { On = 1, Off = 0 } [PublicAPI] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(1)] public class Item { [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private class ItemConfig { [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 2, 1 })] public ConfigEntry<string> craft; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 2, 1 })] public ConfigEntry<string> upgrade; public ConfigEntry<CraftingTable> table = null; public ConfigEntry<int> tableLevel = null; public ConfigEntry<string> customTable = null; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public ConfigEntry<int> maximumTableLevel; public ConfigEntry<Toggle> requireOneIngredient = null; public ConfigEntry<float> qualityResultAmountMultiplier = null; } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private class TraderConfig { public ConfigEntry<Trader> trader = null; public ConfigEntry<uint> price = null; public ConfigEntry<uint> stack = null; public ConfigEntry<string> requiredGlobalKey = null; } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] private class RequirementQuality { public int quality; } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(2)] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string Category; [UsedImplicitly] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 2, 1 })] public Action<ConfigEntryBase> CustomDrawer; public Func<bool> browsability; } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] [PublicAPI] public enum DamageModifier { Normal, Resistant, Weak, Immune, Ignore, VeryResistant, VeryWeak, None } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] private delegate void setDmgFunc(ref DamageTypes dmg, float value); [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private class SerializedRequirements { public readonly List<Requirement> Reqs; public SerializedRequirements(List<Requirement> reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) : this(reqs.Split(new char[1] { ',' }).Select([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (string r) => { string[] array = r.Split(new char[1] { ':' }); Requirement result = default(Requirement); result.itemName = array[0]; result.amount = ((array.Length <= 1 || !int.TryParse(array[1], out var result2)) ? 1 : result2); result.quality = ((array.Length > 2 && int.TryParse(array[2], out var result3)) ? result3 : 0); return result; }).ToList()) { } public override string ToString() { return string.Join(",", Reqs.Select([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : ""))); } [return: <294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public static ItemDrop fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade) { //IL_0100: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01b7: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (Requirement r) => { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) ItemDrop val6 = ResItem(r); return (val6 == null) ? ((Requirement)null) : new Requirement { m_amount = (r.amountConfig?.Value ?? r.amount), m_resItem = val6, m_amountPerLevel = 0 }; })); List<Requirement> list = dictionary.Values.Where([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (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(); [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(2)] ItemDrop ResItem(Requirement r) { return fetchByName(objectDB, r.itemName); } } } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(0)] private class SerializedDrop { public readonly List<DropTarget> Drops; public SerializedDrop(List<DropTarget> drops) { Drops = drops; } public SerializedDrop(string drops) { Drops = ((drops == "") ? ((IEnumerable<string>)Array.Empty<string>()) : ((IEnumerable<string>)drops.Split(new char[1] { ',' }))).Select([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (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"; DropTarget result3 = default(DropTarget); result3.creature = array[0]; result3.chance = ((array.Length > 1 && float.TryParse(array[1], out var result4)) ? result4 : 1f); result3.min = result; result3.max = result2; result3.levelMultiplier = levelMultiplier; return result3; }).ToList(); } public override string ToString() { return string.Join(",", Drops.Select([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0"))); } [return: <294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private static Character fetchByName(ZNetScene netScene, string name) { GameObject prefab = netScene.GetPrefab(name); Character val = ((prefab != null) ? prefab.GetComponent<Character>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The drop target character '" + name + "' does not exist.")); } return val; } public Dictionary<Character, Drop> toCharacterDrops(ZNetScene netScene, GameObject item) { //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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown Dictionary<Character, Drop> dictionary = new Dictionary<Character, Drop>(); 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<Item> registeredItems = new List<Item>(); private static readonly Dictionary<ItemDrop, Item> itemDropMap = new Dictionary<ItemDrop, Item>(); private static Dictionary<Item, Dictionary<string, List<Recipe>>> activeRecipes = new Dictionary<Item, Dictionary<string, List<Recipe>>>(); [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 1, 1, 2 })] private static Dictionary<Recipe, ConfigEntryBase> hiddenCraftRecipes = new Dictionary<Recipe, ConfigEntryBase>(); [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(new byte[] { 1, 1, 2 })] private static Dictionary<Recipe, ConfigEntryBase> hiddenUpgradeRecipes = new Dictionary<Recipe, ConfigEntryBase>(); private static Dictionary<Item, Dictionary<string, ItemConfig>> itemCraftConfigs = new Dictionary<Item, Dictionary<string, ItemConfig>>(); private static Dictionary<Item, ConfigEntry<string>> itemDropConfigs = new Dictionary<Item, ConfigEntry<string>>(); private Dictionary<CharacterDrop, Drop> characterDrops = new Dictionary<CharacterDrop, Drop>(); private readonly Dictionary<ConfigEntryBase, Action> statsConfigs = new Dictionary<ConfigEntryBase, Action>(); private static readonly ConditionalWeakTable<Requirement, RequirementQuality> requirementQuality = new ConditionalWeakTable<Requirement, RequirementQuality>(); public static Configurability DefaultConfigurability = Configurability.Full; public Configurability? Configurable = null; private Configurability configurationVisible = Configurability.Full; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private TraderConfig traderConfig; public readonly GameObject Prefab; public List<string> StartEffects = new List<string>(); public List<string> HoldEffects = new List<string>(); public List<string> EquipEffects = new List<string>(); public List<string> UnEquipEffects = new List<string>(); public List<string> TriggerEffects = new List<string>(); public List<string> TrailStartEffects = new List<string>(); [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<Conversion> Conversions = new List<Conversion>(); internal List<ItemConversion> conversions = new List<ItemConversion>(); internal List<CookingConversion> CookingConversions = new List<CookingConversion>(); internal List<ItemConversion> cookingConversions = new List<ItemConversion>(); public Dictionary<string, ItemRecipe> Recipes = new Dictionary<string, ItemRecipe>(); [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private LocalizeKey _name; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private LocalizeKey _description; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private static object configManager; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private static Localization _english; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private static BaseUnityPlugin _plugin; private static bool hasConfigSync = true; [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] 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.")] [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] public ConfigEntryBase RecipeIsActive { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(2)] get { return this[""].RecipeIsActive; } [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(2)] 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 var value)) { return value; } return Recipes[name] = new ItemRecipe(); } } public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } SharedData shared = Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; if (shared.m_name.StartsWith("$")) { _name = new LocalizeKey(shared.m_name); } else { string text = "$item_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(shared.m_name); shared.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } SharedData shared = Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; if (shared.m_description.StartsWith("$")) { _description = new LocalizeKey(shared.m_description); } else { string text = "$itemdesc_" + ((Object)Prefab).name.Replace(" ", "_"); _description = new LocalizeKey(text).English(shared.m_description); shared.m_description = text; } return _description; } } private static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); private static BaseUnityPlugin plugin { get { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown if (_plugin == null) { IEnumerable<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } [<294b9bed-7320-49dc-ad21-2b53b01b8cb1>Nullable(2)] private static object configSync { [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(2)] 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 void AddConsumeEffect(StatusEffect statusEffect) { SharedData shared = Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_consumeStatusEffect = statusEffect; } 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<ItemDrop>()] = this; Prefab.GetComponent<ItemDrop>().m_itemData.m_dropPrefab = Prefab; } public void ToggleConfigurationVisibility(Configurability visible) { configurationVisible = visible; if (itemDropConfigs.TryGetValue(this, out var value)) { Toggle((ConfigEntryBase)(object)value, Configurability.Drop); } if (itemCraftConfigs.TryGetValue(this, out var 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<ConfigEntryBase, Action> statsConfig in statsConfigs) { Toggle(statsConfig.Key, Configurability.Stats); if ((visible & Configurability.Stats) != 0) { statsConfig.Value(); } } reloadConfigDisplay(); void Toggle(ConfigEntryBase cfg, Configurability check) { object[] tags = cfg.Description.Tags; foreach (object obj2 in tags) { if (obj2 is ConfigurationManagerAttributes configurationManagerAttributes) { configurationManagerAttributes.Browsable = (visible & check) != 0 && (configurationManagerAttributes.browsability == null || configurationManagerAttributes.browsability()); } } } void ToggleObj(object obj, Configurability check) { FieldInfo[] fields = obj.GetType().GetFields(); foreach (FieldInfo fieldInfo in fields) { object? value3 = fieldInfo.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<object>()); } } private void UpdateItemTableConfig(string recipeKey, CraftingTable table, string customTableValue) { if (activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(recipeKey, out var 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<CraftingStation>() : null); } else { value.First().m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName(table)).GetComponent<CraftingStation>(); } } } 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 var value)) { return; } foreach (Recipe item in value) { item.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, craftRequirements, upgradeRequirements); } } internal static void Patch_FejdStartup() { //IL_1353: Unknown result type (might be due to invalid IL or missing references) //IL_1358: Unknown result type (might be due to invalid IL or missing references) //IL_10a1: Unknown result type (might be due to invalid IL or missing references) //IL_10ab: Expected O, but got Unknown //IL_114d: Unknown result type (might be due to invalid IL or missing references) //IL_1157: Expected O, but got Unknown //IL_11f9: Unknown result type (might be due to invalid IL or missing references) //IL_1203: Expected O, but got Unknown //IL_26e7: Unknown result type (might be due to invalid IL or missing references) //IL_26f1: Expected O, but got Unknown //IL_12ae: Unknown result type (might be due to invalid IL or missing references) //IL_12b8: Expected O, but got Unknown //IL_0cbd: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Expected O, but got Unknown //IL_1420: Unknown result type (might be due to invalid IL or missing references) //IL_1423: Unknown result type (might be due to invalid IL or missing references) //IL_1479: Expected I4, but got Unknown //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0deb: Unknown result type (might be due to invalid IL or missing references) //IL_0df5: Expected O, but got Unknown //IL_0e97: Unknown result type (might be due to invalid IL or missing references) //IL_0ea1: Expected O, but got Unknown //IL_15b9: Unknown result type (might be due to invalid IL or missing references) //IL_15bc: Unknown result type (might be due to invalid IL or missing references) //IL_15be: Invalid comparison between Unknown and I4 //IL_0f4c: Unknown result type (might be due to invalid IL or missing references) //IL_0f56: Expected O, but got Unknown //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_15c2: Unknown result type (might be due to invalid IL or missing references) //IL_15c6: Invalid comparison between Unknown and I4 //IL_17db: Unknown result type (might be due to invalid IL or missing references) //IL_17de: Unknown result type (might be due to invalid IL or missing references) //IL_17e0: Invalid comparison between Unknown and I4 //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Expected O, but got Unknown //IL_15ca: Unknown result type (might be due to invalid IL or missing references) //IL_15ce: Invalid comparison between Unknown and I4 //IL_17e4: Unknown result type (might be due to invalid IL or missing references) //IL_17e8: Unknown result type (might be due to invalid IL or missing references) //IL_17ea: Invalid comparison between Unknown and I4 //IL_18d3: Unknown result type (might be due to invalid IL or missing references) //IL_18d8: Unknown result type (might be due to invalid IL or missing references) //IL_18da: Unknown result type (might be due to invalid IL or missing references) //IL_18dd: Invalid comparison between Unknown and I4 //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Expected O, but got Unknown //IL_06eb: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Expected O, but got Unknown //IL_17ee: Unknown result type (might be due to invalid IL or missing references) //IL_17f2: Invalid comparison between Unknown and I4 //IL_18e1: Unknown result type (might be due to invalid IL or missing references) //IL_18e5: Invalid comparison between Unknown and I4 //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08ba: Expected O, but got Unknown //IL_195e: Unknown result type (might be due to invalid IL or missing references) //IL_1961: Unknown result type (might be due to invalid IL or missing references) //IL_1963: Invalid comparison between Unknown and I4 //IL_1967: Unknown result type (might be due to invalid IL or missing references) //IL_196b: Unknown result type (might be due to invalid IL or missing references) //IL_196d: Invalid comparison between Unknown and I4 //IL_1ac0: Unknown result type (might be due to invalid IL or missing references) //IL_1ac3: Invalid comparison between Unknown and I4 //IL_1971: Unknown result type (might be due to invalid IL or missing references) //IL_1975: Invalid comparison between Unknown and I4 //IL_1cd2: Unknown result type (might be due to invalid IL or missing references) //IL_1cd9: Invalid comparison between Unknown and I4 //IL_1dae: Unknown result type (might be due to invalid IL or missing references) //IL_1db3: Unknown result type (might be due to invalid IL or missing references) //IL_1db5: Unknown result type (might be due to invalid IL or missing references) //IL_1db9: Unknown result type (might be due to invalid IL or missing references) //IL_1dbb: Invalid comparison between Unknown and I4 //IL_1a30: Unknown result type (might be due to invalid IL or missing references) //IL_1a35: Unknown result type (might be due to invalid IL or missing references) //IL_1e34: Unknown result type (might be due to invalid IL or missing references) //IL_1e37: Unknown result type (might be due to invalid IL or missing references) //IL_1e39: Invalid comparison between Unknown and I4 //IL_1e3d: Unknown result type (might be due to invalid IL or missing references) //IL_1e41: Invalid comparison between Unknown and I4 //IL_1e45: Unknown result type (might be due to invalid IL or missing references) //IL_1e49: Invalid comparison between Unknown and I4 //IL_22da: Unknown result type (might be due to invalid IL or missing references) //IL_22dd: Invalid comparison between Unknown and I4 Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); if (DefaultConfigurability != 0) { bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (Item item4 in registeredItems.Where([<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (Item i) => i.configurability != Configurability.Disabled)) { Item item3 = item4; string name2 = item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(name2), "").Trim(); string localizedName = Localization.instance.Localize(name2).Trim(); int order = 0; if ((item3.configurability & Configurability.Recipe) != 0) { itemCraftConfigs[item3] = new Dictionary<string, ItemConfig>(); foreach (string item5 in item3.Recipes.Keys.DefaultIfEmpty("")) { string configKey = item5; string text = ((configKey == "") ? "" : (" (" + configKey + ")")); if (!item3.Recipes.ContainsKey(configKey) || item3.Recipes[configKey].Crafting.Stations.Count <= 0) { continue; } ItemConfig itemConfig2 = (itemCraftConfigs[item3][configKey] = new ItemConfig()); ItemConfig cfg = itemConfig2; List<ConfigurationManagerAttributes> hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>(); cfg.table = config(englishName, "Crafting Station" + text, item3.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 = ((item3.configurationVisible & Configurability.Recipe) != 0), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = CustomTableBrowsability, Browsable = (CustomTableBrowsability() && (item3.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.customTable = config(englishName, "Custom Crafting Station" + text, item3.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() && (item3.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes); cfg.tableLevel = config(englishName, "Crafting Station Level" + text, item3.Recipes[configKey].Crafting.Stations.First().level, new ConfigDescription("Required crafting station level to craft " + englishName + ".", (AcceptableValueBase)null, new object[1] { configurationManagerAttributes })); cfg.tableLevel.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value6)) { value6.First().m_minStationLevel = cfg.tableLevel.Value; } }; if (item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1) { cfg.maximumTableLevel = config(englishName, "Maximum Crafting Station Level" + text, (item3.MaximumRequiredStationLevel == int.MaxValue) ? (item3.Recipes[configKey].Crafting.Stations.First().level + item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality - 1) : item3.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, item3.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), Category = localizedName } })); ConfigurationManagerAttributes qualityResultAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = QualityResultBrowsability, Browsable = (QualityResultBrowsability() && (item3.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; cfg.requireOneIngredient.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value5)) { foreach (Recipe item6 in value5) { item6.m_requireOnlyOneIngredient = cfg.requireOneIngredient.Value == Toggle.On; } } qualityResultAttributes.Browsable = QualityResultBrowsability(); reloadConfigDisplay(); }; cfg.qualityResultAmountMultiplier = config(englishName, "Quality Multiplier" + text, item3.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 += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out var value4)) { foreach (Recipe item7 in value4) { item7.m_qualityResultAmountMultiplier = cfg.qualityResultAmountMultiplier.Value; } } }; if ((!item3.Recipes[configKey].RequiredItems.Free || item3.Recipes[configKey].RequiredItems.Requirements.Count > 0) && item3.Recipes[configKey].RequiredItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.craft = itemConfig("Crafting Costs" + text, new SerializedRequirements(item3.Recipes[configKey].RequiredItems.Requirements).ToString(), "Item costs to craft " + englishName, isUpgrade: false); } if (item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_maxQuality > 1 && (!item3.Recipes[configKey].RequiredUpgradeItems.Free || item3.Recipes[configKey].RequiredUpgradeItems.Requirements.Count > 0) && item3.Recipes[configKey].RequiredUpgradeItems.Requirements.All((Requirement r) => r.amountConfig == null)) { cfg.upgrade = itemConfig("Upgrading Costs" + text, new SerializedRequirements(item3.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) { item3.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) { item3.UpdateItemTableConfig(configKey, cfg.table.Value, cfg.customTable.Value); customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item8 in hideWhenNoneAttributes) { item8.Browsable = cfg.table.Value != CraftingTable.Disabled; } reloadConfigDisplay(); } bool TableLevelBrowsability() { return cfg.table.Value != CraftingTable.Disabled; } ConfigEntry<string> itemConfig(string name, string value, string desc, bool isUpgrade) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes { CustomDrawer = drawRequirementsConfigTable(item3, isUpgrade), Order = (order -= 1), browsability = ItemBrowsability, Browsable = (ItemBrowsability() && (item3.configurationVisible & Configurability.Recipe) != 0), Category = localizedName }; hideWhenNoneAttributes.Add(configurationManagerAttributes3); return config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes3 })); } } if ((item3.configurability & Configurability.Drop) != 0) { ConfigEntry<string> val3 = (itemDropConfigs[item3] = config(englishName, "Drops from", new SerializedDrop(item3.DropsFrom.Drops).ToString(), new ConfigDescription(englishName + " drops from this creature.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { CustomDrawer = drawDropsConfigTable, Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Drop) != 0) } }))); ConfigEntry<string> val4 = val3; val4.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { item3.UpdateCharacterDrop(); }; } for (int j = 0; j < item3.Conversions.Count; j++) { string text2 = ((item3.Conversions.Count > 1) ? $"{j + 1}. " : ""); Conversion conversion2 = item3.Conversions[j]; conversion2.config = new Conversion.ConversionConfig(); int index2 = j; conversion2.config.input = config(englishName, text2 + "Conversion Input Item", conversion2.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion2.config.input.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { if (index2 < item3.conversions.Count) { ObjectDB instance2 = ObjectDB.instance; if (instance2 != null) { ItemDrop from2 = SerializedRequirements.fetchByName(instance2, conversion2.config.input.Value); item3.conversions[index2].m_from = from2; UpdatePiece(); } } }; conversion2.config.piece = config(englishName, text2 + "Conversion Piece", conversion2.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion2.config.piece.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { UpdatePiece(); }; conversion2.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion2.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion2.config.customPiece.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { UpdatePiece(); }; void UpdatePiece() { if (index2 < item3.conversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance)) { string text5 = ((conversion2.config.piece.Value == ConversionPiece.Disabled) ? null : ((conversion2.config.piece.Value == ConversionPiece.Custom) ? conversion2.config.customPiece.Value : getInternalName(conversion2.config.piece.Value))); string activePiece2 = conversion2.config.activePiece; if (conversion2.config.activePiece != null) { Smelter component2 = ZNetScene.instance.GetPrefab(conversion2.config.activePiece).GetComponent<Smelter>(); int num3 = component2.m_conversion.IndexOf(item3.conversions[index2]); if (num3 >= 0) { Smelter[] array5 = Resources.FindObjectsOfTypeAll<Smelter>(); foreach (Smelter val8 in array5) { if (Utils.GetPrefabName(((Component)val8).gameObject) == activePiece2) { val8.m_conversion.RemoveAt(num3); } } } conversion2.config.activePiece = null; } if (item3.conversions[index2].m_from != null && conversion2.config.piece.Value != 0) { GameObject prefab2 = ZNetScene.instance.GetPrefab(text5); if (((prefab2 != null) ? prefab2.GetComponent<Smelter>() : null) != null) { conversion2.config.activePiece = text5; Smelter[] array6 = Resources.FindObjectsOfTypeAll<Smelter>(); foreach (Smelter val9 in array6) { if (Utils.GetPrefabName(((Component)val9).gameObject) == text5) { val9.m_conversion.Add(item3.conversions[index2]); } } } } } } } } for (int k = 0; k < item3.CookingConversions.Count; k++) { string text3 = ((item3.CookingConversions.Count > 1) ? $"{k + 1}" : ""); CookingConversion conversion = item3.CookingConversions[k]; conversion.config = new CookingConversion.ConversionConfig(); int index = k; conversion.config.cookTime = config(englishName, text3 + "Cook Time", conversion.CookTime, new ConfigDescription(text3 + "Cook Time", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.cookTime.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { item3.cookingConversions[index].m_cookTime = conversion.config.cookTime.Value; UpdatePiece(); }; conversion.config.input = config(englishName, text3 + "Conversion Input Item", conversion.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.input.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { if (index < item3.cookingConversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop from = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); item3.cookingConversions[index].m_from = from; UpdatePiece(); } } }; conversion.config.piece = config(englishName, text3 + "Conversion Piece", conversion.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.piece.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { UpdatePiece(); }; conversion.config.customPiece = config(englishName, text3 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.customPiece.SettingChanged += [<23306c63-723e-4b13-8de0-22af7cc43132>NullableContext(0)] (object _, EventArgs _) => { UpdatePiece(); }; void UpdatePiece() { if (index < item3.cookingConversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance)) { string text4 = ((conversion.config.piece.Value == CookingPiece.Disabled) ? null : ((conversion.config.piece.Value == CookingPiece.Custom) ? conversion.config.customPiece.Value : getInternalName(conversion.config.piece.Value))); string activePiece = conversion.config.activePiece; if (conversion.config.activePiece != null) { CookingStation component = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent<CookingStation>(); int num = component.m_conversion.IndexOf(item3.cookingConversions[index]); if (num >= 0) { CookingStation[] array3 = Resources.FindObjectsOfTypeAll<CookingStation>(); foreach (CookingStation val6 in array3) { if (Utils.GetPrefabName(((Component)val6).gameObject) == activePiece) { val6.m_conversion.RemoveAt(num); } } } conversion.config.activePiece = null; } if (item3.cookingConversions[index].m_from != null && conversion.config.piece.Value != 0) { GameObject prefab = ZNetScene.instance.GetPrefab(text4); if (((prefab != null) ? prefab.GetComponent<CookingStation>() : null) != null) { conversion.config.activePiece = text4; CookingStation[] array4 = Resources.FindObjectsOfTypeAll<CookingStation>(); foreach (CookingStation val7 in array4) { if (Utils.GetPrefabName(((Component)val7).gameObject) == text4) { val7.m_conversion.Add(item3.cookingConversions[index]); } } } } } } } if ((item3.configurability & Configurability.Stats) != 0) { item3.statsConfigs.Clear(); SharedData shared2 = item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; ItemType itemType = shared2.m_itemType; statcfg<float>("Weight", "Weight of " + englishName + ".", (SharedData shared) => shared.m_weight, delegate(SharedData shared, float value) { shared.m_weight = value; }); statcfg<int>("Trader Value", "Trader value of " + englishName + ".", (SharedData shared) => shared.m_value, delegate(SharedData shared, int value) { shared.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<float>("Durability", "Durability of " + englishName + ".", (SharedData shared) => shared.m_maxDurability, delegate(SharedData shared, float value) { shared.m_maxDurability = value; }); statcfg<float>("Durability per Level", "Durability gain per level of " + englishName + ".", (SharedData shared) => shared.m_durabilityPerLevel, delegate(SharedData shared, float value) { shared.m_durabilityPerLevel = value; }); statcfg<float>("Movement Speed Modifier", "Movement speed modifier of " + englishName + ".", (SharedData shared) => shared.m_movementModifier, delegate(SharedData shared, float value) { shared.m_movementModifier = value; }); } if ((itemType - 3 <= 2 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg<float>("Block Armor", "Block armor of " + englishName + ".", (SharedData shared) => shared.m_blockPower, delegate(SharedData shared, float value) { shared.m_blockPower = value; }); statcfg<float>("Block Armor per Level", "Block armor per level for " + englishName + ".", (SharedData shared) => shared.m_blockPowerPerLevel, delegate(SharedData shared, float value) { shared.m_blockPowerPerLevel = value; }); statcfg<float>("Block Force", "Block force of " + englishName + ".", (SharedData shared) => shared.m_deflectionForce, delegate(SharedData shared, float value) { shared.m_deflectionForce = value; }); statcfg<float>("Block Force per Level", "Block force per level for " + englishName + ".", (SharedData shared) => shared.m_deflectionForcePerLevel, delegate(SharedData shared, float value) { shared.m_deflectionForcePerLevel = value; }); statcfg<float>("Parry Bonus", "Parry bonus of " + englishName + ".", (SharedData shared) => shared.m_timedBlockBonus, delegate(SharedData shared, float value) { shared.m_timedBlockBonus = value; }); } else if ((itemType - 6 <= 1 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { statcfg<float>("Armor", "Armor of " + englishName + ".", (SharedData shared) => shared.m_armor, delegate(SharedData shared, float value) { shared.m_armor = value; }); statcfg<float>("Armor per Level", "Armor per level for " + englishName + ".", (SharedData shared) => shared.m_armorPerLevel, delegate(SharedData shared, float value) { shared.m_armorPerLevel = value; }); } SkillType skillType = shared2.m_skillType; if (((int)skillType == 7 || (int)skillType == 12) ? true : false) { statcfg<int>("Tool tier", "Tool tier of " + englishName + ".", (SharedData shared) => shared.m_toolTier, delegate(SharedData shared, int value) { shared.m_toolTier = value; }); } if ((itemType - 5 <= 2 || itemType - 11 <= 1 || (int)itemType == 17) ? true : false) { Dictionary<DamageType, DamageModifier> modifiers = shared2.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 item9 in first.Except((IEnumerable<DamageType>)(object)array)) { DamageType damageType = item9; statcfg<DamageModifier>(((object)(DamageType)(ref damageType)).ToString() + " Resistance", ((object)(DamageType)(ref damageType)).ToString() + " resistance of " + englishName + ".", (SharedData _) => modifiers.TryGetValue(damageType, out var value3) ? value3 : DamageModifier.None, delegate(SharedData shared, DamageModifier value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) DamageModPair val10 = default(DamageModPair); val10.m_type = damageType; val10.m_modifier = (DamageModifier)value; DamageModPair val11 = val10; for (int num6 = 0; num6 < shared.m_damageModifiers.Count; num6++) { if (shared.m_damageModifiers[num6].m_type == damageType) { if (value == DamageModifier.None) { shared.m_damageModifiers.RemoveAt(num6); } else { shared.m_damageModifiers[num6] = val11; } return; } } if (value != DamageModifier.None) { shared.m_damageModifiers.Add(val11); } }); } } if ((int)itemType == 2 && shared2.m_food > 0f) { statcfg<float>("Health", "Health value of " + englishName + ".", (SharedData shared) => shared.m