using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Agents;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GTFO.API.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Player;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("InfectionDeathPenalty")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfectionDeathPenalty")]
[assembly: AssemblyTitle("InfectionDeathPenalty")]
[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 InfectionDeathPenalty
{
[HarmonyPatch]
internal static class Patch
{
[HarmonyPatch(typeof(Dam_PlayerDamageBase), "ReceiveSetDead")]
[HarmonyPrefix]
public static void OnPlayerDown(Dam_PlayerDamageBase __instance)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
PlayerAgent owner = __instance.Owner;
if ((Object)(object)owner == (Object)null || !((Agent)owner).Alive || owner.Owner.IsBot || !((Agent)owner).IsLocallyOwned)
{
return;
}
float infection = __instance.Infection;
float num = 0.85f;
if (!(infection >= num))
{
float amount = Plugin.InfectionPercentage.Value / 100f;
pInfection val = default(pInfection);
val.amount = amount;
val.mode = (pInfectionMode)1;
pInfection val2 = val;
__instance.ModifyInfection(val2, true, true);
if (__instance.Infection > num)
{
val = default(pInfection);
val.amount = num;
val.mode = (pInfectionMode)0;
pInfection val3 = val;
__instance.ModifyInfection(val3, false, false);
}
}
}
}
[BepInPlugin("Heaveness.InfectionDeathPenalty", "InfectionDeathPenalty", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BasePlugin
{
public static ConfigEntry<float> InfectionPercentage;
public override void Load()
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
InfectionPercentage = ((BasePlugin)this).Config.Bind<float>("Settings", "InfectionPercentage", 10f, new ConfigDescription("Infection percent to apply when a player goes down. Does accept decimal values.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 85f), Array.Empty<object>()));
((BasePlugin)this).Log.LogInfo((object)"InfectionDeathPenalty is loaded!");
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Infection percentage set to: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(InfectionPercentage.Value);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("%");
}
log.LogInfo(val);
LiveEditListener val2 = LiveEdit.CreateListener(Paths.ConfigPath, Path.GetFileName(((BasePlugin)this).Config.ConfigFilePath), false);
val2.FileChangedEventCooldown = 0.75f;
val2.FileChanged += (LiveEditEventHandler)delegate
{
((BasePlugin)this).Config.Reload();
((BasePlugin)this).Log.LogInfo((object)"LiveEdit: InfectionDeathPenalty Configuration reloaded");
};
new Harmony("Heaveness.InfectionDeathPenalty").PatchAll();
}
}
}