using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[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 NeverDie
{
[BepInPlugin("com.example.neverdie", "Never Die", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "com.example.neverdie";
public static BoolField Enabled;
public static IntField MinHealth;
private void Awake()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
PluginConfigurator obj = PluginConfigurator.Create("Never Die", "com.example.neverdie");
Enabled = new BoolField(obj.rootPanel, "Enabled", "field.enabled", true);
MinHealth = new IntField(obj.rootPanel, "Minimum Health (lowest HP V1 can reach)", "field.minhealth", 1, 1, 100, true, true);
new Harmony("com.example.neverdie").PatchAll(typeof(NewMovementPatches));
((BaseUnityPlugin)this).Logger.LogInfo((object)"Never Die loaded.");
}
}
[HarmonyPatch(typeof(NewMovement))]
internal static class NewMovementPatches
{
private static int Floor()
{
int value = Plugin.MinHealth.value;
if (value >= 1)
{
return value;
}
return 1;
}
[HarmonyPrefix]
[HarmonyPatch("GetHurt")]
private static void GetHurtPrefix(NewMovement __instance, ref int damage)
{
if (Plugin.Enabled.value && !__instance.dead)
{
int num = __instance.hp - Floor();
if (num < 0)
{
num = 0;
}
if (damage > num)
{
damage = num;
}
}
}
[HarmonyPostfix]
[HarmonyPatch("Update")]
private static void UpdatePostfix(NewMovement __instance)
{
if (Plugin.Enabled.value && !__instance.dead)
{
int num = Floor();
if (__instance.hp < num)
{
__instance.hp = num;
}
}
}
}
}