Decompiled source of TU Addons v2.0.1
BepInEx/plugins/Marsarah-MarsarahMod/MarsarahMod.dll
Decompiled 2 months 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