Decompiled source of OneMoreMeal v1.0.0

OneMoreMeal.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
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("OneMoreMeal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OneMoreMeal")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a6577b0f-52a5-4a4e-969d-e2844121e4b7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[BepInPlugin("com.zhaila.valheim.onemoremeal", "OneMoreMeal", "1.0.0")]
public class OneMoreMealMod : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.zhaila.valheim.onemoremeal");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(Player), "EatFood")]
public static class EatFoodPatch
{
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_3)
			{
				list[i].opcode = OpCodes.Ldc_I4_4;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Player), "CanEat")]
public static class CanEatPatch
{
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		for (int i = 0; i < list.Count; i++)
		{
			if (list[i].opcode == OpCodes.Ldc_I4_3)
			{
				list[i].opcode = OpCodes.Ldc_I4_4;
			}
		}
		return list;
	}
}
[HarmonyPatch(typeof(Hud), "Awake")]
public static class HudPatch
{
	private static void Postfix(Hud __instance)
	{
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: 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_0132: Expected O, but got Unknown
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		Array.Resize(ref __instance.m_foodBars, 4);
		Array.Resize(ref __instance.m_foodIcons, 4);
		Array.Resize(ref __instance.m_foodTime, 4);
		GameObject val = Object.Instantiate<GameObject>(((Component)__instance.m_foodBars[0]).gameObject, ((Component)__instance.m_foodBars[0]).transform.parent);
		__instance.m_foodBars[3] = val.GetComponent<Image>();
		val.transform.SetParent(((Component)__instance.m_foodBars[0]).transform.parent, false);
		val.transform.localPosition = ((Component)__instance.m_foodBars[0]).transform.localPosition + new Vector3(0f, 138f, 0f);
		Transform parent = ((Component)__instance.m_foodIcons[0]).transform.parent;
		GameObject val2 = Object.Instantiate<GameObject>(((Component)parent).gameObject, parent.parent);
		val2.transform.SetParent(parent.parent, false);
		val2.transform.localPosition = parent.localPosition + new Vector3(0f, 138f, 0f);
		foreach (Transform item in val2.transform)
		{
			Transform val3 = item;
			Object.Destroy((Object)(object)((Component)val3).gameObject);
		}
		val2.transform.SetSiblingIndex(parent.GetSiblingIndex());
		GameObject val4 = Object.Instantiate<GameObject>(((Component)__instance.m_foodIcons[0]).gameObject, ((Component)__instance.m_foodIcons[0]).transform.parent);
		__instance.m_foodIcons[3] = val4.GetComponent<Image>();
		val4.transform.SetParent(((Component)__instance.m_foodIcons[0]).transform.parent, false);
		val4.transform.localPosition = ((Component)__instance.m_foodIcons[0]).transform.localPosition + new Vector3(0f, 138f, 0f);
		GameObject val5 = Object.Instantiate<GameObject>(((Component)__instance.m_foodTime[0]).gameObject, __instance.m_foodTime[0].transform.parent);
		__instance.m_foodTime[3] = (TMP_Text)(object)val5.GetComponent<TextMeshProUGUI>();
		val5.transform.SetParent(__instance.m_foodTime[0].transform.parent, false);
		val5.transform.localPosition = __instance.m_foodTime[0].transform.localPosition + new Vector3(0f, 138f, 0f);
	}
}