Decompiled source of StartingEitr v1.0.3

StartingEitr.dll

Decompiled a day ago
using 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.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 Tom.StartingEitr
{
	[BepInPlugin("tom.valheim.startingeitr", "Starting Eitr", "1.0.3")]
	public sealed class StartingEitr : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		private static class FoodEitrPatch
		{
			[HarmonyPostfix]
			private static void Postfix(ref float eitr)
			{
				if (BaseEitr != null)
				{
					eitr += BaseEitr.Value;
				}
			}
		}

		internal static ConfigEntry<float> BaseEitr;

		private Harmony harmony;

		private void Awake()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			BaseEitr = ((BaseUnityPlugin)this).Config.Bind<float>("General", "BaseEitr", 25f, new ConfigDescription("Eitr added to every player's food Eitr total.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 250f), Array.Empty<object>()));
			harmony = new Harmony("tom.valheim.startingeitr");
			harmony.PatchAll(typeof(StartingEitr).Assembly);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Starting Eitr loaded: " + BaseEitr.Value));
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}