using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.ObjectPool; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Callbacks; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RavenwoodPotions")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("JamesJonesTV")] [assembly: AssemblyProduct("RavenwoodPotions")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.0.1")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class ExtensionMarkerAttribute : Attribute { private readonly string k__BackingField; public string Name => k__BackingField; public ExtensionMarkerAttribute(string name) { k__BackingField = name; } } } namespace RavenWoodPotions { [BepInPlugin("JamesJonesTV.RavenwoodPotions", "RavenwoodPotions", "1.0.1")] public class RavenWoodPotionsPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; } internal const string ModName = "RavenwoodPotions"; internal const string ModVersion = "1.0.1"; internal const string Author = "JamesJonesTV"; private const string ModGUID = "JamesJonesTV.RavenwoodPotions"; private static string ConfigFileName = "JamesJonesTV.RavenwoodPotions.cfg"; private static string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("JamesJonesTV.RavenwoodPotions"); public static readonly ManualLogSource RavenwoodPotionsLogger; private static readonly ConfigSync ConfigSync; private static ConfigEntry _serverConfigLocked; private static ConfigEntry _recipeIsActiveConfig; public void Awake() { //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_0b41: Unknown result type (might be due to invalid IL or missing references) //IL_0d90: Unknown result type (might be due to invalid IL or missing references) //IL_0fdf: Unknown result type (might be due to invalid IL or missing references) //IL_122e: Unknown result type (might be due to invalid IL or missing references) //IL_1481: Unknown result type (might be due to invalid IL or missing references) //IL_16d0: Unknown result type (might be due to invalid IL or missing references) //IL_191f: Unknown result type (might be due to invalid IL or missing references) //IL_1b6e: Unknown result type (might be due to invalid IL or missing references) //IL_1dc1: Unknown result type (might be due to invalid IL or missing references) //IL_2010: Unknown result type (might be due to invalid IL or missing references) //IL_225f: Unknown result type (might be due to invalid IL or missing references) //IL_24ae: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Expected O, but got Unknown //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Expected O, but got Unknown //IL_0a34: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0c51: Unknown result type (might be due to invalid IL or missing references) //IL_0c58: Expected O, but got Unknown //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c92: Unknown result type (might be due to invalid IL or missing references) //IL_0ea0: Unknown result type (might be due to invalid IL or missing references) //IL_0ea7: Expected O, but got Unknown //IL_0ed2: Unknown result type (might be due to invalid IL or missing references) //IL_0ee1: Unknown result type (might be due to invalid IL or missing references) //IL_10ef: Unknown result type (might be due to invalid IL or missing references) //IL_10f6: Expected O, but got Unknown //IL_1121: Unknown result type (might be due to invalid IL or missing references) //IL_1130: Unknown result type (might be due to invalid IL or missing references) //IL_1342: Unknown result type (might be due to invalid IL or missing references) //IL_1349: Expected O, but got Unknown //IL_1374: Unknown result type (might be due to invalid IL or missing references) //IL_1383: Unknown result type (might be due to invalid IL or missing references) //IL_1591: Unknown result type (might be due to invalid IL or missing references) //IL_1598: Expected O, but got Unknown //IL_15c3: Unknown result type (might be due to invalid IL or missing references) //IL_15d2: Unknown result type (might be due to invalid IL or missing references) //IL_17e0: Unknown result type (might be due to invalid IL or missing references) //IL_17e7: Expected O, but got Unknown //IL_1812: Unknown result type (might be due to invalid IL or missing references) //IL_1821: Unknown result type (might be due to invalid IL or missing references) //IL_1a2f: Unknown result type (might be due to invalid IL or missing references) //IL_1a36: Expected O, but got Unknown //IL_1a61: Unknown result type (might be due to invalid IL or missing references) //IL_1a70: Unknown result type (might be due to invalid IL or missing references) //IL_1c82: Unknown result type (might be due to invalid IL or missing references) //IL_1c89: Expected O, but got Unknown //IL_1cb4: Unknown result type (might be due to invalid IL or missing references) //IL_1cc3: Unknown result type (might be due to invalid IL or missing references) //IL_1ed1: Unknown result type (might be due to invalid IL or missing references) //IL_1ed8: Expected O, but got Unknown //IL_1f03: Unknown result type (might be due to invalid IL or missing references) //IL_1f12: Unknown result type (might be due to invalid IL or missing references) //IL_2120: Unknown result type (might be due to invalid IL or missing references) //IL_2127: Expected O, but got Unknown //IL_2152: Unknown result type (might be due to invalid IL or missing references) //IL_2161: Unknown result type (might be due to invalid IL or missing references) //IL_236f: Unknown result type (might be due to invalid IL or missing references) //IL_2376: Expected O, but got Unknown //IL_23a1: Unknown result type (might be due to invalid IL or missing references) //IL_23b0: Unknown result type (might be due to invalid IL or missing references) Localizer.Load(); _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry(_serverConfigLocked); RavenPotionEffectRegister.minorDefenseEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.minorDefenseEffect).name = "SE_MinorDefense"; ((StatusEffect)RavenPotionEffectRegister.minorDefenseEffect).m_name = "$se_minordefense_name"; ((StatusEffect)RavenPotionEffectRegister.minorDefenseEffect).m_tooltip = "$se_minordefense_tooltip"; RavenPotionEffectRegister.minorDefenseEffect.potionCategory = PotionCategory.Armor; RavenPotionEffectRegister.minorDefenseEffect.armorExtra = 5f; ((StatusEffect)RavenPotionEffectRegister.minorDefenseEffect).m_ttl = 600f; try { string text = "RavenwoodPotions.Icons.MinorDefenseIcon.png"; Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream != null) { byte[] array = new byte[stream.Length]; stream.Read(array, 0, (int)stream.Length); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); ((StatusEffect)RavenPotionEffectRegister.minorDefenseEffect).m_icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text)); } } catch (Exception ex) { Debug.LogError((object)("Error cargando el icono desde el DLL: " + ex.Message)); } Item item = new Item("ravenwoodpotions", "RP_PotionMinorDefense"); item.Name.English("Minor Defense Potion"); item.Name.Spanish("Poción de Defensa Menor"); item.Description.English("Grants a minor boost to your armor for 10 minutes."); item.Description.Spanish("Otorga +5 de armadura durante 10 minutos."); ConfigEntry recipeIsActive = config("RP_PotionMinorDefense", "IsRecipeEnabled", Toggle.On, "Enable recipe for Minor Defense potion"); item.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive; SharedData shared = item.Prefab.GetComponent().m_itemData.m_shared; shared.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.minorDefenseEffect; shared.m_itemType = (ItemType)2; item.Crafting.Add(CraftingTable.Cauldron, 1); item.RequiredItems.Add("Essence_Poison", 3); item.RequiredItems.Add("Mushroom", 3); item.RequiredItems.Add("Raspberry", 3); item.RequiredItems.Add("Coal", 3); RavenPotionEffectRegister.mediumDefenseEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mediumDefenseEffect).name = "SE_MediumDefense"; ((StatusEffect)RavenPotionEffectRegister.mediumDefenseEffect).m_name = "$se_mediumdefense_name"; ((StatusEffect)RavenPotionEffectRegister.mediumDefenseEffect).m_tooltip = "$se_mediumdefense_tooltip"; RavenPotionEffectRegister.mediumDefenseEffect.potionCategory = PotionCategory.Armor; RavenPotionEffectRegister.mediumDefenseEffect.armorExtra = 10f; ((StatusEffect)RavenPotionEffectRegister.mediumDefenseEffect).m_ttl = 1200f; try { string text2 = "RavenwoodPotions.Icons.MediumDefenseIcon.png"; Assembly executingAssembly2 = Assembly.GetExecutingAssembly(); using Stream stream2 = executingAssembly2.GetManifestResourceStream(text2); if (stream2 != null) { byte[] array2 = new byte[stream2.Length]; stream2.Read(array2, 0, (int)stream2.Length); Texture2D val2 = new Texture2D(2, 2); ImageConversion.LoadImage(val2, array2); ((StatusEffect)RavenPotionEffectRegister.mediumDefenseEffect).m_icon = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text2)); } } catch (Exception ex2) { Debug.LogError((object)("Error cargando el icono de Medium Defense desde el DLL: " + ex2.Message)); } Item item2 = new Item("ravenwoodpotions", "RP_PotionMediumDefense"); item2.Name.English("Medium Defense Potion"); item2.Name.Spanish("Poción de Defensa Media"); item2.Description.English("Grants a medium boost to your armor for 20 minutes."); item2.Description.Spanish("Otorga +10 de armadura durante 20 minutos."); ConfigEntry recipeIsActive2 = config("RP_PotionMediumDefense", "IsRecipeEnabled", Toggle.On, "Enable recipe for Medium Defense potion"); item2.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive2; SharedData shared2 = item2.Prefab.GetComponent().m_itemData.m_shared; shared2.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mediumDefenseEffect; shared2.m_itemType = (ItemType)2; item2.Crafting.Add(CraftingTable.Cauldron, 2); item2.RequiredItems.Add("Essence_Poison", 5); item2.RequiredItems.Add("MushroomYellow", 5); item2.RequiredItems.Add("Blueberries", 5); item2.RequiredItems.Add("Guck", 5); RavenPotionEffectRegister.majorDefenseEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.majorDefenseEffect).name = "SE_MajorDefense"; ((StatusEffect)RavenPotionEffectRegister.majorDefenseEffect).m_name = "$se_majordefense_name"; ((StatusEffect)RavenPotionEffectRegister.majorDefenseEffect).m_tooltip = "$se_majordefense_tooltip"; RavenPotionEffectRegister.majorDefenseEffect.potionCategory = PotionCategory.Armor; RavenPotionEffectRegister.majorDefenseEffect.armorExtra = 15f; ((StatusEffect)RavenPotionEffectRegister.majorDefenseEffect).m_ttl = 1800f; try { string text3 = "RavenwoodPotions.Icons.MajorDefenseIcon.png"; Assembly executingAssembly3 = Assembly.GetExecutingAssembly(); using Stream stream3 = executingAssembly3.GetManifestResourceStream(text3); if (stream3 != null) { byte[] array3 = new byte[stream3.Length]; stream3.Read(array3, 0, (int)stream3.Length); Texture2D val3 = new Texture2D(2, 2); ImageConversion.LoadImage(val3, array3); ((StatusEffect)RavenPotionEffectRegister.majorDefenseEffect).m_icon = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text3)); } } catch (Exception ex3) { Debug.LogError((object)("Error cargando el icono de Major Defense desde el DLL: " + ex3.Message)); } Item item3 = new Item("ravenwoodpotions", "RP_PotionMajorDefense"); item3.Name.English("Major Defense Potion"); item3.Name.Spanish("Poción de Defensa Mayor"); item3.Description.English("Grants a major boost to your armor for 30 minutes."); item3.Description.Spanish("Otorga +15 de armadura durante 30 minutos."); ConfigEntry recipeIsActive3 = config("RP_PotionMajorDefense", "IsRecipeEnabled", Toggle.On, "Enable recipe for Major Defense potion"); item3.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive3; SharedData shared3 = item3.Prefab.GetComponent().m_itemData.m_shared; shared3.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.majorDefenseEffect; shared3.m_itemType = (ItemType)2; item3.Crafting.Add(CraftingTable.Cauldron, 3); item3.RequiredItems.Add("Essence_Poison", 8); item3.RequiredItems.Add("MushroomBlue", 8); item3.RequiredItems.Add("Cloudberry", 8); item3.RequiredItems.Add("Tar", 8); RavenPotionEffectRegister.mythicDefenseEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mythicDefenseEffect).name = "SE_MythicDefense"; ((StatusEffect)RavenPotionEffectRegister.mythicDefenseEffect).m_name = "$se_mythicdefense_name"; ((StatusEffect)RavenPotionEffectRegister.mythicDefenseEffect).m_tooltip = "$se_mythicdefense_tooltip"; RavenPotionEffectRegister.mythicDefenseEffect.potionCategory = PotionCategory.Armor; RavenPotionEffectRegister.mythicDefenseEffect.armorExtra = 20f; ((StatusEffect)RavenPotionEffectRegister.mythicDefenseEffect).m_ttl = 3600f; try { string text4 = "RavenwoodPotions.Icons.MythicDefenseIcon.png"; Assembly executingAssembly4 = Assembly.GetExecutingAssembly(); using Stream stream4 = executingAssembly4.GetManifestResourceStream(text4); if (stream4 != null) { byte[] array4 = new byte[stream4.Length]; stream4.Read(array4, 0, (int)stream4.Length); Texture2D val4 = new Texture2D(2, 2); ImageConversion.LoadImage(val4, array4); ((StatusEffect)RavenPotionEffectRegister.mythicDefenseEffect).m_icon = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text4)); } } catch (Exception ex4) { Debug.LogError((object)("Error cargando el icono de Mythic Defense desde el DLL: " + ex4.Message)); } Item item4 = new Item("ravenwoodpotions", "RP_PotionMythicDefense"); item4.Name.English("Mythic Defense Potion"); item4.Name.Spanish("Poción de Defensa Mítica"); item4.Description.English("Grants a mythic boost to your armor for 1 hour."); item4.Description.Spanish("Otorga +20 de armadura durante 1 hora."); ConfigEntry recipeIsActive4 = config("RP_PotionMythicDefense", "IsRecipeEnabled", Toggle.On, "Enable recipe for Mythic Defense potion"); item4.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive4; SharedData shared4 = item4.Prefab.GetComponent().m_itemData.m_shared; shared4.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mythicDefenseEffect; shared4.m_itemType = (ItemType)2; item4.Crafting.Add(CraftingTable.Cauldron, 4); item4.RequiredItems.Add("Essence_Poison", 10); item4.RequiredItems.Add("MushroomSmokePuff", 10); item4.RequiredItems.Add("Vineberry", 10); item4.RequiredItems.Add("Sap", 10); RavenPotionEffectRegister.minorFortitudeEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.minorFortitudeEffect).name = "SE_MinorFortitude"; ((StatusEffect)RavenPotionEffectRegister.minorFortitudeEffect).m_name = "$se_minorfortitude_name"; ((StatusEffect)RavenPotionEffectRegister.minorFortitudeEffect).m_tooltip = "$se_minorfortitude_tooltip"; RavenPotionEffectRegister.minorFortitudeEffect.potionCategory = PotionCategory.Heal; RavenPotionEffectRegister.minorFortitudeEffect.healthExtra = 10f; ((StatusEffect)RavenPotionEffectRegister.minorFortitudeEffect).m_ttl = 600f; try { string text5 = "RavenwoodPotions.Icons.MinorFortitudeIcon.png"; Assembly executingAssembly5 = Assembly.GetExecutingAssembly(); using Stream stream5 = executingAssembly5.GetManifestResourceStream(text5); if (stream5 != null) { byte[] array5 = new byte[stream5.Length]; stream5.Read(array5, 0, (int)stream5.Length); Texture2D val5 = new Texture2D(2, 2); ImageConversion.LoadImage(val5, array5); ((StatusEffect)RavenPotionEffectRegister.minorFortitudeEffect).m_icon = Sprite.Create(val5, new Rect(0f, 0f, (float)((Texture)val5).width, (float)((Texture)val5).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text5)); } } catch (Exception ex5) { Debug.LogError((object)("Error cargando el icono de Minor Fortitude desde el DLL: " + ex5.Message)); } Item item5 = new Item("ravenwoodpotions", "RP_PotionMinorFortitude"); item5.Name.English("Minor Fortitude Potion"); item5.Name.Spanish("Poción de Fortaleza Menor"); item5.Description.English("Grants a minor boost to your maximum health for 10 minutes."); item5.Description.Spanish("Otorga +10 de vida máxima durante 10 minutos."); ConfigEntry recipeIsActive5 = config("RP_PotionMinorFortitude", "IsRecipeEnabled", Toggle.On, "Enable recipe for Minor Fortitude potion"); item5.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive5; SharedData shared5 = item5.Prefab.GetComponent().m_itemData.m_shared; shared5.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.minorFortitudeEffect; shared5.m_itemType = (ItemType)2; item5.Crafting.Add(CraftingTable.Cauldron, 1); item5.RequiredItems.Add("Essence_Fire", 3); item5.RequiredItems.Add("Mushroom", 3); item5.RequiredItems.Add("Raspberry", 3); item5.RequiredItems.Add("Dandelion", 3); RavenPotionEffectRegister.mediumFortitudeEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mediumFortitudeEffect).name = "SE_MediumFortitude"; ((StatusEffect)RavenPotionEffectRegister.mediumFortitudeEffect).m_name = "$se_mediumfortitude_name"; ((StatusEffect)RavenPotionEffectRegister.mediumFortitudeEffect).m_tooltip = "$se_mediumfortitude_tooltip"; RavenPotionEffectRegister.mediumFortitudeEffect.potionCategory = PotionCategory.Heal; RavenPotionEffectRegister.mediumFortitudeEffect.healthExtra = 20f; ((StatusEffect)RavenPotionEffectRegister.mediumFortitudeEffect).m_ttl = 1200f; try { string text6 = "RavenwoodPotions.Icons.MediumFortitudeIcon.png"; Assembly executingAssembly6 = Assembly.GetExecutingAssembly(); using Stream stream6 = executingAssembly6.GetManifestResourceStream(text6); if (stream6 != null) { byte[] array6 = new byte[stream6.Length]; stream6.Read(array6, 0, (int)stream6.Length); Texture2D val6 = new Texture2D(2, 2); ImageConversion.LoadImage(val6, array6); ((StatusEffect)RavenPotionEffectRegister.mediumFortitudeEffect).m_icon = Sprite.Create(val6, new Rect(0f, 0f, (float)((Texture)val6).width, (float)((Texture)val6).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text6)); } } catch (Exception ex6) { Debug.LogError((object)("Error cargando el icono de Medium Fortitude desde el DLL: " + ex6.Message)); } Item item6 = new Item("ravenwoodpotions", "RP_PotionMediumFortitude"); item6.Name.English("Medium Fortitude Potion"); item6.Name.Spanish("Poción de Fortaleza Media"); item6.Description.English("Grants a medium boost to your maximum health for 20 minutes."); item6.Description.Spanish("Otorga +20 de vida máxima durante 20 minutos."); ConfigEntry recipeIsActive6 = config("RP_PotionMediumFortitude", "IsRecipeEnabled", Toggle.On, "Enable recipe for Medium Fortitude potion"); item6.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive6; SharedData shared6 = item6.Prefab.GetComponent().m_itemData.m_shared; shared6.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mediumFortitudeEffect; shared6.m_itemType = (ItemType)2; item6.Crafting.Add(CraftingTable.Cauldron, 2); item6.RequiredItems.Add("Essence_Fire", 5); item6.RequiredItems.Add("MushroomYellow", 5); item6.RequiredItems.Add("Blueberries", 5); item6.RequiredItems.Add("Thistle", 5); RavenPotionEffectRegister.majorFortitudeEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.majorFortitudeEffect).name = "SE_MajorFortitude"; ((StatusEffect)RavenPotionEffectRegister.majorFortitudeEffect).m_name = "$se_majorfortitude_name"; ((StatusEffect)RavenPotionEffectRegister.majorFortitudeEffect).m_tooltip = "$se_majorfortitude_tooltip"; RavenPotionEffectRegister.majorFortitudeEffect.potionCategory = PotionCategory.Heal; RavenPotionEffectRegister.majorFortitudeEffect.healthExtra = 30f; ((StatusEffect)RavenPotionEffectRegister.majorFortitudeEffect).m_ttl = 1800f; try { string text7 = "RavenwoodPotions.Icons.MajorFortitudeIcon.png"; Assembly executingAssembly7 = Assembly.GetExecutingAssembly(); using Stream stream7 = executingAssembly7.GetManifestResourceStream(text7); if (stream7 != null) { byte[] array7 = new byte[stream7.Length]; stream7.Read(array7, 0, (int)stream7.Length); Texture2D val7 = new Texture2D(2, 2); ImageConversion.LoadImage(val7, array7); ((StatusEffect)RavenPotionEffectRegister.majorFortitudeEffect).m_icon = Sprite.Create(val7, new Rect(0f, 0f, (float)((Texture)val7).width, (float)((Texture)val7).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text7)); } } catch (Exception ex7) { Debug.LogError((object)("Error cargando el icono de Major Fortitude desde el DLL: " + ex7.Message)); } Item item7 = new Item("ravenwoodpotions", "RP_PotionMajorFortitude"); item7.Name.English("Major Fortitude Potion"); item7.Name.Spanish("Poción de Fortaleza Mayor"); item7.Description.English("Grants a major boost to your maximum health for 30 minutes."); item7.Description.Spanish("Otorga +30 de vida máxima durante 30 minutos."); ConfigEntry recipeIsActive7 = config("RP_PotionMajorFortitude", "IsRecipeEnabled", Toggle.On, "Enable recipe for Major Fortitude potion"); item7.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive7; SharedData shared7 = item7.Prefab.GetComponent().m_itemData.m_shared; shared7.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.majorFortitudeEffect; shared7.m_itemType = (ItemType)2; item7.Crafting.Add(CraftingTable.Cauldron, 3); item7.RequiredItems.Add("Essence_Fire", 8); item7.RequiredItems.Add("MushroomBlue", 8); item7.RequiredItems.Add("Cloudberry", 8); item7.RequiredItems.Add("MushroomJotunPuffs", 8); RavenPotionEffectRegister.mythicFortitudeEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mythicFortitudeEffect).name = "SE_MythicFortitude"; ((StatusEffect)RavenPotionEffectRegister.mythicFortitudeEffect).m_name = "$se_mythicfortitude_name"; ((StatusEffect)RavenPotionEffectRegister.mythicFortitudeEffect).m_tooltip = "$se_mythicfortitude_tooltip"; RavenPotionEffectRegister.mythicFortitudeEffect.potionCategory = PotionCategory.Heal; RavenPotionEffectRegister.mythicFortitudeEffect.healthExtra = 40f; ((StatusEffect)RavenPotionEffectRegister.mythicFortitudeEffect).m_ttl = 3600f; try { string text8 = "RavenwoodPotions.Icons.MythicFortitudeIcon.png"; Assembly executingAssembly8 = Assembly.GetExecutingAssembly(); using Stream stream8 = executingAssembly8.GetManifestResourceStream(text8); if (stream8 != null) { byte[] array8 = new byte[stream8.Length]; stream8.Read(array8, 0, (int)stream8.Length); Texture2D val8 = new Texture2D(2, 2); ImageConversion.LoadImage(val8, array8); ((StatusEffect)RavenPotionEffectRegister.mythicFortitudeEffect).m_icon = Sprite.Create(val8, new Rect(0f, 0f, (float)((Texture)val8).width, (float)((Texture)val8).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text8)); } } catch (Exception ex8) { Debug.LogError((object)("Error cargando el icono de Mythic Fortitude desde el DLL: " + ex8.Message)); } Item item8 = new Item("ravenwoodpotions", "RP_PotionMythicFortitude"); item8.Name.English("Mythic Fortitude Potion"); item8.Name.Spanish("Poción de Fortaleza Mítica"); item8.Description.English("Grants a mythic boost to your maximum health for 1 hour."); item8.Description.Spanish("Otorga +40 de vida máxima durante 1 hora."); ConfigEntry recipeIsActive8 = config("RP_PotionMythicFortitude", "IsRecipeEnabled", Toggle.On, "Enable recipe for Mythic Fortitude potion"); item8.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive8; SharedData shared8 = item8.Prefab.GetComponent().m_itemData.m_shared; shared8.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mythicFortitudeEffect; shared8.m_itemType = (ItemType)2; item8.Crafting.Add(CraftingTable.Cauldron, 4); item8.RequiredItems.Add("Essence_Fire", 10); item8.RequiredItems.Add("MushroomSmokePuff", 10); item8.RequiredItems.Add("Vineberry", 10); item8.RequiredItems.Add("Fiddleheadfern", 10); RavenPotionEffectRegister.minorIntellectEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.minorIntellectEffect).name = "SE_MinorIntellect"; ((StatusEffect)RavenPotionEffectRegister.minorIntellectEffect).m_name = "$se_minorintellect_name"; ((StatusEffect)RavenPotionEffectRegister.minorIntellectEffect).m_tooltip = "$se_minorintellect_tooltip"; RavenPotionEffectRegister.minorIntellectEffect.potionCategory = PotionCategory.Eitr; RavenPotionEffectRegister.minorIntellectEffect.eitrExtra = 10f; ((StatusEffect)RavenPotionEffectRegister.minorIntellectEffect).m_ttl = 600f; try { string text9 = "RavenwoodPotions.Icons.MinorIntellectIcon.png"; Assembly executingAssembly9 = Assembly.GetExecutingAssembly(); using Stream stream9 = executingAssembly9.GetManifestResourceStream(text9); if (stream9 != null) { byte[] array9 = new byte[stream9.Length]; stream9.Read(array9, 0, (int)stream9.Length); Texture2D val9 = new Texture2D(2, 2); ImageConversion.LoadImage(val9, array9); ((StatusEffect)RavenPotionEffectRegister.minorIntellectEffect).m_icon = Sprite.Create(val9, new Rect(0f, 0f, (float)((Texture)val9).width, (float)((Texture)val9).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text9)); } } catch (Exception ex9) { Debug.LogError((object)("Error cargando el icono de Minor Intellect desde el DLL: " + ex9.Message)); } Item item9 = new Item("ravenwoodpotions", "RP_PotionMinorIntellect"); item9.Name.English("Minor Intellect Potion"); item9.Name.Spanish("Poción de Intelecto Menor"); item9.Description.English("Grants a minor boost to your maximum Eitr for 10 minutes."); item9.Description.Spanish("Otorga +10 de Eitr máximo durante 10 minutos."); ConfigEntry recipeIsActive9 = config("RP_PotionMinorIntellect", "IsRecipeEnabled", Toggle.On, "Enable recipe for Minor Intellect potion"); item9.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive9; SharedData shared9 = item9.Prefab.GetComponent().m_itemData.m_shared; shared9.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.minorIntellectEffect; shared9.m_itemType = (ItemType)2; item9.Crafting.Add(CraftingTable.Cauldron, 1); item9.RequiredItems.Add("Essence_Frost", 3); item9.RequiredItems.Add("Mushroom", 3); item9.RequiredItems.Add("Raspberry", 3); item9.RequiredItems.Add("NeckTail", 3); RavenPotionEffectRegister.mediumIntellectEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mediumIntellectEffect).name = "SE_MediumIntellect"; ((StatusEffect)RavenPotionEffectRegister.mediumIntellectEffect).m_name = "$se_mediumintellect_name"; ((StatusEffect)RavenPotionEffectRegister.mediumIntellectEffect).m_tooltip = "$se_mediumintellect_tooltip"; RavenPotionEffectRegister.mediumIntellectEffect.potionCategory = PotionCategory.Eitr; RavenPotionEffectRegister.mediumIntellectEffect.eitrExtra = 20f; ((StatusEffect)RavenPotionEffectRegister.mediumIntellectEffect).m_ttl = 1200f; try { string text10 = "RavenwoodPotions.Icons.MediumIntellectIcon.png"; Assembly executingAssembly10 = Assembly.GetExecutingAssembly(); using Stream stream10 = executingAssembly10.GetManifestResourceStream(text10); if (stream10 != null) { byte[] array10 = new byte[stream10.Length]; stream10.Read(array10, 0, (int)stream10.Length); Texture2D val10 = new Texture2D(2, 2); ImageConversion.LoadImage(val10, array10); ((StatusEffect)RavenPotionEffectRegister.mediumIntellectEffect).m_icon = Sprite.Create(val10, new Rect(0f, 0f, (float)((Texture)val10).width, (float)((Texture)val10).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text10)); } } catch (Exception ex10) { Debug.LogError((object)("Error cargando el icono de Medium Intellect desde el DLL: " + ex10.Message)); } Item item10 = new Item("ravenwoodpotions", "RP_PotionMediumIntellect"); item10.Name.English("Medium Intellect Potion"); item10.Name.Spanish("Poción de Intelecto Media"); item10.Description.English("Grants a medium boost to your maximum Eitr for 20 minutes."); item10.Description.Spanish("Otorga +20 de Eitr máximo durante 20 minutos."); ConfigEntry recipeIsActive10 = config("RP_PotionMediumIntellect", "IsRecipeEnabled", Toggle.On, "Enable recipe for Medium Intellect potion"); item10.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive10; SharedData shared10 = item10.Prefab.GetComponent().m_itemData.m_shared; shared10.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mediumIntellectEffect; shared10.m_itemType = (ItemType)2; item10.Crafting.Add(CraftingTable.Cauldron, 2); item10.RequiredItems.Add("Essence_Frost", 5); item10.RequiredItems.Add("MushroomYellow", 5); item10.RequiredItems.Add("Blueberries", 5); item10.RequiredItems.Add("GreydwarfEye", 5); RavenPotionEffectRegister.majorIntellectEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.majorIntellectEffect).name = "SE_MajorIntellect"; ((StatusEffect)RavenPotionEffectRegister.majorIntellectEffect).m_name = "$se_majorintellect_name"; ((StatusEffect)RavenPotionEffectRegister.majorIntellectEffect).m_tooltip = "$se_majorintellect_tooltip"; RavenPotionEffectRegister.majorIntellectEffect.potionCategory = PotionCategory.Eitr; RavenPotionEffectRegister.majorIntellectEffect.eitrExtra = 30f; ((StatusEffect)RavenPotionEffectRegister.majorIntellectEffect).m_ttl = 1800f; try { string text11 = "RavenwoodPotions.Icons.MajorIntellectIcon.png"; Assembly executingAssembly11 = Assembly.GetExecutingAssembly(); using Stream stream11 = executingAssembly11.GetManifestResourceStream(text11); if (stream11 != null) { byte[] array11 = new byte[stream11.Length]; stream11.Read(array11, 0, (int)stream11.Length); Texture2D val11 = new Texture2D(2, 2); ImageConversion.LoadImage(val11, array11); ((StatusEffect)RavenPotionEffectRegister.majorIntellectEffect).m_icon = Sprite.Create(val11, new Rect(0f, 0f, (float)((Texture)val11).width, (float)((Texture)val11).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text11)); } } catch (Exception ex11) { Debug.LogError((object)("Error cargando el icono de Major Intellect desde el DLL: " + ex11.Message)); } Item item11 = new Item("ravenwoodpotions", "RP_PotionMajorIntellect"); item11.Name.English("Major Intellect Potion"); item11.Name.Spanish("Poción de Intelecto Mayor"); item11.Description.English("Grants a major boost to your maximum Eitr for 30 minutes."); item11.Description.Spanish("Otorga +30 de Eitr máximo durante 30 minutos."); ConfigEntry recipeIsActive11 = config("RP_PotionMajorIntellect", "IsRecipeEnabled", Toggle.On, "Enable recipe for Major Intellect potion"); item11.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive11; SharedData shared11 = item11.Prefab.GetComponent().m_itemData.m_shared; shared11.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.majorIntellectEffect; shared11.m_itemType = (ItemType)2; item11.Crafting.Add(CraftingTable.Cauldron, 3); item11.RequiredItems.Add("Essence_Frost", 8); item11.RequiredItems.Add("MushroomBlue", 8); item11.RequiredItems.Add("Cloudberry", 8); item11.RequiredItems.Add("FreezeGland", 8); RavenPotionEffectRegister.mythicIntellectEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mythicIntellectEffect).name = "SE_MythicIntellect"; ((StatusEffect)RavenPotionEffectRegister.mythicIntellectEffect).m_name = "$se_mythicintellect_name"; ((StatusEffect)RavenPotionEffectRegister.mythicIntellectEffect).m_tooltip = "$se_mythicintellect_tooltip"; RavenPotionEffectRegister.mythicIntellectEffect.potionCategory = PotionCategory.Eitr; RavenPotionEffectRegister.mythicIntellectEffect.eitrExtra = 40f; ((StatusEffect)RavenPotionEffectRegister.mythicIntellectEffect).m_ttl = 3600f; try { string text12 = "RavenwoodPotions.Icons.MythicIntellectIcon.png"; Assembly executingAssembly12 = Assembly.GetExecutingAssembly(); using Stream stream12 = executingAssembly12.GetManifestResourceStream(text12); if (stream12 != null) { byte[] array12 = new byte[stream12.Length]; stream12.Read(array12, 0, (int)stream12.Length); Texture2D val12 = new Texture2D(2, 2); ImageConversion.LoadImage(val12, array12); ((StatusEffect)RavenPotionEffectRegister.mythicIntellectEffect).m_icon = Sprite.Create(val12, new Rect(0f, 0f, (float)((Texture)val12).width, (float)((Texture)val12).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text12)); } } catch (Exception ex12) { Debug.LogError((object)("Error cargando el icono de Mythic Intellect desde el DLL: " + ex12.Message)); } Item item12 = new Item("ravenwoodpotions", "RP_PotionMythicIntellect"); item12.Name.English("Mythic Intellect Potion"); item12.Name.Spanish("Poción de Intelecto Mítica"); item12.Description.English("Grants a mythic boost to your maximum Eitr for 1 hour."); item12.Description.Spanish("Otorga +40 de Eitr máximo durante 1 hora."); ConfigEntry recipeIsActive12 = config("RP_PotionMythicIntellect", "IsRecipeEnabled", Toggle.On, "Enable recipe for Mythic Intellect potion"); item12.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive12; SharedData shared12 = item12.Prefab.GetComponent().m_itemData.m_shared; shared12.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mythicIntellectEffect; shared12.m_itemType = (ItemType)2; item12.Crafting.Add(CraftingTable.Cauldron, 4); item12.RequiredItems.Add("Essence_Frost", 10); item12.RequiredItems.Add("MushroomSmokePuff", 10); item12.RequiredItems.Add("Vineberry", 10); item12.RequiredItems.Add("MushroomMagecap", 10); RavenPotionEffectRegister.minorAgilityEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.minorAgilityEffect).name = "SE_MinorAgility"; ((StatusEffect)RavenPotionEffectRegister.minorAgilityEffect).m_name = "$se_minoragility_name"; ((StatusEffect)RavenPotionEffectRegister.minorAgilityEffect).m_tooltip = "$se_minoragility_tooltip"; RavenPotionEffectRegister.minorAgilityEffect.potionCategory = PotionCategory.Stamina; RavenPotionEffectRegister.minorAgilityEffect.staminaExtra = 10f; ((StatusEffect)RavenPotionEffectRegister.minorAgilityEffect).m_ttl = 600f; try { string text13 = "RavenwoodPotions.Icons.MinorAgilityIcon.png"; Assembly executingAssembly13 = Assembly.GetExecutingAssembly(); using Stream stream13 = executingAssembly13.GetManifestResourceStream(text13); if (stream13 != null) { byte[] array13 = new byte[stream13.Length]; stream13.Read(array13, 0, (int)stream13.Length); Texture2D val13 = new Texture2D(2, 2); ImageConversion.LoadImage(val13, array13); ((StatusEffect)RavenPotionEffectRegister.minorAgilityEffect).m_icon = Sprite.Create(val13, new Rect(0f, 0f, (float)((Texture)val13).width, (float)((Texture)val13).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text13)); } } catch (Exception ex13) { Debug.LogError((object)("Error cargando el icono de Minor Agility desde el DLL: " + ex13.Message)); } Item item13 = new Item("ravenwoodpotions", "RP_PotionMinorAgility"); item13.Name.English("Minor Agility Potion"); item13.Name.Spanish("Poción de Agilidad Menor"); item13.Description.English("Grants a minor boost to your maximum Stamina for 10 minutes."); item13.Description.Spanish("Otorga +10 de Aguante máximo durante 10 minutos."); ConfigEntry recipeIsActive13 = config("RP_PotionMinorAgility", "IsRecipeEnabled", Toggle.On, "Enable recipe for Minor Agility potion"); item13.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive13; SharedData shared13 = item13.Prefab.GetComponent().m_itemData.m_shared; shared13.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.minorAgilityEffect; shared13.m_itemType = (ItemType)2; item13.Crafting.Add(CraftingTable.Cauldron, 1); item13.RequiredItems.Add("Essence_Lightning", 3); item13.RequiredItems.Add("Mushroom", 3); item13.RequiredItems.Add("Raspberry", 3); item13.RequiredItems.Add("Honey", 3); RavenPotionEffectRegister.mediumAgilityEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mediumAgilityEffect).name = "SE_MediumAgility"; ((StatusEffect)RavenPotionEffectRegister.mediumAgilityEffect).m_name = "$se_mediumagility_name"; ((StatusEffect)RavenPotionEffectRegister.mediumAgilityEffect).m_tooltip = "$se_mediumagility_tooltip"; RavenPotionEffectRegister.mediumAgilityEffect.potionCategory = PotionCategory.Stamina; RavenPotionEffectRegister.mediumAgilityEffect.staminaExtra = 20f; ((StatusEffect)RavenPotionEffectRegister.mediumAgilityEffect).m_ttl = 1200f; try { string text14 = "RavenwoodPotions.Icons.MediumAgilityIcon.png"; Assembly executingAssembly14 = Assembly.GetExecutingAssembly(); using Stream stream14 = executingAssembly14.GetManifestResourceStream(text14); if (stream14 != null) { byte[] array14 = new byte[stream14.Length]; stream14.Read(array14, 0, (int)stream14.Length); Texture2D val14 = new Texture2D(2, 2); ImageConversion.LoadImage(val14, array14); ((StatusEffect)RavenPotionEffectRegister.mediumAgilityEffect).m_icon = Sprite.Create(val14, new Rect(0f, 0f, (float)((Texture)val14).width, (float)((Texture)val14).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text14)); } } catch (Exception ex14) { Debug.LogError((object)("Error cargando el icono de Medium Agility desde el DLL: " + ex14.Message)); } Item item14 = new Item("ravenwoodpotions", "RP_PotionMediumAgility"); item14.Name.English("Medium Agility Potion"); item14.Name.Spanish("Poción de Agilidad Media"); item14.Description.English("Grants a medium boost to your maximum Stamina for 20 minutes."); item14.Description.Spanish("Otorga +20 de Aguante máximo durante 20 minutos."); ConfigEntry recipeIsActive14 = config("RP_PotionMediumAgility", "IsRecipeEnabled", Toggle.On, "Enable recipe for Medium Agility potion"); item14.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive14; SharedData shared14 = item14.Prefab.GetComponent().m_itemData.m_shared; shared14.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mediumAgilityEffect; shared14.m_itemType = (ItemType)2; item14.Crafting.Add(CraftingTable.Cauldron, 2); item14.RequiredItems.Add("Essence_Lightning", 5); item14.RequiredItems.Add("MushroomYellow", 5); item14.RequiredItems.Add("Blueberries", 5); item14.RequiredItems.Add("Carrot", 5); RavenPotionEffectRegister.majorAgilityEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.majorAgilityEffect).name = "SE_MajorAgility"; ((StatusEffect)RavenPotionEffectRegister.majorAgilityEffect).m_name = "$se_majoragility_name"; ((StatusEffect)RavenPotionEffectRegister.majorAgilityEffect).m_tooltip = "$se_majoragility_tooltip"; RavenPotionEffectRegister.majorAgilityEffect.potionCategory = PotionCategory.Stamina; RavenPotionEffectRegister.majorAgilityEffect.staminaExtra = 30f; ((StatusEffect)RavenPotionEffectRegister.majorAgilityEffect).m_ttl = 1800f; try { string text15 = "RavenwoodPotions.Icons.MajorAgilityIcon.png"; Assembly executingAssembly15 = Assembly.GetExecutingAssembly(); using Stream stream15 = executingAssembly15.GetManifestResourceStream(text15); if (stream15 != null) { byte[] array15 = new byte[stream15.Length]; stream15.Read(array15, 0, (int)stream15.Length); Texture2D val15 = new Texture2D(2, 2); ImageConversion.LoadImage(val15, array15); ((StatusEffect)RavenPotionEffectRegister.majorAgilityEffect).m_icon = Sprite.Create(val15, new Rect(0f, 0f, (float)((Texture)val15).width, (float)((Texture)val15).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text15)); } } catch (Exception ex15) { Debug.LogError((object)("Error cargando el icono de Major Agility desde el DLL: " + ex15.Message)); } Item item15 = new Item("ravenwoodpotions", "RP_PotionMajorAgility"); item15.Name.English("Major Agility Potion"); item15.Name.Spanish("Poción de Agilidad Mayor"); item15.Description.English("Grants a major boost to your maximum Stamina for 30 minutes."); item15.Description.Spanish("Otorga +30 de Aguante máximo durante 30 minutos."); ConfigEntry recipeIsActive15 = config("RP_PotionMajorAgility", "IsRecipeEnabled", Toggle.On, "Enable recipe for Major Agility potion"); item15.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive15; SharedData shared15 = item15.Prefab.GetComponent().m_itemData.m_shared; shared15.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.majorAgilityEffect; shared15.m_itemType = (ItemType)2; item15.Crafting.Add(CraftingTable.Cauldron, 3); item15.RequiredItems.Add("Essence_Lightning", 8); item15.RequiredItems.Add("MushroomBlue", 8); item15.RequiredItems.Add("Cloudberry", 8); item15.RequiredItems.Add("Onion", 8); RavenPotionEffectRegister.mythicAgilityEffect = ScriptableObject.CreateInstance(); ((Object)RavenPotionEffectRegister.mythicAgilityEffect).name = "SE_MythicAgility"; ((StatusEffect)RavenPotionEffectRegister.mythicAgilityEffect).m_name = "$se_mythicagility_name"; ((StatusEffect)RavenPotionEffectRegister.mythicAgilityEffect).m_tooltip = "$se_mythicagility_tooltip"; RavenPotionEffectRegister.mythicAgilityEffect.potionCategory = PotionCategory.Stamina; RavenPotionEffectRegister.mythicAgilityEffect.staminaExtra = 40f; ((StatusEffect)RavenPotionEffectRegister.mythicAgilityEffect).m_ttl = 3600f; try { string text16 = "RavenwoodPotions.Icons.MythicAgilityIcon.png"; Assembly executingAssembly16 = Assembly.GetExecutingAssembly(); using Stream stream16 = executingAssembly16.GetManifestResourceStream(text16); if (stream16 != null) { byte[] array16 = new byte[stream16.Length]; stream16.Read(array16, 0, (int)stream16.Length); Texture2D val16 = new Texture2D(2, 2); ImageConversion.LoadImage(val16, array16); ((StatusEffect)RavenPotionEffectRegister.mythicAgilityEffect).m_icon = Sprite.Create(val16, new Rect(0f, 0f, (float)((Texture)val16).width, (float)((Texture)val16).height), new Vector2(0.5f, 0.5f)); } else { Debug.LogWarning((object)("No se encontró el recurso incrustado en el DLL: " + text16)); } } catch (Exception ex16) { Debug.LogError((object)("Error cargando el icono de Mythic Agility desde el DLL: " + ex16.Message)); } Item item16 = new Item("ravenwoodpotions", "RP_PotionMythicAgility"); item16.Name.English("Mythic Agility Potion"); item16.Name.Spanish("Poción de Agilidad Mítica"); item16.Description.English("Grants a mythic boost to your maximum Stamina for 1 hour."); item16.Description.Spanish("Otorga +40 de Aguante máximo durante 1 hora."); ConfigEntry recipeIsActive16 = config("RP_PotionMythicAgility", "IsRecipeEnabled", Toggle.On, "Enable recipe for Mythic Agility potion"); item16.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive16; SharedData shared16 = item16.Prefab.GetComponent().m_itemData.m_shared; shared16.m_consumeStatusEffect = (StatusEffect)(object)RavenPotionEffectRegister.mythicAgilityEffect; shared16.m_itemType = (ItemType)2; item16.Crafting.Add(CraftingTable.Cauldron, 4); item16.RequiredItems.Add("Essence_Lightning", 10); item16.RequiredItems.Add("MushroomSmokePuff", 10); item16.RequiredItems.Add("Vineberry", 10); item16.RequiredItems.Add("RoyalJelly", 10); Assembly executingAssembly17 = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly17); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { RavenwoodPotionsLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { RavenwoodPotionsLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); RavenwoodPotionsLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry config(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 val2 = ((BaseUnityPlugin)this).Config.Bind(group, name, value, val); SyncedConfigEntry syncedConfigEntry = ConfigSync.AddConfigEntry(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry config(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()), synchronizedSetting); } static RavenWoodPotionsPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; RavenwoodPotionsLogger = Logger.CreateLogSource("RavenwoodPotions"); ConfigSync = new ConfigSync("JamesJonesTV.RavenwoodPotions") { DisplayName = "RavenwoodPotions", CurrentVersion = "1.0.1", MinimumRequiredVersion = "1.0.1" }; _serverConfigLocked = null; _recipeIsActiveConfig = null; } } public static class KeyboardExtensions { [SpecialName] public sealed class $8D1D3E80A18AA9715780B6CB7003B2F1 { [SpecialName] public static class $895AB635D4D087636CF1C26BA650BA11 { } [ExtensionMarker("$895AB635D4D087636CF1C26BA650BA11")] public bool IsKeyDown() { throw new NotSupportedException(); } [ExtensionMarker("$895AB635D4D087636CF1C26BA650BA11")] public bool IsKeyHeld() { throw new NotSupportedException(); } } public static bool IsKeyDown(this KeyboardShortcut shortcut) { //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) return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } public static bool IsKeyHeld(this KeyboardShortcut shortcut) { //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) return (int)((KeyboardShortcut)(ref shortcut)).MainKey != 0 && Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey) && ((KeyboardShortcut)(ref shortcut)).Modifiers.All((Func)Input.GetKey); } } [HarmonyPatch(typeof(ObjectDB), "Awake")] internal static class ObjectDBAwakePatch { private static void Postfix(ObjectDB __instance) { RavenPotionEffectRegister.RegisterCustomEffects(__instance); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] internal static class ObjectDBCopyOtherDBPatch { private static void Postfix(ObjectDB __instance) { RavenPotionEffectRegister.RegisterCustomEffects(__instance); } } internal static class RavenPotionEffectRegister { public static RavenPotionSe_Stats minorDefenseEffect; public static RavenPotionSe_Stats mediumDefenseEffect; public static RavenPotionSe_Stats majorDefenseEffect; public static RavenPotionSe_Stats mythicDefenseEffect; public static RavenPotionSe_Stats minorFortitudeEffect; public static RavenPotionSe_Stats mediumFortitudeEffect; public static RavenPotionSe_Stats majorFortitudeEffect; public static RavenPotionSe_Stats mythicFortitudeEffect; public static RavenPotionSe_Stats minorIntellectEffect; public static RavenPotionSe_Stats mediumIntellectEffect; public static RavenPotionSe_Stats majorIntellectEffect; public static RavenPotionSe_Stats mythicIntellectEffect; public static RavenPotionSe_Stats minorAgilityEffect; public static RavenPotionSe_Stats mediumAgilityEffect; public static RavenPotionSe_Stats majorAgilityEffect; public static RavenPotionSe_Stats mythicAgilityEffect; public static void RegisterCustomEffects(ObjectDB db) { ObjectDB db2 = db; if ((Object)(object)db2 == (Object)null || db2.m_StatusEffects == null) { return; } StatusEffect val = db2.m_StatusEffects.Find((StatusEffect se) => ((Object)se).name == "Potion_frostresist"); StatusEffect val2 = db2.m_StatusEffects.Find((StatusEffect se) => ((Object)se).name == "Potion_poisonresist"); StatusEffect val3 = db2.m_StatusEffects.Find((StatusEffect se) => ((Object)se).name == "Potion_health_lingering"); StatusEffect val4 = db2.m_StatusEffects.Find((StatusEffect se) => ((Object)se).name == "Potion_stamina_medium"); if ((Object)(object)val != (Object)null) { if ((Object)(object)minorDefenseEffect != (Object)null) { ((StatusEffect)minorDefenseEffect).m_startEffects = val.m_startEffects; } if ((Object)(object)mediumDefenseEffect != (Object)null) { ((StatusEffect)mediumDefenseEffect).m_startEffects = val.m_startEffects; } if ((Object)(object)majorDefenseEffect != (Object)null) { ((StatusEffect)majorDefenseEffect).m_startEffects = val.m_startEffects; } if ((Object)(object)mythicDefenseEffect != (Object)null) { ((StatusEffect)mythicDefenseEffect).m_startEffects = val.m_startEffects; } } if ((Object)(object)val2 != (Object)null) { if ((Object)(object)minorFortitudeEffect != (Object)null) { ((StatusEffect)minorFortitudeEffect).m_startEffects = val2.m_startEffects; } if ((Object)(object)mediumFortitudeEffect != (Object)null) { ((StatusEffect)mediumFortitudeEffect).m_startEffects = val2.m_startEffects; } } if ((Object)(object)val3 != (Object)null) { if ((Object)(object)minorIntellectEffect != (Object)null) { ((StatusEffect)minorIntellectEffect).m_startEffects = val3.m_startEffects; } if ((Object)(object)mediumIntellectEffect != (Object)null) { ((StatusEffect)mediumIntellectEffect).m_startEffects = val3.m_startEffects; } if ((Object)(object)majorIntellectEffect != (Object)null) { ((StatusEffect)majorIntellectEffect).m_startEffects = val3.m_startEffects; } if ((Object)(object)mythicIntellectEffect != (Object)null) { ((StatusEffect)mythicIntellectEffect).m_startEffects = val3.m_startEffects; } } if ((Object)(object)val4 != (Object)null) { if ((Object)(object)minorAgilityEffect != (Object)null) { ((StatusEffect)minorAgilityEffect).m_startEffects = val4.m_startEffects; } if ((Object)(object)mediumAgilityEffect != (Object)null) { ((StatusEffect)mediumAgilityEffect).m_startEffects = val4.m_startEffects; } if ((Object)(object)majorAgilityEffect != (Object)null) { ((StatusEffect)majorAgilityEffect).m_startEffects = val4.m_startEffects; } if ((Object)(object)mythicAgilityEffect != (Object)null) { ((StatusEffect)mythicAgilityEffect).m_startEffects = val4.m_startEffects; } } RegistrarEfectoSeguro((StatusEffect)(object)minorDefenseEffect); RegistrarEfectoSeguro((StatusEffect)(object)mediumDefenseEffect); RegistrarEfectoSeguro((StatusEffect)(object)majorDefenseEffect); RegistrarEfectoSeguro((StatusEffect)(object)mythicDefenseEffect); RegistrarEfectoSeguro((StatusEffect)(object)minorFortitudeEffect); RegistrarEfectoSeguro((StatusEffect)(object)mediumFortitudeEffect); RegistrarEfectoSeguro((StatusEffect)(object)majorFortitudeEffect); RegistrarEfectoSeguro((StatusEffect)(object)mythicFortitudeEffect); RegistrarEfectoSeguro((StatusEffect)(object)minorIntellectEffect); RegistrarEfectoSeguro((StatusEffect)(object)mediumIntellectEffect); RegistrarEfectoSeguro((StatusEffect)(object)majorIntellectEffect); RegistrarEfectoSeguro((StatusEffect)(object)mythicIntellectEffect); RegistrarEfectoSeguro((StatusEffect)(object)minorAgilityEffect); RegistrarEfectoSeguro((StatusEffect)(object)mediumAgilityEffect); RegistrarEfectoSeguro((StatusEffect)(object)majorAgilityEffect); RegistrarEfectoSeguro((StatusEffect)(object)mythicAgilityEffect); void RegistrarEfectoSeguro(StatusEffect efecto) { if (!((Object)(object)efecto == (Object)null) && !string.IsNullOrEmpty(((Object)efecto).name) && !db2.m_StatusEffects.Contains(efecto)) { db2.m_StatusEffects.Add(efecto); } } } } public enum PotionCategory { None, Heal, Armor, Stamina, Eitr } public class RavenPotionSe_Stats : SE_Stats { [Header("Configuración de la Poción")] public PotionCategory potionCategory = PotionCategory.None; [Header("Stats Otorgados (Añade a los base)")] public float healthExtra = 0f; public float staminaExtra = 0f; public float eitrExtra = 0f; public float armorExtra = 0f; public override string GetTooltipString() { string text = ((SE_Stats)this).GetTooltipString() ?? string.Empty; return text.Replace("\n\n", "\n").TrimEnd('\n', '\r'); } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] internal static class PlayerGetTotalFoodValuePatch { private static void Postfix(Player __instance, ref float hp, ref float stamina, ref float eitr) { if ((Object)(object)__instance == (Object)null) { return; } foreach (StatusEffect statusEffect in ((Character)__instance).GetSEMan().GetStatusEffects()) { if (statusEffect is RavenPotionSe_Stats ravenPotionSe_Stats) { if (ravenPotionSe_Stats.healthExtra > 0f) { hp += ravenPotionSe_Stats.healthExtra; } if (ravenPotionSe_Stats.staminaExtra > 0f) { stamina += ravenPotionSe_Stats.staminaExtra; } if (ravenPotionSe_Stats.eitrExtra > 0f) { eitr += ravenPotionSe_Stats.eitrExtra; } } } } } [HarmonyPatch(typeof(Player), "GetBodyArmor")] internal static class PlayerGetBodyArmorPatch { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)__instance == (Object)null) { return; } foreach (StatusEffect statusEffect in ((Character)__instance).GetSEMan().GetStatusEffects()) { if (statusEffect is RavenPotionSe_Stats ravenPotionSe_Stats && ravenPotionSe_Stats.armorExtra > 0f) { __result += ravenPotionSe_Stats.armorExtra; } } } } [HarmonyPatch(typeof(Player), "ConsumeItem")] internal static class PlayerConsumeItemPatch { private static bool Prefix(Player __instance, Inventory inventory, ItemData item, ref bool __result) { if (item != null && item.m_shared != null && (Object)(object)item.m_shared.m_consumeStatusEffect != (Object)null && item.m_shared.m_consumeStatusEffect is RavenPotionSe_Stats ravenPotionSe_Stats) { foreach (StatusEffect statusEffect in ((Character)__instance).GetSEMan().GetStatusEffects()) { if (statusEffect is RavenPotionSe_Stats ravenPotionSe_Stats2 && ravenPotionSe_Stats2.potionCategory != 0 && ravenPotionSe_Stats2.potionCategory == ravenPotionSe_Stats.potionCategory) { string arg = Localization.instance.Localize("$msg_potion_active_error"); ((Character)__instance).Message((MessageType)2, $"{arg} ({ravenPotionSe_Stats.potionCategory})", 0, (Sprite)null); __result = false; return false; } } } return true; } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] public static class RegisterAndCheckVersion { 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 RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register("RavenwoodPotions_VersionCheck", (Action)RpcHandlers.RPC_RavenWoodPotions_Version); RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.0.1"); peer.m_rpc.Invoke("RavenwoodPotions_VersionCheck", new object[1] { val }); } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] public static class VerifyClient { private static bool Prefix(ZRpc rpc, ZPackage pkg, ref ZNet __instance) { if (!__instance.IsServer() || RpcHandlers.ValidatedPeers.Contains(rpc)) { return true; } RavenWoodPotionsPlugin.RavenwoodPotionsLogger.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(), "RavenwoodPotionsRequestAdminSync", new object[1] { (object)new ZPackage() }); } } [HarmonyPatch(typeof(FejdStartup), "ShowConnectError")] public class ShowConnectionError { private static void Postfix(FejdStartup __instance) { if (__instance.m_connectionFailedPanel.activeSelf) { __instance.m_connectionFailedError.fontSizeMax = 25f; __instance.m_connectionFailedError.fontSizeMin = 15f; TMP_Text connectionFailedError = __instance.m_connectionFailedError; connectionFailedError.text = connectionFailedError.text + "\n" + RavenWoodPotionsPlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogInfo((object)("Peer (" + peer.m_rpc.m_socket.GetHostName() + ") disconnected, removing from validated list")); RpcHandlers.ValidatedPeers.Remove(peer.m_rpc); } } } public static class RpcHandlers { public static readonly List ValidatedPeers = new List(); public static void RPC_RavenWoodPotions_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogInfo((object)("Version check, local: 1.0.1, remote: " + text)); if (text != "1.0.1") { RavenWoodPotionsPlugin.ConnectionError = "RavenwoodPotions Installed: 1.0.1\n Needed: " + text; if (ZNet.instance.IsServer()) { RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { RavenWoodPotionsPlugin.RavenwoodPotionsLogger.LogInfo((object)"Received same version from server!"); } else { RavenWoodPotionsPlugin.RavenwoodPotionsLogger.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 LocalizationManager { [PublicAPI] public class Localizer { private static readonly Dictionary>> PlaceholderProcessors; private static readonly Dictionary> loadedTexts; private static readonly ConditionalWeakTable localizationLanguage; private static readonly List> localizationObjects; private static BaseUnityPlugin? _plugin; private static readonly List fileExtensions; 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 source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } public static event Action? OnLocalizationComplete; private static void UpdatePlaceholderText(Localization localization, string key) { localizationLanguage.TryGetValue(localization, out string value); string text = loadedTexts[value][key]; if (PlaceholderProcessors.TryGetValue(key, out Dictionary> value2)) { text = value2.Aggregate(text, (string current, KeyValuePair> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder(string key, string placeholder, ConfigEntry config, Func? convertConfigValue = null) where T : notnull { string key2 = key; string placeholder2 = placeholder; Func convertConfigValue2 = convertConfigValue; ConfigEntry config2 = config; if (convertConfigValue2 == null) { convertConfigValue2 = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key2)) { PlaceholderProcessors[key2] = new Dictionary>(); } config2.SettingChanged += delegate { UpdatePlaceholder(); }; if (loadedTexts.ContainsKey(Localization.instance.GetSelectedLanguage())) { UpdatePlaceholder(); } void UpdatePlaceholder() { PlaceholderProcessors[key2][placeholder2] = () => convertConfigValue2(config2.Value); UpdatePlaceholderText(Localization.instance, key2); } } public static void AddText(string key, string text) { List> list = new List>(); foreach (WeakReference localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference item in list) { localizationObjects.Remove(item); } } public static void Load() { _ = plugin; } public static void LoadLocalizationLater(Localization __instance) { LoadLocalization(Localization.instance, __instance.GetSelectedLanguage()); } public static void SafeCallLocalizeComplete() { Localizer.OnLocalizationComplete?.Invoke(); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference(__instance)); } localizationLanguage.Add(__instance, language); Dictionary dictionary = new Dictionary(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string[] array = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' }); if (array.Length >= 2) { string text = array[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } } byte[] array2 = LoadTranslationFromAssembly("English"); if (array2 == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize>(Encoding.UTF8.GetString(array2)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.TryGetValue(language, out var value)) { text2 = File.ReadAllText(value); } else { byte[] array3 = LoadTranslationFromAssembly(language); if (array3 != null) { text2 = Encoding.UTF8.GetString(array3); } } } if (text2 == null && dictionary.TryGetValue("English", out var value2)) { text2 = File.ReadAllText(value2); } if (text2 != null) { foreach (KeyValuePair item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize>(text2) ?? new Dictionary()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown PlaceholderProcessors = new Dictionary>>(); loadedTexts = new Dictionary>(); localizationLanguage = new ConditionalWeakTable(); localizationObjects = new List>(); fileExtensions = new List(2) { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "SetupGui", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalizationLater", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "SafeCallLocalizeComplete", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static byte[]? LoadTranslationFromAssembly(string language) { foreach (string fileExtension in fileExtensions) { byte[] array = ReadEmbeddedFileBytes("translations." + language + fileExtension); if (array != null) { return array; } } return null; } public static byte[]? ReadEmbeddedFileBytes(string resourceFileName, Assembly? containingAssembly = null) { string resourceFileName2 = resourceFileName; using MemoryStream memoryStream = new MemoryStream(); if ((object)containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string text = containingAssembly.GetManifestResourceNames().FirstOrDefault((string str) => str.EndsWith(resourceFileName2, StringComparison.Ordinal)); if (text != null) { containingAssembly.GetManifestResourceStream(text)?.CopyTo(memoryStream); } return (memoryStream.Length == 0L) ? null : memoryStream.ToArray(); } } public static class LocalizationManagerVersion { public const string Version = "1.4.1"; } } namespace ItemManager { [PublicAPI] public enum CraftingTable { Disabled, Inventory, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("piece_MeadCauldron")] MeadCauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("piece_preptable")] PrepTable, [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 } public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] public class RequiredResourceList { public readonly List Requirements = new List(); 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 amountConfig, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amountConfig = amountConfig, quality = quality }); } } [PublicAPI] public class CraftingStationList { public readonly List Stations = new List(); public void Add(CraftingTable table, int level) { Stations.Add(new CraftingStationConfig { Table = table, level = level }); } public void Add(string customTable, int level) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, level = level, custom = customTable }); } } [PublicAPI] 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; public ConfigEntryBase? RecipeIsActive = null; } [PublicAPI] public class Trade { public Trader Trader = Trader.None; public uint Price = 0u; public uint Stack = 1u; public string? RequiredGlobalKey = null; } [PublicAPI] [Flags] public enum Trader { None = 0, Haldor = 1, Hildir = 2 } public struct Requirement { public string itemName; public int amount; public ConfigEntry? amountConfig; [Description("Set to a non-zero value to apply the requirement only for a specific quality")] public int quality; } public struct CraftingStationConfig { public CraftingTable Table; public int level; public string? custom; } [Flags] public enum Configurability { Disabled = 0, Recipe = 1, Stats = 2, Drop = 4, Trader = 8, Full = 0xF } [PublicAPI] public class DropTargets { public readonly List Drops = new List(); public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true) { Drops.Add(new DropTarget { creature = creatureName, chance = chance, min = min, max = max.GetValueOrDefault(min), levelMultiplier = levelMultiplier }); } } public struct DropTarget { public string creature; public int min; public int max; public float chance; public bool levelMultiplier; } public enum Toggle { On = 1, Off = 0 } [PublicAPI] public class Item { private class ItemConfig { public ConfigEntry? craft; public ConfigEntry? upgrade; public ConfigEntry table = null; public ConfigEntry tableLevel = null; public ConfigEntry customTable = null; public ConfigEntry? maximumTableLevel; public ConfigEntry requireOneIngredient = null; public ConfigEntry qualityResultAmountMultiplier = null; } private class TraderConfig { public ConfigEntry trader = null; public ConfigEntry price = null; public ConfigEntry stack = null; public ConfigEntry requiredGlobalKey = null; } private class RequirementQuality { public int quality; } private class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] public string? Category; [UsedImplicitly] public Action? CustomDrawer; public Func? browsability; } [PublicAPI] public enum DamageModifier { Normal, Resistant, Weak, Immune, Ignore, VeryResistant, VeryWeak, None } private delegate void setDmgFunc(ref DamageTypes dmg, float value); private class SerializedRequirements { public readonly List Reqs; public SerializedRequirements(List reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) : this(reqs.Split(new char[1] { ',' }).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); 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((Requirement r) => $"{r.itemName}:{r.amount}" + ((r.quality > 0) ? $":{r.quality}" : ""))); } public static ItemDrop? fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent() : 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 ObjectDB objectDB2 = objectDB; Dictionary dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func)((Requirement r) => r.itemName), (Func)delegate(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 list = dictionary.Values.Where((Requirement v) => v != null).ToList(); foreach (Requirement item in upgrade.Reqs.Where((Requirement r) => r.itemName != "")) { if (item.quality > 0) { ItemDrop val = ResItem(item); if (val != null) { Requirement val2 = new Requirement { m_resItem = val, m_amountPerLevel = (item.amountConfig?.Value ?? item.amount), m_amount = 0 }; list.Add(val2); requirementQuality.Add(val2, new RequirementQuality { quality = item.quality }); } continue; } if (!dictionary.TryGetValue(item.itemName, out var value) || value == null) { ItemDrop val3 = ResItem(item); if (val3 != null) { string itemName = item.itemName; Requirement val4 = new Requirement { m_resItem = val3, m_amount = 0 }; Requirement val5 = val4; dictionary[itemName] = val4; value = val5; list.Add(value); } } if (value != null) { value.m_amountPerLevel = item.amountConfig?.Value ?? item.amount; } } return list.ToArray(); ItemDrop? ResItem(Requirement r) { return fetchByName(objectDB2, r.itemName); } } } private class SerializedDrop { public readonly List Drops; public SerializedDrop(List drops) { Drops = drops; } public SerializedDrop(string drops) { Drops = ((drops == "") ? ((IEnumerable)Array.Empty()) : ((IEnumerable)drops.Split(new char[1] { ',' }))).Select(delegate(string r) { string[] array = r.Split(new char[1] { ':' }); if (array.Length <= 2 || !int.TryParse(array[2], out var result)) { result = 1; } if (array.Length <= 3 || !int.TryParse(array[3], out var result2)) { result2 = result; } bool levelMultiplier = array.Length <= 4 || array[4] != "0"; 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((DropTarget r) => $"{r.creature}:{r.chance.ToString(CultureInfo.InvariantCulture)}:{r.min}:" + ((r.min == r.max) ? "" : $"{r.max}") + (r.levelMultiplier ? "" : ":0"))); } private static Character? fetchByName(ZNetScene netScene, string name) { GameObject prefab = netScene.GetPrefab(name); Character val = ((prefab != null) ? prefab.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The drop target character '" + name + "' does not exist.")); } return val; } public Dictionary 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 dictionary = new Dictionary(); foreach (DropTarget drop in Drops) { Character val = fetchByName(netScene, drop.creature); if (val != null) { dictionary[val] = new Drop { m_prefab = item, m_amountMin = drop.min, m_amountMax = drop.max, m_chance = drop.chance, m_levelMultiplier = drop.levelMultiplier }; } } return dictionary; } } [CompilerGenerated] private sealed class <>c__DisplayClass83_0 { public Quaternion? cameraRotation; public float lightIntensity; public ItemDrop item; public Quaternion? itemRotation; } [CompilerGenerated] private sealed class d__85 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable instructions; public IEnumerable <>3__instructions; private List 5__1; private FieldInfo 5__2; private int 5__3; CodeInstruction IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__85(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown int num; switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = instructions.ToList(); 5__2 = AccessTools.DeclaredField(typeof(Recipe), "m_amount"); 5__3 = 0; break; case 1: <>1__state = -1; if (5__3 > 1 && 5__1[5__3 - 2].opcode == OpCodes.Ldfld && CodeInstructionExtensions.OperandIs(5__1[5__3 - 2], (MemberInfo)5__2) && 5__1[5__3 - 1].opcode == OpCodes.Ldc_I4_1 && 5__1[5__3].operand is Label) { <>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null); <>1__state = 2; return true; } goto IL_01ca; case 2: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(Item), "CheckItemIsUpgrade", (Type[])null, (Type[])null)); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = new CodeInstruction(OpCodes.Brtrue, 5__1[5__3].operand); <>1__state = 4; return true; case 4: { <>1__state = -1; goto IL_01ca; } IL_01ca: num = 5__3 + 1; 5__3 = num; break; } if (5__3 < 5__1.Count) { <>2__current = 5__1[5__3]; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__85 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__85(0); } d__.instructions = <>3__instructions; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private static readonly List registeredItems = new List(); private static readonly Dictionary itemDropMap = new Dictionary(); private static Dictionary>> activeRecipes = new Dictionary>>(); private static Dictionary hiddenCraftRecipes = new Dictionary(); private static Dictionary hiddenUpgradeRecipes = new Dictionary(); private static Dictionary> itemCraftConfigs = new Dictionary>(); private static Dictionary> itemDropConfigs = new Dictionary>(); private Dictionary characterDrops = new Dictionary(); private readonly Dictionary statsConfigs = new Dictionary(); private static readonly ConditionalWeakTable requirementQuality = new ConditionalWeakTable(); public static Configurability DefaultConfigurability = Configurability.Full; public Configurability? Configurable = null; private Configurability configurationVisible = Configurability.Full; private TraderConfig? traderConfig; public readonly GameObject Prefab; [Description("Specifies the maximum required crafting station level to upgrade and repair the item.\nDefault is calculated from crafting station level and maximum quality.")] public int MaximumRequiredStationLevel = int.MaxValue; [Description("Assigns the item as a drop item to a creature.\nUses a creature name, a drop chance and a minimum and maximum amount.")] public readonly DropTargets DropsFrom = new DropTargets(); [Description("Configures whether the item can be bought at the trader.\nDon't forget to set cost to something above 0 or the item will be sold for free.")] public readonly Trade Trade = new Trade(); internal List Conversions = new List(); internal List conversions = new List(); public Dictionary Recipes = new Dictionary(); private LocalizeKey? _name; private LocalizeKey? _description; private static object? configManager; private static Localization? _english; private static BaseUnityPlugin? _plugin; private static bool hasConfigSync = true; private static object? _configSync; private Configurability configurability => Configurable ?? DefaultConfigurability; [Description("Specifies the resources needed to craft the item.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the item should need.")] public RequiredResourceList RequiredItems => this[""].RequiredItems; [Description("Specifies the resources needed to upgrade the item.\nUse .Add to add resources with their internal ID and an amount. This amount will be multipled by the item quality level.\nUse one .Add for each resource type the upgrade should need.")] public RequiredResourceList RequiredUpgradeItems => this[""].RequiredUpgradeItems; [Description("Specifies the crafting station needed to craft the item.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.\nUse one .Add for each crafting station.")] public CraftingStationList Crafting => this[""].Crafting; [Description("Specifies a config entry which toggles whether a recipe is active.")] public ConfigEntryBase? RecipeIsActive { get { return this[""].RecipeIsActive; } set { this[""].RecipeIsActive = value; } } [Description("Specifies the number of items that should be given to the player with a single craft of the item.\nDefaults to 1.")] public int CraftAmount { get { return this[""].CraftAmount; } set { this[""].CraftAmount = value; } } public bool RequireOnlyOneIngredient { get { return this[""].RequireOnlyOneIngredient; } set { this[""].RequireOnlyOneIngredient = value; } } public float QualityResultAmountMultiplier { get { return this[""].QualityResultAmountMultiplier; } set { this[""].QualityResultAmountMultiplier = value; } } public ItemRecipe this[string name] { get { if (Recipes.TryGetValue(name, out ItemRecipe value)) { return value; } return Recipes[name] = new ItemRecipe(); } } public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } SharedData shared = Prefab.GetComponent().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().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 source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } private static object? configSync { get { if (_configSync == null && hasConfigSync) { Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " ItemManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } } return _configSync; } } public Item(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public Item(AssetBundle bundle, string prefabName) : this(PrefabManager.RegisterPrefab(bundle, prefabName, addToObjectDb: true), skipRegistering: true) { } public Item(GameObject prefab, bool skipRegistering = false) { if (!skipRegistering) { PrefabManager.RegisterPrefab(prefab, addToObjectDb: true); } Prefab = prefab; registeredItems.Add(this); itemDropMap[Prefab.GetComponent()] = this; Prefab.GetComponent().m_itemData.m_dropPrefab = Prefab; } public void ToggleConfigurationVisibility(Configurability visible) { configurationVisible = visible; if (itemDropConfigs.TryGetValue(this, out ConfigEntry value)) { Toggle((ConfigEntryBase)(object)value, Configurability.Drop); } if (itemCraftConfigs.TryGetValue(this, out Dictionary value2)) { foreach (ItemConfig value4 in value2.Values) { ToggleObj(value4, Configurability.Recipe); } } foreach (Conversion conversion in Conversions) { if (conversion.config != null) { ToggleObj(conversion.config, Configurability.Recipe); } } foreach (KeyValuePair statsConfig in statsConfigs) { Toggle(statsConfig.Key, Configurability.Stats); if ((visible & Configurability.Stats) != 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()); } } private void UpdateItemTableConfig(string recipeKey, CraftingTable table, string customTableValue) { if (activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(recipeKey, out List value)) { value.First().m_enabled = table != CraftingTable.Disabled; if ((uint)table <= 1u) { value.First().m_craftingStation = null; } else if (table == CraftingTable.Custom) { Recipe obj = value.First(); GameObject prefab = ZNetScene.instance.GetPrefab(customTableValue); obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent() : null); } else { value.First().m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName(table)).GetComponent(); } } } private void UpdateCraftConfig(string recipeKey, SerializedRequirements craftRequirements, SerializedRequirements upgradeRequirements) { if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || !activeRecipes.ContainsKey(this) || !activeRecipes[this].TryGetValue(recipeKey, out List value)) { return; } foreach (Recipe item in value) { item.m_resources = SerializedRequirements.toPieceReqs(ObjectDB.instance, craftRequirements, upgradeRequirements); } } internal static void Patch_FejdStartup() { //IL_1001: Unknown result type (might be due to invalid IL or missing references) //IL_1006: Unknown result type (might be due to invalid IL or missing references) //IL_2395: Unknown result type (might be due to invalid IL or missing references) //IL_239f: Expected O, but got Unknown //IL_10ce: Unknown result type (might be due to invalid IL or missing references) //IL_10d1: Unknown result type (might be due to invalid IL or missing references) //IL_1127: Expected I4, but got Unknown //IL_0ccc: Unknown result type (might be due to invalid IL or missing references) //IL_0cd6: Expected O, but got Unknown //IL_1267: Unknown result type (might be due to invalid IL or missing references) //IL_126a: Unknown result type (might be due to invalid IL or missing references) //IL_126c: Invalid comparison between Unknown and I4 //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0dfa: Unknown result type (might be due to invalid IL or missing references) //IL_0e04: Expected O, but got Unknown //IL_0ea6: Unknown result type (might be due to invalid IL or missing references) //IL_0eb0: Expected O, but got Unknown //IL_1270: Unknown result type (might be due to invalid IL or missing references) //IL_1274: Invalid comparison between Unknown and I4 //IL_0f5b: Unknown result type (might be due to invalid IL or missing references) //IL_0f65: Expected O, but got Unknown //IL_1489: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_148e: Invalid comparison between Unknown and I4 //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_1278: Unknown result type (might be due to invalid IL or missing references) //IL_127c: Invalid comparison between Unknown and I4 //IL_1492: Unknown result type (might be due to invalid IL or missing references) //IL_1496: Unknown result type (might be due to invalid IL or missing references) //IL_1498: 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_1581: Unknown result type (might be due to invalid IL or missing references) //IL_1586: Unknown result type (might be due to invalid IL or missing references) //IL_1588: Unknown result type (might be due to invalid IL or missing references) //IL_158b: Invalid comparison between Unknown and I4 //IL_149c: Unknown result type (might be due to invalid IL or missing references) //IL_14a0: Invalid comparison between Unknown and I4 //IL_158f: Unknown result type (might be due to invalid IL or missing references) //IL_1593: 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_160c: Unknown result type (might be due to invalid IL or missing references) //IL_160f: Unknown result type (might be due to invalid IL or missing references) //IL_1611: 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_1615: Unknown result type (might be due to invalid IL or missing references) //IL_1619: Unknown result type (might be due to invalid IL or missing references) //IL_161b: Invalid comparison between Unknown and I4 //IL_176e: Unknown result type (might be due to invalid IL or missing references) //IL_1771: Invalid comparison between Unknown and I4 //IL_161f: Unknown result type (might be due to invalid IL or missing references) //IL_1623: Invalid comparison between Unknown and I4 //IL_1980: Unknown result type (might be due to invalid IL or missing references) //IL_1987: Invalid comparison between Unknown and I4 //IL_1a5c: Unknown result type (might be due to invalid IL or missing references) //IL_1a61: Unknown result type (might be due to invalid IL or missing references) //IL_1a63: Unknown result type (might be due to invalid IL or missing references) //IL_1a67: Unknown result type (might be due to invalid IL or missing references) //IL_1a69: Invalid comparison between Unknown and I4 //IL_16de: Unknown result type (might be due to invalid IL or missing references) //IL_16e3: Unknown result type (might be due to invalid IL or missing references) //IL_1ae2: Unknown result type (might be due to invalid IL or missing references) //IL_1ae5: Unknown result type (might be due to invalid IL or missing references) //IL_1ae7: Invalid comparison between Unknown and I4 //IL_1aeb: Unknown result type (might be due to invalid IL or missing references) //IL_1aef: Invalid comparison between Unknown and I4 //IL_1af3: Unknown result type (might be due to invalid IL or missing references) //IL_1af7: Invalid comparison between Unknown and I4 //IL_1f88: Unknown result type (might be due to invalid IL or missing references) //IL_1f8b: Invalid comparison between Unknown and I4 Type type = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((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((Item i) => i.configurability != Configurability.Disabled)) { Item item3 = item4; string name2 = item3.Prefab.GetComponent().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(); 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 hideWhenNoneAttributes = new List(); 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 += delegate { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out List value6)) { value6.First().m_minStationLevel = cfg.tableLevel.Value; } }; if (item3.Prefab.GetComponent().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().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 += delegate { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out List 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 += delegate { if (activeRecipes.ContainsKey(item3) && activeRecipes[item3].TryGetValue(configKey, out List 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().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 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 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 val4 = val3; val4.SettingChanged += delegate { item3.UpdateCharacterDrop(); }; } for (int j = 0; j < item3.Conversions.Count; j++) { string text2 = ((item3.Conversions.Count > 1) ? $"{j + 1}. " : ""); Conversion conversion = item3.Conversions[j]; conversion.config = new Conversion.ConversionConfig(); int index = j; conversion.config.input = config(englishName, text2 + "Conversion Input Item", conversion.Input, new ConfigDescription("Input item to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.input.SettingChanged += delegate { if (index < item3.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop from = SerializedRequirements.fetchByName(instance, conversion.config.input.Value); item3.conversions[index].m_from = from; UpdatePiece(); } } }; conversion.config.piece = config(englishName, text2 + "Conversion Piece", conversion.Piece, new ConfigDescription("Conversion piece used to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.piece.SettingChanged += delegate { UpdatePiece(); }; conversion.config.customPiece = config(englishName, text2 + "Conversion Custom Piece", conversion.customPiece ?? "", new ConfigDescription("Custom conversion piece to create " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Recipe) != 0) } })); conversion.config.customPiece.SettingChanged += delegate { UpdatePiece(); }; void UpdatePiece() { if (index < item3.conversions.Count && Object.op_Implicit((Object)(object)ZNetScene.instance)) { string text3 = ((conversion.config.piece.Value == ConversionPiece.Disabled) ? null : ((conversion.config.piece.Value == ConversionPiece.Custom) ? conversion.config.customPiece.Value : getInternalName(conversion.config.piece.Value))); string activePiece = conversion.config.activePiece; if (conversion.config.activePiece != null) { Smelter component = ZNetScene.instance.GetPrefab(conversion.config.activePiece).GetComponent(); int num = component.m_conversion.IndexOf(item3.conversions[index]); if (num >= 0) { Smelter[] array3 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val6 in array3) { if (Utils.GetPrefabName(((Component)val6).gameObject) == activePiece) { val6.m_conversion.RemoveAt(num); } } } conversion.config.activePiece = null; } if (item3.conversions[index].m_from != null && conversion.config.piece.Value != 0) { GameObject prefab = ZNetScene.instance.GetPrefab(text3); if (((prefab != null) ? prefab.GetComponent() : null) != null) { conversion.config.activePiece = text3; Smelter[] array4 = Resources.FindObjectsOfTypeAll(); foreach (Smelter val7 in array4) { if (Utils.GetPrefabName(((Component)val7).gameObject) == text3) { val7.m_conversion.Add(item3.conversions[index]); } } } } } } } } if ((item3.configurability & Configurability.Stats) != 0) { item3.statsConfigs.Clear(); SharedData shared2 = item3.Prefab.GetComponent().m_itemData.m_shared; ItemType itemType = shared2.m_itemType; statcfg("Weight", "Weight of " + englishName + ".", (SharedData shared) => shared.m_weight, delegate(SharedData shared, float value) { shared.m_weight = value; }); statcfg("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("Durability", "Durability of " + englishName + ".", (SharedData shared) => shared.m_maxDurability, delegate(SharedData shared, float value) { shared.m_maxDurability = value; }); statcfg("Durability per Level", "Durability gain per level of " + englishName + ".", (SharedData shared) => shared.m_durabilityPerLevel, delegate(SharedData shared, float value) { shared.m_durabilityPerLevel = value; }); statcfg("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("Block Armor", "Block armor of " + englishName + ".", (SharedData shared) => shared.m_blockPower, delegate(SharedData shared, float value) { shared.m_blockPower = value; }); statcfg("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("Block Force", "Block force of " + englishName + ".", (SharedData shared) => shared.m_deflectionForce, delegate(SharedData shared, float value) { shared.m_deflectionForce = value; }); statcfg("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("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("Armor", "Armor of " + englishName + ".", (SharedData shared) => shared.m_armor, delegate(SharedData shared, float value) { shared.m_armor = value; }); statcfg("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("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 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)(object)array)) { DamageType damageType = item9; statcfg(((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 val8 = default(DamageModPair); val8.m_type = damageType; val8.m_modifier = (DamageModifier)value; DamageModPair val9 = val8; for (int num2 = 0; num2 < shared.m_damageModifiers.Count; num2++) { if (shared.m_damageModifiers[num2].m_type == damageType) { if (value == DamageModifier.None) { shared.m_damageModifiers.RemoveAt(num2); } else { shared.m_damageModifiers[num2] = val9; } return; } } if (value != DamageModifier.None) { shared.m_damageModifiers.Add(val9); } }); } } if ((int)itemType == 2 && shared2.m_food > 0f) { statcfg("Health", "Health value of " + englishName + ".", (SharedData shared) => shared.m_food, delegate(SharedData shared, float value) { shared.m_food = value; }); statcfg("Stamina", "Stamina value of " + englishName + ".", (SharedData shared) => shared.m_foodStamina, delegate(SharedData shared, float value) { shared.m_foodStamina = value; }); statcfg("Eitr", "Eitr value of " + englishName + ".", (SharedData shared) => shared.m_foodEitr, delegate(SharedData shared, float value) { shared.m_foodEitr = value; }); statcfg("Duration", "Duration of " + englishName + ".", (SharedData shared) => shared.m_foodBurnTime, delegate(SharedData shared, float value) { shared.m_foodBurnTime = value; }); statcfg("Health Regen", "Health regen value of " + englishName + ".", (SharedData shared) => shared.m_foodRegen, delegate(SharedData shared, float value) { shared.m_foodRegen = value; }); } if ((int)shared2.m_skillType == 10) { statcfg("Health Cost", "Health cost of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackHealth, delegate(SharedData shared, float value) { shared.m_attack.m_attackHealth = value; }); statcfg("Health Cost Percentage", "Health cost percentage of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackHealthPercentage, delegate(SharedData shared, float value) { shared.m_attack.m_attackHealthPercentage = value; }); } skillType = shared2.m_skillType; if (skillType - 9 <= 1) { statcfg("Eitr Cost", "Eitr cost of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackEitr, delegate(SharedData shared, float value) { shared.m_attack.m_attackEitr = value; }); } if ((itemType - 3 <= 1 || (int)itemType == 14 || (int)itemType == 22) ? true : false) { statcfg("Knockback", "Knockback of " + englishName + ".", (SharedData shared) => shared.m_attackForce, delegate(SharedData shared, float value) { shared.m_attackForce = value; }); statcfg("Backstab Bonus", "Backstab bonus of " + englishName + ".", (SharedData shared) => shared.m_backstabBonus, delegate(SharedData shared, float value) { shared.m_backstabBonus = value; }); statcfg("Attack Stamina", "Attack stamina of " + englishName + ".", (SharedData shared) => shared.m_attack.m_attackStamina, delegate(SharedData shared, float value) { shared.m_attack.m_attackStamina = value; }); SetDmg("True", (DamageTypes dmg) => dmg.m_damage, delegate(ref DamageTypes dmg, float val) { dmg.m_damage = val; }); SetDmg("Slash", (DamageTypes dmg) => dmg.m_slash, delegate(ref DamageTypes dmg, float val) { dmg.m_slash = val; }); SetDmg("Pierce", (DamageTypes dmg) => dmg.m_pierce, delegate(ref DamageTypes dmg, float val) { dmg.m_pierce = val; }); SetDmg("Blunt", (DamageTypes dmg) => dmg.m_blunt, delegate(ref DamageTypes dmg, float val) { dmg.m_blunt = val; }); SetDmg("Chop", (DamageTypes dmg) => dmg.m_chop, delegate(ref DamageTypes dmg, float val) { dmg.m_chop = val; }); SetDmg("Pickaxe", (DamageTypes dmg) => dmg.m_pickaxe, delegate(ref DamageTypes dmg, float val) { dmg.m_pickaxe = val; }); SetDmg("Fire", (DamageTypes dmg) => dmg.m_fire, delegate(ref DamageTypes dmg, float val) { dmg.m_fire = val; }); SetDmg("Poison", (DamageTypes dmg) => dmg.m_poison, delegate(ref DamageTypes dmg, float val) { dmg.m_poison = val; }); SetDmg("Frost", (DamageTypes dmg) => dmg.m_frost, delegate(ref DamageTypes dmg, float val) { dmg.m_frost = val; }); SetDmg("Lightning", (DamageTypes dmg) => dmg.m_lightning, delegate(ref DamageTypes dmg, float val) { dmg.m_lightning = val; }); SetDmg("Spirit", (DamageTypes dmg) => dmg.m_spirit, delegate(ref DamageTypes dmg, float val) { dmg.m_spirit = val; }); if ((int)itemType == 4) { statcfg("Projectiles", "Number of projectiles that " + englishName + " shoots at once.", (SharedData shared) => shared.m_attack.m_projectileBursts, delegate(SharedData shared, int value) { shared.m_attack.m_projectileBursts = value; }); statcfg("Burst Interval", "Time between the projectiles " + englishName + " shoots at once.", (SharedData shared) => shared.m_attack.m_burstInterval, delegate(SharedData shared, float value) { shared.m_attack.m_burstInterval = value; }); statcfg("Minimum Accuracy", "Minimum accuracy for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileAccuracyMin, delegate(SharedData shared, float value) { shared.m_attack.m_projectileAccuracyMin = value; }); statcfg("Accuracy", "Accuracy for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileAccuracy, delegate(SharedData shared, float value) { shared.m_attack.m_projectileAccuracy = value; }); statcfg("Minimum Velocity", "Minimum velocity for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileVelMin, delegate(SharedData shared, float value) { shared.m_attack.m_projectileVelMin = value; }); statcfg("Velocity", "Velocity for " + englishName + ".", (SharedData shared) => shared.m_attack.m_projectileVel, delegate(SharedData shared, float value) { shared.m_attack.m_projectileVel = value; }); statcfg("Maximum Draw Time", "Time until " + englishName + " is fully drawn at skill level 0.", (SharedData shared) => shared.m_attack.m_drawDurationMin, delegate(SharedData shared, float value) { shared.m_attack.m_drawDurationMin = value; }); statcfg("Stamina Drain", "Stamina drain per second while drawing " + englishName + ".", (SharedData shared) => shared.m_attack.m_drawStaminaDrain, delegate(SharedData shared, float value) { shared.m_attack.m_drawStaminaDrain = value; }); } } } List traderAttributes; if ((item3.configurability & Configurability.Trader) != 0) { traderAttributes = new List(); item3.traderConfig = new TraderConfig { trader = config(englishName, "Trader Selling", item3.Trade.Trader, new ConfigDescription("Which traders sell " + englishName + ".", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = ((item3.configurationVisible & Configurability.Trader) != 0), Category = localizedName } })) }; item3.traderConfig.trader.SettingChanged += delegate { item3.ReloadTraderConfiguration(); foreach (ConfigurationManagerAttributes item10 in traderAttributes) { item10.Browsable = TraderBrowsability(); } reloadConfigDisplay(); }; item3.traderConfig.price = traderConfig("Trader Price", item3.Trade.Price, "Price of " + englishName + " at the trader."); item3.traderConfig.stack = traderConfig("Trader Stack", item3.Trade.Stack, "Stack size of " + englishName + " in the trader. Also known as the number of items sold by a trader in one transaction."); item3.traderConfig.requiredGlobalKey = traderConfig("Trader Required Global Key", item3.Trade.RequiredGlobalKey ?? "", "Required global key to unlock " + englishName + " at the trader."); if (item3.traderConfig.trader.Value != 0) { PrefabManager.AddItemToTrader(item3.Prefab, item3.traderConfig.trader.Value, item3.traderConfig.price.Value, item3.traderConfig.stack.Value, item3.traderConfig.requiredGlobalKey.Value); } } else if (item3.Trade.Trader != 0) { PrefabManager.AddItemToTrader(item3.Prefab, item3.Trade.Trader, item3.Trade.Price, item3.Trade.Stack, item3.Trade.RequiredGlobalKey); } void SetDmg(string dmgType, Func readDmg, setDmgFunc setDmg) { Func readDmg2 = readDmg; setDmgFunc setDmg2 = setDmg; statcfg(dmgType + " Damage", dmgType + " damage dealt by " + englishName + ".", (SharedData shared) => readDmg2(shared.m_damages), delegate(SharedData shared, float val) { setDmg2(ref shared.m_damages, val); }); statcfg(dmgType + " Damage Per Level", dmgType + " damage dealt increase per level for " + englishName + ".", (SharedData shared) => readDmg2(shared.m_damagesPerLevel), delegate(SharedData shared, float val) { setDmg2(ref shared.m_damagesPerLevel, val); }); } bool TraderBrowsability() { return item3.traderConfig.trader.Value != Trader.None; } void statcfg(string configName, string description, Func readDefault, Action setValue) where T : notnull { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown Action setValue2 = setValue; SharedData shared3 = item3.Prefab.GetComponent().m_itemData.m_shared; ConfigEntry cfg2 = config(englishName, configName, readDefault(shared3), new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName, Browsable = ((item3.configurationVisible & Configurability.Stats) != 0) } })); if ((item3.configurationVisible & Configurability.Stats) != 0) { setValue2(shared3, cfg2.Value); } item3.statsConfigs.Add((ConfigEntryBase)(object)cfg2, ApplyConfig); cfg2.SettingChanged += delegate { if ((item3.configurationVisible & Configurability.Stats) != 0) { ApplyConfig(); } }; void ApplyConfig() { item3.ApplyToAllInstances(delegate(ItemData item) { setValue2(item.m_shared, cfg2.Value); }); } } ConfigEntry traderConfig(string name, T value, string desc) where T : notnull { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes { Order = (order -= 1), browsability = TraderBrowsability, Browsable = (TraderBrowsability() && (item3.configurationVisible & Configurability.Trader) != 0), Category = localizedName }; traderAttributes.Add(configurationManagerAttributes2); ConfigEntry val5 = config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes2 })); val5.SettingChanged += delegate { item3.ReloadTraderConfiguration(); }; return val5; } } if (saveOnConfigSet) { plugin.Config.SaveOnConfigSet = true; plugin.Config.Save(); } } configManager = ((type == null) ? null : Chainloader.ManagerObject.GetComponent(type)); foreach (Item registeredItem in registeredItems) { Item item2 = registeredItem; foreach (KeyValuePair recipe in item2.Recipes) { KeyValuePair kv = recipe; RequiredResourceList[] array2 = new RequiredResourceList[2] { kv.Value.RequiredItems, kv.Value.RequiredUpgradeItems }; foreach (RequiredResourceList requiredResourceList in array2) { for (int l = 0; l < requiredResourceList.Requirements.Count; l++) { ConfigEntry amountCfg; int resourceIndex; if ((item2.configurability & Configurability.Recipe) != 0) { amountCfg = requiredResourceList.Requirements[l].amountConfig; if (amountCfg != null) { resourceIndex = l; amountCfg.SettingChanged += ConfigChanged; } } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(item2) && activeRecipes[item2].TryGetValue(kv.Key, out List value2)) { foreach (Recipe item11 in value2) { item11.m_resources[resourceIndex].m_amount = amountCfg.Value; } } } } } } item2.InitializeNewRegisteredItem(); } } private void InitializeNewRegisteredItem() { foreach (KeyValuePair recipe in Recipes) { KeyValuePair kv = recipe; ConfigEntryBase enabledCfg = kv.Value.RecipeIsActive; if (enabledCfg != null) { ((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged)); } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && activeRecipes.ContainsKey(this) && activeRecipes[this].TryGetValue(kv.Key, out List value)) { foreach (Recipe item in value) { item.m_enabled = (int)enabledCfg.BoxedValue != 0; } } } } } public void ReloadCraftingConfiguration() { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name)) == null) { registerRecipesInObjectDB(ObjectDB.instance); ObjectDB.instance.m_items.Add(Prefab); ObjectDB.instance.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); ZNetScene.instance.m_prefabs.Add(Prefab); ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)Prefab).name), Prefab); } foreach (string item in Recipes.Keys.DefaultIfEmpty("")) { if (Recipes.TryGetValue(item, out ItemRecipe value) && value.Crafting.Stations.Count > 0) { UpdateItemTableConfig(item, value.Crafting.Stations.First().Table, value.Crafting.Stations.First().custom ?? ""); UpdateCraftConfig(item, new SerializedRequirements(value.RequiredItems.Requirements), new SerializedRequirements(value.RequiredUpgradeItems.Requirements)); } } } private void ReloadTraderConfiguration() { if (traderConfig.trader.Value == Trader.None) { PrefabManager.RemoveItemFromTrader(Prefab); } else { PrefabManager.AddItemToTrader(Prefab, traderConfig.trader.Value, traderConfig.price.Value, traderConfig.stack.Value, traderConfig.requiredGlobalKey.Value); } } public static void ApplyToAllInstances(GameObject prefab, Action callback) { callback(prefab.GetComponent().m_itemData); string name = prefab.GetComponent().m_itemData.m_shared.m_name; Inventory[] source = (from c in Player.s_players.Select((Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType() select c.GetInventory()) where c != null select c).ToArray(); foreach (ItemData item in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent()) select c).Concat(ItemDrop.s_instances) select i.m_itemData).Concat(source.SelectMany((Inventory i) => i.GetAllItems()))) { if (item.m_shared.m_name == name) { callback(item); } } } public void ApplyToAllInstances(Action callback) { ApplyToAllInstances(Prefab, callback); } private static string getInternalName(T value) where T : struct { return ((InternalName)typeof(T).GetMember(value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName; } private void registerRecipesInObjectDB(ObjectDB objectDB) { //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Expected O, but got Unknown activeRecipes[this] = new Dictionary>(); itemCraftConfigs.TryGetValue(this, out Dictionary value); foreach (KeyValuePair recipe in Recipes) { List list = new List(); foreach (CraftingStationConfig station in recipe.Value.Crafting.Stations) { ItemConfig itemConfig = value?[recipe.Key]; Recipe val = ScriptableObject.CreateInstance(); string name = ((Object)Prefab).name; CraftingTable table = station.Table; ((Object)val).name = name + "_Recipe_" + table; val.m_amount = recipe.Value.CraftAmount; bool enabled; if (itemConfig != null) { enabled = itemConfig.table.Value != CraftingTable.Disabled; } else { ConfigEntryBase? recipeIsActive = recipe.Value.RecipeIsActive; enabled = (int)(((recipeIsActive != null) ? recipeIsActive.BoxedValue : null) ?? ((object)1)) != 0; } val.m_enabled = enabled; val.m_item = Prefab.GetComponent(); val.m_resources = SerializedRequirements.toPieceReqs(objectDB, (itemConfig?.craft == null) ? new SerializedRequirements(recipe.Value.RequiredItems.Requirements) : new SerializedRequirements(itemConfig.craft.Value), (itemConfig?.upgrade == null) ? new SerializedRequirements(recipe.Value.RequiredUpgradeItems.Requirements) : new SerializedRequirements(itemConfig.upgrade.Value)); table = ((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value); if ((uint)table <= 1u) { val.m_craftingStation = null; } else if (((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value) == CraftingTable.Custom) { GameObject prefab = ZNetScene.instance.GetPrefab((itemConfig == null || list.Count > 0) ? station.custom : itemConfig.customTable.Value); if (prefab != null) { val.m_craftingStation = prefab.GetComponent(); } else { Debug.LogWarning((object)("Custom crafting station '" + ((itemConfig == null || list.Count > 0) ? station.custom : itemConfig.customTable.Value) + "' does not exist")); } } else { val.m_craftingStation = ZNetScene.instance.GetPrefab(getInternalName((itemConfig == null || list.Count > 0) ? station.Table : itemConfig.table.Value)).GetComponent(); } val.m_minStationLevel = ((itemConfig == null || list.Count > 0) ? station.level : itemConfig.tableLevel.Value); val.m_requireOnlyOneIngredient = ((itemConfig == null) ? recipe.Value.RequireOnlyOneIngredient : (itemConfig.requireOneIngredient.Value == Toggle.On)); val.m_qualityResultAmountMultiplier = itemConfig?.qualityResultAmountMultiplier.Value ?? recipe.Value.QualityResultAmountMultiplier; list.Add(val); RequiredResourceList requiredItems = recipe.Value.RequiredItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenCraftRecipes.Add(val, recipe.Value.RecipeIsActive); } } requiredItems = recipe.Value.RequiredUpgradeItems; if (requiredItems != null && !requiredItems.Free) { List requirements = requiredItems.Requirements; if (requirements != null && requirements.Count == 0) { hiddenUpgradeRecipes.Add(val, recipe.Value.RecipeIsActive); } } } activeRecipes[this].Add(recipe.Key, list); objectDB.m_recipes.AddRange(list); } conversions = new List(); for (int i = 0; i < Conversions.Count; i++) { Conversion conversion = Conversions[i]; conversions.Add(new ItemConversion { m_from = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.input.Value ?? conversion.Input), m_to = Prefab.GetComponent() }); ConversionPiece conversionPiece = conversion.config?.piece.Value ?? conversion.Piece; string text = null; if (conversionPiece != 0 && conversions[i].m_from != null) { text = ((conversionPiece != ConversionPiece.Custom) ? getInternalName(conversionPiece) : (conversion.config?.customPiece.Value ?? conversion.customPiece)); GameObject prefab2 = ZNetScene.instance.GetPrefab(text); Smelter val2 = ((prefab2 != null) ? prefab2.GetComponent() : null); if (val2 != null) { val2.m_conversion.Add(conversions[i]); } else { text = null; } } if (conversion.config != null) { conversion.config.activePiece = text; } } } [HarmonyPriority(0)] internal static void Patch_ObjectDBInit(ObjectDB __instance) { if ((Object)(object)__instance.GetItemPrefab("YagluthDrop") == (Object)null) { return; } hiddenCraftRecipes.Clear(); hiddenUpgradeRecipes.Clear(); foreach (Item registeredItem in registeredItems) { registeredItem.registerRecipesInObjectDB(__instance); } } internal static void Patch_TraderGetAvailableItems(Trader __instance, ref List __result) { string prefabName = Utils.GetPrefabName(((Component)__instance).gameObject); if (1 == 0) { } Trader trader2 = ((prefabName == "Haldor") ? Trader.Haldor : ((prefabName == "Hildir") ? Trader.Hildir : Trader.None)); if (1 == 0) { } Trader trader = trader2; __result.AddRange(from tuple in PrefabManager.CustomTradeItems.Values where (tuple.Item1 & trader) != 0 select tuple.Item2 into tradeItem where string.IsNullOrEmpty(tradeItem.m_requiredGlobalKey) || ZoneSystem.instance.GetGlobalKey(tradeItem.m_requiredGlobalKey) select tradeItem); } internal static void Patch_OnAddSmelterInput(ItemData item, bool __result) { if (__result) { ((Humanoid)Player.m_localPlayer).UnequipItem(item, true); } } internal static void Patch_MaximumRequiredStationLevel(Recipe __instance, ref int __result, int quality) { if (!itemDropMap.TryGetValue(__instance.m_item, out Item value)) { return; } IEnumerable source; if (!itemCraftConfigs.TryGetValue(value, out Dictionary value2)) { source = Enumerable.Empty(); } else { CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if (currentCraftingStation != null) { string stationName = Utils.GetPrefabName(((Component)currentCraftingStation).gameObject); source = from c in value2.Where(delegate(KeyValuePair c) { CraftingTable value3 = c.Value.table.Value; if (1 == 0) { } bool result; switch (value3) { case CraftingTable.Disabled: case CraftingTable.Inventory: result = false; break; case CraftingTable.Custom: result = c.Value.customTable.Value == stationName; break; default: result = getInternalName(c.Value.table.Value) == stationName; break; } if (1 == 0) { } return result; }) select c.Value; } else { source = value2.Values; } } __result = Mathf.Min(Mathf.Max(1, __instance.m_minStationLevel) + (quality - 1), (from cfg in source where cfg.maximumTableLevel != null select cfg.maximumTableLevel.Value).DefaultIfEmpty(value.MaximumRequiredStationLevel).Max()); } internal static void Patch_GetAvailableRecipesPrefix(ref Dictionary>? __state) { if (__state == null) { __state = new Dictionary>(); } Dictionary dictionary; if (InventoryGui.instance.InCraftTab()) { dictionary = hiddenCraftRecipes; } else { if (!InventoryGui.instance.InUpradeTab()) { return; } dictionary = hiddenUpgradeRecipes; } foreach (Recipe key in dictionary.Keys) { key.m_enabled = false; } __state[Assembly.GetExecutingAssembly()] = dictionary; } internal static void Patch_GetAvailableRecipesFinalizer(Dictionary> __state) { if (!__state.TryGetValue(Assembly.GetExecutingAssembly(), out Dictionary value)) { return; } foreach (KeyValuePair item in value) { Recipe key = item.Key; ConfigEntryBase value2 = item.Value; key.m_enabled = (int)(((value2 != null) ? value2.BoxedValue : null) ?? ((object)1)) != 0; } } internal static IEnumerable Transpile_SetupRequirementList(IEnumerable instructionsEnumerable, ILGenerator ilg) { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown List list = instructionsEnumerable.ToList(); MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(InventoryGui), "SetupRequirement", (Type[])null, (Type[])null); CodeInstruction val = null; CodeInstruction val2 = null; LocalBuilder localBuilder = ilg.DeclareLocal(typeof(int)); Dictionary dictionary = new Dictionary(); bool flag = false; int num = 0; int value = 0; Label? label = default(Label?); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], methodInfo)) { val = list[i + 2]; val2 = list[i + 5]; flag = true; } if (flag) { if (CodeInstructionExtensions.Branches(list[i], ref label) && dictionary.TryGetValue(label.Value, out value)) { num = i; break; } continue; } foreach (Label label4 in list[i].labels) { dictionary[label4] = i; } } if (list[value - 3].opcode == OpCodes.Dup) { return list; } Label label2 = ilg.DefineLabel(); Label label3 = ilg.DefineLabel(); list[num + 1].labels.Add(label2); list.InsertRange(num + 1, (IEnumerable)(object)new CodeInstruction[11] { new CodeInstruction(OpCodes.Ldloc, (object)localBuilder), new CodeInstruction(OpCodes.Brfalse, (object)label2), val.Clone(), new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.DeclaredField(typeof(InventoryGui), "m_recipeRequirementList")), new CodeInstruction(OpCodes.Ldlen, (object)null), new CodeInstruction(OpCodes.Bgt, (object)label2), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), val2.Clone(), new CodeInstruction(OpCodes.Ldc_I4_0, (object)null), new CodeInstruction(OpCodes.Br, (object)label3) }); list.InsertRange(value - 2, (IEnumerable)(object)new CodeInstruction[2] { new CodeInstruction(OpCodes.Dup, (object)null) { labels = new List