Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Valheim Rebalanced v0.1.3
ValheimRebalanced.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ValheimRebalanced")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValheimRebalanced")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("836b3b93-5d51-4ad2-ac91-61f5f04733bb")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ValheimMod; [BepInPlugin("microman502.ValheimRebalanced", "Valheim Rebalanced", "0.1.3")] [BepInProcess("valheim.exe")] public class ValheimRebalanced : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("microman502.ValheimRebalanced"); public static ManualLogSource logger = Logger.CreateLogSource("ValheimRebalanced"); private AssetBundle itemBundle; private void Awake() { harmony.PatchAll(); LoadResources(); AddItems(); AddPieces(); AddRecipes(); AddConversions(); PrefabManager.OnVanillaPrefabsAvailable += OnVanillaPrefabsAvailable; } private void OnVanillaPrefabsAvailable() { PrefabManager.OnVanillaPrefabsAvailable -= OnVanillaPrefabsAvailable; AddPrefabs(); } private void AddPrefabs() { AddPrefab(itemBundle, "resinbomb_explosion", fixReferences: true); AddPrefab(itemBundle, "resinbomb_projectile", fixReferences: true); } private void LoadResources() { itemBundle = AssetUtils.LoadAssetBundleFromResources("customitems"); CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); localization.AddJsonFile("English", AssetUtils.LoadTextFromResources("english.json", Assembly.GetExecutingAssembly())); } private void AddItems() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Expected O, but got Unknown //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Expected O, but got Unknown //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown ItemConfig val = new ItemConfig(); val.Amount = 1; val.AddRequirement(new RequirementConfig("Flint", 14, 7, false)); val.AddRequirement(new RequirementConfig("Wood", 12, 6, false)); val.AddRequirement(new RequirementConfig("LeatherScraps", 6, 3, false)); val.CraftingStation = "piece_workbench"; val.MinStationLevel = 2; CustomItem val2 = new CustomItem(itemBundle, "BattleaxeFlint", true, val); ItemManager.Instance.AddItem(val2); ItemConfig val3 = new ItemConfig(); val3.Amount = 5; val3.AddRequirement(new RequirementConfig("Resin", 10, 0, false)); val3.AddRequirement(new RequirementConfig("Coal", 5, 0, false)); val3.AddRequirement(new RequirementConfig("LeatherScraps", 3, 0, false)); val3.CraftingStation = "piece_workbench"; val3.MinStationLevel = 2; CustomItem val4 = new CustomItem(itemBundle, "BombResin", true, val3); ItemManager.Instance.AddItem(val4); AddRecipe("Recipe_BombResin5Alt", "BombResin", 5, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Resin", Amount = 10 }, new RequirementConfig { Item = "Coal", Amount = 5 }, new RequirementConfig { Item = "TrollHide", Amount = 2 } }); ItemConfig val5 = new ItemConfig(); val5.Amount = 1; val5.AddRequirement(new RequirementConfig("Bronze", 4, 2, false)); val5.AddRequirement(new RequirementConfig("LeatherScraps", 5, 3, false)); val5.AddRequirement(new RequirementConfig("Resin", 12, 6, false)); val5.CraftingStation = "forge"; val5.MinStationLevel = 1; CustomItem val6 = new CustomItem(itemBundle, "ExplorersTorch", true, val5); ItemManager.Instance.AddItem(val6); ItemConfig val7 = new ItemConfig(); val7.Amount = 3; val7.AddRequirement(new RequirementConfig("Honey", 2, 0, false)); val7.AddRequirement(new RequirementConfig("MushroomYellow", 4, 0, false)); val7.AddRequirement(new RequirementConfig("Dandelion", 8, 0, false)); val7.CraftingStation = "piece_cauldron"; val7.MinStationLevel = 1; CustomItem val8 = new CustomItem(itemBundle, "YellowSoup", true, val7); ItemManager.Instance.AddItem(val8); ItemConfig val9 = new ItemConfig(); val9.Amount = 2; val9.AddRequirement(new RequirementConfig("Sap", 2, 0, false)); val9.AddRequirement(new RequirementConfig("MushroomJotunPuffs", 5, 0, false)); val9.AddRequirement(new RequirementConfig("BugMeat", 2, 0, false)); val9.CraftingStation = "piece_cauldron"; val9.MinStationLevel = 5; CustomItem val10 = new CustomItem(itemBundle, "MistBroth", true, val9); ItemManager.Instance.AddItem(val10); } private void AddPieces() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown PieceConfig val = new PieceConfig(); val.AddRequirement(new RequirementConfig("YggdrasilWood", 15, 0, true)); val.AddRequirement(new RequirementConfig("QueenBee", 2, 0, true)); val.AddRequirement(new RequirementConfig("Eitr", 7, 0, true)); val.CraftingStation = "piece_workbench"; val.PieceTable = "Hammer"; CustomPiece val2 = new CustomPiece(itemBundle, "piece_queenshive", true, val); PieceManager.Instance.AddPiece(val2); } private void AddConversions() { } private void RemoveRecipes() { ItemManager.Instance.RemoveRecipe("Recipe_Bronze"); ItemManager.Instance.RemoveRecipe("Recipe_Bronze5"); ItemManager.Instance.RemoveRecipe("Recipe_Onionsoup"); ItemManager.Instance.RemoveRecipe("Recipe_FishAndBread"); } private void AddRecipes() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0050: Expected O, but got Unknown //IL_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Expected O, but got Unknown //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Expected O, but got Unknown //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Expected O, but got Unknown //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Expected O, but got Unknown //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Expected O, but got Unknown AddRecipe("Recipe_Bronze2", "Bronze", 2, "forge", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Tin", Amount = 1 }, new RequirementConfig { Item = "Copper", Amount = 2 } }); AddRecipe("Recipe_Bronze10", "Bronze", 10, "forge", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Tin", Amount = 5 }, new RequirementConfig { Item = "Copper", Amount = 10 } }); AddRecipe("Recipe_FineWood", "FineWood", 3, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "FineWood", Amount = 1 }, new RequirementConfig { Item = "AncientSeed", Amount = 1 } }); AddRecipe("Recipe_Wood", "Wood", 4, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Wood", Amount = 1 }, new RequirementConfig { Item = "AncientSeed", Amount = 1 } }); AddRecipe("Recipe_RoundLog", "RoundLog", 4, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "RoundLog", Amount = 1 }, new RequirementConfig { Item = "AncientSeed", Amount = 1 } }); AddRecipe("Recipe_AmberPearl", "AmberPearl", 1, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[1] { new RequirementConfig { Item = "Amber", Amount = 2 } }); AddRecipe("Recipe_HoeNoWorkbench", "Hoe", 1, null, (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Wood", Amount = 5 }, new RequirementConfig { Item = "Stone", Amount = 2 } }); AddRecipe("Recipe_OozeBomb5Alt", "BombOoze", 5, "piece_workbench", (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Pukeberries", Amount = 3 }, new RequirementConfig { Item = "Ooze", Amount = 2 }, new RequirementConfig { Item = "Resin", Amount = 5 } }); AddRecipe("Recipe_SledgeStagbreakerAlt", "SledgeStagbreaker", 1, "piece_workbench", 2, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "RoundLog", Amount = 20 }, new RequirementConfig { Item = "TrophyBoar", Amount = 5 }, new RequirementConfig { Item = "LeatherScraps", Amount = 2 } }); AddRecipe("Recipe_OnionSoupRebalanced", "OnionSoup", 1, "piece_cauldron", 3, (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Onion", Amount = 3 }, new RequirementConfig { Item = "BoarJerky", Amount = 1 } }); AddRecipe("Recipe_OnionSoupAlt", "OnionSoup", 1, "piece_cauldron", 3, (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Onion", Amount = 1 }, new RequirementConfig { Item = "CarrotSoup", Amount = 1 } }); AddRecipe("Recipe_SaladAltStamina", "Salad", 3, "piece_cauldron", 5, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "MushroomJotunPuffs", Amount = 3 }, new RequirementConfig { Item = "OnionSoup", Amount = 1 }, new RequirementConfig { Item = "TurnipStew", Amount = 1 } }); AddRecipe("Recipe_SaladAltMisc", "Salad", 3, "piece_cauldron", 5, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "MushroomJotunPuffs", Amount = 3 }, new RequirementConfig { Item = "OnionSoup", Amount = 1 }, new RequirementConfig { Item = "BlackSoup", Amount = 1 } }); AddRecipe("Recipe_FishAndBreadRebalanced", "FishAndBreadUncooked", 2, "piece_cauldron", 5, (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "FishAnglerRaw", Amount = 1 }, new RequirementConfig { Item = "BreadDough", Amount = 2 } }); AddRecipe("Recipe_ShocklateSmoothieAlt", "ShocklateSmoothie", 1, "piece_cauldron", 2, (RequirementConfig[])(object)new RequirementConfig[2] { new RequirementConfig { Item = "Ooze", Amount = 1 }, new RequirementConfig { Item = "QueensJam", Amount = 1 } }); AddRecipe("Recipe_SausagesAlt", "Sausages", 4, "piece_cauldron", 2, (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Entrails", Amount = 4 }, new RequirementConfig { Item = "NeckTail", Amount = 4 }, new RequirementConfig { Item = "Thistle", Amount = 1 } }); } private void AddRecipe(string recipeName, string recipeResult, int recipeResultAmount, string craftingStation, RequirementConfig[] requirements) { AddRecipe(recipeName, recipeResult, recipeResultAmount, craftingStation, 0, requirements); } private void AddRecipe(string recipeName, string recipeResult, int recipeResultAmount, string craftingStation, int stationLevel, RequirementConfig[] requirements) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown CustomRecipe val = new CustomRecipe(new RecipeConfig { CraftingStation = craftingStation, MinStationLevel = stationLevel, Item = recipeResult, Name = recipeName, Amount = recipeResultAmount, Requirements = requirements }); ItemManager.Instance.AddRecipe(val); } private void AddPrefab(AssetBundle bundle, string prefabName, bool fixReferences) { AddPrefab(bundle.LoadAsset<GameObject>(prefabName), fixReferences); } private void AddPrefab(GameObject prefab, bool fixReferences) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown CustomPrefab val = new CustomPrefab(prefab, fixReferences); PrefabManager.Instance.AddPrefab(val); } private void FixReference(AssetBundle bundle, string prefabName, bool recursive) { FixReference(bundle.LoadAsset<GameObject>(prefabName), recursive); } private void FixReference(GameObject prefab, bool recursive) { PrefabExtension.FixReferences(prefab, recursive); } } [HarmonyPatch] public static class Patches { private static string[] removingResources = new string[4] { "Recipe_Bronze", "Recipe_Bronze5", "Recipe_Onionsoup", "Recipe_FishAndBread" }; public static ManualLogSource logger = Logger.CreateLogSource("ValheimRebalanced"); public static bool IsObjectDBGood() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0; } [HarmonyPostfix] [HarmonyPatch(typeof(ObjectDB), "Awake")] public static void ObjectDB_Awake_DebugPatch(ref ObjectDB __instance) { if (!IsObjectDBGood()) { return; } List<Recipe> recipes = __instance.m_recipes; for (int i = 0; i < recipes.Count; i++) { for (int j = 0; j < removingResources.Length; j++) { if (((Object)recipes[i]).name == removingResources[j]) { recipes.RemoveAt(i--); } } } __instance.m_recipes = recipes; } [HarmonyPrefix] [HarmonyPatch(typeof(Smelter), "Spawn")] public static bool Smelter_Spawn_Patch(Smelter __instance, string ore, ref int stack) { if (ore == "IronScrap") { stack = 2; } return true; } [HarmonyPrefix] [HarmonyPatch(typeof(SE_Wet), "Setup")] public static bool SE_Wet_Setup_Patch(SE_Wet __instance, ref float ___m_raiseSkillModifier, ref SkillType ___m_raiseSkill) { ___m_raiseSkill = (SkillType)999; ___m_raiseSkillModifier = 1.25f; return true; } }