using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; 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("ClassLibrary1MyFirstValheimMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ClassLibrary1MyFirstValheimMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d44b3159-ab39-42ba-93fa-b0490bff8e9b")] [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 ClassLibrary1MyFirstValheimMod; [BepInPlugin("com.mansvards.lessgrind", "Less Grind Mod", "1.0.0")] public class LessGrindPlugin : BaseUnityPlugin { private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mans pirmais modis ir veiksmīgi iedarbināts!"); Harmony val = new Harmony("com.mansvards.lessgrind"); val.PatchAll(); } } [HarmonyPatch(typeof(ObjectDB), "Awake")] internal static class Patch_ObjectDB_Awake { private static void Postfix(ObjectDB __instance) { if ((Object)(object)__instance == (Object)null || __instance.m_recipes == null) { return; } foreach (Recipe recipe in __instance.m_recipes) { if ((Object)(object)recipe == (Object)null || recipe.m_resources == null) { continue; } Requirement[] resources = recipe.m_resources; foreach (Requirement val in resources) { if (val != null) { if (val.m_amount > 1) { val.m_amount = (int)Math.Max(1.0, (double)val.m_amount * 0.5); } if (val.m_amountPerLevel > 1) { val.m_amountPerLevel = (int)Math.Max(1.0, (double)val.m_amountPerLevel * 0.5); } } } } } }