Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LinejaeserasRace v1.0.1
plugins/LinejaeserasRace.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using AzuExtendedPlayerInventory; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LinejaeserasRace.Systems; using LocalizationManager; using Microsoft.CodeAnalysis; using ServerSync; using StatusEffectManager; 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("LinejaeserasRace")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Azathoth")] [assembly: AssemblyProduct("LinejaeserasRace")] [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.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] 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; } } } namespace LocalizationManager { [PublicAPI] public class Localizer { private static readonly Dictionary<string, Dictionary<string, Func<string>>> PlaceholderProcessors; private static readonly Dictionary<string, Dictionary<string, string>> loadedTexts; private static readonly ConditionalWeakTable<Localization, string> localizationLanguage; private static readonly List<WeakReference<Localization>> localizationObjects; private static BaseUnityPlugin? _plugin; private static readonly List<string> 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<TypeInfo> source; try { source = Assembly.GetExecutingAssembly().DefinedTypes.ToList(); } catch (ReflectionTypeLoadException ex) { source = from t in ex.Types where t != null select t.GetTypeInfo(); } _plugin = (BaseUnityPlugin)Chainloader.ManagerObject.GetComponent((Type)source.First((TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); } return _plugin; } } 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<string, Func<string>> value2)) { text = value2.Aggregate(text, (string current, KeyValuePair<string, Func<string>> kv) => current.Replace("{" + kv.Key + "}", kv.Value())); } localization.AddWord(key, text); } public static void AddPlaceholder<T>(string key, string placeholder, ConfigEntry<T> config, Func<T, string>? convertConfigValue = null) where T : notnull { string key2 = key; string placeholder2 = placeholder; Func<T, string> convertConfigValue2 = convertConfigValue; ConfigEntry<T> config2 = config; if (convertConfigValue2 == null) { convertConfigValue2 = (T val) => val.ToString(); } if (!PlaceholderProcessors.ContainsKey(key2)) { PlaceholderProcessors[key2] = new Dictionary<string, Func<string>>(); } 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<WeakReference<Localization>> list = new List<WeakReference<Localization>>(); foreach (WeakReference<Localization> localizationObject in localizationObjects) { if (localizationObject.TryGetTarget(out var target)) { Dictionary<string, string> dictionary = loadedTexts[localizationLanguage.GetOrCreateValue(target)]; if (!target.m_translations.ContainsKey(key)) { dictionary[key] = text; target.AddWord(key, text); } } else { list.Add(localizationObject); } } foreach (WeakReference<Localization> item in list) { localizationObjects.Remove(item); } } public static void Load() { LoadLocalization(Localization.instance, Localization.instance.GetSelectedLanguage()); } private static void LoadLocalization(Localization __instance, string language) { if (!localizationLanguage.Remove(__instance)) { localizationObjects.Add(new WeakReference<Localization>(__instance)); } localizationLanguage.Add(__instance, language); Dictionary<string, string> dictionary = new Dictionary<string, string>(); foreach (string item in from f in Directory.GetFiles(Path.GetDirectoryName(Paths.PluginPath), plugin.Info.Metadata.Name + ".*", SearchOption.AllDirectories) where fileExtensions.IndexOf(Path.GetExtension(f)) >= 0 select f) { string text = Path.GetFileNameWithoutExtension(item).Split(new char[1] { '.' })[1]; if (dictionary.ContainsKey(text)) { Debug.LogWarning((object)("Duplicate key " + text + " found for " + plugin.Info.Metadata.Name + ". The duplicate file found at " + item + " will be skipped.")); } else { dictionary[text] = item; } } byte[] array = LoadTranslationFromAssembly("English"); if (array == null) { throw new Exception("Found no English localizations in mod " + plugin.Info.Metadata.Name + ". Expected an embedded resource translations/English.json or translations/English.yml."); } Dictionary<string, string> dictionary2 = new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(Encoding.UTF8.GetString(array)); if (dictionary2 == null) { throw new Exception("Localization for mod " + plugin.Info.Metadata.Name + " failed: Localization file was empty."); } string text2 = null; if (language != "English") { if (dictionary.ContainsKey(language)) { text2 = File.ReadAllText(dictionary[language]); } else { byte[] array2 = LoadTranslationFromAssembly(language); if (array2 != null) { text2 = Encoding.UTF8.GetString(array2); } } } if (text2 == null && dictionary.ContainsKey("English")) { text2 = File.ReadAllText(dictionary["English"]); } if (text2 != null) { foreach (KeyValuePair<string, string> item2 in new DeserializerBuilder().IgnoreFields().Build().Deserialize<Dictionary<string, string>>(text2) ?? new Dictionary<string, string>()) { dictionary2[item2.Key] = item2.Value; } } loadedTexts[language] = dictionary2; foreach (KeyValuePair<string, string> item3 in dictionary2) { UpdatePlaceholderText(__instance, item3.Key); } } static Localizer() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown PlaceholderProcessors = new Dictionary<string, Dictionary<string, Func<string>>>(); loadedTexts = new Dictionary<string, Dictionary<string, string>>(); localizationLanguage = new ConditionalWeakTable<Localization, string>(); localizationObjects = new List<WeakReference<Localization>>(); fileExtensions = new List<string> { ".json", ".yml" }; Harmony val = new Harmony("org.bepinex.helpers.LocalizationManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(Localizer), "LoadLocalization", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } 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(); } } } namespace LinejaeserasRace { [BepInPlugin("Azathoth.LinejaeserasRace", "LinejaeserasRace", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LinejaeserasRacePlugin : 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<ConfigEntryBase>? CustomDrawer; } internal const string ModName = "LinejaeserasRace"; internal const string ModVersion = "1.0.1"; internal const string Author = "Azathoth"; private const string ModGUID = "Azathoth.LinejaeserasRace"; private static string ConfigFileName = "Azathoth.LinejaeserasRace.cfg"; private static string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("Azathoth.LinejaeserasRace"); public static readonly ManualLogSource LinejaeserasRaceLogger; private static readonly ConfigSync ConfigSync; private static ConfigEntry<Toggle> _serverConfigLocked; private static ConfigEntry<Toggle> _recipeIsActiveConfig; public void Awake() { Localizer.Load(); _serverConfigLocked = config("1 - General", "Lock Configuration", Toggle.On, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); LNE_RacialSlot_AzuEPI.TryRegisterRacialSlot(LinejaeserasRaceLogger); LNE_RacialStatusEffects.Register(); Item item = new Item("linejaeserasrace", "LNE_Orcovil"); item.Name.English("Orcovil Potion"); item.Description.English("Transform into an Orcovil."); ConfigEntry<Toggle> recipeIsActive = config("LNE_Orcovil", "IsRecipeEnabled", Toggle.On, "Enable recipe for Orcovil potion"); item.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive; SharedData shared = item.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared.m_movementModifier = -0.15f; Item item2 = new Item("linejaeserasrace", "LNE_Orcovil1"); item2.Name.English("Orcovil Potion v2"); item2.Description.English("Transform into Orcovil version 2."); ConfigEntry<Toggle> recipeIsActive2 = config("LNE_Orcovil1", "IsRecipeEnabled", Toggle.On, "Enable recipe for Orcovil v2 potion"); item2.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive2; SharedData shared2 = item2.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared2.m_movementModifier = -0.15f; Item item3 = new Item("linejaeserasrace", "LNE_Orcoverde"); item3.Name.English("Green Orc Potion"); item3.Description.English("Transform into a green orc."); ConfigEntry<Toggle> recipeIsActive3 = config("LNE_Orcoverde", "IsRecipeEnabled", Toggle.On, "Enable recipe for Green Orc potion"); item3.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive3; SharedData shared3 = item3.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item4 = new Item("linejaeserasrace", "LNE_Orcoverdev2"); item4.Name.English("Green Orc Potion v2"); item4.Description.English("Transform into an enhanced green orc."); ConfigEntry<Toggle> recipeIsActive4 = config("LNE_Orcoverdev2", "IsRecipeEnabled", Toggle.On, "Enable recipe for Green Orc potion v2"); item4.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive4; SharedData shared4 = item4.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item5 = new Item("linejaeserasrace", "LNE_OrcoUrukai"); item5.Name.English("Urukai Potion"); item5.Description.English("Transform into a Urukai warrior."); ConfigEntry<Toggle> recipeIsActive5 = config("LNE_OrcoUrukai", "IsRecipeEnabled", Toggle.On, "Enable recipe for Urukai potion"); item5.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive5; SharedData shared5 = item5.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item6 = new Item("linejaeserasrace", "LNE_OrcoUrukaiv2"); item6.Name.English("Urukai Potion v2"); item6.Description.English("Transform into an elite Urukai."); ConfigEntry<Toggle> recipeIsActive6 = config("LNE_OrcoUrukaiv2", "IsRecipeEnabled", Toggle.On, "Enable recipe for Urukai v2 potion"); item6.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive6; SharedData shared6 = item6.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item7 = new Item("linejaeserasrace", "LNE_Troll"); item7.Name.English("Troll Potion"); item7.Description.English("Transform into a troll."); ConfigEntry<Toggle> recipeIsActive7 = config("LNE_Troll", "IsRecipeEnabled", Toggle.On, "Enable recipe for Troll potion"); item7.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive7; SharedData shared7 = item7.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item8 = new Item("linejaeserasrace", "LNE_potionelf"); item8.Name.English("Elf Potion"); item8.Description.English("Transform into an elf."); ConfigEntry<Toggle> recipeIsActive8 = config("LNE_potionelf", "IsRecipeEnabled", Toggle.On, "Enable recipe for Elf potion"); item8.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive8; SharedData shared8 = item8.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared8.m_movementModifier = 0.08f; Item item9 = new Item("linejaeserasrace", "LNE_potionelf1"); item9.Name.English("Elf Potion v2"); item9.Description.English("Transform into an elf with unique traits."); ConfigEntry<Toggle> recipeIsActive9 = config("LNE_potionelf1", "IsRecipeEnabled", Toggle.On, "Enable recipe for Elf v2 potion"); item9.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive9; SharedData shared9 = item9.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared9.m_movementModifier = 0.08f; Item item10 = new Item("linejaeserasrace", "LNE_potionelfv1"); item10.Name.English("Elf Potion v1"); item10.Description.English("Transform into an elf with classic elven traits."); ConfigEntry<Toggle> recipeIsActive10 = config("LNE_potionelfv1", "IsRecipeEnabled", Toggle.On, "Enable recipe for Elf potion v1"); item10.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive10; SharedData shared10 = item10.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared10.m_movementModifier = 0.08f; Item item11 = new Item("linejaeserasrace", "LNE_potionelfv1f1"); item11.Name.English("Elf Potion v1 (Variant)"); item11.Description.English("Transform into an alternate elf variant."); ConfigEntry<Toggle> recipeIsActive11 = config("LNE_potionelfv1f1", "IsRecipeEnabled", Toggle.On, "Enable recipe for Elf potion v1 variant"); item11.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive11; SharedData shared11 = item11.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared11.m_movementModifier = 0.08f; Item item12 = new Item("linejaeserasrace", "LNE_Enano"); item12.Name.English("Dwarf Potion"); item12.Description.English("Transform into a mighty dwarf."); ConfigEntry<Toggle> recipeIsActive12 = config("LNE_Enano", "IsRecipeEnabled", Toggle.On, "Enable recipe for Dwarf potion"); item12.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive12; SharedData shared12 = item12.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item13 = new Item("linejaeserasrace", "LNE_Nomuerto"); item13.Name.English("Undead Potion"); item13.Description.English("Transform into an undead creature."); ConfigEntry<Toggle> recipeIsActive13 = config("LNE_Nomuerto", "IsRecipeEnabled", Toggle.On, "Enable recipe for Undead potion"); item13.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive13; SharedData shared13 = item13.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item14 = new Item("linejaeserasrace", "LNE_potionelfodelbosqueoscuro"); item14.Name.English("Nigth Elf Potion"); item14.Description.English("Transform into a night elf."); ConfigEntry<Toggle> recipeIsActive14 = config("LNE_potionelfodelbosqueoscuro", "IsRecipeEnabled", Toggle.On, "Enable recipe for night Elf potion"); item14.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive14; SharedData shared14 = item14.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared14.m_movementModifier = 0.1f; Item item15 = new Item("linejaeserasrace", "LNE_potionelfodelbosqueoscuro1"); item15.Name.English("Nigth Elf Potion v1"); item15.Description.English("Transform into a night elf variant."); ConfigEntry<Toggle> recipeIsActive15 = config("LNE_potionelfodelbosqueoscuro1", "IsRecipeEnabled", Toggle.On, "Enable recipe for night Elf potion v1"); item15.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive15; SharedData shared15 = item15.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared15.m_movementModifier = 0.1f; Item item16 = new Item("linejaeserasrace", "LNE_potionelfodelbosqueoscurov1"); item16.Name.English("Nigth Elf Potion V1"); item16.Description.English("Transform into an alternate version of the night elf."); ConfigEntry<Toggle> recipeIsActive16 = config("LNE_potionelfodelbosqueoscurov1", "IsRecipeEnabled", Toggle.On, "Enable recipe for night Elf potion V1"); item16.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive16; SharedData shared16 = item16.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared16.m_movementModifier = 0.1f; Item item17 = new Item("linejaeserasrace", "LNE_potionelfodelbosqueoscurov2"); item17.Name.English("Nigth Elf Potion v2"); item17.Description.English("Transform into a night elf."); ConfigEntry<Toggle> recipeIsActive17 = config("LNE_potionelfodelbosqueoscurov2", "IsRecipeEnabled", Toggle.On, "Enable recipe for night Elf potion v2"); item17.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive17; SharedData shared17 = item17.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared17.m_movementModifier = 0.1f; Item item18 = new Item("linejaeserasrace", "LNE_potionelfnoche"); item18.Name.English("Mystical Elf Potion"); item18.Description.English("Transform into a mystical night elf."); ConfigEntry<Toggle> recipeIsActive18 = config("LNE_potionelfnoche", "IsRecipeEnabled", Toggle.On, "Enable recipe for Night Elf potion"); item18.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive18; SharedData shared18 = item18.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item19 = new Item("linejaeserasrace", "LNE_potionelfdark"); item19.Name.English("Dark Elf Potion"); item19.Description.English("Transform into a dark elf."); ConfigEntry<Toggle> recipeIsActive19 = config("LNE_potionelfdark", "IsRecipeEnabled", Toggle.On, "Enable recipe for Dark Elf potion"); item19.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive19; SharedData shared19 = item19.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared19.m_movementModifier = 0.12f; Item item20 = new Item("linejaeserasrace", "LNE_Tiefling"); item20.Name.English("Tiefling Potion"); item20.Description.English("Transform into a Tiefling, a being touched by infernal blood."); ConfigEntry<Toggle> recipeIsActive20 = config("LNE_Tiefling", "IsRecipeEnabled", Toggle.On, "Enable recipe for Tiefling transformation potion"); item20.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive20; SharedData shared20 = item20.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item21 = new Item("linejaeserasrace", "LNE_Mirmidon"); item21.Name.English("Myrmidon Potion"); item21.Description.English("Transform into a Myrmidon warrior of ancient power."); ConfigEntry<Toggle> recipeIsActive21 = config("LNE_Mirmidon", "IsRecipeEnabled", Toggle.On, "Enable recipe for Myrmidon transformation potion"); item21.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive21; SharedData shared21 = item21.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item22 = new Item("linejaeserasrace", "LNE_Muspelheim"); item22.Name.English("Muspelheim Potion"); item22.Description.English("Transform into a blazing warrior of Muspelheim."); ConfigEntry<Toggle> recipeIsActive22 = config("LNE_Muspelheim_Config", "IsRecipeEnabled", Toggle.On, "Enable recipe for Muspelheim transformation potion"); item22.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive22; SharedData shared22 = item22.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared22.m_movementModifier = -0.2f; Item item23 = new Item("linejaeserasrace", "LNE_Niflborn"); item23.Name.English("Niflborn Potion"); item23.Description.English("Transform into a Niflborn, a being shaped by the frozen essence of Niflheim."); ConfigEntry<Toggle> recipeIsActive23 = config("LNE_Niflborn", "IsRecipeEnabled", Toggle.On, "Enable recipe for Niflborn transformation potion"); item23.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive23; SharedData shared23 = item23.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared23.m_movementModifier = -0.2f; Item item24 = new Item("linejaeserasrace", "LNE_Jotun"); item24.Name.English("Jotun Potion"); item24.Description.English("Transform into a mighty Jotun of ancient frost and stone."); ConfigEntry<Toggle> recipeIsActive24 = config("LNE_Jotun", "IsRecipeEnabled", Toggle.On, "Enable recipe for Jotun transformation potion"); item24.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive24; SharedData shared24 = item24.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared24.m_movementModifier = -0.25f; Item item25 = new Item("linejaeserasrace", "LNE_Draenei"); item25.Name.English("Draenei Potion"); item25.Description.English("Transform into a Draenei, infused with ancient arcane power."); ConfigEntry<Toggle> recipeIsActive25 = config("LNE_Draenei", "IsRecipeEnabled", Toggle.On, "Enable recipe for Draenei transformation potion"); item25.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive25; SharedData shared25 = item25.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Item item26 = new Item("linejaeserasrace", "LNE_Goblin"); item26.Name.English("Goblin Potion"); item26.Description.English("Transform into a Goblin, fueled by cunning and feral speed."); ConfigEntry<Toggle> recipeIsActive26 = config("LNE_Goblin", "IsRecipeEnabled", Toggle.On, "Enable recipe for Goblin transformation potion"); item26.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive26; SharedData shared26 = item26.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; shared19.m_movementModifier = 0.12f; Item item27 = new Item("linejaeserasrace", "LNE_Human"); item27.Name.English("Human Potion"); item27.Name.Spanish("Poción Humano"); item27.Description.English("Transform into a Human, balanced in strength, discipline, and adaptability."); item27.Description.Spanish("Transfórmate en Humano, equilibrado en fuerza, disciplina y adaptabilidad."); ConfigEntry<Toggle> recipeIsActive27 = config("LNE_Human", "IsRecipeEnabled", Toggle.On, "Enable recipe for Human transformation potion"); item27.RecipeIsActive = (ConfigEntryBase?)(object)recipeIsActive27; SharedData shared27 = item27.Prefab.GetComponent<ItemDrop>().m_itemData.m_shared; Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { LinejaeserasRaceLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { LinejaeserasRaceLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); LinejaeserasRaceLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> config<T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } static LinejaeserasRacePlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; LinejaeserasRaceLogger = Logger.CreateLogSource("LinejaeserasRace"); ConfigSync = new ConfigSync("Azathoth.LinejaeserasRace") { DisplayName = "LinejaeserasRace", CurrentVersion = "1.0.1", MinimumRequiredVersion = "1.0.1" }; _serverConfigLocked = null; _recipeIsActiveConfig = null; } } public static class KeyboardExtensions { 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<KeyCode, bool>)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<KeyCode, bool>)Input.GetKey); } } [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 LinejaeserasRacePlugin.LinejaeserasRaceLogger.LogDebug((object)"Registering version RPC handler"); peer.m_rpc.Register<ZPackage>("LinejaeserasRace_VersionCheck", (Action<ZRpc, ZPackage>)RpcHandlers.RPC_LinejaeserasRace_Version); LinejaeserasRacePlugin.LinejaeserasRaceLogger.LogInfo((object)"Invoking version check"); ZPackage val = new ZPackage(); val.Write("1.0.1"); peer.m_rpc.Invoke("LinejaeserasRace_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; } LinejaeserasRacePlugin.LinejaeserasRaceLogger.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(), "LinejaeserasRaceRequestAdminSync", 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" + LinejaeserasRacePlugin.ConnectionError; } } } [HarmonyPatch(typeof(ZNet), "Disconnect")] public static class RemoveDisconnectedPeerFromVerified { private static void Prefix(ZNetPeer peer, ref ZNet __instance) { if (__instance.IsServer()) { LinejaeserasRacePlugin.LinejaeserasRaceLogger.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<ZRpc> ValidatedPeers = new List<ZRpc>(); public static void RPC_LinejaeserasRace_Version(ZRpc rpc, ZPackage pkg) { string text = pkg.ReadString(); LinejaeserasRacePlugin.LinejaeserasRaceLogger.LogInfo((object)("Version check, local: 1.0.1, remote: " + text)); if (text != "1.0.1") { LinejaeserasRacePlugin.ConnectionError = "LinejaeserasRace Installed: 1.0.1\n Needed: " + text; if (ZNet.instance.IsServer()) { LinejaeserasRacePlugin.LinejaeserasRaceLogger.LogWarning((object)("Peer (" + rpc.m_socket.GetHostName() + ") has incompatible version, disconnecting...")); rpc.Invoke("Error", new object[1] { 3 }); } } else if (!ZNet.instance.IsServer()) { LinejaeserasRacePlugin.LinejaeserasRaceLogger.LogInfo((object)"Received same version from server!"); } else { LinejaeserasRacePlugin.LinejaeserasRaceLogger.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 LinejaeserasRace.Systems { public static class LinejaeserasRaceHandler { [HarmonyPatch(typeof(Humanoid), "EquipItem")] private static class EquipPatch { private static void Postfix(Humanoid __instance, ItemData item) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && item != null && item.m_equipped && LNE_RacialItems.IsRacial(item)) { RecalculateAndWriteScale(val); } } } [HarmonyPatch(typeof(Humanoid), "UnequipItem")] private static class UnequipPatch { private static void Postfix(Humanoid __instance, ItemData item) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null && item != null && LNE_RacialItems.IsRacial(item)) { RecalculateAndWriteScale(val); } } } [HarmonyPatch(typeof(Player), "OnSpawned")] private static class PlayerOnSpawnedPatch { private static void Postfix(Player __instance) { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { RecalculateAndWriteScale(__instance); } } } [HarmonyPatch(typeof(Player), "Update")] private static class PlayerUpdatePatch { private static void Postfix(Player __instance) { if (!((Object)(object)__instance == (Object)null)) { ApplyScaleFromZdo(__instance); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class LNE_PlayerScaleSupport { private static readonly int PlayerHash = StringExtensionMethods.GetStableHashCode("Player"); [HarmonyPriority(0)] private static void Postfix(ZNetScene __instance) { if (!((Object)(object)__instance == (Object)null) && __instance.m_namedPrefabs.TryGetValue(PlayerHash, out var value)) { ZNetView component = value.GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null) { component.m_syncInitialScale = true; } } } } private const string DwarfRacePrefab = "LNE_Enano"; private const string OrcVilPrefab = "LNE_Orcovil"; private const string OrcVil1Prefab = "LNE_Orcovil1"; private const string OrcVerdePrefab = "LNE_Orcoverde"; private const string OrcVerdeV2Prefab = "LNE_Orcoverdev2"; private const string OrcUrukaiPrefab = "LNE_OrcoUrukai"; private const string OrcUrukaiV2Prefab = "LNE_OrcoUrukaiv2"; private const string MuspelheimPrefab = "LNE_Muspelheim"; private const string JotunPrefab = "LNE_Jotun"; private const string NiflbornPrefab = "LNE_Niflborn"; private const string HighElf1 = "LNE_potionelf"; private const string HighElf2 = "LNE_potionelf1"; private const string HighElf3 = "LNE_potionelfv1"; private const string HighElf4 = "LNE_potionelfv1f1"; private const string TallElf1 = "LNE_potionelfodelbosqueoscuro"; private const string TallElf2 = "LNE_potionelfodelbosqueoscurov1"; private const string TallElf3 = "LNE_potionelfodelbosqueoscurov2"; private const string TallElf4 = "LNE_potionelfnoche"; private const string TallElf5 = "LNE_potionelfdark"; private const string DraeneiPrefab = "LNE_Draenei"; private const string TieflingPrefab = "LNE_Tiefling"; private const string MirmidonPrefab = "LNE_Mirmidon"; private const string TrollPrefab = "LNE_Troll"; private const string NoMuertoPrefab = "LNE_Nomuerto"; private const string GoblinPrefab = "LNE_Goblin"; private const float DefaultScale = 1f; private const float DwarfScale = 0.8f; private const float HighElfScale = 1.02f; private const float TallElfScale = 1.04f; private const float OrcScale = 1.06f; private const float DraeneiScale = 1.07f; private const float TieflingScale = 1.07f; private const float MirmidonScale = 1.07f; private const float TrollScale = 1.09f; private const float NoMuertoScale = 1.01f; private const float GoblinScale = 0.75f; private const float MuspelheimScale = 1.37f; private const float JotunScale = 1.5f; private const float NiflbornScale = 1.37f; private static readonly int ZdoScaleHash = StringExtensionMethods.GetStableHashCode("LNE_RaceScaleAbs"); private static void RecalculateAndWriteScale(Player player) { if (!((Object)(object)player == (Object)null) && !((Object)(object)((Character)player).m_nview == (Object)null) && ((Character)player).m_nview.IsValid() && !((Object)(object)Player.m_localPlayer != (Object)(object)player)) { float num = ComputeScaleFromInventory(player); ZDO zDO = ((Character)player).m_nview.GetZDO(); if (zDO != null) { zDO.Set(ZdoScaleHash, num); ApplyScale(player, num); } } } private static void ApplyScaleFromZdo(Player player) { if (!((Object)(object)player == (Object)null) && !((Object)(object)((Character)player).m_nview == (Object)null) && ((Character)player).m_nview.IsValid()) { ZDO zDO = ((Character)player).m_nview.GetZDO(); if (zDO != null) { float @float = zDO.GetFloat(ZdoScaleHash, 1f); ApplyScale(player, @float); } } } private static void ApplyScale(Player player, float scale) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(scale, scale, scale); if (!(((Component)player).transform.localScale == val)) { ((Component)player).transform.localScale = val; } } private static float ComputeScaleFromInventory(Player player) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return 1f; } bool flag = false; bool flag2 = false; string text = null; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; foreach (ItemData allItem in inventory.GetAllItems()) { if (!allItem.m_equipped || !Object.op_Implicit((Object)(object)allItem.m_dropPrefab)) { continue; } string name = ((Object)allItem.m_dropPrefab).name; if (name == "LNE_Enano") { flag = true; continue; } if (IsGiantRace(name)) { flag2 = true; if (text == null) { text = name; } continue; } if (name == "LNE_Troll") { flag3 = true; continue; } if (IsOrcRace(name)) { flag4 = true; continue; } switch (name) { case "LNE_Draenei": flag5 = true; continue; case "LNE_Tiefling": flag6 = true; continue; case "LNE_Mirmidon": flag7 = true; continue; } if (IsTallElfRace(name)) { flag8 = true; } else if (IsHighElfRace(name)) { flag9 = true; } else if (name == "LNE_Nomuerto") { flag10 = true; } else if (name == "LNE_Goblin") { flag11 = true; } } if (flag) { return 0.8f; } if (flag2) { return text switch { "LNE_Jotun" => 1.5f, "LNE_Muspelheim" => 1.37f, "LNE_Niflborn" => 1.37f, _ => 1.37f, }; } if (flag3) { return 1.09f; } if (flag4) { return 1.06f; } if (flag5) { return 1.07f; } if (flag6) { return 1.07f; } if (flag7) { return 1.07f; } if (flag8) { return 1.04f; } if (flag9) { return 1.02f; } if (flag10) { return 1.01f; } if (flag11) { return 0.75f; } return 1f; } private static bool IsOrcRace(string race) { int result; switch (race) { default: result = ((race == "LNE_OrcoUrukaiv2") ? 1 : 0); break; case "LNE_Orcovil": case "LNE_Orcovil1": case "LNE_Orcoverde": case "LNE_Orcoverdev2": case "LNE_OrcoUrukai": result = 1; break; } return (byte)result != 0; } private static bool IsGiantRace(string race) { return race == "LNE_Muspelheim" || race == "LNE_Jotun" || race == "LNE_Niflborn"; } private static bool IsHighElfRace(string race) { int result; switch (race) { default: result = ((race == "LNE_potionelfv1f1") ? 1 : 0); break; case "LNE_potionelf": case "LNE_potionelf1": case "LNE_potionelfv1": result = 1; break; } return (byte)result != 0; } private static bool IsTallElfRace(string race) { int result; switch (race) { default: result = ((race == "LNE_potionelfdark") ? 1 : 0); break; case "LNE_potionelfodelbosqueoscuro": case "LNE_potionelfodelbosqueoscurov1": case "LNE_potionelfodelbosqueoscurov2": case "LNE_potionelfnoche": result = 1; break; } return (byte)result != 0; } } [HarmonyPatch(typeof(Player), "QueueEquipAction")] public static class LNE_BlockMultipleRaces { private static bool Prefix(Player __instance, ItemData item) { ItemData item2 = item; if (item2 == null) { return true; } if (!LNE_RacialItems.IsRacial(item2)) { return true; } if (((Humanoid)__instance).GetInventory().GetAllItems().Any((ItemData i) => i.m_equipped && i != item2 && LNE_RacialItems.IsRacial(i))) { ((Character)__instance).Message((MessageType)2, "You can only equip one racial item at a time.", 0, (Sprite)null); return false; } return true; } } public static class LNE_RacialItems { public static readonly HashSet<string> RacialPrefabs = new HashSet<string> { "LNE_Orcovil", "LNE_Orcovil1", "LNE_Orcoverde", "LNE_Orcoverdev2", "LNE_OrcoUrukai", "LNE_OrcoUrukaiv2", "LNE_Troll", "LNE_potionelf", "LNE_potionelf1", "LNE_potionelfv1", "LNE_potionelfv1f1", "LNE_potionelfodelbosqueoscuro1", "LNE_potionelfodelbosqueoscurov2", "LNE_Enano", "LNE_potionelfodelbosqueoscuro", "LNE_potionelfodelbosqueoscurov1", "LNE_potionelfnoche", "LNE_potionelfdark", "LNE_Mirmidon", "LNE_Nomuerto", "LNE_Tiefling", "LNE_Muspelheim", "LNE_Niflborn", "LNE_Jotun", "LNE_Draenei", "LNE_Goblin", "LNE_Human" }; public static bool IsRacial(ItemData? item) { return Object.op_Implicit((Object)(object)item?.m_dropPrefab) && RacialPrefabs.Contains(((Object)item.m_dropPrefab).name); } } [HarmonyPatch] internal static class LNE_RacialLifestealFromStatusEffects { [HarmonyPatch(typeof(Character), "ApplyDamage")] private static class Character_ApplyDamage_Lifesteal { private static void Postfix(Character __instance, HitData hit) { if (hit == null) { return; } Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return; } float totalDamage = hit.GetTotalDamage(); if (totalDamage <= 0f) { return; } float num = 0f; float num2 = 0f; foreach (LNE_RacialStatusConfig.StatConfig item in LNE_RacialStatusConfig.GetConfigsFor(val)) { if (!(item.LifeStealChancePercent <= 0f) && !(item.LifeStealPercentOfDamage <= 0f) && item.LifeStealChancePercent > num) { num = item.LifeStealChancePercent; num2 = item.LifeStealPercentOfDamage; } } if (num <= 0f || num2 <= 0f) { return; } float num3 = Random.Range(0f, 100f); if (!(num3 > num)) { float num4 = totalDamage * (num2 / 100f); if (!(num4 <= 0f)) { ((Character)val).Heal(num4, true); } } } } } internal static class LNE_RacialSkillBonuses { internal class SkillBonus { public SkillType Skill; public float Bonus; } [CompilerGenerated] private sealed class <GetBonusesFor>d__2 : IEnumerable<SkillBonus>, IEnumerable, IEnumerator<SkillBonus>, IDisposable, IEnumerator { private int <>1__state; private SkillBonus <>2__current; private int <>l__initialThreadId; private StatusEffect se; public StatusEffect <>3__se; private string <name>5__1; private List<SkillBonus> <list>5__2; private List<SkillBonus>.Enumerator <>s__3; private SkillBonus <bonus>5__4; SkillBonus IEnumerator<SkillBonus>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetBonusesFor>d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <name>5__1 = null; <list>5__2 = null; <>s__3 = default(List<SkillBonus>.Enumerator); <bonus>5__4 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; goto IL_0134; } <>1__state = -1; if ((Object)(object)se == (Object)null) { return false; } <name>5__1 = ((Object)se).name; if (string.IsNullOrEmpty(<name>5__1)) { return false; } if (<name>5__1.EndsWith("(Clone)", StringComparison.Ordinal)) { <name>5__1 = <name>5__1.Substring(0, <name>5__1.Length - "(Clone)".Length); } if (!SkillConfig.TryGetValue(<name>5__1, out <list>5__2) || <list>5__2 == null) { return false; } <>s__3 = <list>5__2.GetEnumerator(); <>1__state = -3; goto IL_013c; IL_013c: if (<>s__3.MoveNext()) { <bonus>5__4 = <>s__3.Current; if (<bonus>5__4 != null) { <>2__current = <bonus>5__4; <>1__state = 1; return true; } goto IL_0134; } <>m__Finally1(); <>s__3 = default(List<SkillBonus>.Enumerator); return false; IL_0134: <bonus>5__4 = null; goto IL_013c; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__3).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<SkillBonus> IEnumerable<SkillBonus>.GetEnumerator() { <GetBonusesFor>d__2 <GetBonusesFor>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetBonusesFor>d__ = this; } else { <GetBonusesFor>d__ = new <GetBonusesFor>d__2(0); } <GetBonusesFor>d__.se = <>3__se; return <GetBonusesFor>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<SkillBonus>)this).GetEnumerator(); } } internal static readonly Dictionary<string, List<SkillBonus>> SkillConfig = new Dictionary<string, List<SkillBonus>>(StringComparer.OrdinalIgnoreCase) { ["LNE_SE_OrcGreenPower"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)110, Bonus = 10f } }, ["LNE_SE_OrcGreenPower1"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)110, Bonus = 10f } }, ["LNE_SE_OrcBlackPower"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)13, Bonus = 15f } }, ["LNE_SE_OrcBlackPower1"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)13, Bonus = 15f } }, ["LNE_SE_Troll"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)105, Bonus = 10f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f }, new SkillBonus { Skill = (SkillType)5, Bonus = 10f } }, ["LNE_SE_Dwarf"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)107, Bonus = 15f } }, ["LNE_HighElf"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)9, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f } }, ["LNE_HighElf1"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)9, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f } }, ["LNE_HighElf2"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)9, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f } }, ["LNE_HighElf3"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)9, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f } }, ["LNE_SE_NightElf"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)101, Bonus = 20f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f }, new SkillBonus { Skill = (SkillType)100, Bonus = 10f } }, ["LNE_SE_NightElf1"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)101, Bonus = 20f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f }, new SkillBonus { Skill = (SkillType)100, Bonus = 10f } }, ["LNE_SE_NightElf2"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)101, Bonus = 20f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f }, new SkillBonus { Skill = (SkillType)100, Bonus = 10f } }, ["LNE_SE_NightElf3"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)101, Bonus = 20f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f }, new SkillBonus { Skill = (SkillType)100, Bonus = 10f } }, ["LNE_SE_DarkElf"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)10, Bonus = 10f }, new SkillBonus { Skill = (SkillType)101, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 10f } }, ["LNE_SE_Jotun"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)12, Bonus = 20f } }, ["LNE_SE_Myrmidon"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)103, Bonus = 50f }, new SkillBonus { Skill = (SkillType)104, Bonus = 25f } }, ["LNE_SE_Goblin"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)14, Bonus = 15f }, new SkillBonus { Skill = (SkillType)104, Bonus = 25f }, new SkillBonus { Skill = (SkillType)100, Bonus = 15f }, new SkillBonus { Skill = (SkillType)108, Bonus = 20f } }, ["LNE_SE_Human"] = new List<SkillBonus> { new SkillBonus { Skill = (SkillType)5, Bonus = 10f }, new SkillBonus { Skill = (SkillType)6, Bonus = 10f }, new SkillBonus { Skill = (SkillType)14, Bonus = 10f }, new SkillBonus { Skill = (SkillType)105, Bonus = 10f }, new SkillBonus { Skill = (SkillType)106, Bonus = 10f }, new SkillBonus { Skill = (SkillType)107, Bonus = 10f }, new SkillBonus { Skill = (SkillType)110, Bonus = 10f } } }; [IteratorStateMachine(typeof(<GetBonusesFor>d__2))] internal static IEnumerable<SkillBonus> GetBonusesFor(StatusEffect se) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetBonusesFor>d__2(-2) { <>3__se = se }; } } [HarmonyPatch] internal static class LNE_RacialSkillBonusesPatches { [HarmonyPatch(typeof(SEMan), "ModifySkillLevel")] private static class SEMan_ModifySkillLevel_Patch { private static void Postfix(SEMan __instance, SkillType skill, ref float level) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (__instance == null) { return; } Character character = __instance.m_character; if ((Object)(object)character == (Object)null || !character.IsPlayer()) { return; } Player val = (Player)(object)((character is Player) ? character : null); if ((Object)(object)val == (Object)null) { return; } foreach (StatusEffect statusEffect in __instance.GetStatusEffects()) { if ((Object)(object)statusEffect == (Object)null) { continue; } foreach (LNE_RacialSkillBonuses.SkillBonus item in LNE_RacialSkillBonuses.GetBonusesFor(statusEffect)) { if (item.Skill == skill) { level += item.Bonus; } } } } } } public static class LNE_RacialSlot_AzuEPI { private static bool _initialized; public static void TryRegisterRacialSlot(ManualLogSource log) { if (!_initialized) { _initialized = true; if (!API.IsLoaded()) { log.LogInfo((object)"[LNE] AzuEPI no detectado → ítems raciales usan Utility vanilla"); } else if (API.AddSlot("Racial", GetEquippedRacialItem, LNE_RacialItems.IsRacial)) { log.LogInfo((object)"[LNE] Slot 'Racial' agregado correctamente (AzuEPI)"); } else { log.LogWarning((object)"[LNE] No se pudo agregar slot 'Racial' (¿ya existe?)"); } } } private static ItemData? GetEquippedRacialItem(Player player) { return ((IEnumerable<ItemData>)((Humanoid)player).GetInventory().GetEquippedItems()).FirstOrDefault((Func<ItemData, bool>)LNE_RacialItems.IsRacial); } } internal static class LNE_RacialStatusConfig { internal class StatConfig { public float BonusHealth; public float BonusStamina; public float BonusEitr; public float LifeStealChancePercent; public float LifeStealPercentOfDamage; public float PeriodicHealPercent; public float PeriodicHealInterval; public float PeriodicStaminaPercent; public float PeriodicStaminaInterval; public float BonusHealthRegen; public float BonusStaminaRegen; public float BonusEitrRegen; public float PeriodicEitrPercent; public float PeriodicEitrInterval; } [CompilerGenerated] private sealed class <GetConfigsFor>d__2 : IEnumerable<StatConfig>, IEnumerable, IEnumerator<StatConfig>, IDisposable, IEnumerator { private int <>1__state; private StatConfig <>2__current; private int <>l__initialThreadId; private Player player; public Player <>3__player; private SEMan <seMan>5__1; private List<StatusEffect>.Enumerator <>s__2; private StatusEffect <se>5__3; private string <name>5__4; private StatConfig <config>5__5; StatConfig IEnumerator<StatConfig>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetConfigsFor>d__2(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <seMan>5__1 = null; <>s__2 = default(List<StatusEffect>.Enumerator); <se>5__3 = null; <name>5__4 = null; <config>5__5 = null; <>1__state = -2; } private bool MoveNext() { try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; goto IL_0154; } <>1__state = -1; if (!Object.op_Implicit((Object)(object)player)) { return false; } <seMan>5__1 = ((Character)player).GetSEMan(); if (<seMan>5__1 == null) { return false; } <>s__2 = <seMan>5__1.GetStatusEffects().GetEnumerator(); <>1__state = -3; goto IL_016a; IL_0154: <name>5__4 = null; <config>5__5 = null; <se>5__3 = null; goto IL_016a; IL_016a: while (true) { if (<>s__2.MoveNext()) { <se>5__3 = <>s__2.Current; if (!((Object)(object)<se>5__3 == (Object)null)) { <name>5__4 = ((Object)<se>5__3).name; if (!string.IsNullOrEmpty(<name>5__4)) { break; } } continue; } <>m__Finally1(); <>s__2 = default(List<StatusEffect>.Enumerator); return false; } if (<name>5__4.EndsWith("(Clone)", StringComparison.Ordinal)) { <name>5__4 = <name>5__4.Substring(0, <name>5__4.Length - "(Clone)".Length); } if (StatusConfigs.TryGetValue(<name>5__4, out <config>5__5)) { <>2__current = <config>5__5; <>1__state = 1; return true; } goto IL_0154; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<StatConfig> IEnumerable<StatConfig>.GetEnumerator() { <GetConfigsFor>d__2 <GetConfigsFor>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetConfigsFor>d__ = this; } else { <GetConfigsFor>d__ = new <GetConfigsFor>d__2(0); } <GetConfigsFor>d__.player = <>3__player; return <GetConfigsFor>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<StatConfig>)this).GetEnumerator(); } } internal static readonly Dictionary<string, StatConfig> StatusConfigs = new Dictionary<string, StatConfig>(StringComparer.OrdinalIgnoreCase) { ["LNE_SE_OrcovilPower"] = new StatConfig { BonusHealth = 15f, BonusStamina = 0f, BonusEitr = 30f, LifeStealChancePercent = 50f, LifeStealPercentOfDamage = 20f, BonusEitrRegen = 2f }, ["LNE_SE_OrcovilPower1"] = new StatConfig { BonusHealth = 15f, BonusStamina = 0f, BonusEitr = 30f, LifeStealChancePercent = 50f, LifeStealPercentOfDamage = 20f, BonusEitrRegen = 2f }, ["LNE_SE_OrcGreenPower"] = new StatConfig { BonusHealth = 15f, BonusStamina = 20f }, ["LNE_SE_OrcGreenPower1"] = new StatConfig { BonusHealth = 15f, BonusStamina = 20f }, ["LNE_SE_OrcBlackPower"] = new StatConfig { BonusHealth = 35f }, ["LNE_SE_OrcBlackPower1"] = new StatConfig { BonusHealth = 35f }, ["LNE_SE_Troll"] = new StatConfig { BonusHealth = 10f, BonusStamina = 15f, BonusHealthRegen = 5f }, ["LNE_SE_Dwarf"] = new StatConfig { BonusHealth = 25f }, ["LNE_HighElf"] = new StatConfig { BonusHealth = -5f, BonusEitr = 30f, BonusEitrRegen = 2.5f }, ["LNE_HighElf1"] = new StatConfig { BonusHealth = -5f, BonusEitr = 30f, BonusEitrRegen = 2.5f }, ["LNE_HighElf2"] = new StatConfig { BonusHealth = -5f, BonusEitr = 30f, BonusEitrRegen = 2.5f }, ["LNE_HighElf3"] = new StatConfig { BonusHealth = -5f, BonusEitr = 30f, BonusEitrRegen = 2.5f }, ["LNE_SE_NightElf"] = new StatConfig { BonusStamina = 20f, BonusStaminaRegen = 2.5f }, ["LNE_SE_NightElf1"] = new StatConfig { BonusStamina = 20f, BonusStaminaRegen = 2.5f }, ["LNE_SE_NightElf2"] = new StatConfig { BonusStamina = 20f, BonusStaminaRegen = 2.5f }, ["LNE_SE_NightElf3"] = new StatConfig { BonusStamina = 20f, BonusStaminaRegen = 2.5f }, ["LNE_SE_DarkElf"] = new StatConfig { BonusEitr = 15f, BonusEitrRegen = 2.5f, LifeStealChancePercent = 30f, LifeStealPercentOfDamage = 10f }, ["LNE_SE_Jotun"] = new StatConfig { BonusHealth = 100f, BonusStamina = -20f, BonusHealthRegen = 5f }, ["LNE_SE_Niflborn"] = new StatConfig { BonusHealth = 70f, BonusHealthRegen = 3f }, ["LNE_SE_Muspelheim"] = new StatConfig { BonusHealth = 70f, BonusHealthRegen = 3f }, ["LNE_SE_Myrmidon"] = new StatConfig { BonusHealth = 30f, BonusStamina = 20f, BonusEitrRegen = 2f }, ["LNE_SE_Undead"] = new StatConfig { BonusHealth = 15f, BonusStamina = 40f, LifeStealChancePercent = 60f, LifeStealPercentOfDamage = 10f }, ["LNE_SE_Draenei"] = new StatConfig { BonusHealth = 40f, BonusEitr = 15f, BonusHealthRegen = 5f }, ["LNE_SE_Tiefling"] = new StatConfig { BonusHealth = 10f, BonusEitr = 20f, BonusEitrRegen = 2.5f }, ["LNE_SE_Goblin"] = new StatConfig { BonusStamina = 15f, BonusEitr = 30f, LifeStealChancePercent = 50f, LifeStealPercentOfDamage = 20f, BonusEitrRegen = 2f }, ["LNE_SE_Human"] = new StatConfig { BonusHealth = 10f, BonusStamina = 10f, BonusStaminaRegen = 5f } }; [IteratorStateMachine(typeof(<GetConfigsFor>d__2))] internal static IEnumerable<StatConfig> GetConfigsFor(Player player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetConfigsFor>d__2(-2) { <>3__player = player }; } } [HarmonyPatch(typeof(Player), "Update")] internal static class LNE_RacialPeriodicRegen { private static readonly Dictionary<long, float> HpTimers = new Dictionary<long, float>(); private static readonly Dictionary<long, float> StamTimers = new Dictionary<long, float>(); private static readonly Dictionary<long, float> EitrTimers = new Dictionary<long, float>(); private static void Postfix(Player __instance) { float deltaTime = Time.deltaTime; if ((Object)(object)__instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || ((Character)__instance).IsDead() || (Object)(object)((Character)__instance).m_nview == (Object)null || !((Character)__instance).m_nview.IsValid()) { return; } float num = 0f; float interval = 0f; float num2 = 0f; float interval2 = 0f; float num3 = 0f; float interval3 = 0f; foreach (LNE_RacialStatusConfig.StatConfig item in LNE_RacialStatusConfig.GetConfigsFor(__instance)) { if (item.PeriodicHealPercent > num && item.PeriodicHealInterval > 0f) { num = item.PeriodicHealPercent; interval = item.PeriodicHealInterval; } if (item.PeriodicStaminaPercent > num2 && item.PeriodicStaminaInterval > 0f) { num2 = item.PeriodicStaminaPercent; interval2 = item.PeriodicStaminaInterval; } if (item.PeriodicEitrPercent > num3 && item.PeriodicEitrInterval > 0f) { num3 = item.PeriodicEitrPercent; interval3 = item.PeriodicEitrInterval; } } long playerID = __instance.GetPlayerID(); TickHp(__instance, playerID, deltaTime, num, interval); TickStamina(__instance, playerID, deltaTime, num2, interval2); TickEitr(__instance, playerID, deltaTime, num3, interval3); } private static void TickHp(Player p, long pid, float dt, float percent, float interval) { if (!HpTimers.TryGetValue(pid, out var value)) { value = 0f; } if (percent <= 0f || interval <= 0f) { HpTimers[pid] = 0f; return; } value += dt; if (value < interval) { HpTimers[pid] = value; return; } if (LNE_LastDamageTracker.LastDamageTime.TryGetValue(pid, out var value2) && Time.time - value2 < 12f) { HpTimers[pid] = value; return; } HpTimers[pid] = 0f; float maxHealth = ((Character)p).GetMaxHealth(); if (!(maxHealth <= 0f) && !(((Character)p).GetHealth() >= maxHealth - 0.001f)) { float num = maxHealth * (percent / 100f); ((Character)p).Heal(num, true); } } private static void TickStamina(Player p, long pid, float dt, float percent, float interval) { if (!StamTimers.TryGetValue(pid, out var value)) { value = 0f; } if (percent <= 0f || interval <= 0f) { StamTimers[pid] = 0f; return; } value += dt; if (value < interval) { StamTimers[pid] = value; return; } StamTimers[pid] = 0f; float maxStamina = ((Character)p).GetMaxStamina(); if (!(maxStamina <= 0f) && !(p.GetStamina() >= maxStamina - 0.001f)) { float num = maxStamina * (percent / 100f); ((Character)p).AddStamina(num); } } private static void TickEitr(Player p, long pid, float dt, float percent, float interval) { if (!EitrTimers.TryGetValue(pid, out var value)) { value = 0f; } if (percent <= 0f || interval <= 0f) { EitrTimers[pid] = 0f; return; } value += dt; if (value < interval) { EitrTimers[pid] = value; return; } EitrTimers[pid] = 0f; float maxEitr = ((Character)p).GetMaxEitr(); if (!(maxEitr <= 0f) && !(p.GetEitr() >= maxEitr - 0.001f)) { float num = maxEitr * (percent / 100f); ((Character)p).AddEitr(num); } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class LNE_LastDamageTracker { internal static readonly Dictionary<long, float> LastDamageTime = new Dictionary<long, float>(); private static void Postfix(Character __instance) { if (__instance.IsPlayer()) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { long playerID = val.GetPlayerID(); LastDamageTime[playerID] = Time.time; } } } } [HarmonyPatch] internal static class LNE_RacialStatsFromStatusEffects { [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] private static class Player_GetTotalFoodValue_RacialBonuses { private static void Postfix(Player __instance, ref float hp, ref float stamina, ref float eitr) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return; } foreach (LNE_RacialStatusConfig.StatConfig item in LNE_RacialStatusConfig.GetConfigsFor(__instance)) { if (item.BonusHealth != 0f) { hp += item.BonusHealth; } if (item.BonusStamina != 0f) { stamina += item.BonusStamina; } if (item.BonusEitr != 0f) { eitr += item.BonusEitr; } } } } } public static class LNE_RacialStatusEffects { private static bool _initialized; public static void Register() { if (!_initialized) { _initialized = true; CustomSE customSE = new CustomSE("LNE_SE_MysticElf"); customSE.Type = EffectType.Equip; customSE.Name.English("Mystic Elf"); customSE.Name.Spanish("Elfo Místico"); customSE.Icon = "LNE_ElfMystic.png"; customSE.Effect.m_tooltip = "<color=#66CCFF>La magia mística de los elfos nocturnos fluye a través de ti.</color>"; customSE.AddSEToPrefab(customSE, "LNE_potionelfnoche"); } } } public static class LNE_PrefabRegistrar { private static readonly string[] AllRacePrefabs = new string[27] { "LNE_Orcovil", "LNE_Orcovil1", "LNE_Orcoverde", "LNE_Orcoverdev2", "LNE_OrcoUrukai", "LNE_OrcoUrukaiv2", "LNE_Troll", "LNE_potionelf", "LNE_potionelf1", "LNE_potionelfv1", "LNE_potionelfv1f1", "LNE_potionelfodelbosqueoscuro", "LNE_potionelfodelbosqueoscuro1", "LNE_Enano", "LNE_potionelfodelbosqueoscurov1", "LNE_potionelfodelbosqueoscurov2", "LNE_potionelfnoche", "LNE_potionelfdark", "LNE_Mirmidon", "LNE_Nomuerto", "LNE_Tiefling", "LNE_Muspelheim", "LNE_Niflborn", "LNE_Jotun", "LNE_Draenei", "LNE_Goblin", "LNE_Human" }; public static void ApplyHairColorToBeardAndEyebrows(VisEquipment vis) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vis == (Object)null || !Object.op_Implicit((Object)(object)vis.m_visual)) { return; } Player component = ((Component)vis).GetComponent<Player>(); if (Object.op_Implicit((Object)(object)component)) { Vector3 hairColor = component.GetHairColor(); Color color = default(Color); ((Color)(ref color))..ctor(hairColor.x, hairColor.y, hairColor.z); Transform val = FindDeepChild(vis.m_visual.transform, "Barba"); if (Object.op_Implicit((Object)(object)val)) { ApplyColorToAllRenderers(val, color); } Transform val2 = FindDeepChild(vis.m_visual.transform, "Cejas"); if (Object.op_Implicit((Object)(object)val2)) { ApplyColorToAllRenderers(val2, color); } } } public static void ApplyColorToAllRenderers(Transform root, Color color) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } Material[] sharedMaterials = val.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { Material val2 = sharedMaterials[j]; if (Object.op_Implicit((Object)(object)val2)) { MaterialPropertyBlock val3 = new MaterialPropertyBlock(); val.GetPropertyBlock(val3, j); if (val2.HasProperty("_Color")) { val3.SetColor("_Color", color); } if (val2.HasProperty("_BaseColor")) { val3.SetColor("_BaseColor", color); } if (val2.HasProperty("_HairColor")) { val3.SetColor("_HairColor", color); } val.SetPropertyBlock(val3, j); } } } } public static Transform FindDeepChild(Transform parent, string name) { if (!Object.op_Implicit((Object)(object)parent)) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (((Object)child).name == name) { return child; } Transform val = FindDeepChild(child, name); if (Object.op_Implicit((Object)(object)val)) { return val; } } return null; } public static void RegisterAll() { Debug.Log((object)"[LNE] Registrando TODOS los prefabs raciales para VisEquipmentPatch..."); string[] allRacePrefabs = AllRacePrefabs; foreach (string text in allRacePrefabs) { try { text.Register(); Debug.Log((object)("[LNE] Registrado en customArmors: " + text)); } catch { Debug.LogWarning((object)("[LNE] No se pudo registrar prefab: " + text)); } } } } [HarmonyPatch(typeof(FejdStartup), "Awake")] public static class LNE_AutoRegisterPatch { private static void Postfix() { LNE_PrefabRegistrar.RegisterAll(); } } public static class VisEquipmentPatches { [HarmonyPatch(typeof(VisEquipment), "AttachItem")] private static class VisEquipment_AttachItem_Patch { [UsedImplicitly] private static bool Prefix(VisEquipment __instance, int itemHash, int variant, Transform joint, bool enableEquipEffects, bool backAttach, ref GameObject __result) { //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) if (!customArmors.Contains(itemHash)) { return true; } __result = null; GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); if (!Object.op_Implicit((Object)(object)itemPrefab)) { return false; } bool flag = __instance.GetModelIndex() != 0; Transform val = itemPrefab.transform.Find(flag ? "attach_female" : "attach_male"); if (!Object.op_Implicit((Object)(object)val)) { return false; } GameObject val2 = null; for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (backAttach && ((Object)child).name == "attach_back") { val2 = ((Component)child).gameObject; break; } if (((Object)child).name == "attach" || (!backAttach && ((Object)child).name == "attach_skin")) { val2 = ((Component)child).gameObject; break; } } if (!Object.op_Implicit((Object)(object)val2)) { return false; } GameObject val3 = Object.Instantiate<GameObject>(val2); val3.SetActive(true); VisEquipment.CleanupInstance(val3); if (enableEquipEffects) { VisEquipment.EnableEquippedEffects(val3); } if (((Object)val2).name == "attach_skin") { val3.transform.SetParent(((Component)__instance.m_bodyModel).transform.parent); val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; LNE_RaceBodyMarker lNE_RaceBodyMarker = val3.GetComponent<LNE_RaceBodyMarker>(); if ((Object)(object)lNE_RaceBodyMarker == (Object)null) { lNE_RaceBodyMarker = val3.AddComponent<LNE_RaceBodyMarker>(); } SkinnedMeshRenderer[] componentsInChildren = val3.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val4 in componentsInChildren) { val4.rootBone = __instance.m_bodyModel.rootBone; val4.bones = __instance.m_bodyModel.bones; string name = ((Object)val4).name; switch (name) { default: if (!(name == "cuerpotrollfemeninop")) { continue; } break; case "body": case "bodyfem": case "male": case "bodyfem.004": case "body.001": case "Body": case "bodyfem.001": case "EnanoMen": break; } if (!lNE_RaceBodyMarker.BodyRenderers.Contains(val4)) { lNE_RaceBodyMarker.BodyRenderers.Add(val4); } ApplyPlayerShaderToRaceRenderer(__instance, val4); } } else { val3.transform.SetParent(joint); val3.transform.localPosition = Vector3.zero; val3.transform.localRotation = Quaternion.identity; } IEquipmentVisual componentInChildren = val3.GetComponentInChildren<IEquipmentVisual>(); if (componentInChildren != null) { componentInChildren.Setup(variant); } __result = val3; return false; } } [HarmonyPatch(typeof(VisEquipment), "AttachArmor")] private static class VisEquipment_AttachArmor_Patch { [UsedImplicitly] private static bool Prefix(VisEquipment __instance, int itemHash, int variant, ref List<GameObject> __result) { if (!customArmors.Contains(itemHash)) { return true; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemHash); if (!Object.op_Implicit((Object)(object)itemPrefab)) { return false; } bool flag = __instance.GetModelIndex() != 0; Transform val = itemPrefab.transform.Find(flag ? "attach_female" : "attach_male"); if (!Object.op_Implicit((Object)(object)val)) { return false; } __result = new List<GameObject>(); for (int i = 0; i < val.childCount; i++) { Transform child = val.GetChild(i); if (!Utils.CustomStartsWith(((Object)child).name, "attach_")) { continue; } string text = ((Object)child).name.Substring(7); if (text == "skin") { GameObject item = AttachArmorSkin(__instance, child, variant); __result.Add(item); continue; } Transform val2 = Utils.FindChild(__instance.m_visual.transform, text, (IterativeSearchType)0); if (Object.op_Implicit((Object)(object)val2)) { GameObject item2 = AttachItem(child, val2, variant); __result.Add(item2); } } return false; } } [HarmonyPatch(typeof(VisEquipment), "UpdateEquipmentVisuals")] public static class LNE_VisEquipment_UpdateEquipmentVisuals_Patch { [UsedImplicitly] private static void Postfix(VisEquipment __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.m_bodyModel == (Object)null || !Object.op_Implicit((Object)(object)__instance.m_visual)) { return; } LNE_RaceBodyMarker componentInChildren = __instance.m_visual.GetComponentInChildren<LNE_RaceBodyMarker>(true); if ((Object)(object)componentInChildren == (Object)null || componentInChildren.BodyRenderers == null) { return; } foreach (SkinnedMeshRenderer bodyRenderer in componentInChildren.BodyRenderers) { if (Object.op_Implicit((Object)(object)bodyRenderer)) { ApplyPlayerShaderToRaceRenderer(__instance, bodyRenderer); } } } } public class LNE_RaceBodyMarker : MonoBehaviour { public List<SkinnedMeshRenderer> BodyRenderers = new List<SkinnedMeshRenderer>(); } [HarmonyPatch(typeof(VisEquipment), "SetHairColor")] public static class LNE_BeardEyebrowsFollowHairColorPatch { private static void Postfix(VisEquipment __instance, Vector3 color) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0087: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && Object.op_Implicit((Object)(object)__instance.m_visual)) { Color color2 = default(Color); ((Color)(ref color2))..ctor(color.x, color.y, color.z); Transform val = LNE_PrefabRegistrar.FindDeepChild(__instance.m_visual.transform, "Barba"); if (Object.op_Implicit((Object)(object)val)) { LNE_PrefabRegistrar.ApplyColorToAllRenderers(val, color2); } Transform val2 = LNE_PrefabRegistrar.FindDeepChild(__instance.m_visual.transform, "Cejas"); if (Object.op_Implicit((Object)(object)val2)) { LNE_PrefabRegistrar.ApplyColorToAllRenderers(val2, color2); } } } } public static readonly List<int> customArmors = new List<int>(); public static void Register(this GameObject obj) { ((Object)obj).name.Register(); } public static void Register(this Item item) { item.Prefab.Register(); } public static void Register(this string itemName) { Register(StringExtensionMethods.GetStableHashCode(itemName)); } public static void Register(int hash) { customArmors.Add(hash); } private static void ApplyPlayerShaderToRaceRenderer(VisEquipment vis, SkinnedMeshRenderer renderer) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)vis == (Object)null || (Object)(object)vis.m_bodyModel == (Object)null || (Object)(object)renderer == (Object)null) { return; } Material sharedMaterial = ((Renderer)vis.m_bodyModel).sharedMaterial; Material val; if ((Object)(object)sharedMaterial != (Object)null) { val = new Material(sharedMaterial); } else { Material sharedMaterial2 = ((Renderer)renderer).sharedMaterial; Shader val2 = Shader.Find("Custom/Player"); if ((Object)(object)sharedMaterial2 != (Object)null) { val = new Material(sharedMaterial2); if ((Object)(object)val2 != (Object)null) { val.shader = val2; } } else { val = (((Object)(object)val2 != (Object)null) ? new Material(val2) : new Material(Shader.Find("Standard"))); } } Material sharedMaterial3 = ((Renderer)renderer).sharedMaterial; if ((Object)(object)sharedMaterial3 != (Object)null) { if (sharedMaterial3.HasProperty("_MainTex") && val.HasProperty("_MainTex")) { Texture texture = sharedMaterial3.GetTexture("_MainTex"); if ((Object)(object)texture != (Object)null) { val.SetTexture("_MainTex", texture); } } if (sharedMaterial3.HasProperty("_BumpMap") && val.HasProperty("_BumpMap")) { Texture texture2 = sharedMaterial3.GetTexture("_BumpMap"); if ((Object)(object)texture2 != (Object)null) { val.SetTexture("_BumpMap", texture2); } } if (sharedMaterial3.HasProperty("_EmissionMap") && val.HasProperty("_EmissionMap")) { Texture texture3 = sharedMaterial3.GetTexture("_EmissionMap"); if ((Object)(object)texture3 != (Object)null) { val.SetTexture("_EmissionMap", texture3); if (val.HasProperty("_EmissionColor") && sharedMaterial3.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", sharedMaterial3.GetColor("_EmissionColor")); } } } } if (val.HasProperty("_Color")) { val.SetColor("_Color", Color.white); } ((Renderer)renderer).sharedMaterial = val; } private static GameObject AttachItem(Transform child, Transform joint, int variant) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject); val.SetActive(true); val.transform.SetParent(joint); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; if (variant >= 0) { IEquipmentVisual componentInChildren = val.GetComponentInChildren<IEquipmentVisual>(); if (componentInChildren != null) { componentInChildren.Setup(variant); } } VisEquipment.CleanupInstance(val); VisEquipment.EnableEquippedEffects(val); return val; } private static GameObject AttachArmorSkin(VisEquipment __instance, Transform child, int variant) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject, ((Component)__instance.m_bodyModel).transform.position, ((Component)__instance.m_bodyModel).transform.rotation, ((Component)__instance.m_bodyModel).transform.parent); val.SetActive(true); LNE_RaceBodyMarker lNE_RaceBodyMarker = val.GetComponent<LNE_RaceBodyMarker>(); if ((Object)(object)lNE_RaceBodyMarker == (Object)null) { lNE_RaceBodyMarker = val.AddComponent<LNE_RaceBodyMarker>(); } SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { val2.rootBone = __instance.m_bodyModel.rootBone; val2.bones = __instance.m_bodyModel.bones; string name = ((Object)val2).name; switch (name) { default: if (!(name == "Cuerpotrollfemeninop")) { continue; } break; case "body": case "bodyfem": case "male": case "bodyfem.004": case "body.001": case "Body": case "bodyfem.001": case "EnanoMen": break; } if (!lNE_RaceBodyMarker.BodyRenderers.Contains(val2)) { lNE_RaceBodyMarker.BodyRenderers.Add(val2); } ApplyPlayerShaderToRaceRenderer(__instance, val2); } IEquipmentVisual component = val.GetComponent<IEquipmentVisual>(); if (component != null) { component.Setup(variant); } VisEquipment.CleanupInstance(val); VisEquipment.EnableEquippedEffects(val); return val; } } } 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<Requirement> Requirements = new List<Requirement>(); public bool Free = false; public void Add(string itemName, int amount, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amount = amount, quality = quality }); } public void Add(string itemName, ConfigEntry<int> amountConfig, int quality = 0) { Requirements.Add(new Requirement { itemName = itemName, amountConfig = amountConfig, quality = quality }); } } [PublicAPI] public class CraftingStationList { public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>(); public void Add(CraftingTable table, int level) { Stations.Add(new CraftingStationConfig { Table = table, level = level }); } public void Add(string customTable, int level) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, level = level, custom = customTable }); } } [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<int>? amountConfig; [Description("Set to a non-zero value to apply the requirement only for a specific quality")] public int quality; } public struct CraftingStationConfig { public CraftingTable Table; public int level; 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<DropTarget> Drops = new List<DropTarget>(); public void Add(string creatureName, float chance, int min = 1, int? max = null, bool levelMultiplier = true) { Drops.Add(new DropTarget { creature = creatureName, chance = chance, min = min, max = max.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<string>? craft; public ConfigEntry<string>? upgrade; public ConfigEntry<CraftingTable> table = null; public ConfigEntry<int> tableLevel = null; public ConfigEntry<string> customTable = null; public ConfigEntry<int>? maximumTableLevel; public ConfigEntry<Toggle> requireOneIngredient = null; public ConfigEntry<float> qualityResultAmountMultiplier = null; } private class TraderConfig { public ConfigEntry<Trader> trader = null; public ConfigEntry<uint> price = null; public ConfigEntry<uint> stack = null; public ConfigEntry<string> 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<ConfigEntryBase>? CustomDrawer; public Func<bool>? 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<Requirement> Reqs; public SerializedRequirements(List<Requirement> 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<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(ObjectDB objectDB, SerializedRequirements craft, SerializedRequirements upgrade) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01b7: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown ObjectDB objectDB2 = objectDB; Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)((Requirement r) => r.itemName), (Func<Requirement, Requirement>)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<Requirement> 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<DropTarget> Drops; public SerializedDrop(List<DropTarget> drops) { Drops = drops; } public SerializedDrop(string drops) { Drops = ((drops == "") ? ((IEnumerable<string>)Array.Empty<string>()) : ((IEnumerable<string>)drops.Split(new char[1] { ',' }))).Select(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<Character>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("The drop target character '" + name + "' does not exist.")); } return val; } public Dictionary<Character, Drop> toCharacterDrops(ZNetScene netScene, GameObject item) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown Dictionary<Character, Drop> dictionary = new Dictionary<Character, Drop>(); foreach (DropTarget drop in Drops) { Character val = fetchByName(netScene, drop.creature); if (val != null) { dictionary[val] = new Drop { m_prefab = item, m_amountMin = drop.min, m_amountMax = drop.max, m_chance = drop.chance, m_levelMultiplier = drop.levelMultiplier }; } } return dictionary; } } [CompilerGenerated] private sealed class <>c__DisplayClass83_0 { public Quaternion? cameraRotation; public float lightIntensity; public ItemDrop item; public Quaternion? itemRotation; } [CompilerGenerated] private sealed class <Transpile_InventoryGui>d__85 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private List<CodeInstruction> <instrs>5__1; private FieldInfo <amount