using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TheForest.Utils;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SOTFHealingOverTime")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SOTFHealingOverTime")]
[assembly: AssemblyTitle("SOTFHealingOverTime")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace SOTFHealingOverTime
{
[BepInPlugin("com.dryzler.sotf.healingovertime", "Dryzler's Healing Over Time", "1.0.1")]
public class SOTFMod : BasePlugin
{
[HarmonyPatch(typeof(FirstPersonCharacter), "Update")]
private static class FirstPersonCharacter_Update_Patch
{
private static DateTime lastDateTime = DateTime.Now;
private static bool Prefix(FirstPersonCharacter __instance)
{
if (LocalPlayer.Vitals.IsHealing())
{
return true;
}
if ((DateTime.Now - lastDateTime).TotalSeconds >= 1.0)
{
lastDateTime = DateTime.Now;
float value = MinutesMaxFullness.Value;
float value2 = MinutesNoFullness.Value;
float num = (value - value2) / 100f * LocalPlayer.Vitals.GetFullness() + value2;
float num2 = LocalPlayer.Vitals.GetMaxHealth() / (num * 60f);
float num3 = LocalPlayer.Vitals.GetHealth() + num2;
if (num3 > LocalPlayer.Vitals.GetMaxHealth())
{
num3 = LocalPlayer.Vitals.GetMaxHealth();
}
LocalPlayer.Vitals.SetHealth(num3);
}
return true;
}
}
private readonly Harmony harmony = new Harmony("com.dryzler.sotf.healingovertime");
public static ConfigEntry<float> MinutesMaxFullness { get; private set; }
public static ConfigEntry<float> MinutesNoFullness { get; private set; }
public override void Load()
{
MinutesMaxFullness = ((BasePlugin)this).Config.Bind<float>("Dryzlers Healing Over Time", "100% fullness", 5f, "Minutes to heal 100% when 100% fullness");
MinutesNoFullness = ((BasePlugin)this).Config.Bind<float>("Dryzlers Healing Over Time", "0% fullness", 20f, "Minutes to heal 100% when 0% fullness");
harmony.PatchAll();
}
}
}