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 RefreshFoodAnytime v1.0.0
RefreshFoodAnytime.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("RefreshFoodAnytime")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RefreshFoodAnytime")] [assembly: AssemblyTitle("RefreshFoodAnytime")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RefreshFoodAnytime { [BepInPlugin("local.refreshfoodanytime", "Refresh Food Anytime", "1.0.0")] [BepInProcess("valheim.exe")] public class Plugin : BaseUnityPlugin { private static int eatDepth; private static ConfigEntry<bool> enabled; private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_0129: Expected O, but got Unknown enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Allow eating food again at any time, not only below 50% remaining."); Harmony val = new Harmony("local.refreshfoodanytime"); Type type = AccessTools.Inner(typeof(Player), "Food"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "CanEatAgain", (Type[])null, (Type[])null)); if (methodInfo == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find Player.Food.CanEatAgain - mod disabled. Valheim may have changed."); return; } val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "CanEatAgainPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); string[] array = new string[2] { "CanEat", "EatFood" }; foreach (string text in array) { MethodInfo methodInfo2 = AccessTools.Method(typeof(Player), text, (Type[])null, (Type[])null); if (methodInfo2 == null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Could not find Player." + text + " - mod may not work.")); } else { val.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(Plugin), "EnterPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "ExitFinalizer", (Type[])null), (HarmonyMethod)null); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Refresh Food Anytime loaded."); } private static void EnterPrefix() { eatDepth++; } private static void ExitFinalizer() { if (eatDepth > 0) { eatDepth--; } } private static void CanEatAgainPostfix(ref bool __result) { if (enabled.Value && eatDepth > 0) { __result = true; } } } }