Decompiled source of Takers Underworld v2.0.0
BepInEx/plugins/cjayride-CustomLoadingScreens/CustomLoadingScreens.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.8.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyVersion("0.8.0.0")] namespace CustomLoadingScreens; [BepInPlugin("cjayride.CustomLoadingScreens", "Custom Loading Screens", "0.8.0")] public class BepInExPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(FejdStartup), "LoadMainScene")] public static class LoadMainScene_Patch { public static void Prefix(FejdStartup __instance) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) loadingSprite = GetRandomLoadingScreen(); if (differentSpawnScreen.Value) { loadingSprite2 = GetRandomLoadingScreen(); } if (loadingTips.Any()) { loadingTip = loadingTips[Random.Range(0, loadingTips.Length)]; if (differentSpawnTip.Value) { loadingTip2 = loadingTips[Random.Range(0, loadingTips.Length)]; } } Image val = Object.Instantiate<Image>(((Component)__instance.m_loading.transform.Find("Bkg")).GetComponent<Image>(), __instance.m_loading.transform); if (!((Object)(object)val == (Object)null)) { val.sprite = loadingSprite; ((Graphic)val).color = loadingColorMask.Value; val.type = (Type)0; val.preserveAspect = true; } } } [HarmonyPriority(800)] [HarmonyPatch(typeof(ZNet), "RPC_ClientHandshake")] public static class ZNet_RPC_ClientHandshake_Patch { public static bool Prefix(ZNet __instance, ZRpc rpc, bool needPassword) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsServer()) { Image val = Object.Instantiate<Image>(((Component)((Component)Hud.instance).transform.Find("LoadingBlack").Find("Bkg")).GetComponent<Image>(), ((Component)((Component)Hud.instance).transform.Find("LoadingBlack")).transform); if ((Object)(object)val == (Object)null) { return true; } val.sprite = loadingSprite; ((Graphic)val).color = loadingColorMask.Value; val.type = (Type)0; val.preserveAspect = true; if (loadingTips.Any()) { Object.Instantiate<Transform>(Hud.instance.m_loadingTip.transform.parent.Find("panel_separator"), ((Component)((Component)Hud.instance).transform.Find("LoadingBlack")).transform); TMP_Text component = Object.Instantiate<GameObject>(((Component)Hud.instance.m_loadingTip).gameObject, ((Component)((Component)Hud.instance).transform.Find("LoadingBlack")).transform).GetComponent<TMP_Text>(); if ((Object)(object)component != (Object)null) { component.text = loadingTip; ((Graphic)component).color = tipTextColor.Value; } } } return true; } } [HarmonyPatch(typeof(Hud), "UpdateBlackScreen")] public static class UpdateBlackScreen_Patch { public static void Prefix(Hud __instance, bool ___m_haveSetupLoadScreen, ref bool __state) { __state = !___m_haveSetupLoadScreen; } public static void Postfix(Hud __instance, bool ___m_haveSetupLoadScreen, ref bool __state) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (__state && ___m_haveSetupLoadScreen) { __instance.m_loadingImage.sprite = (differentSpawnScreen.Value ? loadingSprite2 : loadingSprite); ((Graphic)__instance.m_loadingImage).color = spawnColorMask.Value; if (loadingTips.Any()) { __instance.m_loadingTip.text = (differentSpawnTip.Value ? loadingTip2 : loadingTip); } ((Graphic)__instance.m_loadingTip).color = tipTextColor.Value; if (removeVignette.Value) { ((Component)__instance.m_loadingProgress.transform.Find("TopFade")).gameObject.SetActive(false); ((Component)__instance.m_loadingProgress.transform.Find("BottomFade")).gameObject.SetActive(false); ((Component)__instance.m_loadingProgress.transform.Find("text_darken")).gameObject.SetActive(false); } } } } private static readonly bool isDebug = true; private static BepInExPlugin context; public static ConfigEntry<bool> modEnabled; public static ConfigEntry<string> loadingText; public static ConfigEntry<bool> differentSpawnScreen; public static ConfigEntry<bool> differentSpawnTip; public static ConfigEntry<bool> showTipsOnLoadingScreen; public static ConfigEntry<bool> removeVignette; public static ConfigEntry<Color> spawnColorMask; public static ConfigEntry<Color> loadingColorMask; public static ConfigEntry<Color> loadingTextColor; public static ConfigEntry<Color> tipTextColor; public static List<string> loadingScreens = new List<string>(); public static Dictionary<string, string> loadingScreens2 = new Dictionary<string, string>(); public static Dictionary<string, DateTime> fileWriteTimes = new Dictionary<string, DateTime>(); public static List<string> screensToLoad = new List<string>(); public static string[] loadingTips = new string[0]; public static Dictionary<string, Texture2D> cachedScreens = new Dictionary<string, Texture2D>(); private static Sprite loadingSprite; private static Sprite loadingSprite2; private static string loadingTip; private static string loadingTip2; public static ConfigEntry<string> imagePath; public static ConfigEntry<string> tipsPath; private void Awake() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) context = this; modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable this mod"); differentSpawnScreen = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DifferentSpawnScreen", true, "Use a different screen for the spawn part"); differentSpawnTip = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DifferentSpawnTip", true, "Use a different tip for the spawn part"); spawnColorMask = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "SpawnColorMask", new Color(0.532f, 0.588f, 0.853f, 1f), "Change the color mask of the spawn screen (set last number to 0 to disable)"); loadingColorMask = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "LoadingColorMask", Color.white, "Change the color mask of the initial loading screen (set to white to disable)"); removeVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RemoveMask", true, "Remove dark edges for the spawn part"); loadingText = ((BaseUnityPlugin)this).Config.Bind<string>("General", "LoadingText", "Loading...", "Custom Loading... text"); loadingTextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "LoadingTextColor", new Color(1f, 0.641f, 0f, 1f), "Custom Loading... text color"); tipTextColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "TipTextColor", Color.white, "Custom tip text color"); imagePath = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PathToImagesFolder", "plugins\\cjayride-CustomLoadingScreens\\CustomLoadingScreens", "Path to image files. Example: config\\CustomLoadingScreens or plugins\\cjayride-CustomLoadingScreens\\CustomLoadingScreens"); tipsPath = ((BaseUnityPlugin)this).Config.Bind<string>("General", "PathToTipsFolder", "plugins\\cjayride-CustomLoadingScreens\\CustomLoadingScreens", "Path to tips file. Example: config\\CustomLoadingScreens or plugins\\cjayride-CustomLoadingScreens\\CustomLoadingScreens"); if (modEnabled.Value) { LoadCustomLoadingScreens(); LoadTips(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } } private void LoadTips() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string directoryName2 = Path.GetDirectoryName(directoryName); string directoryName3 = Path.GetDirectoryName(directoryName2); string path = Path.Combine(directoryName3, tipsPath.Value, "tips.txt"); if (!File.Exists(path)) { File.Create(path); } else { loadingTips = File.ReadAllLines(path); } } private static void LoadCustomLoadingScreens() { loadingScreens.Clear(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string directoryName2 = Path.GetDirectoryName(directoryName); string directoryName3 = Path.GetDirectoryName(directoryName2); string path = Path.Combine(directoryName3, imagePath.Value); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); return; } string[] files = Directory.GetFiles(path, "*.png", SearchOption.AllDirectories); foreach (string item in files) { loadingScreens.Add(item); } } private static Sprite GetRandomLoadingScreen() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!loadingScreens.Any()) { return null; } Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(loadingScreens[Random.Range(0, loadingScreens.Count)]); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero, 1f); } }
BepInEx/plugins/Marsarah-MarsarahMod/MarsarahMod.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MarsarahMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MarsarahMod")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a5ef8741-f8ae-4520-90e7-70f066991530")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MarsarahMod { internal class MMInstantEquipAndEat { [HarmonyPatch(typeof(Player), "QueueEquipAction")] private static class EquipActionSpeed_Patch { private static void Prefix(ItemData item) { if (MMConfigManager.fasterEquipEnabled) { if (item.IsWeapon() && item.m_shared.m_equipDuration > 0f) { item.m_shared.m_equipDuration = 0f; } if (item.IsEquipable() && !item.IsWeapon() && item.m_shared.m_equipDuration > 1f) { item.m_shared.m_equipDuration = 1f; } } } } [HarmonyPatch(typeof(Player), "QueueUnequipAction")] private static class UnequipActionSpeed_Patch { private static void Prefix(ItemData item) { if (MMConfigManager.fasterEquipEnabled) { if (item.IsWeapon() && item.m_shared.m_equipDuration > 0f) { item.m_shared.m_equipDuration = 0f; } if (item.IsEquipable() && !item.IsWeapon() && item.m_shared.m_equipDuration > 1f) { item.m_shared.m_equipDuration = 1f; } } } } [HarmonyPatch(typeof(ZSyncAnimation), "SetTrigger")] private class RemoveEquipAndEatAnimation { private static bool Prefix(ZSyncAnimation __instance, string name) { if (MMConfigManager.fasterEquipEnabled && name == "equip_hip") { return false; } if (MMConfigManager.instantEatAndDrinkEnabled && name == "eat") { return false; } return true; } } } internal class MMArmorStats { [HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })] public class eitrFromMageGear_Patch { public static void Prefix(Player __instance) { if (!((Object)(object)__instance != (Object)null)) { return; } if (MMConfigManager.mageGearGivesEitrEnabled) { eitrFromGear = 0f; Inventory inventory = ((Humanoid)__instance).GetInventory(); List<ItemData> equippedItems = inventory.GetEquippedItems(); foreach (ItemData item in equippedItems) { switch (item.m_shared.m_name) { case "$item_helmet_mage": eitrFromGear += mageHeadEitr; break; case "$item_chest_mage": eitrFromGear += mageChestEitr; break; case "$item_legs_mage": eitrFromGear += mageLegsEitr; break; case "$item_helmet_mage_ashlands": eitrFromGear += mageHeadEitrAshlands; break; case "$item_chest_mage_ashlands": eitrFromGear += mageChestEitrAshlands; break; case "$item_legs_mage_ashlands": eitrFromGear += mageLegsEitrAshlands; break; } } } if (!MMConfigManager.moreArmorStatsEnabled) { return; } hpFromGear = 0f; staminaFromGear = 0f; Inventory inventory2 = ((Humanoid)__instance).GetInventory(); List<ItemData> equippedItems2 = inventory2.GetEquippedItems(); foreach (ItemData item2 in equippedItems2) { switch (item2.m_shared.m_name) { case "$item_helmet_bronze": hpFromGear += bronzeHeadHP; break; case "$item_chest_bronze": hpFromGear += bronzeChestHP; break; case "$item_legs_bronze": hpFromGear += bronzeLegsHP; break; case "$item_helmet_iron": hpFromGear += ironHeadHP; break; case "$item_chest_iron": hpFromGear += ironChestHP; break; case "$item_legs_iron": hpFromGear += ironLegsHP; break; case "$item_helmet_drake": hpFromGear += silverHeadHP; break; case "$item_chest_wolf": hpFromGear += silverChestHP; break; case "$item_legs_wolf": hpFromGear += silverLegsHP; break; case "$item_helmet_padded": hpFromGear += paddedHeadHP; break; case "$item_chest_pcuirass": hpFromGear += paddedChestHP; break; case "$item_legs_pgreaves": hpFromGear += paddedLegsHP; break; case "$item_helmet_carapace": hpFromGear += carapaceHeadHP; break; case "$item_chest_carapace": hpFromGear += carapaceChestHP; break; case "$item_legs_carapace": hpFromGear += carapaceLegsHP; break; case "$item_helmet_flametal": hpFromGear += flametalHeadHP; break; case "$item_chest_flametal": hpFromGear += flametalChestHP; break; case "$item_legs_flametal": hpFromGear += flametalLegsHP; break; case "$item_helmet_medium_ashlands": hpFromGear += askHeadHP; staminaFromGear += askHeadStamina; break; case "$item_chest_medium_ashlands": hpFromGear += askChestHP; staminaFromGear += askChestStamina; break; case "$item_legs_medium_ashlands": hpFromGear += askLegsHP; staminaFromGear += askLegsStamina; break; case "$item_helmet_trollleather": staminaFromGear += trollHeadStamina; break; case "$item_chest_trollleather": staminaFromGear += trollChestStamina; break; case "$item_legs_trollleather": staminaFromGear += trollLegsStamina; break; case "$item_helmet_root": staminaFromGear += rootHeadStamina; break; case "$item_chest_root": staminaFromGear += rootChestStamina; break; case "$item_legs_root": staminaFromGear += rootLegsStamina; break; case "$item_helmet_fenris": staminaFromGear += fenrisHeadStamina; break; case "$item_chest_fenris": staminaFromGear += fenrisChestStamina; break; case "$item_legs_fenris": staminaFromGear += fenrisLegsStamina; break; } } } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] public class BaseEitr_Patch { public static void Postfix(ref float hp, ref float stamina, ref float eitr) { if (MMConfigManager.mageGearGivesEitrEnabled) { eitr += eitrFromGear; } if (MMConfigManager.moreArmorStatsEnabled) { hp += hpFromGear; stamina += staminaFromGear; } } } private static float hpFromGear; private static float staminaFromGear; private static float eitrFromGear; private static int bronzeHeadHP; private static int bronzeChestHP; private static int bronzeLegsHP; private static int ironHeadHP; private static int ironChestHP; private static int ironLegsHP; private static int silverHeadHP; private static int silverChestHP; private static int silverLegsHP; private static int paddedHeadHP; private static int paddedChestHP; private static int paddedLegsHP; private static int carapaceHeadHP; private static int carapaceChestHP; private static int carapaceLegsHP; private static int flametalHeadHP; private static int flametalChestHP; private static int flametalLegsHP; private static int askHeadHP; private static int askChestHP; private static int askLegsHP; private static int trollHeadStamina; private static int trollChestStamina; private static int trollLegsStamina; private static int rootHeadStamina; private static int rootChestStamina; private static int rootLegsStamina; private static int fenrisHeadStamina; private static int fenrisChestStamina; private static int fenrisLegsStamina; private static int askHeadStamina; private static int askChestStamina; private static int askLegsStamina; private static int mageHeadEitr; private static int mageChestEitr; private static int mageLegsEitr; private static int mageHeadEitrAshlands; private static int mageChestEitrAshlands; private static int mageLegsEitrAshlands; public static void InitializeArmorStatsData() { hpFromGear = 0f; staminaFromGear = 0f; eitrFromGear = 0f; bronzeHeadHP = 2; bronzeChestHP = 4; bronzeLegsHP = 4; ironHeadHP = 4; ironChestHP = 8; ironLegsHP = 8; silverHeadHP = 8; silverChestHP = 12; silverLegsHP = 10; paddedHeadHP = 10; paddedChestHP = 16; paddedLegsHP = 14; carapaceHeadHP = 12; carapaceChestHP = 20; carapaceLegsHP = 18; flametalHeadHP = 14; flametalChestHP = 24; flametalLegsHP = 22; askHeadHP = 5; askChestHP = 10; askLegsHP = 10; trollHeadStamina = 1; trollChestStamina = 2; trollLegsStamina = 2; rootHeadStamina = 3; rootChestStamina = 4; rootLegsStamina = 3; fenrisHeadStamina = 4; fenrisChestStamina = 6; fenrisLegsStamina = 5; askHeadStamina = 5; askChestStamina = 8; askLegsStamina = 7; mageHeadEitr = 10; mageChestEitr = 20; mageLegsEitr = 20; mageHeadEitrAshlands = 15; mageChestEitrAshlands = 30; mageLegsEitrAshlands = 30; } } internal class MMArrowSlots { [HarmonyPatch(typeof(InventoryGrid), "UpdateGui", new Type[] { typeof(Player), typeof(ItemData) })] public static class ArrowSlots_Patch { } } internal class MMClearMistlands { [HarmonyPatch(typeof(ZoneSystem), "Update")] private class ClearMistlandsQueenCheck_Patch { private static void Prefix(ZoneSystem __instance) { queenDefeated = false; if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null) { List<string> globalKeys = __instance.GetGlobalKeys(); if (globalKeys.Contains("defeated_queen")) { queenDefeated = true; } } } } [HarmonyPatch(typeof(MistEmitter), "Update")] private class ClearMistlandsEmitter_Patch { private static void Prefix(MistEmitter __instance) { if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null && queenDefeated) { ((Component)__instance).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(ParticleMist), "Update")] private class ClearMistlandsParticle_Patch { private static void Postfix(ParticleMist __instance) { if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null && queenDefeated) { ((Component)__instance).gameObject.SetActive(false); } } } private static bool queenDefeated; } internal class MMCraftableChain { [HarmonyPatch(typeof(ObjectDB), "Awake")] private class CraftableChain_Patch { private static void Postfix(ObjectDB __instance) { if (!MMConfigManager.craftableChainEnabled || !((Object)(object)__instance != (Object)null)) { return; } Recipe val = __instance.m_recipes.Find((Recipe r) => ((Object)r).name == "Recipe_Chain"); if ((Object)(object)val == (Object)null) { val = CreateChainRecipe(ref __instance); if ((Object)(object)val != (Object)null) { __instance.m_recipes.Add(val); } } } } private static Recipe CreateChainRecipe(ref ObjectDB objDB) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) Recipe val = null; GameObject val2 = objDB.m_items.Find((GameObject i) => ((Object)i).name == "Chain"); GameObject val3 = objDB.m_items.Find((GameObject i) => ((Object)i).name == "Iron"); Recipe val4 = objDB.m_recipes.Find((Recipe r) => ((Object)r).name == "Recipe_Lantern"); if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) { val = ScriptableObject.CreateInstance<Recipe>(); val.m_item = val2.GetComponent<ItemDrop>(); val.m_amount = 2; val.m_minStationLevel = 1; val.m_resources = (Requirement[])(object)new Requirement[1]; val.m_resources[0] = new Requirement(); val.m_resources[0].m_amount = 1; val.m_resources[0].m_amountPerLevel = 1; val.m_resources[0].m_recover = true; val.m_resources[0].m_resItem = val3.GetComponent<ItemDrop>(); ((Object)val).hideFlags = ((Object)val4).hideFlags; val.m_craftingStation = val4.m_craftingStation; val.m_repairStation = val4.m_repairStation; ((Object)val).name = "Recipe_Chain"; val.m_enabled = true; } return val; } } internal class MMCreatureUnleveler { [HarmonyPatch(typeof(ZoneSystem), "Update")] private class ClearMistlandsQueenCheck_Patch { private static void Prefix(ZoneSystem __instance) { eikthyrDefeated = false; elderDefeated = false; bonemassDefeated = false; moderDefeated = false; yagluthDefeated = false; queenDefeated = false; faderDefeated = false; if (MMConfigManager.clearMistlandsEnabled && (Object)(object)__instance != (Object)null) { List<string> globalKeys = __instance.GetGlobalKeys(); if (globalKeys.Contains("defeated_eikthyr")) { eikthyrDefeated = true; } if (globalKeys.Contains("defeated_gdking")) { elderDefeated = true; } if (globalKeys.Contains("defeated_bonemass")) { bonemassDefeated = true; } if (globalKeys.Contains("defeated_dragon")) { moderDefeated = true; } if (globalKeys.Contains("defeated_goblinking")) { yagluthDefeated = true; } if (globalKeys.Contains("defeated_queen")) { queenDefeated = true; } if (globalKeys.Contains("defeated_fader")) { faderDefeated = true; } } } } [HarmonyPatch(typeof(SpawnSystem), "Awake")] private static class RemoveMinimumDistanceForStars { private static void Postfix(SpawnSystem __instance) { if (!((Object)(object)__instance != (Object)null) || !MMConfigManager.creatureUnlevelerEnabled) { return; } foreach (SpawnSystemList spawnList in __instance.m_spawnLists) { foreach (SpawnData spawner in spawnList.m_spawners) { if (eikthyrDefeated) { switch (spawner.m_name) { case "deer": spawner.m_overrideLevelupChance = 15f; break; case "Boar": case "Neck lakes": case "Neck IN RAIN": spawner.m_overrideLevelupChance = 15f; spawner.m_levelUpMinCenterDistance = 400f; break; case "Greyling": spawner.m_overrideLevelupChance = 15f; spawner.m_maxLevel = 2; break; } } if (elderDefeated) { switch (spawner.m_name) { case "greydwarf DAY": case "greydwarf Night": spawner.m_overrideLevelupChance = 20f; break; case "Boar": case "Neck lakes": case "Neck IN RAIN": case "greydwarf ELITE": case "Troll": spawner.m_overrideLevelupChance = 20f; spawner.m_levelUpMinCenterDistance = 0f; break; case "Greyling": case "greydwarf After boss": case "Greydwarf Elite": case "Greydwarf Shaman": case "Greydwarf": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; } } if (bonemassDefeated) { switch (spawner.m_name) { case "Marsh draugr": case "Leech": spawner.m_overrideLevelupChance = 20f; break; case "Skeleton": case "Draugr": case "Draugr Elite": case "Marsh surtling": case "Surtling": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; case "Boar": case "Neck lakes": case "Neck IN RAIN": case "greydwarf ELITE": case "greydwarf DAY": case "greydwarf Night": case "Greyling": case "greydwarf After boss": case "Greydwarf Elite": case "Greydwarf Shaman": case "Greydwarf": spawner.m_overrideLevelupChance = 30f; break; } } if (moderDefeated) { switch (spawner.m_name) { case "Fenring": spawner.m_overrideLevelupChance = 10f; spawner.m_maxLevel = 2; break; case "Wolf": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; case "Troll": spawner.m_overrideLevelupChance = 30f; break; case "Skeleton": case "Marsh draugr": case "Draugr": case "Draugr Elite": case "Marsh surtling": case "Surtling": spawner.m_overrideLevelupChance = 30f; break; } } if (yagluthDefeated) { switch (spawner.m_name) { case "GoblinBrute": spawner.m_overrideLevelupChance = 20f; break; case "Goblin": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; case "Blob": case "BlobElite": case "Wraith": case "Abomination": case "StoneGolem": case "Hatchling": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 2; break; case "Fenring": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; case "Wolf": spawner.m_overrideLevelupChance = 30f; break; } } if (queenDefeated) { switch (spawner.m_name) { case "Dverger": case "Seeker Brute": case "Tick defeated queen other biomes": spawner.m_overrideLevelupChance = 20f; break; case "Seeker defeated queen other biomes": case "SeekerBrood defeated queen other biomes": spawner.m_overrideLevelupChance = 10f; spawner.m_maxLevel = 2; break; case "Seeker": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 3; break; case "Lox": case "Deathsquito": spawner.m_overrideLevelupChance = 20f; spawner.m_maxLevel = 2; break; case "Goblin": case "GoblinBrute": spawner.m_overrideLevelupChance = 30f; break; } } if (faderDefeated) { switch (spawner.m_name) { case "Dverger": spawner.m_overrideLevelupChance = 30f; break; case "Charred Melee [Other biomes when Fader is defeated]": case "Charred Archer [Other biomes when Fader is defeated]": spawner.m_overrideLevelupChance = 10f; spawner.m_maxLevel = 2; break; } } } } } } private static bool eikthyrDefeated; private static bool elderDefeated; private static bool bonemassDefeated; private static bool moderDefeated; private static bool yagluthDefeated; private static bool queenDefeated; private static bool faderDefeated; } internal class MMGearSpeedChanges { [HarmonyPatch(typeof(ObjectDB), "Awake")] private class GearSpeed_Patch { private static List<ItemDrop> chestItems; private static List<ItemDrop> legsItems; private static List<ItemDrop> twoHWItems; private static List<ItemDrop> shieldItems; private static void Prefix(ref ObjectDB __instance) { if (MMConfigManager.altGearSpeedModifiersEnabled) { GetItems(ref __instance); ModifySpeed(); } } private static void GetItems(ref ObjectDB objDB) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType)); ItemType val = (ItemType)0; ItemType val2 = (ItemType)0; ItemType val3 = (ItemType)0; ItemType val4 = (ItemType)0; ItemType[] array2 = array; for (int i = 0; i < array2.Length; i++) { ItemType val5 = array2[i]; if (((object)(ItemType)(ref val5)).ToString() == "Chest") { val = val5; } if (((object)(ItemType)(ref val5)).ToString() == "Legs") { val2 = val5; } if (((object)(ItemType)(ref val5)).ToString() == "TwoHandedWeapon") { val3 = val5; } if (((object)(ItemType)(ref val5)).ToString() == "Shield") { val4 = val5; } } chestItems = objDB.GetAllItems(val, ""); legsItems = objDB.GetAllItems(val2, ""); twoHWItems = objDB.GetAllItems(val3, ""); shieldItems = objDB.GetAllItems(val4, ""); } private static void ModifySpeed() { foreach (ItemDrop chestItem in chestItems) { switch (((Object)chestItem).name) { case "ArmorBronzeChest": case "ArmorIronChest": case "ArmorWolfChest": case "ArmorPaddedCuirass": case "ArmorCarapaceChest": case "ArmorFlametalChest": case "ArmorMageChest": case "ArmorMageChest_Ashlands": chestItem.m_itemData.m_shared.m_movementModifier = 0f; break; case "ArmorTrollLeatherChest": case "ArmorAshlandsMediumChest": chestItem.m_itemData.m_shared.m_movementModifier = 0.02f; break; case "ArmorRootChest": chestItem.m_itemData.m_shared.m_movementModifier = 0.01f; break; } } foreach (ItemDrop legsItem in legsItems) { switch (((Object)legsItem).name) { case "ArmorBronzeLegs": case "ArmorIronLegs": case "ArmorWolfLegs": case "ArmorPaddedGreaves": case "ArmorCarapaceLegs": case "ArmorFlametalLegs": case "ArmorMageLegs": case "ArmorMageLegs_Ashlands": legsItem.m_itemData.m_shared.m_movementModifier = 0f; break; case "ArmorTrollLeatherLegs": case "ArmorAshlandsMediumlegs": legsItem.m_itemData.m_shared.m_movementModifier = 0.02f; break; case "ArmorRootLegs": legsItem.m_itemData.m_shared.m_movementModifier = 0.01f; break; } } foreach (ItemDrop twoHWItem in twoHWItems) { string name = ((Object)twoHWItem).name; string text = name; if (text == "Battleaxe" || text == "BattleaxeCrystal") { twoHWItem.m_itemData.m_shared.m_movementModifier = -0.05f; } } foreach (ItemDrop shieldItem in shieldItems) { switch (((Object)shieldItem).name) { case "ShieldFlametalTower": case "ShieldBlackmetalTower": case "ShieldBoneTower": case "ShieldIronTower": case "ShieldWoodTower": shieldItem.m_itemData.m_shared.m_movementModifier = -0.1f; break; case "ShieldSerpentscale": shieldItem.m_itemData.m_shared.m_movementModifier = -0.05f; break; } } } } } internal class MMGearUpgradeUnlocker { [HarmonyPatch(typeof(ObjectDB), "Awake")] private class GearUpgradeUnlock_Patch { private static void Prefix(ref ObjectDB __instance) { if (!MMConfigManager.gearUpgradeUnlockEnabled) { return; } foreach (Recipe recipe in __instance.m_recipes) { switch (((Object)recipe).name) { case "Recipe_HelmetBronze": case "Recipe_ArmorBronzeChest": case "Recipe_ArmorBronzeLegs": case "Recipe_AtgeirBronze": case "Recipe_AxeBronze": case "Recipe_KnifeCopper": case "Recipe_MaceBronze": case "Recipe_PickaxeBronze": case "Recipe_SpearBronze": case "Recipe_SwordBronze": case "Recipe_HelmetMage": case "Recipe_ArmorMageChest": case "Recipe_ArmorMageLegs": case "Recipe_CapeFeather": case "Recipe_StaffFireball": case "Recipe_StaffIceShards": case "Recipe_StaffShield": case "Recipe_StaffSkeleton": case "Recipe_ArmorCarapaceChest": case "Recipe_ArmorCarapaceLegs": case "Recipe_HelmetCarapace": case "Recipe_AxeJotunBane": case "Recipe_SpearCarapace": case "Recipe_SwordMistwalker": case "Recipe_AtgeirHimminAfl": case "Recipe_KnifeSkollAndHati": case "Recipe_SledgeDemolisher": case "Recipe_SwordKrom": case "Recipe_BowSpineSnap": case "Recipe_CrossbowArbalest": recipe.m_minStationLevel = 0; break; case "Recipe_HelmetLeather": case "Recipe_ArmorLeatherChest": case "Recipe_ArmorLeatherLegs": case "Recipe_CapeDeerHide": case "Recipe_HelmetTrollLeather": case "Recipe_ArmorTrollLeatherChest": case "Recipe_ArmorTrollLeatherLegs": case "Recipe_CapeTrollHide": case "Recipe_SledgeStagbreaker": case "Recipe_HelmetMage_Ashlands": case "Recipe_ArmorMageChest_Ashlands": case "Recipe_ArmorMageLegs_Ashlands": case "Recipe_CapeAsksvin": case "Recipe_StaffClusterbomb": case "Recipe_StaffGreenRoots": case "Recipe_StaffLightning": case "Recipe_StaffRedTroll": recipe.m_minStationLevel = 1; break; case "Recipe_HelmetMedium_Ashlands": case "Recipe_ArmorMediumChest_Ashlands": case "Recipe_ArmorMediumLegs_Ashlands": case "Recipe_HelmetFlametal": case "Recipe_ArmorFlametalChest": case "Recipe_ArmorFlametalLegs": case "Recipe_CapeAsh": case "Recipe_MaceEldner": case "Recipe_SpearSplitner": case "Recipe_SwordNiedhogg": case "Recipe_AxeBerzerkr": case "Recipe_SwordSlayer": case "Recipe_BowAshlands": case "Recipe_CrossbowRipper": recipe.m_minStationLevel = 2; break; case "Recipe_MaceEldner_Blood": case "Recipe_MaceEldner_Lightning": case "Recipe_MaceEldner_Nature": case "Recipe_SpearSplitner_Blood": case "Recipe_SpearSplitner_Lightning": case "Recipe_SpearSplitner_Nature": case "Recipe_SwordNiedhogg_Blood": case "Recipe_SwordNiedhogg_Lightning": case "Recipe_SwordNiedhogg_Nature": case "Recipe_AxeBerzerkr_Blood": case "Recipe_AxeBerzerkr_Lightning": case "Recipe_AxeBerzerkr_Nature": case "Recipe_SwordSlayer_Blood": case "Recipe_SwordSlayer_Lightning": case "Recipe_SwordSlayer_Nature": case "Recipe_BowAshlands_Blood": case "Recipe_BowAshlands_Lightning": case "Recipe_BowAshlands_Nature": case "Recipe_CrossbowRipper_Blood": case "Recipe_CrossbowRipper_Lightning": case "Recipe_CrossbowRipper_Nature": case "Recipe_SwordFire": recipe.m_minStationLevel = 3; break; case "Recipe_CapeLinen": if (MMConfigManager.altLinenCapeEnabled) { recipe.m_minStationLevel = 1; } else { recipe.m_minStationLevel = 2; } break; } } } } [HarmonyPatch(typeof(Recipe), "GetRequiredStationLevel")] private class GearUpgradeUnlockStationLevel_Patch { private static bool Prefix(int quality, ref int ___m_minStationLevel, ref int __result, ref bool __runOriginal) { if (MMConfigManager.gearUpgradeUnlockEnabled) { __runOriginal = false; __result = Mathf.Max(0, ___m_minStationLevel) + (quality - 1); return false; } __runOriginal = true; __result = Mathf.Max(1, ___m_minStationLevel) + (quality - 1); return true; } } } internal class MMLessAshlandsEnemies { [HarmonyPatch(typeof(SpawnSystem), "Awake")] private class LessAshlandsEnemiesAwake_Patch { private static void Postfix(SpawnSystem __instance) { if (!MMConfigManager.lessAshlandsEnemiesEnabled || !Object.op_Implicit((Object)(object)__instance)) { return; } foreach (SpawnSystemList spawnList in __instance.m_spawnLists) { foreach (SpawnData spawner in spawnList.m_spawners) { switch (spawner.m_name) { case "Fallen Valkyrie": spawner.m_spawnChance = 15f; break; case "Asksvin [DAY]": spawner.m_maxSpawned = 1; spawner.m_groupSizeMin = 1; spawner.m_groupSizeMax = 2; spawner.m_spawnChance = 20f; break; case "Asksvin [NIGHT]": spawner.m_maxSpawned = 2; spawner.m_groupSizeMin = 1; spawner.m_groupSizeMax = 3; spawner.m_spawnChance = 35f; break; case "Volture": spawner.m_maxSpawned = 2; spawner.m_groupSizeMin = 1; spawner.m_groupSizeMax = 2; spawner.m_spawnChance = 20f; break; case "Charred Twitcher [DAY]": spawner.m_maxSpawned = 2; spawner.m_groupSizeMin = 1; spawner.m_groupSizeMax = 2; spawner.m_spawnChance = 35f; break; case "Charred Twitcher [NIGHT]": spawner.m_maxSpawned = 3; spawner.m_groupSizeMin = 2; spawner.m_groupSizeMax = 3; spawner.m_spawnChance = 45f; break; case "Charred Archer": spawner.m_maxSpawned = 2; spawner.m_groupSizeMax = 2; spawner.m_spawnChance = 30f; break; case "Charred Melee": spawner.m_maxSpawned = 2; spawner.m_groupSizeMax = 2; spawner.m_spawnChance = 30f; break; case "Lava Blob": spawner.m_maxSpawned = 1; spawner.m_groupSizeMax = 1; spawner.m_spawnChance = 20f; break; } } } } } } internal class MMLinenAndLoxCapeChanges { [HarmonyPatch(typeof(ObjectDB), "Awake")] private class AlternateLinenAndLoxCape_Patch { private static void Postfix(ref ObjectDB __instance) { if (MMConfigManager.altLinenCapeEnabled) { if (MMShared.itemDropSuccess) { ApplyRecipeChanges(ref __instance); } ApplyPoisonResist(ref __instance); } } private static void ApplyRecipeChanges(ref ObjectDB objDB) { foreach (Recipe recipe in objDB.m_recipes) { string name = ((Object)recipe).name; string text = name; if (!(text == "Recipe_CapeLinen")) { continue; } Requirement[] resources = recipe.m_resources; foreach (Requirement val in resources) { switch (((Object)val.m_resItem).name) { case "LinenThread": val.m_amount = 5; val.m_amountPerLevel = 2; val.m_resItem = MMShared.deerHideID; break; case "Silver": case "BlackMetal": val.m_amount = 1; val.m_amountPerLevel = 0; val.m_resItem = MMShared.ironID; break; } } } } private static void ApplyPoisonResist(ref ObjectDB objDB) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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) ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType)); ItemType val = (ItemType)0; ItemType[] array2 = array; for (int i = 0; i < array2.Length; i++) { ItemType val2 = array2[i]; if (((object)(ItemType)(ref val2)).ToString() == "Shoulder") { val = val2; break; } } List<ItemDrop> allItems = objDB.GetAllItems(val, ""); foreach (ItemDrop item2 in allItems) { string name = ((Object)item2).name; string text = name; if (text == "CapeLinen" || text == "CapeLox") { DamageModPair item = default(DamageModPair); item.m_modifier = (DamageModifier)1; item.m_type = (DamageType)256; if (!item2.m_itemData.m_shared.m_damageModifiers.Contains(item)) { item2.m_itemData.m_shared.m_damageModifiers.Add(item); } } } } } } internal class MMBuildPieceChanges { [HarmonyPatch(typeof(PieceTable), "UpdateAvailable")] private class BuildPiecesModifications_Patch { private static void Postfix(ref List<GameObject> ___m_pieces) { foreach (GameObject ___m_piece in ___m_pieces) { Piece component = ___m_piece.GetComponent<Piece>(); Requirement[] requirements = component.m_resources; string name = component.m_name; if (MMConfigManager.extensionsChangesEnabled && component.m_spaceRequirement >= 2f) { component.m_spaceRequirement = 1f; } if (MMConfigManager.cheaperBuildPiecesEnabled) { updateBuildPiecesAmounts(ref requirements, ref name); } if (MMConfigManager.altBuildPiecesMaterialsEnabled && MMShared.itemDropSuccess) { updateBuildPiecesMaterials(ref requirements, ref name); } } } } [HarmonyPatch(typeof(Piece), "DropResources")] private class BuildPieceReturn_Patch { private static void Prefix([NotNull] ref Requirement[] ___m_resources, [NotNull] ref string ___m_name) { if (MMConfigManager.cheaperBuildPiecesEnabled) { updateBuildPiecesAmounts(ref ___m_resources, ref ___m_name); } if (MMConfigManager.altBuildPiecesMaterialsEnabled && MMShared.itemDropSuccess) { updateBuildPiecesMaterials(ref ___m_resources, ref ___m_name); } } } private static void updateBuildPiecesAmounts(ref Requirement[] requirements, ref string name) { switch (name) { case "$piece_preptable": { Requirement[] array64 = requirements; foreach (Requirement val64 in array64) { string name64 = ((Object)val64.m_resItem).name; string text63 = name64; if (!(text63 == "FineWood")) { if (text63 == "LeatherScraps") { val64.m_amount = 10; } } else { val64.m_amount = 10; } } break; } case "$piece_cookingstation_iron": { Requirement[] array96 = requirements; foreach (Requirement val96 in array96) { string name96 = ((Object)val96.m_resItem).name; string text95 = name96; if (!(text95 == "Iron")) { if (text95 == "Chain") { val96.m_amount = 2; } } else { val96.m_amount = 2; } } break; } case "$piece_itemstand": { Requirement[] array32 = requirements; foreach (Requirement val32 in array32) { string name32 = ((Object)val32.m_resItem).name; string text31 = name32; if (text31 == "FineWood") { val32.m_amount = 2; } } break; } case "$piece_blastfurnace": { Requirement[] array80 = requirements; foreach (Requirement val80 in array80) { string name80 = ((Object)val80.m_resItem).name; string text79 = name80; if (text79 == "Iron") { val80.m_amount = 5; } } break; } case "$piece_oven": { Requirement[] array48 = requirements; foreach (Requirement val48 in array48) { string name48 = ((Object)val48.m_resItem).name; string text47 = name48; if (text47 == "Iron") { val48.m_amount = 5; } } break; } case "$piece_forge_ext3": { Requirement[] array16 = requirements; foreach (Requirement val16 in array16) { string name16 = ((Object)val16.m_resItem).name; string text15 = name16; if (text15 == "Wood") { val16.m_amount = 15; } } break; } case "$piece_forge_ext4": { Requirement[] array88 = requirements; foreach (Requirement val88 in array88) { string name88 = ((Object)val88.m_resItem).name; string text87 = name88; if (text87 == "Iron") { val88.m_amount = 7; } } break; } case "$piece_forge_ext5": { Requirement[] array72 = requirements; foreach (Requirement val72 in array72) { string name72 = ((Object)val72.m_resItem).name; string text71 = name72; if (text71 == "FineWood") { val72.m_amount = 10; } } break; } case "$piece_forge_ext6": { Requirement[] array56 = requirements; foreach (Requirement val56 in array56) { string name56 = ((Object)val56.m_resItem).name; string text55 = name56; if (text55 == "Iron") { val56.m_amount = 5; } } break; } case "$piece_woodwindowshutter": { Requirement[] array40 = requirements; foreach (Requirement val40 in array40) { string name40 = ((Object)val40.m_resItem).name; string text39 = name40; if (text39 == "Wood") { val40.m_amount = 2; } } break; } case "$piece_darkwoodgate": { Requirement[] array24 = requirements; foreach (Requirement val24 in array24) { string name24 = ((Object)val24.m_resItem).name; string text23 = name24; if (text23 == "Iron") { val24.m_amount = 3; } } break; } case "$piece_irongate": { Requirement[] array8 = requirements; foreach (Requirement val8 in array8) { string name8 = ((Object)val8.m_resItem).name; string text7 = name8; if (text7 == "Iron") { val8.m_amount = 3; } } break; } case "$piece_chest": { Requirement[] array92 = requirements; foreach (Requirement val92 in array92) { string name92 = ((Object)val92.m_resItem).name; string text91 = name92; if (text91 == "Iron") { val92.m_amount = 1; } } break; } case "$piece_chestprivate": { Requirement[] array84 = requirements; foreach (Requirement val84 in array84) { string name84 = ((Object)val84.m_resItem).name; string text83 = name84; if (text83 == "Iron") { val84.m_amount = 4; } } break; } case "$piece_chestblackmetal": { Requirement[] array76 = requirements; foreach (Requirement val76 in array76) { string name76 = ((Object)val76.m_resItem).name; string text75 = name76; if (text75 == "BlackMetal") { val76.m_amount = 4; } } break; } case "$piece_brazierceiling01": { Requirement[] array68 = requirements; foreach (Requirement val68 in array68) { string name68 = ((Object)val68.m_resItem).name; string text67 = name68; if (text67 == "Bronze") { val68.m_amount = 3; } } break; } case "$piece_sconce": { Requirement[] array60 = requirements; foreach (Requirement val60 in array60) { string name60 = ((Object)val60.m_resItem).name; string text59 = name60; if (text59 == "Copper") { val60.m_amount = 1; } } break; } case "$piece_groundtorchwood": { Requirement[] array52 = requirements; foreach (Requirement val52 in array52) { string name52 = ((Object)val52.m_resItem).name; string text51 = name52; if (text51 == "Wood") { val52.m_amount = 1; } } break; } case "$piece_groundtorch": case "$piece_groundtorchgreen": case "$piece_groundtorchblue": { Requirement[] array44 = requirements; foreach (Requirement val44 in array44) { string name44 = ((Object)val44.m_resItem).name; string text43 = name44; if (text43 == "Iron") { val44.m_amount = 1; } } break; } case "$piece_portal": { Requirement[] array36 = requirements; foreach (Requirement val36 in array36) { string name36 = ((Object)val36.m_resItem).name; string text35 = name36; if (text35 == "FineWood") { val36.m_amount = 10; } } break; } case "$piece_portal_stone": { Requirement[] array28 = requirements; foreach (Requirement val28 in array28) { string name28 = ((Object)val28.m_resItem).name; string text27 = name28; if (text27 == "Grausten") { val28.m_amount = 10; } } break; } case "$piece_rug_lox": { Requirement[] array20 = requirements; foreach (Requirement val20 in array20) { string name20 = ((Object)val20.m_resItem).name; string text19 = name20; if (text19 == "LoxPelt") { val20.m_amount = 3; } } break; } case "$piece_rug_wolf": { Requirement[] array12 = requirements; foreach (Requirement val12 in array12) { string name12 = ((Object)val12.m_resItem).name; string text11 = name12; if (text11 == "WolfPelt") { val12.m_amount = 3; } } break; } case "$piece_rug_deer": { Requirement[] array4 = requirements; foreach (Requirement val4 in array4) { string name5 = ((Object)val4.m_resItem).name; string text4 = name5; if (text4 == "DeerHide") { val4.m_amount = 3; } } break; } case "$piece_banner01": case "$piece_banner02": case "$piece_banner03": case "$piece_banner04": case "$piece_banner05": case "$piece_banner06": case "$piece_banner07": case "$piece_banner08": case "$piece_banner09": case "$piece_banner10": case "$piece_banner11": { Requirement[] array94 = requirements; foreach (Requirement val94 in array94) { string name94 = ((Object)val94.m_resItem).name; string text93 = name94; if (text93 == "LeatherScraps") { val94.m_amount = 5; } } break; } case "$piece_fermenter": { Requirement[] array90 = requirements; foreach (Requirement val90 in array90) { string name90 = ((Object)val90.m_resItem).name; string text89 = name90; if (text89 == "FineWood") { val90.m_amount = 15; } } break; } case "$piece_bathtub": { Requirement[] array86 = requirements; foreach (Requirement val86 in array86) { string name86 = ((Object)val86.m_resItem).name; string text85 = name86; if (text85 == "Iron") { val86.m_amount = 5; } } break; } case "$piece_crystalwall1x1": { Requirement[] array82 = requirements; foreach (Requirement val82 in array82) { string name82 = ((Object)val82.m_resItem).name; string text81 = name82; if (text81 == "Crystal") { val82.m_amount = 1; } } break; } case "$piece_incinerator": { Requirement[] array78 = requirements; foreach (Requirement val78 in array78) { string name78 = ((Object)val78.m_resItem).name; string text77 = name78; if (text77 == "Iron") { val78.m_amount = 5; } } break; } case "$piece_stonewall1x1": { Requirement[] array74 = requirements; foreach (Requirement val74 in array74) { string name74 = ((Object)val74.m_resItem).name; string text73 = name74; if (text73 == "Stone") { val74.m_amount = 2; } } break; } case "$piece_stonewall2x1": { Requirement[] array70 = requirements; foreach (Requirement val70 in array70) { string name70 = ((Object)val70.m_resItem).name; string text69 = name70; if (text69 == "Stone") { val70.m_amount = 3; } } break; } case "$piece_stonepillar": { Requirement[] array66 = requirements; foreach (Requirement val66 in array66) { string name66 = ((Object)val66.m_resItem).name; string text65 = name66; if (text65 == "Stone") { val66.m_amount = 3; } } break; } case "$piece_stonearch": { Requirement[] array62 = requirements; foreach (Requirement val62 in array62) { string name62 = ((Object)val62.m_resItem).name; string text61 = name62; if (text61 == "Stone") { val62.m_amount = 3; } } break; } case "$piece_stonefloor2x2": { Requirement[] array58 = requirements; foreach (Requirement val58 in array58) { string name58 = ((Object)val58.m_resItem).name; string text57 = name58; if (text57 == "Stone") { val58.m_amount = 4; } } break; } case "$piece_stonestair": { Requirement[] array54 = requirements; foreach (Requirement val54 in array54) { string name54 = ((Object)val54.m_resItem).name; string text53 = name54; if (text53 == "Stone") { val54.m_amount = 3; } } break; } case "$piece_blackmarble2x1x1": { Requirement[] array50 = requirements; foreach (Requirement val50 in array50) { string name50 = ((Object)val50.m_resItem).name; string text49 = name50; if (text49 == "BlackMarble") { val50.m_amount = 3; } } break; } case "$piece_blackmarble_stair": { Requirement[] array46 = requirements; foreach (Requirement val46 in array46) { string name46 = ((Object)val46.m_resItem).name; string text45 = name46; if (text45 == "BlackMarble") { val46.m_amount = 3; } } break; } case "$piece_blackmarble_base1": { Requirement[] array42 = requirements; foreach (Requirement val42 in array42) { string name42 = ((Object)val42.m_resItem).name; string text41 = name42; if (text41 == "BlackMarble") { val42.m_amount = 4; } } break; } case "$piece_blackmarble_basecorner": { Requirement[] array38 = requirements; foreach (Requirement val38 in array38) { string name38 = ((Object)val38.m_resItem).name; string text37 = name38; if (text37 == "BlackMarble") { val38.m_amount = 5; } } break; } case "$piece_blackmarble_out1": { Requirement[] array34 = requirements; foreach (Requirement val34 in array34) { string name34 = ((Object)val34.m_resItem).name; string text33 = name34; if (text33 == "BlackMarble") { val34.m_amount = 4; } } break; } case "$piece_blackmarble_outcorner": { Requirement[] array30 = requirements; foreach (Requirement val30 in array30) { string name30 = ((Object)val30.m_resItem).name; string text29 = name30; if (text29 == "BlackMarble") { val30.m_amount = 5; } } break; } case "$piece_blackmarble_arch": { Requirement[] array26 = requirements; foreach (Requirement val26 in array26) { string name26 = ((Object)val26.m_resItem).name; string text25 = name26; if (text25 == "BlackMarble") { val26.m_amount = 4; } } break; } case "$piece_dvergr_stake_wall": { Requirement[] array22 = requirements; foreach (Requirement val22 in array22) { string name22 = ((Object)val22.m_resItem).name; string text21 = name22; if (!(text21 == "YggdrasilWood")) { if (text21 == "Iron") { val22.m_amount = 2; } } else { val22.m_amount = 4; } } break; } case "$piece_sharpstakes": { Requirement[] array18 = requirements; foreach (Requirement val18 in array18) { string name18 = ((Object)val18.m_resItem).name; string text17 = name18; if (!(text17 == "Wood")) { if (text17 == "RoundLog") { val18.m_amount = 2; } } else { val18.m_amount = 4; } } break; } case "$piece_dvergr_sharpstakes": { Requirement[] array14 = requirements; foreach (Requirement val14 in array14) { string name14 = ((Object)val14.m_resItem).name; string text13 = name14; if (!(text13 == "YggdrasilWood")) { if (text13 == "Iron") { val14.m_amount = 1; } } else { val14.m_amount = 4; } } break; } case "$piece_trap": { Requirement[] array10 = requirements; foreach (Requirement val10 in array10) { string name10 = ((Object)val10.m_resItem).name; string text9 = name10; if (!(text9 == "BlackMetal")) { if (text9 == "BronzeNails") { val10.m_amount = 5; } } else { val10.m_amount = 3; } } break; } case "$piece_turret": { Requirement[] array6 = requirements; foreach (Requirement val6 in array6) { switch (((Object)val6.m_resItem).name) { case "BlackMetal": val6.m_amount = 7; break; case "YggdrasilWood": val6.m_amount = 7; break; case "MechanicalSpring": val6.m_amount = 2; break; } } break; } case "$piece_eitrrefinery": { Requirement[] array2 = requirements; foreach (Requirement val2 in array2) { string name3 = ((Object)val2.m_resItem).name; string text2 = name3; if (text2 == "BlackMarble") { val2.m_amount = 10; } } break; } case "$piece_blackforge_ext2": { Requirement[] array95 = requirements; foreach (Requirement val95 in array95) { string name95 = ((Object)val95.m_resItem).name; string text94 = name95; if (text94 == "Copper") { val95.m_amount = 5; } } break; } case "$piece_sapcollector": { Requirement[] array93 = requirements; foreach (Requirement val93 in array93) { string name93 = ((Object)val93.m_resItem).name; string text92 = name93; if (!(text92 == "YggdrasilWood")) { if (text92 == "BlackMetal") { val93.m_amount = 3; } } else { val93.m_amount = 5; } } break; } case "$piece_magetable": { Requirement[] array91 = requirements; foreach (Requirement val91 in array91) { string name91 = ((Object)val91.m_resItem).name; string text90 = name91; if (!(text90 == "YggdrasilWood")) { if (text90 == "BlackMetal") { val91.m_amount = 5; } } else { val91.m_amount = 10; } } break; } case "$piece_magetable_ext": { Requirement[] array89 = requirements; foreach (Requirement val89 in array89) { string name89 = ((Object)val89.m_resItem).name; string text88 = name89; if (!(text88 == "BlackMarble")) { if (text88 == "Eitr") { val89.m_amount = 5; } } else { val89.m_amount = 5; } } break; } case "$piece_magetable_ext2": { Requirement[] array87 = requirements; foreach (Requirement val87 in array87) { string name87 = ((Object)val87.m_resItem).name; string text86 = name87; if (!(text86 == "BlackMarble")) { if (text86 == "Eitr") { val87.m_amount = 5; } } else { val87.m_amount = 5; } } break; } case "$piece_magetable_ext3": { Requirement[] array85 = requirements; foreach (Requirement val85 in array85) { string name85 = ((Object)val85.m_resItem).name; string text84 = name85; if (text84 == "Eitr") { val85.m_amount = 5; } } break; } case "$piece_hexagonalgate": { Requirement[] array83 = requirements; foreach (Requirement val83 in array83) { string name83 = ((Object)val83.m_resItem).name; string text82 = name83; if (text82 == "Copper") { val83.m_amount = 4; } } break; } case "$piece_dvergr_spiralstair": { Requirement[] array81 = requirements; foreach (Requirement val81 in array81) { string name81 = ((Object)val81.m_resItem).name; string text80 = name81; if (!(text80 == "YggdrasilWood")) { if (text80 == "Copper") { val81.m_amount = 1; } } else { val81.m_amount = 3; } } break; } case "$piece_dvergr_spiralstair_right": { Requirement[] array79 = requirements; foreach (Requirement val79 in array79) { string name79 = ((Object)val79.m_resItem).name; string text78 = name79; if (!(text78 == "YggdrasilWood")) { if (text78 == "Copper") { val79.m_amount = 1; } } else { val79.m_amount = 3; } } break; } case "$piece_blackmarble_bench": { Requirement[] array77 = requirements; foreach (Requirement val77 in array77) { string name77 = ((Object)val77.m_resItem).name; string text76 = name77; if (!(text76 == "BlackMarble")) { if (text76 == "Copper") { val77.m_amount = 2; } } else { val77.m_amount = 5; } } break; } case "$piece_table_round": { Requirement[] array75 = requirements; foreach (Requirement val75 in array75) { string name75 = ((Object)val75.m_resItem).name; string text74 = name75; if (text74 == "IronNails") { val75.m_amount = 10; } } break; } case "$piece_blackmarble_table": { Requirement[] array73 = requirements; foreach (Requirement val73 in array73) { string name73 = ((Object)val73.m_resItem).name; string text72 = name73; if (!(text72 == "BlackMarble")) { if (text72 == "Copper") { val73.m_amount = 2; } } else { val73.m_amount = 5; } } break; } case "$piece_brazierfloor01": { Requirement[] array71 = requirements; foreach (Requirement val71 in array71) { string name71 = ((Object)val71.m_resItem).name; string text70 = name71; if (text70 == "Bronze") { val71.m_amount = 3; } } break; } case "$piece_brazierfloor02": { Requirement[] array69 = requirements; foreach (Requirement val69 in array69) { string name69 = ((Object)val69.m_resItem).name; string text68 = name69; if (!(text68 == "Bronze")) { if (text68 == "GreydwarfEye") { val69.m_amount = 2; } } else { val69.m_amount = 3; } } break; } case "$piece_jute_carpet": { Requirement[] array67 = requirements; foreach (Requirement val67 in array67) { string name67 = ((Object)val67.m_resItem).name; string text66 = name67; if (text66 == "JuteRed") { val67.m_amount = 3; } } break; } case "$piece_juteblue_carpet": { Requirement[] array65 = requirements; foreach (Requirement val65 in array65) { string name65 = ((Object)val65.m_resItem).name; string text64 = name65; if (text64 == "JuteBlue") { val65.m_amount = 3; } } break; } case "$piece_rug_hare": { Requirement[] array63 = requirements; foreach (Requirement val63 in array63) { string name63 = ((Object)val63.m_resItem).name; string text62 = name63; if (text62 == "ScaleHide") { val63.m_amount = 2; } } break; } case "$piece_dvergr_lantern": { Requirement[] array61 = requirements; foreach (Requirement val61 in array61) { string name61 = ((Object)val61.m_resItem).name; string text60 = name61; if (text60 == "Copper") { val61.m_amount = 1; } } break; } case "$piece_dvergr_lantern_pole": { Requirement[] array59 = requirements; foreach (Requirement val59 in array59) { string name59 = ((Object)val59.m_resItem).name; string text58 = name59; if (text58 == "Copper") { val59.m_amount = 2; } } break; } case "$piece_clothdoor": { Requirement[] array57 = requirements; foreach (Requirement val57 in array57) { string name57 = ((Object)val57.m_resItem).name; string text56 = name57; if (text56 == "JuteRed") { val57.m_amount = 3; } } break; } case "$piece_hanging_cloth_blue1": { Requirement[] array55 = requirements; foreach (Requirement val55 in array55) { string name55 = ((Object)val55.m_resItem).name; string text54 = name55; if (text54 == "JuteBlue") { val55.m_amount = 3; } } break; } case "$piece_hanging_cloth_blue2": { Requirement[] array53 = requirements; foreach (Requirement val53 in array53) { string name53 = ((Object)val53.m_resItem).name; string text52 = name53; if (text52 == "JuteBlue") { val53.m_amount = 3; } } break; } case "$piece_ashwood_archedwall": { Requirement[] array51 = requirements; foreach (Requirement val51 in array51) { string name51 = ((Object)val51.m_resItem).name; string text50 = name51; if (text50 == "Blackwood") { val51.m_amount = 1; } } break; } case "$piece_ashwood_floor_2x2": { Requirement[] array49 = requirements; foreach (Requirement val49 in array49) { string name49 = ((Object)val49.m_resItem).name; string text48 = name49; if (text48 == "Blackwood") { val49.m_amount = 2; } } break; } case "$piece_ashwood_floor_1x1": { Requirement[] array47 = requirements; foreach (Requirement val47 in array47) { string name47 = ((Object)val47.m_resItem).name; string text46 = name47; if (text46 == "Blackwood") { val47.m_amount = 1; } } break; } case "$piece_ashwood_floor_deco": { Requirement[] array45 = requirements; foreach (Requirement val45 in array45) { string name45 = ((Object)val45.m_resItem).name; string text44 = name45; if (text44 == "Blackwood") { val45.m_amount = 2; } } break; } case "$piece_ashwood_beam_1m": { Requirement[] array43 = requirements; foreach (Requirement val43 in array43) { string name43 = ((Object)val43.m_resItem).name; string text42 = name43; if (text42 == "Blackwood") { val43.m_amount = 1; } } break; } case "$piece_ashwood_beam_2m": { Requirement[] array41 = requirements; foreach (Requirement val41 in array41) { string name41 = ((Object)val41.m_resItem).name; string text40 = name41; if (text40 == "Blackwood") { val41.m_amount = 2; } } break; } case "$piece_ashwood_pole_1m": { Requirement[] array39 = requirements; foreach (Requirement val39 in array39) { string name39 = ((Object)val39.m_resItem).name; string text38 = name39; if (text38 == "Blackwood") { val39.m_amount = 1; } } break; } case "$piece_ashwood_pole_2m": { Requirement[] array37 = requirements; foreach (Requirement val37 in array37) { string name37 = ((Object)val37.m_resItem).name; string text36 = name37; if (text36 == "Blackwood") { val37.m_amount = 2; } } break; } case "$piece_ashwoodstair": { Requirement[] array35 = requirements; foreach (Requirement val35 in array35) { string name35 = ((Object)val35.m_resItem).name; string text34 = name35; if (text34 == "Blackwood") { val35.m_amount = 1; } } break; } case "$piece_grausten_stoneladder": { Requirement[] array33 = requirements; foreach (Requirement val33 in array33) { string name33 = ((Object)val33.m_resItem).name; string text32 = name33; if (text32 == "Grausten") { val33.m_amount = 3; } } break; } case "$piece_grausten_stair": { Requirement[] array31 = requirements; foreach (Requirement val31 in array31) { string name31 = ((Object)val31.m_resItem).name; string text30 = name31; if (text30 == "Grausten") { val31.m_amount = 3; } } break; } case "$piece_grausten_floor1x1": { Requirement[] array29 = requirements; foreach (Requirement val29 in array29) { string name29 = ((Object)val29.m_resItem).name; string text28 = name29; if (text28 == "Grausten") { val29.m_amount = 1; } } break; } case "$piece_grausten_pillarmedium": { Requirement[] array27 = requirements; foreach (Requirement val27 in array27) { string name27 = ((Object)val27.m_resItem).name; string text26 = name27; if (text26 == "Grausten") { val27.m_amount = 2; } } break; } case "$piece_grausten_pillartapered": { Requirement[] array25 = requirements; foreach (Requirement val25 in array25) { string name25 = ((Object)val25.m_resItem).name; string text24 = name25; if (text24 == "Grausten") { val25.m_amount = 4; } } break; } case "$piece_grausten_pillartaperedinverted": { Requirement[] array23 = requirements; foreach (Requirement val23 in array23) { string name23 = ((Object)val23.m_resItem).name; string text22 = name23; if (text22 == "Grausten") { val23.m_amount = 4; } } break; } case "$piece_grausten_beammedium": { Requirement[] array21 = requirements; foreach (Requirement val21 in array21) { string name21 = ((Object)val21.m_resItem).name; string text20 = name21; if (text20 == "Grausten") { val21.m_amount = 2; } } break; } case "$piece_grausten_wall1x2": { Requirement[] array19 = requirements; foreach (Requirement val19 in array19) { string name19 = ((Object)val19.m_resItem).name; string text18 = name19; if (text18 == "Grausten") { val19.m_amount = 2; } } break; } case "$piece_grausten_wall2x2": { Requirement[] array17 = requirements; foreach (Requirement val17 in array17) { string name17 = ((Object)val17.m_resItem).name; string text16 = name17; if (text16 == "Grausten") { val17.m_amount = 4; } } break; } case "$piece_grausten_wall4x2": { Requirement[] array15 = requirements; foreach (Requirement val15 in array15) { string name15 = ((Object)val15.m_resItem).name; string text14 = name15; if (text14 == "Grausten") { val15.m_amount = 8; } } break; } case "$piece_grausten_window4x2": { Requirement[] array13 = requirements; foreach (Requirement val13 in array13) { string name13 = ((Object)val13.m_resItem).name; string text12 = name13; if (text12 == "Grausten") { val13.m_amount = 8; } } break; } case "$piece_grausten_roof45_corner": { Requirement[] array11 = requirements; foreach (Requirement val11 in array11) { string name11 = ((Object)val11.m_resItem).name; string text10 = name11; if (text10 == "Grausten") { val11.m_amount = 4; } } break; } case "$piece_grausten_roof45_corner2": { Requirement[] array9 = requirements; foreach (Requirement val9 in array9) { string name9 = ((Object)val9.m_resItem).name; string text8 = name9; if (text8 == "Grausten") { val9.m_amount = 4; } } break; } case "$piece_grausten_roof45_archcorner": { Requirement[] array7 = requirements; foreach (Requirement val7 in array7) { string name7 = ((Object)val7.m_resItem).name; string text6 = name7; if (text6 == "Grausten") { val7.m_amount = 4; } } break; } case "$piece_grausten_roof45_archcorner2": { Requirement[] array5 = requirements; foreach (Requirement val5 in array5) { string name6 = ((Object)val5.m_resItem).name; string text5 = name6; if (text5 == "Grausten") { val5.m_amount = 4; } } break; } case "$piece_flametalgate": { Requirement[] array3 = requirements; foreach (Requirement val3 in array3) { string name4 = ((Object)val3.m_resItem).name; string text3 = name4; if (text3 == "FlametalNew") { val3.m_amount = 8; } } break; } case "$piece_rug_asksvin": { Requirement[] array = requirements; foreach (Requirement val in array) { string name2 = ((Object)val.m_resItem).name; string text = name2; if (text == "AskHide") { val.m_amount = 3; } } break; } } } private static void updateBuildPiecesMaterials(ref Requirement[] requirements, ref string name) { switch (name) { case "$piece_workbench_ext4": { Requirement[] array2 = requirements; foreach (Requirement val2 in array2) { string name3 = ((Object)val2.m_resItem).name; string text2 = name3; if (text2 == "Obsidian") { val2.m_resItem = MMShared.coalID; } } break; } case "$piece_darkwoodgate": { Requirement[] array3 = requirements; foreach (Requirement val3 in array3) { string name4 = ((Object)val3.m_resItem).name; string text3 = name4; if (text3 == "Iron") { val3.m_resItem = MMShared.blackMetalID; } } break; } case "$piece_bathtub": { Requirement[] array = requirements; foreach (Requirement val in array) { string name2 = ((Object)val.m_resItem).name; string text = name2; if (text == "Iron") { val.m_resItem = MMShared.blackMetalID; } } break; } } } } internal class MMConfigManager { public static readonly ConfigSync configSync = new ConfigSync("Marsarah.MarsarahMod") { DisplayName = "MarsarahMod", CurrentVersion = "5.5.3", MinimumRequiredVersion = "5.5.3" }; private static ConfigEntry<bool> serverConfigLocked = null; public static ConfigFile configBase; public static bool modEnabled; public static bool cheaperGearEnabled; public static bool doubleBronzeEnabled; public static bool altGearRecipesEnabled; public static bool altLinenCapeEnabled; public static bool altGearSpeedModifiersEnabled; public static bool cheaperBuildPiecesEnabled; public static bool altBuildPiecesMaterialsEnabled; public static bool altForsakenPowersEnabled; public static bool fasterCharacterSpeedEnabled; public static bool lighterMetalWeightEnabled; public static bool largerPickupAreaEnabled; public static bool noSkillLowerOnDeathEnabled; public static bool altStatusEffectsEnabled; public static bool largerBoatExploreRadiusEnabled; public static bool showInventoryWeight; public static bool showInventorySlots; public static bool showBoatSpeed; public static bool lessStaminaUsageEnabled; public static bool showTimeAndDay; public static bool timeFormat24H; public static bool smartBiomeEnabled; public static bool altLoadingTipsEnabled; public static bool showEnemyDetector; public static bool showSummonCounter; public static bool showOnlinePartyIndicator; public static bool partyIndicatorUnderMinimap; public static bool hideOnlineIndicatorWhenSolo; public static bool altCookingRecipesEnabled; public static bool altMeadRecipesEnabled; public static bool moreFoodStacksEnabled; public static bool moreArmorStatsEnabled; public static bool biggerWhispRadiusEnabled; public static bool friendlyBallistasEnabled; public static bool betterDeathRaiserEnabled; public static bool betterSummonedSkeletonGearEnabled; public static bool mageGearGivesEitrEnabled; public static bool betterFrostStaffAccuracyEnabled; public static bool lessFallDamageEnabled; public static bool reducedCrossbowsReloadTimeEnabled; public static bool lessAshlandsEnemiesEnabled; public static bool gearUpgradeUnlockEnabled; public static bool permanentLightsEnabled; public static bool clearMistlandsEnabled; public static bool craftableChainEnabled; public static bool brighterLanternsEnabled; public static bool lessFogEnabled; public static bool creatureUnlevelerEnabled; public static bool minibossWeightEnabled; public static bool fasterResourceDropsEnabled; public static bool fasterEquipEnabled; public static bool instantEatAndDrinkEnabled; public static bool extensionsChangesEnabled; public static bool noFleeEnabled; public static bool automaticProgressionHaltEnabled; public static bool seekerSoldierTrophyEnabled; public static bool tougherShipsEnabled; public static bool otherEnabled; public static bool ReadConfigFile() { modEnabled = config("1 - Main Mod", "Enable Main Mod", value: true, "Enable Marsarah Mod").Value; serverConfigLocked = config("1 - Main Mod", "Lock Configuration", value: true, "If on, only server admins can change the configuration."); configSync.AddLockingConfigEntry<bool>(serverConfigLocked); if (modEnabled) { cheaperGearEnabled = config("2 - Grindyness Reduction", "Cheaper Gear Recipes", value: true, "Reduces costs for crafting and upgrading gear (especially metal)").Value; doubleBronzeEnabled = config("2 - Grindyness Reduction", "Double Bronze Crafting", value: true, "Doubles the amount of crafted Bronze at the Forge").Value; cheaperBuildPiecesEnabled = config("2 - Grindyness Reduction", "Cheaper Build Pieces", value: true, "Reduces costs for build pieces").Value; altCookingRecipesEnabled = config("2 - Grindyness Reduction", "Alternate Cooking Recipes", value: true, "Modifies food recipes costs and crafted amounts").Value; altMeadRecipesEnabled = config("2 - Grindyness Reduction", "Alternate Mead Recipes", value: true, "Modifies mead recipes costs and crafted amounts").Value; moreFoodStacksEnabled = config("2 - Grindyness Reduction", "More Food Stacks", value: true, "Increases food item stacks to make them more uniform").Value; altGearRecipesEnabled = config("3 - Features", "Alt Gear Recipes", value: true, "Modifies gear recipe materials for some items (more materials from current biomes)").Value; altBuildPiecesMaterialsEnabled = config("3 - Features", "Alt Build Piece Materials", value: true, "Modifies build pieces materials (more materials from current biome)").Value; altLinenCapeEnabled = config("3 - Features", "Alt Linen & Lox Cape", value: true, "Moves Linen Cape to Swamp Era and adds poison resist to both capes").Value; altGearSpeedModifiersEnabled = config("3 - Features", "Alt Gear Speed Modifiers", value: true, "Gear speed penalty reduced (light armors have increased move speed, heavy armors have no penalty)").Value; altForsakenPowersEnabled = config("3 - Features", "Alt Forsaken Powers", value: true, "Reduce Forsaken Powers cooldowns and increase durations").Value; fasterCharacterSpeedEnabled = config("3 - Features", "Faster Character Speed", value: true, "Faster character jog, walk, swim and crouch speeds (run excluded)").Value; altStatusEffectsEnabled = config("3 - Features", "Alt Status Effects", value: true, "Wet effect and potions timers reduced to 1 min").Value; lessStaminaUsageEnabled = config("3 - Features", "Less Stamina Usage", value: true, "Less stamina usage in general").Value; moreArmorStatsEnabled = config("3 - Features", "More Armor Stats", value: true, "Heavy armor gives extra HP, light armor gives extra stamina").Value; mageGearGivesEitrEnabled = config("3 - Features", "Mage Gear Eitr", value: true, "Mage Gear Provides Base Eitr").Value; betterDeathRaiserEnabled = config("3 - Features", "Better Death Raiser", value: true, "Increases chance of summoning archers, and increases summoned skeleton speed").Value; betterSummonedSkeletonGearEnabled = config("3 - Features", "Better Summoned Skeleton Gear", value: true, "Summoned Skeletons have better looking gear (stats not affected)").Value; betterFrostStaffAccuracyEnabled = config("3 - Features", "Better Frost Staff Accuracy", value: true, "Improves Staff of Frost Accuracy").Value; reducedCrossbowsReloadTimeEnabled = config("3 - Features", "Reduced Crossbows Reload Time", value: true, "Crossbows Reload Time Reduced").Value; lessAshlandsEnemiesEnabled = config("3 - Features", "Less Ashlands Enemies", value: false, "Less Enemies in Ashlands").Value; gearUpgradeUnlockEnabled = config("3 - Features", "Gear Upgrade Unlock", value: true, "Unlock max levels for upgrading Mistlands and Ashlands gear, plus earlier max level upgrades for Leather and Bronze sets").Value; permanentLightsEnabled = config("3 - Features", "Permanent Lights", value: false, "Makes all light sources permanent, but the build costs use max fuel type").Value; clearMistlandsEnabled = config("3 - Features", "Clear Mistlands", value: true, "Clear Mistlands mist after defeating the Queen").Value; craftableChainEnabled = config("3 - Features", "Craftable Chain", value: true, "Chain craftable at Black Forge").Value; brighterLanternsEnabled = config("3 - Features", "Brighter Lanterns", value: true, "Dvergr lanterns are brighter").Value; lessFogEnabled = config("3 - Features", "Clearer Weather", value: true, "Reduces chance for mist and snowstorms").Value; creatureUnlevelerEnabled = config("3 - Features", "Creature Unleveler By Boss", value: true, "Increases chance of creatures to spawn with a star or two after defeating their relevant biome boss").Value; minibossWeightEnabled = config("3 - Features", "Hildir Weight Rewards", value: true, "Increases base carry weight by 25 when turning in Hildir chests (for each chest)").Value; extensionsChangesEnabled = config("3 - Features", "Station Extensions Changes", value: true, "Decreases space requirement for workstation extensions and increases build distance to workstations").Value; noFleeEnabled = config("3 - Features", "Stop Running Away", value: true, "Boars and Necks won't flee when alerted").Value; automaticProgressionHaltEnabled = config("3 - Features", "Progression Halt", value: true, "Creatures and objects do not drop any items unless the previous biome boss has been defeated.").Value; seekerSoldierTrophyEnabled = config("3 - Features", "Better Seeker Soldier Trophy Rate", value: true, "Increased Seeker Soldier trophy drop rate to 0.2 (from 0.05) for easier Queen summons.").Value; tougherShipsEnabled = config("3 - Features", "Tougher Ships", value: true, "Increases Ships HP. Raft: 300 -> 400, Karve: 500 -> 650, Longship: 1000 -> 1250, Drakkar: 3000 -> 4000").Value; otherEnabled = config("3 - Features", "Other Section", value: true, "Tankard costs reduced and Iron Nails crafting output doubled").Value; lighterMetalWeightEnabled = config("4 - QOL", "Lighter Metal Weight", value: true, "All metal (ore and bar) weight decreased to 8 (equal to Tin Ore)").Value; largerPickupAreaEnabled = config("4 - QOL", "Larger Pickup Area", value: true, "Item pickup area increased").Value; noSkillLowerOnDeathEnabled = config("4 - QOL", "No Skill Lower On Death", value: true, "Skills won't go down the current level upon death (progress in that skill is still lost)").Value; largerBoatExploreRadiusEnabled = config("4 - QOL", "Larger Boat Explore Radius", value: true, "Larger explore radius on a boat").Value; biggerWhispRadiusEnabled = config("4 - QOL", "Bigger Wisp Radius", value: true, "Increases wisp radius").Value; friendlyBallistasEnabled = config("4 - QOL", "Friendly Ballistas", value: true, "Ballistas won't target players and tame animals").Value; lessFallDamageEnabled = config("4 - QOL", "Less Fall Damage", value: true, "Fall damage reduced by 40%").Value; fasterResourceDropsEnabled = config("4 - QOL", "Faster Resource Drops", value: true, "Enemies drop resources faster when dying").Value; fasterEquipEnabled = config("4 - QOL", "Faster Equip", value: false, "Equipping weapons is instant. Armor equip timers reduced to 1s (from 1s/2s)").Value; instantEatAndDrinkEnabled = config("4 - QOL", "Instant Eat And Drink", value: false, "Eating food and drinking meads is instant (Skips animation completely)").Value; altLoadingTipsEnabled = config("5 - UI", "Alt Loading Tips", value: true, "More loading screen tips").Value; showInventoryWeight = config("5 - UI", "Show Inventory Weight", value: true, "Show inventory weight").Value; showInventorySlots = config("5 - UI", "Show Inventory Slots", value: true, "Show free inventory slots").Value; showBoatSpeed = config("5 - UI", "Show Boat Speed", value: true, "Show boat speed (only when driving a boat)").Value; showTimeAndDay = config("5 - UI", "Show Time And Day", value: true, "Show time and day").Value; timeFormat24H = config("5 - UI", "Show Time And Day - 24 Hour Format", value: false, "Use 24 Hour time format").Value; smartBiomeEnabled = config("5 - UI", "Show Smart Biome", value: true, "Show smart biome text on minimap (colored according to armor value)").Value; showEnemyDetector = config("5 - UI", "Show Enemy Detector", value: true, "Show enemy detector").Value; showSummonCounter = config("5 - UI", "Show Summon Counter", value: true, "Show number of summoned skeletons from the Dead Raiser").Value; showOnlinePartyIndicator = config("5 - UI", "Show Online Party Indicator", value: true, "Show online players").Value; partyIndicatorUnderMinimap = config("5 - UI", "Show Online Party Indicator - Indicator Under Minimap", value: false, "Show online players under minimap").Value; hideOnlineIndicatorWhenSolo = config("5 - UI", "Show Online Party Indicator - Hide Online Indicator When Solo", value: true, "Hide online players when alone in world").Value; } return true; } private static ConfigEntry<T> config<T>(string group, string name, T value, string description, bool synchronizedSetting = true) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()); ConfigEntry<T> val2 = configBase.Bind<T>(group, name, value, val); SyncedConfigEntry<T> syncedConfigEntry = configSync.AddConfigEntry<T>(val2); syncedConfigEntry.SynchronizedConfig = synchronizedSetting; return val2; } } [BepInPlugin("marsarah.MarsarahMod", "Marsarah Mod", "5.5.3")] public class MarsarahMod : BaseUnityPlugin { internal const string ModName = "MarsarahMod"; internal const string ModVersion = "5.5.3"; internal const string Author = "Marsarah"; public const string ModGUID = "Marsarah.MarsarahMod"; public static string ConfigFileName = "Marsarah.MarsarahMod.cfg"; public static string ConfigFileFullPath; private readonly Harmony harmony = new Harmony("Marsarah.MarsarahMod"); private void Awake() { MMConfigManager.configBase = ((BaseUnityPlugin)this).Config; MMConfigManager.ReadConfigFile(); if (MMConfigManager.modEnabled) { MMShared.InitializeSharedSata(); MMDeathRaiserChanges.InitializeDeathRaiserData(); MMArmorStats.InitializeArmorStatsData(); MMUIChanges.InitializeUIData(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Marsarah.MarsarahMod"); SetupWatcher(); } else { MModLog("MarsarahMod is disabled..."); } } 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 { MModLog("ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { MModLog("There was an issue loading " + ConfigFileName); } } private void Update() { UpdateUIDisplay(); UpdateEnemyDetector(); UpdateSummonsCounter(); UpdatePlayerArmor(); UpdateUITime(); } private void UpdateUIDisplay() { if (MMConfigManager.modEnabled && Input.GetKeyDown((KeyCode)277)) { MMShared.showUI = !MMShared.showUI; } } private void UpdateEnemyDetector() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 if (!MMConfigManager.modEnabled || !MMConfigManager.showEnemyDetector || !Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } int num = 0; int num2 = 0; List<Character> list = new List<Character>(); Character.GetCharactersInRange(((Component)Player.m_localPlayer).transform.position, 30f, list); foreach (Character item in list) { if ((int)item.GetFaction() == 10 && (Object)(object)item.GetBaseAI() != (Object)null && !item.GetBaseAI().IsAggravated()) { num2++; } if (item.m_name.ToString() == "Human" || item.m_name.ToString() == "$enemy_deer" || item.m_name.ToString() == "$enemy_hare" || item.m_name.ToString() == "$enemy_summonedroot" || item.IsTamed()) { num++; } } MMShared.numEnemies = list.Count - num - num2; MMShared.numEnemiesPassive = num2; } private void UpdateSummonsCounter() { if (!MMConfigManager.modEnabled || !MMConfigManager.showSummonCounter || !Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } List<Character> allCharacters = Character.GetAllCharacters(); int num = 0; foreach (Character item in allCharacters) { if (!item.IsTamed()) { continue; } MonsterAI component = ((Component)item).GetComponent<MonsterAI>(); if (component == null) { continue; } GameObject followTarget = component.GetFollowTarget(); if (followTarget != null) { Player component2 = followTarget.GetComponent<Player>(); if (component2 != null && component2.GetPlayerName() == Player.m_localPlayer.GetPlayerName()) { num++; } } } MMShared.numSummons = num; } private void UpdatePlayerArmor() { if (MMConfigManager.modEnabled && Object.op_Implicit((Object)(object)Player.m_localPlayer) && MMConfigManager.smartBiomeEnabled && MMShared.showUI) { MMShared.playerArmor = ((Character)Player.m_localPlayer).GetBodyArmor(); } } private void UpdateUITime() { if (!MMConfigManager.showTimeAndDay) { return; } float num = 0f; if (Object.op_Implicit((Object)(object)EnvMan.instance)) { num = (float)typeof(EnvMan).GetField("m_smoothDayFraction", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(EnvMan.instance); MMShared.currentDay = Traverse.Create((object)EnvMan.instance).Method("GetCurrentDay", Array.Empty<object>()).GetValue<int>(); } if (!MMConfigManager.timeFormat24H) { if (num < 0.2f) { MMShared.dayString = "Night"; } else if (num < 0.25f) { MMShared.dayString = "Dawn"; } else if (num < 0.33f) { MMShared.dayString = "Morning"; } else if (num < 0.5f) { MMShared.dayString = "Day"; } else if (num < 0.66f) { MMShared.dayString = "Afternoon"; } else if (num < 0.75f) { MMShared.dayString = "Evening"; } else if (num < 0.8f) { MMShared.dayString = "Dusk"; } else { MMShared.dayString = "Night"; } } else { int num2 = (int)(num * 24f); int num3 = (int)((num * 24f - (float)num2) * 60f); string text = ((num2 < 10) ? ("0" + num2) : num2.ToString()); string text2 = ((num3 < 10) ? ("0" + num3) : num3.ToString()); MMShared.dayString = "Time " + text + ":" + text2; } } public static void MModLog(string log, bool header = false, bool footer = false) { if (header) { Debug.Log((object)"==================================================="); } Debug.Log((object)("[Marsarah Mod] : " + log)); if (footer) { Debug.Log((object)"==================================================="); } } static MarsarahMod() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; } } internal class MMDeathRaiserChanges { [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class BetterDeathRaiser_Equipment_Patch { private static void Postfix(ZNetScene __instance) { if (!Object.op_Implicit((Object)(object)__instance) || !MMConfigManager.betterSummonedSkeletonGearEnabled) { return; } for (int i = 0; i < summonedSkeletonArmorsWarrior.Length; i++) { if ((Object)(object)summonedSkeletonArmorWarriorObjects[i] == (Object)null) { summonedSkeletonArmorWarriorObjects[i] = ZNetScene.instance.GetPrefab(summonedSkeletonArmorsWarrior[i]); } } for (int j = 0; j < summonedSkeletonArmorsBowman.Length; j++) { if ((Object)(object)summonedSkeletonArmorBowmanObjects[j] == (Object)null) { summonedSkeletonArmorBowmanObjects[j] = ZNetScene.instance.GetPrefab(summonedSkeletonArmorsBowman[j]); } } for (int k = 0; k < summonedSkeletonWeapons.Length; k++) { if ((Object)(object)summonedSkeletonWeaponsObjects[k] == (Object)null) { summonedSkeletonWeaponsObjects[k] = ZNetScene.instance.GetPrefab(summonedSkeletonWeapons[k]); } } for (int l = 0; l < summonedSkeletonShields.Length; l++) { if ((Object)(object)summonedSkeletonShieldsObjects[l] == (Object)null) { summonedSkeletonShieldsObjects[l] = ZNetScene.instance.GetPrefab(summonedSkeletonShields[l]); } } for (int m = 0; m < summonedSkeletonBows.Length; m++) { if ((Object)(object)summonedSkeletonBowsObjects[m] == (Object)null) { summonedSkeletonBowsObjects[m] = ZNetScene.instance.GetPrefab(summonedSkeletonBows[m]); } } GameObject prefab = ZNetScene.instance.GetPrefab("skeleton_bow2"); if ((Object)(object)prefab != (Object)null) { bowAi = prefab.GetComponent<ItemDrop>(); } GameObject prefab2 = ZNetScene.instance.GetPrefab("skeleton_sword2"); if ((Object)(object)prefab != (Object)null) { swordAi = prefab2.GetComponent<ItemDrop>(); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] private class BetterDeathRaiserHPPercent_Patch { private static void Prefix(ref ObjectDB __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!MMConfigManager.betterDeathRaiserEnabled) { return; } ItemType[] array = (ItemType[])Enum.GetValues(typeof(ItemType)); ItemType val = (ItemType)0; bool flag = false; ItemType[] array2 = array; for (int i = 0; i < array2.Length; i++) { ItemType val2 = array2[i]; if (((object)(ItemType)(ref val2)).ToString() == "TwoHandedWeaponLeft") { val = val2; flag = true; } if (flag) { break; } } List<ItemDrop> allItems = __instance.GetAllItems(val, ""); foreach (ItemDrop item in allItems) { if (item.m_itemData.m_shared.m_name == "$item_staffskeleton") { item.m_itemData.m_shared.m_attack.m_attackHealthPercentage = 30f; break; } } } } [HarmonyPatch(typeof(Humanoid), "Awake")] private class BetterDeathRaiserSkeletonStatsAndRatio_Patch { private static void Prefix(Humanoid __instance, ref GameObject[] ___m_randomWeapon, ref GameObject[] ___m_randomShield) { if (!Object.op_Implicit((Object)(object)__instance) || !((Object)__instance).name.StartsWith("Skeleton_Friendly")) { return; } if (MMConfigManager.betterDeathRaiserEnabled) { if ((Object)(object)skeletonBow == (Object)null || (Object)(object)skeletonSword == (Object)null) { GameObject[] array = ___m_randomWeapon; foreach (GameObject val in array) { string name = ((Object)val).name; string text = name; if (!(text == "skeleton_sword2")) { if (text == "skeleton_bow2") { skeletonBow = val; } } else { skeletonSword = val; } } } ___m_randomWeapon[0] = skeletonSword; ___m_randomWeapon[1] = skeletonSword; ___m_randomWeapon[2] = skeletonBow; ___m_randomWeapon[3] = skeletonBow; ___m_randomWeapon[4] = skeletonBow; ((Character)__instance).m_speed = 4f; ((Character)__instance).m_runSpeed = 8f; } if (MMConfigManager.betterSummonedSkeletonGearEnabled) { if (MMConfigManager.betterDeathRaiserEnabled) { ___m_randomWeapon[0] = summonedSkeletonWeaponsObjects[0]; ___m_randomWeapon[1] = summonedSkeletonWeaponsObjects[1]; ___m_randomWeapon[2] = summonedSkeletonBowsObjects[0]; ___m_randomWeapon[3] = summonedSkeletonBowsObjects[1]; ___m_randomWeapon[4] = summonedSkeletonBowsObjects[2]; } else { ___m_randomWeapon[0] = summonedSkeletonWeaponsObjects[0]; ___m_randomWeapon[1] = summonedSkeletonWeaponsObjects[1]; ___m_randomWeapon[2] = summonedSkeletonBowsObjects[0]; ___m_randomWeapon[3] = summonedSkeletonWeaponsObjects[1]; ___m_randomWeapon[4] = summonedSkeletonWeaponsObjects[2]; } ___m_randomShield[0] = summonedSkeletonShieldsObjects[0]; ___m_randomShield[1] = summonedSkeletonShieldsObjects[1]; } } } [HarmonyPatch(typeof(Humanoid), "GiveDefaultItem")] private class BetterDeathRaiserSkeletonGiveItem_Patch { private static void Prefix(Humanoid __instance, ref GameObject prefab, ref bool __runOriginal) { if (MMConfigManager.betterSummonedSkeletonGearEnabled && Object.op_Implicit((Object)(object)__instance) && ((Object)__instance).name.StartsWith("Skeleton_Friendly")) { ItemData val = __instance.PickupPrefab(prefab, 0, false); if ((Object)(object)bowAi != (Object)null && (((Object)prefab).name == summonedSkeletonBows[0] || ((Object)prefab).name == summonedSkeletonBows[1] || ((Object)prefab).name == summonedSkeletonBows[2])) { val.m_shared = bowAi.m_itemData.m_shared; } if ((Object)(object)swordAi != (Object)null && (((Object)prefab).name == summonedSkeletonWeapons[0] || ((Object)prefab).name == summonedSkeletonWeapons[1])) { val.m_shared = swordAi.m_itemData.m_shared; } if (val != null && !val.IsWeapon()) { __instance.EquipItem(val, false); } if (((Object)prefab).name == summonedSkeletonWeapons[0] || ((Object)prefab).name == summonedSkeletonWeapons[1]) { for (int i = 0; i < summonedSkeletonArmorsWarrior.Length; i++) { giveItem(__instance, summonedSkeletonArmorWarriorObjects[i]); } } if (((Object)prefab).name == summonedSkeletonBows[0] || ((Object)prefab).name == summonedSkeletonBows[1] || ((Object)prefab).name == summonedSkeletonBows[2]) { for (int j = 0; j < summonedSkeletonArmorsBowman.Length; j++) { giveItem(__instance, summonedSkeletonArmorBowmanObjects[j]); } } __runOriginal = false; } else { __runOriginal = true; } } } private static ItemDrop swordAi; private static ItemDrop bowAi; private static GameObject skeletonSword; private static GameObject skeletonBow; private static GameObject[] summonedSkeletonArmorWarriorObjects; private static GameObject[] summonedSkeletonArmorBowmanObjects; private static GameObject[] summonedSkeletonWeaponsObjects; private static GameObject[] summonedSkeletonShieldsObjects; private static GameObject[] summonedSkeletonBowsObjects; private static string[] summonedSkeletonArmorsWarrior; private static string[] summonedSkeletonArmorsBowman; private static string[] summonedSkeletonWeapons; private static string[] summonedSkeletonShields; private static string[] summonedSkeletonBows; public static void InitializeDeathRaiserData() { swordAi = null; bowAi = null; skeletonSword = null; skeletonBow = null; summonedSkeletonArmorWarriorObjects = (GameObject[])(object)new GameObject[3]; summonedSkeletonArmorBowmanObjects = (GameObject[])(object)new GameObject[3]; summonedSkeletonWeaponsObjects = (GameObject[])(object)new GameObject[4]; summonedSkeletonShieldsObjects = (GameObject[])(object)new GameObject[2]; summonedSkeletonBowsObjects = (GameObject[])(object)new GameObject[3]; summonedSkeletonArmorsWarrior = new string[3] { "CapeLox", "ArmorCarapaceChest", "ArmorCarapaceLegs" }; summonedSkeletonArmorsBowman = new string[3] { "CapeFeather", "ArmorPaddedCuirass", "ArmorPaddedGreaves" }; summonedSkeletonWeapons = new string[2] { "SwordBlackmetal", "MaceNeedle" }; summonedSkeletonShields = new string[2] { "ShieldBlackmetal", "ShieldCarapace" }; summonedSkeletonBows = new string[3] { "BowHuntsman", "BowDraugrFang", "BowSpineSnap" }; } private static void giveItem(Humanoid human, GameObject prefab) { ItemData val = human.PickupPrefab(prefab, 0, false); if (val != null && !val.IsWeapon()) { human.EquipItem(val, false); } } } internal class MMFasterCharacterSpeed_TEMP { [HarmonyPatch(typeof(Character), "Awake")] private class FasterCharacterSpeed_Patch { private static void Prefix(ref float ___m_crouchSpeed, ref float ___m_walkSpeed, ref float ___m_speed, ref float ___m_swimSpeed) { if (MMConfigManager.fasterCharacterSpeedEnabled) { ___m_crouchSpeed = 2.2f; ___m_walkSpeed = 2.5f; ___m_speed = 5f; ___m_swimSpeed = 2.2f; } } } } internal class MMFoodAndMeadChanges { [HarmonyPatch(typeof(ObjectDB), "Awake")] private class FoodAndMeadChanges_Patch { private static void Postfix(ref ObjectDB __instance) { if ((Object)(object)__instance != (Object)null) { if (MMConfigManager.altCookingRecipesEnabled) { SetAltCookingRecipes(ref __instance); } if (MMConfigManager.moreFoodStacksEnabled) { SetMoreFoodStacks(ref __instance); } if (MMConfigManager.altMeadRecipesEnabled) { SetAltMeadRecipes(ref __instance); } } } } private static void SetAltCookingRecipes(ref ObjectDB objDB) { foreach (Recipe recipe in objDB.m_recipes) { switch (((Object)recipe).name) { case "Recipe_QueensJam": { Requirement[] resources5 = recipe.m_resources; foreach (Requirement val5 in resources5) { string name3 = ((Object)val5.m_resItem).name; string text3 = name3; if (!(text3 == "Raspberry")) { if (text3 == "Blueberries") { val5.m_amount = 5; } } else { val5.m_amount = 5; } } break; } case "Recipe_TurnipStew": recipe.m_amount = 2; break; case "Recipe_Blacksoup": { Requirement[] resources14 = recipe.m_resources; foreach (Requirement val14 in resources14) { switch (((Object)val14.m_resItem).name) { case "Bloodbag": val14.m_amount = 2; break; case "Honey": val14.m_amount = 2; break; case "Turnip": val14.m_amount = 2; break; } } recipe.m_amount = 2; break; } case "Recipe_CarrotSoup": recipe.m_amount = 2; break; case "Recipe_DeerStew": { Requirement[] resources20 = recipe.m_resources; foreach (Requirement val20 in resources20) { switch (((Object)val20.m_resItem).name) { case "CookedDeerMeat": val20.m_amount = 2; break; case "Blueberries": val20.m_amount = 2; break; case "Carrot": val20.m_amount = 2; break; } } recipe.m_amount = 2; break; } case "Recipe_ShocklateSmoothie": recipe.m_amount = 2; break; case "Recipe_MinceMeatSauce": { Requirement[] resources11 = recipe.m_resources; foreach (Requirement val11 in resources11) { switch (((Object)val11.m_resItem).name) { case "RawMeat": val11.m_amount = 2; break; case "NeckTail": val11.m_amount = 2; break; case "Carrot": val11.m_amount = 2; break; } } recipe.m_amount = 2; break; } case "Recipe_Eyescream": recipe.m_amount = 2; break; case "Recipe_Onionsoup": recipe.m_amount = 2; break; case "Recipe_WolfSkewer": { Requirement[] resources2 = recipe.m_resources; foreach (Requirement val2 in resources2) { string name2 = ((Object)val2.m_resItem).name; string text2 = name2; if (!(text2 == "WolfMeat")) { if (text2 == "Onion") { val2.m_amount = 2; } } else { val2.m_amount = 2; } } recipe.m_amount = 2; break; } case "Recipe_SerpentStew": { Requirement[] resources18 = recipe.m_resources; foreach (Requirement val18 in resources18) { string name11 = ((Object)val18.m_resItem).name; string text11 = name11; if (!(text11 == "Mushroom")) { if (text11 == "SerpentMeatCooked") { val18.m_amount = 2; } } else { val18.m_amount = 2; } } recipe.m_amount = 2; break; } case "Recipe_BloodPudding": recipe.m_amount = 2; break; case "Recipe_FishWraps": recipe.m_amount = 2; break; case "Recipe_FishAndBread": recipe.m_amount = 2; break; case "Recipe_LoxPie": recipe.m_amount = 2; break; case "Recipe_Bread": { Requirement[] resources13 = recipe.m_resources; foreach (Requirement val13 in resources13) { string name8 = ((Object)val13.m_resItem).name; string text8 = name8; if (text8 == "BarleyFlour") { val13.m_amount = 6; } } break; } case "Recipe_HoneyGlazedChicken": { Requirement[] resources9 = recipe.m_resources; foreach (Requirement val9 in resources9) { string name5 = ((Object)val9.m_resItem).name; string text5 = name5; if (text5 == "ChickenMeat") { val9.m_amount = 2; } } recipe.m_amount = 2; break; } case "Recipe_MagicallyStuffedShroom": { Requirement[] resources7 = recipe.m_resources; foreach (Requirement val7 in resources7) { string name4 = ((Object)val7.m_resItem).name; string text4 = name4; if (text4 == "GiantBloodSack") { val7.m_amount = 2; } } recipe.m_amount = 2; break; } case "Recipe_MeatPlatter": { Requirement[] resources3 = recipe.m_resources; foreach (Requirement val3 in resources3) { switch (((Object)val3.m_resItem).name) { case "BugMeat": case "LoxMeat": case "HareMeat": val3.m_amount = 2; break; } } recipe.m_amount = 2; break; } case "Recipe_MisthareSupreme": { Requirement[] resources19 = recipe.m_resources; foreach (Requirement val19 in resources19) { string name1
BepInEx/plugins/RustyMods-CustomBanners/CustomBanners.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CustomBanners.CloneBanners; using CustomBanners.Managers; using HarmonyLib; using JetBrains.Annotations; using Microsoft.CodeAnalysis; using PieceManager; using ServerSync; using TMPro; using UnityEngine; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; 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("CustomBanners")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("CustomBanners")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.0.9")] [assembly: AssemblyCompany("RustyMods")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.9.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<2dd38463-91fe-466d-a2d4-c89173de7848>Embedded] internal sealed class <2dd38463-91fe-466d-a2d4-c89173de7848>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [<2dd38463-91fe-466d-a2d4-c89173de7848>Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class <1026c029-dcb1-493b-a941-4adc8a04a8c0>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <1026c029-dcb1-493b-a941-4adc8a04a8c0>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <1026c029-dcb1-493b-a941-4adc8a04a8c0>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [<2dd38463-91fe-466d-a2d4-c89173de7848>Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class <845a9831-97cf-404f-914b-d01d6b09b622>NullableContextAttribute : Attribute { public readonly byte Flag; public <845a9831-97cf-404f-914b-d01d6b09b622>NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace PieceManager { [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [PublicAPI] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public static class MaterialReplacer { [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] public enum ShaderType { PieceShader, VegetationShader, RockShader, RugShader, GrassShader, CustomCreature, UseUnityShader } private static readonly Dictionary<GameObject, bool> ObjectToSwap; public static readonly Dictionary<string, Material> OriginalMaterials; private static readonly Dictionary<GameObject, ShaderType> ObjectsForShaderReplace; public static readonly HashSet<Shader> CachedShaders; private static bool hasRun; static MaterialReplacer() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown CachedShaders = new HashSet<Shader>(); hasRun = false; OriginalMaterials = new Dictionary<string, Material>(); ObjectToSwap = new Dictionary<GameObject, bool>(); ObjectsForShaderReplace = new Dictionary<GameObject, ShaderType>(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZoneSystem), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MaterialReplacer), "ReplaceAllMaterialsWithOriginal", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void RegisterGameObjectForShaderSwap(GameObject go, ShaderType type) { if (!ObjectsForShaderReplace.ContainsKey(go)) { ObjectsForShaderReplace.Add(go, type); } } public static void RegisterGameObjectForMatSwap(GameObject go, bool isJotunnMock = false) { if (!ObjectToSwap.ContainsKey(go)) { ObjectToSwap.Add(go, isJotunnMock); } } public static void GetAllMaterials() { Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val in array) { OriginalMaterials[((Object)val).name] = val; } } [HarmonyPriority(700)] private static void ReplaceAllMaterialsWithOriginal() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)SystemInfo.graphicsDeviceType == 4 || hasRun) { return; } if (OriginalMaterials.Count == 0) { GetAllMaterials(); } foreach (KeyValuePair<GameObject, bool> item in ObjectToSwap) { GameObject key = item.Key; bool value = item.Value; ProcessGameObjectMaterials(key, value); } AssetBundle[] array = Resources.FindObjectsOfTypeAll<AssetBundle>(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { IEnumerable<Shader> enumerable3; try { IEnumerable<Shader> enumerable2; if (!val.isStreamedSceneAssetBundle || !Object.op_Implicit((Object)(object)val)) { IEnumerable<Shader> enumerable = val.LoadAllAssets<Shader>(); enumerable2 = enumerable; } else { enumerable2 = from shader in ((IEnumerable<string>)val.GetAllAssetNames()).Select((Func<string, Shader>)val.LoadAsset<Shader>) where (Object)(object)shader != (Object)null select shader; } enumerable3 = enumerable2; } catch (Exception) { continue; } if (enumerable3 == null) { continue; } foreach (Shader item2 in enumerable3) { CachedShaders.Add(item2); } } foreach (KeyValuePair<GameObject, ShaderType> item3 in ObjectsForShaderReplace) { GameObject key2 = item3.Key; ShaderType value2 = item3.Value; ProcessGameObjectShaders(key2, value2); } hasRun = true; } private static void ProcessGameObjectMaterials(GameObject go, bool isJotunnMock) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials.Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Material material) => ReplaceMaterial(material, isJotunnMock)).ToArray(); val.sharedMaterials = sharedMaterials; } } private static Material ReplaceMaterial(Material originalMaterial, bool isJotunnMock) { string text = (isJotunnMock ? "JVLmock_" : "_REPLACE_"); if (!((Object)originalMaterial).name.StartsWith(text, StringComparison.Ordinal)) { return originalMaterial; } string text2 = ((Object)originalMaterial).name.Replace(" (Instance)", "").Replace(text, ""); if (OriginalMaterials.TryGetValue(text2, out var value)) { return value; } Debug.LogWarning((object)("No suitable material found to replace: " + text2)); return originalMaterial; } private static void ProcessGameObjectShaders(GameObject go, ShaderType shaderType) { Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; foreach (Material val2 in sharedMaterials) { if ((Object)(object)val2 != (Object)null) { val2.shader = GetShaderForType(val2.shader, shaderType, ((Object)val2.shader).name); } } } } public static Shader GetShaderForType(Shader orig, ShaderType shaderType, string originalShaderName) { return (Shader)(shaderType switch { ShaderType.PieceShader => FindShaderWithName(orig, "Custom/Piece"), ShaderType.VegetationShader => FindShaderWithName(orig, "Custom/Vegetation"), ShaderType.RockShader => FindShaderWithName(orig, "Custom/StaticRock"), ShaderType.RugShader => FindShaderWithName(orig, "Custom/Rug"), ShaderType.GrassShader => FindShaderWithName(orig, "Custom/Grass"), ShaderType.CustomCreature => FindShaderWithName(orig, "Custom/Creature"), ShaderType.UseUnityShader => FindShaderWithName(orig, ((Object)(object)FindShaderWithName(orig, originalShaderName) != (Object)null) ? originalShaderName : "ToonDeferredShading2017"), _ => FindShaderWithName(orig, "Standard"), }); } public static Shader FindShaderWithName(Shader origShader, string name) { foreach (Shader cachedShader in CachedShaders) { if (((Object)cachedShader).name == name) { return cachedShader; } } return origShader; } } [PublicAPI] public enum CraftingTable { None, [InternalName("piece_workbench")] Workbench, [InternalName("piece_cauldron")] Cauldron, [InternalName("forge")] Forge, [InternalName("piece_artisanstation")] ArtisanTable, [InternalName("piece_stonecutter")] StoneCutter, [InternalName("piece_magetable")] MageTable, [InternalName("blackforge")] BlackForge, [InternalName("piece_preptable")] FoodPreparationTable, [InternalName("piece_MeadCauldron")] MeadKetill, Custom } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class InternalName : Attribute { public readonly string internalName; public InternalName(string internalName) { this.internalName = internalName; } } [PublicAPI] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class ExtensionList { public readonly List<ExtensionConfig> ExtensionStations = new List<ExtensionConfig>(); public void Set(CraftingTable table, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = table, maxStationDistance = maxStationDistance }); } public void Set(string customTable, int maxStationDistance = 5) { ExtensionStations.Add(new ExtensionConfig { Table = CraftingTable.Custom, custom = customTable, maxStationDistance = maxStationDistance }); } } public struct ExtensionConfig { public CraftingTable Table; public float maxStationDistance; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public string custom; } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [PublicAPI] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class CraftingStationList { public readonly List<CraftingStationConfig> Stations = new List<CraftingStationConfig>(); public void Set(CraftingTable table) { Stations.Add(new CraftingStationConfig { Table = table }); } public void Set(string customTable) { Stations.Add(new CraftingStationConfig { Table = CraftingTable.Custom, custom = customTable }); } } public struct CraftingStationConfig { public CraftingTable Table; public int level; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public string custom; } [PublicAPI] public enum BuildPieceCategory { Misc = 0, Crafting = 1, BuildingWorkbench = 2, BuildingStonecutter = 3, Furniture = 4, All = 100, Custom = 99 } [PublicAPI] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class RequiredResourcesList { public readonly List<Requirement> Requirements = new List<Requirement>(); public void Add(string item, int amount, bool recover) { Requirements.Add(new Requirement { itemName = item, amount = amount, recover = recover }); } } public struct Requirement { [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(1)] public string itemName; public int amount; public bool recover; } public struct SpecialProperties { [Description("Admins should be the only ones that can build this piece.")] public bool AdminOnly; [Description("Turns off generating a config for this build piece.")] public bool NoConfig; } [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [PublicAPI] public class BuildingPieceCategory { public BuildPieceCategory Category; public string custom = ""; public void Set(BuildPieceCategory category) { Category = category; } public void Set(string customCategory) { Category = BuildPieceCategory.Custom; custom = customCategory; } } [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] [PublicAPI] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] public class PieceTool { public readonly HashSet<string> Tools = new HashSet<string>(); public void Add(string tool) { Tools.Add(tool); } } [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [PublicAPI] public class BuildPiece { [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] public class PieceConfig { public ConfigEntry<string> craft = null; public ConfigEntry<BuildPieceCategory> category = null; public ConfigEntry<string> customCategory = null; public ConfigEntry<string> tools = null; public ConfigEntry<CraftingTable> extensionTable = null; public ConfigEntry<string> customExtentionTable = null; public ConfigEntry<float> maxStationDistance = null; public ConfigEntry<CraftingTable> table = null; public ConfigEntry<string> customTable = null; } [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] public class ConfigurationManagerAttributes { [UsedImplicitly] public int? Order; [UsedImplicitly] public bool? Browsable; [UsedImplicitly] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public string Category; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(new byte[] { 2, 1 })] [UsedImplicitly] public Action<ConfigEntryBase> CustomDrawer; } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] public class SerializedRequirements { public readonly List<Requirement> Reqs; public SerializedRequirements(List<Requirement> reqs) { Reqs = reqs; } public SerializedRequirements(string reqs) { Reqs = reqs.Split(new char[1] { ',' }).Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (string r) => { string[] array = r.Split(new char[1] { ':' }); Requirement result = default(Requirement); result.itemName = array[0]; result.amount = ((array.Length <= 1 || !int.TryParse(array[1], out var result2)) ? 1 : result2); bool result3 = default(bool); result.recover = array.Length <= 2 || !bool.TryParse(array[2], out result3) || result3; return result; }).ToList(); } public override string ToString() { return string.Join(",", Reqs.Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Requirement r) => $"{r.itemName}:{r.amount}:{r.recover}")); } [return: <1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public static ItemDrop fetchByName(ObjectDB objectDB, string name) { GameObject itemPrefab = objectDB.GetItemPrefab(name); ItemDrop val = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)(((!string.IsNullOrWhiteSpace(((Object)plugin).name)) ? ("[" + ((Object)plugin).name + "]") : "") + " The required item '" + name + "' does not exist.")); } return val; } public static Requirement[] toPieceReqs(SerializedRequirements craft) { Dictionary<string, Requirement> dictionary = craft.Reqs.Where((Requirement r) => r.itemName != "").ToDictionary((Func<Requirement, string>)([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Requirement r) => r.itemName), (Func<Requirement, Requirement>)([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Requirement r) => { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDrop val = ResItem(r); return (val == null) ? ((Requirement)null) : new Requirement { m_amount = r.amount, m_resItem = val, m_recover = r.recover }; })); return dictionary.Values.Where([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Requirement v) => v != null).ToArray(); [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(2)] static ItemDrop ResItem(Requirement r) { return fetchByName(ObjectDB.instance, r.itemName); } } } public static readonly List<BuildPiece> registeredPieces = new List<BuildPiece>(); private static readonly Dictionary<Piece, BuildPiece> pieceMap = new Dictionary<Piece, BuildPiece>(); public static readonly Dictionary<string, BuildPiece> buildPieceMap = new Dictionary<string, BuildPiece>(); public static Dictionary<BuildPiece, PieceConfig> pieceConfigs = new Dictionary<BuildPiece, PieceConfig>(); internal List<Conversion> Conversions = new List<Conversion>(); internal List<ItemConversion> conversions = new List<ItemConversion>(); [Description("Disables generation of the configs for your pieces. This is global, this turns it off for all pieces in your mod.")] public static bool ConfigurationEnabled = true; public readonly GameObject Prefab; public List<string> PlaceEffects = new List<string>(); public List<string> HitEffects = new List<string>(); public List<string> DestroyedEffects = new List<string>(); public List<string> SwitchEffects = new List<string>(); public List<string> RandomSpeakEffects = new List<string>(); public List<string> OpenEffects = new List<string>(); public List<string> CloseEffects = new List<string>(); public string CloneDoorEffectsFrom = ""; public string KeyItem = ""; public string CloneBossStoneEffectsFrom = ""; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public StatusEffect GuardianPower; public string BossTrophy = ""; [Description("Specifies the resources needed to craft the piece.\nUse .Add to add resources with their internal ID and an amount.\nUse one .Add for each resource type the building piece should need.")] public readonly RequiredResourcesList RequiredItems = new RequiredResourcesList(); [Description("Sets the category for the building piece.")] public readonly BuildingPieceCategory Category = new BuildingPieceCategory(); [Description("Specifies the tool needed to build your piece.\nUse .Add to add a tool.")] public readonly PieceTool Tool = new PieceTool(); [Description("Specifies the crafting station needed to build your piece.\nUse .Add to add a crafting station, using the CraftingTable enum and a minimum level for the crafting station.")] public CraftingStationList Crafting = new CraftingStationList(); [Description("Makes this piece a station extension")] public ExtensionList Extension = new ExtensionList(); [Description("Change the extended/special properties of your build piece.")] public SpecialProperties SpecialProperties; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] [Description("Specifies a config entry which toggles whether a recipe is active.")] public ConfigEntryBase RecipeIsActive = null; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] private LocalizeKey _name; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] private LocalizeKey _description; internal string[] activeTools = null; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] public static object configManager; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] private static Localization _english; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] internal static BaseUnityPlugin _plugin = null; private static bool hasConfigSync = true; [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] private static object _configSync; public LocalizeKey Name { get { LocalizeKey name = _name; if (name != null) { return name; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_name.StartsWith("$")) { _name = new LocalizeKey(component.m_name); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_"); _name = new LocalizeKey(text).English(component.m_name); component.m_name = text; } return _name; } } public LocalizeKey Description { get { LocalizeKey description = _description; if (description != null) { return description; } Piece component = Prefab.GetComponent<Piece>(); if (component.m_description.StartsWith("$")) { _description = new LocalizeKey(component.m_description); } else { string text = "$piece_" + ((Object)Prefab).name.Replace(" ", "_") + "_description"; _description = new LocalizeKey(text).English(component.m_description); component.m_description = text; } return _description; } } public static Localization english => _english ?? (_english = LocalizationCache.ForLanguage("English")); internal static BaseUnityPlugin plugin { get { //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (_plugin != null) { return _plugin; } 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([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (TypeInfo t) => t.IsClass && typeof(BaseUnityPlugin).IsAssignableFrom(t))); return _plugin; } } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] private static object configSync { [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(2)] get { if (_configSync != null || !hasConfigSync) { return _configSync; } Type type = Assembly.GetExecutingAssembly().GetType("ServerSync.ConfigSync"); if ((object)type != null) { _configSync = Activator.CreateInstance(type, plugin.Info.Metadata.GUID + " PieceManager"); type.GetField("CurrentVersion").SetValue(_configSync, plugin.Info.Metadata.Version.ToString()); type.GetProperty("IsLocked").SetValue(_configSync, true); } else { hasConfigSync = false; } return _configSync; } } public void UpdateEffects() { UpdateEffectList(PlaceEffects, ref Prefab.GetComponent<Piece>().m_placeEffect); RandomSpeak val = default(RandomSpeak); if (Prefab.TryGetComponent<RandomSpeak>(ref val)) { UpdateEffectList(RandomSpeakEffects, ref val.m_speakEffects); } WearNTear val2 = default(WearNTear); if (Prefab.TryGetComponent<WearNTear>(ref val2)) { UpdateEffectList(DestroyedEffects, ref val2.m_destroyedEffect); UpdateEffectList(HitEffects, ref val2.m_hitEffect); UpdateEffectList(SwitchEffects, ref val2.m_switchEffect); } Container val3 = default(Container); if (Prefab.TryGetComponent<Container>(ref val3)) { UpdateEffectList(OpenEffects, ref val3.m_openEffects); UpdateEffectList(CloseEffects, ref val3.m_closeEffects); } Door val4 = default(Door); if (Object.op_Implicit((Object)(object)ZNetScene.instance) && !Utility.IsNullOrWhiteSpace(CloneDoorEffectsFrom) && Prefab.TryGetComponent<Door>(ref val4)) { GameObject prefab = ZNetScene.instance.GetPrefab(CloneDoorEffectsFrom); Door val5 = default(Door); if (Object.op_Implicit((Object)(object)prefab) && prefab.TryGetComponent<Door>(ref val5)) { val4.m_openEffects = val5.m_openEffects; val4.m_closeEffects = val5.m_closeEffects; val4.m_lockedEffects = val5.m_lockedEffects; } if (!Utility.IsNullOrWhiteSpace(KeyItem)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(KeyItem); ItemDrop keyItem = default(ItemDrop); if (itemPrefab != null && itemPrefab.TryGetComponent<ItemDrop>(ref keyItem)) { val4.m_keyItem = keyItem; } } } BossStone val6 = default(BossStone); if (!Object.op_Implicit((Object)(object)ZNetScene.instance) || Utility.IsNullOrWhiteSpace(CloneBossStoneEffectsFrom) || !Prefab.TryGetComponent<BossStone>(ref val6)) { return; } ItemStand itemStand = val6.m_itemStand; if (itemStand == null) { return; } GameObject prefab2 = ZNetScene.instance.GetPrefab(CloneBossStoneEffectsFrom); BossStone val7 = default(BossStone); if (prefab2 == null || !prefab2.TryGetComponent<BossStone>(ref val7)) { return; } val6.m_activateStep1 = val7.m_activateStep1; val6.m_activateStep2 = val7.m_activateStep2; val6.m_activateStep3 = val7.m_activateStep3; ItemStand itemStand2 = val7.m_itemStand; if (itemStand2 == null) { return; } itemStand.m_effects = itemStand2.m_effects; itemStand.m_activatePowerEffects = itemStand2.m_activatePowerEffects; if (Utility.IsNullOrWhiteSpace(BossTrophy)) { return; } GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab(BossTrophy); ItemDrop val8 = default(ItemDrop); if (itemPrefab2 == null || !itemPrefab2.TryGetComponent<ItemDrop>(ref val8)) { return; } itemStand.m_supportedItems.Add(val8); StatusEffect guardianPower = GuardianPower; if (guardianPower != null) { guardianPower.m_icon = val8.m_itemData.GetIcon(); if (!ObjectDB.instance.m_StatusEffects.Contains(guardianPower)) { ObjectDB.instance.m_StatusEffects.Add(guardianPower); } itemStand.m_guardianPower = guardianPower; } } private static void UpdateEffectList(List<string> effects, ref EffectList list) { if (effects.Count != 0 && !((Object)(object)ZNetScene.instance == (Object)null)) { list.m_effectPrefabs = list.m_effectPrefabs.Concat((from effect in ((IEnumerable<string>)effects).Select((Func<string, GameObject>)ZNetScene.instance.GetPrefab) where (Object)(object)effect != (Object)null select effect).Select((Func<GameObject, EffectData>)([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (GameObject effect) => new EffectData { m_prefab = effect, m_enabled = true }))).ToArray(); } } public BuildPiece(string assetBundleFileName, string prefabName, string folderName = "assets") : this(PiecePrefabManager.RegisterAssetBundle(assetBundleFileName, folderName), prefabName) { } public BuildPiece(AssetBundle bundle, string prefabName) { Prefab = PiecePrefabManager.RegisterPrefab(bundle, prefabName); registeredPieces.Add(this); buildPieceMap[prefabName] = this; } public BuildPiece(GameObject prefab) { Prefab = prefab; } internal static void Patch_FejdStartup(FejdStartup __instance) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Expected O, but got Unknown //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Expected O, but got Unknown //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Expected O, but got Unknown //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Expected O, but got Unknown //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Expected O, but got Unknown //IL_0b7e: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Expected O, but got Unknown //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0c22: Expected O, but got Unknown Type configManagerType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager"); configManager = ((configManagerType == null) ? null : Chainloader.ManagerObject.GetComponent(configManagerType)); foreach (BuildPiece registeredPiece in registeredPieces) { registeredPiece.activeTools = registeredPiece.Tool.Tools.DefaultIfEmpty("Hammer").ToArray(); if (registeredPiece.Category.Category != BuildPieceCategory.Custom) { registeredPiece.Prefab.GetComponent<Piece>().m_category = (PieceCategory)registeredPiece.Category.Category; } else { registeredPiece.Prefab.GetComponent<Piece>().m_category = PiecePrefabManager.GetCategory(registeredPiece.Category.custom); } } if (!ConfigurationEnabled) { return; } bool saveOnConfigSet = plugin.Config.SaveOnConfigSet; plugin.Config.SaveOnConfigSet = false; foreach (BuildPiece registeredPiece2 in registeredPieces) { BuildPiece piece = registeredPiece2; if (piece.SpecialProperties.NoConfig) { continue; } PieceConfig pieceConfig2 = (pieceConfigs[piece] = new PieceConfig()); PieceConfig cfg = pieceConfig2; Piece piecePrefab2 = piece.Prefab.GetComponent<Piece>(); string pieceName = piecePrefab2.m_name; string englishName = new Regex("[=\\n\\t\\\\\"\\'\\[\\]]*").Replace(english.Localize(pieceName), "").Trim(); string localizedName = Localization.instance.Localize(pieceName).Trim(); int order = 0; cfg.category = config(englishName, "Build Table Category", piece.Category.Category, new ConfigDescription("Build Category where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Order = (order -= 1), Category = localizedName } })); ConfigurationManagerAttributes customTableAttributes = new ConfigurationManagerAttributes { Order = (order -= 1), Browsable = (cfg.category.Value == BuildPieceCategory.Custom), Category = localizedName }; cfg.customCategory = config(englishName, "Custom Build Category", piece.Category.custom, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.category.SettingChanged += BuildTableConfigChanged; cfg.customCategory.SettingChanged += BuildTableConfigChanged; if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab2.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab2.m_category = (PieceCategory)cfg.category.Value; } cfg.tools = config(englishName, "Tools", string.Join(", ", piece.activeTools), new ConfigDescription("Comma separated list of tools where " + localizedName + " is available.", (AcceptableValueBase)null, new object[1] { customTableAttributes })); piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); cfg.tools.SettingChanged += [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (object _, EventArgs _) => { Inventory[] source = (from c in Player.s_players.Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Player p) => ((Humanoid)p).GetInventory()).Concat(from c in Object.FindObjectsOfType<Container>() select c.GetInventory()) where c != null select c).ToArray(); Dictionary<string, List<PieceTable>> dictionary = (from kv in (from i in (from p in ObjectDB.instance.m_items select p.GetComponent<ItemDrop>() into c where Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((Component)c).GetComponent<ZNetView>()) select c).Concat(ItemDrop.s_instances) select new KeyValuePair<string, ItemData>(Utils.GetPrefabName(((Component)i).gameObject), i.m_itemData)).Concat(from i in source.SelectMany([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Inventory i) => i.GetAllItems()) select new KeyValuePair<string, ItemData>(((Object)i.m_dropPrefab).name, i)) where Object.op_Implicit((Object)(object)kv.Value.m_shared.m_buildPieces) group kv by kv.Key).ToDictionary([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Key, [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (IGrouping<string, KeyValuePair<string, ItemData>> g) => g.Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (KeyValuePair<string, ItemData> kv) => kv.Value.m_shared.m_buildPieces).Distinct().ToList()); string[] array5 = piece.activeTools; foreach (string key in array5) { if (dictionary.TryGetValue(key, out var value3)) { foreach (PieceTable item3 in value3) { item3.m_pieces.Remove(piece.Prefab); } } } piece.activeTools = (from s in cfg.tools.Value.Split(new char[1] { ',' }) select s.Trim()).ToArray(); if (Object.op_Implicit((Object)(object)ObjectDB.instance)) { string[] array6 = piece.activeTools; foreach (string key2 in array6) { if (dictionary.TryGetValue(key2, out var value4)) { foreach (PieceTable item4 in value4) { if (!item4.m_pieces.Contains(piece.Prefab)) { item4.m_pieces.Add(piece.Prefab); } } } } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { PiecePrefabManager.CategoryRefreshNeeded = true; ((Humanoid)Player.m_localPlayer).SetPlaceMode(Player.m_localPlayer.m_buildPieces); } } }; StationExtension pieceExtensionComp; List<ConfigurationManagerAttributes> hideWhenNoneAttributes2; if (piece.Extension.ExtensionStations.Count > 0) { pieceExtensionComp = piece.Prefab.GetOrAddComponent<StationExtension>(); PieceConfig pieceConfig3 = cfg; string group = englishName; CraftingTable table = piece.Extension.ExtensionStations.First().Table; string text = "Crafting station that " + localizedName + " extends."; object[] array = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes.Order = num; array[0] = configurationManagerAttributes; pieceConfig3.extensionTable = config(group, "Extends Station", table, new ConfigDescription(text, (AcceptableValueBase)null, array)); cfg.customExtentionTable = config(englishName, "Custom Extend Station", piece.Extension.ExtensionStations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); PieceConfig pieceConfig4 = cfg; string group2 = englishName; float maxStationDistance = piece.Extension.ExtensionStations.First().maxStationDistance; string text2 = "Distance from the station that " + localizedName + " can be placed."; object[] array2 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes2 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes2.Order = num; array2[0] = configurationManagerAttributes2; pieceConfig4.maxStationDistance = config(group2, "Max Station Distance", maxStationDistance, new ConfigDescription(text2, (AcceptableValueBase)null, array2)); hideWhenNoneAttributes2 = new List<ConfigurationManagerAttributes>(); cfg.extensionTable.SettingChanged += ExtensionTableConfigChanged; cfg.customExtentionTable.SettingChanged += ExtensionTableConfigChanged; cfg.maxStationDistance.SettingChanged += ExtensionTableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes3 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes3.Order = num; configurationManagerAttributes3.Browsable = cfg.extensionTable.Value != CraftingTable.None; ConfigurationManagerAttributes item = configurationManagerAttributes3; hideWhenNoneAttributes2.Add(item); } List<ConfigurationManagerAttributes> hideWhenNoneAttributes; if (piece.Crafting.Stations.Count > 0) { hideWhenNoneAttributes = new List<ConfigurationManagerAttributes>(); PieceConfig pieceConfig5 = cfg; string group3 = englishName; CraftingTable table2 = piece.Crafting.Stations.First().Table; string text3 = "Crafting station where " + localizedName + " is available."; object[] array3 = new object[1]; ConfigurationManagerAttributes configurationManagerAttributes4 = new ConfigurationManagerAttributes(); int num = order - 1; order = num; configurationManagerAttributes4.Order = num; array3[0] = configurationManagerAttributes4; pieceConfig5.table = config(group3, "Crafting Station", table2, new ConfigDescription(text3, (AcceptableValueBase)null, array3)); cfg.customTable = config(englishName, "Custom Crafting Station", piece.Crafting.Stations.First().custom ?? "", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { customTableAttributes })); cfg.table.SettingChanged += TableConfigChanged; cfg.customTable.SettingChanged += TableConfigChanged; ConfigurationManagerAttributes configurationManagerAttributes5 = new ConfigurationManagerAttributes(); num = order - 1; order = num; configurationManagerAttributes5.Order = num; configurationManagerAttributes5.Browsable = cfg.table.Value != CraftingTable.None; ConfigurationManagerAttributes item2 = configurationManagerAttributes5; hideWhenNoneAttributes.Add(item2); } cfg.craft = itemConfig("Crafting Costs", new SerializedRequirements(piece.RequiredItems.Requirements).ToString(), "Item costs to craft " + localizedName); cfg.craft.SettingChanged += [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (object _, EventArgs _) => { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab2.m_resources = resources; Piece[] array4 = Object.FindObjectsOfType<Piece>(); foreach (Piece val in array4) { if (val.m_name == pieceName) { val.m_resources = resources; } } } }; for (int j = 0; j < piece.Conversions.Count; j++) { string text4 = ((piece.Conversions.Count > 1) ? $"{j + 1}. " : ""); Conversion conversion = piece.Conversions[j]; conversion.config = new Conversion.ConversionConfig(); int index = j; conversion.config.input = config(englishName, text4 + "Conversion Input Item", conversion.Input, new ConfigDescription("Conversion input item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.input.SettingChanged += [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance2 = ObjectDB.instance; if (instance2 != null) { ItemDrop from = SerializedRequirements.fetchByName(instance2, conversion.config.input.Value); piece.conversions[index].m_from = from; } } }; conversion.config.output = config(englishName, text4 + "Conversion Output Item", conversion.Output, new ConfigDescription("Conversion output item within " + englishName, (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Category = localizedName } })); conversion.config.output.SettingChanged += [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (object _, EventArgs _) => { if (index < piece.conversions.Count) { ObjectDB instance = ObjectDB.instance; if (instance != null) { ItemDrop to = SerializedRequirements.fetchByName(instance, conversion.config.output.Value); piece.conversions[index].m_to = to; } } }; } void BuildTableConfigChanged(object o, EventArgs e) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) if (registeredPieces.Count > 0) { if (cfg.category.Value == BuildPieceCategory.Custom) { piecePrefab2.m_category = PiecePrefabManager.GetCategory(cfg.customCategory.Value); } else { piecePrefab2.m_category = (PieceCategory)cfg.category.Value; } if (Object.op_Implicit((Object)(object)Hud.instance)) { PiecePrefabManager.CategoryRefreshNeeded = true; PiecePrefabManager.CreateCategoryTabs(); } } customTableAttributes.Browsable = cfg.category.Value == BuildPieceCategory.Custom; ReloadConfigDisplay(); } void ExtensionTableConfigChanged(object o, EventArgs e) { if (piece.RequiredItems.Requirements.Count > 0) { CraftingTable value2 = cfg.extensionTable.Value; CraftingTable craftingTable = value2; if (craftingTable == CraftingTable.Custom) { StationExtension obj2 = pieceExtensionComp; GameObject prefab2 = ZNetScene.instance.GetPrefab(cfg.customExtentionTable.Value); obj2.m_craftingStation = ((prefab2 != null) ? prefab2.GetComponent<CraftingStation>() : null); } else { pieceExtensionComp.m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(cfg.extensionTable.Value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent<CraftingStation>(); } pieceExtensionComp.m_maxStationDistance = cfg.maxStationDistance.Value; } customTableAttributes.Browsable = cfg.extensionTable.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item5 in hideWhenNoneAttributes2) { item5.Browsable = cfg.extensionTable.Value != CraftingTable.None; } ReloadConfigDisplay(); plugin.Config.Save(); } void TableConfigChanged(object o, EventArgs e) { if (piece.RequiredItems.Requirements.Count > 0) { switch (cfg.table.Value) { case CraftingTable.None: piecePrefab2.m_craftingStation = null; break; case CraftingTable.Custom: { Piece obj = piecePrefab2; GameObject prefab = ZNetScene.instance.GetPrefab(cfg.customTable.Value); obj.m_craftingStation = ((prefab != null) ? prefab.GetComponent<CraftingStation>() : null); break; } default: piecePrefab2.m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(cfg.table.Value.ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent<CraftingStation>(); break; } } customTableAttributes.Browsable = cfg.table.Value == CraftingTable.Custom; foreach (ConfigurationManagerAttributes item6 in hideWhenNoneAttributes) { item6.Browsable = cfg.table.Value != CraftingTable.None; } ReloadConfigDisplay(); plugin.Config.Save(); } ConfigEntry<string> itemConfig(string name, string value, string desc) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown ConfigurationManagerAttributes configurationManagerAttributes6 = new ConfigurationManagerAttributes { CustomDrawer = DrawConfigTable, Order = (order -= 1), Category = localizedName }; return config(englishName, name, value, new ConfigDescription(desc, (AcceptableValueBase)null, new object[1] { configurationManagerAttributes6 })); } } foreach (BuildPiece registeredPiece3 in registeredPieces) { ConfigEntryBase enabledCfg = registeredPiece3.RecipeIsActive; Piece piecePrefab; if (enabledCfg != null) { piecePrefab = registeredPiece3.Prefab.GetComponent<Piece>(); ConfigChanged(null, null); ((object)enabledCfg).GetType().GetEvent("SettingChanged").AddEventHandler(enabledCfg, new EventHandler(ConfigChanged)); } registeredPiece3.InitializeNewRegisteredPiece(registeredPiece3); [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(2)] void ConfigChanged(object o, EventArgs e) { piecePrefab.m_enabled = (int)enabledCfg.BoxedValue != 0; } } if (saveOnConfigSet) { plugin.Config.SaveOnConfigSet = true; plugin.Config.Save(); } void ReloadConfigDisplay() { object obj3 = configManagerType?.GetProperty("DisplayingWindow").GetValue(configManager); if (obj3 is bool && (bool)obj3) { configManagerType.GetMethod("BuildSettingList").Invoke(configManager, Array.Empty<object>()); } } } public void InitializeNewRegisteredPiece(BuildPiece piece) { ConfigEntryBase recipeIsActive = piece.RecipeIsActive; PieceConfig cfg; Piece piecePrefab; string pieceName; if (recipeIsActive != null) { pieceConfigs.TryGetValue(piece, out cfg); piecePrefab = piece.Prefab.GetComponent<Piece>(); pieceName = piecePrefab.m_name; ((object)recipeIsActive).GetType().GetEvent("SettingChanged").AddEventHandler(recipeIsActive, new EventHandler(ConfigChanged)); } void ConfigChanged(object o, EventArgs e) { if (Object.op_Implicit((Object)(object)ObjectDB.instance) && (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") != (Object)null && cfg != null) { Requirement[] resources = SerializedRequirements.toPieceReqs(new SerializedRequirements(cfg.craft.Value)); piecePrefab.m_resources = resources; Piece[] array = Object.FindObjectsOfType<Piece>(); foreach (Piece val in array) { if (val.m_name == pieceName) { val.m_resources = resources; } } } } } [HarmonyPriority(700)] internal static void Patch_ObjectDBInit(ObjectDB __instance) { //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Expected O, but got Unknown if ((Object)(object)__instance.GetItemPrefab("YmirRemains") == (Object)null) { return; } foreach (BuildPiece registeredPiece in registeredPieces) { pieceConfigs.TryGetValue(registeredPiece, out var value); registeredPiece.Prefab.GetComponent<Piece>().m_resources = SerializedRequirements.toPieceReqs((value == null) ? new SerializedRequirements(registeredPiece.RequiredItems.Requirements) : new SerializedRequirements(value.craft.Value)); foreach (ExtensionConfig extensionStation in registeredPiece.Extension.ExtensionStations) { switch ((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.Table : value.extensionTable.Value) { case CraftingTable.None: registeredPiece.Prefab.GetComponent<StationExtension>().m_craftingStation = null; break; case CraftingTable.Custom: { GameObject prefab = ZNetScene.instance.GetPrefab((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.custom : value.customExtentionTable.Value); if (prefab != null) { registeredPiece.Prefab.GetComponent<StationExtension>().m_craftingStation = prefab.GetComponent<CraftingStation>(); } else { Debug.LogWarning((object)("Custom crafting station '" + ((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.custom : value.customExtentionTable.Value) + "' does not exist")); } break; } default: if (value != null && value.table.Value == CraftingTable.None) { registeredPiece.Prefab.GetComponent<StationExtension>().m_craftingStation = null; } else { registeredPiece.Prefab.GetComponent<StationExtension>().m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(((value == null || registeredPiece.Extension.ExtensionStations.Count > 0) ? extensionStation.Table : value.extensionTable.Value).ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent<CraftingStation>(); } break; } } foreach (CraftingStationConfig station in registeredPiece.Crafting.Stations) { switch ((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.Table : value.table.Value) { case CraftingTable.None: registeredPiece.Prefab.GetComponent<Piece>().m_craftingStation = null; break; case CraftingTable.Custom: { GameObject prefab2 = ZNetScene.instance.GetPrefab((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.custom : value.customTable.Value); if (prefab2 != null) { registeredPiece.Prefab.GetComponent<Piece>().m_craftingStation = prefab2.GetComponent<CraftingStation>(); } else { Debug.LogWarning((object)("Custom crafting station '" + ((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.custom : value.customTable.Value) + "' does not exist")); } break; } default: if (value != null && value.table.Value == CraftingTable.None) { registeredPiece.Prefab.GetComponent<Piece>().m_craftingStation = null; } else { registeredPiece.Prefab.GetComponent<Piece>().m_craftingStation = ZNetScene.instance.GetPrefab(((InternalName)typeof(CraftingTable).GetMember(((value == null || registeredPiece.Crafting.Stations.Count > 0) ? station.Table : value.table.Value).ToString())[0].GetCustomAttributes(typeof(InternalName)).First()).internalName).GetComponent<CraftingStation>(); } break; } } registeredPiece.conversions = new List<ItemConversion>(); for (int i = 0; i < registeredPiece.Conversions.Count; i++) { Conversion conversion = registeredPiece.Conversions[i]; registeredPiece.conversions.Add(new ItemConversion { m_from = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.input.Value ?? conversion.Input), m_to = SerializedRequirements.fetchByName(ObjectDB.instance, conversion.config?.output.Value ?? conversion.Output) }); if (registeredPiece.conversions[i].m_from != null && registeredPiece.conversions[i].m_to != null) { registeredPiece.Prefab.GetComponent<Smelter>().m_conversion.Add(registeredPiece.conversions[i]); } } } } public void Snapshot(float lightIntensity = 1.3f, Quaternion? cameraRotation = null) { SnapshotPiece(Prefab, lightIntensity, cameraRotation); } internal void SnapshotPiece(GameObject prefab, float lightIntensity = 1.3f, Quaternion? cameraRotation = null) { //IL_0055: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: 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) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab == (Object)null) && (prefab.GetComponentsInChildren<Renderer>().Any() || prefab.GetComponentsInChildren<MeshFilter>().Any())) { Camera component = new GameObject("CameraIcon", new Type[1] { typeof(Camera) }).GetComponent<Camera>(); component.backgroundColor = Color.clear; component.clearFlags = (CameraClearFlags)2; ((Component)component).transform.position = new Vector3(10000f, 10000f, 10000f); ((Component)component).transform.rotation = (Quaternion)(((??)cameraRotation) ?? Quaternion.Euler(0f, 180f, 0f)); component.fieldOfView = 0.5f; component.farClipPlane = 100000f; component.cullingMask = 8; Light component2 = new GameObject("LightIcon", new Type[1] { typeof(Light) }).GetComponent<Light>(); ((Component)component2).transform.position = new Vector3(10000f, 10000f, 10000f); ((Component)component2).transform.rotation = Quaternion.Euler(5f, 180f, 5f); component2.type = (LightType)1; component2.cullingMask = 8; component2.intensity = lightIntensity; GameObject val = Object.Instantiate<GameObject>(prefab); Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>(); foreach (Transform val2 in componentsInChildren) { ((Component)val2).gameObject.layer = 3; } val.transform.position = Vector3.zero; val.transform.rotation = Quaternion.Euler(23f, 51f, 25.8f); ((Object)val).name = ((Object)prefab).name; MeshRenderer[] componentsInChildren2 = val.GetComponentsInChildren<MeshRenderer>(); Vector3 val3 = componentsInChildren2.Aggregate(Vector3.positiveInfinity, [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Vector3 cur, MeshRenderer renderer) => { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Bounds bounds2 = ((Renderer)renderer).bounds; return Vector3.Min(cur, ((Bounds)(ref bounds2)).min); }); Vector3 val4 = componentsInChildren2.Aggregate(Vector3.negativeInfinity, [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (Vector3 cur, MeshRenderer renderer) => { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = ((Renderer)renderer).bounds; return Vector3.Max(cur, ((Bounds)(ref bounds)).max); }); val.transform.position = new Vector3(10000f, 10000f, 10000f) - (val3 + val4) / 2f; Vector3 val5 = val4 - val3; TimedDestruction val6 = val.AddComponent<TimedDestruction>(); val6.Trigger(1f); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(0f, 0f, 128f, 128f); component.targetTexture = RenderTexture.GetTemporary((int)((Rect)(ref val7)).width, (int)((Rect)(ref val7)).height); component.fieldOfView = 20f; float num = Mathf.Max(val5.x, val5.y) + 0.1f; float num2 = num / Mathf.Tan(component.fieldOfView * ((float)Math.PI / 180f)) * 1.1f; ((Component)component).transform.position = new Vector3(10000f, 10000f, 10000f) + new Vector3(0f, 0f, num2); component.Render(); RenderTexture active = RenderTexture.active; RenderTexture.active = component.targetTexture; Texture2D val8 = new Texture2D((int)((Rect)(ref val7)).width, (int)((Rect)(ref val7)).height, (TextureFormat)4, false); val8.ReadPixels(new Rect(0f, 0f, (float)(int)((Rect)(ref val7)).width, (float)(int)((Rect)(ref val7)).height), 0, 0); val8.Apply(); RenderTexture.active = active; prefab.GetComponent<Piece>().m_icon = Sprite.Create(val8, new Rect(0f, 0f, (float)(int)((Rect)(ref val7)).width, (float)(int)((Rect)(ref val7)).height), Vector2.one / 2f); ((Component)component2).gameObject.SetActive(false); component.targetTexture.Release(); ((Component)component).gameObject.SetActive(false); val.SetActive(false); Object.DestroyImmediate((Object)(object)val); Object.Destroy((Object)(object)component); Object.Destroy((Object)(object)component2); Object.Destroy((Object)(object)((Component)component).gameObject); Object.Destroy((Object)(object)((Component)component2).gameObject); } } public static void DrawConfigTable(ConfigEntryBase cfg) { //IL_0108: 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_0123: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown bool valueOrDefault = cfg.Description.Tags.Select([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (object a) => (a.GetType().Name == "ConfigurationManagerAttributes") ? ((bool?)a.GetType().GetField("ReadOnly")?.GetValue(a)) : null).FirstOrDefault((bool? v) => v.HasValue).GetValueOrDefault(); List<Requirement> list = new List<Requirement>(); bool flag = false; int num = (int)(configManager?.GetType().GetProperty("RightColumnWidth", BindingFlags.Instance | BindingFlags.NonPublic).GetGetMethod(nonPublic: true) .Invoke(configManager, Array.Empty<object>()) ?? ((object)130)); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); foreach (Requirement req in new SerializedRequirements((string)cfg.BoxedValue).Reqs) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int num2 = req.amount; if (int.TryParse(GUILayout.TextField(num2.ToString(), new GUIStyle(GUI.skin.textField) { fixedWidth = 40f }, Array.Empty<GUILayoutOption>()), out var result) && result != num2 && !valueOrDefault) { num2 = result; flag = true; } int num3 = Mathf.Max(num - 40 - 67 - 21 - 21, 140); string text = GUILayout.TextField(req.itemName, new GUIStyle(GUI.skin.textField) { fixedWidth = num3 }, Array.Empty<GUILayoutOption>()); string text2 = (valueOrDefault ? req.itemName : text); flag = flag || text2 != req.itemName; bool flag2 = req.recover; if (GUILayout.Toggle(req.recover, "Recover", new GUIStyle(GUI.skin.toggle) { fixedWidth = 67f }, Array.Empty<GUILayoutOption>()) != req.recover) { flag2 = !flag2; flag = true; } if (GUILayout.Button("x", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; } else { list.Add(new Requirement { amount = num2, itemName = text2, recover = flag2 }); } if (GUILayout.Button("+", new GUIStyle(GUI.skin.button) { fixedWidth = 21f }, Array.Empty<GUILayoutOption>()) && !valueOrDefault) { flag = true; list.Add(new Requirement { amount = 1, itemName = "", recover = false }); } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (flag) { cfg.BoxedValue = new SerializedRequirements(list).ToString(); } } public static ConfigEntry<T> config<[<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] T>(string group, string name, T value, ConfigDescription description) { ConfigEntry<T> val = plugin.Config.Bind<T>(group, name, value, description); configSync?.GetType().GetMethod("AddConfigEntry").MakeGenericMethod(typeof(T)) .Invoke(configSync, new object[1] { val }); return val; } public static ConfigEntry<T> config<[<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] T>(string group, string name, T value, string description) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } } public static class GoExtensions { [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public static T GetOrAddComponent<[<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] T>(this GameObject gameObject) where T : Component { return gameObject.GetComponent<T>() ?? gameObject.AddComponent<T>(); } } [PublicAPI] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class LocalizeKey { private static readonly List<LocalizeKey> keys = new List<LocalizeKey>(); public readonly string Key; public readonly Dictionary<string, string> Localizations = new Dictionary<string, string>(); public LocalizeKey(string key) { Key = key.Replace("$", ""); keys.Add(this); } public void Alias(string alias) { Localizations.Clear(); if (!alias.Contains("$")) { alias = "$" + alias; } Localizations["alias"] = alias; Localization.instance.AddWord(Key, Localization.instance.Localize(alias)); } public LocalizeKey English(string key) { return addForLang("English", key); } public LocalizeKey Swedish(string key) { return addForLang("Swedish", key); } public LocalizeKey French(string key) { return addForLang("French", key); } public LocalizeKey Italian(string key) { return addForLang("Italian", key); } public LocalizeKey German(string key) { return addForLang("German", key); } public LocalizeKey Spanish(string key) { return addForLang("Spanish", key); } public LocalizeKey Russian(string key) { return addForLang("Russian", key); } public LocalizeKey Romanian(string key) { return addForLang("Romanian", key); } public LocalizeKey Bulgarian(string key) { return addForLang("Bulgarian", key); } public LocalizeKey Macedonian(string key) { return addForLang("Macedonian", key); } public LocalizeKey Finnish(string key) { return addForLang("Finnish", key); } public LocalizeKey Danish(string key) { return addForLang("Danish", key); } public LocalizeKey Norwegian(string key) { return addForLang("Norwegian", key); } public LocalizeKey Icelandic(string key) { return addForLang("Icelandic", key); } public LocalizeKey Turkish(string key) { return addForLang("Turkish", key); } public LocalizeKey Lithuanian(string key) { return addForLang("Lithuanian", key); } public LocalizeKey Czech(string key) { return addForLang("Czech", key); } public LocalizeKey Hungarian(string key) { return addForLang("Hungarian", key); } public LocalizeKey Slovak(string key) { return addForLang("Slovak", key); } public LocalizeKey Polish(string key) { return addForLang("Polish", key); } public LocalizeKey Dutch(string key) { return addForLang("Dutch", key); } public LocalizeKey Portuguese_European(string key) { return addForLang("Portuguese_European", key); } public LocalizeKey Portuguese_Brazilian(string key) { return addForLang("Portuguese_Brazilian", key); } public LocalizeKey Chinese(string key) { return addForLang("Chinese", key); } public LocalizeKey Japanese(string key) { return addForLang("Japanese", key); } public LocalizeKey Korean(string key) { return addForLang("Korean", key); } public LocalizeKey Hindi(string key) { return addForLang("Hindi", key); } public LocalizeKey Thai(string key) { return addForLang("Thai", key); } public LocalizeKey Abenaki(string key) { return addForLang("Abenaki", key); } public LocalizeKey Croatian(string key) { return addForLang("Croatian", key); } public LocalizeKey Georgian(string key) { return addForLang("Georgian", key); } public LocalizeKey Greek(string key) { return addForLang("Greek", key); } public LocalizeKey Serbian(string key) { return addForLang("Serbian", key); } public LocalizeKey Ukrainian(string key) { return addForLang("Ukrainian", key); } private LocalizeKey addForLang(string lang, string value) { Localizations[lang] = value; if (Localization.instance.GetSelectedLanguage() == lang) { Localization.instance.AddWord(Key, value); } else if (lang == "English" && !Localization.instance.m_translations.ContainsKey(Key)) { Localization.instance.AddWord(Key, value); } return this; } [HarmonyPriority(300)] internal static void AddLocalizedKeys(Localization __instance, string language) { foreach (LocalizeKey key in keys) { string value2; if (key.Localizations.TryGetValue(language, out var value) || key.Localizations.TryGetValue("English", out value)) { __instance.AddWord(key.Key, value); } else if (key.Localizations.TryGetValue("alias", out value2)) { __instance.AddWord(key.Key, Localization.instance.Localize(value2)); } } } } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public static class LocalizationCache { private static readonly Dictionary<string, Localization> localizations = new Dictionary<string, Localization>(); internal static void LocalizationPostfix(Localization __instance, string language) { string key = localizations.FirstOrDefault([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (KeyValuePair<string, Localization> l) => l.Value == __instance).Key; if (key != null) { localizations.Remove(key); } if (!localizations.ContainsKey(language)) { localizations.Add(language, __instance); } } public static Localization ForLanguage([<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(2)] string language = null) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown if (localizations.TryGetValue(language ?? PlayerPrefs.GetString("language", "English"), out var value)) { return value; } value = new Localization(); if (language != null) { value.SetupLanguage(language); } return value; } } [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] public class AdminSyncing { private static bool isServer; internal static bool registeredOnClient; [HarmonyPriority(700)] internal static void AdminStatusSync(ZNet __instance) { isServer = __instance.IsServer(); if (BuildPiece._plugin != null) { if (isServer) { ZRoutedRpc.instance.Register<ZPackage>(BuildPiece._plugin.Info.Metadata.Name + " PMAdminStatusSync", (Action<long, ZPackage>)RPC_AdminPieceAddRemove); } else if (!registeredOnClient) { ZRoutedRpc.instance.Register<ZPackage>(BuildPiece._plugin.Info.Metadata.Name + " PMAdminStatusSync", (Action<long, ZPackage>)RPC_AdminPieceAddRemove); registeredOnClient = true; } } if (isServer) { ((MonoBehaviour)ZNet.instance).StartCoroutine(WatchAdminListChanges()); } static void SendAdmin(List<ZNetPeer> peers, bool isAdmin) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write(isAdmin); ((MonoBehaviour)ZNet.instance).StartCoroutine(sendZPackage(peers, val)); } static IEnumerator WatchAdminListChanges() { List<string> currentList = new List<string>(ZNet.instance.m_adminList.GetList()); while (true) { yield return (object)new WaitForSeconds(30f); if (!ZNet.instance.m_adminList.GetList().SequenceEqual(currentList)) { currentList = new List<string>(ZNet.instance.m_adminList.GetList()); List<ZNetPeer> adminPeer = (from p in ZNet.instance.GetPeers() where ZNet.instance.ListContainsId(ZNet.instance.m_adminList, 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); } } } } private static IEnumerator sendZPackage(List<ZNetPeer> peers, ZPackage package) { if (!Object.op_Implicit((Object)(object)ZNet.instance)) { yield break; } byte[] rawData = package.GetArray(); if (rawData != null && rawData.LongLength > 10000) { ZPackage compressedPackage = new ZPackage(); compressedPackage.Write(4); MemoryStream output = new MemoryStream(); using (DeflateStream deflateStream = new DeflateStream(output, CompressionLevel.Optimal)) { deflateStream.Write(rawData, 0, rawData.Length); } compressedPackage.Write(output.ToArray()); package = compressedPackage; } List<IEnumerator<bool>> writers = (from peer in peers where peer.IsReady() select peer into p select TellPeerAdminStatus(p, package)).ToList(); writers.RemoveAll((IEnumerator<bool> writer) => !writer.MoveNext()); while (writers.Count > 0) { yield return null; writers.RemoveAll((IEnumerator<bool> writer) => !writer.MoveNext()); } } private static IEnumerator<bool> TellPeerAdminStatus(ZNetPeer peer, ZPackage package) { ZRoutedRpc rpc = ZRoutedRpc.instance; if (rpc != null) { SendPackage(package); } void SendPackage(ZPackage pkg) { BaseUnityPlugin plugin = BuildPiece._plugin; string text = ((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync"; if (isServer) { peer.m_rpc.Invoke(text, new object[1] { pkg }); } else { rpc.InvokeRoutedRPC(peer.m_server ? 0 : peer.m_uid, text, new object[1] { pkg }); } } yield break; } internal static void RPC_AdminPieceAddRemove(long sender, ZPackage package) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown ZNetPeer peer = ZNet.instance.GetPeer(sender); bool flag = false; try { flag = package.ReadBool(); } catch { } if (isServer) { ZRoutedRpc instance = ZRoutedRpc.instance; long everybody = ZRoutedRpc.Everybody; BaseUnityPlugin plugin = BuildPiece._plugin; instance.InvokeRoutedRPC(everybody, ((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { (object)new ZPackage() }); if (ZNet.instance.ListContainsId(ZNet.instance.m_adminList, peer.m_rpc.GetSocket().GetHostName())) { ZPackage val = new ZPackage(); val.Write(true); ZRpc rpc = peer.m_rpc; BaseUnityPlugin plugin2 = BuildPiece._plugin; rpc.Invoke(((plugin2 != null) ? plugin2.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { val }); } return; } foreach (BuildPiece registeredPiece in BuildPiece.registeredPieces) { if (!registeredPiece.SpecialProperties.AdminOnly) { continue; } Piece component = registeredPiece.Prefab.GetComponent<Piece>(); string name = component.m_name; string text = Localization.instance.Localize(name).Trim(); if (!Object.op_Implicit((Object)(object)ObjectDB.instance) || (Object)(object)ObjectDB.instance.GetItemPrefab("YmirRemains") == (Object)null) { continue; } Piece[] array = Object.FindObjectsOfType<Piece>(); foreach (Piece val2 in array) { if (flag) { if (val2.m_name == name) { val2.m_enabled = true; } } else if (val2.m_name == name) { val2.m_enabled = false; } } List<GameObject> pieces = ObjectDB.instance.GetItemPrefab("Hammer").GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces.m_pieces; if (flag) { if (!pieces.Contains(ZNetScene.instance.GetPrefab(((Object)component).name))) { pieces.Add(ZNetScene.instance.GetPrefab(((Object)component).name)); } } else if (pieces.Contains(ZNetScene.instance.GetPrefab(((Object)component).name))) { pieces.Remove(ZNetScene.instance.GetPrefab(((Object)component).name)); } } } } [HarmonyPatch(typeof(ZNet), "OnNewConnection")] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] internal class RegisterClientRPCPatch { private static void Postfix(ZNet __instance, ZNetPeer peer) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (!__instance.IsServer()) { ZRpc rpc = peer.m_rpc; BaseUnityPlugin plugin = BuildPiece._plugin; rpc.Register<ZPackage>(((plugin != null) ? plugin.Info.Metadata.Name : null) + " PMAdminStatusSync", (Action<ZRpc, ZPackage>)RPC_InitialAdminSync); return; } ZPackage val = new ZPackage(); val.Write(__instance.ListContainsId(__instance.m_adminList, peer.m_rpc.GetSocket().GetHostName())); ZRpc rpc2 = peer.m_rpc; BaseUnityPlugin plugin2 = BuildPiece._plugin; rpc2.Invoke(((plugin2 != null) ? plugin2.Info.Metadata.Name : null) + " PMAdminStatusSync", new object[1] { val }); } private static void RPC_InitialAdminSync(ZRpc rpc, ZPackage package) { AdminSyncing.RPC_AdminPieceAddRemove(0L, package); } } [<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(1)] [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] public static class PiecePrefabManager { [<1026c029-dcb1-493b-a941-4adc8a04a8c0>Nullable(0)] private struct BundleId { [UsedImplicitly] public string assetBundleFileName; [UsedImplicitly] public string folderName; } private static readonly Dictionary<BundleId, AssetBundle> bundleCache; private static readonly List<GameObject> piecePrefabs; public static readonly Dictionary<string, PieceCategory> PieceCategories; public static readonly Dictionary<string, PieceCategory> OtherPieceCategories; private static readonly Dictionary<PieceCategory, string> VanillaLabels; internal static bool CategoryRefreshNeeded; static PiecePrefabManager() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_02eb: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Expected O, but got Unknown //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Expected O, but got Unknown bundleCache = new Dictionary<BundleId, AssetBundle>(); piecePrefabs = new List<GameObject>(); PieceCategories = new Dictionary<string, PieceCategory>(); OtherPieceCategories = new Dictionary<string, PieceCategory>(); VanillaLabels = new Dictionary<PieceCategory, string>(); Harmony val = new Harmony("org.bepinex.helpers.PieceManager"); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(FejdStartup), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(BuildPiece), "Patch_FejdStartup", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "LoadCSV", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizeKey), "AddLocalizedKeys", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Localization), "SetupLanguage", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(LocalizationCache), "LocalizationPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(BuildPiece), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ObjectDB), "CopyOtherDB", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ObjectDBInit", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNet), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(AdminSyncing), "AdminStatusSync", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNetScene), "Awake", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_ZNetSceneAwake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(ZNetScene), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RefFixPatch_ZNetSceneAwake", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(PieceTable), "UpdateAvailable", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Transpiler", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(PieceTable), "UpdateAvailable", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Prefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "UpdateAvailable_Postfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Player), "SetPlaceMode", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Patch_SetPlaceMode", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "Awake", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "Hud_AwakeCreateTabs", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "UpdateBuild", (Type[])null, (Type[])null), new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RepositionCatsIfNeeded", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Hud), "LateUpdate", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "RepositionCatsIfNeeded", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Enum), "GetValues", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "EnumGetValuesPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); val.Patch((MethodBase)AccessTools.DeclaredMethod(typeof(Enum), "GetNames", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "EnumGetNamesPatch", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static AssetBundle RegisterAssetBundle(string assetBundleFileName, string folderName = "assets") { BundleId bundleId = default(BundleId); bundleId.assetBundleFileName = assetBundleFileName; bundleId.folderName = folderName; BundleId key = bundleId; if (!bundleCache.TryGetValue(key, out var value)) { Dictionary<BundleId, AssetBundle> dictionary = bundleCache; AssetBundle? obj = ((IEnumerable<AssetBundle>)Resources.FindObjectsOfTypeAll<AssetBundle>()).FirstOrDefault((Func<AssetBundle, bool>)([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (AssetBundle a) => ((Object)a).name == assetBundleFileName)) ?? AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(Assembly.GetExecutingAssembly().GetName().Name + "." + folderName + "." + assetBundleFileName)); AssetBundle result = obj; dictionary[key] = obj; return result; } return value; } public static IEnumerable<GameObject> FixRefs(AssetBundle assetBundle) { return assetBundle.LoadAllAssets<GameObject>(); } public static GameObject RegisterPrefab(string assetBundleFileName, string prefabName, string folderName = "assets") { return RegisterPrefab(RegisterAssetBundle(assetBundleFileName, folderName), prefabName); } public static GameObject RegisterPrefab(AssetBundle assets, string prefabName) { if ((Object)(object)assets == (Object)null) { Debug.LogError((object)"Failed to load asset bundle. Please make sure to mark all asset bundles as embedded resources."); return null; } GameObject val = assets.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("Failed to load prefab " + prefabName + " from asset bundle " + ((Object)assets).name)); return null; } piecePrefabs.Add(val); return val; } public static Sprite RegisterSprite(string assetBundleFileName, string prefabName, string folderName = "assets") { return RegisterSprite(RegisterAssetBundle(assetBundleFileName, folderName), prefabName); } public static Sprite RegisterSprite(AssetBundle assets, string prefabName) { return assets.LoadAsset<Sprite>(prefabName); } private static void EnumGetValuesPatch(Type enumType, ref Array __result) { if (!(enumType != typeof(PieceCategory)) && PieceCategories.Count != 0) { PieceCategory[] array = (PieceCategory[])(object)new PieceCategory[__result.Length + PieceCategories.Count]; __result.CopyTo(array, 0); PieceCategories.Values.CopyTo(array, __result.Length); __result = array; } } private static void EnumGetNamesPatch(Type enumType, ref string[] __result) { if (!(enumType != typeof(PieceCategory)) && PieceCategories.Count != 0) { __result = CollectionExtensions.AddRangeToArray<string>(__result, PieceCategories.Keys.ToArray()); } } private static Dictionary<PieceCategory, string> GetPieceCategoriesMap() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Array values = Enum.GetValues(typeof(PieceCategory)); string[] names = Enum.GetNames(typeof(PieceCategory)); Dictionary<PieceCategory, string> dictionary = new Dictionary<PieceCategory, string>(); for (int i = 0; i < values.Length; i++) { dictionary[(PieceCategory)values.GetValue(i)] = names[i]; } return dictionary; } public static PieceCategory GetCategory(string name) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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) //IL_0094: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) if (Enum.TryParse<PieceCategory>(name, ignoreCase: true, out PieceCategory result)) { return result; } if (PieceCategories.TryGetValue(name, out result)) { return result; } if (OtherPieceCategories.TryGetValue(name, out result)) { return result; } Dictionary<PieceCategory, string> pieceCategoriesMap = GetPieceCategoriesMap(); foreach (KeyValuePair<PieceCategory, string> item in pieceCategoriesMap) { if (item.Value == name) { result = item.Key; OtherPieceCategories[name] = result; return result; } } result = (PieceCategory)(pieceCategoriesMap.Count - 1); PieceCategories[name] = result; string categoryToken = GetCategoryToken(name); Localization.instance.AddWord(categoryToken, name); return result; } internal static void CreateCategoryTabs() { if (Object.op_Implicit((Object)(object)Hud.instance)) { int num = ModifiedMaxCategory(); for (int i = Hud.instance.m_pieceCategoryTabs.Length; i < num; i++) { GameObject val = CreateCategoryTab(); Hud.instance.m_pieceCategoryTabs = CollectionExtensions.AddItem<GameObject>((IEnumerable<GameObject>)Hud.instance.m_pieceCategoryTabs, val).ToArray(); } if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { RepositionCategories(Player.m_localPlayer.m_buildPieces); Player.m_localPlayer.UpdateAvailablePiecesList(); } } } private static GameObject CreateCategoryTab() { //IL_0084: 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) GameObject val = Hud.instance.m_pieceCategoryTabs[0]; GameObject val2 = Object.Instantiate<GameObject>(Hud.instance.m_pieceCategoryTabs[0], val.transform.parent); val2.SetActive(false); UIInputHandler orAddComponent = val2.GetOrAddComponent<UIInputHandler>(); orAddComponent.m_onLeftDown = (Action<UIInputHandler>)Delegate.Combine(orAddComponent.m_onLeftDown, new Action<UIInputHandler>(Hud.instance.OnLeftClickCategory)); TMP_Text[] componentsInChildren = val2.GetComponentsInChildren<TMP_Text>(); foreach (TMP_Text val3 in componentsInChildren) { val3.rectTransform.offsetMin = new Vector2(3f, 1f); val3.rectTransform.offsetMax = new Vector2(-3f, -1f); val3.enableAutoSizing = true; val3.fontSizeMin = 12f; val3.fontSizeMax = 20f; val3.lineSpacing = 0.8f; val3.textWrappingMode = (TextWrappingModes)1; val3.overflowMode = (TextOverflowModes)3; } return val2; } private static int ModifiedMaxCategory() { return Enum.GetValues(typeof(PieceCategory)).Length - 1; } private static int GetMaxCategoryOrDefault() { try { return (int)Enum.Parse(typeof(PieceCategory), "Max"); } catch (ArgumentException) { Debug.LogWarning((object)"Could not find Piece.PieceCategory.Max, using fallback value 4"); return 4; } } private static List<CodeInstruction> TranspileMaxCategory(IEnumerable<CodeInstruction> instructions, int maxOffset) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown int num = GetMaxCategoryOrDefault() + maxOffset; List<CodeInstruction> list = new List<CodeInstruction>(); foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.LoadsConstant(instruction, (long)num)) { list.Add(new CodeInstruction(OpCodes.Call, (object)AccessTools.DeclaredMethod(typeof(PiecePrefabManager), "ModifiedMaxCategory", (Type[])null, (Type[])null))); if (maxOffset != 0) { list.Add(new CodeInstruction(OpCodes.Ldc_I4, (object)maxOffset)); list.Add(new CodeInstruction(OpCodes.Add, (object)null)); } } else { list.Add(instruction); } } return list; } private static IEnumerable<CodeInstruction> UpdateAvailable_Transpiler(IEnumerable<CodeInstruction> instructions) { return TranspileMaxCategory(instructions, 0); } private static HashSet<PieceCategory> CategoriesInPieceTable(PieceTable pieceTable) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) HashSet<PieceCategory> hashSet = new HashSet<PieceCategory>(); Piece val = default(Piece); foreach (GameObject item in pieceTable.m_pieces.Where([<845a9831-97cf-404f-914b-d01d6b09b622>NullableContext(0)] (GameObject pieceFab) => (Object)(object)pieceFab != (Object)null)) { if (item.TryGetComponent<Piece>(ref val)) { hashSet.Add(val.m_category); } } return hashSet; } private static void RepositionCatsIfNeeded() { if (CategoryRefreshNeeded) { CategoryRefreshNeeded = false; CreateCategoryTabs(); RepositionCats(); } } private static void RepositionCats() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Object.op_Implicit((Object)(object)Player.m_localPlayer.m_buildPieces)) { RepositionCategories(Player.m_localPlayer.m_buildPieces); } } private static void RepositionCategories(PieceTable pieceTable) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0096: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing ref