using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using On;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: AssemblyCompany("NoFoodLoss")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoFoodLoss")]
[assembly: AssemblyTitle("NoFoodLoss")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 NoFoodLoss
{
[BepInPlugin("NoFoodLoss", "NoFoodLoss", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static float timeReduction;
private void Awake()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin NoFoodLoss is loaded!");
Player.OnDeath += new hook_OnDeath(OnDeath);
timeReduction = Mathf.Clamp01(((BaseUnityPlugin)this).Config.Bind<float>("Configuration", "Duration Penalty", 50f, "How much to reduce the duration of food buffs by when dying, as a percentage (ie, 50 would be 50% reduction)").Value * 0.01f);
}
private void OnDeath(orig_OnDeath orig, Player self)
{
List<Food> list = self.m_foods.ToArray().ToList();
orig.Invoke(self);
if (!((Character)self).m_nview.IsOwner())
{
return;
}
foreach (Food item in list)
{
item.m_time *= 1f - timeReduction;
}
self.m_foods.AddRange(list);
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "NoFoodLoss";
public const string PLUGIN_NAME = "NoFoodLoss";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}