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 BepInEx.Logging;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using On;
using TMPro;
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: AssemblyCompany("lacrivoca.DeathQuota")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4c389b3c02219e609ed70093452ee32c174ad89d")]
[assembly: AssemblyProduct("DeathQuota")]
[assembly: AssemblyTitle("lacrivoca.DeathQuota")]
[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.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;
}
}
[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 DeathQuota
{
[BepInPlugin("lacrivoca.DeathQuota", "DeathQuota", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
public class DeathQuota : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_ApplyPenalty <0>__HUDManager_ApplyPenalty;
}
public static DeathQuota Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
Hook();
Logger.LogInfo((object)"lacrivoca.DeathQuota v1.0.0 has loaded!");
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
internal static void Hook()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
object obj = <>O.<0>__HUDManager_ApplyPenalty;
if (obj == null)
{
hook_ApplyPenalty val = HUDManager_ApplyPenalty;
<>O.<0>__HUDManager_ApplyPenalty = val;
obj = (object)val;
}
HUDManager.ApplyPenalty += (hook_ApplyPenalty)obj;
}
private static void HUDManager_ApplyPenalty(orig_ApplyPenalty orig, HUDManager self, int playersDead, int bodiesInsured)
{
float num = 0.2f;
int num2 = TimeOfDay.Instance.profitQuota;
bodiesInsured = Mathf.Max(bodiesInsured, 0);
if (bodiesInsured == playersDead)
{
Logger.LogDebug((object)"DeathQuota: All bodies collected.");
((TMP_Text)self.statsUIElements.penaltyAddition).text = string.Format("{0} casualties: -{1}%\n(All bodies recovered)", playersDead, num * 100f * (float)(playersDead - bodiesInsured), bodiesInsured);
((TMP_Text)self.statsUIElements.penaltyTotal).text = $"PROFIT MARGINS DEEMED ACCEPTABLE. QUOTA UNCHANGED.";
TimeOfDay.Instance.profitQuota = num2;
return;
}
for (int i = 0; i < playersDead - bodiesInsured; i++)
{
num2 += (int)((float)num2 * num);
}
for (int j = 0; j < bodiesInsured; j++)
{
num2 += (int)((float)num2 * (num / 2.5f));
}
((TMP_Text)self.statsUIElements.penaltyAddition).text = $"{playersDead} casualties: -{num * 100f * (float)(playersDead - bodiesInsured)}%\n({bodiesInsured} bodies recovered)";
((TMP_Text)self.statsUIElements.penaltyTotal).text = $"QUOTA INCREASED TO: ${num2}";
TimeOfDay.Instance.profitQuota = num2;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "lacrivoca.DeathQuota";
public const string PLUGIN_NAME = "DeathQuota";
public const string PLUGIN_VERSION = "1.0.0";
}
}