Decompiled source of Judes Equipment v2.2.4
plugins/JudesEquipment.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; 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.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using JetBrains.Annotations; using JudesEquipment.ArmorSets; using JudesEquipment.Configuration; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("JudesEquipment")] [assembly: AssemblyDescription("")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("JudesEquipment")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f33c90df-d8e2-403e-b94c-001a58ff0821")] [assembly: AssemblyFileVersion("2.2.4")] [assembly: AssemblyCompany("")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.2.4.0")] [module: UnverifiableCode] namespace JudesEquipment { public static class Sync { public static ConfigSync configSync = new ConfigSync("GoldenJude_JudesEquipment") { DisplayName = "Jude's Equipment", CurrentVersion = "2.2.4", MinimumRequiredVersion = "2.2.4" }; public static ConfigEntry<T> SyncConfig<T>(ConfigEntry<T> entry) { SyncedConfigEntry<T> syncedConfigEntry = configSync.AddConfigEntry<T>(entry); syncedConfigEntry.SynchronizedConfig = true; return entry; } } [HarmonyPatch] internal static class GenderSwitchPatch { [HarmonyPatch(typeof(VisEquipment), "AttachArmor")] [HarmonyPostfix] public static void PostFix(VisEquipment __instance, ref List<GameObject> __result) { SetEquipmentGender(ref __result, __instance); } public static void SetEquipmentGender(ref List<GameObject> equip, VisEquipment viseq) { foreach (GameObject item in equip) { if ((Object)(object)item == (Object)null) { continue; } for (int i = 0; i < item.transform.childCount; i++) { Transform child = item.transform.GetChild(i); if (!((Object)(object)child == (Object)null)) { if (((Object)((Component)child).gameObject).name == "female" && viseq.GetModelIndex() == 0) { ((Component)child).gameObject.SetActive(false); } if (((Object)((Component)child).gameObject).name == "male" && viseq.GetModelIndex() == 1) { ((Component)child).gameObject.SetActive(false); } } } } } } public static class ItemManager { public static Transform cloneContainer; public static List<PrefabConfig> prefabs = new List<PrefabConfig>(); public static List<StatusEffect> customSEs = new List<StatusEffect>(); public static List<BlacksmithsToolsConfig> bsmithCfgs = new List<BlacksmithsToolsConfig>(); public static Dictionary<string, Dictionary<string, string>> colorConfig = new Dictionary<string, Dictionary<string, string>> { { "ArmorBarbarianBronzeHelmetJD", new Dictionary<string, string> { { "Color 1", "#FF892A" }, { "Color 2", "#FFFFFF" } } }, { "ArmorBarbarianBronzeChestJD", new Dictionary<string, string> { { "Color 1", "#FF892A" }, { "Color 2", "#FFFFFF" } } }, { "ArmorBarbarianBronzeLegsJD", new Dictionary<string, string> { { "Color 1", "#FF892A" }, { "Color 2", "#FFFFFF" } } }, { "ArmorWarriorHelmet", new Dictionary<string, string> { { "Color 1", "#FF892A" } } }, { "ArmorWarriorChest", new Dictionary<string, string> { { "Color 1", "#FF892A" } } }, { "ArmorPlateIronHelmetJD", new Dictionary<string, string> { { "Color 1", "#FFFFFF" } } }, { "ArmorPlateIronChestJD", new Dictionary<string, string> { { "Color 1", "#FFFFFF" } } }, { "ArmorPlateIronLegsJD", new Dictionary<string, string> { { "Color 1", "#FFFFFF" } } }, { "ArmorDragonslayerHelmet", new Dictionary<string, string> { { "Color 1", "#373737" } } }, { "ArmorDragonslayerChest", new Dictionary<string, string> { { "Color 1", "#373737" } } }, { "ArmorDragonslayerLegs", new Dictionary<string, string> { { "Color 1", "#373737" } } }, { "ArmorWandererChest", new Dictionary<string, string> { { "Color 1", "#FFFFFF" } } }, { "ArmorWandererLegs", new Dictionary<string, string> { { "Color 1", "#FFFFFF" } } }, { "ArmorBlackmetalgarbHelmet", new Dictionary<string, string> { { "Color 1", "#264C35" } } }, { "ArmorBlackmetalgarbChest", new Dictionary<string, string> { { "Color 1", "#264C35" } } }, { "ArmorBlackmetalgarbLegs", new Dictionary<string, string> { { "Color 1", "#264C35" } } }, { "ArmorSerpentHelmet", new Dictionary<string, string> { { "Color 1", "#264C35" }, { "Color 2", "#FFFFFF" } } }, { "ArmorSerpentChest", new Dictionary<string, string> { { "Color 1", "#264C35" }, { "Color 2", "#FFFFFF" } } }, { "ArmorSerpentLegs", new Dictionary<string, string> { { "Color 1", "#264C35" }, { "Color 2", "#FFFFFF" } } }, { "ArmorMistlandsHelmet", new Dictionary<string, string> { { "Color 1", "#545454" }, { "Emission color", "#BF3000" } } }, { "ArmorMistlandsChest", new Dictionary<string, string> { { "Color 1", "#545454" }, { "Emission color", "#BF3000" } } }, { "ArmorMistlandsLegs", new Dictionary<string, string> { { "Color 1", "#545454" }, { "Emission color", "#BF3000" } } } }; public static readonly List<string> allPrefabs = new List<string> { "ArmorNobleHelmet", "ArmorNobleChest", "ArmorNobleLegs", "ArmorNobleCape", "ArmorBarbarianBronzeHelmetJD", "ArmorBarbarianBronzeChestJD", "ArmorBarbarianBronzeLegsJD", "ArmorBarbarianCapeJD", "ArmorWarriorHelmet", "ArmorWarriorChest", "ArmorWarriorLegs", "ArmorPlateIronHelmetJD", "ArmorPlateIronChestJD", "ArmorPlateIronLegsJD", "ArmorPlateCape", "ArmorDragonslayerHelmet", "ArmorDragonslayerChest", "ArmorDragonslayerLegs", "ArmorWandererHelmet", "ArmorWandererChest", "ArmorWandererLegs", "ArmorWandererCape", "ArmorBlackmetalgarbHelmet", "ArmorBlackmetalgarbChest", "ArmorBlackmetalgarbLegs", "ArmorSerpentHelmet", "ArmorSerpentChest", "ArmorSerpentLegs", "ArmorSerpentCape", "ArmorMistlandsHelmet", "ArmorMistlandsChest", "ArmorMistlandsLegs", "BackpackSimple", "BackpackHeavy" }; public static Transform GetCloneHolder() { if ((Object)(object)cloneContainer == (Object)null) { cloneContainer = GameObject.CreatePrimitive((PrimitiveType)3).transform; Object.DontDestroyOnLoad((Object)(object)cloneContainer); ((Component)cloneContainer).gameObject.SetActive(false); return cloneContainer; } return cloneContainer; } public static void AddItemsToDBs(ObjectDB odb) { LoadPrefabsFromBundle(); foreach (PrefabConfig prefab in prefabs) { if ((Object)(object)prefab.GetPrefab() == (Object)null) { continue; } if (!odb.m_itemByHash.ContainsKey(StringExtensionMethods.GetStableHashCode(((Object)prefab.GetPrefab()).name))) { odb.m_itemByHash.Add(StringExtensionMethods.GetStableHashCode(((Object)prefab.GetPrefab()).name), prefab.GetPrefab()); } if (!odb.m_items.Contains(prefab.GetPrefab())) { odb.m_items.Add(prefab.GetPrefab()); } if ((Object)(object)ZNetScene.instance != (Object)null) { if (!ZNetScene.instance.m_prefabs.Contains(prefab.GetPrefab())) { ZNetScene.instance.m_prefabs.Add(prefab.GetPrefab()); } if (!ZNetScene.instance.m_namedPrefabs.ContainsKey(StringExtensionMethods.GetStableHashCode(((Object)prefab.GetPrefab()).name))) { ZNetScene.instance.m_namedPrefabs.Add(StringExtensionMethods.GetStableHashCode(((Object)prefab.GetPrefab()).name), prefab.GetPrefab()); } } } customSEs.ForEach(delegate(StatusEffect se) { if (!odb.m_StatusEffects.Contains(se)) { odb.m_StatusEffects.Add(se); } }); } public static void InsertBsmithToolsCfgs() { if (!Main.bsmithAvailable) { return; } Type type = Type.GetType("BlacksmithTools.BodypartSystem,BlacksmithTools"); FieldInfo field = type.GetField("bodypartSettingsAsBones"); Dictionary<string, List<int>> dictionary = (Dictionary<string, List<int>>)field.GetValue(field); foreach (BlacksmithsToolsConfig bsmithCfg in bsmithCfgs) { if (dictionary.ContainsKey(bsmithCfg.itemName)) { dictionary[bsmithCfg.itemName] = new List<int>(bsmithCfg.bonesToHide); } else { dictionary.Add(bsmithCfg.itemName, new List<int>(bsmithCfg.bonesToHide)); } } } private static void LoadPrefabsFromBundle() { AssetBundle bundle = Util.LoadBundle("judeequipment"); prefabs.Clear(); allPrefabs.ForEach(delegate(string _prefab) { prefabs.Add(new PrefabConfig { prefab = bundle.LoadAsset<GameObject>(_prefab) }); }); bundle.Unload(false); } } public static class LocalizationManager { public static Localization localizationInstance; public static readonly List<string> languages = new List<string> { "English", "Swedish", "French", "Italian", "German", "Spanish", "Russian", "Romanian", "Bulgarian", "Macedonian", "Finnish", "Danish", "Norwegian", "Icelandic", "Turkish", "Lithuanian", "Czech", "Hungarian", "Slovak", "Polish", "Dutch", "Portuguese_European", "Portuguese_Brazilian", "Chinese", "Japanese", "Korean", "Hindi", "Thai", "Abenaki", "Croatian", "Georgian", "Greek", "Serbian", "Ukrainian" }; public static void LoadLocalization() { List<string> list = Directory.GetFiles(Paths.ConfigPath, "GoldenJude_JudesEquipment_Localization.yml", SearchOption.AllDirectories).ToList(); if (list.Count == 0) { File.WriteAllText(Path.Combine(Paths.ConfigPath, "GoldenJude_JudesEquipment_Localization.yml"), new SerializerBuilder().Build().Serialize(Main.localization)); return; } try { IDeserializer deserializer = new DeserializerBuilder().Build(); Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>(); dictionary = deserializer.Deserialize<Dictionary<string, Dictionary<string, string>>>(File.ReadAllText(list[0])); Main.localization.Clear(); Main.localization = dictionary; Main.syncedLocalization.Value = new SerializerBuilder().Build().Serialize(dictionary); } catch (Exception ex) { Main.log.LogWarning((object)"An error occured when loading localization"); Main.log.LogWarning((object)ex.Message); Main.log.LogWarning((object)ex.StackTrace); } } public static void InsertLocalization() { if (localizationInstance == null) { return; } string key = localizationInstance.GetSelectedLanguage(); if (!Main.localization.ContainsKey(key)) { key = "English"; } if (!Main.localization.ContainsKey(key)) { return; } foreach (KeyValuePair<string, string> item in Main.localization[key]) { localizationInstance.m_translations.Remove(item.Key); localizationInstance.m_translations.Add(item.Key, item.Value); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("GoldenJude_JudesEquipment", "JudesEquipment", "2.2.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public const string MODNAME = "JudesEquipment"; public const string AUTHOR = "GoldenJude"; public const string GUID = "GoldenJude_JudesEquipment"; public const string VERSION = "2.2.4"; public static ManualLogSource log; internal readonly Harmony harmony; public static Assembly assembly; public const string bundleName = "judeequipment"; public const string itemConfigName = "GoldenJude_JudesEquipment_ItemConfig.yml"; public const string localizationconfigName = "GoldenJude_JudesEquipment_Localization.yml"; public const string colorConfigName = "GoldenJude_JudesEquipment_Colors.yml"; public static CustomSyncedValue<string> syncedModConfig = new CustomSyncedValue<string>(Sync.configSync, Path.GetFileNameWithoutExtension("GoldenJude_JudesEquipment_ItemConfig.yml")); public static CustomSyncedValue<string> syncedLocalization = new CustomSyncedValue<string>(Sync.configSync, Path.GetFileNameWithoutExtension("GoldenJude_JudesEquipment_Localization.yml")); public static SyncedConfigEntry<int> lockingConfig; public static ConfigEntry<bool> neutralMetals; public static ConfigEntry<bool> smoothTextures; public static Shader creatureShader; public static bool bsmithAvailable = false; public static bool hugosCollidersAvaiable = false; public static ItemConfig modConfig = new ItemConfig(); public static Dictionary<string, Dictionary<string, string>> localization = new Dictionary<string, Dictionary<string, string>> { { "English", new Dictionary<string, string>() } }; public static FileSystemWatcher fsw = new FileSystemWatcher { Path = Paths.ConfigPath, IncludeSubdirectories = true, EnableRaisingEvents = true }; public Main() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown log = ((BaseUnityPlugin)this).Logger; harmony = new Harmony("GoldenJude_JudesEquipment"); assembly = Assembly.GetExecutingAssembly(); } public void Start() { harmony.PatchAll(assembly); bsmithAvailable = Util.IsModAvailable("BlacksmithTools", "2.0.0"); hugosCollidersAvaiable = Util.IsModAvailable("More Player Cloth Colliders", "3.0.0"); lockingConfig = Sync.configSync.AddLockingConfigEntry<int>(((BaseUnityPlugin)this).Config.Bind<int>("Sync", "Sync configs", 1, "1 = enabled, 0 = disabled")); neutralMetals = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "Neutral metals", false, "Makes all metals a neutral grey"); smoothTextures = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "Smooth textures", false, "Removes pixelization filter on all textures, overrides color config"); CreateDefaultLocalization(); LocalizationManager.LoadLocalization(); LoadColorConfig(); syncedModConfig.ValueChanged += delegate { modConfig = new DeserializerBuilder().Build().Deserialize<ItemConfig>(syncedModConfig.Value); modConfig.ApplyArmorConfigs(); modConfig.ApplyRecipeConfigs(); modConfig.ApplySetEffects(); }; syncedLocalization.ValueChanged += delegate { localization = new DeserializerBuilder().Build().Deserialize<Dictionary<string, Dictionary<string, string>>>(syncedLocalization.Value); LocalizationManager.InsertLocalization(); }; fsw.Changed += delegate(object sender, FileSystemEventArgs e) { if (Sync.configSync.IsSourceOfTruth) { if (Path.GetFileName(e.FullPath) == "GoldenJude_JudesEquipment_ItemConfig.yml") { LoadModConfig(); } if (Path.GetFileName(e.FullPath) == "GoldenJude_JudesEquipment_Localization.yml") { LocalizationManager.LoadLocalization(); } } }; } public static void LoadColorConfig() { List<string> list = Directory.GetFiles(Paths.ConfigPath, "GoldenJude_JudesEquipment_Colors.yml", SearchOption.AllDirectories).ToList(); if (list.Count == 0) { File.WriteAllText(Path.Combine(Paths.ConfigPath, "GoldenJude_JudesEquipment_Colors.yml"), new SerializerBuilder().Build().Serialize(ItemManager.colorConfig)); return; } Dictionary<string, Dictionary<string, string>> dictionary = new Dictionary<string, Dictionary<string, string>>(); try { dictionary = new DeserializerBuilder().Build().Deserialize<Dictionary<string, Dictionary<string, string>>>(File.ReadAllText(list[0])); ItemManager.colorConfig = dictionary; } catch (Exception ex) { log.LogWarning((object)"An error occured when loading GoldenJude_JudesEquipment_Colors.yml, will use default values"); log.LogWarning((object)ex.Message); log.LogWarning((object)ex.StackTrace); } } public static void LoadModConfig() { List<string> list = Directory.GetFiles(Paths.ConfigPath, "GoldenJude_JudesEquipment_ItemConfig.yml", SearchOption.AllDirectories).ToList(); if (list.Count == 0) { File.WriteAllText(Path.Combine(Paths.ConfigPath, "GoldenJude_JudesEquipment_ItemConfig.yml"), new SerializerBuilder().Build().Serialize(modConfig)); return; } ItemConfig graph = new ItemConfig(); try { graph = new DeserializerBuilder().Build().Deserialize<ItemConfig>(File.ReadAllText(list[0])); } catch (Exception ex) { log.LogWarning((object)"An error occured when loading GoldenJude_JudesEquipment_ItemConfig.yml, will use default values"); log.LogWarning((object)ex.Message); log.LogWarning((object)ex.StackTrace); } syncedModConfig.Value = new SerializerBuilder().Build().Serialize(graph); try { if (!ConfigHasAllArmors(File.ReadAllText(list[0]))) { File.WriteAllText(Path.Combine(Paths.ConfigPath, "GoldenJude_JudesEquipment_ItemConfig.yml"), new SerializerBuilder().Build().Serialize(modConfig)); } } catch (Exception ex2) { log.LogWarning((object)("failed to validate if item config fil contains all sets, error: " + Environment.NewLine + ex2.Message)); } } private static bool ConfigHasAllArmors(string configJson) { List<FieldInfo> source = typeof(ItemConfig).GetFields().ToList(); List<FieldInfo> list = source.Where((FieldInfo field) => field.CustomAttributes.First((CustomAttributeData att) => att.AttributeType == typeof(YamlMemberAttribute)) != null).ToList(); foreach (FieldInfo item in list) { CustomAttributeData customAttributeData = item.CustomAttributes.First((CustomAttributeData att) => att.AttributeType == typeof(YamlMemberAttribute)); string value = (string)customAttributeData.NamedArguments.First((CustomAttributeNamedArgument na) => na.MemberName == "Alias").TypedValue.Value; if (!configJson.Contains(value)) { return false; } } return true; } private void CreateDefaultLocalization() { localization["English"].Add("ArmorNobleHelmet", "Fur hat"); localization["English"].Add("ArmorNobleHelmet_description", "Fashionable hat with fur lining"); localization["English"].Add("ArmorNobleChest", "Noble's banner garb"); localization["English"].Add("ArmorNobleChest_description", "A garb stitched together from banners torn from your burial chamber, a good alternative to roaming Valheim bare"); localization["English"].Add("ArmorNobleLegs", "Noble's pants"); localization["English"].Add("ArmorNobleLegs_description", "Worn, loose pants from a past life where one could afford to feast more often"); localization["English"].Add("ArmorNobleCape", "Vegvisir cape"); localization["English"].Add("ArmorNobleCape_description", "Cape fashioned from a vegvisir banner"); localization["English"].Add("ArmorBarbarianBronzeHelmetJD", "Barbarian's helmet"); localization["English"].Add("ArmorBarbarianBronzeHelmetJD_description", "Helmet made from a bronze alloy"); localization["English"].Add("ArmorBarbarianBronzeChestJD", "Barbarian's armor"); localization["English"].Add("ArmorBarbarianBronzeChestJD_description", "A bronze disc attached to leather straps, a true barbarian hurls himself into battle despite the lack of protection"); localization["English"].Add("ArmorBarbarianBronzeLegsJD", "Barbarian's boots"); localization["English"].Add("ArmorBarbarianBronzeLegsJD_description", "Thick hide wrapped around one's waist, fastened with a fashionable bronze belt"); localization["English"].Add("ArmorBarbarianCapeJD", "Barbarian's fur cape"); localization["English"].Add("ArmorBarbarianCapeJD_description", "Thick, short cape made from fur. Covers ones back when his drunk raidmates can't."); localization["English"].Add("ArmorWarriorHelmet", "Warrior's helmet"); localization["English"].Add("ArmorWarriorHelmet_description", "Chainmail wrapping around the neck provides good protection"); localization["English"].Add("ArmorWarriorChest", "Warrior's hauberk"); localization["English"].Add("ArmorWarriorChest_description", "Long vest made from linked chains"); localization["English"].Add("ArmorWarriorLegs", "Warrior's boots"); localization["English"].Add("ArmorWarriorLegs_description", "Multi-layered pants keep it's wearer warm and protected"); localization["English"].Add("ArmorPlateIronHelmetJD", "Sturdy helmet"); localization["English"].Add("ArmorPlateIronHelmetJD_description", "A sturdy helmet with a leather neckguard"); localization["English"].Add("ArmorPlateIronChestJD", "Plate mail"); localization["English"].Add("ArmorPlateIronChestJD_description", "Thick plates of metal riveted to a leather harness"); localization["English"].Add("ArmorPlateIronLegsJD", "Plate greaves"); localization["English"].Add("ArmorPlateIronLegsJD_description", "Reliable greaves and kneeguards"); localization["English"].Add("ArmorPlateCape", "Boar cape"); localization["English"].Add("ArmorPlateCape_description", "Reinforced boar hide worn around one's shoulders like a trophy"); localization["English"].Add("ArmorDragonslayerHelmet", "Horned helm"); localization["English"].Add("ArmorDragonslayerHelmet_description", "Dragon's tremble in fear when they see the blackened helmet adorned with the horns of their kin"); localization["English"].Add("ArmorDragonslayerChest", "Dragonslayer's armor"); localization["English"].Add("ArmorDragonslayerChest_description", "Obsidian layer over silver plates makes for reliable protection"); localization["English"].Add("ArmorDragonslayerLegs", "Spiked greaves"); localization["English"].Add("ArmorDragonslayerLegs_description", "Unlucky is he who finds himself in the way of these"); localization["English"].Add("ArmorWandererHelmet", "Straw hat"); localization["English"].Add("ArmorWandererHelmet_description", "A reinforced straw hat"); localization["English"].Add("ArmorWandererChest", "Coat of plates"); localization["English"].Add("ArmorWandererChest_description", "Small metal plates attached to a leather jerkin, easy to maintain during travels"); localization["English"].Add("ArmorWandererLegs", "Wanderer's pants"); localization["English"].Add("ArmorWandererLegs_description", "Durable pants with makeshift protection around the shins"); localization["English"].Add("ArmorWandererCape", "Straw cape"); localization["English"].Add("ArmorWandererCape_description", "Cheap to make cape made from straw collected in the plains, protects against the elements but is quick to catch fire"); localization["English"].Add("ArmorBlackmetalgarbHelmet", "Nomadic helmet"); localization["English"].Add("ArmorBlackmetalgarbHelmet_description", "Blackmetal helmet with colorful padding fit for a nomad"); localization["English"].Add("ArmorBlackmetalgarbChest", "Nomadic garb"); localization["English"].Add("ArmorBlackmetalgarbChest_description", "A nomadic garb adorned with protective elements made from blackmetal, found commonly in the nomad's homeland, the plains"); localization["English"].Add("ArmorBlackmetalgarbLegs", "Nomadic boots"); localization["English"].Add("ArmorBlackmetalgarbLegs_description", "Thick leather boots with blackmetal toe guard, helpful when one happens to get stomped on by a Lox"); localization["English"].Add("ArmorSerpentHelmet", "Finned helm"); localization["English"].Add("ArmorSerpentHelmet_description", "A thick blackmetal casque adorned by the fins of a mighty serpent. The style is popular with raiding knights of the South."); localization["English"].Add("ArmorSerpentChest", "Serpent armor"); localization["English"].Add("ArmorSerpentChest_description", "Plates of blackmetal overtop a surcoat of sea serpent scales. The perfect garb for spreading Odin's good word."); localization["English"].Add("ArmorSerpentLegs", "Serpent Cuisses"); localization["English"].Add("ArmorSerpentLegs_description", "Blackmetal cuisses, greaves and sabatons. Excellent protection with a slightly fishy smell."); localization["English"].Add("ArmorSerpentCape", "Serpent knight's cape"); localization["English"].Add("ArmorSerpentCape_description", "Heavy dark cape of the Serpent order."); localization["English"].Add("ArmorMistlandsHelmet", "Scorched sallet"); localization["English"].Add("ArmorMistlandsHelmet_description", "Helmet made from a rare material only found within the ashlands"); localization["English"].Add("ArmorMistlandsChest", "Scorched armor"); localization["English"].Add("ArmorMistlandsChest_description", "Thick, multi layered gambeson provides protection from the searing heat of flametal, which in turn protects from blows"); localization["English"].Add("ArmorMistlandsLegs", "Scorched greaves"); localization["English"].Add("ArmorMistlandsLegs_description", "One need not fear the cold while wearing these"); localization["English"].Add("BackpackSimple", "Simple backpack"); localization["English"].Add("BackpackSimple_description", "Leather container attached to a wooden frame"); localization["English"].Add("BackpackHeavy", "Heavy backpack"); localization["English"].Add("BackpackHeavy_description", "Large chest hauled on ones shoulders with a canvas bag for additional storage"); } public static void CreateBlacksmithsTooslConfigs() { if (bsmithAvailable) { ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorNobleChest", bonesToHide = Util.TorsoUpperLowerArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorNobleLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorBlackmetalgarbChest", bonesToHide = Util.TorsoUpperArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorBlackmetalgarbLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorBarbarianBronzeLegsJD", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorWarriorLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorWandererChest", bonesToHide = Util.TorsoUpperArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorWandererLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorDragonslayerChest", bonesToHide = Util.TorsoUpperArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorDragonslayerLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorMistlandsChest", bonesToHide = Util.TorsoUpperLowerArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorMistlandsLegs", bonesToHide = Util.CompleteLegs }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorSerpentChest", bonesToHide = Util.TorsoUpperLowerArms }); ItemManager.bsmithCfgs.Add(new BlacksmithsToolsConfig { itemName = "ArmorSerpentLegs", bonesToHide = Util.CompleteLegs }); } } } [HarmonyPatch] internal static class Patches { public static IEnumerator DelayedRecipeInsertion() { yield return null; Main.modConfig.ApplyRecipeConfigs(); } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] [HarmonyPostfix] private static void CopyOtherDb_patch(ObjectDB __instance, ObjectDB other) { List<GameObject> items = __instance.m_items; object creatureShader; if (items == null) { creatureShader = null; } else { GameObject? obj = items.Find((GameObject _item) => ((Object)_item).name == "ArmorIronChest"); if (obj == null) { creatureShader = null; } else { SkinnedMeshRenderer componentInChildren = obj.GetComponentInChildren<SkinnedMeshRenderer>(true); if (componentInChildren == null) { creatureShader = null; } else { Material material = ((Renderer)componentInChildren).material; creatureShader = ((material != null) ? material.shader : null); } } } Main.creatureShader = (Shader)creatureShader; ItemManager.AddItemsToDBs(__instance); } [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "Awake")] private static void DbAwake_patch(ObjectDB __instance) { List<GameObject> items = __instance.m_items; object creatureShader; if (items == null) { creatureShader = null; } else { GameObject? obj = items.Find((GameObject _item) => ((Object)_item).name == "ArmorIronChest"); if (obj == null) { creatureShader = null; } else { SkinnedMeshRenderer componentInChildren = obj.GetComponentInChildren<SkinnedMeshRenderer>(true); if (componentInChildren == null) { creatureShader = null; } else { Material material = ((Renderer)componentInChildren).material; creatureShader = ((material != null) ? material.shader : null); } } } Main.creatureShader = (Shader)creatureShader; if (Main.bsmithAvailable) { Main.CreateBlacksmithsTooslConfigs(); ItemManager.InsertBsmithToolsCfgs(); } ItemManager.AddItemsToDBs(__instance); Main.LoadModConfig(); LocalizationManager.LoadLocalization(); LocalizationManager.InsertLocalization(); } [HarmonyPatch(typeof(FejdStartup), "Start")] [HarmonyPostfix] private static void FejdSetupGui_patch() { LocalizationManager.localizationInstance = Localization.instance; } [HarmonyPatch(typeof(Humanoid), "HaveSetEffect")] [HarmonyPostfix] private static void shitpatch(ItemData item, Humanoid __instance, ref bool __result) { if (!__result && item != null && !((Object)(object)item.m_dropPrefab == (Object)null) && ItemManager.allPrefabs.Contains(((Object)item.m_dropPrefab).name)) { __result = item != null && !((Object)(object)item.m_shared.m_setStatusEffect == (Object)null) && item.m_shared.m_setName.Length != 0 && item.m_shared.m_setSize > 0 && __instance.GetSetCount(item.m_shared.m_setName) >= item.m_shared.m_setSize; } } } public static class Util { public static readonly int[] Torso = new int[6] { 0, 1, 2, 3, 7, 26 }; public static readonly int[] ArmUpperLeft = new int[1] { 8 }; public static readonly int[] ArmLowerLeft = new int[1] { 9 }; public static readonly int[] HandLeft = new int[17] { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; public static readonly int[] ArmUpperRight = new int[1] { 27 }; public static readonly int[] ArmLowerRight = new int[1] { 28 }; public static readonly int[] HandRight = new int[16] { 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44 }; public static readonly int[] LegUpperLeft = new int[1] { 45 }; public static readonly int[] LegLowerLeft = new int[1] { 46 }; public static readonly int[] FootLeft = new int[2] { 47, 48 }; public static readonly int[] LegUpperRight = new int[1] { 49 }; public static readonly int[] LegLowerRight = new int[1] { 50 }; public static readonly int[] FootRight = new int[2] { 51, 52 }; public static readonly int[] TorsoUpperArms = Torso.Concat(ArmUpperLeft).Concat(ArmUpperRight).ToArray(); public static readonly int[] TorsoUpperLowerArms = Torso.Concat(ArmUpperLeft).Concat(ArmLowerLeft).Concat(ArmUpperRight) .Concat(ArmLowerRight) .ToArray(); public static readonly int[] CompleteLegs = LegUpperLeft.Concat(LegLowerLeft).Concat(FootLeft).Concat(LegUpperRight) .Concat(LegLowerRight) .Concat(FootRight) .ToArray(); public static AssetBundle LoadBundle(string bundleName) { return AssetBundle.LoadFromStream(Main.assembly.GetManifestResourceStream(Main.assembly.GetName().Name + ".Resources." + bundleName)); } public static bool IsModAvailable(string modName, string minVersion, bool printAllMods = false) { PluginInfo? obj = Chainloader.PluginInfos.Values.ToList().Find((PluginInfo _modName) => _modName.Metadata.Name == modName); return ((obj != null) ? obj.Metadata.Version : null) >= new System.Version(minVersion); } public static List<DamageModPair> ParseDmgModPairs(string def) { //IL_007c: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) try { if (string.IsNullOrEmpty(def)) { return new List<DamageModPair>(); } def = def.Trim(); List<DamageModPair> list = new List<DamageModPair>(); string[] array = def.Split(new char[1] { ';' }); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { ':' }); DamageType type = (DamageType)Enum.Parse(typeof(DamageType), array3[0].ToString().Trim()); DamageModifier modifier = (DamageModifier)Enum.Parse(typeof(DamageModifier), array3[1].ToString().Trim()); list.Add(new DamageModPair { m_type = type, m_modifier = modifier }); } return list; } catch (Exception ex) { Main.log.LogError((object)"An error occured when parsing damge modifiers"); Main.log.LogError((object)ex.Message); return new List<DamageModPair>(); } } } } namespace JudesEquipment.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("JudesEquipment.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] judeequipment { get { object @object = ResourceManager.GetObject("judeequipment", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace JudesEquipment.Configuration { public class ArmorSetConfig { [YamlMember(Alias = "set effect")] public SetEffect setEffect = new SetEffect(); public Dictionary<string, ArmorConfig> items = new Dictionary<string, ArmorConfig>(); public void ApplyArmorConfigs() { items.Values.ToList().ForEach(delegate(ArmorConfig piece) { piece.ApplyConfig(); }); } public void ApplyRecipeConfigs() { items.Values.ToList().ForEach(delegate(ArmorConfig piece) { piece.recipe.ApplyConfig(piece.prefabName); }); } public void ApplySetConfig(string effectName) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ObjectDB.instance == (Object)null) { return; } SE_Stats effect = (SE_Stats)ItemManager.customSEs.Find((StatusEffect se) => ((Object)se).name == effectName); if ((Object)(object)effect == (Object)null) { effect = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)effect).name = effectName; ((StatusEffect)effect).m_icon = ObjectDB.instance.m_items.Find((GameObject iconSource) => ((Object)iconSource).name == items.Values.ToList()[0].prefabName).GetComponent<ItemDrop>().m_itemData.m_shared.m_icons[0]; ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)effect); ItemManager.customSEs.Add((StatusEffect)(object)effect); } effect.m_healthRegenMultiplier = (float)setEffect.healthRegenModifier / 100f + 1f; effect.m_staminaRegenMultiplier = (float)setEffect.staminaReregenModifier / 100f + 1f; effect.m_addMaxCarryWeight = setEffect.carryWeightModifier; effect.m_mods = ArmorConfig.ParseModPairs(setEffect.damageModifiers); effect.m_skillLevel = (SkillType)Enum.Parse(typeof(SkillType), setEffect.skillModifier.skill); effect.m_skillLevelModifier = setEffect.skillModifier.modifier; effect.m_runStaminaDrainModifier = (float)setEffect.runStaminaDrainModifier / 100f; effect.m_jumpStaminaUseModifier = (float)setEffect.jumpStaminaDrainModifier / 100f; items.Values.ToList().ForEach(delegate(ArmorConfig piece) { if (piece.countsTowardsSetBonus) { GameObject prefab = ItemManager.prefabs.Find((PrefabConfig armor) => ((Object)armor.GetPrefab()).name == piece.prefabName).GetPrefab(); ItemDrop val = ((prefab != null) ? prefab.GetComponent<ItemDrop>() : null); val.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)effect; val.m_itemData.m_shared.m_setName = effectName; val.m_itemData.m_shared.m_setSize = GetSetSize(); } }); } public int GetSetSize() { int num = 0; foreach (ArmorConfig value in items.Values) { if (value.countsTowardsSetBonus) { num++; } } return num; } } public class ItemConfig { [YamlMember(Alias = "noble's armor")] public Noble noble = new Noble(); [YamlMember(Alias = "barbarian's armor")] public Barbarian barbarian = new Barbarian(); [YamlMember(Alias = "warrior's armor")] public Warrior warrior = new Warrior(); [YamlMember(Alias = "plate armor")] public Plate plate = new Plate(); [YamlMember(Alias = "dragonslayer's armor")] public Dragonslayer dragonslayer = new Dragonslayer(); [YamlMember(Alias = "wanderer's armor")] public Wanderer wanderer = new Wanderer(); [YamlMember(Alias = "nomad's armor")] public Nomad nomad = new Nomad(); [YamlMember(Alias = "serpent armor")] public Serpent serpent = new Serpent(); [YamlMember(Alias = "scorched armor")] public Scorched scorched = new Scorched(); [YamlMember(Alias = "simple backpack")] public SimpleBackpack simpleBackpack = new SimpleBackpack(); [YamlMember(Alias = "heavy backpack")] public HeavyBackpack heavyBackpack = new HeavyBackpack(); [YamlIgnore] private List<ArmorSetConfig> Sets => new List<ArmorSetConfig> { noble, barbarian, warrior, plate, dragonslayer, wanderer, nomad, serpent, scorched, simpleBackpack, heavyBackpack }; public void ApplyArmorConfigs() { Sets.ForEach(delegate(ArmorSetConfig set) { set.ApplyArmorConfigs(); }); } public void ApplyRecipeConfigs() { Sets.ForEach(delegate(ArmorSetConfig set) { set.ApplyRecipeConfigs(); }); } public void ApplySetEffects() { Sets.ForEach(delegate(ArmorSetConfig set) { set.ApplySetConfig(set.items.Values.First().prefabName); }); } } public class PrefabConfig { public GameObject prefab; public bool replaceMat = true; public GameObject GetPrefab() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Invalid comparison between Unknown and I4 if ((Object)(object)prefab == (Object)null) { Main.log.LogWarning((object)"prefab null"); return null; } prefab.layer = 12; ItemDrop component = prefab.GetComponent<ItemDrop>(); SharedData shared = component.m_itemData.m_shared; prefab.layer = 12; string name = "$" + ((Object)prefab).name; string description = "$" + ((Object)prefab).name + "_description"; shared.m_name = name; shared.m_description = description; if (replaceMat) { ReplaceMaterials(); } if (!Main.hugosCollidersAvaiable && (int)component.m_itemData.m_shared.m_itemType != 17) { prefab.GetComponentsInChildren<Cloth>(true).ToList().ForEach(delegate(Cloth cloth) { Object.Destroy((Object)(object)cloth); }); } return prefab; } public void ReplaceMaterials() { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null || (Object)(object)Main.creatureShader == (Object)null) { return; } List<Renderer> list = new List<Renderer>(); list.AddRange((IEnumerable<Renderer>)(object)prefab.GetComponentsInChildren<MeshRenderer>(true)); list.AddRange((IEnumerable<Renderer>)(object)prefab.GetComponentsInChildren<SkinnedMeshRenderer>(true)); foreach (Renderer item in list) { List<Material> list2 = new List<Material>(); int num = 0; Material[] materials = item.materials; foreach (Material mat in materials) { string[] source = new string[4] { "_MainTex", "_BumpMap", "_MetallicGlossMap", "_EmissionMap" }; string[] array = new string[1] { "_BumpMap" }; Material replacerMat = new Material(Main.creatureShader); replacerMat.SetFloat("_Cull", 0f); replacerMat.SetFloat("_AddRain", 1f); replacerMat.SetFloat("_Glossiness", 0f); int num2 = (((Object)(object)mat.GetTexture("_MetallicGlossMap") != (Object)null) ? 1 : 0); replacerMat.SetFloat("_Metallic", (float)num2); replacerMat.SetFloat("_MetalGloss", mat.GetFloat("_GlossMapScale")); replacerMat.SetFloat("_TwoSidedNormals", 1f); Color val = mat.GetColor("_Color"); Color val2 = mat.GetColor("_EmissionColor"); if (Main.neutralMetals.Value) { val = Color.grey; val2 = Color.black; } else if (ItemManager.colorConfig.ContainsKey(((Object)prefab).name)) { string key = "Color " + (num + 1); if (ItemManager.colorConfig[((Object)prefab).name].ContainsKey(key)) { ColorUtility.TryParseHtmlString(ItemManager.colorConfig[((Object)prefab).name][key], ref val); } if (ItemManager.colorConfig[((Object)prefab).name].ContainsKey("Emission color")) { ColorUtility.TryParseHtmlString(ItemManager.colorConfig[((Object)prefab).name]["Emission color"], ref val2); } } replacerMat.SetColor("_Color", Color.white); replacerMat.SetColor("_MetalColor", val); replacerMat.SetColor("_EmissionColor", val2); replacerMat.EnableKeyword("_ADDRAIN_ON"); replacerMat.EnableKeyword("_TWOSIDEDNORMALS_ON"); source.ToList().ForEach(delegate(string tex) { Texture texture = mat.GetTexture(tex); if ((Object)(object)texture != (Object)null && Main.smoothTextures.Value) { texture.filterMode = (FilterMode)1; } replacerMat.SetTexture(tex, texture); }); list2.Add(replacerMat); num++; } item.materials = list2.ToArray(); } replaceMat = false; } } public class RecipeConfig { public class RequirementConfig { [YamlMember(Alias = "item")] public string item; [YamlMember(Alias = "amount")] public int amount = 0; [YamlMember(Alias = "amount per level")] public int amountPerLevel = 0; public Requirement GetRequirement() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Requirement val = new Requirement(); GameObject? obj = ObjectDB.instance.m_items.Find((GameObject _item) => ((Object)_item).name == item); val.m_resItem = ((obj != null) ? obj.GetComponent<ItemDrop>() : null); if ((Object)(object)val.m_resItem == (Object)null) { return null; } val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; val.m_recover = true; return val; } } [YamlMember(Alias = "enabled")] public bool enabled = true; [YamlIgnore] public int amount = 1; [YamlMember(Alias = "station")] public string station = string.Empty; [YamlMember(Alias = "minimum station level")] public int minimumStationLevel = 1; [YamlMember(Alias = "requirements")] public List<RequirementConfig> requirements = new List<RequirementConfig>(); public void ApplyConfig(string prefabName) { bool flag = false; string recipeName = prefabName + "_recipe"; if ((Object)(object)ObjectDB.instance == (Object)null || (Object)(object)ZNetScene.instance == (Object)null || !enabled) { return; } Recipe val = ObjectDB.instance.m_recipes?.Find((Recipe _recipe) => ((Object)_recipe).name == recipeName); if ((Object)(object)val == (Object)null) { flag = true; } PrefabConfig? prefabConfig = ItemManager.prefabs.Find((PrefabConfig _prefab) => ((Object)_prefab.GetPrefab()).name == prefabName); object obj; if (prefabConfig == null) { obj = null; } else { GameObject prefab = prefabConfig.GetPrefab(); obj = ((prefab != null) ? prefab.GetComponent<ItemDrop>() : null); } ItemDrop val2 = (ItemDrop)obj; if ((Object)(object)val2 == (Object)null) { return; } if (flag) { val = ScriptableObject.CreateInstance<Recipe>(); ((Object)val).name = recipeName; ObjectDB.instance.m_recipes.Add(val); } val.m_enabled = enabled; val.m_item = val2; val.m_amount = amount; Recipe obj2 = val; GameObject prefab2 = ZNetScene.instance.GetPrefab(station); obj2.m_craftingStation = ((prefab2 != null) ? prefab2.GetComponent<CraftingStation>() : null); val.m_repairStation = val.m_craftingStation; val.m_minStationLevel = minimumStationLevel; List<Requirement> resolvedRequirements = new List<Requirement>(); requirements.ForEach(delegate(RequirementConfig reqCfg) { Requirement requirement = reqCfg.GetRequirement(); if (requirement != null) { resolvedRequirements.Add(requirement); } }); val.m_resources = resolvedRequirements.ToArray(); } } public class SetEffect { [YamlMember(Alias = "health regen modifier")] public int healthRegenModifier = 0; [YamlMember(Alias = "stamina regen modifier")] public int staminaReregenModifier = 0; [YamlMember(Alias = "run stamina drain modifier")] public int runStaminaDrainModifier = 0; [YamlMember(Alias = "jump stamina drain modifier")] public int jumpStaminaDrainModifier = 0; [YamlMember(Alias = "carry weight modifier")] public int carryWeightModifier = 0; [YamlMember(Alias = "skill modifier")] public SkillModifier skillModifier = new SkillModifier(); [YamlMember(Alias = "damage modifiers")] public Dictionary<string, string> damageModifiers; public SetEffect() { //IL_0036: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, string> dictionary = new Dictionary<string, string>(); DamageType val = (DamageType)1; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)2; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)4; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)8; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)32; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)64; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)128; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)256; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)512; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); damageModifiers = dictionary; base..ctor(); } } public class SkillModifier { public string skill = "None"; public int modifier = 0; } public class ArmorConfig { [YamlMember(Alias = "item prefab name")] public string prefabName = string.Empty; [YamlMember(Alias = "required for set bonus")] public bool countsTowardsSetBonus = true; public int armor = 0; [YamlMember(Alias = "armor per level")] public int armorPerLevel = 2; [YamlMember(Alias = "enable durability")] public bool enableDurability = true; public int baseDurability = 1000; [YamlMember(Alias = "durability per level")] public int durabilityPerLevel = 200; public bool repairable = true; [YamlMember(Alias = "destroy when broken")] public bool destroyBroken = false; public int weight = 0; public bool teleportable = true; [YamlMember(Alias = "maximum upgrade level")] public int maxUpgradeLevel = 4; [YamlMember(Alias = "movement speed modifier")] public int movementSpeedModifier = 0; [YamlMember(Alias = "damage modifiers")] public Dictionary<string, string> damageModifiers; [YamlMember(Alias = "recipe")] public RecipeConfig recipe; public void ApplyConfig() { PrefabConfig? prefabConfig = ItemManager.prefabs.Find((PrefabConfig prefab) => ((Object)prefab.GetPrefab()).name == prefabName); object obj; if (prefabConfig == null) { obj = null; } else { GameObject prefab2 = prefabConfig.GetPrefab(); obj = ((prefab2 != null) ? prefab2.GetComponent<ItemDrop>().m_itemData.m_shared : null); } SharedData val = (SharedData)obj; if (val != null) { val.m_weight = weight; val.m_armor = armor; val.m_armorPerLevel = armorPerLevel; val.m_damageModifiers = ParseModPairs(damageModifiers); val.m_maxDurability = baseDurability; val.m_durabilityPerLevel = durabilityPerLevel; val.m_destroyBroken = destroyBroken; val.m_canBeReparied = repairable; val.m_movementModifier = (float)movementSpeedModifier / 100f; val.m_equipDuration = 1f; val.m_maxQuality = maxUpgradeLevel; val.m_useDurability = enableDurability; } } public static List<DamageModPair> ParseModPairs(Dictionary<string, string> mods) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) List<DamageModPair> list = new List<DamageModPair>(); foreach (KeyValuePair<string, string> mod in mods) { if (!(mod.Value.ToLower() == "none")) { DamageType type = (DamageType)Enum.Parse(typeof(DamageType), mod.Key); DamageModifier modifier = (DamageModifier)Enum.Parse(typeof(DamageModifier), mod.Value); list.Add(new DamageModPair { m_type = type, m_modifier = modifier }); } } return list; } public ArmorConfig() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, string> dictionary = new Dictionary<string, string>(); DamageType val = (DamageType)1; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)2; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)4; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)8; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)32; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)64; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)128; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)256; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); val = (DamageType)512; dictionary.Add(((object)(DamageType)(ref val)).ToString(), "none"); damageModifiers = dictionary; recipe = new RecipeConfig(); base..ctor(); } } public class BlacksmithsToolsConfig { public string itemName; public int[] bonesToHide; } } namespace JudesEquipment.ArmorSets { public class Barbarian : ArmorSetConfig { public Barbarian() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { staminaReregenModifier = 25 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)7; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 25; obj.skillModifier = skillModifier; setEffect = obj; int armor = 4; int weight = 10; ArmorConfig value = new ArmorConfig { prefabName = "ArmorBarbarianBronzeHelmetJD", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 2, amountPerLevel = 0 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorBarbarianBronzeChestJD", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 2, amountPerLevel = 0 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorBarbarianBronzeLegsJD", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 2, amountPerLevel = 0 } } } }; ArmorConfig value4 = new ArmorConfig { prefabName = "ArmorBarbarianCapeJD", armor = 4, weight = 6, movementSpeedModifier = -3, countsTowardsSetBonus = false, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 8, amountPerLevel = 4 }, new RecipeConfig.RequirementConfig { item = "Bronze", amount = 1, amountPerLevel = 1 }, new RecipeConfig.RequirementConfig { item = "BoneFragments", amount = 5, amountPerLevel = 3 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); items.Add("cape", value4); } } public class Dragonslayer : ArmorSetConfig { public Dragonslayer() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { jumpStaminaDrainModifier = -25 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)100; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 30; obj.skillModifier = skillModifier; setEffect = obj; Dictionary<string, string> damageModifiers = setEffect.damageModifiers; DamageType val2 = (DamageType)64; string? key = ((object)(DamageType)(ref val2)).ToString(); DamageModifier val3 = (DamageModifier)1; damageModifiers[key] = ((object)(DamageModifier)(ref val3)).ToString(); int armor = 24; int weight = 20; int movementSpeedModifier = -5; ArmorConfig value = new ArmorConfig { prefabName = "ArmorDragonslayerHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Silver", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "WolfPelt", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "Obsidian", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "TrophyHatchling", amount = 2, amountPerLevel = 0 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorDragonslayerChest", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Silver", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "WolfPelt", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "Obsidian", amount = 10, amountPerLevel = 3 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorDragonslayerLegs", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Silver", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "WolfPelt", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "Obsidian", amount = 10, amountPerLevel = 3 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); } } public class HeavyBackpack : ArmorSetConfig { public HeavyBackpack() { setEffect = new SetEffect { carryWeightModifier = 200 }; ArmorConfig value = new ArmorConfig { prefabName = "BackpackHeavy", armor = 0, weight = 30, movementSpeedModifier = -5, baseDurability = 100, durabilityPerLevel = 100, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Wood", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "IronNails", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Iron", amount = 2, amountPerLevel = 1 } } } }; items.Add("backpack", value); } } public class Noble : ArmorSetConfig { public Noble() { setEffect = new SetEffect { staminaReregenModifier = 5, healthRegenModifier = 5, runStaminaDrainModifier = -5 }; int armor = 1; int weight = 5; string station = "piece_workbench"; string item = "LeatherScraps"; int amount = 5; int amountPerLevel = 1; string item2 = "DeerHide"; int amount2 = 2; int amountPerLevel2 = 1; ArmorConfig value = new ArmorConfig { prefabName = "ArmorNobleHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = station, requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = item, amount = amount, amountPerLevel = amountPerLevel }, new RecipeConfig.RequirementConfig { item = item2, amount = amount2, amountPerLevel = amountPerLevel2 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorNobleChest", armor = armor, weight = weight, recipe = new RecipeConfig { station = station, requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = item, amount = amount, amountPerLevel = amountPerLevel }, new RecipeConfig.RequirementConfig { item = item2, amount = amount2, amountPerLevel = amountPerLevel2 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorNobleLegs", armor = armor, weight = weight, recipe = new RecipeConfig { station = station, requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = item, amount = amount, amountPerLevel = amountPerLevel }, new RecipeConfig.RequirementConfig { item = item2, amount = amount2, amountPerLevel = amountPerLevel2 } } } }; ArmorConfig value4 = new ArmorConfig { prefabName = "ArmorNobleCape", armor = 1, weight = 1, countsTowardsSetBonus = false, recipe = new RecipeConfig { station = station, requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = item, amount = amount, amountPerLevel = amountPerLevel } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); items.Add("cape", value4); } } public class Nomad : ArmorSetConfig { public Nomad() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { runStaminaDrainModifier = -15 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)102; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 25; obj.skillModifier = skillModifier; setEffect = obj; Dictionary<string, string> damageModifiers = setEffect.damageModifiers; DamageType val2 = (DamageType)64; string key = ((object)(DamageType)(ref val2)).ToString().ToString(); DamageModifier val3 = (DamageModifier)1; damageModifiers[key] = ((object)(DamageModifier)(ref val3)).ToString(); int armor = 20; int weight = 10; ArmorConfig value = new ArmorConfig { prefabName = "ArmorBlackmetalgarbHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 5 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorBlackmetalgarbChest", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 5 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorBlackmetalgarbLegs", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 5 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); } } public class Plate : ArmorSetConfig { public Plate() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { healthRegenModifier = 10 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)6; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 20; obj.skillModifier = skillModifier; setEffect = obj; int armor = 18; int weight = 20; int movementSpeedModifier = -5; ArmorConfig value = new ArmorConfig { prefabName = "ArmorPlateIronHelmetJD", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Iron", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 5, amountPerLevel = 1 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorPlateIronChestJD", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Iron", amount = 25, amountPerLevel = 8 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 5, amountPerLevel = 1 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorPlateIronLegsJD", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Iron", amount = 25, amountPerLevel = 8 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 5, amountPerLevel = 1 } } } }; ArmorConfig value4 = new ArmorConfig { prefabName = "ArmorPlateCape", armor = 4, weight = 8, movementSpeedModifier = -3, countsTowardsSetBonus = false, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "TrophyBoar", amount = 3, amountPerLevel = 1 }, new RecipeConfig.RequirementConfig { item = "Iron", amount = 2, amountPerLevel = 1 }, new RecipeConfig.RequirementConfig { item = "LeatherScraps", amount = 10, amountPerLevel = 5 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); items.Add("cape", value4); } } public class Scorched : ArmorSetConfig { public Scorched() { //IL_001e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { healthRegenModifier = 10 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)1; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 15; obj.skillModifier = skillModifier; setEffect = obj; Dictionary<string, string> damageModifiers = setEffect.damageModifiers; DamageType val2 = (DamageType)32; string? key = ((object)(DamageType)(ref val2)).ToString(); DamageModifier val3 = (DamageModifier)1; damageModifiers[key] = ((object)(DamageModifier)(ref val3)).ToString(); Dictionary<string, string> damageModifiers2 = setEffect.damageModifiers; val2 = (DamageType)64; string? key2 = ((object)(DamageType)(ref val2)).ToString(); val3 = (DamageModifier)1; damageModifiers2[key2] = ((object)(DamageModifier)(ref val3)).ToString(); int armor = 34; int weight = 20; int movementSpeedModifier = -5; ArmorConfig value = new ArmorConfig { prefabName = "ArmorMistlandsHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Flametal", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 10, amountPerLevel = 3 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorMistlandsChest", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Flametal", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 10, amountPerLevel = 3 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorMistlandsLegs", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Flametal", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 10, amountPerLevel = 3 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); } } public class Serpent : ArmorSetConfig { public Serpent() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { staminaReregenModifier = 15, healthRegenModifier = 15 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)103; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 30; obj.skillModifier = skillModifier; setEffect = obj; int armor = 30; int weight = 20; int movementSpeedModifier = -5; ArmorConfig value = new ArmorConfig { prefabName = "ArmorSerpentHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Silver", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 10, amountPerLevel = 2 }, new RecipeConfig.RequirementConfig { item = "TrophySerpent", amount = 2, amountPerLevel = 0 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorSerpentChest", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Silver", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 5, amountPerLevel = 2 }, new RecipeConfig.RequirementConfig { item = "SerpentScale", amount = 5, amountPerLevel = 2 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorSerpentLegs", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "BlackMetal", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Silver", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LoxPelt", amount = 5, amountPerLevel = 2 }, new RecipeConfig.RequirementConfig { item = "SerpentScale", amount = 5, amountPerLevel = 2 } } } }; ArmorConfig armorConfig = new ArmorConfig { prefabName = "ArmorSerpentCape", armor = 3, weight = 6, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Silver", amount = 5, amountPerLevel = 1 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 5 } } } }; Dictionary<string, string> damageModifiers = armorConfig.damageModifiers; DamageType val2 = (DamageType)64; string? key = ((object)(DamageType)(ref val2)).ToString(); DamageModifier val3 = (DamageModifier)1; damageModifiers[key] = ((object)(DamageModifier)(ref val3)).ToString(); items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); items.Add("cape", armorConfig); } } public class SimpleBackpack : ArmorSetConfig { public SimpleBackpack() { setEffect = new SetEffect { carryWeightModifier = 100 }; ArmorConfig value = new ArmorConfig { prefabName = "BackpackSimple", armor = 0, weight = 15, movementSpeedModifier = -5, baseDurability = 10, durabilityPerLevel = 10, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Wood", amount = 20, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 5, amountPerLevel = 2 }, new RecipeConfig.RequirementConfig { item = "LeatherScraps", amount = 10, amountPerLevel = 5 } } } }; items.Add("backpack", value); } } public class Wanderer : ArmorSetConfig { public Wanderer() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { staminaReregenModifier = 15, carryWeightModifier = 50 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)1; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 15; obj.skillModifier = skillModifier; setEffect = obj; int armor = 22; int weight = 10; int movementSpeedModifier = -3; ArmorConfig value = new ArmorConfig { prefabName = "ArmorWandererHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Flax", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Iron", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 10, amountPerLevel = 3 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorWandererChest", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Iron", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 10 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorWandererLegs", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Iron", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 20, amountPerLevel = 10 } } } }; ArmorConfig value4 = new ArmorConfig { prefabName = "ArmorWandererCape", armor = 2, weight = 5, countsTowardsSetBonus = false, recipe = new RecipeConfig { station = "piece_workbench", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Flax", amount = 15, amountPerLevel = 5 }, new RecipeConfig.RequirementConfig { item = "Iron", amount = 10, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "LinenThread", amount = 10, amountPerLevel = 3 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); items.Add("cape", value4); } } public class Warrior : ArmorSetConfig { public Warrior() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) SetEffect obj = new SetEffect { healthRegenModifier = 10 }; SkillModifier skillModifier = new SkillModifier(); SkillType val = (SkillType)4; skillModifier.skill = ((object)(SkillType)(ref val)).ToString(); skillModifier.modifier = 15; obj.skillModifier = skillModifier; setEffect = obj; Dictionary<string, string> damageModifiers = setEffect.damageModifiers; DamageType val2 = (DamageType)2; string? key = ((object)(DamageType)(ref val2)).ToString(); DamageModifier val3 = (DamageModifier)1; damageModifiers[key] = ((object)(DamageModifier)(ref val3)).ToString(); int armor = 6; int weight = 15; int movementSpeedModifier = -5; ArmorConfig value = new ArmorConfig { prefabName = "ArmorWarriorHelmet", armor = armor, weight = weight, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 3, amountPerLevel = 1 } } } }; ArmorConfig value2 = new ArmorConfig { prefabName = "ArmorWarriorChest", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 3, amountPerLevel = 1 }, new RecipeConfig.RequirementConfig { item = "Stone", amount = 20, amountPerLevel = 0 }, new RecipeConfig.RequirementConfig { item = "Raspberry", amount = 20, amountPerLevel = 0 } } } }; ArmorConfig value3 = new ArmorConfig { prefabName = "ArmorWarriorLegs", armor = armor, weight = weight, movementSpeedModifier = movementSpeedModifier, recipe = new RecipeConfig { station = "forge", requirements = new List<RecipeConfig.RequirementConfig> { new RecipeConfig.RequirementConfig { item = "Bronze", amount = 5, amountPerLevel = 3 }, new RecipeConfig.RequirementConfig { item = "DeerHide", amount = 3, amountPerLevel = 1 } } } }; items.Add("helmet", value); items.Add("chest", value2); items.Add("legs", value3); } } } namespace Microsoft.CodeAnalysis { [<dafe624b-e986-44b1-9933-97c373e6384a>Embedded] [CompilerGenerated] internal sealed class <dafe624b-e986-44b1-9933-97c373e6384a>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [CompilerGenerated] [<dafe624b-e986-44b1-9933-97c373e6384a>Embedded] internal sealed class <7135523d-d1fb-40bf-ad07-d869d9e91c59>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <7135523d-d1fb-40bf-ad07-d869d9e91c59>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <7135523d-d1fb-40bf-ad07-d869d9e91c59>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<dafe624b-e986-44b1-9933-97c373e6384a>Embedded] internal sealed class <effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContextAttribute : Attribute { public readonly byte Flag; public <effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContextAttribute(byte P_0) { Flag = P_0; } } [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [<dafe624b-e986-44b1-9933-97c373e6384a>Embedded] [CompilerGenerated] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServerSync { [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] [PublicAPI] internal abstract class OwnConfigEntryBase { [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(2)] public object LocalBaseValue; public bool SynchronizedConfig = true; public abstract ConfigEntryBase BaseConfig { get; } } [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] [PublicAPI] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] internal class SyncedConfigEntry<[<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(2)] T> : OwnConfigEntryBase { public readonly ConfigEntry<T> SourceConfig; public override ConfigEntryBase BaseConfig => (ConfigEntryBase)(object)SourceConfig; public T Value { get { return SourceConfig.Value; } set { SourceConfig.Value = value; } } public SyncedConfigEntry(ConfigEntry<T> sourceConfig) { SourceConfig = sourceConfig; } public void AssignLocalValue(T value) { if (LocalBaseValue == null) { Value = value; } else { LocalBaseValue = value; } } } [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(2)] internal abstract class CustomSyncedValueBase { public object LocalBaseValue; [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(1)] public readonly string Identifier; [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(1)] public readonly Type Type; private object boxedValue; protected bool localIsOwner; public readonly int Priority; public object BoxedValue { get { return boxedValue; } set { boxedValue = value; this.ValueChanged?.Invoke(); } } public event Action ValueChanged; [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] protected CustomSyncedValueBase(ConfigSync configSync, string identifier, Type type, int priority) { Priority = priority; Identifier = identifier; Type = type; configSync.AddCustomValue(this); localIsOwner = configSync.IsSourceOfTruth; configSync.SourceOfTruthChanged += delegate(bool truth) { localIsOwner = truth; }; } } [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] [PublicAPI] internal sealed class CustomSyncedValue<[<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(2)] T> : CustomSyncedValueBase { public T Value { get { return (T)base.BoxedValue; } set { base.BoxedValue = value; } } public CustomSyncedValue(ConfigSync configSync, string identifier, T value = default(T), int priority = 0) : base(configSync, identifier, typeof(T), priority) { Value = value; } public void AssignLocalValue(T value) { if (localIsOwner) { Value = value; } else { LocalBaseValue = value; } } } internal class ConfigurationManagerAttributes { [UsedImplicitly] public bool? ReadOnly = false; } [PublicAPI] [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] internal class ConfigSync { [HarmonyPatch(typeof(ZRpc), "HandlePackage")] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(0)] private static class SnatchCurrentlyHandlingRPC { [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(2)] public static ZRpc currentRpc; [HarmonyPrefix] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] private static void Prefix(ZRpc __instance) { currentRpc = __instance; } } [HarmonyPatch(typeof(ZNet), "Awake")] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(0)] internal static class RegisterRPCPatch { [HarmonyPostfix] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] private static void Postfix(ZNet __instance) { isServer = __instance.IsServer(); foreach (ConfigSync configSync2 in configSyncs) { ZRoutedRpc.instance.Register<ZPackage>(configSync2.Name + " ConfigSync", (Action<long, ZPackage>)configSync2.RPC_FromOtherClientConfigSync); if (isServer) { configSync2.InitialSyncDone = true; Debug.Log((object)("Registered '" + configSync2.Name + " ConfigSync' RPC - waiting for incoming connections")); } } if (isServer) { ((MonoBehaviour)__instance).StartCoroutine(WatchAdminListChanges()); } [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] static void SendAdmin(List<ZNetPeer> peers, bool isAdmin) { ZPackage package = ConfigsToPackage(null, null, new PackageEntry[1] { new PackageEntry { section = "Internal", key = "lockexempt", type = typeof(bool), value = isAdmin } }); ConfigSync configSync = configSyncs.First(); if (configSync != null) { ((MonoBehaviour)ZNet.instance).StartCoroutine(configSync.sendZPackage(peers, package)); } } [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] static IEnumerator WatchAdminListChanges() { SyncedList adminList = (SyncedList)AccessTools.DeclaredField(typeof(ZNet), "m_adminList").GetValue(ZNet.instance); List<string> CurrentList = new List<string>(adminList.GetList()); while (true) { yield return (object)new WaitForSeconds(30f); if (!adminList.GetList().SequenceEqual(CurrentList)) { CurrentList = new List<string>(adminList.GetList()); List<ZNetPeer> adminPeer = (from p in ZNet.instance.GetPeers() where adminList.Contains(p.m_rpc.GetSocket().GetHostName()) select p).ToList(); List<ZNetPeer> nonAdminPeer = ZNet.instance.GetPeers().Except(adminPeer).ToList(); SendAdmin(nonAdminPeer, isAdmin: false); SendAdmin(adminPeer, isAdmin: true); } } } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(0)] private static class RegisterClientRPCPatch { [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(1)] [HarmonyPostfix] private static void Postfix(ZNet __instance, ZNetPeer peer) { if (__instance.IsServer()) { return; } foreach (ConfigSync configSync in configSyncs) { peer.m_rpc.Register<ZPackage>(configSync.Name + " ConfigSync", (Action<ZRpc, ZPackage>)configSync.RPC_FromServerConfigSync); } } } [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(0)] private class ParsedConfigs { [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(new byte[] { 1, 1, 2 })] public readonly Dictionary<OwnConfigEntryBase, object> configValues = new Dictionary<OwnConfigEntryBase, object>(); [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(new byte[] { 1, 1, 2 })] public readonly Dictionary<CustomSyncedValueBase, object> customValues = new Dictionary<CustomSyncedValueBase, object>(); } [HarmonyPatch(typeof(ZNet), "Shutdown")] [<effafb53-ba55-46f7-8795-cb5d32cec3d8>NullableContext(0)] private class ResetConfigsOnShutdown { [HarmonyPostfix] private static void Postfix() { ProcessingServerUpdate = true; foreach (ConfigSync configSync in configSyncs) { configSync.resetConfigsFromServer(); configSync.IsSourceOfTruth = true; configSync.InitialSyncDone = false; } ProcessingServerUpdate = false; } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] private class SendConfigsAfterLogin { [<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(0)] private class BufferingSocket : ISocket { public volatile bool finished = false; public volatile int versionMatchQueued = -1; public readonly List<ZPackage> Package = new List<ZPackage>(); public readonly ISocket Original; public BufferingSocket(ISocket original) { Original = original; } public bool IsConnected() { return Original.IsConnected(); } public ZPackage Recv() { return Original.Recv(); } public int GetSendQueueSize() { return Original.GetSendQueueSize(); } public int GetCurrentSendRate() { return Original.GetCurrentSendRate(); } public bool IsHost() { return Original.IsHost(); } public void Dispose() { Original.Dispose(); } public bool GotNewData() { return Original.GotNewData(); } public void Close() { Original.Close(); } public string GetEndPointString() { return Original.GetEndPointString(); } public void GetAndResetStats(out int totalSent, out int totalRecv) { Original.GetAndResetStats(ref totalSent, ref totalRecv); } public void GetConnectionQuality(out float localQuality, out float remoteQuality, out int ping, out float outByteSec, out float inByteSec) { Original.GetConnectionQuality(ref localQuality, ref remoteQuality, ref ping, ref outByteSec, ref inByteSec); } public ISocket Accept() { return Original.Accept(); } public int GetHostPort() { return Original.GetHostPort(); } public bool Flush() { return Original.Flush(); } public string GetHostName() { return Original.GetHostName(); } public void VersionMatch() { if (finished) { Original.VersionMatch(); } else { versionMatchQueued = Package.Count; } } public void Send(ZPackage pkg) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown int pos = pkg.GetPos(); pkg.SetPos(0); int num = pkg.ReadInt(); if ((num == StringExtensionMethods.GetStableHashCode("PeerInfo") || num == StringExtensionMethods.GetStableHashCode("RoutedRPC") || num == StringExtensionMethods.GetStableHashCode("ZDOData")) && !finished) { ZPackage val = new ZPackage(pkg.GetArray()); val.SetPos(pos); Package.Add(val); } else { pkg.SetPos(pos); Original.Send(pkg); } } } [HarmonyPrefix] [HarmonyPriority(800)] private static void Prefix([<7135523d-d1fb-40bf-ad07-d869d9e91c59>Nullable(new byte[] { 2, 1, 1 })] ref Dictionary<Assembly, BufferingSocket> __state, ZNet __instance, ZRpc rpc) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (__instance.IsServer()) { BufferingSocket value = new BufferingSocket(rpc.GetSocket()); AccessTools.DeclaredField(typeof(ZRpc), "m_socket").SetValue(rpc, value); object? obj = AccessTools.DeclaredMethod(typeof(ZNet), "GetPeer", new Type[1] { typeof(ZRpc) }, (Type[])null).Invoke(__instance, new object[1] { rpc }); ZNetPeer val = (ZNetPeer)((obj is ZNetPeer) ? obj : null); if (val != null && (int)ZNet.m_onlineBackend > 0) { AccessTools.DeclaredField(typeof(ZNetPeer), "m_socket").SetValue(val, value); } if (__state == null) { __state = new Dictionary<Assembly, BufferingSocket>(); } __state[Assembly.GetExecutingAssembly()] = value; } } [HarmonyPostfix] private static void Postfix(Dictionary<Assembly, BufferingSocket> __state, ZNet __instance, ZRpc rpc) { ZNetPeer peer; if (__instance.IsServer()) { object obj = AccessTools.DeclaredMethod(typeof(ZNet), "GetPeer", new Type[1] { typeof(ZRpc) }, (Type[])null).Invoke(__instance, new object[1] { rpc }); peer = (ZNetPeer)((obj is ZNetPeer) ? obj : null); if (peer == null) { SendBufferedData();