using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Jotunn.Managers; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AllInOneMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AllInOneMod")] [assembly: AssemblyTitle("AllInOneMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Kladbm.AllInOneMod; [BepInPlugin("Kladbm.AllInOneMod", "AllInOneMod", "1.3.2")] public class AllInOnePlugin : BaseUnityPlugin { [HarmonyPatch(typeof(BaseAI), "Awake")] public static class Patch_BaseAI_Awake { private static void Postfix(BaseAI __instance) { if ((Object)(object)__instance == (Object)null) { return; } string text = ((Object)__instance).name.Replace("(Clone)", ""); float num = 1.5f; float num2 = 1.25f; float num3 = num; string[] source = new string[10] { "GoblinShaman", "GoblinShaman_Hildir", "GoblinShaman_Hildir_nochest", "GreydwarfMage_TW", "SkeletonMage_TW", "FenringMage_TW", "GoblinMage_TW", "CorruptedDvergerMage_TW", "GDAncientShaman_TW", "GDAncientShaman_rootspawn_TW" }; string[] source2 = new string[6] { "Draugr", "Draugr_Elite", "Draugr_Ranged", "Blob", "BlobElite", "Leech" }; string[] source3 = new string[8] { "Goblin", "Goblin_Gem", "GoblinArcher", "GoblinBrute", "GoblinBrute_Hildir", "GoblinBruteBros", "GoblinBruteBros_nochest", "GoblinKing" }; switch (text) { case "Ulv": case "Fenring": case "Wolf": case "Fenring_Cultist": num2 *= 1.5f; num3 *= 3f; break; case "Bat": case "Volture": case "Dragon": num2 *= 1.75f; num3 *= 1.75f; break; case "Deathsquito": num2 *= 1.1f; num3 *= 1.1f; break; case "Serpent": case "Shark_TW": num2 *= 4f; num3 *= 2f; break; case "Fox_TW": num2 *= 1.25f; num3 *= 1.25f; break; case "Deer": case "RottingElk_TW": num2 *= 1f; num3 *= 2f; break; case "Prowler_TW": num2 *= 1f; num3 *= 2f; break; case "Tick": num2 *= 1.25f; num3 *= 1.25f; break; case "Wraith": case "HelWraith_TW": num2 *= 1.75f; num3 *= 1.25f; break; case "Bjorn": num2 *= 2f; num3 *= 2.5f; break; default: if (source.Contains(text)) { num2 = 1.5f; num3 = 1.5f; } if (source2.Contains(text)) { num2 = 0.9f; num3 = 0.9f; } if (source3.Contains(text)) { num2 = 1.1f; num3 = 1.1f; } break; } float viewRange = __instance.m_viewRange; float hearRange = __instance.m_hearRange; __instance.m_viewRange *= num2; __instance.m_hearRange *= num3; _logger.LogInfo((object)("[" + text + "] Awareness boost: " + $"View {viewRange} → {__instance.m_viewRange} (x{num2:0.00}), " + $"Hear {hearRange} → {__instance.m_hearRange} (x{num3:0.00})")); } } [HarmonyPatch(typeof(Skills), "OnDeath")] private static class NoCraftingSkillLossPatch { private static Skill craftingSkill; private static Skill fishingSkill; private static Skill dodgeSkill; private static readonly FieldInfo skillDataField = typeof(Skills).GetField("m_skillData", BindingFlags.Instance | BindingFlags.NonPublic); private static void Prefix(Skills __instance) { Dictionary dictionary = (Dictionary)skillDataField.GetValue(__instance); dictionary.TryGetValue((SkillType)107, out craftingSkill); if (craftingSkill != null) { _logger.LogInfo((object)$"[AllInOneMod] Saving Crafting skill level: {craftingSkill.m_level:0.00}"); dictionary.Remove((SkillType)107); _logger.LogInfo((object)"[AllInOneMod] Removed Crafting skill from death penalty"); } dictionary.TryGetValue((SkillType)104, out fishingSkill); if (fishingSkill != null) { _logger.LogInfo((object)$"[AllInOneMod] Saving Fishing skill level: {fishingSkill.m_level:0.00}"); dictionary.Remove((SkillType)104); _logger.LogInfo((object)"[AllInOneMod] Removed Fishing skill from death penalty"); } dictionary.TryGetValue((SkillType)108, out dodgeSkill); if (dodgeSkill != null) { _logger.LogInfo((object)$"[AllInOneMod] Saving Dodge skill level: {dodgeSkill.m_level:0.00}"); dictionary.Remove((SkillType)108); _logger.LogInfo((object)"[AllInOneMod] Removed Dodge skill from death penalty"); } } private static void Finalizer(Skills __instance) { Dictionary dictionary = (Dictionary)skillDataField.GetValue(__instance); if (craftingSkill != null) { dictionary.Add((SkillType)107, craftingSkill); _logger.LogInfo((object)$"[AllInOneMod] Restored Crafting skill level: {craftingSkill.m_level:0.00}"); } if (fishingSkill != null) { dictionary.Add((SkillType)104, fishingSkill); _logger.LogInfo((object)$"[AllInOneMod] Restored Fishing skill level: {fishingSkill.m_level:0.00}"); } if (dodgeSkill != null) { dictionary.Add((SkillType)108, dodgeSkill); _logger.LogInfo((object)$"[AllInOneMod] Restored Dodge skill level: {dodgeSkill.m_level:0.00}"); } } } [HarmonyPatch(typeof(Player), "RaiseSkill")] private static class Patch_Player_RaiseSkill_ApiaryFix { private static readonly FieldInfo CurrentStationField = AccessTools.Field(typeof(Player), "m_currentStation"); private static void Prefix(Player __instance, ref SkillType skill) { if ((int)skill == 107) { object? obj = CurrentStationField?.GetValue(__instance); CraftingStation val = (CraftingStation)((obj is CraftingStation) ? obj : null); if (!((Object)(object)val == (Object)null) && ((Object)((Component)val).gameObject).name.Replace("(Clone)", "") == "piece_apiary") { skill = (SkillType)105; } } } } [HarmonyPatch(typeof(Skills), "GetSkillFactor")] private static class Patch_Skills_GetSkillFactor_ApiaryFix { private static readonly FieldInfo CurrentStationField = AccessTools.Field(typeof(Player), "m_currentStation"); private static readonly FieldInfo PlayerField = AccessTools.Field(typeof(Skills), "m_player"); private static void Prefix(Skills __instance, ref SkillType skillType) { if ((int)skillType != 107) { return; } object? obj = PlayerField?.GetValue(__instance); Player val = (Player)((obj is Player) ? obj : null); if (!((Object)(object)val == (Object)null)) { object? obj2 = CurrentStationField?.GetValue(val); CraftingStation val2 = (CraftingStation)((obj2 is CraftingStation) ? obj2 : null); if (!((Object)(object)val2 == (Object)null) && ((Object)((Component)val2).gameObject).name.Replace("(Clone)", "") == "piece_apiary") { skillType = (SkillType)105; } } } } private const string ModName = "AllInOneMod"; private const string ModVersion = "1.3.2"; private const string Author = "Kladbm"; private const string ModGUID = "Kladbm.AllInOneMod"; private readonly Harmony _harmony = new Harmony("Kladbm.AllInOneMod"); private static ManualLogSource _logger; private static readonly List<(string Boss, string Item, float Chance)> BossDropTable = new List<(string, string, float)> { ("Eikthyr", "VAatgeir_antler", 0.03f), ("Eikthyr", "VAAntler_dagger", 0.03f), ("Eikthyr", "VAAntler_Bow", 0.03f), ("Eikthyr", "VAAntler_Sword", 0.03f), ("Eikthyr", "VAAntler_greataxe", 0.03f), ("gd_king", "VAElderRoundShield", 0.03f), ("gd_king", "VAVine_Sword", 0.03f), ("gd_king", "VACrossbowElder", 0.03f), ("gd_king", "VAElder_mace", 0.03f), ("gd_king", "VAElderHammer", 0.03f), ("Bonemass", "VABonemassDagger", 0.03f), ("Bonemass", "VABonemassWarhammer", 0.03f), ("Bonemass", "VABonemassGreatsword", 0.03f), ("Bonemass", "VABonemassSword", 0.03f), ("Bonemass", "VABone_dualaxes", 0.03f), ("Bonemass", "VABone_axe", 0.03f), ("Dragon", "VAModer_shield", 0.02f), ("Dragon", "VACrossbowModer", 0.02f), ("Dragon", "VAModer_RoundShield", 0.02f), ("Dragon", "VAdagger_moder_2h", 0.02f), ("Dragon", "VAdagger_moder", 0.02f), ("Dragon", "VASpearModer", 0.02f), ("Dragon", "VAModer_greatsword", 0.02f), ("Dragon", "VASwordModer", 0.02f), ("Dragon", "VAModer_Axe", 0.02f), ("Dragon", "VAModer_dualaxes", 0.02f), ("GoblinKing", "VAYagluthAtgeir", 0.05f), ("GoblinKing", "VAYagluth_greatsword", 0.05f), ("GoblinKing", "VAFist_Yagluth", 0.05f), ("SeekerQueen", "VAdagger_queen", 0.04f), ("SeekerQueen", "VAQueen_bow", 0.04f), ("SeekerQueen", "VASwordQueen", 0.04f), ("SeekerQueen", "VAQueen_greatsword", 0.04f), ("Fader", "VASpearFader", 0.05f), ("Fader", "VASwordFader", 0.05f), ("Fader", "VAGreatswordFader", 0.05f) }; private void Awake() { _logger = ((BaseUnityPlugin)this).Logger; _logger.LogInfo((object)"AllInOneMod initializing..."); _harmony.PatchAll(Assembly.GetExecutingAssembly()); ItemManager.OnItemsRegistered += OnItemsRegistered; _logger.LogInfo((object)"All patches applied successfully."); } private void OnItemsRegistered() { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ObjectDB.instance is null in OnItemsRegistered!"); return; } PatchLightSourceFuel(); PatchCart(); PatchCrossbowStamina(instance); PatchBowStamina(instance); PatchKnifeWrench(instance); PatchKnifeViper(instance); PatchDualAxeDemonic(instance); PatchAxeEarly(instance); PatchArrowBone(instance); PatchBoatParts(instance); PatchHoneyFood(instance); PatchSpellslingerArmor(instance); PatchArmoryModArmor(instance); PatchThrowAxes(instance); PatchFood(instance); PatchShield(instance); PatchAllBossDrops(instance); PatchKnives(instance); _logger.LogInfo((object)"[AllInOneMod] Items patched in OnItemsRegistered!"); } private static void PatchKnives(ObjectDB db) { string[] array = new string[33] { "KnifeBlackMetal", "KnifeButcher", "KnifeChitin", "KnifeCopper", "KnifeFlint", "KnifeSilver", "KnifeSkollAndHati", "KnifeWood", "DualKnifeBone_TW", "DualKnifeChitin_TW", "DualKnifeIron_TW", "DualKnifeSilver_TW", "DualKnifeBM_TW", "DualKnifeFlametal_TW", "KnifeViper_TW", "KnifeBronze_TW", "KnifeIron_TW", "KnifeWrench_TW", "VAdagger_meteor_2h_blood", "VAdagger_meteor_2h_lightning", "VAdagger_meteor_2h_nature", "VAdagger_meteor_2h", "VAdagger_meteor_blood", "VAdagger_meteor_lightning", "VAdagger_meteor_nature", "VAdagger_meteor", "VAdagger_queen", "VABonemassDagger", "VAdagger_moder_2h", "VAdagger_moder", "VAdagger_copper_2h", "VAAntler_dagger", "VAdagger_blackmetal_mistlands" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float maxDurability = shared.m_maxDurability; float durabilityPerLevel = shared.m_durabilityPerLevel; shared.m_maxDurability += 50f; shared.m_durabilityPerLevel += 25f; _logger.LogInfo((object)($"[AllInOneMod] {text} durability: {maxDurability} -> {shared.m_maxDurability}, " + $"durabilityPerLevel: {durabilityPerLevel} -> {shared.m_durabilityPerLevel}")); } } private static void PatchCart() { string text = "Cart"; GameObject val = null; PieceTable[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { foreach (GameObject piece in array[i].m_pieces) { if (!((Object)(object)piece == (Object)null) && !(((Object)piece).name != text)) { val = piece; break; } } if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); return; } Vagon component = val.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] Vagon not found on " + text + ".")); return; } WearNTear component2 = val.GetComponent(); if ((Object)(object)component2 == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] WearNTear not found on " + text + ".")); return; } float itemWeightMassFactor = component.m_itemWeightMassFactor; float health = component2.m_health; component.m_itemWeightMassFactor *= 0.8f; component2.m_health *= 2f; _logger.LogInfo((object)("[AllInOneMod] " + text + " updated: " + $"ItemWeightMassFactor {itemWeightMassFactor} -> {component.m_itemWeightMassFactor}, " + $"Health {health} -> {component2.m_health}")); } private static void PatchLightSourceFuel() { string[] source = new string[12] { "fire_pit", "fire_pit_iron", "bonfire", "hearth", "piece_groundtorch", "piece_groundtorch_wood", "piece_groundtorch_green", "piece_groundtorch_blue", "piece_brazierfloor01", "piece_brazierfloor02", "piece_walltorch", "piece_brazierceiling01" }; PieceTable[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { foreach (GameObject piece in array[i].m_pieces) { if (!((Object)(object)piece == (Object)null) && source.Contains(((Object)piece).name)) { Fireplace component = piece.GetComponent(); if (!((Object)(object)component == (Object)null)) { float maxFuel = component.m_maxFuel; float secPerFuel = component.m_secPerFuel; component.m_maxFuel = (float)Math.Ceiling(component.m_maxFuel * 1.5f / 2f) * 2f; component.m_secPerFuel = (float)(Math.Ceiling(component.m_secPerFuel * 1.2f / 2f / 60f) * 2.0 * 60.0); _logger.LogInfo((object)("[AllInOneMod] " + ((Object)piece).name + " updated: " + $"MaxFuel {maxFuel} -> {component.m_maxFuel}, " + $"SecPerFuel {secPerFuel} -> {component.m_secPerFuel}")); } } } } } private static void PatchBowStamina(ObjectDB db) { string[] array = new string[18] { "Bow", "BowFineWood", "BowHuntsman", "BowDraugrFang", "BowSpineSnap", "BowAshlands", "BowAshlandsBlood", "BowAshlandsStorm", "BowAshlandsRoot", "BowTrollBone_TW", "BowBlackmetal_TW", "GreatbowModer_TW", "GreatbowBlackmetal_TW", "GreatbowDvergr_TW", "VAQueen_bow", "VAAntler_Bow", "VABlood_bone_bow", "VAHeavy_Blood_Bone_Bow" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float drawStaminaDrain = shared.m_attack.m_drawStaminaDrain; shared.m_attack.m_drawStaminaDrain = (float)Math.Ceiling(shared.m_attack.m_drawStaminaDrain * 1.09f); _logger.LogInfo((object)$"[AllInOneMod] {text} updated: DrawStaminaDrain {drawStaminaDrain} -> {shared.m_attack.m_drawStaminaDrain}"); } } private static void PatchCrossbowStamina(ObjectDB db) { string[] array = new string[14] { "CrossbowArbalest", "CrossbowRipper", "CrossbowRipperBlood", "CrossbowRipperLightning", "CrossbowRipperNature", "CrossbowWood_TW", "CrossbowEikthyr_TW", "CrossbowBronze_TW", "CrossbowChitin_TW", "CrossbowIron_TW", "CrossbowSilver_TW", "CrossbowBlackmetal_TW", "VACrossbowModer", "VACrossbowElder" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float reloadStaminaDrain = shared.m_attack.m_reloadStaminaDrain; float reloadTime = shared.m_attack.m_reloadTime; shared.m_attack.m_reloadStaminaDrain = (float)Math.Ceiling(shared.m_attack.m_reloadStaminaDrain * 1.09f); shared.m_attack.m_reloadTime = 3f; _logger.LogInfo((object)("[AllInOneMod] " + text + " updated: " + $"ReloadStaminaDrain {reloadStaminaDrain} -> {shared.m_attack.m_reloadStaminaDrain}, " + $"ReloadTime {reloadTime} -> {shared.m_attack.m_reloadTime}")); } } private static void PatchBoatParts(ObjectDB db) { string[] array = new string[4] { "BBA_LargeHull", "BBA_Mast", "BBA_SmallHull", "BBA_SturdyHull" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } float weight = component.m_itemData.m_shared.m_weight; component.m_itemData.m_shared.m_weight = 100f; _logger.LogInfo((object)$"[AllInOneMod] {text} weight: {weight} -> 100"); } } private static void PatchHoneyFood(ObjectDB db) { string[] array = new string[23] { "HoneyCookedMeat", "HoneyCookedDeer", "HoneyCookedNeck", "HoneyTeriyakiSalmon", "HoneySausages", "HoneySerpentMeat", "HoneyMushroomSoup", "HoneyTeriyakiSalmonWrap", "HoneyCookedWolf", "OdinsDelight", "HoneyYellowStewLesser", "HoneyBread", "HoneyCookedLox", "HoneyDessertPie", "HoneyCookedHare", "HoneyCookedSeeker", "HoneyMushroomStew", "HoneyYellowStew", "HoneyHarePie", "HoneyCookedVoltureMeat", "HoneyCookedAsksvin", "SurtrsDelight", "KonungrOmelette" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float foodBurnTime = shared.m_foodBurnTime; shared.m_foodBurnTime = Mathf.Round((Mathf.Round(shared.m_foodBurnTime / 60f) * 0.85f - 1f) / 2f + 1f) * 60f * 2f; _logger.LogInfo((object)$"[AllInOneMod] {text} updated: BurnTime {foodBurnTime} -> {shared.m_foodBurnTime}"); } } private static void PatchKnifeViper(ObjectDB db) { GameObject itemPrefab = db.GetItemPrefab("KnifeViper_TW"); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] KnifeViper_TW prefab not found."); return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on KnifeViper_TW."); return; } component.m_itemData.m_shared.m_damages.m_poison = 7f; _logger.LogInfo((object)"[AllInOneMod] KnifeViper_TW damage set: poison = 7"); } private static void PatchDualAxeDemonic(ObjectDB db) { GameObject itemPrefab = db.GetItemPrefab("DualAxeDemonic_TW"); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] DualAxeDemonic_TW prefab not found."); return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on DualAxeDemonic_TW."); return; } component.m_itemData.m_shared.m_damages.m_fire = 11f; _logger.LogInfo((object)"[AllInOneMod] DualAxeDemonic_TW damage set: fire = 11"); } private static void PatchKnifeWrench(ObjectDB db) { GameObject itemPrefab = db.GetItemPrefab("KnifeWrench_TW"); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] KnifeWrench_TW prefab not found."); return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on KnifeWrench_TW."); return; } component.m_itemData.m_shared.m_damages.m_blunt = 24f; component.m_itemData.m_shared.m_damages.m_pierce = 18f; _logger.LogInfo((object)"[AllInOneMod] KnifeWrench_TW damage set: blunt = 24, pierce = 18"); } private static void PatchAxeEarly(ObjectDB db) { GameObject itemPrefab = db.GetItemPrefab("AxeEarly"); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] AxeEarly prefab not found."); return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on AxeEarly."); return; } component.m_itemData.m_shared.m_damages.m_chop = 36f; component.m_itemData.m_shared.m_damagesPerLevel.m_chop = 2f; component.m_itemData.m_shared.m_damages.m_slash = 20f; component.m_itemData.m_shared.m_damagesPerLevel.m_slash = 4f; _logger.LogInfo((object)"[AllInOneMod] AxeEarly damage set: chop = 36, slash = 20"); } private static void PatchArrowBone(ObjectDB db) { GameObject itemPrefab = db.GetItemPrefab("ArrowBone_TW"); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ArrowBone_TW prefab not found."); return; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)"[AllInOneMod] ItemDrop component not found on ArrowBone_TW."); return; } component.m_itemData.m_shared.m_damages.m_blunt = 0f; component.m_itemData.m_shared.m_damages.m_pierce = 30f; _logger.LogInfo((object)"[AllInOneMod] ArrowBone_TW damage set: blunt = 0, pierce = 30"); } private static void PatchSpellslingerArmor(ObjectDB db) { string[] array = new string[15] { "HelmetSpellslinger_BlackForest_TW", "ArmorSpellSlingerChest_BlackForest_TW", "ArmorSpellslingerLegs_BlackForest_TW", "HelmetSpellslinger_Swamp_TW", "ArmorSpellSlingerChest_Swamp_TW", "ArmorSpellslingerLegs_Swamp_TW", "HelmetSpellslinger_Mountain_TW", "ArmorSpellSlingerChest_Mountain_TW", "ArmorSpellslingerLegs_Mountain_TW", "HelmetSpellslinger_Plains_TW", "ArmorSpellSlingerChest_Plains_TW", "ArmorSpellslingerLegs_Plains_TW", "HelmetSpellslinger_Mistlands_TW", "ArmorSpellSlingerChest_Mistlands_TW", "ArmorSpellslingerLegs_Mistlands_TW" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float armor = shared.m_armor; float armorPerLevel = shared.m_armorPerLevel; shared.m_armor += 1f; shared.m_armorPerLevel += 2f; _logger.LogInfo((object)("[AllInOneMod] " + text + " armor updated: " + $"m_armor {armor} -> {shared.m_armor}, " + $"m_armorPerLevel {armorPerLevel} -> {shared.m_armorPerLevel}")); } } private static void PatchArmoryModArmor(ObjectDB db) { string[] array = new string[15] { "HelmetRazorback_TW", "ArmorRazorbackChest_TW", "ArmorRazorbackLegs_TW", "HelmetHunterCarapace_TW", "ArmorHunterChestCarapace_TW", "ArmorHunterLegsCarapace_TW", "HelmetRogueCarapace_TW", "ArmorRogueCarapaceChest_TW", "ArmorRogueCarapaceLegs_TW", "HelmetVigorousCarapace_TW", "ArmorVigorousCarapaceChest_TW", "ArmorVigorousCarapaceLegs_TW", "HelmetFenrirCarapace_TW", "ArmorFenrirCarapaceChest_TW", "ArmorFenrirCarapaceLegs_TW" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; float armorPerLevel = shared.m_armorPerLevel; shared.m_armorPerLevel += 2f; _logger.LogInfo((object)("[AllInOneMod] " + text + " armor updated: " + $"m_armorPerLevel {armorPerLevel} -> {shared.m_armorPerLevel}")); } } private static void PatchThrowAxes(ObjectDB db) { string[] array = new string[6] { "ThrowAxeFlint_TW", "ThrowAxeBronze_TW", "ThrowAxeIron_TW", "ThrowAxeSilver_TW", "ThrowAxeBlackmetal_TW", "ThrowAxeDvergr_TW" }; foreach (string text in array) { GameObject itemPrefab = db.GetItemPrefab(text); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + text + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + text + ".")); continue; } SharedData shared = component.m_itemData.m_shared; shared.m_damages.m_slash = Mathf.Round(shared.m_damages.m_slash * 1.1f / 2f) * 2f; shared.m_damages.m_chop = Mathf.Round(shared.m_damages.m_chop * 1.1f / 2f) * 2f; shared.m_attack.m_attackStamina = Mathf.Round(shared.m_attack.m_attackStamina * 0.9f / 2f) * 2f; shared.m_secondaryAttack.m_attackStamina = Mathf.Round(shared.m_secondaryAttack.m_attackStamina * 0.9f / 2f) * 2f; _logger.LogInfo((object)("[AllInOneMod] " + text + " updated: +10% slash & chop (rounded to even), -10% stamina costs (rounded to even)")); } } private static void PatchShield(ObjectDB db) { foreach (KeyValuePair> item in new Dictionary> { { "ShieldSerpentscale", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.15f }, { "m_blockPower", 66f } } }, { "ShieldBlackmetalTower", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 115f } } }, { "ShieldBoneTower", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 34f } } }, { "ShieldFlametalTower", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 156f } } }, { "ShieldIronTower", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 57f } } }, { "ShieldWoodTower", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 11f } } }, { "ShieldBronzeTower_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 37f } } }, { "ShieldChitinTower_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 46f } } }, { "ShieldCarapaceTower_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_movementModifier", -0.2f }, { "m_blockPower", 137f } } }, { "ShieldBronzeBuckler", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 16f } } }, { "ShieldCarapaceBuckler", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 73f } } }, { "ShieldIronBuckler", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 27f } } }, { "ShieldChitinBuckler_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 21f } } }, { "ShieldSilverBuckler_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 37f } } }, { "ShieldBlackmetalBuckler_TW", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 56f } } }, { "ShieldBanded", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldBlackmetal", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldCarapace", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldFlametal", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldSilver", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldWood", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldBronzeBanded_TW", new Dictionary { { "m_maxQuality", 4 } } }, { "ShieldChitin_TW", new Dictionary { { "m_maxQuality", 4 } } }, { "VAdverger_tower", new Dictionary { { "m_movementModifier", -0.2f }, { "m_maxQuality", 4 }, { "m_blockPower", 127f } } }, { "VAsilver_tower", new Dictionary { { "m_movementModifier", -0.2f }, { "m_maxQuality", 4 } } }, { "VAModer_shield", new Dictionary { { "m_movementModifier", -0.2f }, { "m_maxQuality", 4 }, { "m_blockPower", 101f } } }, { "VAModer_RoundShield", new Dictionary { { "m_maxQuality", 4 } } }, { "VAElderRoundShield", new Dictionary { { "m_maxQuality", 4 } } }, { "VAserpent_buckler", new Dictionary { { "m_maxQuality", 4 }, { "m_blockPower", 38f } } } }) { string key = item.Key; Dictionary value = item.Value; GameObject itemPrefab = db.GetItemPrefab(key); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + key + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + key + ".")); continue; } SharedData shared = component.m_itemData.m_shared; foreach (KeyValuePair item2 in value) { string key2 = item2.Key; object value2 = item2.Value; FieldInfo field = ((object)shared).GetType().GetField(key2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value3 = field.GetValue(shared); field.SetValue(shared, value2); _logger.LogInfo((object)$"[AllInOneMod] {key}.{key2} updated: {value3} -> {value2}"); } else { _logger.LogInfo((object)("[AllInOneMod] " + key + "." + key2 + " not found on ItemDrop.m_shared")); } } } } private static void PatchFood(ObjectDB db) { foreach (KeyValuePair> item in new Dictionary> { { "FeastAshlands", new Dictionary { { "m_food", 85f }, { "m_foodStamina", 85f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 7f } } }, { "FeastMistlands", new Dictionary { { "m_food", 75f }, { "m_foodStamina", 75f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 6f } } }, { "FeastPlains", new Dictionary { { "m_food", 65f }, { "m_foodStamina", 65f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 5f } } }, { "FeastMountains", new Dictionary { { "m_food", 55f }, { "m_foodStamina", 55f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 4f } } }, { "FeastOceans", new Dictionary { { "m_food", 50f }, { "m_foodStamina", 50f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 4f } } }, { "FeastSwamps", new Dictionary { { "m_food", 45f }, { "m_foodStamina", 45f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 4f } } }, { "FeastBlackforest", new Dictionary { { "m_food", 40f }, { "m_foodStamina", 40f }, { "m_foodBurnTime", 2400f }, { "m_foodRegen", 4f } } }, { "FeastMeadows", new Dictionary { { "m_foodBurnTime", 2400f }, { "m_foodRegen", 3f } } }, { "QueensJam", new Dictionary { { "m_foodBurnTime", 1500f }, { "m_foodRegen", 1f } } }, { "FishCooked", new Dictionary { { "m_food", 50f }, { "m_foodStamina", 12f } } }, { "DeerStew", new Dictionary { { "m_food", 43f }, { "m_foodStamina", 18f } } }, { "MinceMeatSauce", new Dictionary { { "m_food", 42f }, { "m_foodStamina", 15f } } }, { "ShocklateSmoothie", new Dictionary { { "m_food", 13f }, { "m_foodStamina", 57f }, { "m_foodBurnTime", 1020f }, { "m_foodRegen", 0f } } }, { "Sausages", new Dictionary { { "m_food", 57f }, { "m_foodStamina", 15f }, { "m_foodBurnTime", 1620f } } }, { "BlackSoup", new Dictionary { { "m_foodStamina", 23f } } }, { "SerpentMeatCooked", new Dictionary { { "m_foodStamina", 13f } } }, { "SerpentStew", new Dictionary { { "m_food", 83f }, { "m_foodStamina", 19f } } }, { "OnionSoup", new Dictionary { { "m_foodBurnTime", 1380f } } }, { "Eyescream", new Dictionary { { "m_food", 17f }, { "m_foodStamina", 67f }, { "m_foodBurnTime", 1380f } } }, { "FishWraps", new Dictionary { { "m_foodBurnTime", 1620f } } }, { "BloodPudding", new Dictionary { { "m_food", 21f } } }, { "MeatPlatter", new Dictionary { { "m_food", 83f }, { "m_foodStamina", 21f } } }, { "FishAndBread", new Dictionary { { "m_food", 27f }, { "m_foodStamina", 93f }, { "m_foodBurnTime", 1620f } } }, { "CookedFoxMeat_TW", new Dictionary { { "m_foodStamina", 27f } } }, { "MixedGrill_TW", new Dictionary { { "m_food", 65f }, { "m_foodStamina", 30f }, { "m_foodRegen", 4f } } }, { "CookedSharkMeat_TW", new Dictionary { { "m_food", 34f }, { "m_foodBurnTime", 1500f } } }, { "SeekerAspic", new Dictionary { { "m_food", 70f }, { "m_foodStamina", 41f }, { "m_foodEitr", 23f } } }, { "MagicallyStuffedShroom", new Dictionary { { "m_food", 45f }, { "m_foodStamina", 27f }, { "m_foodEitr", 56f } } }, { "YggdrasilPorridge", new Dictionary { { "m_food", 27f }, { "m_foodStamina", 17f }, { "m_foodEitr", 85f } } }, { "BoarJerky", new Dictionary { { "m_food", 26f }, { "m_foodStamina", 26f }, { "m_foodBurnTime", 1500f } } }, { "WolfJerky", new Dictionary { { "m_food", 38f }, { "m_foodStamina", 38f }, { "m_foodBurnTime", 1500f } } }, { "FoxJerky_TW", new Dictionary { { "m_food", 28f }, { "m_foodStamina", 28f }, { "m_foodBurnTime", 1500f } } }, { "BearJerky_TW", new Dictionary { { "m_food", 39f }, { "m_foodStamina", 39f }, { "m_foodBurnTime", 1500f } } }, { "HoneyNeckJerky", new Dictionary { { "m_food", 20f }, { "m_foodStamina", 20f }, { "m_foodBurnTime", 1500f } } }, { "HoneyDeerJerky", new Dictionary { { "m_food", 27f }, { "m_foodStamina", 27f }, { "m_foodBurnTime", 1500f } } }, { "HoneyLoxJerky", new Dictionary { { "m_food", 41f }, { "m_foodStamina", 41f }, { "m_foodBurnTime", 1500f } } }, { "Mistharesupreme", new Dictionary { { "m_foodBurnTime", 1800f } } }, { "CookedBearSteak_TW", new Dictionary { { "m_food", 43f }, { "m_foodStamina", 25f }, { "m_foodRegen", 5f } } }, { "CookedBjornMeat", new Dictionary { { "m_food", 47f }, { "m_foodStamina", 13f }, { "m_foodRegen", 4f } } } }) { string key = item.Key; Dictionary value = item.Value; GameObject itemPrefab = db.GetItemPrefab(key); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] " + key + " prefab not found.")); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] ItemDrop not found on " + key + ".")); continue; } SharedData shared = component.m_itemData.m_shared; foreach (KeyValuePair item2 in value) { string key2 = item2.Key; object value2 = item2.Value; FieldInfo field = ((object)shared).GetType().GetField(key2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value3 = field.GetValue(shared); field.SetValue(shared, value2); _logger.LogInfo((object)$"[AllInOneMod] {key}.{key2} updated: {value3} -> {value2}"); } else { _logger.LogInfo((object)("[AllInOneMod] " + key + "." + key2 + " not found on ItemDrop.m_shared")); } } } } private static void PatchAllBossDrops(ObjectDB db) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0137: Expected O, but got Unknown foreach (IGrouping item3 in from e in BossDropTable group e by e.Boss) { string key = item3.Key; ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab(key) : null); if ((Object)(object)val == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] Boss prefab not found: " + key)); continue; } CharacterDrop component = val.GetComponent(); if ((Object)(object)component == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] CharacterDrop not found on " + key)); continue; } foreach (var item4 in item3) { string item = item4.Item2; float item2 = item4.Item3; GameObject itemPrefab = db.GetItemPrefab(item); if ((Object)(object)itemPrefab == (Object)null) { _logger.LogInfo((object)("[AllInOneMod] Item prefab not found: " + item)); continue; } component.m_drops.Add(new Drop { m_prefab = itemPrefab, m_amountMin = 1, m_amountMax = 1, m_chance = item2, m_onePerPlayer = false, m_levelMultiplier = false, m_dontScale = false }); _logger.LogInfo((object)$"[AllInOneMod] Added {item} → {key} ({item2 * 100f:0}%)"); } } } }